mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2025-01-31 13:01:39 +01:00
Simplify ASSA override tag history + add delete context menu - thx Andrebavila :)
Fix #7548
This commit is contained in:
parent
c9d61c3a9c
commit
cefc2b7104
@ -1196,10 +1196,11 @@ namespace Nikse.SubtitleEdit.Core.Forms
|
||||
|
||||
text = text.Trim();
|
||||
|
||||
if (text.Replace('♪', ' ').Replace('♫', ' ').Trim().Length == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
//TODO: new option "Remove if only music symbols"? Add/Fix unit tests... see https://github.com/SubtitleEdit/subtitleedit/issues/7541
|
||||
//if (text.Replace('♪', ' ').Replace('♫', ' ').Trim().Length == 0)
|
||||
//{
|
||||
// return string.Empty;
|
||||
//}
|
||||
|
||||
// keep U2010 dashes if no changes
|
||||
if (originalAfterU2010Replace == text)
|
||||
|
58
src/ui/Forms/Assa/TagHistory.Designer.cs
generated
58
src/ui/Forms/Assa/TagHistory.Designer.cs
generated
@ -31,38 +31,25 @@ namespace Nikse.SubtitleEdit.Forms.Assa
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.seTextBoxOverrideStyle = new Nikse.SubtitleEdit.Controls.NikseTextBox();
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.listBoxHistory = new System.Windows.Forms.ListBox();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.buttonOK = new System.Windows.Forms.Button();
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// seTextBoxOverrideStyle
|
||||
//
|
||||
this.seTextBoxOverrideStyle.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.seTextBoxOverrideStyle.BackColor = System.Drawing.SystemColors.WindowFrame;
|
||||
this.seTextBoxOverrideStyle.HideSelection = true;
|
||||
this.seTextBoxOverrideStyle.Location = new System.Drawing.Point(12, 254);
|
||||
this.seTextBoxOverrideStyle.Multiline = true;
|
||||
this.seTextBoxOverrideStyle.Name = "seTextBoxOverrideStyle";
|
||||
this.seTextBoxOverrideStyle.Padding = new System.Windows.Forms.Padding(1);
|
||||
this.seTextBoxOverrideStyle.ScrollBars = ScrollBars.None;
|
||||
this.seTextBoxOverrideStyle.SelectedText = "";
|
||||
this.seTextBoxOverrideStyle.SelectionLength = 0;
|
||||
this.seTextBoxOverrideStyle.SelectionStart = 0;
|
||||
this.seTextBoxOverrideStyle.Size = new System.Drawing.Size(776, 152);
|
||||
this.seTextBoxOverrideStyle.TabIndex = 0;
|
||||
//
|
||||
// listBoxHistory
|
||||
//
|
||||
this.listBoxHistory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.listBoxHistory.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.listBoxHistory.ContextMenuStrip = this.contextMenuStrip1;
|
||||
this.listBoxHistory.FormattingEnabled = true;
|
||||
this.listBoxHistory.Location = new System.Drawing.Point(12, 36);
|
||||
this.listBoxHistory.Name = "listBoxHistory";
|
||||
this.listBoxHistory.Size = new System.Drawing.Size(776, 212);
|
||||
this.listBoxHistory.Size = new System.Drawing.Size(776, 368);
|
||||
this.listBoxHistory.TabIndex = 1;
|
||||
this.listBoxHistory.SelectedIndexChanged += new System.EventHandler(this.listBoxHistory_SelectedIndexChanged);
|
||||
this.listBoxHistory.DoubleClick += new System.EventHandler(this.listBoxHistory_DoubleClick);
|
||||
@ -72,7 +59,7 @@ namespace Nikse.SubtitleEdit.Forms.Assa
|
||||
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.buttonCancel.Location = new System.Drawing.Point(713, 415);
|
||||
this.buttonCancel.Location = new System.Drawing.Point(713, 418);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonCancel.TabIndex = 217;
|
||||
@ -83,7 +70,7 @@ namespace Nikse.SubtitleEdit.Forms.Assa
|
||||
//
|
||||
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.buttonOK.Location = new System.Drawing.Point(632, 415);
|
||||
this.buttonOK.Location = new System.Drawing.Point(632, 418);
|
||||
this.buttonOK.Name = "buttonOK";
|
||||
this.buttonOK.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonOK.TabIndex = 216;
|
||||
@ -91,32 +78,47 @@ namespace Nikse.SubtitleEdit.Forms.Assa
|
||||
this.buttonOK.UseVisualStyleBackColor = true;
|
||||
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.removeToolStripMenuItem});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 48);
|
||||
//
|
||||
// removeToolStripMenuItem
|
||||
//
|
||||
this.removeToolStripMenuItem.Name = "removeToolStripMenuItem";
|
||||
this.removeToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Delete;
|
||||
this.removeToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.removeToolStripMenuItem.Text = "Remove";
|
||||
this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click);
|
||||
//
|
||||
// TagHistory
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.ClientSize = new System.Drawing.Size(800, 453);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonOK);
|
||||
this.Controls.Add(this.listBoxHistory);
|
||||
this.Controls.Add(this.seTextBoxOverrideStyle);
|
||||
this.KeyPreview = true;
|
||||
this.MinimumSize = new System.Drawing.Size(816, 489);
|
||||
this.MinimumSize = new System.Drawing.Size(816, 400);
|
||||
this.Name = "TagHistory";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "TagHistory";
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TagHistory_KeyDown);
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Controls.NikseTextBox seTextBoxOverrideStyle;
|
||||
private System.Windows.Forms.ListBox listBoxHistory;
|
||||
private System.Windows.Forms.Button buttonCancel;
|
||||
private System.Windows.Forms.Button buttonOK;
|
||||
private ContextMenuStrip contextMenuStrip1;
|
||||
private ToolStripMenuItem removeToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
using Nikse.SubtitleEdit.Core.Common;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Nikse.SubtitleEdit.Core.Common;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@ -19,36 +21,28 @@ namespace Nikse.SubtitleEdit.Forms.Assa
|
||||
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
|
||||
UiUtil.FixLargeFonts(this, buttonOK);
|
||||
|
||||
FillHistory();
|
||||
}
|
||||
|
||||
private void FillHistory()
|
||||
{
|
||||
listBoxHistory.BeginUpdate();
|
||||
listBoxHistory.Items.Clear();
|
||||
foreach (var tag in Configuration.Settings.SubtitleSettings.AssaOverrideTagHistory)
|
||||
{
|
||||
listBoxHistory.Items.Add(tag);
|
||||
}
|
||||
|
||||
listBoxHistory.EndUpdate();
|
||||
|
||||
if (Configuration.Settings.SubtitleSettings.AssaOverrideTagHistory.Count > 0)
|
||||
{
|
||||
listBoxHistory.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
seTextBoxOverrideStyle.KeyDown += SeTextBoxOverrideStyle_KeyDown;
|
||||
}
|
||||
|
||||
private void SeTextBoxOverrideStyle_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
|
||||
private void listBoxHistory_SelectedIndexChanged(object sender, System.EventArgs e)
|
||||
{
|
||||
var idx = listBoxHistory.SelectedIndex;
|
||||
if (idx < 0)
|
||||
{
|
||||
seTextBoxOverrideStyle.Text = string.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
seTextBoxOverrideStyle.Text = Configuration.Settings.SubtitleSettings.AssaOverrideTagHistory[idx];
|
||||
}
|
||||
|
||||
private void buttonOK_Click(object sender, System.EventArgs e)
|
||||
@ -56,7 +50,6 @@ namespace Nikse.SubtitleEdit.Forms.Assa
|
||||
var idx = listBoxHistory.SelectedIndex;
|
||||
if (idx < 0)
|
||||
{
|
||||
seTextBoxOverrideStyle.Text = string.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -89,5 +82,21 @@ namespace Nikse.SubtitleEdit.Forms.Assa
|
||||
buttonOK_Click(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeToolStripMenuItem_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
var indices = new List<int>();
|
||||
foreach (int idx in listBoxHistory.SelectedIndices)
|
||||
{
|
||||
indices.Add(idx);
|
||||
}
|
||||
|
||||
foreach (var idx in indices.OrderByDescending(p=>p))
|
||||
{
|
||||
Configuration.Settings.SubtitleSettings.AssaOverrideTagHistory.RemoveAt(idx);
|
||||
}
|
||||
|
||||
FillHistory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,4 +117,7 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
Loading…
x
Reference in New Issue
Block a user