diff --git a/LanguageBaseEnglish.xml b/LanguageBaseEnglish.xml index 1904e9d60..412e1baa5 100644 --- a/LanguageBaseEnglish.xml +++ b/LanguageBaseEnglish.xml @@ -1378,6 +1378,7 @@ To use an API key, go to "Options -> Settings -> Tools" to enter your Goog Size all columns to fit Set style Set actor + Set layer ASSA tools Sub Station Alpha styles... Advanced Sub Station Alpha styles... diff --git a/src/ui/Forms/Main.Designer.cs b/src/ui/Forms/Main.Designer.cs index be69e47ca..3b1d5f3d2 100644 --- a/src/ui/Forms/Main.Designer.cs +++ b/src/ui/Forms/Main.Designer.cs @@ -315,6 +315,7 @@ namespace Nikse.SubtitleEdit.Forms this.toolStripMenuItemMergeDialog = new System.Windows.Forms.ToolStripMenuItem(); this.mergeBeforeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.mergeAfterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator4Extend = new System.Windows.Forms.ToolStripSeparator(); this.extendBeforeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.extendAfterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); @@ -571,7 +572,7 @@ namespace Nikse.SubtitleEdit.Forms this.timerOriginalTextUndo = new System.Windows.Forms.Timer(this.components); this.contextMenuStripShowVideoControls = new System.Windows.Forms.ContextMenuStrip(this.components); this.toolStripMenuItemShowVideoControls = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator4Extend = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripMenuItemSetLayer = new System.Windows.Forms.ToolStripMenuItem(); this.statusStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); @@ -2631,6 +2632,7 @@ namespace Nikse.SubtitleEdit.Forms this.contextMenuStripListView.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.setStylesForSelectedLinesToolStripMenuItem, this.setActorForSelectedLinesToolStripMenuItem, + this.toolStripMenuItemSetLayer, this.toolStripMenuItemAssaTools, this.toolStripMenuItemAssStyles, this.toolStripSeparatorAssa, @@ -2669,7 +2671,7 @@ namespace Nikse.SubtitleEdit.Forms this.toolStripMenuItemSelectedLines, this.toolStripMenuItemGoogleMicrosoftTranslateSelLine}); this.contextMenuStripListView.Name = "contextMenuStripListView"; - this.contextMenuStripListView.Size = new System.Drawing.Size(285, 804); + this.contextMenuStripListView.Size = new System.Drawing.Size(285, 826); this.contextMenuStripListView.Closed += new System.Windows.Forms.ToolStripDropDownClosedEventHandler(this.MenuClosed); this.contextMenuStripListView.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripListViewOpening); this.contextMenuStripListView.Opened += new System.EventHandler(this.MenuOpened); @@ -2947,6 +2949,11 @@ namespace Nikse.SubtitleEdit.Forms this.mergeAfterToolStripMenuItem.Text = "Merge with line after"; this.mergeAfterToolStripMenuItem.Click += new System.EventHandler(this.MergeAfterToolStripMenuItemClick); // + // toolStripSeparator4Extend + // + this.toolStripSeparator4Extend.Name = "toolStripSeparator4Extend"; + this.toolStripSeparator4Extend.Size = new System.Drawing.Size(281, 6); + // // extendBeforeToolStripMenuItem // this.extendBeforeToolStripMenuItem.Name = "extendBeforeToolStripMenuItem"; @@ -5576,10 +5583,11 @@ namespace Nikse.SubtitleEdit.Forms this.toolStripMenuItemShowVideoControls.Text = "Show video controls"; this.toolStripMenuItemShowVideoControls.Click += new System.EventHandler(this.toolStripMenuItemShowVideoControls_Click); // - // toolStripSeparator4Extend + // toolStripMenuItemSetLayer // - this.toolStripSeparator4Extend.Name = "toolStripSeparator4Extend"; - this.toolStripSeparator4Extend.Size = new System.Drawing.Size(281, 6); + this.toolStripMenuItemSetLayer.Name = "toolStripMenuItemSetLayer"; + this.toolStripMenuItemSetLayer.Size = new System.Drawing.Size(284, 22); + this.toolStripMenuItemSetLayer.Text = "Set layer"; // // Main // @@ -6198,5 +6206,6 @@ namespace Nikse.SubtitleEdit.Forms private System.Windows.Forms.ToolStripMenuItem generateVideoWithSoftcodedSubtitlesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemExportTtmlImage; private System.Windows.Forms.ToolStripSeparator toolStripSeparator4Extend; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSetLayer; } } \ No newline at end of file diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index 4d273e7cc..db4e4072c 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -44,7 +44,6 @@ using System.Threading.Tasks; using System.Windows.Forms; using Nikse.SubtitleEdit.Core.AudioToText; using Nikse.SubtitleEdit.Forms.AudioToText; -using WebVTT = Nikse.SubtitleEdit.Core.SubtitleFormats.WebVTT; using Nikse.SubtitleEdit.Forms.VTT; namespace Nikse.SubtitleEdit.Forms @@ -1845,6 +1844,7 @@ namespace Nikse.SubtitleEdit.Forms toolStripMenuItemAssaStyles.Text = _language.Menu.ContextMenu.SubStationAlphaStyles; setStylesForSelectedLinesToolStripMenuItem.Text = _language.Menu.ContextMenu.SetStyle; setActorForSelectedLinesToolStripMenuItem.Text = _language.Menu.ContextMenu.SetActor; + toolStripMenuItemSetLayer.Text = _language.Menu.ContextMenu.SetLayer; toolStripMenuItemAssaTools.Text = _language.Menu.ContextMenu.AssaTools; applyCustomStylesToolStripMenuItem.Text = _language.Menu.ContextMenu.ApplyCustomOverrideTag; setPositionToolStripMenuItem.Text = _language.Menu.ContextMenu.SetPosition; @@ -8859,6 +8859,7 @@ namespace Nikse.SubtitleEdit.Forms toolStripMenuItemSetRegion.Visible = false; toolStripMenuItemSetLanguage.Visible = false; + toolStripMenuItemSetLayer.Visible = false; List actors = null; if ((formatType == typeof(AdvancedSubStationAlpha) || formatType == typeof(SubStationAlpha) || formatType == typeof(CsvNuendo)) && SubtitleListview1.SelectedItems.Count > 0) { @@ -8938,6 +8939,28 @@ namespace Nikse.SubtitleEdit.Forms } UiUtil.FixFonts(setActorForSelectedLinesToolStripMenuItem); + + toolStripMenuItemSetLayer.DropDownItems.Clear(); + if (SubtitleListview1.SelectedItems.Count > 0) + { + var p = _subtitle.GetParagraphOrDefault(SubtitleListview1.SelectedItems[0].Index); + if (p != null) + { + var layer = p.Layer; + + toolStripMenuItemSetLayer.DropDownItems.Add((layer - 100).ToString(CultureInfo.InvariantCulture), null, SetLayer); + toolStripMenuItemSetLayer.DropDownItems.Add((layer - 10).ToString(CultureInfo.InvariantCulture), null, SetLayer); + toolStripMenuItemSetLayer.DropDownItems.Add((layer - 1).ToString(CultureInfo.InvariantCulture), null, SetLayer); + + toolStripMenuItemSetLayer.DropDownItems.Add(layer.ToString(CultureInfo.InvariantCulture), null, SetLayer); + ((ToolStripMenuItem)toolStripMenuItemSetLayer.DropDownItems[toolStripMenuItemSetLayer.DropDownItems.Count - 1]).Checked = true; + + toolStripMenuItemSetLayer.DropDownItems.Add((layer + 1).ToString(CultureInfo.InvariantCulture), null, SetLayer); + toolStripMenuItemSetLayer.DropDownItems.Add((layer + 10).ToString(CultureInfo.InvariantCulture), null, SetLayer); + toolStripMenuItemSetLayer.DropDownItems.Add((layer + 100).ToString(CultureInfo.InvariantCulture), null, SetLayer); + } + toolStripMenuItemSetLayer.Visible = true; + } } else if (((formatType == typeof(TimedText10) && Configuration.Settings.SubtitleSettings.TimedText10ShowStyleAndLanguage) || formatType == typeof(ItunesTimedText)) && SubtitleListview1.SelectedItems.Count > 0) { @@ -9449,6 +9472,20 @@ namespace Nikse.SubtitleEdit.Forms } } + private void SetLayer(object sender, EventArgs e) + { + string layer = (sender as ToolStripItem).Text; + if (!string.IsNullOrEmpty(layer) && int.TryParse(layer, out int number)) + { + MakeHistoryForUndo(LanguageSettings.Current.Main.Menu.ContextMenu.SetLayer + ": " + layer); + + foreach (int index in SubtitleListview1.SelectedIndices) + { + _subtitle.Paragraphs[index].Layer = number; + } + } + } + private void SetRegion(object sender, EventArgs e) { string region = (sender as ToolStripItem).Text; diff --git a/src/ui/Forms/Main.resx b/src/ui/Forms/Main.resx index 20558035a..9468d9a93 100644 --- a/src/ui/Forms/Main.resx +++ b/src/ui/Forms/Main.resx @@ -857,7 +857,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2 - CAAAAk1TRnQBSQFMAgEBAgEAAbwBLgG8AS4BEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAAcQBLgHEAS4BEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/src/ui/Logic/Language.cs b/src/ui/Logic/Language.cs index e5f6b702e..fe38b5228 100644 --- a/src/ui/Logic/Language.cs +++ b/src/ui/Logic/Language.cs @@ -1943,6 +1943,7 @@ namespace Nikse.SubtitleEdit.Logic SizeAllColumnsToFit = "Size all columns to fit", SetStyle = "Set style", SetActor = "Set actor", + SetLayer = "Set layer", AssaTools = "ASSA tools", AdvancedSubStationAlphaStyles = "Advanced Sub Station Alpha styles...", SubStationAlphaStyles = "Sub Station Alpha styles...", diff --git a/src/ui/Logic/LanguageDeserializer.cs b/src/ui/Logic/LanguageDeserializer.cs index fb1cabe59..2423abd56 100644 --- a/src/ui/Logic/LanguageDeserializer.cs +++ b/src/ui/Logic/LanguageDeserializer.cs @@ -4504,6 +4504,9 @@ namespace Nikse.SubtitleEdit.Logic case "Main/Menu/ContextMenu/SetActor": language.Main.Menu.ContextMenu.SetActor = reader.Value; break; + case "Main/Menu/ContextMenu/SetLayer": + language.Main.Menu.ContextMenu.SetLayer = reader.Value; + break; case "Main/Menu/ContextMenu/AssaTools": language.Main.Menu.ContextMenu.AssaTools = reader.Value; break; diff --git a/src/ui/Logic/LanguageStructure.cs b/src/ui/Logic/LanguageStructure.cs index 0ad29b10b..08d3f1c5f 100644 --- a/src/ui/Logic/LanguageStructure.cs +++ b/src/ui/Logic/LanguageStructure.cs @@ -1787,6 +1787,7 @@ namespace Nikse.SubtitleEdit.Logic public string SizeAllColumnsToFit { get; set; } public string SetStyle { get; set; } public string SetActor { get; set; } + public string SetLayer { get; set; } public string AssaTools { get; set; } public string SubStationAlphaStyles { get; set; } public string AdvancedSubStationAlphaStyles { get; set; }