From df4e8c5f08c6a2abc20bb320b420eeb0979a37dd Mon Sep 17 00:00:00 2001 From: May Kittens Devour Your Soul Date: Sun, 4 Feb 2018 23:30:02 +0100 Subject: [PATCH 1/5] Update and rename bih_OCRFixReplaceList.xml to ba_OCRFixReplaceList.xml properly renamed to intended language --- .../{bih_OCRFixReplaceList.xml => ba_OCRFixReplaceList.xml} | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) rename Dictionaries/{bih_OCRFixReplaceList.xml => ba_OCRFixReplaceList.xml} (99%) diff --git a/Dictionaries/bih_OCRFixReplaceList.xml b/Dictionaries/ba_OCRFixReplaceList.xml similarity index 99% rename from Dictionaries/bih_OCRFixReplaceList.xml rename to Dictionaries/ba_OCRFixReplaceList.xml index db427b3d7..7172ddd3a 100644 --- a/Dictionaries/bih_OCRFixReplaceList.xml +++ b/Dictionaries/ba_OCRFixReplaceList.xml @@ -1,4 +1,5 @@ + @@ -878,7 +879,6 @@ - @@ -921,6 +921,7 @@ + From 5b2feabc987f2b547c21cff3cd1f5574050401a2 Mon Sep 17 00:00:00 2001 From: May Kittens Devour Your Soul Date: Sun, 4 Feb 2018 23:42:33 +0100 Subject: [PATCH 2/5] Update ba_OCRFixReplaceList.xml --- Dictionaries/ba_OCRFixReplaceList.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dictionaries/ba_OCRFixReplaceList.xml b/Dictionaries/ba_OCRFixReplaceList.xml index 7172ddd3a..856632573 100644 --- a/Dictionaries/ba_OCRFixReplaceList.xml +++ b/Dictionaries/ba_OCRFixReplaceList.xml @@ -1229,7 +1229,7 @@ - + @@ -1253,7 +1253,7 @@ - + @@ -1542,7 +1542,6 @@ - From af6ed906e22b69ef7f57fba1924d11079fba9ebd Mon Sep 17 00:00:00 2001 From: May Kittens Devour Your Soul Date: Mon, 5 Feb 2018 12:41:25 +0100 Subject: [PATCH 3/5] Update srp_OCRFixReplaceList.xml --- Dictionaries/srp_OCRFixReplaceList.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dictionaries/srp_OCRFixReplaceList.xml b/Dictionaries/srp_OCRFixReplaceList.xml index 803481251..2d3be0d72 100644 --- a/Dictionaries/srp_OCRFixReplaceList.xml +++ b/Dictionaries/srp_OCRFixReplaceList.xml @@ -8,7 +8,7 @@ - + @@ -157,6 +157,10 @@ + + + + From df0612e61e158aad607dfedf8e8dd700c836e98b Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Mon, 5 Feb 2018 20:05:38 +0100 Subject: [PATCH 4/5] Add "Add 'word' to user dictionary" in spell check context menu - thx Mihai :) --- Changelog.txt | 2 ++ LanguageMaster.xml | 1 + libse/Language.cs | 1 + libse/LanguageDeserializer.cs | 3 +++ libse/LanguageStructure.cs | 1 + src/Forms/SpellCheck.Designer.cs | 32 +++++++++++++++++++++----------- src/Forms/SpellCheck.cs | 11 ++++++++++- 7 files changed, 39 insertions(+), 12 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 606ba1133..23938f41b 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -15,6 +15,7 @@ * Allow larger "margin" in SSA/ASSA styles - thx von Suppé * Export to images alignment option "Center, left justify" - thx Shota * Add "only if on separate line" option for "Remove interjections" - thx darnn + * Start with uppercase letter after title in "Change casing" - thx 791 * FIXED: * Fix Ctrl+v of time code in "Time code control" (regr. from 3.5.5) - thx Mohammed * Fix for format "TTML draft 2006-10" - thx thehulk @@ -25,6 +26,7 @@ * Fix missing color tag for EBU STL - thx Tom * Fix for null terminated text from mkv - thx taxen/mkver * Fix focus after Alt+3/4 (previous/next) - thx Jamakmake + * Fix possible crash in "Save original as..." - thx darnn 3.5.5 (26th January 2018) diff --git a/LanguageMaster.xml b/LanguageMaster.xml index db0107732..743ec9700 100644 --- a/LanguageMaster.xml +++ b/LanguageMaster.xml @@ -2031,6 +2031,7 @@ can edit in same subtitle file (collaboration) Edit whole text Edit word only Add '{0}' to name list + Add '{0}' to user dictionary Auto fix names where only casing differ Prompt for unknown one letter words Treat word ending " in' " as " ing " (English only) diff --git a/libse/Language.cs b/libse/Language.cs index 89896eb09..b41b12e0b 100644 --- a/libse/Language.cs +++ b/libse/Language.cs @@ -2327,6 +2327,7 @@ can edit in same subtitle file (collaboration)", EditWholeText = "Edit whole text", EditWordOnly = "Edit word only", AddXToNames = "Add '{0}' to name list", + AddXToUserDictionary = "Add '{0}' to user dictionary", AutoFixNames = "Auto fix names where only casing differ", CheckOneLetterWords = "Prompt for unknown one letter words", TreatINQuoteAsING = "Treat word ending \" in' \" as \" ing \" (English only)", diff --git a/libse/LanguageDeserializer.cs b/libse/LanguageDeserializer.cs index 9af480447..314d9a279 100644 --- a/libse/LanguageDeserializer.cs +++ b/libse/LanguageDeserializer.cs @@ -5506,6 +5506,9 @@ namespace Nikse.SubtitleEdit.Core case "SpellCheck/AddXToNames": language.SpellCheck.AddXToNames = reader.Value; break; + case "SpellCheck/AddXToUserDictionary": + language.SpellCheck.AddXToUserDictionary = reader.Value; + break; case "SpellCheck/AutoFixNames": language.SpellCheck.AutoFixNames = reader.Value; break; diff --git a/libse/LanguageStructure.cs b/libse/LanguageStructure.cs index 88aa9a63b..f8ed4ff2e 100644 --- a/libse/LanguageStructure.cs +++ b/libse/LanguageStructure.cs @@ -2206,6 +2206,7 @@ public string EditWholeText { get; set; } public string EditWordOnly { get; set; } public string AddXToNames { get; set; } + public string AddXToUserDictionary { get; set; } public string AutoFixNames { get; set; } public string CheckOneLetterWords { get; set; } public string TreatINQuoteAsING { get; set; } diff --git a/src/Forms/SpellCheck.Designer.cs b/src/Forms/SpellCheck.Designer.cs index 70cc5fcf3..510054118 100644 --- a/src/Forms/SpellCheck.Designer.cs +++ b/src/Forms/SpellCheck.Designer.cs @@ -34,6 +34,7 @@ this.buttonUseSuggestionAlways = new System.Windows.Forms.Button(); this.buttonAddToNames = new System.Windows.Forms.Button(); this.groupBoxWordNotFound = new System.Windows.Forms.GroupBox(); + this.buttonGoogleIt = new System.Windows.Forms.Button(); this.buttonUndo = new System.Windows.Forms.Button(); this.groupBoxSuggestions = new System.Windows.Forms.GroupBox(); this.checkBoxAutoChangeNames = new System.Windows.Forms.CheckBox(); @@ -44,7 +45,7 @@ this.textBoxWholeText = new System.Windows.Forms.TextBox(); this.labelActionInfo = new System.Windows.Forms.Label(); this.buttonSpellCheckDownload = new System.Windows.Forms.Button(); - this.buttonGoogleIt = new System.Windows.Forms.Button(); + this.addXToUserDictionaryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip1.SuspendLayout(); this.groupBoxWordNotFound.SuspendLayout(); this.groupBoxSuggestions.SuspendLayout(); @@ -108,9 +109,10 @@ // contextMenuStrip1 // this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.addXToNamesnoiseListToolStripMenuItem}); + this.addXToNamesnoiseListToolStripMenuItem, + this.addXToUserDictionaryToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(208, 26); + this.contextMenuStrip1.Size = new System.Drawing.Size(208, 70); this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStrip1Opening); // // addXToNamesnoiseListToolStripMenuItem @@ -247,6 +249,16 @@ this.groupBoxWordNotFound.TabStop = false; this.groupBoxWordNotFound.Text = "Word not found"; // + // buttonGoogleIt + // + this.buttonGoogleIt.Location = new System.Drawing.Point(6, 158); + this.buttonGoogleIt.Name = "buttonGoogleIt"; + this.buttonGoogleIt.Size = new System.Drawing.Size(280, 21); + this.buttonGoogleIt.TabIndex = 7; + this.buttonGoogleIt.Text = "&Google it"; + this.buttonGoogleIt.UseVisualStyleBackColor = true; + this.buttonGoogleIt.Click += new System.EventHandler(this.buttonGoogleIt_Click); + // // buttonUndo // this.buttonUndo.Location = new System.Drawing.Point(6, 185); @@ -357,15 +369,12 @@ this.buttonSpellCheckDownload.UseVisualStyleBackColor = true; this.buttonSpellCheckDownload.Click += new System.EventHandler(this.buttonSpellCheckDownload_Click); // - // buttonGoogleIt + // addXToUserDictionaryToolStripMenuItem // - this.buttonGoogleIt.Location = new System.Drawing.Point(6, 158); - this.buttonGoogleIt.Name = "buttonGoogleIt"; - this.buttonGoogleIt.Size = new System.Drawing.Size(280, 21); - this.buttonGoogleIt.TabIndex = 7; - this.buttonGoogleIt.Text = "&Google it"; - this.buttonGoogleIt.UseVisualStyleBackColor = true; - this.buttonGoogleIt.Click += new System.EventHandler(this.buttonGoogleIt_Click); + this.addXToUserDictionaryToolStripMenuItem.Name = "addXToUserDictionaryToolStripMenuItem"; + this.addXToUserDictionaryToolStripMenuItem.Size = new System.Drawing.Size(207, 22); + this.addXToUserDictionaryToolStripMenuItem.Text = "Add x to user dictionary"; + this.addXToUserDictionaryToolStripMenuItem.Click += new System.EventHandler(this.AddXToUserDictionaryToolStripMenuItem_Click); // // SpellCheck // @@ -437,5 +446,6 @@ private System.Windows.Forms.Button buttonSpellCheckDownload; private System.Windows.Forms.Button buttonUndo; private System.Windows.Forms.Button buttonGoogleIt; + private System.Windows.Forms.ToolStripMenuItem addXToUserDictionaryToolStripMenuItem; } } \ No newline at end of file diff --git a/src/Forms/SpellCheck.cs b/src/Forms/SpellCheck.cs index b62cc1fb3..32d0c2bcc 100644 --- a/src/Forms/SpellCheck.cs +++ b/src/Forms/SpellCheck.cs @@ -358,6 +358,7 @@ namespace Nikse.SubtitleEdit.Forms { string word = richTextBoxParagraph.SelectedText.Trim(); addXToNamesnoiseListToolStripMenuItem.Text = string.Format(Configuration.Settings.Language.SpellCheck.AddXToNames, word); + addXToUserDictionaryToolStripMenuItem.Text = string.Format(Configuration.Settings.Language.SpellCheck.AddXToUserDictionary, word); } else { @@ -374,6 +375,15 @@ namespace Nikse.SubtitleEdit.Forms } } + private void AddXToUserDictionaryToolStripMenuItem_Click(object sender, EventArgs e) + { + if (!string.IsNullOrWhiteSpace(richTextBoxParagraph.SelectedText)) + { + ChangeWord = richTextBoxParagraph.SelectedText.Trim(); + DoAction(SpellCheckAction.AddToDictionary); + } + } + private void CheckBoxAutoChangeNamesCheckedChanged(object sender, EventArgs e) { if (textBoxWord.Text.Length < 2) @@ -1085,6 +1095,5 @@ namespace Nikse.SubtitleEdit.Forms if (!string.IsNullOrWhiteSpace(text)) System.Diagnostics.Process.Start("https://www.google.com/search?q=" + Utilities.UrlEncode(text)); } - } } From f5179f814b8d3d92593cb204052f4d9a9e4e978a Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Mon, 5 Feb 2018 20:21:09 +0100 Subject: [PATCH 5/5] Remove empty lines if only contains control characters - thx Nima :) --- libse/Forms/FixCommonErrors/FixEmptyLines.cs | 12 ++++++------ libse/Subtitle.cs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libse/Forms/FixCommonErrors/FixEmptyLines.cs b/libse/Forms/FixCommonErrors/FixEmptyLines.cs index dbe69cc88..e4511d379 100644 --- a/libse/Forms/FixCommonErrors/FixEmptyLines.cs +++ b/libse/Forms/FixCommonErrors/FixEmptyLines.cs @@ -30,11 +30,11 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors // Ssa Tags if (text.StartsWith("{\\", StringComparison.Ordinal)) { - var endIDx = text.IndexOf('}', 2); - if (endIDx > 2) + var endIdx = text.IndexOf('}', 2); + if (endIdx > 2) { - pre = text.Substring(0, endIDx + 1); - text = text.Remove(0, endIDx + 1); + pre = text.Substring(0, endIdx + 1); + text = text.Remove(0, endIdx + 1); } } @@ -106,11 +106,11 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors { Paragraph p = subtitle.Paragraphs[i]; var text = HtmlUtil.RemoveHtmlTags(p.Text, true).Trim(); - if (callbacks.AllowFix(p, fixAction0) && string.IsNullOrEmpty(text)) + if (callbacks.AllowFix(p, fixAction0) && string.IsNullOrEmpty(text.RemoveControlCharacters())) { subtitle.Paragraphs.RemoveAt(i); emptyLinesRemoved++; - callbacks.AddFixToListView(p, fixAction0, p.Text, string.Format("[{0}]", language.RemovedEmptyLine)); + callbacks.AddFixToListView(p, fixAction0, p.Text, $"[{language.RemovedEmptyLine}]"); callbacks.AddToDeleteIndices(i); } } diff --git a/libse/Subtitle.cs b/libse/Subtitle.cs index 950e84eee..256718e90 100644 --- a/libse/Subtitle.cs +++ b/libse/Subtitle.cs @@ -458,7 +458,7 @@ namespace Nikse.SubtitleEdit.Core for (int i = _paragraphs.Count - 1; i >= 0; i--) { Paragraph p = _paragraphs[i]; - if (string.IsNullOrWhiteSpace(p.Text)) + if (string.IsNullOrWhiteSpace(p.Text.RemoveControlCharacters())) _paragraphs.RemoveAt(i); } if (count != _paragraphs.Count)