diff --git a/src/Controls/SubtitleListView.cs b/src/Controls/SubtitleListView.cs index bd34b39fd..b9e463052 100644 --- a/src/Controls/SubtitleListView.cs +++ b/src/Controls/SubtitleListView.cs @@ -414,38 +414,23 @@ namespace Nikse.SubtitleEdit.Controls if (_settings.Tools.ListViewSyntaxColorDurationSmall) { double charactersPerSecond = Utilities.GetCharactersPerSecond(paragraph); - if (charactersPerSecond > Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds + 7) + if (charactersPerSecond > Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds) { - item.SubItems[ColumnIndexDuration].BackColor = Color.Red; - durationChanged = true; - } - else if (charactersPerSecond > Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds) - { - item.SubItems[ColumnIndexDuration].BackColor = Color.Orange; - durationChanged = true; - } - else if (paragraph.Duration.TotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds - 100) - { - item.SubItems[ColumnIndexDuration].BackColor = Color.Red; + item.SubItems[ColumnIndexDuration].BackColor = Configuration.Settings.Tools.ListViewSyntaxErrorColor; durationChanged = true; } else if (paragraph.Duration.TotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) { - item.SubItems[ColumnIndexDuration].BackColor = Color.Orange; + item.SubItems[ColumnIndexDuration].BackColor = Configuration.Settings.Tools.ListViewSyntaxErrorColor; durationChanged = true; } } if (_settings.Tools.ListViewSyntaxColorDurationBig) { // double charactersPerSecond = Utilities.GetCharactersPerSecond(paragraph); - if (paragraph.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds + 100) + if (paragraph.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { - item.SubItems[ColumnIndexDuration].BackColor = Color.Red; - durationChanged = true; - } - else if (paragraph.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) - { - item.SubItems[ColumnIndexDuration].BackColor = Color.Orange; + item.SubItems[ColumnIndexDuration].BackColor = Configuration.Settings.Tools.ListViewSyntaxErrorColor; durationChanged = true; } } @@ -457,8 +442,8 @@ namespace Nikse.SubtitleEdit.Controls Paragraph prev = paragraphs[i - 1]; if (paragraph.StartTime.TotalMilliseconds < prev.EndTime.TotalMilliseconds) { - Items[i - 1].SubItems[ColumnIndexEnd].BackColor = Color.Orange; - item.SubItems[ColumnIndexStart].BackColor = Color.Orange; + Items[i - 1].SubItems[ColumnIndexEnd].BackColor = Configuration.Settings.Tools.ListViewSyntaxErrorColor; + item.SubItems[ColumnIndexStart].BackColor = Configuration.Settings.Tools.ListViewSyntaxErrorColor; } else { @@ -473,33 +458,25 @@ namespace Nikse.SubtitleEdit.Controls { int noOfLines = paragraph.Text.Split(Environment.NewLine[0]).Length; string s = Utilities.RemoveHtmlTags(paragraph.Text).Replace(Environment.NewLine, string.Empty); // we don't count new line in total length... correct? - if (s.Length < Configuration.Settings.General.SubtitleLineMaximumLength * 1.9) + if (s.Length <= Configuration.Settings.General.SubtitleLineMaximumLength * 2) { - if (noOfLines == 3) - item.SubItems[ColumnIndexText].BackColor = Color.Orange; - else if (noOfLines > 3) - item.SubItems[ColumnIndexText].BackColor = Color.Red; + if (noOfLines >= 3) + item.SubItems[ColumnIndexText].BackColor = Configuration.Settings.Tools.ListViewSyntaxErrorColor; else if (item.SubItems[ColumnIndexText].BackColor != BackColor) item.SubItems[ColumnIndexText].BackColor = BackColor; } - else if (s.Length < Configuration.Settings.General.SubtitleLineMaximumLength * 2.1) - { - item.SubItems[ColumnIndexText].BackColor = Color.Orange; - } else { - item.SubItems[ColumnIndexText].BackColor = Color.Red; + item.SubItems[ColumnIndexText].BackColor = Configuration.Settings.Tools.ListViewSyntaxErrorColor; } } if (_settings.Tools.ListViewSyntaxMoreThanTwoLines && item.SubItems[ColumnIndexText].BackColor != Color.Orange && - item.SubItems[ColumnIndexText].BackColor != Color.Red) + item.SubItems[ColumnIndexText].BackColor != Configuration.Settings.Tools.ListViewSyntaxErrorColor) { int newLines = paragraph.Text.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Length; - if (newLines == 3) - item.SubItems[ColumnIndexText].BackColor = Color.Orange; - else if (newLines > 3) - item.SubItems[ColumnIndexText].BackColor = Color.Red; + if (newLines >= 3) + item.SubItems[ColumnIndexText].BackColor = Configuration.Settings.Tools.ListViewSyntaxErrorColor; } } } diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index 1019690e3..a37cde943 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -2719,6 +2719,13 @@ namespace Nikse.SubtitleEdit.Forms Configuration.Settings.General.SubtitleBackgroundColor.ToArgb().ToString(); bool oldUseTimeFormatHHMMSSFF = Configuration.Settings.General.UseTimeFormatHHMMSSFF; + string oldSyntaxColoring = Configuration.Settings.Tools.ListViewSyntaxColorDurationSmall.ToString() + + Configuration.Settings.Tools.ListViewSyntaxColorDurationBig.ToString() + + Configuration.Settings.Tools.ListViewSyntaxColorLongLines.ToString() + + Configuration.Settings.Tools.ListViewSyntaxColorOverlap.ToString() + + Configuration.Settings.Tools.ListViewSyntaxMoreThanTwoLines.ToString() + + Configuration.Settings.Tools.ListViewSyntaxErrorColor.ToArgb().ToString(); + var oldAllowEditOfOriginalSubtitle = Configuration.Settings.General.AllowEditOfOriginalSubtitle; var settings = new Settings(); settings.Initialize(this.Icon, toolStripButtonFileNew.Image, toolStripButtonFileOpen.Image, toolStripButtonSave.Image, toolStripButtonSaveAs.Image, @@ -2745,11 +2752,20 @@ namespace Nikse.SubtitleEdit.Forms audioVisualizer.TextColor = Configuration.Settings.VideoControls.WaveFormTextColor; audioVisualizer.MouseWheelScrollUpIsForward = Configuration.Settings.VideoControls.WaveFormMouseWheelScrollUpIsForward; + string newSyntaxColoring = Configuration.Settings.Tools.ListViewSyntaxColorDurationSmall.ToString() + + Configuration.Settings.Tools.ListViewSyntaxColorDurationBig.ToString() + + Configuration.Settings.Tools.ListViewSyntaxColorLongLines.ToString() + + Configuration.Settings.Tools.ListViewSyntaxColorOverlap.ToString() + + Configuration.Settings.Tools.ListViewSyntaxMoreThanTwoLines.ToString() + + Configuration.Settings.Tools.ListViewSyntaxErrorColor.ToArgb().ToString(); + + if (oldSubtitleFontSettings != Configuration.Settings.General.SubtitleFontName + Configuration.Settings.General.SubtitleFontBold + Configuration.Settings.General.SubtitleFontSize + Configuration.Settings.General.SubtitleFontColor.ToArgb().ToString() + - Configuration.Settings.General.SubtitleBackgroundColor.ToArgb().ToString()) + Configuration.Settings.General.SubtitleBackgroundColor.ToArgb().ToString() || + oldSyntaxColoring != newSyntaxColoring) { Utilities.InitializeSubtitleFont(textBoxListViewText); Utilities.InitializeSubtitleFont(textBoxListViewTextAlternate); diff --git a/src/Forms/Main.resx b/src/Forms/Main.resx index 3e748bce8..3e6bf1552 100644 --- a/src/Forms/Main.resx +++ b/src/Forms/Main.resx @@ -681,7 +681,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2 - CAAAAk1TRnQBSQFMAgEBAgEAAagBEwGoARMBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAAbABEwGwARMBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/src/Forms/Settings.Designer.cs b/src/Forms/Settings.Designer.cs index bbaa1855b..9372ad0bc 100644 --- a/src/Forms/Settings.Designer.cs +++ b/src/Forms/Settings.Designer.cs @@ -220,18 +220,16 @@ this.labelShortcut = new System.Windows.Forms.Label(); this.tabPageSyntaxColoring = new System.Windows.Forms.TabPage(); this.groupBoxListViewSyntaxColoring = new System.Windows.Forms.GroupBox(); + this.checkBoxSyntaxColorTextMoreThanTwoLines = new System.Windows.Forms.CheckBox(); this.checkBoxSyntaxOverlap = new System.Windows.Forms.CheckBox(); + this.checkBoxSyntaxColorDurationTooSmall = new System.Windows.Forms.CheckBox(); + this.buttonListViewSyntaxColorError = new System.Windows.Forms.Button(); this.checkBoxSyntaxColorTextTooLong = new System.Windows.Forms.CheckBox(); this.checkBoxSyntaxColorDurationTooLarge = new System.Windows.Forms.CheckBox(); - this.checkBoxSyntaxColorDurationTooSmall = new System.Windows.Forms.CheckBox(); + this.panelListViewSyntaxColorError = new System.Windows.Forms.Panel(); this.colorDialogSSAStyle = new System.Windows.Forms.ColorDialog(); this.fontDialogSSAStyle = new System.Windows.Forms.FontDialog(); this.labelStatus = new System.Windows.Forms.Label(); - this.panel1 = new System.Windows.Forms.Panel(); - this.buttonListViewSyntaxColorWarning = new System.Windows.Forms.Button(); - this.panel2 = new System.Windows.Forms.Panel(); - this.buttonListViewSyntaxColorError = new System.Windows.Forms.Button(); - this.checkBoxSyntaxColorTextMoreThanTwoLines = new System.Windows.Forms.CheckBox(); this.tabControlSettings.SuspendLayout(); this.tabPageGenerel.SuspendLayout(); this.groupBoxMiscellaneous.SuspendLayout(); @@ -2431,14 +2429,12 @@ // groupBoxListViewSyntaxColoring // this.groupBoxListViewSyntaxColoring.Controls.Add(this.checkBoxSyntaxColorTextMoreThanTwoLines); - this.groupBoxListViewSyntaxColoring.Controls.Add(this.panel1); this.groupBoxListViewSyntaxColoring.Controls.Add(this.checkBoxSyntaxOverlap); this.groupBoxListViewSyntaxColoring.Controls.Add(this.checkBoxSyntaxColorDurationTooSmall); - this.groupBoxListViewSyntaxColoring.Controls.Add(this.buttonListViewSyntaxColorWarning); this.groupBoxListViewSyntaxColoring.Controls.Add(this.buttonListViewSyntaxColorError); this.groupBoxListViewSyntaxColoring.Controls.Add(this.checkBoxSyntaxColorTextTooLong); this.groupBoxListViewSyntaxColoring.Controls.Add(this.checkBoxSyntaxColorDurationTooLarge); - this.groupBoxListViewSyntaxColoring.Controls.Add(this.panel2); + this.groupBoxListViewSyntaxColoring.Controls.Add(this.panelListViewSyntaxColorError); this.groupBoxListViewSyntaxColoring.Location = new System.Drawing.Point(6, 6); this.groupBoxListViewSyntaxColoring.Name = "groupBoxListViewSyntaxColoring"; this.groupBoxListViewSyntaxColoring.Size = new System.Drawing.Size(808, 399); @@ -2446,16 +2442,45 @@ this.groupBoxListViewSyntaxColoring.TabStop = false; this.groupBoxListViewSyntaxColoring.Text = "List view syntax coloring"; // + // checkBoxSyntaxColorTextMoreThanTwoLines + // + this.checkBoxSyntaxColorTextMoreThanTwoLines.AutoSize = true; + this.checkBoxSyntaxColorTextMoreThanTwoLines.Location = new System.Drawing.Point(20, 116); + this.checkBoxSyntaxColorTextMoreThanTwoLines.Name = "checkBoxSyntaxColorTextMoreThanTwoLines"; + this.checkBoxSyntaxColorTextMoreThanTwoLines.Size = new System.Drawing.Size(187, 17); + this.checkBoxSyntaxColorTextMoreThanTwoLines.TabIndex = 14; + this.checkBoxSyntaxColorTextMoreThanTwoLines.Text = "Text - color if more than two lines"; + this.checkBoxSyntaxColorTextMoreThanTwoLines.UseVisualStyleBackColor = true; + // // checkBoxSyntaxOverlap // this.checkBoxSyntaxOverlap.AutoSize = true; this.checkBoxSyntaxOverlap.Location = new System.Drawing.Point(20, 154); this.checkBoxSyntaxOverlap.Name = "checkBoxSyntaxOverlap"; - this.checkBoxSyntaxOverlap.Size = new System.Drawing.Size(97, 17); + this.checkBoxSyntaxOverlap.Size = new System.Drawing.Size(129, 17); this.checkBoxSyntaxOverlap.TabIndex = 13; - this.checkBoxSyntaxOverlap.Text = "Overlap - color"; + this.checkBoxSyntaxOverlap.Text = "Time - color if overlap"; this.checkBoxSyntaxOverlap.UseVisualStyleBackColor = true; // + // checkBoxSyntaxColorDurationTooSmall + // + this.checkBoxSyntaxColorDurationTooSmall.Location = new System.Drawing.Point(20, 35); + this.checkBoxSyntaxColorDurationTooSmall.Name = "checkBoxSyntaxColorDurationTooSmall"; + this.checkBoxSyntaxColorDurationTooSmall.Size = new System.Drawing.Size(154, 17); + this.checkBoxSyntaxColorDurationTooSmall.TabIndex = 10; + this.checkBoxSyntaxColorDurationTooSmall.Text = "Duration - color if too small"; + this.checkBoxSyntaxColorDurationTooSmall.UseVisualStyleBackColor = true; + // + // buttonListViewSyntaxColorError + // + this.buttonListViewSyntaxColorError.Location = new System.Drawing.Point(20, 192); + this.buttonListViewSyntaxColorError.Name = "buttonListViewSyntaxColorError"; + this.buttonListViewSyntaxColorError.Size = new System.Drawing.Size(112, 21); + this.buttonListViewSyntaxColorError.TabIndex = 4; + this.buttonListViewSyntaxColorError.Text = "Error color"; + this.buttonListViewSyntaxColorError.UseVisualStyleBackColor = true; + this.buttonListViewSyntaxColorError.Click += new System.EventHandler(this.buttonListViewSyntaxColorError_Click); + // // checkBoxSyntaxColorTextTooLong // this.checkBoxSyntaxColorTextTooLong.AutoSize = true; @@ -2476,15 +2501,14 @@ this.checkBoxSyntaxColorDurationTooLarge.Text = "Duration - color if too large"; this.checkBoxSyntaxColorDurationTooLarge.UseVisualStyleBackColor = true; // - // checkBoxSyntaxColorDurationTooSmall + // panelListViewSyntaxColorError // - this.checkBoxSyntaxColorDurationTooSmall.AutoSize = true; - this.checkBoxSyntaxColorDurationTooSmall.Location = new System.Drawing.Point(20, 35); - this.checkBoxSyntaxColorDurationTooSmall.Name = "checkBoxSyntaxColorDurationTooSmall"; - this.checkBoxSyntaxColorDurationTooSmall.Size = new System.Drawing.Size(154, 17); - this.checkBoxSyntaxColorDurationTooSmall.TabIndex = 10; - this.checkBoxSyntaxColorDurationTooSmall.Text = "Duration - color if too small"; - this.checkBoxSyntaxColorDurationTooSmall.UseVisualStyleBackColor = true; + this.panelListViewSyntaxColorError.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panelListViewSyntaxColorError.Location = new System.Drawing.Point(142, 192); + this.panelListViewSyntaxColorError.Name = "panelListViewSyntaxColorError"; + this.panelListViewSyntaxColorError.Size = new System.Drawing.Size(21, 20); + this.panelListViewSyntaxColorError.TabIndex = 5; + this.panelListViewSyntaxColorError.Click += new System.EventHandler(this.buttonListViewSyntaxColorError_Click); // // labelStatus // @@ -2495,50 +2519,6 @@ this.labelStatus.TabIndex = 3; this.labelStatus.Text = "labelStatus"; // - // panel1 - // - this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel1.Location = new System.Drawing.Point(414, 59); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(21, 20); - this.panel1.TabIndex = 7; - // - // buttonListViewSyntaxColorWarning - // - this.buttonListViewSyntaxColorWarning.Location = new System.Drawing.Point(292, 58); - this.buttonListViewSyntaxColorWarning.Name = "buttonListViewSyntaxColorWarning"; - this.buttonListViewSyntaxColorWarning.Size = new System.Drawing.Size(112, 21); - this.buttonListViewSyntaxColorWarning.TabIndex = 6; - this.buttonListViewSyntaxColorWarning.Text = "Warning color"; - this.buttonListViewSyntaxColorWarning.UseVisualStyleBackColor = true; - // - // panel2 - // - this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel2.Location = new System.Drawing.Point(414, 31); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(21, 20); - this.panel2.TabIndex = 5; - // - // buttonListViewSyntaxColorError - // - this.buttonListViewSyntaxColorError.Location = new System.Drawing.Point(292, 31); - this.buttonListViewSyntaxColorError.Name = "buttonListViewSyntaxColorError"; - this.buttonListViewSyntaxColorError.Size = new System.Drawing.Size(112, 21); - this.buttonListViewSyntaxColorError.TabIndex = 4; - this.buttonListViewSyntaxColorError.Text = "Error color"; - this.buttonListViewSyntaxColorError.UseVisualStyleBackColor = true; - // - // checkBoxSyntaxColorTextMoreThanTwoLines - // - this.checkBoxSyntaxColorTextMoreThanTwoLines.AutoSize = true; - this.checkBoxSyntaxColorTextMoreThanTwoLines.Location = new System.Drawing.Point(20, 116); - this.checkBoxSyntaxColorTextMoreThanTwoLines.Name = "checkBoxSyntaxColorTextMoreThanTwoLines"; - this.checkBoxSyntaxColorTextMoreThanTwoLines.Size = new System.Drawing.Size(187, 17); - this.checkBoxSyntaxColorTextMoreThanTwoLines.TabIndex = 14; - this.checkBoxSyntaxColorTextMoreThanTwoLines.Text = "Text - color if more than two lines"; - this.checkBoxSyntaxColorTextMoreThanTwoLines.UseVisualStyleBackColor = true; - // // Settings // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -2832,9 +2812,7 @@ private System.Windows.Forms.CheckBox checkBoxSyntaxColorDurationTooLarge; private System.Windows.Forms.CheckBox checkBoxSyntaxColorDurationTooSmall; private System.Windows.Forms.CheckBox checkBoxSyntaxColorTextMoreThanTwoLines; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Button buttonListViewSyntaxColorWarning; private System.Windows.Forms.Button buttonListViewSyntaxColorError; - private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Panel panelListViewSyntaxColorError; } } \ No newline at end of file diff --git a/src/Forms/Settings.cs b/src/Forms/Settings.cs index 5ab5243dc..333e812be 100644 --- a/src/Forms/Settings.cs +++ b/src/Forms/Settings.cs @@ -162,6 +162,7 @@ namespace Nikse.SubtitleEdit.Forms checkBoxSyntaxColorTextTooLong.Checked = Configuration.Settings.Tools.ListViewSyntaxColorLongLines; checkBoxSyntaxColorTextMoreThanTwoLines.Checked = Configuration.Settings.Tools.ListViewSyntaxMoreThanTwoLines; checkBoxSyntaxOverlap.Checked = Configuration.Settings.Tools.ListViewSyntaxColorOverlap; + panelListViewSyntaxColorError.BackColor = Configuration.Settings.Tools.ListViewSyntaxErrorColor; // Language var language = Configuration.Settings.Language.Settings; @@ -175,6 +176,7 @@ namespace Nikse.SubtitleEdit.Forms tabPageProxy.Text = language.Proxy; tabPageToolBar.Text = language.Toolbar; tabPageShortcuts.Text = language.Shortcuts; + tabPageSyntaxColoring.Text = language.SyntaxColoring; groupBoxShowToolBarButtons.Text = language.ShowToolBarButtons; labelTBNew.Text = language.New; labelTBOpen.Text = language.Open; @@ -622,6 +624,13 @@ namespace Nikse.SubtitleEdit.Forms comboBoxShortcutKey.Left = labelShortcutKey.Left + labelShortcutKey.Width; comboBoxShortcutKey.Items[0] = Configuration.Settings.Language.General.None; + groupBoxListViewSyntaxColoring.Text = language.ListViewSyntaxColoring; + checkBoxSyntaxColorDurationTooSmall.Text = language.SyntaxColorDurationIfTooSmall; + checkBoxSyntaxColorDurationTooLarge.Text = language.SyntaxColorDurationIfTooLarge; + checkBoxSyntaxColorTextTooLong.Text = language.SyntaxColorTextIfTooLong; + checkBoxSyntaxColorTextMoreThanTwoLines.Text = language.SyntaxColorTextMoreThanTwoLines; + checkBoxSyntaxOverlap.Text = language.SyntaxColorOverlap; + if (!Configuration.Settings.General.ShowBetaStuff) tabControlSettings.TabPages.Remove(tabPageSyntaxColoring); @@ -945,6 +954,7 @@ namespace Nikse.SubtitleEdit.Forms Configuration.Settings.Tools.ListViewSyntaxColorLongLines = checkBoxSyntaxColorTextTooLong.Checked ; Configuration.Settings.Tools.ListViewSyntaxMoreThanTwoLines = checkBoxSyntaxColorTextMoreThanTwoLines.Checked; Configuration.Settings.Tools.ListViewSyntaxColorOverlap = checkBoxSyntaxOverlap.Checked; + Configuration.Settings.Tools.ListViewSyntaxErrorColor = panelListViewSyntaxColorError.BackColor; Configuration.Settings.VideoControls.WaveFormDrawGrid = checkBoxWaveFormShowGrid.Checked; Configuration.Settings.VideoControls.WaveFormGridColor = panelWaveFormGridColor.BackColor; @@ -2082,5 +2092,12 @@ namespace Nikse.SubtitleEdit.Forms } } + private void buttonListViewSyntaxColorError_Click(object sender, EventArgs e) + { + colorDialogSSAStyle.Color = panelListViewSyntaxColorError.BackColor; + if (colorDialogSSAStyle.ShowDialog() == DialogResult.OK) + panelListViewSyntaxColorError.BackColor = colorDialogSSAStyle.Color; + } + } } diff --git a/src/Forms/SubStationAlphaStyles.cs b/src/Forms/SubStationAlphaStyles.cs index 5c843ed4e..fd98d6b94 100644 --- a/src/Forms/SubStationAlphaStyles.cs +++ b/src/Forms/SubStationAlphaStyles.cs @@ -831,6 +831,7 @@ namespace Nikse.SubtitleEdit.Forms textBoxStyleName.Focus(); AddStyleToHeader(style, oldStyle); _doUpdate = true; + listViewStyles_SelectedIndexChanged(null, null); } } @@ -881,6 +882,7 @@ namespace Nikse.SubtitleEdit.Forms SsaStyle oldStyle = GetSsaStyle(listViewStyles.Items[0].Text); AddStyleToHeader(style, oldStyle); _doUpdate = true; + listViewStyles_SelectedIndexChanged(null, null); } private void textBoxStyleName_TextChanged(object sender, EventArgs e) diff --git a/src/Logic/Language.cs b/src/Logic/Language.cs index e7b2d0af1..0ae1cc289 100644 --- a/src/Logic/Language.cs +++ b/src/Logic/Language.cs @@ -930,10 +930,10 @@ namespace Nikse.SubtitleEdit.Logic ContextMenu = new LanguageStructure.Main.MainMenu.ListViewContextMenu { - AdvancedSubStationAlphaSetStyle = "Advanced Sub Station Alpha - Set Style", - SubStationAlphaSetStyle = "Sub Station Alpha - Set Style", - AdvancedSubStationAlphaStyles = "Advanced Sub Station Alpha Styles...", - SubStationAlphaStyles = "Sub Station Alpha Styles...", + AdvancedSubStationAlphaSetStyle = "Advanced Sub Station Alpha - set style", + SubStationAlphaSetStyle = "Sub Station Alpha - set style", + AdvancedSubStationAlphaStyles = "Advanced Sub Station Alpha styles...", + SubStationAlphaStyles = "Sub Station Alpha styles...", Cut = "Cut", Copy = "Copy", Paste = "Paste", @@ -1316,6 +1316,14 @@ can edit in same subtitle file (collaboration)", Pause = "Pause", TogglePlayPause = "Toggle play/pause", Fullscreen = "Fullscreen", + SyntaxColoring = "Syntax coloring", + ListViewSyntaxColoring = "List view syntax coloring", + SyntaxColorDurationIfTooSmall = "Color duration if too short", + SyntaxColorDurationIfTooLarge = "Color duration if too long", + SyntaxColorTextIfTooLong = "Color text if too long", + SyntaxColorTextMoreThanTwoLines = "Color text if more than two lines", + SyntaxColorOverlap = "Color time code overlap", + SyntaxColorErrorColor = "Error background color", }; ShowEarlierLater = new LanguageStructure.ShowEarlierLater @@ -1408,7 +1416,6 @@ can edit in same subtitle file (collaboration)", }; - SubStationAlphaStyles = new LanguageStructure.SubStationAlphaStyles { Title = "Advanced Sub Station Alpha styles", diff --git a/src/Logic/LanguageStructure.cs b/src/Logic/LanguageStructure.cs index 75268c92b..736d542cc 100644 --- a/src/Logic/LanguageStructure.cs +++ b/src/Logic/LanguageStructure.cs @@ -1265,6 +1265,14 @@ public string TogglePlayPause { get; set; } public string Pause { get; set; } public string Fullscreen { get; set; } + public string SyntaxColoring { get; set; } + public string ListViewSyntaxColoring { get; set; } + public string SyntaxColorDurationIfTooSmall { get; set; } + public string SyntaxColorDurationIfTooLarge { get; set; } + public string SyntaxColorTextIfTooLong { get; set; } + public string SyntaxColorTextMoreThanTwoLines { get; set; } + public string SyntaxColorOverlap { get; set; } + public string SyntaxColorErrorColor { get; set; } } public class ShowEarlierLater diff --git a/src/Logic/Settings.cs b/src/Logic/Settings.cs index 8fabdc90a..d65f75693 100644 --- a/src/Logic/Settings.cs +++ b/src/Logic/Settings.cs @@ -90,6 +90,7 @@ namespace Nikse.SubtitleEdit.Logic public bool ListViewSyntaxColorOverlap { get; set; } public bool ListViewSyntaxColorLongLines { get; set; } public bool ListViewSyntaxMoreThanTwoLines { get; set; } + public Color ListViewSyntaxErrorColor { get; set; } public Color ListViewUnfocusedSelectedColor { get; set; } public bool SplitAdvanced { get; set; } public string SplitOutputFolder { get; set; } @@ -117,6 +118,7 @@ namespace Nikse.SubtitleEdit.Logic ListViewSyntaxColorOverlap = true; ListViewSyntaxColorLongLines = true; ListViewSyntaxMoreThanTwoLines = true; + ListViewSyntaxErrorColor = Color.FromArgb(255, 125, 125); ListViewUnfocusedSelectedColor = Color.LightBlue; SplitAdvanced = false; SplitNumberOfParts = 3; @@ -1083,12 +1085,15 @@ namespace Nikse.SubtitleEdit.Logic subNode = node.SelectSingleNode("ListViewSyntaxMoreThanTwoLines"); if (subNode != null) settings.Tools.ListViewSyntaxMoreThanTwoLines = Convert.ToBoolean(subNode.InnerText); - subNode = node.SelectSingleNode("ListViewUnfocusedSelectedColor"); - if (subNode != null) - settings.Tools.ListViewUnfocusedSelectedColor = Color.FromArgb(int.Parse(subNode.InnerText)); subNode = node.SelectSingleNode("ListViewSyntaxColorOverlap"); if (subNode != null) settings.Tools.ListViewSyntaxColorOverlap = Convert.ToBoolean(subNode.InnerText); + subNode = node.SelectSingleNode("ListViewSyntaxErrorColor"); + if (subNode != null) + settings.Tools.ListViewSyntaxErrorColor = Color.FromArgb(int.Parse(subNode.InnerText)); + subNode = node.SelectSingleNode("ListViewUnfocusedSelectedColor"); + if (subNode != null) + settings.Tools.ListViewUnfocusedSelectedColor = Color.FromArgb(int.Parse(subNode.InnerText)); subNode = node.SelectSingleNode("SplitAdvanced"); if (subNode != null) settings.Tools.SplitAdvanced = Convert.ToBoolean(subNode.InnerText); @@ -1754,8 +1759,9 @@ namespace Nikse.SubtitleEdit.Logic textWriter.WriteElementString("ListViewSyntaxColorDurationBig", settings.Tools.ListViewSyntaxColorDurationBig.ToString()); textWriter.WriteElementString("ListViewSyntaxColorLongLines", settings.Tools.ListViewSyntaxColorLongLines.ToString()); textWriter.WriteElementString("ListViewSyntaxMoreThanTwoLines", settings.Tools.ListViewSyntaxMoreThanTwoLines.ToString()); - textWriter.WriteElementString("ListViewUnfocusedSelectedColor", settings.Tools.ListViewUnfocusedSelectedColor.ToArgb().ToString()); textWriter.WriteElementString("ListViewSyntaxColorOverlap", settings.Tools.ListViewSyntaxColorOverlap.ToString()); + textWriter.WriteElementString("ListViewSyntaxErrorColor", settings.Tools.ListViewSyntaxErrorColor.ToArgb().ToString()); + textWriter.WriteElementString("ListViewUnfocusedSelectedColor", settings.Tools.ListViewUnfocusedSelectedColor.ToArgb().ToString()); textWriter.WriteElementString("SplitAdvanced", settings.Tools.SplitAdvanced.ToString()); textWriter.WriteElementString("SplitOutputFolder", settings.Tools.SplitOutputFolder); textWriter.WriteElementString("SplitNumberOfParts", settings.Tools.SplitNumberOfParts.ToString());