mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Add "Sort by" in "Batch convert" - thx Masina86 :)
This commit is contained in:
parent
62f8c0d3d8
commit
68292a32e3
@ -332,7 +332,7 @@ Read more info (web)?</WhisperNotFound>
|
||||
<FilterMoreThanTwoLines>More than two lines in one subtitle</FilterMoreThanTwoLines>
|
||||
<FilterContains>Text contains...</FilterContains>
|
||||
<FilterFileNameContains>File name contains...</FilterFileNameContains>
|
||||
<MkvLanguageCodeContains>Matroska (.mkv) language code contains...</MkvLanguageCodeContains>
|
||||
<LanguageCodeContains>Language code contains...</LanguageCodeContains>
|
||||
<FixCommonErrorsErrorX>Fix common errors: {0}</FixCommonErrorsErrorX>
|
||||
<MultipleReplaceErrorX>Multiple replace: {0}</MultipleReplaceErrorX>
|
||||
<AutoBalanceErrorX>Auto balance: {0}</AutoBalanceErrorX>
|
||||
|
@ -218,6 +218,8 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
public bool BatchConvertApplyDurationLimits { get; set; }
|
||||
public bool BatchConvertDeleteLines { get; set; }
|
||||
public bool BatchConvertAssaChangeRes { get; set; }
|
||||
public bool BatchConvertSortBy { get; set; }
|
||||
public string BatchConvertSortByChoice { get; set; }
|
||||
public bool BatchConvertOffsetTimeCodes { get; set; }
|
||||
public string BatchConvertLanguage { get; set; }
|
||||
public string BatchConvertFormat { get; set; }
|
||||
@ -5059,6 +5061,18 @@ $HorzAlign = Center
|
||||
settings.Tools.BatchConvertAssaChangeRes = Convert.ToBoolean(subNode.InnerText, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("BatchConvertSortBy");
|
||||
if (subNode != null)
|
||||
{
|
||||
settings.Tools.BatchConvertSortBy = Convert.ToBoolean(subNode.InnerText, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("BatchConvertSortByChoice");
|
||||
if (subNode != null)
|
||||
{
|
||||
settings.Tools.BatchConvertSortByChoice = subNode.InnerText;
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("BatchConvertChangeFrameRate");
|
||||
if (subNode != null)
|
||||
{
|
||||
@ -10380,6 +10394,8 @@ $HorzAlign = Center
|
||||
textWriter.WriteElementString("BatchConvertApplyDurationLimits", settings.Tools.BatchConvertApplyDurationLimits.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("BatchConvertDeleteLines", settings.Tools.BatchConvertDeleteLines.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("BatchConvertAssaChangeRes", settings.Tools.BatchConvertAssaChangeRes.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("BatchConvertSortBy", settings.Tools.BatchConvertSortBy.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("BatchConvertSortByChoice", settings.Tools.BatchConvertSortByChoice);
|
||||
textWriter.WriteElementString("BatchConvertChangeFrameRate", settings.Tools.BatchConvertChangeFrameRate.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("BatchConvertOffsetTimeCodes", settings.Tools.BatchConvertOffsetTimeCodes.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("BatchConvertLanguage", settings.Tools.BatchConvertLanguage);
|
||||
|
@ -52,9 +52,12 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
lines.ForEach(line => sb.AppendLine(line));
|
||||
string xmlAsString = sb.ToString().Trim();
|
||||
if (xmlAsString.Contains("<DCSubtitle"))
|
||||
var xmlAsString = sb.ToString().Trim();
|
||||
if (!xmlAsString.Contains("<DCSubtitle"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var xml = new XmlDocument { XmlResolver = null };
|
||||
try
|
||||
{
|
||||
@ -70,7 +73,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
System.Diagnostics.Debug.WriteLine(ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -170,16 +173,16 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
end.InnerText = ConvertToTimeString(p.EndTime);
|
||||
subNode.Attributes.Append(end);
|
||||
|
||||
bool alignLeft = p.Text.StartsWith("{\\a1}", StringComparison.Ordinal) || p.Text.StartsWith("{\\a5}", StringComparison.Ordinal) || p.Text.StartsWith("{\\a9}", StringComparison.Ordinal) || // sub station alpha
|
||||
var alignLeft = p.Text.StartsWith("{\\a1}", StringComparison.Ordinal) || p.Text.StartsWith("{\\a5}", StringComparison.Ordinal) || p.Text.StartsWith("{\\a9}", StringComparison.Ordinal) || // sub station alpha
|
||||
p.Text.StartsWith("{\\an1}", StringComparison.Ordinal) || p.Text.StartsWith("{\\an4}", StringComparison.Ordinal) || p.Text.StartsWith("{\\an7}", StringComparison.Ordinal); // advanced sub station alpha
|
||||
|
||||
bool alignRight = p.Text.StartsWith("{\\a3}", StringComparison.Ordinal) || p.Text.StartsWith("{\\a7}", StringComparison.Ordinal) || p.Text.StartsWith("{\\a11}", StringComparison.Ordinal) || // sub station alpha
|
||||
var alignRight = p.Text.StartsWith("{\\a3}", StringComparison.Ordinal) || p.Text.StartsWith("{\\a7}", StringComparison.Ordinal) || p.Text.StartsWith("{\\a11}", StringComparison.Ordinal) || // sub station alpha
|
||||
p.Text.StartsWith("{\\an3}", StringComparison.Ordinal) || p.Text.StartsWith("{\\an6}", StringComparison.Ordinal) || p.Text.StartsWith("{\\an9}", StringComparison.Ordinal); // advanced sub station alpha
|
||||
|
||||
bool alignVTop = p.Text.StartsWith("{\\a5}", StringComparison.Ordinal) || p.Text.StartsWith("{\\a6}", StringComparison.Ordinal) || p.Text.StartsWith("{\\a7}", StringComparison.Ordinal) || // sub station alpha
|
||||
var alignVTop = p.Text.StartsWith("{\\a5}", StringComparison.Ordinal) || p.Text.StartsWith("{\\a6}", StringComparison.Ordinal) || p.Text.StartsWith("{\\a7}", StringComparison.Ordinal) || // sub station alpha
|
||||
p.Text.StartsWith("{\\an7}", StringComparison.Ordinal) || p.Text.StartsWith("{\\an8}", StringComparison.Ordinal) || p.Text.StartsWith("{\\an9}", StringComparison.Ordinal); // advanced sub station alpha
|
||||
|
||||
bool alignVCenter = p.Text.StartsWith("{\\a9}", StringComparison.Ordinal) || p.Text.StartsWith("{\\a10}", StringComparison.Ordinal) || p.Text.StartsWith("{\\a11}", StringComparison.Ordinal) || // sub station alpha
|
||||
var alignVCenter = p.Text.StartsWith("{\\a9}", StringComparison.Ordinal) || p.Text.StartsWith("{\\a10}", StringComparison.Ordinal) || p.Text.StartsWith("{\\a11}", StringComparison.Ordinal) || // sub station alpha
|
||||
p.Text.StartsWith("{\\an4}", StringComparison.Ordinal) || p.Text.StartsWith("{\\an5}", StringComparison.Ordinal) || p.Text.StartsWith("{\\an6}", StringComparison.Ordinal); // advanced sub station alpha
|
||||
|
||||
var text = Utilities.RemoveSsaTags(p.Text);
|
||||
@ -665,12 +668,15 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
var textLines = new List<SubtitleLine>();
|
||||
var pText = new StringBuilder();
|
||||
var vAlignment = string.Empty;
|
||||
var vPosition = string.Empty;
|
||||
var lastVPosition = string.Empty;
|
||||
var extra = string.Empty;
|
||||
foreach (XmlNode innerNode in node.ChildNodes)
|
||||
{
|
||||
string vPosition;
|
||||
if (innerNode.Name == "Text")
|
||||
{
|
||||
extra = innerNode.OuterXml;
|
||||
|
||||
if (innerNode.Attributes["VPosition"] != null)
|
||||
{
|
||||
vPosition = innerNode.Attributes["VPosition"].InnerText;
|
||||
@ -692,13 +698,13 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
}
|
||||
}
|
||||
|
||||
bool alignLeft = false;
|
||||
bool alignRight = false;
|
||||
bool alignVTop = false;
|
||||
bool alignVCenter = false;
|
||||
var alignLeft = false;
|
||||
var alignRight = false;
|
||||
var alignVTop = false;
|
||||
var alignVCenter = false;
|
||||
if (innerNode.Attributes["HAlign"] != null)
|
||||
{
|
||||
string hAlign = innerNode.Attributes["HAlign"].InnerText;
|
||||
var hAlign = innerNode.Attributes["HAlign"].InnerText;
|
||||
if (hAlign == "left")
|
||||
{
|
||||
alignLeft = true;
|
||||
@ -711,7 +717,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
|
||||
if (innerNode.Attributes["VAlign"] != null)
|
||||
{
|
||||
string hAlign = innerNode.Attributes["VAlign"].InnerText;
|
||||
var hAlign = innerNode.Attributes["VAlign"].InnerText;
|
||||
if (hAlign == "top")
|
||||
{
|
||||
alignVTop = true;
|
||||
@ -726,7 +732,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
{
|
||||
if (!pText.ToString().StartsWith("{\\an", StringComparison.Ordinal))
|
||||
{
|
||||
string pre = string.Empty;
|
||||
var pre = string.Empty;
|
||||
if (alignVTop)
|
||||
{
|
||||
if (alignLeft)
|
||||
@ -769,7 +775,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
}
|
||||
}
|
||||
|
||||
string temp = pre + pText;
|
||||
var temp = pre + pText;
|
||||
pText.Clear();
|
||||
pText.Append(temp);
|
||||
}
|
||||
@ -895,13 +901,13 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
}
|
||||
|
||||
string text;
|
||||
if (textLines.All(p => string.Equals(p.VerticalAlignment, "bottom", StringComparison.InvariantCultureIgnoreCase)))
|
||||
if (textLines.All(line => string.Equals(line.VerticalAlignment, "bottom", StringComparison.InvariantCultureIgnoreCase)))
|
||||
{
|
||||
text = string.Join(Environment.NewLine, textLines.OrderByDescending(p => p.GetVerticalPositionAsNumber()).Select(p => p.Text));
|
||||
text = string.Join(Environment.NewLine, textLines.OrderByDescending(line => line.GetVerticalPositionAsNumber()).Select(line => line.Text));
|
||||
}
|
||||
else
|
||||
{
|
||||
text = string.Join(Environment.NewLine, textLines.OrderBy(p => p.GetVerticalPositionAsNumber()).Select(p => p.Text));
|
||||
text = string.Join(Environment.NewLine, textLines.OrderBy(line => line.GetVerticalPositionAsNumber()).Select(line => line.Text));
|
||||
}
|
||||
|
||||
text = text.Replace(Environment.NewLine + "{\\an1}", Environment.NewLine);
|
||||
@ -943,7 +949,9 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
}
|
||||
}
|
||||
|
||||
subtitle.Paragraphs.Add(new Paragraph(GetTimeCode(start), GetTimeCode(end), HtmlUtil.FixInvalidItalicTags(text)));
|
||||
var p = new Paragraph(GetTimeCode(start), GetTimeCode(end), HtmlUtil.FixInvalidItalicTags(text));
|
||||
p.Extra = extra;
|
||||
subtitle.Paragraphs.Add(p);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
275
src/ui/Forms/BatchConvert.Designer.cs
generated
275
src/ui/Forms/BatchConvert.Designer.cs
generated
@ -35,6 +35,17 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.buttonConvert = new System.Windows.Forms.Button();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.groupBoxConvertOptions = new System.Windows.Forms.GroupBox();
|
||||
this.groupBoxSortBy = new System.Windows.Forms.GroupBox();
|
||||
this.comboBoxSortBy = new System.Windows.Forms.ComboBox();
|
||||
this.groupBoxMergeSameTimeCodes = new System.Windows.Forms.GroupBox();
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog = new System.Windows.Forms.CheckBox();
|
||||
this.numericUpDownMergeSameTimeCodesMaxDifference = new System.Windows.Forms.NumericUpDown();
|
||||
this.labelMergeSameTimeCodesMaxDifference = new System.Windows.Forms.Label();
|
||||
this.groupBoxConvertColorsToDialog = new System.Windows.Forms.GroupBox();
|
||||
this.checkBoxConvertColorsToDialogReBreakLines = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxConvertColorsToDialogAddNewLines = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxConvertColorsToDialogRemoveColorTags = new System.Windows.Forms.CheckBox();
|
||||
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()));
|
||||
@ -158,16 +169,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.progressBar1 = new System.Windows.Forms.ProgressBar();
|
||||
this.labelStatus = new System.Windows.Forms.Label();
|
||||
this.labelError = new System.Windows.Forms.Label();
|
||||
this.groupBoxMergeSameTimeCodes = new System.Windows.Forms.GroupBox();
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog = new System.Windows.Forms.CheckBox();
|
||||
this.numericUpDownMergeSameTimeCodesMaxDifference = new System.Windows.Forms.NumericUpDown();
|
||||
this.labelMergeSameTimeCodesMaxDifference = new System.Windows.Forms.Label();
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines = new System.Windows.Forms.CheckBox();
|
||||
this.groupBoxConvertColorsToDialog = new System.Windows.Forms.GroupBox();
|
||||
this.checkBoxConvertColorsToDialogReBreakLines = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxConvertColorsToDialogAddNewLines = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxConvertColorsToDialogRemoveColorTags = new System.Windows.Forms.CheckBox();
|
||||
this.groupBoxConvertOptions.SuspendLayout();
|
||||
this.groupBoxSortBy.SuspendLayout();
|
||||
this.groupBoxMergeSameTimeCodes.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMergeSameTimeCodesMaxDifference)).BeginInit();
|
||||
this.groupBoxConvertColorsToDialog.SuspendLayout();
|
||||
this.contextMenuStripOptions.SuspendLayout();
|
||||
this.groupBoxDeleteLines.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDeleteLast)).BeginInit();
|
||||
@ -198,9 +204,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.groupBoxOutput.SuspendLayout();
|
||||
this.groupBoxInput.SuspendLayout();
|
||||
this.contextMenuStripFiles.SuspendLayout();
|
||||
this.groupBoxMergeSameTimeCodes.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMergeSameTimeCodesMaxDifference)).BeginInit();
|
||||
this.groupBoxConvertColorsToDialog.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonConvert
|
||||
@ -231,6 +234,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
//
|
||||
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.groupBoxSortBy);
|
||||
this.groupBoxConvertOptions.Controls.Add(this.groupBoxMergeSameTimeCodes);
|
||||
this.groupBoxConvertOptions.Controls.Add(this.groupBoxConvertColorsToDialog);
|
||||
this.groupBoxConvertOptions.Controls.Add(this.listViewConvertOptions);
|
||||
@ -252,6 +256,133 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.groupBoxConvertOptions.TabStop = false;
|
||||
this.groupBoxConvertOptions.Text = "Convert options";
|
||||
//
|
||||
// groupBoxSortBy
|
||||
//
|
||||
this.groupBoxSortBy.Controls.Add(this.comboBoxSortBy);
|
||||
this.groupBoxSortBy.Location = new System.Drawing.Point(301, 11);
|
||||
this.groupBoxSortBy.Name = "groupBoxSortBy";
|
||||
this.groupBoxSortBy.Size = new System.Drawing.Size(268, 149);
|
||||
this.groupBoxSortBy.TabIndex = 311;
|
||||
this.groupBoxSortBy.TabStop = false;
|
||||
this.groupBoxSortBy.Text = "Sort by";
|
||||
this.groupBoxSortBy.Visible = false;
|
||||
//
|
||||
// comboBoxSortBy
|
||||
//
|
||||
this.comboBoxSortBy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxSortBy.FormattingEnabled = true;
|
||||
this.comboBoxSortBy.Location = new System.Drawing.Point(8, 30);
|
||||
this.comboBoxSortBy.Name = "comboBoxSortBy";
|
||||
this.comboBoxSortBy.Size = new System.Drawing.Size(228, 21);
|
||||
this.comboBoxSortBy.TabIndex = 0;
|
||||
//
|
||||
// groupBoxMergeSameTimeCodes
|
||||
//
|
||||
this.groupBoxMergeSameTimeCodes.Controls.Add(this.checkBoxMergeSameTimeCodesReBreakLines);
|
||||
this.groupBoxMergeSameTimeCodes.Controls.Add(this.checkBoxMergeSameTimeCodesMakeDialog);
|
||||
this.groupBoxMergeSameTimeCodes.Controls.Add(this.numericUpDownMergeSameTimeCodesMaxDifference);
|
||||
this.groupBoxMergeSameTimeCodes.Controls.Add(this.labelMergeSameTimeCodesMaxDifference);
|
||||
this.groupBoxMergeSameTimeCodes.Location = new System.Drawing.Point(308, 17);
|
||||
this.groupBoxMergeSameTimeCodes.Name = "groupBoxMergeSameTimeCodes";
|
||||
this.groupBoxMergeSameTimeCodes.Size = new System.Drawing.Size(268, 149);
|
||||
this.groupBoxMergeSameTimeCodes.TabIndex = 310;
|
||||
this.groupBoxMergeSameTimeCodes.TabStop = false;
|
||||
this.groupBoxMergeSameTimeCodes.Text = "Merge lines with same time codes";
|
||||
this.groupBoxMergeSameTimeCodes.Visible = false;
|
||||
//
|
||||
// checkBoxMergeSameTimeCodesReBreakLines
|
||||
//
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.AutoSize = true;
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.Checked = true;
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.Location = new System.Drawing.Point(15, 102);
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.Name = "checkBoxMergeSameTimeCodesReBreakLines";
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.Size = new System.Drawing.Size(94, 17);
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.TabIndex = 43;
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.Text = "Re-break lines";
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxMergeSameTimeCodesMakeDialog
|
||||
//
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.AutoSize = true;
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.Checked = true;
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.Location = new System.Drawing.Point(15, 79);
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.Name = "checkBoxMergeSameTimeCodesMakeDialog";
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.Size = new System.Drawing.Size(84, 17);
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.TabIndex = 42;
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.Text = "Make dialog";
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericUpDownMergeSameTimeCodesMaxDifference
|
||||
//
|
||||
this.numericUpDownMergeSameTimeCodesMaxDifference.Location = new System.Drawing.Point(15, 41);
|
||||
this.numericUpDownMergeSameTimeCodesMaxDifference.Maximum = new decimal(new int[] {
|
||||
10000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownMergeSameTimeCodesMaxDifference.Name = "numericUpDownMergeSameTimeCodesMaxDifference";
|
||||
this.numericUpDownMergeSameTimeCodesMaxDifference.Size = new System.Drawing.Size(64, 20);
|
||||
this.numericUpDownMergeSameTimeCodesMaxDifference.TabIndex = 38;
|
||||
this.numericUpDownMergeSameTimeCodesMaxDifference.Value = new decimal(new int[] {
|
||||
250,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// labelMergeSameTimeCodesMaxDifference
|
||||
//
|
||||
this.labelMergeSameTimeCodesMaxDifference.AutoSize = true;
|
||||
this.labelMergeSameTimeCodesMaxDifference.Location = new System.Drawing.Point(12, 23);
|
||||
this.labelMergeSameTimeCodesMaxDifference.Name = "labelMergeSameTimeCodesMaxDifference";
|
||||
this.labelMergeSameTimeCodesMaxDifference.Size = new System.Drawing.Size(139, 13);
|
||||
this.labelMergeSameTimeCodesMaxDifference.TabIndex = 40;
|
||||
this.labelMergeSameTimeCodesMaxDifference.Text = "Max. milliseconds difference";
|
||||
//
|
||||
// groupBoxConvertColorsToDialog
|
||||
//
|
||||
this.groupBoxConvertColorsToDialog.Controls.Add(this.checkBoxConvertColorsToDialogReBreakLines);
|
||||
this.groupBoxConvertColorsToDialog.Controls.Add(this.checkBoxConvertColorsToDialogAddNewLines);
|
||||
this.groupBoxConvertColorsToDialog.Controls.Add(this.checkBoxConvertColorsToDialogRemoveColorTags);
|
||||
this.groupBoxConvertColorsToDialog.Location = new System.Drawing.Point(305, 15);
|
||||
this.groupBoxConvertColorsToDialog.Name = "groupBoxConvertColorsToDialog";
|
||||
this.groupBoxConvertColorsToDialog.Size = new System.Drawing.Size(268, 149);
|
||||
this.groupBoxConvertColorsToDialog.TabIndex = 310;
|
||||
this.groupBoxConvertColorsToDialog.TabStop = false;
|
||||
this.groupBoxConvertColorsToDialog.Text = "Convert colors to dialog";
|
||||
this.groupBoxConvertColorsToDialog.Visible = false;
|
||||
//
|
||||
// checkBoxConvertColorsToDialogReBreakLines
|
||||
//
|
||||
this.checkBoxConvertColorsToDialogReBreakLines.AutoSize = true;
|
||||
this.checkBoxConvertColorsToDialogReBreakLines.Location = new System.Drawing.Point(9, 69);
|
||||
this.checkBoxConvertColorsToDialogReBreakLines.Name = "checkBoxConvertColorsToDialogReBreakLines";
|
||||
this.checkBoxConvertColorsToDialogReBreakLines.Size = new System.Drawing.Size(94, 17);
|
||||
this.checkBoxConvertColorsToDialogReBreakLines.TabIndex = 6;
|
||||
this.checkBoxConvertColorsToDialogReBreakLines.Text = "Re-break lines";
|
||||
this.checkBoxConvertColorsToDialogReBreakLines.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxConvertColorsToDialogAddNewLines
|
||||
//
|
||||
this.checkBoxConvertColorsToDialogAddNewLines.AutoSize = true;
|
||||
this.checkBoxConvertColorsToDialogAddNewLines.Location = new System.Drawing.Point(9, 46);
|
||||
this.checkBoxConvertColorsToDialogAddNewLines.Name = "checkBoxConvertColorsToDialogAddNewLines";
|
||||
this.checkBoxConvertColorsToDialogAddNewLines.Size = new System.Drawing.Size(165, 17);
|
||||
this.checkBoxConvertColorsToDialogAddNewLines.TabIndex = 5;
|
||||
this.checkBoxConvertColorsToDialogAddNewLines.Text = "Place every dash on new line";
|
||||
this.checkBoxConvertColorsToDialogAddNewLines.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxConvertColorsToDialogRemoveColorTags
|
||||
//
|
||||
this.checkBoxConvertColorsToDialogRemoveColorTags.AutoSize = true;
|
||||
this.checkBoxConvertColorsToDialogRemoveColorTags.Location = new System.Drawing.Point(9, 23);
|
||||
this.checkBoxConvertColorsToDialogRemoveColorTags.Name = "checkBoxConvertColorsToDialogRemoveColorTags";
|
||||
this.checkBoxConvertColorsToDialogRemoveColorTags.Size = new System.Drawing.Size(115, 17);
|
||||
this.checkBoxConvertColorsToDialogRemoveColorTags.TabIndex = 4;
|
||||
this.checkBoxConvertColorsToDialogRemoveColorTags.Text = "Remove color tags";
|
||||
this.checkBoxConvertColorsToDialogRemoveColorTags.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// listViewConvertOptions
|
||||
//
|
||||
this.listViewConvertOptions.CheckBoxes = true;
|
||||
@ -1630,113 +1761,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.labelError.Size = new System.Drawing.Size(51, 13);
|
||||
this.labelError.TabIndex = 10;
|
||||
this.labelError.Text = "labelError";
|
||||
//
|
||||
// groupBoxMergeSameTimeCodes
|
||||
//
|
||||
this.groupBoxMergeSameTimeCodes.Controls.Add(this.checkBoxMergeSameTimeCodesReBreakLines);
|
||||
this.groupBoxMergeSameTimeCodes.Controls.Add(this.checkBoxMergeSameTimeCodesMakeDialog);
|
||||
this.groupBoxMergeSameTimeCodes.Controls.Add(this.numericUpDownMergeSameTimeCodesMaxDifference);
|
||||
this.groupBoxMergeSameTimeCodes.Controls.Add(this.labelMergeSameTimeCodesMaxDifference);
|
||||
this.groupBoxMergeSameTimeCodes.Location = new System.Drawing.Point(308, 17);
|
||||
this.groupBoxMergeSameTimeCodes.Name = "groupBoxMergeSameTimeCodes";
|
||||
this.groupBoxMergeSameTimeCodes.Size = new System.Drawing.Size(268, 149);
|
||||
this.groupBoxMergeSameTimeCodes.TabIndex = 310;
|
||||
this.groupBoxMergeSameTimeCodes.TabStop = false;
|
||||
this.groupBoxMergeSameTimeCodes.Text = "Merge lines with same time codes";
|
||||
this.groupBoxMergeSameTimeCodes.Visible = false;
|
||||
//
|
||||
// checkBoxMergeSameTimeCodesMakeDialog
|
||||
//
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.AutoSize = true;
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.Checked = true;
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.Location = new System.Drawing.Point(15, 79);
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.Name = "checkBoxMergeSameTimeCodesMakeDialog";
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.Size = new System.Drawing.Size(84, 17);
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.TabIndex = 42;
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.Text = "Make dialog";
|
||||
this.checkBoxMergeSameTimeCodesMakeDialog.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericUpDownMergeSameTimeCodesMaxDifference
|
||||
//
|
||||
this.numericUpDownMergeSameTimeCodesMaxDifference.Location = new System.Drawing.Point(15, 41);
|
||||
this.numericUpDownMergeSameTimeCodesMaxDifference.Maximum = new decimal(new int[] {
|
||||
10000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownMergeSameTimeCodesMaxDifference.Name = "numericUpDownMergeSameTimeCodesMaxDifference";
|
||||
this.numericUpDownMergeSameTimeCodesMaxDifference.Size = new System.Drawing.Size(64, 20);
|
||||
this.numericUpDownMergeSameTimeCodesMaxDifference.TabIndex = 38;
|
||||
this.numericUpDownMergeSameTimeCodesMaxDifference.Value = new decimal(new int[] {
|
||||
250,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// labelMergeSameTimeCodesMaxDifference
|
||||
//
|
||||
this.labelMergeSameTimeCodesMaxDifference.AutoSize = true;
|
||||
this.labelMergeSameTimeCodesMaxDifference.Location = new System.Drawing.Point(12, 23);
|
||||
this.labelMergeSameTimeCodesMaxDifference.Name = "labelMergeSameTimeCodesMaxDifference";
|
||||
this.labelMergeSameTimeCodesMaxDifference.Size = new System.Drawing.Size(139, 13);
|
||||
this.labelMergeSameTimeCodesMaxDifference.TabIndex = 40;
|
||||
this.labelMergeSameTimeCodesMaxDifference.Text = "Max. milliseconds difference";
|
||||
//
|
||||
// checkBoxMergeSameTimeCodesReBreakLines
|
||||
//
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.AutoSize = true;
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.Checked = true;
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.Location = new System.Drawing.Point(15, 102);
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.Name = "checkBoxMergeSameTimeCodesReBreakLines";
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.Size = new System.Drawing.Size(94, 17);
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.TabIndex = 43;
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.Text = "Re-break lines";
|
||||
this.checkBoxMergeSameTimeCodesReBreakLines.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBoxConvertColorsToDialog
|
||||
//
|
||||
this.groupBoxConvertColorsToDialog.Controls.Add(this.checkBoxConvertColorsToDialogReBreakLines);
|
||||
this.groupBoxConvertColorsToDialog.Controls.Add(this.checkBoxConvertColorsToDialogAddNewLines);
|
||||
this.groupBoxConvertColorsToDialog.Controls.Add(this.checkBoxConvertColorsToDialogRemoveColorTags);
|
||||
this.groupBoxConvertColorsToDialog.Location = new System.Drawing.Point(305, 15);
|
||||
this.groupBoxConvertColorsToDialog.Name = "groupBoxConvertColorsToDialog";
|
||||
this.groupBoxConvertColorsToDialog.Size = new System.Drawing.Size(268, 149);
|
||||
this.groupBoxConvertColorsToDialog.TabIndex = 310;
|
||||
this.groupBoxConvertColorsToDialog.TabStop = false;
|
||||
this.groupBoxConvertColorsToDialog.Text = "Convert colors to dialog";
|
||||
this.groupBoxConvertColorsToDialog.Visible = false;
|
||||
//
|
||||
// checkBoxConvertColorsToDialogReBreakLines
|
||||
//
|
||||
this.checkBoxConvertColorsToDialogReBreakLines.AutoSize = true;
|
||||
this.checkBoxConvertColorsToDialogReBreakLines.Location = new System.Drawing.Point(9, 69);
|
||||
this.checkBoxConvertColorsToDialogReBreakLines.Name = "checkBoxConvertColorsToDialogReBreakLines";
|
||||
this.checkBoxConvertColorsToDialogReBreakLines.Size = new System.Drawing.Size(94, 17);
|
||||
this.checkBoxConvertColorsToDialogReBreakLines.TabIndex = 6;
|
||||
this.checkBoxConvertColorsToDialogReBreakLines.Text = "Re-break lines";
|
||||
this.checkBoxConvertColorsToDialogReBreakLines.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxConvertColorsToDialogAddNewLines
|
||||
//
|
||||
this.checkBoxConvertColorsToDialogAddNewLines.AutoSize = true;
|
||||
this.checkBoxConvertColorsToDialogAddNewLines.Location = new System.Drawing.Point(9, 46);
|
||||
this.checkBoxConvertColorsToDialogAddNewLines.Name = "checkBoxConvertColorsToDialogAddNewLines";
|
||||
this.checkBoxConvertColorsToDialogAddNewLines.Size = new System.Drawing.Size(165, 17);
|
||||
this.checkBoxConvertColorsToDialogAddNewLines.TabIndex = 5;
|
||||
this.checkBoxConvertColorsToDialogAddNewLines.Text = "Place every dash on new line";
|
||||
this.checkBoxConvertColorsToDialogAddNewLines.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxConvertColorsToDialogRemoveColorTags
|
||||
//
|
||||
this.checkBoxConvertColorsToDialogRemoveColorTags.AutoSize = true;
|
||||
this.checkBoxConvertColorsToDialogRemoveColorTags.Location = new System.Drawing.Point(9, 23);
|
||||
this.checkBoxConvertColorsToDialogRemoveColorTags.Name = "checkBoxConvertColorsToDialogRemoveColorTags";
|
||||
this.checkBoxConvertColorsToDialogRemoveColorTags.Size = new System.Drawing.Size(115, 17);
|
||||
this.checkBoxConvertColorsToDialogRemoveColorTags.TabIndex = 4;
|
||||
this.checkBoxConvertColorsToDialogRemoveColorTags.Text = "Remove color tags";
|
||||
this.checkBoxConvertColorsToDialogRemoveColorTags.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// BatchConvert
|
||||
//
|
||||
@ -1761,6 +1785,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.ResizeEnd += new System.EventHandler(this.BatchConvert_ResizeEnd);
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.BatchConvert_KeyDown);
|
||||
this.groupBoxConvertOptions.ResumeLayout(false);
|
||||
this.groupBoxSortBy.ResumeLayout(false);
|
||||
this.groupBoxMergeSameTimeCodes.ResumeLayout(false);
|
||||
this.groupBoxMergeSameTimeCodes.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMergeSameTimeCodesMaxDifference)).EndInit();
|
||||
this.groupBoxConvertColorsToDialog.ResumeLayout(false);
|
||||
this.groupBoxConvertColorsToDialog.PerformLayout();
|
||||
this.contextMenuStripOptions.ResumeLayout(false);
|
||||
this.groupBoxDeleteLines.ResumeLayout(false);
|
||||
this.groupBoxDeleteLines.PerformLayout();
|
||||
@ -1807,11 +1837,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.groupBoxInput.ResumeLayout(false);
|
||||
this.groupBoxInput.PerformLayout();
|
||||
this.contextMenuStripFiles.ResumeLayout(false);
|
||||
this.groupBoxMergeSameTimeCodes.ResumeLayout(false);
|
||||
this.groupBoxMergeSameTimeCodes.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMergeSameTimeCodesMaxDifference)).EndInit();
|
||||
this.groupBoxConvertColorsToDialog.ResumeLayout(false);
|
||||
this.groupBoxConvertColorsToDialog.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@ -1954,5 +1979,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private System.Windows.Forms.CheckBox checkBoxConvertColorsToDialogReBreakLines;
|
||||
private System.Windows.Forms.CheckBox checkBoxConvertColorsToDialogAddNewLines;
|
||||
private System.Windows.Forms.CheckBox checkBoxConvertColorsToDialogRemoveColorTags;
|
||||
private System.Windows.Forms.GroupBox groupBoxSortBy;
|
||||
private System.Windows.Forms.ComboBox comboBoxSortBy;
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using Nikse.SubtitleEdit.Core.Enums;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
@ -167,6 +168,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
addFilesToolStripMenuItem.Text = l.AddFiles;
|
||||
groupBoxDeleteLines.Text = l.DeleteLines;
|
||||
groupBoxAssaChangeRes.Text = LanguageSettings.Current.AssaResolutionChanger.Title;
|
||||
groupBoxSortBy.Text = LanguageSettings.Current.Main.Menu.Tools.SortBy;
|
||||
comboBoxSortBy.Items.Clear();
|
||||
comboBoxSortBy.Items.Add(LanguageSettings.Current.Main.Menu.Tools.Number);
|
||||
comboBoxSortBy.Items.Add(LanguageSettings.Current.Main.Menu.Tools.StartTime);
|
||||
comboBoxSortBy.Items.Add(LanguageSettings.Current.Main.Menu.Tools.EndTime);
|
||||
|
||||
comboBoxFrameRateFrom.Left = labelFromFrameRate.Left + labelFromFrameRate.Width + 3;
|
||||
comboBoxFrameRateTo.Left = labelToFrameRate.Left + labelToFrameRate.Width + 3;
|
||||
@ -299,7 +305,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
comboBoxFilter.Items[2] = l.FilterMoreThanTwoLines;
|
||||
comboBoxFilter.Items[3] = l.FilterContains;
|
||||
comboBoxFilter.Items[4] = l.FilterFileNameContains;
|
||||
comboBoxFilter.Items[5] = l.MkvLanguageCodeContains;
|
||||
comboBoxFilter.Items[5] = l.LanguageCodeContains;
|
||||
comboBoxFilter.SelectedIndex = 0;
|
||||
comboBoxFilter.Left = labelFilter.Left + labelFilter.Width + 4;
|
||||
textBoxFilter.Left = comboBoxFilter.Left + comboBoxFilter.Width + 4;
|
||||
@ -594,6 +600,13 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Action = CommandLineConverter.BatchAction.AssaChangeRes,
|
||||
Control = groupBoxAssaChangeRes
|
||||
},
|
||||
new FixActionItem
|
||||
{
|
||||
Text = LanguageSettings.Current.Main.Menu.Tools.SortBy,
|
||||
Checked = Configuration.Settings.Tools.BatchConvertSortBy,
|
||||
Action = CommandLineConverter.BatchAction.SortBy,
|
||||
Control = groupBoxSortBy
|
||||
},
|
||||
};
|
||||
foreach (var fixItem in fixItems)
|
||||
{
|
||||
@ -1883,6 +1896,23 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
sub = fixDurationLimits.Fix(sub);
|
||||
}
|
||||
|
||||
if (IsActionEnabled(CommandLineConverter.BatchAction.SortBy))
|
||||
{
|
||||
var sortBy = comboBoxSortBy.Text;
|
||||
if (sortBy == LanguageSettings.Current.Main.Menu.Tools.Number)
|
||||
{
|
||||
sub.Sort(SubtitleSortCriteria.Number);
|
||||
}
|
||||
else if (sortBy == LanguageSettings.Current.Main.Menu.Tools.StartTime)
|
||||
{
|
||||
sub.Sort(SubtitleSortCriteria.StartTime);
|
||||
}
|
||||
else if (sortBy == LanguageSettings.Current.Main.Menu.Tools.EndTime)
|
||||
{
|
||||
sub.Sort(SubtitleSortCriteria.EndTime);
|
||||
}
|
||||
}
|
||||
|
||||
if (IsActionEnabled(CommandLineConverter.BatchAction.DeleteLines))
|
||||
{
|
||||
DeleteLines(sub);
|
||||
@ -3003,6 +3033,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Configuration.Settings.Tools.BatchConvertChangeFrameRate = IsActionEnabled(CommandLineConverter.BatchAction.ChangeFrameRate);
|
||||
Configuration.Settings.Tools.BatchConvertOffsetTimeCodes = IsActionEnabled(CommandLineConverter.BatchAction.OffsetTimeCodes);
|
||||
Configuration.Settings.Tools.BatchConvertApplyDurationLimits = IsActionEnabled(CommandLineConverter.BatchAction.ApplyDurationLimits);
|
||||
Configuration.Settings.Tools.BatchConvertSortBy = IsActionEnabled(CommandLineConverter.BatchAction.SortBy);
|
||||
Configuration.Settings.Tools.BatchConvertSortByChoice = comboBoxSortBy.Text;
|
||||
Configuration.Settings.Tools.MergeShortLinesMaxGap = (int)numericUpDownMaxMillisecondsBetweenLines.Value;
|
||||
Configuration.Settings.Tools.MergeShortLinesOnlyContinuous = checkBoxOnlyContinuationLines.Checked;
|
||||
Configuration.Settings.Tools.BatchConvertDeleteLines = IsActionEnabled(CommandLineConverter.BatchAction.DeleteLines);
|
||||
|
@ -58,6 +58,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
|
||||
RemoveLineBreaks,
|
||||
DeleteLines,
|
||||
AssaChangeRes,
|
||||
SortBy,
|
||||
}
|
||||
|
||||
internal static void ConvertOrReturn(string productIdentifier, string[] commandLineArguments)
|
||||
|
@ -496,7 +496,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
FilterMoreThanTwoLines = "More than two lines in one subtitle",
|
||||
FilterContains = "Text contains...",
|
||||
FilterFileNameContains = "File name contains...",
|
||||
MkvLanguageCodeContains = "Matroska (.mkv) language code contains...",
|
||||
LanguageCodeContains = "Matroska (.mkv) language code contains...",
|
||||
FixCommonErrorsErrorX = "Fix common errors: {0}",
|
||||
MultipleReplaceErrorX = "Multiple replace: {0}",
|
||||
AutoBalanceErrorX = "Auto balance: {0}",
|
||||
|
@ -883,8 +883,8 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
case "BatchConvert/FilterFileNameContains":
|
||||
language.BatchConvert.FilterFileNameContains = reader.Value;
|
||||
break;
|
||||
case "BatchConvert/MkvLanguageCodeContains":
|
||||
language.BatchConvert.MkvLanguageCodeContains = reader.Value;
|
||||
case "BatchConvert/LanguageCodeContains":
|
||||
language.BatchConvert.LanguageCodeContains = reader.Value;
|
||||
break;
|
||||
case "BatchConvert/FixCommonErrorsErrorX":
|
||||
language.BatchConvert.FixCommonErrorsErrorX = reader.Value;
|
||||
|
@ -354,7 +354,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public string FilterMoreThanTwoLines { get; set; }
|
||||
public string FilterContains { get; set; }
|
||||
public string FilterFileNameContains { get; set; }
|
||||
public string MkvLanguageCodeContains { get; set; }
|
||||
public string LanguageCodeContains { get; set; }
|
||||
public string FixCommonErrorsErrorX { get; set; }
|
||||
public string MultipleReplaceErrorX { get; set; }
|
||||
public string AutoBalanceErrorX { get; set; }
|
||||
|
Loading…
Reference in New Issue
Block a user