Rollback max number of lines enforcement - thx pandalamp :)

It's now controlled by the hidden setting `MaxNumberOfLinesPlusAbort` which should be 1 or 0 (probably)
Fix #5313  and related to #5107
This commit is contained in:
niksedk 2021-09-09 22:23:31 +02:00
parent 5c95ccd6f1
commit 17271d6621
2 changed files with 11 additions and 2 deletions

View File

@ -1142,6 +1142,7 @@ $HorzAlign = Center
public bool RemoveBadCharsWhenOpening { get; set; }
public int SubtitleLineMaximumLength { get; set; }
public int MaxNumberOfLines { get; set; }
public int MaxNumberOfLinesPlusAbort { get; set; }
public int MergeLinesShorterThan { get; set; }
public int SubtitleMinimumDisplayMilliseconds { get; set; }
public int SubtitleMaximumDisplayMilliseconds { get; set; }
@ -1309,6 +1310,7 @@ $HorzAlign = Center
StartRememberPositionAndSize = true;
SubtitleLineMaximumLength = 43;
MaxNumberOfLines = 2;
MaxNumberOfLinesPlusAbort = 1;
MergeLinesShorterThan = 33;
SubtitleMinimumDisplayMilliseconds = 1000;
SubtitleMaximumDisplayMilliseconds = 8 * 1000;
@ -3136,6 +3138,12 @@ $HorzAlign = Center
settings.General.MaxNumberOfLines = Convert.ToInt32(subNode.InnerText, CultureInfo.InvariantCulture);
}
subNode = node.SelectSingleNode("MaxNumberOfLinesPlusAbort");
if (subNode != null)
{
settings.General.MaxNumberOfLinesPlusAbort = Convert.ToInt32(subNode.InnerText, CultureInfo.InvariantCulture);
}
subNode = node.SelectSingleNode("MergeLinesShorterThan");
if (subNode != null)
{
@ -8686,6 +8694,7 @@ $HorzAlign = Center
textWriter.WriteElementString("RemoveBadCharsWhenOpening", settings.General.RemoveBadCharsWhenOpening.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("SubtitleLineMaximumLength", settings.General.SubtitleLineMaximumLength.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("MaxNumberOfLines", settings.General.MaxNumberOfLines.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("MaxNumberOfLinesPlusAbort", settings.General.MaxNumberOfLinesPlusAbort.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("MergeLinesShorterThan", settings.General.MergeLinesShorterThan.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("SubtitleMinimumDisplayMilliseconds", settings.General.SubtitleMinimumDisplayMilliseconds.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("SubtitleMaximumDisplayMilliseconds", settings.General.SubtitleMaximumDisplayMilliseconds.ToString(CultureInfo.InvariantCulture));

View File

@ -9995,7 +9995,7 @@ namespace Nikse.SubtitleEdit.Forms
int numberOfLines = Utilities.GetNumberOfLines(textBoxListViewText.Text);
if (e.Modifiers == Keys.None && e.KeyCode == Keys.Enter && numberOfLines >= Configuration.Settings.General.MaxNumberOfLines)
if (e.Modifiers == Keys.None && e.KeyCode == Keys.Enter && numberOfLines >= Configuration.Settings.General.MaxNumberOfLines + Configuration.Settings.General.MaxNumberOfLinesPlusAbort)
{
e.SuppressKeyPress = true;
}
@ -26004,7 +26004,7 @@ namespace Nikse.SubtitleEdit.Forms
int numberOfLines = Utilities.GetNumberOfLines(textBoxListViewTextOriginal.Text);
if (e.Modifiers == Keys.None && e.KeyCode == Keys.Enter && numberOfLines >= Configuration.Settings.General.MaxNumberOfLines)
if (e.Modifiers == Keys.None && e.KeyCode == Keys.Enter && numberOfLines >= Configuration.Settings.General.MaxNumberOfLines + Configuration.Settings.General.MaxNumberOfLinesPlusAbort)
{
e.SuppressKeyPress = true;
}