From 0e45b8aee7794616c81a4c3063194f46ac8854d5 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sat, 16 Dec 2023 13:07:28 +0100 Subject: [PATCH] Remember combobox line split mode in "Import plain text" - thx Leon :) Fix #7743 --- src/libse/Common/Settings.cs | 8 ++++++++ src/ui/Forms/ImportText.cs | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/libse/Common/Settings.cs b/src/libse/Common/Settings.cs index 150571127..1d53c89c7 100644 --- a/src/libse/Common/Settings.cs +++ b/src/libse/Common/Settings.cs @@ -330,6 +330,7 @@ namespace Nikse.SubtitleEdit.Core.Common public bool FixCommonErrorsFixOverlapAllowEqualEndStart { get; set; } public bool FixCommonErrorsSkipStepOne { get; set; } public string ImportTextSplitting { get; set; } + public string ImportTextSplittingLineMode { get; set; } public string ImportTextLineBreak { get; set; } public bool ImportTextMergeShortLines { get; set; } public bool ImportTextRemoveEmptyLines { get; set; } @@ -6151,6 +6152,12 @@ $HorzAlign = Center settings.Tools.ImportTextSplitting = subNode.InnerText; } + subNode = node.SelectSingleNode("ImportTextSplittingLineMode"); + if (subNode != null) + { + settings.Tools.ImportTextSplittingLineMode = subNode.InnerText; + } + subNode = node.SelectSingleNode("ImportTextMergeShortLines"); if (subNode != null) { @@ -11795,6 +11802,7 @@ $HorzAlign = Center textWriter.WriteElementString("FixCommonErrorsFixOverlapAllowEqualEndStart", settings.Tools.FixCommonErrorsFixOverlapAllowEqualEndStart.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("FixCommonErrorsSkipStepOne", settings.Tools.FixCommonErrorsSkipStepOne.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("ImportTextSplitting", settings.Tools.ImportTextSplitting); + textWriter.WriteElementString("ImportTextSplittingLineMode", settings.Tools.ImportTextSplittingLineMode); textWriter.WriteElementString("ImportTextMergeShortLines", settings.Tools.ImportTextMergeShortLines.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("ImportTextLineBreak", settings.Tools.ImportTextLineBreak); textWriter.WriteElementString("ImportTextRemoveEmptyLines", settings.Tools.ImportTextRemoveEmptyLines.ToString(CultureInfo.InvariantCulture)); diff --git a/src/ui/Forms/ImportText.cs b/src/ui/Forms/ImportText.cs index af0922761..0f0aa47aa 100644 --- a/src/ui/Forms/ImportText.cs +++ b/src/ui/Forms/ImportText.cs @@ -45,6 +45,11 @@ namespace Nikse.SubtitleEdit.Forms comboBoxLineMode.Items.Add(LanguageSettings.Current.ImportText.OneLineIsOneSubtitle); comboBoxLineMode.Items.Add(LanguageSettings.Current.ImportText.TwoLinesAreOneSubtitle); comboBoxLineMode.SelectedIndex = 0; + if (Configuration.Settings.Tools.ImportTextSplittingLineMode == "TwoLinesAreOneSubtitle") + { + comboBoxLineMode.SelectedIndex = 1; + } + labelLineBreak.Text = LanguageSettings.Current.ImportText.LineBreak; columnHeaderFName.Text = LanguageSettings.Current.JoinSubtitles.FileName; columnHeaderSize.Text = LanguageSettings.Current.General.Size; @@ -1200,6 +1205,15 @@ namespace Nikse.SubtitleEdit.Forms Configuration.Settings.Tools.ImportTextAutoSplitNumberOfLines = numericUpDownAutoSplitMaxLines.Value; Configuration.Settings.Tools.ImportTextAutoSplitAtBlank = checkBoxAutoSplitAtBlankLines.Checked; + if (comboBoxLineMode.SelectedIndex == 0) + { + Configuration.Settings.Tools.ImportTextSplittingLineMode = "OneLineIsOneSubtitle"; + } + else + { + Configuration.Settings.Tools.ImportTextSplittingLineMode = "TwoLinesAreOneSubtitle"; + } + if (radioButtonAutoSplit.Checked) { Configuration.Settings.Tools.ImportTextRemoveLinesNoLetters = checkBoxAutoSplitRemoveLinesNoLetters.Checked;