From 39e86258427e358ddec3ed698a8ffc1a73df7e6e Mon Sep 17 00:00:00 2001 From: niksedk Date: Mon, 19 Jun 2023 21:15:44 +0200 Subject: [PATCH] Work on WebVTT styles --- LanguageBaseEnglish.xml | 5 ++++- src/ui/Forms/Main.cs | 10 ++++++++-- src/ui/Logic/Language.cs | 6 ++++++ src/ui/Logic/LanguageDeserializer.cs | 6 ++++++ src/ui/Logic/LanguageStructure.cs | 4 ++++ 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/LanguageBaseEnglish.xml b/LanguageBaseEnglish.xml index 4b783c62f..0c32116e3 100644 --- a/LanguageBaseEnglish.xml +++ b/LanguageBaseEnglish.xml @@ -37,6 +37,7 @@ Actor Gap Region + Layer # Number Text @@ -1474,7 +1475,6 @@ To use an API key, go to "Options -> Settings -> Tools" to enter your Goog Next > Auto &br Unbreak - Set layer Translate @@ -3214,4 +3214,7 @@ Keep changes? WebVTT - set new voice Name of voice + + WebVTT styles + \ No newline at end of file diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index 626a1b55a..4daf6fdfc 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -5973,7 +5973,7 @@ namespace Nikse.SubtitleEdit.Forms TryLoadIcon(toolStripButtonToggleWaveform, "WaveformToggle"); TryLoadIcon(toolStripButtonToggleVideo, "VideoToggle"); TryLoadIcon(toolStripButtonSourceView, "SourceView"); - // IttProperties, WebVttProperties, EbuProperties + // IttProperties, WebVttProperties, WebVttStyle, EbuProperties } toolStripButtonFileNew.Visible = gs.ShowToolbarNew; @@ -10782,7 +10782,7 @@ namespace Nikse.SubtitleEdit.Forms return; } - var isAssa = GetCurrentSubtitleFormat().GetType() == typeof(AdvancedSubStationAlpha); + var isAssa = GetCurrentSubtitleFormat().GetType() == typeof(AdvancedSubStationAlpha); if (isAssa) { var layer = (int)numericUpDownLayer.Value; @@ -32989,6 +32989,7 @@ namespace Nikse.SubtitleEdit.Forms var assFormatOn = formatType == typeof(AdvancedSubStationAlpha); toolStripButtonAssStyleManager.Visible = assFormatOn; + toolStripButtonAssStyleManager.ToolTipText = LanguageSettings.Current.SubStationAlphaStyles.Title; toolStripButtonAssProperties.Visible = assFormatOn; toolStripButtonAssaDraw.Visible = assFormatOn && File.Exists(Path.Combine(Configuration.PluginsDirectory, "AssaDraw.dll")); toolStripButtonAssAttachments.Visible = assFormatOn; @@ -33014,6 +33015,11 @@ namespace Nikse.SubtitleEdit.Forms toolStripButtonXProperties.ToolTipText = string.Format(_language.Menu.File.FormatXProperties, new WebVTT().Name); toolStripButtonXProperties.Image = Properties.Resources.webvtt; TryLoadIcon(toolStripButtonXProperties, "WebVttProperties"); + + toolStripButtonAssStyleManager.Visible = true; + toolStripButtonAssStyleManager.ToolTipText = string.Format(LanguageSettings.Current.WebVttStyleManager.Title, new WebVTT().Name); + toolStripButtonAssStyleManager.Image = Properties.Resources.webvtt; + TryLoadIcon(toolStripButtonAssStyleManager, "WebVttStyle"); } if (formatType == typeof(Ebu)) diff --git a/src/ui/Logic/Language.cs b/src/ui/Logic/Language.cs index e33f3ffb9..85a0e4aee 100644 --- a/src/ui/Logic/Language.cs +++ b/src/ui/Logic/Language.cs @@ -125,6 +125,7 @@ namespace Nikse.SubtitleEdit.Logic public LanguageStructure.Waveform Waveform; public LanguageStructure.WaveformGenerateTimeCodes WaveformGenerateTimeCodes; public LanguageStructure.WebVttNewVoice WebVttNewVoice; + public LanguageStructure.WebVttStyleManager WebVttStyleManager; public Language() { @@ -3612,6 +3613,11 @@ Keep changes?", Title = "WebVTT - set new voice", VoiceName = "Name of voice", }; + + WebVttStyleManager = new LanguageStructure.WebVttStyleManager + { + Title = "WebVTT styles", + }; } //public static Language Load(StreamReader sr) // normal but slow .net way diff --git a/src/ui/Logic/LanguageDeserializer.cs b/src/ui/Logic/LanguageDeserializer.cs index 2423abd56..3a3bd4eac 100644 --- a/src/ui/Logic/LanguageDeserializer.cs +++ b/src/ui/Logic/LanguageDeserializer.cs @@ -166,6 +166,9 @@ namespace Nikse.SubtitleEdit.Logic case "General/Region": language.General.Region = reader.Value; break; + case "General/Layer": + language.General.Layer = reader.Value; + break; case "General/NumberSymbol": language.General.NumberSymbol = reader.Value; break; @@ -8773,6 +8776,9 @@ namespace Nikse.SubtitleEdit.Logic case "WebVttNewVoice/VoiceName": language.WebVttNewVoice.VoiceName = reader.Value; break; + case "WebVttStyleManager/Title": + language.WebVttStyleManager.Title = reader.Value; + break; } } diff --git a/src/ui/Logic/LanguageStructure.cs b/src/ui/Logic/LanguageStructure.cs index b00e5b578..9b6cdf72c 100644 --- a/src/ui/Logic/LanguageStructure.cs +++ b/src/ui/Logic/LanguageStructure.cs @@ -3459,5 +3459,9 @@ namespace Nikse.SubtitleEdit.Logic public string VoiceName { get; set; } } + public class WebVttStyleManager + { + public string Title { get; set; } + } } }