From 3f61eb5d25d2dce743c6d9af995cbdb916942ae2 Mon Sep 17 00:00:00 2001 From: niksedk Date: Mon, 15 Aug 2022 21:19:00 +0200 Subject: [PATCH] Add ebu stl file property icon - thx Leon :) --- src/ui/Controls/SubtitleListView.cs | 33 +++++++----------------- src/ui/Forms/Main.cs | 7 +++++ src/ui/Properties/Resources.Designer.cs | 10 +++++++ src/ui/Properties/Resources.resx | 3 +++ src/ui/Resources/ebu.png | Bin 0 -> 2710 bytes src/ui/SubtitleEdit.csproj | 3 +++ 6 files changed, 33 insertions(+), 23 deletions(-) create mode 100644 src/ui/Resources/ebu.png diff --git a/src/ui/Controls/SubtitleListView.cs b/src/ui/Controls/SubtitleListView.cs index 1b439bca5..7708e98b2 100644 --- a/src/ui/Controls/SubtitleListView.cs +++ b/src/ui/Controls/SubtitleListView.cs @@ -1515,16 +1515,9 @@ namespace Nikse.SubtitleEdit.Controls if (_settings.Tools.ListViewSyntaxColorGap && i >= 0 && i < paragraphs.Count - 1 && ColumnIndexGap >= 0 && !paragraph.StartTime.IsMaxTime) { - Paragraph next = paragraphs[i + 1]; + var next = paragraphs[i + 1]; var gapMilliseconds = (int)Math.Round(next.StartTime.TotalMilliseconds - paragraph.EndTime.TotalMilliseconds); - if (gapMilliseconds < Configuration.Settings.General.MinimumMillisecondsBetweenLines) - { - item.SubItems[ColumnIndexGap].BackColor = Configuration.Settings.Tools.ListViewSyntaxErrorColor; - } - else - { - item.SubItems[ColumnIndexGap].BackColor = BackColor; - } + item.SubItems[ColumnIndexGap].BackColor = gapMilliseconds < Configuration.Settings.General.MinimumMillisecondsBetweenLines ? Configuration.Settings.Tools.ListViewSyntaxErrorColor : BackColor; } if (ColumnIndexTextOriginal >= 0 && item.SubItems.Count >= ColumnIndexTextOriginal) @@ -1539,8 +1532,8 @@ namespace Nikse.SubtitleEdit.Controls if (_settings.Tools.ListViewSyntaxColorLongLines) { - string s = HtmlUtil.RemoveHtmlTags(paragraph.Text, true); - foreach (string line in s.SplitToLines()) + var s = HtmlUtil.RemoveHtmlTags(paragraph.Text, true); + foreach (var line in s.SplitToLines()) { if (line.CountCharacters(false) > Configuration.Settings.General.SubtitleLineMaximumLength) { @@ -1548,7 +1541,7 @@ namespace Nikse.SubtitleEdit.Controls return; } } - int noOfLines = paragraph.NumberOfLines; + var noOfLines = paragraph.NumberOfLines; if (s.CountCharacters(false) <= Configuration.Settings.General.SubtitleLineMaximumLength * noOfLines) { if (noOfLines > Configuration.Settings.General.MaxNumberOfLines && _settings.Tools.ListViewSyntaxMoreThanXLines) @@ -2290,29 +2283,23 @@ namespace Nikse.SubtitleEdit.Controls return; } - var tempText = Columns[ColumnIndexTextOriginal].Text; - Columns[ColumnIndexTextOriginal].Text = Columns[ColumnIndexText].Text; - Columns[ColumnIndexText].Text = tempText; - - var tempColumn = SubtitleColumns[ColumnIndexTextOriginal]; - SubtitleColumns[ColumnIndexTextOriginal] = SubtitleColumns[ColumnIndexText]; - SubtitleColumns[ColumnIndexText] = tempColumn; + (Columns[ColumnIndexTextOriginal].Text, Columns[ColumnIndexText].Text) = (Columns[ColumnIndexText].Text, Columns[ColumnIndexTextOriginal].Text); + (SubtitleColumns[ColumnIndexTextOriginal], SubtitleColumns[ColumnIndexText]) = (SubtitleColumns[ColumnIndexText], SubtitleColumns[ColumnIndexTextOriginal]); UpdateColumnIndexes(); - BeginUpdate(); - int i = 0; + var i = 0; foreach (ListViewItem item in Items) { var p = subtitle.GetParagraphOrDefault(i); if (p != null) { - item.SubItems[ColumnIndexText].Text = p.Text.Replace(Environment.NewLine, _lineSeparatorString); + Columns[ColumnIndexText].Text = p.Text.Replace(Environment.NewLine, _lineSeparatorString); } var original = Utilities.GetOriginalParagraph(i, p, subtitleOriginal.Paragraphs); if (original != null) { - item.SubItems[ColumnIndexTextOriginal].Text = original.Text.Replace(Environment.NewLine, _lineSeparatorString); + Columns[ColumnIndexTextOriginal].Text = original.Text.Replace(Environment.NewLine, _lineSeparatorString); } i++; diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index aad9ea45f..672d25d8d 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -32222,6 +32222,13 @@ namespace Nikse.SubtitleEdit.Forms toolStripButtonXProperties.ToolTipText = string.Format(_language.Menu.File.FormatXProperties, new WebVTT().Name); toolStripButtonXProperties.Image = Properties.Resources.webvtt; } + + if (formatType == typeof(Ebu)) + { + toolStripButtonXProperties.Visible = true; + toolStripButtonXProperties.ToolTipText = string.Format(_language.Menu.File.FormatXProperties, new Ebu().Name); + toolStripButtonXProperties.Image = Properties.Resources.ebu; + } } private void NetflixGlyphCheck(bool isSaving) diff --git a/src/ui/Properties/Resources.Designer.cs b/src/ui/Properties/Resources.Designer.cs index 9f3b72582..0e33c4a18 100644 --- a/src/ui/Properties/Resources.Designer.cs +++ b/src/ui/Properties/Resources.Designer.cs @@ -90,6 +90,16 @@ namespace Nikse.SubtitleEdit.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap ebu { + get { + object obj = ResourceManager.GetObject("ebu", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/src/ui/Properties/Resources.resx b/src/ui/Properties/Resources.resx index 974709d43..43c8ce039 100644 --- a/src/ui/Properties/Resources.resx +++ b/src/ui/Properties/Resources.resx @@ -148,4 +148,7 @@ ..\Resources\itt.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ebu.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/src/ui/Resources/ebu.png b/src/ui/Resources/ebu.png new file mode 100644 index 0000000000000000000000000000000000000000..a973ce41617a95ddd08e5035313e109e8fd5f54b GIT binary patch literal 2710 zcmV;H3TgF;P)aB^>EX>4U6ba`-PAV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