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;
@ -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)