More minor tweaks to avoid unwated scrollwheel numeric up/down change + better handling of numeric up/down change

This commit is contained in:
niksedk 2015-08-20 18:24:15 +02:00
parent c254fd3c72
commit fcaf2434e6
6 changed files with 98 additions and 25 deletions

View File

@ -42,12 +42,13 @@
this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader8 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader8 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.groupBoxUnfixable = new System.Windows.Forms.GroupBox(); this.groupBoxUnfixable = new System.Windows.Forms.GroupBox();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.subtitleListView1 = new Nikse.SubtitleEdit.Controls.SubtitleListView(); this.subtitleListView1 = new Nikse.SubtitleEdit.Controls.SubtitleListView();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDurationMax)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownDurationMax)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDurationMin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownDurationMin)).BeginInit();
this.groupBoxFixesAvailable.SuspendLayout(); this.groupBoxFixesAvailable.SuspendLayout();
this.groupBoxUnfixable.SuspendLayout(); this.groupBoxUnfixable.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout(); this.splitContainer1.SuspendLayout();
@ -93,6 +94,8 @@
0, 0,
0}); 0});
this.numericUpDownDurationMax.ValueChanged += new System.EventHandler(this.numericUpDownDurationMax_ValueChanged); this.numericUpDownDurationMax.ValueChanged += new System.EventHandler(this.numericUpDownDurationMax_ValueChanged);
this.numericUpDownDurationMax.KeyUp += new System.Windows.Forms.KeyEventHandler(this.numericUpDownDurationMax_KeyUp);
this.numericUpDownDurationMax.MouseUp += new System.Windows.Forms.MouseEventHandler(this.numericUpDownDurationMax_MouseUp);
// //
// numericUpDownDurationMin // numericUpDownDurationMin
// //
@ -116,6 +119,8 @@
0, 0,
0}); 0});
this.numericUpDownDurationMin.ValueChanged += new System.EventHandler(this.numericUpDownDurationMin_ValueChanged); this.numericUpDownDurationMin.ValueChanged += new System.EventHandler(this.numericUpDownDurationMin_ValueChanged);
this.numericUpDownDurationMin.KeyUp += new System.Windows.Forms.KeyEventHandler(this.numericUpDownDurationMin_KeyUp);
this.numericUpDownDurationMin.MouseUp += new System.Windows.Forms.MouseEventHandler(this.numericUpDownDurationMin_MouseUp);
// //
// labelNote // labelNote
// //
@ -213,6 +218,29 @@
this.groupBoxUnfixable.TabStop = false; this.groupBoxUnfixable.TabStop = false;
this.groupBoxUnfixable.Text = "Unable to fix min duration: {0}"; this.groupBoxUnfixable.Text = "Unable to fix min duration: {0}";
// //
// subtitleListView1
//
this.subtitleListView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.subtitleListView1.DisplayExtraFromExtra = false;
this.subtitleListView1.FirstVisibleIndex = -1;
this.subtitleListView1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.subtitleListView1.FullRowSelect = true;
this.subtitleListView1.GridLines = true;
this.subtitleListView1.HideSelection = false;
this.subtitleListView1.Location = new System.Drawing.Point(6, 19);
this.subtitleListView1.Name = "subtitleListView1";
this.subtitleListView1.OwnerDraw = true;
this.subtitleListView1.Size = new System.Drawing.Size(919, 129);
this.subtitleListView1.SubtitleFontBold = false;
this.subtitleListView1.SubtitleFontName = "Tahoma";
this.subtitleListView1.SubtitleFontSize = 8;
this.subtitleListView1.TabIndex = 111;
this.subtitleListView1.UseCompatibleStateImageBehavior = false;
this.subtitleListView1.UseSyntaxColoring = true;
this.subtitleListView1.View = System.Windows.Forms.View.Details;
//
// splitContainer1 // splitContainer1
// //
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -235,26 +263,6 @@
this.splitContainer1.SplitterDistance = 302; this.splitContainer1.SplitterDistance = 302;
this.splitContainer1.TabIndex = 54; this.splitContainer1.TabIndex = 54;
// //
// subtitleListView1
//
this.subtitleListView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.subtitleListView1.DisplayExtraFromExtra = false;
this.subtitleListView1.FirstVisibleIndex = -1;
this.subtitleListView1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.subtitleListView1.FullRowSelect = true;
this.subtitleListView1.GridLines = true;
this.subtitleListView1.HideSelection = false;
this.subtitleListView1.Location = new System.Drawing.Point(6, 19);
this.subtitleListView1.Name = "subtitleListView1";
this.subtitleListView1.OwnerDraw = true;
this.subtitleListView1.Size = new System.Drawing.Size(919, 129);
this.subtitleListView1.TabIndex = 111;
this.subtitleListView1.UseCompatibleStateImageBehavior = false;
this.subtitleListView1.UseSyntaxColoring = true;
this.subtitleListView1.View = System.Windows.Forms.View.Details;
//
// ApplyDurationLimits // ApplyDurationLimits
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -277,6 +285,7 @@
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Apply duration limits"; this.Text = "Apply duration limits";
this.Shown += new System.EventHandler(this.ApplyDurationLimits_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ApplyDurationLimits_KeyDown); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ApplyDurationLimits_KeyDown);
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDurationMax)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownDurationMax)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDurationMin)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownDurationMin)).EndInit();
@ -284,6 +293,7 @@
this.groupBoxUnfixable.ResumeLayout(false); this.groupBoxUnfixable.ResumeLayout(false);
this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false); this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Globalization;
using System.Windows.Forms; using System.Windows.Forms;
using Nikse.SubtitleEdit.Logic; using Nikse.SubtitleEdit.Logic;
@ -193,5 +194,31 @@ namespace Nikse.SubtitleEdit.Forms
{ {
get { return _working; } get { return _working; }
} }
private void numericUpDownDurationMin_KeyUp(object sender, KeyEventArgs e)
{
GeneratePreview();
}
private void numericUpDownDurationMax_KeyUp(object sender, KeyEventArgs e)
{
GeneratePreview();
}
private void numericUpDownDurationMin_MouseUp(object sender, MouseEventArgs e)
{
GeneratePreview();
}
private void numericUpDownDurationMax_MouseUp(object sender, MouseEventArgs e)
{
GeneratePreview();
}
private void ApplyDurationLimits_Shown(object sender, EventArgs e)
{
listViewFixes.Focus();
}
} }
} }

View File

@ -115,6 +115,8 @@
0, 0,
0}); 0});
this.numericUpDownMaxMs.ValueChanged += new System.EventHandler(this.numericUpDownMaxMs_ValueChanged); this.numericUpDownMaxMs.ValueChanged += new System.EventHandler(this.numericUpDownMaxMs_ValueChanged);
this.numericUpDownMaxMs.KeyUp += new System.Windows.Forms.KeyEventHandler(this.numericUpDownMaxMs_KeyUp);
this.numericUpDownMaxMs.Validated += new System.EventHandler(this.numericUpDownMaxMs_Validated);
// //
// labelBridgePart1 // labelBridgePart1
// //
@ -210,6 +212,8 @@
0, 0,
0}); 0});
this.numericUpDownMinMsBetweenLines.ValueChanged += new System.EventHandler(this.numericUpDownMinMsBetweenLines_ValueChanged); this.numericUpDownMinMsBetweenLines.ValueChanged += new System.EventHandler(this.numericUpDownMinMsBetweenLines_ValueChanged);
this.numericUpDownMinMsBetweenLines.KeyUp += new System.Windows.Forms.KeyEventHandler(this.numericUpDownMinMsBetweenLines_KeyUp);
this.numericUpDownMinMsBetweenLines.Validated += new System.EventHandler(this.numericUpDownMinMsBetweenLines_Validated);
// //
// DurationsBridgeGaps // DurationsBridgeGaps
// //

View File

@ -173,5 +173,25 @@ namespace Nikse.SubtitleEdit.Forms
SubtitleListview1.Focus(); SubtitleListview1.Focus();
} }
private void numericUpDownMaxMs_Validated(object sender, EventArgs e)
{
GeneratePreview();
}
private void numericUpDownMaxMs_KeyUp(object sender, KeyEventArgs e)
{
GeneratePreview();
}
private void numericUpDownMinMsBetweenLines_Validated(object sender, EventArgs e)
{
GeneratePreview();
}
private void numericUpDownMinMsBetweenLines_KeyUp(object sender, KeyEventArgs e)
{
GeneratePreview();
}
} }
} }

View File

@ -202,6 +202,7 @@
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Set minimum display time between paragraphs"; this.Text = "Set minimum display time between paragraphs";
this.Shown += new System.EventHandler(this.SetMinimumDisplayTimeBetweenParagraphs_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SetMinimalDisplayTimeDifference_KeyDown); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SetMinimalDisplayTimeDifference_KeyDown);
this.groupBoxLinesFound.ResumeLayout(false); this.groupBoxLinesFound.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMinMillisecondsBetweenLines)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMinMillisecondsBetweenLines)).EndInit();

View File

@ -50,6 +50,12 @@ namespace Nikse.SubtitleEdit.Forms
comboBoxFrameRate.SelectedIndex = 3; comboBoxFrameRate.SelectedIndex = 3;
} }
public override sealed string Text
{
get { return base.Text; }
set { base.Text = value; }
}
public Subtitle FixedSubtitle public Subtitle FixedSubtitle
{ {
get { return _fixedSubtitle; } get { return _fixedSubtitle; }
@ -62,12 +68,11 @@ namespace Nikse.SubtitleEdit.Forms
numericUpDownMinMillisecondsBetweenLines.Value = Configuration.Settings.General.MinimumMillisecondsBetweenLines != 0 numericUpDownMinMillisecondsBetweenLines.Value = Configuration.Settings.General.MinimumMillisecondsBetweenLines != 0
? Configuration.Settings.General.MinimumMillisecondsBetweenLines ? Configuration.Settings.General.MinimumMillisecondsBetweenLines
: 1; : 1;
//GeneratePreview();
} }
private void GeneratePreview() private void GeneratePreview()
{ {
List<int> fixes = new List<int>(); var fixes = new List<int>();
if (_subtitle == null) if (_subtitle == null)
return; return;
@ -144,9 +149,10 @@ namespace Nikse.SubtitleEdit.Forms
private void comboBoxFrameRate_SelectedIndexChanged(object sender, EventArgs e) private void comboBoxFrameRate_SelectedIndexChanged(object sender, EventArgs e)
{ {
double frameRate; double frameRate;
if (!double.TryParse(comboBoxFrameRate.Text.Trim().Replace(',', '.'), if (!double.TryParse(comboBoxFrameRate.Text.Trim().Replace(',', '.'), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out frameRate))
NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out frameRate)) {
frameRate = 25.0; frameRate = 25.0;
}
long ms = (long)Math.Round(1000 / frameRate); long ms = (long)Math.Round(1000 / frameRate);
labelOneFrameIsXMS.Text = string.Format(Configuration.Settings.Language.SetMinimumDisplayTimeBetweenParagraphs.OneFrameXisYMilliseconds, frameRate, ms); labelOneFrameIsXMS.Text = string.Format(Configuration.Settings.Language.SetMinimumDisplayTimeBetweenParagraphs.OneFrameXisYMilliseconds, frameRate, ms);
@ -157,6 +163,11 @@ namespace Nikse.SubtitleEdit.Forms
comboBoxFrameRate_SelectedIndexChanged(sender, e); comboBoxFrameRate_SelectedIndexChanged(sender, e);
} }
private void SetMinimumDisplayTimeBetweenParagraphs_Shown(object sender, EventArgs e)
{
SubtitleListview1.Focus();
}
} }
} }