Fix MergeLinesShorterThan saving/loading - thx uckthis/OmrSi :)

Fix #5132
This commit is contained in:
Nikolaj Olsson 2021-06-17 22:42:31 +02:00
parent efaf8dcfc8
commit 5fc6f3cb03
2 changed files with 7 additions and 7 deletions

View File

@ -900,7 +900,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
if (gs.MergeLinesShorterThan >= 1 && gs.MergeLinesShorterThan < comboBoxMergeShortLineLength.Items.Count) if (gs.MergeLinesShorterThan >= 1 && gs.MergeLinesShorterThan < comboBoxMergeShortLineLength.Items.Count)
{ {
comboBoxMergeShortLineLength.SelectedIndex = gs.MergeLinesShorterThan; comboBoxMergeShortLineLength.SelectedIndex = gs.MergeLinesShorterThan - 1;
} }
else else
{ {
@ -1964,7 +1964,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
toolsSettings.VerifyPlaySeconds = comboBoxToolsVerifySeconds.SelectedIndex + 2; toolsSettings.VerifyPlaySeconds = comboBoxToolsVerifySeconds.SelectedIndex + 2;
toolsSettings.StartSceneIndex = comboBoxToolsStartSceneIndex.SelectedIndex; toolsSettings.StartSceneIndex = comboBoxToolsStartSceneIndex.SelectedIndex;
toolsSettings.EndSceneIndex = comboBoxToolsEndSceneIndex.SelectedIndex; toolsSettings.EndSceneIndex = comboBoxToolsEndSceneIndex.SelectedIndex;
gs.MergeLinesShorterThan = comboBoxMergeShortLineLength.SelectedIndex; gs.MergeLinesShorterThan = comboBoxMergeShortLineLength.SelectedIndex + 1;
if (gs.MergeLinesShorterThan > gs.SubtitleLineMaximumLength + 1) if (gs.MergeLinesShorterThan > gs.SubtitleLineMaximumLength + 1)
{ {
gs.MergeLinesShorterThan = gs.SubtitleLineMaximumLength; gs.MergeLinesShorterThan = gs.SubtitleLineMaximumLength;
@ -3354,7 +3354,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
if (profile.MergeLinesShorterThan >= 1 && profile.MergeLinesShorterThan < comboBoxMergeShortLineLength.Items.Count) if (profile.MergeLinesShorterThan >= 1 && profile.MergeLinesShorterThan < comboBoxMergeShortLineLength.Items.Count)
{ {
comboBoxMergeShortLineLength.SelectedIndex = profile.MergeLinesShorterThan; comboBoxMergeShortLineLength.SelectedIndex = profile.MergeLinesShorterThan - 1;
} }
else else
{ {

View File

@ -62,7 +62,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
comboBoxMergeShortLineLength.BeginUpdate(); comboBoxMergeShortLineLength.BeginUpdate();
comboBoxMergeShortLineLength.Items.Clear(); comboBoxMergeShortLineLength.Items.Clear();
for (int i = 10; i < 100; i++) for (int i = 1; i < 100; i++)
{ {
comboBoxMergeShortLineLength.Items.Add(i.ToString(CultureInfo.InvariantCulture)); comboBoxMergeShortLineLength.Items.Add(i.ToString(CultureInfo.InvariantCulture));
} }
@ -204,7 +204,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
RulesProfiles[idx].MaxNumberOfLines = (int)numericUpDownMaxNumberOfLines.Value; RulesProfiles[idx].MaxNumberOfLines = (int)numericUpDownMaxNumberOfLines.Value;
RulesProfiles[idx].SubtitleMaximumWordsPerMinute = (int)numericUpDownMaxWordsMin.Value; RulesProfiles[idx].SubtitleMaximumWordsPerMinute = (int)numericUpDownMaxWordsMin.Value;
RulesProfiles[idx].CpsIncludesSpace = checkBoxCpsIncludeWhiteSpace.Checked; RulesProfiles[idx].CpsIncludesSpace = checkBoxCpsIncludeWhiteSpace.Checked;
RulesProfiles[idx].MergeLinesShorterThan = comboBoxMergeShortLineLength.SelectedIndex + 10; RulesProfiles[idx].MergeLinesShorterThan = comboBoxMergeShortLineLength.SelectedIndex + 1;
RulesProfiles[idx].DialogStyle = DialogSplitMerge.GetDialogStyleFromIndex(comboBoxDialogStyle.SelectedIndex); RulesProfiles[idx].DialogStyle = DialogSplitMerge.GetDialogStyleFromIndex(comboBoxDialogStyle.SelectedIndex);
RulesProfiles[idx].ContinuationStyle = ContinuationUtilities.GetContinuationStyleFromIndex(comboBoxContinuationStyle.SelectedIndex); RulesProfiles[idx].ContinuationStyle = ContinuationUtilities.GetContinuationStyleFromIndex(comboBoxContinuationStyle.SelectedIndex);
UpdateRulesProfilesLine(idx); UpdateRulesProfilesLine(idx);
@ -262,9 +262,9 @@ namespace Nikse.SubtitleEdit.Forms.Options
numericUpDownMaxWordsMin.Value = p.SubtitleMaximumWordsPerMinute; numericUpDownMaxWordsMin.Value = p.SubtitleMaximumWordsPerMinute;
} }
checkBoxCpsIncludeWhiteSpace.Checked = RulesProfiles[idx].CpsIncludesSpace; checkBoxCpsIncludeWhiteSpace.Checked = RulesProfiles[idx].CpsIncludesSpace;
if (RulesProfiles[idx].MergeLinesShorterThan >= 10 && RulesProfiles[idx].MergeLinesShorterThan - 10 < comboBoxMergeShortLineLength.Items.Count) if (RulesProfiles[idx].MergeLinesShorterThan >= 1 && RulesProfiles[idx].MergeLinesShorterThan - 1 < comboBoxMergeShortLineLength.Items.Count)
{ {
comboBoxMergeShortLineLength.SelectedIndex = RulesProfiles[idx].MergeLinesShorterThan - 10; comboBoxMergeShortLineLength.SelectedIndex = RulesProfiles[idx].MergeLinesShorterThan - 1;
} }
else else
{ {