Changed "auto break" to use setting "Merge lines shorter than" + new "Fix common errors" option so user can merge short lines in two different ways

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@279 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-01-23 09:31:03 +00:00
parent dfd15c017a
commit 0f80f040a6
9 changed files with 160 additions and 109 deletions

View File

@ -58,11 +58,18 @@ namespace Nikse.SubtitleEdit.Forms
if (autoBalance)
{
labelCondition.Text = Configuration.Settings.Language.AutoBreakUnbreakLines.OnlyBreakLinesLongerThan;
for (int i = 10; i < 61; i++)
const int start = 10;
const int max = 60;
for (int i = start; i <= max; i++)
comboBoxConditions.Items.Add(i.ToString());
comboBoxConditions.SelectedIndex = 32;
int index = Configuration.Settings.Tools.MergeLinesShorterThan - (start +1);
if (index > 0 && index < max)
comboBoxConditions.SelectedIndex = index;
else
comboBoxConditions.SelectedIndex = 30;
AutuBalance();
AutoBalance();
}
else
{
@ -75,7 +82,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void AutuBalance()
private void AutoBalance()
{
int minLength = int.Parse(comboBoxConditions.Items[comboBoxConditions.SelectedIndex].ToString());
Text = Configuration.Settings.Language.AutoBreakUnbreakLines.TitleAutoBreak;
@ -166,7 +173,7 @@ namespace Nikse.SubtitleEdit.Forms
private void comboBoxConditions_SelectedIndexChanged(object sender, EventArgs e)
{
if (_modeAutoBalance)
AutuBalance();
AutoBalance();
else
Unbreak();
}

View File

@ -23,22 +23,23 @@ namespace Nikse.SubtitleEdit.Forms
const int IndexMissingSpaces = 7;
const int IndexBreakLongLines = 8;
const int IndexMergeShortLines = 9;
const int IndexUppercaseIInsideLowercaseWord = 10;
const int IndexDoubleApostropheToQuote = 11;
const int IndexFixMusicNotation = 12;
const int IndexAddPeriodAfterParagraph = 13;
const int IndexStartWithUppercaseLetterAfterParagraph = 14;
const int IndexStartWithUppercaseLetterAfterPeriodInsideParagraph = 15;
const int IndexAddMissingQuotes = 16;
const int IndexFixHyphens = 17;
const int IndexFix3PlusLines = 18;
const int IndexFixDoubleDash = 19;
const int IndexFixDoubleGreaterThan = 20;
const int IndexFixEllipsesStart = 21;
const int IndexFixMissingOpenBracket = 22;
const int IndexAloneLowercaseIToUppercaseIEnglish = 23;
const int IndexFixOcrErrorsViaReplaceList = 24;
const int IndexDanishLetterI = 25;
const int IndexMergeShortLinesAll = 10;
const int IndexUppercaseIInsideLowercaseWord = 11;
const int IndexDoubleApostropheToQuote = 12;
const int IndexFixMusicNotation = 13;
const int IndexAddPeriodAfterParagraph = 14;
const int IndexStartWithUppercaseLetterAfterParagraph = 15;
const int IndexStartWithUppercaseLetterAfterPeriodInsideParagraph = 16;
const int IndexAddMissingQuotes = 17;
const int IndexFixHyphens = 18;
const int IndexFix3PlusLines = 19;
const int IndexFixDoubleDash = 20;
const int IndexFixDoubleGreaterThan = 21;
const int IndexFixEllipsesStart = 22;
const int IndexFixMissingOpenBracket = 23;
const int IndexAloneLowercaseIToUppercaseIEnglish = 24;
const int IndexFixOcrErrorsViaReplaceList = 25;
const int IndexDanishLetterI = 26;
const int IndexFixSpanishInvertedQuestionAndExclamationMarks = 27;
int _danishLetterIIndex = -1;
@ -137,6 +138,7 @@ namespace Nikse.SubtitleEdit.Forms
_fixActions.Add(new FixItem(_language.FixMissingSpaces, _language.FixMissingSpacesExample, delegate { FixMissingSpaces(); }, ce.MissingSpacesTicked));
_fixActions.Add(new FixItem(_language.BreakLongLines, string.Empty, delegate { FixLongLines(); }, ce.BreakLongLinesTicked));
_fixActions.Add(new FixItem(_language.RemoveLineBreaks, string.Empty, delegate { FixShortLines(); }, ce.MergeShortLinesTicked));
_fixActions.Add(new FixItem(_language.RemoveLineBreaksAll, string.Empty, delegate { FixShortLinesAll(); }, ce.MergeShortLinesAllTicked));
_fixActions.Add(new FixItem(_language.FixUppercaseIInsindeLowercaseWords, _language.FixUppercaseIInsindeLowercaseWordsExample, delegate { FixUppercaseIInsideWords(); }, ce.UppercaseIInsideLowercaseWordTicked));
_fixActions.Add(new FixItem(_language.FixDoubleApostrophes, string.Empty, delegate { FixDoubleApostrophes(); }, ce.DoubleApostropheToQuoteTicked));
_fixActions.Add(new FixItem(_language.FixMusicNotation, _language.FixMusicNotationExample, delegate { FixMusicNotation(); }, ce.FixMusicNotationTicked));
@ -700,12 +702,40 @@ namespace Nikse.SubtitleEdit.Forms
LogStatus(_language.RemoveLineBreaks, string.Format(_language.XLinesUnbreaked, noOfShortLines));
}
public void FixShortLinesAll()
{
string fixAction = _language.MergeShortLineAll;
int noOfShortLines = 0;
for (int i = 0; i < _subtitle.Paragraphs.Count; i++)
{
Paragraph p = _subtitle.Paragraphs[i];
string s = Utilities.RemoveHtmlTags(p.Text);
if (s.Length < Configuration.Settings.Tools.MergeLinesShorterThan && p.Text.Contains(Environment.NewLine))
{
s = Utilities.AutoBreakLine(p.Text);
if (s != p.Text)
{
if (AllowFix(i + 1, fixAction))
{
string oldCurrent = p.Text;
p.Text = s;
_totalFixes++;
noOfShortLines++;
AddFixToListView(p, i + 1, fixAction, oldCurrent, p.Text);
}
}
}
}
if (noOfShortLines > 0)
LogStatus(_language.RemoveLineBreaks, string.Format(_language.XLinesUnbreaked, noOfShortLines));
}
public void FixUnneededSpaces()
{
const string zeroWhiteSpace = "\u200B";
const string zeroWidthNoBreakSpace = "\uFEFF";
string fixAction = _language.UnneededSpace;
int doubleSpaces = 0;
for (int i = 0; i < _subtitle.Paragraphs.Count; i++)
@ -3097,6 +3127,8 @@ namespace Nikse.SubtitleEdit.Forms
ce.MissingSpacesTicked = listView1.Items[IndexMissingSpaces].Checked;
ce.BreakLongLinesTicked = listView1.Items[IndexBreakLongLines].Checked;
ce.MergeShortLinesTicked = listView1.Items[IndexMergeShortLines].Checked;
ce.MergeShortLinesAllTicked = listView1.Items[IndexMergeShortLinesAll].Checked;
ce.UppercaseIInsideLowercaseWordTicked = listView1.Items[IndexUppercaseIInsideLowercaseWord].Checked;
ce.DoubleApostropheToQuoteTicked = listView1.Items[IndexDoubleApostropheToQuote].Checked;
ce.FixMusicNotationTicked = listView1.Items[IndexFixMusicNotation].Checked;

View File

@ -3786,7 +3786,7 @@ namespace Nikse.SubtitleEdit.Forms
}
else
{
string s = Utilities.AutoBreakLine(currentParagraph.Text, 5, Configuration.Settings.General.SubtitleLineMaximumLength * 2);
string s = Utilities.AutoBreakLine(currentParagraph.Text, 5, Configuration.Settings.General.SubtitleLineMaximumLength * 2, Configuration.Settings.Tools.MergeLinesShorterThan);
lines = s.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
if (lines.Length == 2)
{
@ -3824,7 +3824,7 @@ namespace Nikse.SubtitleEdit.Forms
}
else
{
string s = Utilities.AutoBreakLine(originalCurrent.Text, 5, Configuration.Settings.General.SubtitleLineMaximumLength * 2);
string s = Utilities.AutoBreakLine(originalCurrent.Text, 5, Configuration.Settings.General.SubtitleLineMaximumLength * 2, Configuration.Settings.Tools.MergeLinesShorterThan);
lines = s.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
}
if (lines.Length == 2)
@ -4987,6 +4987,7 @@ namespace Nikse.SubtitleEdit.Forms
_change = true;
_subtitleListViewIndex = -1;
RestoreSubtitleListviewIndexes();
UpdateSourceView();
}
}
Cursor.Current = Cursors.Default;
@ -6973,6 +6974,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
}
_change = true;
SubtitleListview1.EndUpdate();
if (_subtitle.WasLoadedWithFrameNumbers)
_subtitle.CalculateFrameNumbersFromTimeCodes(frameRate);

View File

@ -580,6 +580,9 @@
<metadata name="toolStripWaveControls.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>208, 56</value>
</metadata>
<metadata name="toolStripWaveControls.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>208, 56</value>
</metadata>
<data name="toolStripButtonWaveFormZoomOut.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@ -684,7 +687,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
CAAAAk1TRnQBSQFMAgEBAgEAAXgBAAF4AQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAgEAAZgBAAGYAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -33,6 +33,9 @@
this.tabControlSettings = new System.Windows.Forms.TabControl();
this.tabPageGenerel = new System.Windows.Forms.TabPage();
this.groupBoxMiscellaneous = new System.Windows.Forms.GroupBox();
this.labelMergeShortLines = new System.Windows.Forms.Label();
this.comboBoxMergeShortLineLength = new System.Windows.Forms.ComboBox();
this.checkBoxAllowEditOfOriginalSubtitle = new System.Windows.Forms.CheckBox();
this.comboBoxSpellChecker = new System.Windows.Forms.ComboBox();
this.labelSpellChecker = new System.Windows.Forms.Label();
this.panelSubtitleBackgroundColor = new System.Windows.Forms.Panel();
@ -141,8 +144,6 @@
this.textBoxMusicSymbolsToReplace = new System.Windows.Forms.TextBox();
this.labelToolsMusicSymbolsToReplace = new System.Windows.Forms.Label();
this.labelToolsMusicSymbol = new System.Windows.Forms.Label();
this.labelMergeShortLines = new System.Windows.Forms.Label();
this.comboBoxMergeShortLineLength = new System.Windows.Forms.ComboBox();
this.groupBoxToolsVisualSync = new System.Windows.Forms.GroupBox();
this.labelToolsEndScene = new System.Windows.Forms.Label();
this.comboBoxToolsEndSceneIndex = new System.Windows.Forms.ComboBox();
@ -194,7 +195,6 @@
this.colorDialogSSAStyle = new System.Windows.Forms.ColorDialog();
this.fontDialogSSAStyle = new System.Windows.Forms.FontDialog();
this.labelStatus = new System.Windows.Forms.Label();
this.checkBoxAllowEditOfOriginalSubtitle = new System.Windows.Forms.CheckBox();
this.tabControlSettings.SuspendLayout();
this.tabPageGenerel.SuspendLayout();
this.groupBoxMiscellaneous.SuspendLayout();
@ -286,6 +286,8 @@
//
// groupBoxMiscellaneous
//
this.groupBoxMiscellaneous.Controls.Add(this.labelMergeShortLines);
this.groupBoxMiscellaneous.Controls.Add(this.comboBoxMergeShortLineLength);
this.groupBoxMiscellaneous.Controls.Add(this.checkBoxAllowEditOfOriginalSubtitle);
this.groupBoxMiscellaneous.Controls.Add(this.comboBoxSpellChecker);
this.groupBoxMiscellaneous.Controls.Add(this.labelSpellChecker);
@ -325,6 +327,34 @@
this.groupBoxMiscellaneous.TabStop = false;
this.groupBoxMiscellaneous.Text = "Miscellaneous";
//
// labelMergeShortLines
//
this.labelMergeShortLines.AutoSize = true;
this.labelMergeShortLines.Location = new System.Drawing.Point(14, 153);
this.labelMergeShortLines.Name = "labelMergeShortLines";
this.labelMergeShortLines.Size = new System.Drawing.Size(124, 13);
this.labelMergeShortLines.TabIndex = 39;
this.labelMergeShortLines.Text = "Merge lines shorter than";
//
// comboBoxMergeShortLineLength
//
this.comboBoxMergeShortLineLength.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxMergeShortLineLength.FormattingEnabled = true;
this.comboBoxMergeShortLineLength.Location = new System.Drawing.Point(193, 150);
this.comboBoxMergeShortLineLength.Name = "comboBoxMergeShortLineLength";
this.comboBoxMergeShortLineLength.Size = new System.Drawing.Size(73, 21);
this.comboBoxMergeShortLineLength.TabIndex = 4;
//
// checkBoxAllowEditOfOriginalSubtitle
//
this.checkBoxAllowEditOfOriginalSubtitle.AutoSize = true;
this.checkBoxAllowEditOfOriginalSubtitle.Location = new System.Drawing.Point(436, 296);
this.checkBoxAllowEditOfOriginalSubtitle.Name = "checkBoxAllowEditOfOriginalSubtitle";
this.checkBoxAllowEditOfOriginalSubtitle.Size = new System.Drawing.Size(160, 17);
this.checkBoxAllowEditOfOriginalSubtitle.TabIndex = 23;
this.checkBoxAllowEditOfOriginalSubtitle.Text = "Allow edit of original subtitle";
this.checkBoxAllowEditOfOriginalSubtitle.UseVisualStyleBackColor = true;
//
// comboBoxSpellChecker
//
this.comboBoxSpellChecker.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@ -332,15 +362,15 @@
this.comboBoxSpellChecker.Items.AddRange(new object[] {
"Hunspell",
"Word"});
this.comboBoxSpellChecker.Location = new System.Drawing.Point(193, 294);
this.comboBoxSpellChecker.Location = new System.Drawing.Point(193, 332);
this.comboBoxSpellChecker.Name = "comboBoxSpellChecker";
this.comboBoxSpellChecker.Size = new System.Drawing.Size(121, 21);
this.comboBoxSpellChecker.TabIndex = 9;
this.comboBoxSpellChecker.TabIndex = 10;
//
// labelSpellChecker
//
this.labelSpellChecker.AutoSize = true;
this.labelSpellChecker.Location = new System.Drawing.Point(14, 297);
this.labelSpellChecker.Location = new System.Drawing.Point(14, 335);
this.labelSpellChecker.Name = "labelSpellChecker";
this.labelSpellChecker.Size = new System.Drawing.Size(69, 13);
this.labelSpellChecker.TabIndex = 36;
@ -349,25 +379,25 @@
// panelSubtitleBackgroundColor
//
this.panelSubtitleBackgroundColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelSubtitleBackgroundColor.Location = new System.Drawing.Point(193, 249);
this.panelSubtitleBackgroundColor.Location = new System.Drawing.Point(193, 287);
this.panelSubtitleBackgroundColor.Name = "panelSubtitleBackgroundColor";
this.panelSubtitleBackgroundColor.Size = new System.Drawing.Size(46, 15);
this.panelSubtitleBackgroundColor.TabIndex = 8;
this.panelSubtitleBackgroundColor.TabIndex = 9;
this.panelSubtitleBackgroundColor.Click += new System.EventHandler(this.panelSubtitleBackgroundColor_Click);
//
// panelSubtitleFontColor
//
this.panelSubtitleFontColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelSubtitleFontColor.Location = new System.Drawing.Point(193, 229);
this.panelSubtitleFontColor.Location = new System.Drawing.Point(193, 267);
this.panelSubtitleFontColor.Name = "panelSubtitleFontColor";
this.panelSubtitleFontColor.Size = new System.Drawing.Size(46, 15);
this.panelSubtitleFontColor.TabIndex = 7;
this.panelSubtitleFontColor.TabIndex = 8;
this.panelSubtitleFontColor.Click += new System.EventHandler(this.panelSubtitleFontColor_Click);
//
// labelSubtitleFontBackgroundColor
//
this.labelSubtitleFontBackgroundColor.AutoSize = true;
this.labelSubtitleFontBackgroundColor.Location = new System.Drawing.Point(14, 250);
this.labelSubtitleFontBackgroundColor.Location = new System.Drawing.Point(14, 288);
this.labelSubtitleFontBackgroundColor.Name = "labelSubtitleFontBackgroundColor";
this.labelSubtitleFontBackgroundColor.Size = new System.Drawing.Size(151, 13);
this.labelSubtitleFontBackgroundColor.TabIndex = 33;
@ -376,7 +406,7 @@
// labelSubtitleFontColor
//
this.labelSubtitleFontColor.AutoSize = true;
this.labelSubtitleFontColor.Location = new System.Drawing.Point(14, 230);
this.labelSubtitleFontColor.Location = new System.Drawing.Point(14, 268);
this.labelSubtitleFontColor.Name = "labelSubtitleFontColor";
this.labelSubtitleFontColor.Size = new System.Drawing.Size(92, 13);
this.labelSubtitleFontColor.TabIndex = 32;
@ -394,7 +424,7 @@
this.comboBoxAutoBackup.Location = new System.Drawing.Point(539, 252);
this.comboBoxAutoBackup.Name = "comboBoxAutoBackup";
this.comboBoxAutoBackup.Size = new System.Drawing.Size(121, 21);
this.comboBoxAutoBackup.TabIndex = 21;
this.comboBoxAutoBackup.TabIndex = 22;
//
// labelAutoBackup
//
@ -402,7 +432,7 @@
this.labelAutoBackup.Location = new System.Drawing.Point(433, 254);
this.labelAutoBackup.Name = "labelAutoBackup";
this.labelAutoBackup.Size = new System.Drawing.Size(68, 13);
this.labelAutoBackup.TabIndex = 20;
this.labelAutoBackup.TabIndex = 21;
this.labelAutoBackup.Text = "Auto-backup";
//
// checkBoxRememberSelectedLine
@ -411,7 +441,7 @@
this.checkBoxRememberSelectedLine.Location = new System.Drawing.Point(444, 75);
this.checkBoxRememberSelectedLine.Name = "checkBoxRememberSelectedLine";
this.checkBoxRememberSelectedLine.Size = new System.Drawing.Size(139, 17);
this.checkBoxRememberSelectedLine.TabIndex = 12;
this.checkBoxRememberSelectedLine.TabIndex = 13;
this.checkBoxRememberSelectedLine.Text = "Remember selected line";
this.checkBoxRememberSelectedLine.UseVisualStyleBackColor = true;
//
@ -421,7 +451,7 @@
this.checkBoxRemoveBlankLinesWhenOpening.Location = new System.Drawing.Point(436, 147);
this.checkBoxRemoveBlankLinesWhenOpening.Name = "checkBoxRemoveBlankLinesWhenOpening";
this.checkBoxRemoveBlankLinesWhenOpening.Size = new System.Drawing.Size(225, 17);
this.checkBoxRemoveBlankLinesWhenOpening.TabIndex = 15;
this.checkBoxRemoveBlankLinesWhenOpening.TabIndex = 16;
this.checkBoxRemoveBlankLinesWhenOpening.Text = "Remove blank lines when opening subtitle";
this.checkBoxRemoveBlankLinesWhenOpening.UseVisualStyleBackColor = true;
//
@ -455,7 +485,7 @@
this.comboBoxListViewDoubleClickEvent.Location = new System.Drawing.Point(436, 217);
this.comboBoxListViewDoubleClickEvent.Name = "comboBoxListViewDoubleClickEvent";
this.comboBoxListViewDoubleClickEvent.Size = new System.Drawing.Size(222, 21);
this.comboBoxListViewDoubleClickEvent.TabIndex = 19;
this.comboBoxListViewDoubleClickEvent.TabIndex = 20;
//
// labelListViewDoubleClickEvent
//
@ -463,7 +493,7 @@
this.labelListViewDoubleClickEvent.Location = new System.Drawing.Point(433, 202);
this.labelListViewDoubleClickEvent.Name = "labelListViewDoubleClickEvent";
this.labelListViewDoubleClickEvent.Size = new System.Drawing.Size(227, 13);
this.labelListViewDoubleClickEvent.TabIndex = 18;
this.labelListViewDoubleClickEvent.TabIndex = 19;
this.labelListViewDoubleClickEvent.Text = "Double-click on line in main window listview will";
//
// textBoxShowLineBreaksAs
@ -472,7 +502,7 @@
this.textBoxShowLineBreaksAs.MaxLength = 10;
this.textBoxShowLineBreaksAs.Name = "textBoxShowLineBreaksAs";
this.textBoxShowLineBreaksAs.Size = new System.Drawing.Size(69, 21);
this.textBoxShowLineBreaksAs.TabIndex = 17;
this.textBoxShowLineBreaksAs.TabIndex = 18;
//
// labelShowLineBreaksAs
//
@ -480,7 +510,7 @@
this.labelShowLineBreaksAs.Location = new System.Drawing.Point(433, 175);
this.labelShowLineBreaksAs.Name = "labelShowLineBreaksAs";
this.labelShowLineBreaksAs.Size = new System.Drawing.Size(150, 13);
this.labelShowLineBreaksAs.TabIndex = 16;
this.labelShowLineBreaksAs.TabIndex = 17;
this.labelShowLineBreaksAs.Text = "Show line breaks in listview as";
//
// checkBoxRememberWindowPosition
@ -489,7 +519,7 @@
this.checkBoxRememberWindowPosition.Location = new System.Drawing.Point(436, 101);
this.checkBoxRememberWindowPosition.Name = "checkBoxRememberWindowPosition";
this.checkBoxRememberWindowPosition.Size = new System.Drawing.Size(223, 17);
this.checkBoxRememberWindowPosition.TabIndex = 13;
this.checkBoxRememberWindowPosition.TabIndex = 14;
this.checkBoxRememberWindowPosition.Text = "Remember main window position and size";
this.checkBoxRememberWindowPosition.UseVisualStyleBackColor = true;
//
@ -515,7 +545,7 @@
// labelSubtitleFontSize
//
this.labelSubtitleFontSize.AutoSize = true;
this.labelSubtitleFontSize.Location = new System.Drawing.Point(13, 185);
this.labelSubtitleFontSize.Location = new System.Drawing.Point(13, 223);
this.labelSubtitleFontSize.Name = "labelSubtitleFontSize";
this.labelSubtitleFontSize.Size = new System.Drawing.Size(87, 13);
this.labelSubtitleFontSize.TabIndex = 10;
@ -525,10 +555,10 @@
//
this.comboBoxSubtitleFont.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxSubtitleFont.FormattingEnabled = true;
this.comboBoxSubtitleFont.Location = new System.Drawing.Point(193, 154);
this.comboBoxSubtitleFont.Location = new System.Drawing.Point(193, 192);
this.comboBoxSubtitleFont.Name = "comboBoxSubtitleFont";
this.comboBoxSubtitleFont.Size = new System.Drawing.Size(121, 21);
this.comboBoxSubtitleFont.TabIndex = 4;
this.comboBoxSubtitleFont.TabIndex = 5;
//
// checkBoxStartInSourceView
//
@ -536,7 +566,7 @@
this.checkBoxStartInSourceView.Location = new System.Drawing.Point(436, 124);
this.checkBoxStartInSourceView.Name = "checkBoxStartInSourceView";
this.checkBoxStartInSourceView.Size = new System.Drawing.Size(121, 17);
this.checkBoxStartInSourceView.TabIndex = 14;
this.checkBoxStartInSourceView.TabIndex = 15;
this.checkBoxStartInSourceView.Text = "Start in source view";
this.checkBoxStartInSourceView.UseVisualStyleBackColor = true;
//
@ -546,7 +576,7 @@
this.checkBoxReopenLastOpened.Location = new System.Drawing.Point(444, 52);
this.checkBoxReopenLastOpened.Name = "checkBoxReopenLastOpened";
this.checkBoxReopenLastOpened.Size = new System.Drawing.Size(145, 17);
this.checkBoxReopenLastOpened.TabIndex = 11;
this.checkBoxReopenLastOpened.TabIndex = 12;
this.checkBoxReopenLastOpened.Text = "Start with last file loaded";
this.checkBoxReopenLastOpened.UseVisualStyleBackColor = true;
//
@ -556,7 +586,7 @@
this.checkBoxRememberRecentFiles.Location = new System.Drawing.Point(436, 28);
this.checkBoxRememberRecentFiles.Name = "checkBoxRememberRecentFiles";
this.checkBoxRememberRecentFiles.Size = new System.Drawing.Size(195, 17);
this.checkBoxRememberRecentFiles.TabIndex = 10;
this.checkBoxRememberRecentFiles.TabIndex = 11;
this.checkBoxRememberRecentFiles.Text = "Remember recent files (for reopen)";
this.checkBoxRememberRecentFiles.UseVisualStyleBackColor = true;
this.checkBoxRememberRecentFiles.CheckedChanged += new System.EventHandler(this.checkBoxRememberRecentFiles_CheckedChanged);
@ -564,10 +594,10 @@
// checkBoxSubtitleFontBold
//
this.checkBoxSubtitleFontBold.AutoSize = true;
this.checkBoxSubtitleFontBold.Location = new System.Drawing.Point(193, 209);
this.checkBoxSubtitleFontBold.Location = new System.Drawing.Point(193, 247);
this.checkBoxSubtitleFontBold.Name = "checkBoxSubtitleFontBold";
this.checkBoxSubtitleFontBold.Size = new System.Drawing.Size(46, 17);
this.checkBoxSubtitleFontBold.TabIndex = 6;
this.checkBoxSubtitleFontBold.TabIndex = 7;
this.checkBoxSubtitleFontBold.Text = "Bold";
this.checkBoxSubtitleFontBold.UseVisualStyleBackColor = true;
//
@ -590,15 +620,15 @@
"18",
"19",
"20"});
this.comboBoxSubtitleFontSize.Location = new System.Drawing.Point(193, 182);
this.comboBoxSubtitleFontSize.Location = new System.Drawing.Point(193, 220);
this.comboBoxSubtitleFontSize.Name = "comboBoxSubtitleFontSize";
this.comboBoxSubtitleFontSize.Size = new System.Drawing.Size(121, 21);
this.comboBoxSubtitleFontSize.TabIndex = 5;
this.comboBoxSubtitleFontSize.TabIndex = 6;
//
// labelSubtitleFont
//
this.labelSubtitleFont.AutoSize = true;
this.labelSubtitleFont.Location = new System.Drawing.Point(13, 160);
this.labelSubtitleFont.Location = new System.Drawing.Point(13, 198);
this.labelSubtitleFont.Name = "labelSubtitleFont";
this.labelSubtitleFont.Size = new System.Drawing.Size(66, 13);
this.labelSubtitleFont.TabIndex = 8;
@ -1401,8 +1431,6 @@
this.groupBoxFixCommonErrors.Controls.Add(this.textBoxMusicSymbolsToReplace);
this.groupBoxFixCommonErrors.Controls.Add(this.labelToolsMusicSymbolsToReplace);
this.groupBoxFixCommonErrors.Controls.Add(this.labelToolsMusicSymbol);
this.groupBoxFixCommonErrors.Controls.Add(this.labelMergeShortLines);
this.groupBoxFixCommonErrors.Controls.Add(this.comboBoxMergeShortLineLength);
this.groupBoxFixCommonErrors.Location = new System.Drawing.Point(7, 129);
this.groupBoxFixCommonErrors.Name = "groupBoxFixCommonErrors";
this.groupBoxFixCommonErrors.Size = new System.Drawing.Size(785, 121);
@ -1419,14 +1447,14 @@
"♪♪",
"*",
"#"});
this.comboBoxToolsMusicSymbol.Location = new System.Drawing.Point(671, 76);
this.comboBoxToolsMusicSymbol.Location = new System.Drawing.Point(199, 71);
this.comboBoxToolsMusicSymbol.Name = "comboBoxToolsMusicSymbol";
this.comboBoxToolsMusicSymbol.Size = new System.Drawing.Size(86, 21);
this.comboBoxToolsMusicSymbol.TabIndex = 36;
//
// textBoxMusicSymbolsToReplace
//
this.textBoxMusicSymbolsToReplace.Location = new System.Drawing.Point(483, 46);
this.textBoxMusicSymbolsToReplace.Location = new System.Drawing.Point(11, 41);
this.textBoxMusicSymbolsToReplace.MaxLength = 100;
this.textBoxMusicSymbolsToReplace.Name = "textBoxMusicSymbolsToReplace";
this.textBoxMusicSymbolsToReplace.Size = new System.Drawing.Size(274, 21);
@ -1435,7 +1463,7 @@
// labelToolsMusicSymbolsToReplace
//
this.labelToolsMusicSymbolsToReplace.AutoSize = true;
this.labelToolsMusicSymbolsToReplace.Location = new System.Drawing.Point(480, 30);
this.labelToolsMusicSymbolsToReplace.Location = new System.Drawing.Point(8, 25);
this.labelToolsMusicSymbolsToReplace.Name = "labelToolsMusicSymbolsToReplace";
this.labelToolsMusicSymbolsToReplace.Size = new System.Drawing.Size(225, 13);
this.labelToolsMusicSymbolsToReplace.TabIndex = 34;
@ -1444,30 +1472,12 @@
// labelToolsMusicSymbol
//
this.labelToolsMusicSymbol.AutoSize = true;
this.labelToolsMusicSymbol.Location = new System.Drawing.Point(480, 79);
this.labelToolsMusicSymbol.Location = new System.Drawing.Point(8, 74);
this.labelToolsMusicSymbol.Name = "labelToolsMusicSymbol";
this.labelToolsMusicSymbol.Size = new System.Drawing.Size(69, 13);
this.labelToolsMusicSymbol.TabIndex = 32;
this.labelToolsMusicSymbol.Text = "Music symbol";
//
// labelMergeShortLines
//
this.labelMergeShortLines.AutoSize = true;
this.labelMergeShortLines.Location = new System.Drawing.Point(12, 30);
this.labelMergeShortLines.Name = "labelMergeShortLines";
this.labelMergeShortLines.Size = new System.Drawing.Size(124, 13);
this.labelMergeShortLines.TabIndex = 31;
this.labelMergeShortLines.Text = "Merge lines shorter than";
//
// comboBoxMergeShortLineLength
//
this.comboBoxMergeShortLineLength.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxMergeShortLineLength.FormattingEnabled = true;
this.comboBoxMergeShortLineLength.Location = new System.Drawing.Point(196, 27);
this.comboBoxMergeShortLineLength.Name = "comboBoxMergeShortLineLength";
this.comboBoxMergeShortLineLength.Size = new System.Drawing.Size(73, 21);
this.comboBoxMergeShortLineLength.TabIndex = 30;
//
// groupBoxToolsVisualSync
//
this.groupBoxToolsVisualSync.Controls.Add(this.labelToolsEndScene);
@ -1976,16 +1986,6 @@
this.labelStatus.TabIndex = 3;
this.labelStatus.Text = "labelStatus";
//
// checkBoxAllowEditOfOriginalSubtitle
//
this.checkBoxAllowEditOfOriginalSubtitle.AutoSize = true;
this.checkBoxAllowEditOfOriginalSubtitle.Location = new System.Drawing.Point(436, 296);
this.checkBoxAllowEditOfOriginalSubtitle.Name = "checkBoxAllowEditOfOriginalSubtitle";
this.checkBoxAllowEditOfOriginalSubtitle.Size = new System.Drawing.Size(160, 17);
this.checkBoxAllowEditOfOriginalSubtitle.TabIndex = 37;
this.checkBoxAllowEditOfOriginalSubtitle.Text = "Allow edit of original subtitle";
this.checkBoxAllowEditOfOriginalSubtitle.UseVisualStyleBackColor = true;
//
// Settings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -2181,8 +2181,6 @@
private System.Windows.Forms.Label labelToolsStartScene;
private System.Windows.Forms.ComboBox comboBoxToolsStartSceneIndex;
private System.Windows.Forms.GroupBox groupBoxFixCommonErrors;
private System.Windows.Forms.Label labelMergeShortLines;
private System.Windows.Forms.ComboBox comboBoxMergeShortLineLength;
private System.Windows.Forms.Label labelToolsMusicSymbol;
private System.Windows.Forms.ComboBox comboBoxListViewDoubleClickEvent;
private System.Windows.Forms.Label labelListViewDoubleClickEvent;
@ -2234,5 +2232,7 @@
private System.Windows.Forms.Label labelSpellChecker;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.CheckBox checkBoxAllowEditOfOriginalSubtitle;
private System.Windows.Forms.Label labelMergeShortLines;
private System.Windows.Forms.ComboBox comboBoxMergeShortLineLength;
}
}

View File

@ -335,6 +335,7 @@ namespace Nikse.SubtitleEdit.Logic
FixMissingSpaces = "Fix missing spaces",
BreakLongLines = "Break long lines",
RemoveLineBreaks = "Remove line breaks in short texts with only one sentence",
RemoveLineBreaksAll = "Remove line breaks in short texts (all except dialogues)",
FixUppercaseIInsindeLowercaseWords = "Fix uppercase 'i' inside lowercase words (ocr error)",
FixDoubleApostrophes = "Fix double apostrophe characters ('') to a single quote (\")",
AddPeriods = "Add period after lines where next line start with uppercase letter",
@ -365,7 +366,8 @@ namespace Nikse.SubtitleEdit.Logic
UncheckedFixLowercaseIToUppercaseI = "Unchecked \"Fix alone lowercase 'i' to 'I' (English)\"",
XIsChangedToUppercase = "{0} i's changed to uppercase",
FixFirstLetterToUppercaseAfterParagraph = "Fix first letter to uppercase after paragraph",
MergeShortLine = "Merge short line",
MergeShortLine = "Merge short line (single sentence)",
MergeShortLineAll = "Merge short line (all except dialoques)",
XLineBreaksAdded = "{0} line breaks added",
BreakLongLine = "Break long line",
FixLongDisplayTime = "Fix long display time",
@ -1139,6 +1141,8 @@ can edit in same subtitle file (collaboration)",
ShowEarlier = "Show earlier",
ShowLater = "Show later",
TotalAdjustmentX = "Total adjustment: {0}",
AllLines = "All lines",
SelectedLinesonly = "Selected lines only",
};
ShowHistory = new LanguageStructure.ShowHistory

View File

@ -264,6 +264,7 @@
public string FixMissingSpaces { get; set; }
public string BreakLongLines { get; set; }
public string RemoveLineBreaks { get; set; }
public string RemoveLineBreaksAll { get; set; }
public string FixUppercaseIInsindeLowercaseWords { get; set; }
public string FixDoubleApostrophes { get; set; }
public string AddPeriods { get; set; }
@ -296,6 +297,7 @@
public string XIsChangedToUppercase { get; set; }
public string FixFirstLetterToUppercaseAfterParagraph { get; set; }
public string MergeShortLine { get; set; }
public string MergeShortLineAll { get; set; }
public string XLineBreaksAdded { get; set; }
public string BreakLongLine { get; set; }
public string FixLongDisplayTime { get; set; }
@ -1074,6 +1076,8 @@
public string ShowEarlier { get; set; }
public string ShowLater { get; set; }
public string TotalAdjustmentX { get; set; }
public string AllLines { get; set; }
public string SelectedLinesonly { get; set; }
}
public class ShowHistory

View File

@ -143,6 +143,7 @@ namespace Nikse.SubtitleEdit.Logic
public bool InvalidItalicTagsTicked { get; set; }
public bool BreakLongLinesTicked { get; set; }
public bool MergeShortLinesTicked { get; set; }
public bool MergeShortLinesAllTicked { get; set; }
public bool UnneededSpacesTicked { get; set; }
public bool UnneededPeriodsTicked { get; set; }
public bool MissingSpacesTicked { get; set; }

View File

@ -266,27 +266,25 @@ namespace Nikse.SubtitleEdit.Logic
public static string AutoBreakLine(string text)
{
return AutoBreakLine(text, 5, Configuration.Settings.General.SubtitleLineMaximumLength);
return AutoBreakLine(text, 5, Configuration.Settings.General.SubtitleLineMaximumLength, Configuration.Settings.Tools.MergeLinesShorterThan);
}
public static string AutoBreakLine(string text, int mininumLength, int maximumLength)
public static string AutoBreakLine(string text, int mininumLength, int maximumLength, int mergeLinesShorterThan)
{
if (text.Length < mininumLength)
return text;
string temp = RemoveHtmlTags(text);
temp = temp.TrimEnd("!?.:;".ToCharArray());
if (text.Length < 40 && !temp.Contains(".") && !temp.Contains("!") && !temp.Contains("?"))
{
text = text.Replace(Environment.NewLine, " ");
text = text.Replace(" ", " ");
text = text.Replace(" ", " ");
return text;
}
string s = text.Replace(Environment.NewLine, " ");
s = s.Replace(" ", " ");
s = s.Replace(" ", " ");
string temp = RemoveHtmlTags(s);
if (temp.Length < mergeLinesShorterThan)
{
string[] lines = text.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
if (lines.Length == 2 && Utilities.RemoveHtmlTags(lines[1]).Trim().StartsWith("-"))
return text;
if (lines.Length == 3 && Utilities.RemoveHtmlTags(lines[1]).Trim().StartsWith("-") && Utilities.RemoveHtmlTags(lines[2]).Trim().StartsWith("-"))
return text;
return s;
}
int splitPos = -1;
int mid = s.Length / 2;