mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 19:22:53 +01:00
Add checkboxes to 'Apply duration limits' dialog (#3412)
This commit is contained in:
parent
a72b2a204e
commit
bff81dc4d0
@ -234,6 +234,8 @@ namespace Nikse.SubtitleEdit.Core
|
||||
public int AdjustDurationPercent { get; set; }
|
||||
public string AdjustDurationLast { get; set; }
|
||||
public bool AutoBreakCommaBreakEarly { get; set; }
|
||||
public bool ApplyMinimumDurationLimit { get; set; }
|
||||
public bool ApplyMaximumDurationLimit { get; set; }
|
||||
|
||||
public ToolsSettings()
|
||||
{
|
||||
@ -326,6 +328,8 @@ namespace Nikse.SubtitleEdit.Core
|
||||
AdjustDurationSeconds = 0.1m;
|
||||
AdjustDurationPercent = 120;
|
||||
AutoBreakCommaBreakEarly = true;
|
||||
ApplyMinimumDurationLimit = true;
|
||||
ApplyMaximumDurationLimit = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3254,6 +3258,18 @@ $HorzAlign = Center
|
||||
settings.Tools.AutoBreakCommaBreakEarly = Convert.ToBoolean(subNode.InnerText);
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("ApplyMinimumDurationLimit");
|
||||
if (subNode != null)
|
||||
{
|
||||
settings.Tools.ApplyMinimumDurationLimit = Convert.ToBoolean(subNode.InnerText);
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("ApplyMaximumDurationLimit");
|
||||
if (subNode != null)
|
||||
{
|
||||
settings.Tools.ApplyMaximumDurationLimit = Convert.ToBoolean(subNode.InnerText);
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("FindHistory");
|
||||
if (subNode != null)
|
||||
{
|
||||
@ -5874,7 +5890,9 @@ $HorzAlign = Center
|
||||
textWriter.WriteElementString("AdjustDurationPercent", settings.Tools.AdjustDurationPercent.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("AdjustDurationLast", settings.Tools.AdjustDurationLast);
|
||||
textWriter.WriteElementString("AutoBreakCommaBreakEarly", settings.Tools.AutoBreakCommaBreakEarly.ToString());
|
||||
|
||||
textWriter.WriteElementString("ApplyMinimumDurationLimit", settings.Tools.ApplyMinimumDurationLimit.ToString());
|
||||
textWriter.WriteElementString("ApplyMaximumDurationLimit", settings.Tools.ApplyMaximumDurationLimit.ToString());
|
||||
|
||||
if (settings.Tools.FindHistory != null && settings.Tools.FindHistory.Count > 0)
|
||||
{
|
||||
const int maximumFindHistoryItems = 10;
|
||||
|
57
src/Forms/ApplyDurationLimits.Designer.cs
generated
57
src/Forms/ApplyDurationLimits.Designer.cs
generated
@ -28,8 +28,6 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.labelMaxDuration = new System.Windows.Forms.Label();
|
||||
this.labelMinDuration = new System.Windows.Forms.Label();
|
||||
this.numericUpDownDurationMax = new System.Windows.Forms.NumericUpDown();
|
||||
this.numericUpDownDurationMin = new System.Windows.Forms.NumericUpDown();
|
||||
this.labelNote = new System.Windows.Forms.Label();
|
||||
@ -44,6 +42,8 @@
|
||||
this.groupBoxUnfixable = new System.Windows.Forms.GroupBox();
|
||||
this.subtitleListView1 = new Nikse.SubtitleEdit.Controls.SubtitleListView();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.checkBoxMinDuration = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxMaxDuration = new System.Windows.Forms.CheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDurationMax)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDurationMin)).BeginInit();
|
||||
this.groupBoxFixesAvailable.SuspendLayout();
|
||||
@ -54,27 +54,9 @@
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// labelMaxDuration
|
||||
//
|
||||
this.labelMaxDuration.AutoSize = true;
|
||||
this.labelMaxDuration.Location = new System.Drawing.Point(13, 48);
|
||||
this.labelMaxDuration.Name = "labelMaxDuration";
|
||||
this.labelMaxDuration.Size = new System.Drawing.Size(133, 13);
|
||||
this.labelMaxDuration.TabIndex = 48;
|
||||
this.labelMaxDuration.Text = "Max. duration, milliseconds";
|
||||
//
|
||||
// labelMinDuration
|
||||
//
|
||||
this.labelMinDuration.AutoSize = true;
|
||||
this.labelMinDuration.Location = new System.Drawing.Point(12, 21);
|
||||
this.labelMinDuration.Name = "labelMinDuration";
|
||||
this.labelMinDuration.Size = new System.Drawing.Size(130, 13);
|
||||
this.labelMinDuration.TabIndex = 47;
|
||||
this.labelMinDuration.Text = "Min. duration, milliseconds";
|
||||
//
|
||||
// numericUpDownDurationMax
|
||||
//
|
||||
this.numericUpDownDurationMax.Location = new System.Drawing.Point(191, 46);
|
||||
this.numericUpDownDurationMax.Location = new System.Drawing.Point(191, 38);
|
||||
this.numericUpDownDurationMax.Maximum = new decimal(new int[] {
|
||||
50000,
|
||||
0,
|
||||
@ -99,7 +81,7 @@
|
||||
//
|
||||
// numericUpDownDurationMin
|
||||
//
|
||||
this.numericUpDownDurationMin.Location = new System.Drawing.Point(191, 19);
|
||||
this.numericUpDownDurationMin.Location = new System.Drawing.Point(191, 12);
|
||||
this.numericUpDownDurationMin.Maximum = new decimal(new int[] {
|
||||
2000,
|
||||
0,
|
||||
@ -262,17 +244,39 @@
|
||||
this.splitContainer1.SplitterDistance = 302;
|
||||
this.splitContainer1.TabIndex = 54;
|
||||
//
|
||||
// checkBoxMinDuration
|
||||
//
|
||||
this.checkBoxMinDuration.AutoSize = true;
|
||||
this.checkBoxMinDuration.Location = new System.Drawing.Point(16, 13);
|
||||
this.checkBoxMinDuration.Name = "checkBoxMinDuration";
|
||||
this.checkBoxMinDuration.Size = new System.Drawing.Size(149, 17);
|
||||
this.checkBoxMinDuration.TabIndex = 55;
|
||||
this.checkBoxMinDuration.Text = "Min. duration, milliseconds";
|
||||
this.checkBoxMinDuration.UseVisualStyleBackColor = true;
|
||||
this.checkBoxMinDuration.CheckedChanged += new System.EventHandler(this.checkBoxMinDuration_CheckedChanged);
|
||||
//
|
||||
// checkBoxMaxDuration
|
||||
//
|
||||
this.checkBoxMaxDuration.AutoSize = true;
|
||||
this.checkBoxMaxDuration.Location = new System.Drawing.Point(16, 39);
|
||||
this.checkBoxMaxDuration.Name = "checkBoxMaxDuration";
|
||||
this.checkBoxMaxDuration.Size = new System.Drawing.Size(152, 17);
|
||||
this.checkBoxMaxDuration.TabIndex = 56;
|
||||
this.checkBoxMaxDuration.Text = "Max. duration, milliseconds";
|
||||
this.checkBoxMaxDuration.UseVisualStyleBackColor = true;
|
||||
this.checkBoxMaxDuration.CheckedChanged += new System.EventHandler(this.checkBoxMaxDuration_CheckedChanged);
|
||||
//
|
||||
// ApplyDurationLimits
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(961, 571);
|
||||
this.Controls.Add(this.checkBoxMaxDuration);
|
||||
this.Controls.Add(this.checkBoxMinDuration);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonOK);
|
||||
this.Controls.Add(this.labelNote);
|
||||
this.Controls.Add(this.labelMaxDuration);
|
||||
this.Controls.Add(this.labelMinDuration);
|
||||
this.Controls.Add(this.numericUpDownDurationMax);
|
||||
this.Controls.Add(this.numericUpDownDurationMin);
|
||||
this.KeyPreview = true;
|
||||
@ -300,9 +304,6 @@
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label labelMaxDuration;
|
||||
private System.Windows.Forms.Label labelMinDuration;
|
||||
private System.Windows.Forms.NumericUpDown numericUpDownDurationMax;
|
||||
private System.Windows.Forms.NumericUpDown numericUpDownDurationMin;
|
||||
private System.Windows.Forms.Label labelNote;
|
||||
@ -317,5 +318,7 @@
|
||||
private System.Windows.Forms.GroupBox groupBoxUnfixable;
|
||||
private Controls.SubtitleListView subtitleListView1;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.CheckBox checkBoxMinDuration;
|
||||
private System.Windows.Forms.CheckBox checkBoxMaxDuration;
|
||||
}
|
||||
}
|
@ -22,8 +22,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
InitializeComponent();
|
||||
UiUtil.FixFonts(this);
|
||||
Text = Configuration.Settings.Language.ApplyDurationLimits.Title;
|
||||
labelMinDuration.Text = Configuration.Settings.Language.Settings.DurationMinimumMilliseconds;
|
||||
labelMaxDuration.Text = Configuration.Settings.Language.Settings.DurationMaximumMilliseconds;
|
||||
checkBoxMinDuration.Text = Configuration.Settings.Language.Settings.DurationMinimumMilliseconds;
|
||||
checkBoxMaxDuration.Text = Configuration.Settings.Language.Settings.DurationMaximumMilliseconds;
|
||||
checkBoxMinDuration.Checked = Configuration.Settings.Tools.ApplyMinimumDurationLimit;
|
||||
checkBoxMaxDuration.Checked = Configuration.Settings.Tools.ApplyMaximumDurationLimit;
|
||||
labelNote.Text = Configuration.Settings.Language.AdjustDisplayDuration.Note;
|
||||
numericUpDownDurationMin.Value = Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds;
|
||||
numericUpDownDurationMax.Value = Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds;
|
||||
@ -82,8 +84,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_working = new Subtitle(_subtitle);
|
||||
listViewFixes.BeginUpdate();
|
||||
listViewFixes.Items.Clear();
|
||||
FixShortDisplayTimes();
|
||||
FixLongDisplayTimes();
|
||||
if (checkBoxMinDuration.Checked)
|
||||
{
|
||||
FixShortDisplayTimes();
|
||||
}
|
||||
if (checkBoxMaxDuration.Checked)
|
||||
{
|
||||
FixLongDisplayTimes();
|
||||
}
|
||||
listViewFixes.EndUpdate();
|
||||
|
||||
groupBoxFixesAvailable.Text = string.Format(Configuration.Settings.Language.ApplyDurationLimits.FixesAvailable, _totalFixes);
|
||||
@ -203,10 +211,19 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void buttonOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
Configuration.Settings.Tools.ApplyMinimumDurationLimit = checkBoxMinDuration.Checked;
|
||||
Configuration.Settings.Tools.ApplyMaximumDurationLimit = checkBoxMaxDuration.Checked;
|
||||
|
||||
_onlyListFixes = false;
|
||||
_working = new Subtitle(_subtitle);
|
||||
FixShortDisplayTimes();
|
||||
FixLongDisplayTimes();
|
||||
if (checkBoxMinDuration.Checked)
|
||||
{
|
||||
FixShortDisplayTimes();
|
||||
}
|
||||
if (checkBoxMaxDuration.Checked)
|
||||
{
|
||||
FixLongDisplayTimes();
|
||||
}
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
@ -237,5 +254,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
listViewFixes.Focus();
|
||||
}
|
||||
|
||||
private void checkBoxMinDuration_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
GeneratePreview();
|
||||
}
|
||||
|
||||
private void checkBoxMaxDuration_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
GeneratePreview();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user