diff --git a/LanguageMaster.xml b/LanguageMaster.xml index be5b64ae8..7f2c5e558 100644 --- a/LanguageMaster.xml +++ b/LanguageMaster.xml @@ -618,7 +618,9 @@ Note: Do check free disk space. Nothing to fix :) Fixes found: {0} Fixes applied: {0} - Nothing to fix but a few things could be improved - see log for details + Nothing could be fixed automatically. The subtitle contains errors - see log for details + {0} issue(s) fixed but the subtitle still contain errors - see log for details + {0} issue(s) could be fixed but the subtitle will still contain errors - see log for details Unchecked "Fix alone lowercase 'i' to 'I' (English)" {0} i's changed to uppercase Fix first letter to uppercase after paragraph @@ -1514,6 +1516,7 @@ Continue? Insert subtitle at waveform position will cause overlap! Continue anyway? + Subtitle contains negative duration in line(s): {0} Set play rate (speed) to {0}% Cannot read/edit .idx files. Idx files are a part of an idx/sub file pair (also called VobSub), and Subtitle Edit can open the .sub file. This file seems to be a compressed .rar file. Subtitle Edit cannot open compressed files. diff --git a/libse/Language.cs b/libse/Language.cs index 91e34d6e7..61c54daab 100644 --- a/libse/Language.cs +++ b/libse/Language.cs @@ -814,7 +814,9 @@ namespace Nikse.SubtitleEdit.Core NothingToFix = "Nothing to fix :)", FixesFoundX = "Fixes found: {0}", XFixesApplied = "Fixes applied: {0}", - NothingToFixBut = "Nothing to fix but a few things could be improved - see log for details", + NothingFixableBut = "Nothing could be fixed automatically. The subtitle contains errors - see log for details", + XFixedBut = "{0} issue(s) fixed but the subtitle still contain errors - see log for details", + XCouldBeFixedBut = "{0} issue(s) could be fixed but the subtitle will still contain errors - see log for details", UncheckedFixLowercaseIToUppercaseI = "Unchecked \"Fix alone lowercase 'i' to 'I' (English)\"", XIsChangedToUppercase = "{0} i's changed to uppercase", FixFirstLetterToUppercaseAfterParagraph = "Fix first letter to uppercase after paragraph", @@ -1410,6 +1412,7 @@ namespace Nikse.SubtitleEdit.Core PromptInsertSubtitleOverlap = "Insert subtitle at waveform position will cause overlap!" + Environment.NewLine + Environment.NewLine + "Continue anyway?", + SubtitleContainsNegativeDurationsX = "Subtitle contains negative duration in line(s): {0}", SetPlayRateX = "Set play rate (speed) to {0}%", ErrorLoadIdx = "Cannot read/edit .idx files. Idx files are a part of an idx/sub file pair (also called VobSub), and Subtitle Edit can open the .sub file.", ErrorLoadRar = "This file seems to be a compressed .rar file. Subtitle Edit cannot open compressed files.", diff --git a/libse/LanguageDeserializer.cs b/libse/LanguageDeserializer.cs index 015f41f58..acde91f31 100644 --- a/libse/LanguageDeserializer.cs +++ b/libse/LanguageDeserializer.cs @@ -1621,8 +1621,14 @@ namespace Nikse.SubtitleEdit.Core case "FixCommonErrors/XFixesApplied": language.FixCommonErrors.XFixesApplied = reader.Value; break; - case "FixCommonErrors/NothingToFixBut": - language.FixCommonErrors.NothingToFixBut = reader.Value; + case "FixCommonErrors/NothingFixableBut": + language.FixCommonErrors.NothingFixableBut = reader.Value; + break; + case "FixCommonErrors/XFixedBut": + language.FixCommonErrors.XFixedBut = reader.Value; + break; + case "FixCommonErrors/XCouldBeFixedBut": + language.FixCommonErrors.XCouldBeFixedBut = reader.Value; break; case "FixCommonErrors/UncheckedFixLowercaseIToUppercaseI": language.FixCommonErrors.UncheckedFixLowercaseIToUppercaseI = reader.Value; @@ -3220,6 +3226,9 @@ namespace Nikse.SubtitleEdit.Core case "Main/PromptInsertSubtitleOverlap": language.Main.PromptInsertSubtitleOverlap = reader.Value; break; + case "Main/SubtitleContainsNegativeDurationsX": + language.Main.SubtitleContainsNegativeDurationsX = reader.Value; + break; case "Main/SetPlayRateX": language.Main.SetPlayRateX = reader.Value; break; diff --git a/libse/LanguageStructure.cs b/libse/LanguageStructure.cs index 8bfd53c3e..3799bc4c8 100644 --- a/libse/LanguageStructure.cs +++ b/libse/LanguageStructure.cs @@ -686,7 +686,9 @@ public string NothingToFix { get; set; } public string FixesFoundX { get; set; } public string XFixesApplied { get; set; } - public string NothingToFixBut { get; set; } + public string NothingFixableBut { get; set; } + public string XFixedBut { get; set; } + public string XCouldBeFixedBut { get; set; } public string UncheckedFixLowercaseIToUppercaseI { get; set; } public string XIsChangedToUppercase { get; set; } public string FixFirstLetterToUppercaseAfterParagraph { get; set; } @@ -1270,6 +1272,7 @@ public string XPercentCompleted { get; set; } public string NextX { get; set; } public string PromptInsertSubtitleOverlap { get; set; } + public string SubtitleContainsNegativeDurationsX { get; set; } public string SetPlayRateX { get; set; } public string ErrorLoadIdx { get; set; } public string ErrorLoadRar { get; set; } diff --git a/libse/Settings.cs b/libse/Settings.cs index aaaf55a3a..7a4b093f9 100644 --- a/libse/Settings.cs +++ b/libse/Settings.cs @@ -783,6 +783,7 @@ $HorzAlign = Center public bool AutoSave { get; set; } public string PreviewAssaText { get; set; } public bool ShowProgress { get; set; } + public bool ShowNegativeDurationInfoOnSave { get; set; } public long CurrentVideoOffsetInMs { get; set; } public bool UseDarkTheme { get; set; } public bool ShowBetaStuff { get; set; } @@ -2497,6 +2498,12 @@ $HorzAlign = Center settings.General.ShowProgress = Convert.ToBoolean(subNode.InnerText.Trim()); } + subNode = node.SelectSingleNode("ShowNegativeDurationInfoOnSave"); + if (subNode != null) + { + settings.General.ShowNegativeDurationInfoOnSave = Convert.ToBoolean(subNode.InnerText.Trim()); + } + subNode = node.SelectSingleNode("UseDarkTheme"); if (subNode != null) { @@ -6094,6 +6101,7 @@ $HorzAlign = Center textWriter.WriteElementString("AutoSave", settings.General.AutoSave.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("PreviewAssaText", settings.General.PreviewAssaText); textWriter.WriteElementString("ShowProgress", settings.General.ShowProgress.ToString(CultureInfo.InvariantCulture)); + textWriter.WriteElementString("ShowNegativeDurationInfoOnSave", settings.General.ShowNegativeDurationInfoOnSave.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("UseDarkTheme", settings.General.UseDarkTheme.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("ShowBetaStuff", settings.General.ShowBetaStuff.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("NewEmptyDefaultMs", settings.General.NewEmptyDefaultMs.ToString(CultureInfo.InvariantCulture)); diff --git a/src/Forms/FixCommonErrors.Designer.cs b/src/Forms/FixCommonErrors.Designer.cs index 2deb77492..c61239438 100644 --- a/src/Forms/FixCommonErrors.Designer.cs +++ b/src/Forms/FixCommonErrors.Designer.cs @@ -682,7 +682,7 @@ namespace Nikse.SubtitleEdit.Forms this.textBoxFixedIssues.Name = "textBoxFixedIssues"; this.textBoxFixedIssues.ReadOnly = true; this.textBoxFixedIssues.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.textBoxFixedIssues.Size = new System.Drawing.Size(796, 466); + this.textBoxFixedIssues.Size = new System.Drawing.Size(796, 499); this.textBoxFixedIssues.TabIndex = 5; this.textBoxFixedIssues.WordWrap = false; // diff --git a/src/Forms/FixCommonErrors.cs b/src/Forms/FixCommonErrors.cs index 8b766b573..bf2995e27 100644 --- a/src/Forms/FixCommonErrors.cs +++ b/src/Forms/FixCommonErrors.cs @@ -528,9 +528,9 @@ namespace Nikse.SubtitleEdit.Forms public void ShowStatus(string message) { message = message.Replace(Environment.NewLine, " "); - if (message.Length > 83) + if (message.Length > 103) { - message = message.Substring(0, 80) + "..."; + message = message.Substring(0, 100) + "..."; } labelStatus.Text = message; @@ -661,7 +661,7 @@ namespace Nikse.SubtitleEdit.Forms { Cursor = Cursors.WaitCursor; Next(); - ShowAvailableFixesStatus(); + ShowAvailableFixesStatus(false); } Cursor = Cursors.Default; } @@ -1368,19 +1368,7 @@ namespace Nikse.SubtitleEdit.Forms RunSelectedActions(); FixedSubtitle = new Subtitle(Subtitle, false); subtitleListView1.Fill(FixedSubtitle); - if (_totalFixes == 0 && _totalErrors == 0) - { - ShowStatus(_language.NothingToFix); - } - else if (_totalFixes > 0) - { - ShowStatus(string.Format(_language.XFixesApplied, _totalFixes)); - } - else if (_totalErrors > 0) - { - ShowStatus(_language.NothingToFixBut); - } - + ShowAvailableFixesStatus(true); RefreshFixes(); if (listViewFixes.Items.Count == 0) { @@ -1406,14 +1394,13 @@ namespace Nikse.SubtitleEdit.Forms ShowStatus(_language.Analysing); _totalFixes = 0; RefreshFixes(); - - ShowAvailableFixesStatus(); - + ShowAvailableFixesStatus(false); Cursor = Cursors.Default; } - private void ShowAvailableFixesStatus() + private void ShowAvailableFixesStatus(bool applied) { + labelStatus.ForeColor = DefaultForeColor; if (_totalFixes == 0 && _totalErrors == 0) { ShowStatus(_language.NothingToFix); @@ -1424,11 +1411,27 @@ namespace Nikse.SubtitleEdit.Forms } else if (_totalFixes > 0) { - ShowStatus(string.Format(_language.FixesFoundX, _totalFixes)); + if (_totalErrors > 0) + { + labelStatus.ForeColor = Color.Red; + if (applied) + { + ShowStatus(string.Format(_language.XFixedBut, _totalFixes)); + } + else + { + ShowStatus(string.Format(_language.XCouldBeFixedBut, _totalFixes)); + } + } + else + { + ShowStatus(string.Format(_language.XFixesApplied, _totalFixes)); + } } else if (_totalErrors > 0) { - ShowStatus(_language.NothingToFixBut); + labelStatus.ForeColor = Color.Red; + ShowStatus(_language.NothingFixableBut); } TopMost = true; diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index 6d5d3eb6a..8bf4be19d 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -4702,6 +4702,40 @@ namespace Nikse.SubtitleEdit.Forms { ShowStatus(s); } + + if (Configuration.Settings.General.ShowNegativeDurationInfoOnSave) + { + var sb = new StringBuilder(); + for (var index = 0; index < _subtitle.Paragraphs.Count; index++) + { + var p = _subtitle.Paragraphs[index]; + if (p.Duration.TotalMilliseconds < 0) + { + if (sb.Length < 20) + { + if (sb.Length > 0) + { + sb.Append(", "); + } + sb.Append((index + 1).ToString(CultureInfo.InvariantCulture)); + } + else + { + sb.Append("..."); + break; + } + } + } + + if (sb.Length > 0) + { + using (var form = new DialogDoNotShowAgain(Title, string.Format(_language.SubtitleContainsNegativeDurationsX, sb.ToString()))) + { + form.ShowDialog(this); + Configuration.Settings.General.ShowNegativeDurationInfoOnSave = !form.DoNoDisplayAgain; + } + } + } } private void ToolStripButtonSaveAsClick(object sender, EventArgs e)