Remember "Import plain text" options - thx Leon :)

Fix  #2350
This commit is contained in:
Nikolaj Olsson 2017-04-27 10:10:49 +02:00
parent 3e7c32a25d
commit 07ab526eba
3 changed files with 79 additions and 8 deletions

View File

@ -22,6 +22,7 @@
* In "Change casing" it's now possible to add extra names
* Export image margins are now percentage - thx aaaxx/gorgorias
* Added "Clear shortcut" button to settings - thx Simon
* "Import plain text" now rembembers options - thx Leon
* FIXED:
* Fixed crash in "Add to user dictionary" in OCR - thx alfix0
* Fixed original file name bug in "Undo" - thx darnn

View File

@ -169,8 +169,15 @@ namespace Nikse.SubtitleEdit.Core
public bool FixCommonErrorsFixOverlapAllowEqualEndStart { get; set; }
public bool FixCommonErrorsSkipStepOne { get; set; }
public string ImportTextSplitting { get; set; }
public bool ImportTextMergeShortLines { get; set; }
public string ImportTextLineBreak { get; set; }
public bool ImportTextMergeShortLines { get; set; }
public bool ImportTextRemoveEmptyLines { get; set; }
public bool ImportTextRemoveLinesNoLetters { get; set; }
public bool ImportTextGenerateTimeCodes { get; set; }
public bool ImportTextAutoBreak { get; set; }
public decimal ImportTextGap { get; set; }
public bool ImportTextDurationAuto { get; set; }
public decimal ImportTextFixedDuration { get; set; }
public string GenerateTimeCodePatterns { get; set; }
public string MusicSymbolStyle { get; set; }
public int BridgeGapMilliseconds { get; set; }
@ -1999,6 +2006,33 @@ namespace Nikse.SubtitleEdit.Core
subNode = node.SelectSingleNode("ImportTextLineBreak");
if (subNode != null)
settings.Tools.ImportTextLineBreak = subNode.InnerText;
subNode = node.SelectSingleNode("ImportTextMergeShortLines");
if (subNode != null)
settings.Tools.ImportTextMergeShortLines = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("ImportTextRemoveEmptyLines");
if (subNode != null)
settings.Tools.ImportTextRemoveEmptyLines = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("ImportTextRemoveLinesNoLetters");
if (subNode != null)
settings.Tools.ImportTextRemoveLinesNoLetters = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("ImportTextGenerateTimeCodes");
if (subNode != null)
settings.Tools.ImportTextGenerateTimeCodes = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("ImportTextAutoBreak");
if (subNode != null)
settings.Tools.ImportTextAutoBreak = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("ImportTextGap");
if (subNode != null)
settings.Tools.ImportTextGap = Convert.ToDecimal(subNode.InnerText);
subNode = node.SelectSingleNode("ImportTextDurationAuto");
if (subNode != null)
settings.Tools.ImportTextDurationAuto = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("ImportTextFixedDuration");
if (subNode != null)
settings.Tools.ImportTextFixedDuration = Convert.ToDecimal(subNode.InnerText);
subNode = node.SelectSingleNode("GenerateTimeCodePatterns");
if (subNode != null)
settings.Tools.GenerateTimeCodePatterns = subNode.InnerText;
subNode = node.SelectSingleNode("GenerateTimeCodePatterns");
if (subNode != null)
settings.Tools.GenerateTimeCodePatterns = subNode.InnerText;
@ -3106,7 +3140,7 @@ namespace Nikse.SubtitleEdit.Core
textWriter.WriteElementString("ShowToolbarRemoveTextForHi", settings.General.ShowToolbarRemoveTextForHi.ToString());
textWriter.WriteElementString("ShowToolbarVisualSync", settings.General.ShowToolbarVisualSync.ToString());
textWriter.WriteElementString("ShowToolbarSpellCheck", settings.General.ShowToolbarSpellCheck.ToString());
textWriter.WriteElementString("ShowToolbarNetflixGlyphCheck", settings.General.ShowToolbarNetflixGlyphCheck.ToString());
textWriter.WriteElementString("ShowToolbarNetflixGlyphCheck", settings.General.ShowToolbarNetflixGlyphCheck.ToString());
textWriter.WriteElementString("ShowToolbarSettings", settings.General.ShowToolbarSettings.ToString());
textWriter.WriteElementString("ShowToolbarHelp", settings.General.ShowToolbarHelp.ToString());
textWriter.WriteElementString("ShowFrameRate", settings.General.ShowFrameRate.ToString());
@ -3118,7 +3152,7 @@ namespace Nikse.SubtitleEdit.Core
textWriter.WriteElementString("DefaultSubtitleFormat", settings.General.DefaultSubtitleFormat);
textWriter.WriteElementString("DefaultEncoding", settings.General.DefaultEncoding);
textWriter.WriteElementString("AutoConvertToUtf8", settings.General.AutoConvertToUtf8.ToString());
textWriter.WriteElementString("WriteUtf8Bom", settings.General.WriteUtf8Bom.ToString());
textWriter.WriteElementString("WriteUtf8Bom", settings.General.WriteUtf8Bom.ToString());
textWriter.WriteElementString("AutoGuessAnsiEncoding", settings.General.AutoGuessAnsiEncoding.ToString());
textWriter.WriteElementString("_subtitleFontName", settings.General.SubtitleFontName);
textWriter.WriteElementString("SubtitleFontSize", settings.General.SubtitleFontSize.ToString(CultureInfo.InvariantCulture));
@ -3144,9 +3178,9 @@ namespace Nikse.SubtitleEdit.Core
textWriter.WriteElementString("SetStartEndHumanDelay", settings.General.SetStartEndHumanDelay.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("AutoWrapLineWhileTyping", settings.General.AutoWrapLineWhileTyping.ToString());
textWriter.WriteElementString("SubtitleMaximumCharactersPerSeconds", settings.General.SubtitleMaximumCharactersPerSeconds.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("SubtitleOptimalCharactersPerSeconds", settings.General.SubtitleOptimalCharactersPerSeconds.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("SubtitleOptimalCharactersPerSeconds", settings.General.SubtitleOptimalCharactersPerSeconds.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("CharactersPerSecondsIgnoreWhiteSpace", settings.General.CharactersPerSecondsIgnoreWhiteSpace.ToString());
textWriter.WriteElementString("SubtitleMaximumWordsPerMinute", settings.General.SubtitleMaximumWordsPerMinute.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("SubtitleMaximumWordsPerMinute", settings.General.SubtitleMaximumWordsPerMinute.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("SpellCheckLanguage", settings.General.SpellCheckLanguage);
textWriter.WriteElementString("VideoPlayer", settings.General.VideoPlayer);
textWriter.WriteElementString("VideoPlayerDefaultVolume", settings.General.VideoPlayerDefaultVolume.ToString(CultureInfo.InvariantCulture));
@ -3311,6 +3345,15 @@ namespace Nikse.SubtitleEdit.Core
textWriter.WriteElementString("ImportTextSplitting", settings.Tools.ImportTextSplitting);
textWriter.WriteElementString("ImportTextMergeShortLines", settings.Tools.ImportTextMergeShortLines.ToString());
textWriter.WriteElementString("ImportTextLineBreak", settings.Tools.ImportTextLineBreak);
textWriter.WriteElementString("ImportTextMergeShortLines", settings.Tools.ImportTextMergeShortLines.ToString());
textWriter.WriteElementString("ImportTextRemoveEmptyLines", settings.Tools.ImportTextRemoveEmptyLines.ToString());
textWriter.WriteElementString("ImportTextRemoveLinesNoLetters", settings.Tools.ImportTextRemoveLinesNoLetters.ToString());
textWriter.WriteElementString("ImportTextGenerateTimeCodes", settings.Tools.ImportTextGenerateTimeCodes.ToString());
textWriter.WriteElementString("ImportTextAutoBreak", settings.Tools.ImportTextAutoBreak.ToString());
textWriter.WriteElementString("ImportTextGap", settings.Tools.ImportTextGap.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("ImportTextDurationAuto", settings.Tools.ImportTextDurationAuto.ToString());
textWriter.WriteElementString("ImportTextFixedDuration", settings.Tools.ImportTextFixedDuration.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("GenerateTimeCodePatterns", settings.Tools.GenerateTimeCodePatterns);
textWriter.WriteElementString("GenerateTimeCodePatterns", settings.Tools.GenerateTimeCodePatterns);
textWriter.WriteElementString("MusicSymbolStyle", settings.Tools.MusicSymbolStyle);
textWriter.WriteElementString("BridgeGapMilliseconds", settings.Tools.BridgeGapMilliseconds.ToString(CultureInfo.InvariantCulture));

View File

@ -69,10 +69,30 @@ namespace Nikse.SubtitleEdit.Forms
radioButtonSplitAtBlankLines.Checked = true;
else if (Configuration.Settings.Tools.ImportTextSplitting.Equals("line", StringComparison.OrdinalIgnoreCase))
radioButtonLineMode.Checked = true;
checkBoxMergeShortLines.Checked = Configuration.Settings.Tools.ImportTextMergeShortLines;
comboBoxLineBreak.Text = Configuration.Settings.Tools.ImportTextLineBreak;
checkBoxMergeShortLines.Checked = Configuration.Settings.Tools.ImportTextMergeShortLines;
checkBoxRemoveEmptyLines.Checked = Configuration.Settings.Tools.ImportTextRemoveEmptyLines;
checkBoxRemoveLinesWithoutLetters.Checked = Configuration.Settings.Tools.ImportTextRemoveLinesNoLetters;
checkBoxGenerateTimeCodes.Checked = Configuration.Settings.Tools.ImportTextGenerateTimeCodes;
checkBoxAutoBreak.Checked = Configuration.Settings.Tools.ImportTextAutoBreak;
if (Configuration.Settings.Tools.ImportTextGap >= numericUpDownGapBetweenLines.Minimum && Configuration.Settings.Tools.ImportTextGap <= numericUpDownGapBetweenLines.Maximum)
{
numericUpDownGapBetweenLines.Value = Configuration.Settings.Tools.ImportTextGap;
}
if (Configuration.Settings.Tools.ImportTextDurationAuto)
{
radioButtonDurationAuto.Checked = true;
}
else
{
radioButtonDurationFixed.Checked = true;
}
numericUpDownDurationFixed.Enabled = radioButtonDurationFixed.Checked;
if (Configuration.Settings.Tools.ImportTextFixedDuration >= numericUpDownDurationFixed.Minimum &&
Configuration.Settings.Tools.ImportTextFixedDuration <= numericUpDownDurationFixed.Maximum)
{
numericUpDownDurationFixed.Value = Configuration.Settings.Tools.ImportTextFixedDuration;
}
UiUtil.FixLargeFonts(this, buttonOK);
_refreshTimer.Interval = 400;
_refreshTimer.Tick += RefreshTimerTick;
@ -766,8 +786,15 @@ namespace Nikse.SubtitleEdit.Forms
Configuration.Settings.Tools.ImportTextSplitting = "line";
else
Configuration.Settings.Tools.ImportTextSplitting = "auto";
Configuration.Settings.Tools.ImportTextMergeShortLines = checkBoxMergeShortLines.Checked;
Configuration.Settings.Tools.ImportTextLineBreak = comboBoxLineBreak.Text.Trim();
Configuration.Settings.Tools.ImportTextMergeShortLines = checkBoxMergeShortLines.Checked;
Configuration.Settings.Tools.ImportTextRemoveEmptyLines = checkBoxRemoveEmptyLines.Checked;
Configuration.Settings.Tools.ImportTextRemoveLinesNoLetters = checkBoxRemoveLinesWithoutLetters.Checked;
Configuration.Settings.Tools.ImportTextGenerateTimeCodes = checkBoxGenerateTimeCodes.Checked;
Configuration.Settings.Tools.ImportTextAutoBreak = checkBoxAutoBreak.Checked;
Configuration.Settings.Tools.ImportTextGap = numericUpDownGapBetweenLines.Value;
Configuration.Settings.Tools.ImportTextDurationAuto = radioButtonDurationAuto.Checked;
Configuration.Settings.Tools.ImportTextFixedDuration= numericUpDownDurationFixed.Value;
}
private void checkBoxMultipleFiles_CheckedChanged(object sender, EventArgs e)