Add "merge short lines" settings to batch convert

Work on #3867
This commit is contained in:
Nikolaj Olsson 2019-12-09 18:34:46 +01:00
parent b6864ea27e
commit dad17570f0
5 changed files with 211 additions and 67 deletions

View File

@ -258,6 +258,8 @@ namespace Nikse.SubtitleEdit.Core
public double AutoBreakPreferBottomPercent { get; set; }
public bool ApplyMinimumDurationLimit { get; set; }
public bool ApplyMaximumDurationLimit { get; set; }
public int MergeShortLinesMaxGap { get; set; }
public bool MergeShortLinesOnlyContinuous { get; set; }
public ToolsSettings()
{
@ -363,6 +365,8 @@ namespace Nikse.SubtitleEdit.Core
AutoBreakPreferBottomPercent = 5;
ApplyMinimumDurationLimit = true;
ApplyMaximumDurationLimit = true;
MergeShortLinesMaxGap = 250;
MergeShortLinesOnlyContinuous = true;
}
}
@ -3595,6 +3599,18 @@ $HorzAlign = Center
settings.Tools.ApplyMaximumDurationLimit = Convert.ToBoolean(subNode.InnerText);
}
subNode = node.SelectSingleNode("MergeShortLinesMaxGap");
if (subNode != null)
{
settings.Tools.MergeShortLinesMaxGap = Convert.ToInt32(subNode.InnerText);
}
subNode = node.SelectSingleNode("MergeShortLinesOnlyContinuous");
if (subNode != null)
{
settings.Tools.MergeShortLinesOnlyContinuous = Convert.ToBoolean(subNode.InnerText);
}
subNode = node.SelectSingleNode("FindHistory");
if (subNode != null)
{
@ -6342,6 +6358,8 @@ $HorzAlign = Center
textWriter.WriteElementString("AutoBreakPreferBottomPercent", settings.Tools.AutoBreakPreferBottomPercent.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("ApplyMinimumDurationLimit", settings.Tools.ApplyMinimumDurationLimit.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("ApplyMaximumDurationLimit", settings.Tools.ApplyMaximumDurationLimit.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("MergeShortLinesMaxGap", settings.Tools.MergeShortLinesMaxGap.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("MergeShortLinesOnlyContinuous", settings.Tools.MergeShortLinesOnlyContinuous.ToString(CultureInfo.InvariantCulture));
if (settings.Tools.FindHistory != null && settings.Tools.FindHistory.Count > 0)
{

View File

@ -29,7 +29,7 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
Nikse.SubtitleEdit.Core.TimeCode timeCode2 = new Nikse.SubtitleEdit.Core.TimeCode();
Nikse.SubtitleEdit.Core.TimeCode timeCode1 = new Nikse.SubtitleEdit.Core.TimeCode();
this.buttonConvert = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.groupBoxConvertOptions = new System.Windows.Forms.GroupBox();
@ -37,6 +37,11 @@
this.listViewConvertOptions = new System.Windows.Forms.ListView();
this.ActionCheckBox = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.Action = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.groupBoxChangeFrameRate = new System.Windows.Forms.GroupBox();
this.comboBoxFrameRateTo = new System.Windows.Forms.ComboBox();
this.labelToFrameRate = new System.Windows.Forms.Label();
this.comboBoxFrameRateFrom = new System.Windows.Forms.ComboBox();
this.labelFromFrameRate = new System.Windows.Forms.Label();
this.groupBoxOffsetTimeCodes = new System.Windows.Forms.GroupBox();
this.radioButtonShowLater = new System.Windows.Forms.RadioButton();
this.radioButtonShowEarlier = new System.Windows.Forms.RadioButton();
@ -52,11 +57,6 @@
this.radioButtonSpeedCustom = new System.Windows.Forms.RadioButton();
this.numericUpDownPercent = new System.Windows.Forms.NumericUpDown();
this.labelPercent = new System.Windows.Forms.Label();
this.groupBoxChangeFrameRate = new System.Windows.Forms.GroupBox();
this.comboBoxFrameRateTo = new System.Windows.Forms.ComboBox();
this.labelToFrameRate = new System.Windows.Forms.Label();
this.comboBoxFrameRateFrom = new System.Windows.Forms.ComboBox();
this.labelFromFrameRate = new System.Windows.Forms.Label();
this.groupBoxOutput = new System.Windows.Forms.GroupBox();
this.radioButtonSaveInOutputFolder = new System.Windows.Forms.RadioButton();
this.buttonTransportStreamSettings = new System.Windows.Forms.Button();
@ -91,15 +91,24 @@
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.labelStatus = new System.Windows.Forms.Label();
this.groupBoxMergeShortLines = new System.Windows.Forms.GroupBox();
this.checkBoxOnlyContinuationLines = new System.Windows.Forms.CheckBox();
this.numericUpDownMaxCharacters = new System.Windows.Forms.NumericUpDown();
this.numericUpDownMaxMillisecondsBetweenLines = new System.Windows.Forms.NumericUpDown();
this.labelMaxMillisecondsBetweenLines = new System.Windows.Forms.Label();
this.labelMaxCharacters = new System.Windows.Forms.Label();
this.groupBoxConvertOptions.SuspendLayout();
this.groupBoxChangeFrameRate.SuspendLayout();
this.groupBoxOffsetTimeCodes.SuspendLayout();
this.groupBoxFixRtl.SuspendLayout();
this.groupBoxSpeed.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownPercent)).BeginInit();
this.groupBoxChangeFrameRate.SuspendLayout();
this.groupBoxOutput.SuspendLayout();
this.groupBoxInput.SuspendLayout();
this.contextMenuStripFiles.SuspendLayout();
this.groupBoxMergeShortLines.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxCharacters)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxMillisecondsBetweenLines)).BeginInit();
this.SuspendLayout();
//
// buttonConvert
@ -130,6 +139,7 @@
//
this.groupBoxConvertOptions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxConvertOptions.Controls.Add(this.groupBoxMergeShortLines);
this.groupBoxConvertOptions.Controls.Add(this.buttonConvertOptionsSettings);
this.groupBoxConvertOptions.Controls.Add(this.listViewConvertOptions);
this.groupBoxConvertOptions.Controls.Add(this.groupBoxChangeFrameRate);
@ -180,6 +190,54 @@
//
this.Action.Width = 400;
//
// groupBoxChangeFrameRate
//
this.groupBoxChangeFrameRate.Controls.Add(this.comboBoxFrameRateTo);
this.groupBoxChangeFrameRate.Controls.Add(this.labelToFrameRate);
this.groupBoxChangeFrameRate.Controls.Add(this.comboBoxFrameRateFrom);
this.groupBoxChangeFrameRate.Controls.Add(this.labelFromFrameRate);
this.groupBoxChangeFrameRate.Location = new System.Drawing.Point(307, 12);
this.groupBoxChangeFrameRate.Name = "groupBoxChangeFrameRate";
this.groupBoxChangeFrameRate.Size = new System.Drawing.Size(269, 90);
this.groupBoxChangeFrameRate.TabIndex = 100;
this.groupBoxChangeFrameRate.TabStop = false;
this.groupBoxChangeFrameRate.Text = "Change frame rate";
this.groupBoxChangeFrameRate.Visible = false;
//
// comboBoxFrameRateTo
//
this.comboBoxFrameRateTo.FormattingEnabled = true;
this.comboBoxFrameRateTo.Location = new System.Drawing.Point(130, 46);
this.comboBoxFrameRateTo.Name = "comboBoxFrameRateTo";
this.comboBoxFrameRateTo.Size = new System.Drawing.Size(121, 21);
this.comboBoxFrameRateTo.TabIndex = 3;
//
// labelToFrameRate
//
this.labelToFrameRate.AutoSize = true;
this.labelToFrameRate.Location = new System.Drawing.Point(6, 50);
this.labelToFrameRate.Name = "labelToFrameRate";
this.labelToFrameRate.Size = new System.Drawing.Size(70, 13);
this.labelToFrameRate.TabIndex = 2;
this.labelToFrameRate.Text = "To frame rate";
//
// comboBoxFrameRateFrom
//
this.comboBoxFrameRateFrom.FormattingEnabled = true;
this.comboBoxFrameRateFrom.Location = new System.Drawing.Point(130, 17);
this.comboBoxFrameRateFrom.Name = "comboBoxFrameRateFrom";
this.comboBoxFrameRateFrom.Size = new System.Drawing.Size(121, 21);
this.comboBoxFrameRateFrom.TabIndex = 1;
//
// labelFromFrameRate
//
this.labelFromFrameRate.AutoSize = true;
this.labelFromFrameRate.Location = new System.Drawing.Point(6, 21);
this.labelFromFrameRate.Name = "labelFromFrameRate";
this.labelFromFrameRate.Size = new System.Drawing.Size(80, 13);
this.labelFromFrameRate.TabIndex = 0;
this.labelFromFrameRate.Text = "From frame rate";
//
// groupBoxOffsetTimeCodes
//
this.groupBoxOffsetTimeCodes.Controls.Add(this.radioButtonShowLater);
@ -226,14 +284,14 @@
this.timeUpDownAdjust.Name = "timeUpDownAdjust";
this.timeUpDownAdjust.Size = new System.Drawing.Size(96, 27);
this.timeUpDownAdjust.TabIndex = 1;
timeCode2.Hours = 0;
timeCode2.Milliseconds = 0;
timeCode2.Minutes = 0;
timeCode2.Seconds = 0;
timeCode2.TimeSpan = System.TimeSpan.Parse("00:00:00");
timeCode2.TotalMilliseconds = 0D;
timeCode2.TotalSeconds = 0D;
this.timeUpDownAdjust.TimeCode = timeCode2;
timeCode1.Hours = 0;
timeCode1.Milliseconds = 0;
timeCode1.Minutes = 0;
timeCode1.Seconds = 0;
timeCode1.TimeSpan = System.TimeSpan.Parse("00:00:00");
timeCode1.TotalMilliseconds = 0D;
timeCode1.TotalSeconds = 0D;
this.timeUpDownAdjust.TimeCode = timeCode1;
this.timeUpDownAdjust.UseVideoOffset = false;
//
// labelHourMinSecMilliSecond
@ -377,54 +435,6 @@
this.labelPercent.TabIndex = 12;
this.labelPercent.Text = "%";
//
// groupBoxChangeFrameRate
//
this.groupBoxChangeFrameRate.Controls.Add(this.comboBoxFrameRateTo);
this.groupBoxChangeFrameRate.Controls.Add(this.labelToFrameRate);
this.groupBoxChangeFrameRate.Controls.Add(this.comboBoxFrameRateFrom);
this.groupBoxChangeFrameRate.Controls.Add(this.labelFromFrameRate);
this.groupBoxChangeFrameRate.Location = new System.Drawing.Point(307, 12);
this.groupBoxChangeFrameRate.Name = "groupBoxChangeFrameRate";
this.groupBoxChangeFrameRate.Size = new System.Drawing.Size(269, 90);
this.groupBoxChangeFrameRate.TabIndex = 100;
this.groupBoxChangeFrameRate.TabStop = false;
this.groupBoxChangeFrameRate.Text = "Change frame rate";
this.groupBoxChangeFrameRate.Visible = false;
//
// comboBoxFrameRateTo
//
this.comboBoxFrameRateTo.FormattingEnabled = true;
this.comboBoxFrameRateTo.Location = new System.Drawing.Point(130, 46);
this.comboBoxFrameRateTo.Name = "comboBoxFrameRateTo";
this.comboBoxFrameRateTo.Size = new System.Drawing.Size(121, 21);
this.comboBoxFrameRateTo.TabIndex = 3;
//
// labelToFrameRate
//
this.labelToFrameRate.AutoSize = true;
this.labelToFrameRate.Location = new System.Drawing.Point(6, 50);
this.labelToFrameRate.Name = "labelToFrameRate";
this.labelToFrameRate.Size = new System.Drawing.Size(70, 13);
this.labelToFrameRate.TabIndex = 2;
this.labelToFrameRate.Text = "To frame rate";
//
// comboBoxFrameRateFrom
//
this.comboBoxFrameRateFrom.FormattingEnabled = true;
this.comboBoxFrameRateFrom.Location = new System.Drawing.Point(130, 17);
this.comboBoxFrameRateFrom.Name = "comboBoxFrameRateFrom";
this.comboBoxFrameRateFrom.Size = new System.Drawing.Size(121, 21);
this.comboBoxFrameRateFrom.TabIndex = 1;
//
// labelFromFrameRate
//
this.labelFromFrameRate.AutoSize = true;
this.labelFromFrameRate.Location = new System.Drawing.Point(6, 21);
this.labelFromFrameRate.Name = "labelFromFrameRate";
this.labelFromFrameRate.Size = new System.Drawing.Size(80, 13);
this.labelFromFrameRate.TabIndex = 0;
this.labelFromFrameRate.Text = "From frame rate";
//
// groupBoxOutput
//
this.groupBoxOutput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
@ -773,6 +783,94 @@
this.labelStatus.TabIndex = 9;
this.labelStatus.Text = "labelStatus";
//
// groupBoxMergeShortLines
//
this.groupBoxMergeShortLines.Controls.Add(this.checkBoxOnlyContinuationLines);
this.groupBoxMergeShortLines.Controls.Add(this.numericUpDownMaxCharacters);
this.groupBoxMergeShortLines.Controls.Add(this.numericUpDownMaxMillisecondsBetweenLines);
this.groupBoxMergeShortLines.Controls.Add(this.labelMaxMillisecondsBetweenLines);
this.groupBoxMergeShortLines.Controls.Add(this.labelMaxCharacters);
this.groupBoxMergeShortLines.Location = new System.Drawing.Point(308, 71);
this.groupBoxMergeShortLines.Name = "groupBoxMergeShortLines";
this.groupBoxMergeShortLines.Size = new System.Drawing.Size(268, 204);
this.groupBoxMergeShortLines.TabIndex = 304;
this.groupBoxMergeShortLines.TabStop = false;
this.groupBoxMergeShortLines.Text = "groupBox1";
//
// checkBoxOnlyContinuationLines
//
this.checkBoxOnlyContinuationLines.AutoSize = true;
this.checkBoxOnlyContinuationLines.Checked = true;
this.checkBoxOnlyContinuationLines.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxOnlyContinuationLines.Location = new System.Drawing.Point(16, 127);
this.checkBoxOnlyContinuationLines.Name = "checkBoxOnlyContinuationLines";
this.checkBoxOnlyContinuationLines.Size = new System.Drawing.Size(164, 17);
this.checkBoxOnlyContinuationLines.TabIndex = 42;
this.checkBoxOnlyContinuationLines.Text = "Only merge continuation lines";
this.checkBoxOnlyContinuationLines.UseVisualStyleBackColor = true;
//
// numericUpDownMaxCharacters
//
this.numericUpDownMaxCharacters.Location = new System.Drawing.Point(15, 41);
this.numericUpDownMaxCharacters.Maximum = new decimal(new int[] {
200,
0,
0,
0});
this.numericUpDownMaxCharacters.Minimum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDownMaxCharacters.Name = "numericUpDownMaxCharacters";
this.numericUpDownMaxCharacters.Size = new System.Drawing.Size(64, 20);
this.numericUpDownMaxCharacters.TabIndex = 38;
this.numericUpDownMaxCharacters.Value = new decimal(new int[] {
65,
0,
0,
0});
//
// numericUpDownMaxMillisecondsBetweenLines
//
this.numericUpDownMaxMillisecondsBetweenLines.Location = new System.Drawing.Point(15, 90);
this.numericUpDownMaxMillisecondsBetweenLines.Maximum = new decimal(new int[] {
2000,
0,
0,
0});
this.numericUpDownMaxMillisecondsBetweenLines.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDownMaxMillisecondsBetweenLines.Name = "numericUpDownMaxMillisecondsBetweenLines";
this.numericUpDownMaxMillisecondsBetweenLines.Size = new System.Drawing.Size(64, 20);
this.numericUpDownMaxMillisecondsBetweenLines.TabIndex = 39;
this.numericUpDownMaxMillisecondsBetweenLines.Value = new decimal(new int[] {
250,
0,
0,
0});
//
// labelMaxMillisecondsBetweenLines
//
this.labelMaxMillisecondsBetweenLines.AutoSize = true;
this.labelMaxMillisecondsBetweenLines.Location = new System.Drawing.Point(12, 73);
this.labelMaxMillisecondsBetweenLines.Name = "labelMaxMillisecondsBetweenLines";
this.labelMaxMillisecondsBetweenLines.Size = new System.Drawing.Size(178, 13);
this.labelMaxMillisecondsBetweenLines.TabIndex = 41;
this.labelMaxMillisecondsBetweenLines.Text = "Maximum milliseconds between lines";
//
// labelMaxCharacters
//
this.labelMaxCharacters.AutoSize = true;
this.labelMaxCharacters.Location = new System.Drawing.Point(12, 23);
this.labelMaxCharacters.Name = "labelMaxCharacters";
this.labelMaxCharacters.Size = new System.Drawing.Size(187, 13);
this.labelMaxCharacters.TabIndex = 40;
this.labelMaxCharacters.Text = "Maximum characters in one paragraph";
//
// BatchConvert
//
this.AllowDrop = true;
@ -793,6 +891,8 @@
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BatchConvert_FormClosing);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.BatchConvert_KeyDown);
this.groupBoxConvertOptions.ResumeLayout(false);
this.groupBoxChangeFrameRate.ResumeLayout(false);
this.groupBoxChangeFrameRate.PerformLayout();
this.groupBoxOffsetTimeCodes.ResumeLayout(false);
this.groupBoxOffsetTimeCodes.PerformLayout();
this.groupBoxFixRtl.ResumeLayout(false);
@ -800,13 +900,15 @@
this.groupBoxSpeed.ResumeLayout(false);
this.groupBoxSpeed.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownPercent)).EndInit();
this.groupBoxChangeFrameRate.ResumeLayout(false);
this.groupBoxChangeFrameRate.PerformLayout();
this.groupBoxOutput.ResumeLayout(false);
this.groupBoxOutput.PerformLayout();
this.groupBoxInput.ResumeLayout(false);
this.groupBoxInput.PerformLayout();
this.contextMenuStripFiles.ResumeLayout(false);
this.groupBoxMergeShortLines.ResumeLayout(false);
this.groupBoxMergeShortLines.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxCharacters)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxMillisecondsBetweenLines)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -875,5 +977,11 @@
private System.Windows.Forms.RadioButton radioButtonReverseStartEnd;
private System.Windows.Forms.RadioButton radioButtonRemoveUnicode;
private System.Windows.Forms.RadioButton radioButtonAddUnicode;
private System.Windows.Forms.GroupBox groupBoxMergeShortLines;
private System.Windows.Forms.CheckBox checkBoxOnlyContinuationLines;
private System.Windows.Forms.NumericUpDown numericUpDownMaxCharacters;
private System.Windows.Forms.NumericUpDown numericUpDownMaxMillisecondsBetweenLines;
private System.Windows.Forms.Label labelMaxMillisecondsBetweenLines;
private System.Windows.Forms.Label labelMaxCharacters;
}
}

View File

@ -262,6 +262,14 @@ namespace Nikse.SubtitleEdit.Forms
radioButtonAddUnicode.Checked = true;
}
groupBoxMergeShortLines.Text = Configuration.Settings.Language.MergedShortLines.Title;
labelMaxCharacters.Text = Configuration.Settings.Language.MergedShortLines.MaximumCharacters;
labelMaxMillisecondsBetweenLines.Text = Configuration.Settings.Language.MergedShortLines.MaximumMillisecondsBetween;
checkBoxOnlyContinuationLines.Text = Configuration.Settings.Language.MergedShortLines.OnlyMergeContinuationLines;
numericUpDownMaxCharacters.Value = Configuration.Settings.General.SubtitleLineMaximumLength;
numericUpDownMaxMillisecondsBetweenLines.Value = Configuration.Settings.Tools.MergeShortLinesMaxGap;
checkBoxOnlyContinuationLines.Checked = Configuration.Settings.Tools.MergeShortLinesOnlyContinuous;
var fixItems = new List<FixActionItem>
{
new FixActionItem
@ -1049,7 +1057,7 @@ namespace Nikse.SubtitleEdit.Forms
if (IsActionEnabled(CommandLineConverter.BatchAction.MergeShortLines))
{
var mergedShortLinesSub = MergeShortLinesUtils.MergeShortLinesInSubtitle(sub, 250, Configuration.Settings.General.SubtitleLineMaximumLength, true);
var mergedShortLinesSub = MergeShortLinesUtils.MergeShortLinesInSubtitle(sub, Configuration.Settings.Tools.MergeShortLinesMaxGap, Configuration.Settings.General.SubtitleLineMaximumLength, Configuration.Settings.Tools.MergeShortLinesOnlyContinuous);
if (mergedShortLinesSub.Paragraphs.Count != sub.Paragraphs.Count)
{
sub.Paragraphs.Clear();
@ -1835,6 +1843,8 @@ namespace Nikse.SubtitleEdit.Forms
Configuration.Settings.Tools.BatchConvertChangeSpeed = IsActionEnabled(CommandLineConverter.BatchAction.ChangeSpeed);
Configuration.Settings.Tools.BatchConvertChangeFrameRate = IsActionEnabled(CommandLineConverter.BatchAction.ChangeFrameRate);
Configuration.Settings.Tools.BatchConvertOffsetTimeCodes = IsActionEnabled(CommandLineConverter.BatchAction.OffsetTimeCodes);
Configuration.Settings.Tools.MergeShortLinesMaxGap = (int)numericUpDownMaxMillisecondsBetweenLines.Value;
Configuration.Settings.Tools.MergeShortLinesOnlyContinuous = checkBoxOnlyContinuationLines.Checked;
UpdateRtlSettings();
}
@ -2138,6 +2148,7 @@ namespace Nikse.SubtitleEdit.Forms
private void listViewConvertOptions_SelectedIndexChanged(object sender, EventArgs e)
{
groupBoxMergeShortLines.Visible = false;
groupBoxChangeFrameRate.Visible = false;
groupBoxSpeed.Visible = false;
groupBoxOffsetTimeCodes.Visible = false;
@ -2156,6 +2167,9 @@ namespace Nikse.SubtitleEdit.Forms
buttonConvertOptionsSettings.BringToFront();
break;
case CommandLineConverter.BatchAction.MergeShortLines:
groupBoxMergeShortLines.Top = listViewConvertOptions.Top;
groupBoxMergeShortLines.Visible = true;
groupBoxMergeShortLines.BringToFront();
break;
case CommandLineConverter.BatchAction.MergeSameTexts:
break;

View File

@ -59,6 +59,8 @@ namespace Nikse.SubtitleEdit.Forms
SubtitleListview1.AutoSizeAllColumns(this);
NumberOfMerges = 0;
numericUpDownMaxCharacters.Value = Configuration.Settings.General.SubtitleLineMaximumLength;
numericUpDownMaxMillisecondsBetweenLines.Value = Configuration.Settings.Tools.MergeShortLinesMaxGap;
checkBoxOnlyContinuationLines.Checked = Configuration.Settings.Tools.MergeShortLinesOnlyContinuous;
_subtitle = subtitle;
}
@ -224,6 +226,8 @@ namespace Nikse.SubtitleEdit.Forms
private void ButtonOkClick(object sender, EventArgs e)
{
Configuration.Settings.Tools.MergeShortLinesMaxGap = (int)numericUpDownMaxMillisecondsBetweenLines.Value;
Configuration.Settings.Tools.MergeShortLinesOnlyContinuous = checkBoxOnlyContinuationLines.Checked;
DialogResult = DialogResult.OK;
}

View File

@ -1130,7 +1130,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
}
break;
case BatchAction.MergeShortLines:
var mergedShortLinesSub = MergeShortLinesUtils.MergeShortLinesInSubtitle(sub, 250, Configuration.Settings.General.SubtitleLineMaximumLength, true);
var mergedShortLinesSub = MergeShortLinesUtils.MergeShortLinesInSubtitle(sub, Configuration.Settings.Tools.MergeShortLinesMaxGap, Configuration.Settings.General.SubtitleLineMaximumLength, Configuration.Settings.Tools.MergeShortLinesOnlyContinuous);
if (mergedShortLinesSub.Paragraphs.Count != sub.Paragraphs.Count)
{
sub.Paragraphs.Clear();