Add ASSA layer context menu

This commit is contained in:
niksedk 2023-06-15 19:54:50 +02:00
parent da3d18fd6f
commit 7f67fef675
7 changed files with 59 additions and 7 deletions

View File

@ -1378,6 +1378,7 @@ To use an API key, go to "Options -> Settings -> Tools" to enter your Goog
<SizeAllColumnsToFit>Size all columns to fit</SizeAllColumnsToFit>
<SetStyle>Set style</SetStyle>
<SetActor>Set actor</SetActor>
<SetLayer>Set layer</SetLayer>
<AssaTools>ASSA tools</AssaTools>
<SubStationAlphaStyles>Sub Station Alpha styles...</SubStationAlphaStyles>
<AdvancedSubStationAlphaStyles>Advanced Sub Station Alpha styles...</AdvancedSubStationAlphaStyles>

View File

@ -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;
}
}

View File

@ -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<string> 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;

View File

@ -857,7 +857,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
CAAAAk1TRnQBSQFMAgEBAgEAAbwBLgG8AS4BEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAgEAAcQBLgHEAS4BEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -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...",

View File

@ -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;

View File

@ -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; }