Add "select all" + "inverse selection" to "Multiple replace groups" - thx jmaraujouy :)

This commit is contained in:
niksedk 2023-06-30 13:03:25 +02:00
parent b654df497c
commit a4b039a03f
3 changed files with 104 additions and 34 deletions

View File

@ -33,6 +33,7 @@
this.buttonReplacesInverseSelection = new System.Windows.Forms.Button();
this.buttonReplacesSelectAll = new System.Windows.Forms.Button();
this.listViewFixes = new System.Windows.Forms.ListView();
this.contextMenuStripListViewFixes = new System.Windows.Forms.ContextMenuStrip(this.components);
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@ -68,6 +69,9 @@
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItemImport = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemExport = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.inverseSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.radioButtonNormal = new System.Windows.Forms.RadioButton();
this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
@ -93,10 +97,9 @@
this.buttonApply = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.inverseSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStripListViewFixes = new System.Windows.Forms.ContextMenuStrip();
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItemGroupsSelectAll = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemGroupsInvertSelection = new System.Windows.Forms.ToolStripMenuItem();
this.groupBoxLinesFound.SuspendLayout();
this.groupBoxReplaces.SuspendLayout();
this.contextMenuStripRules.SuspendLayout();
@ -106,7 +109,6 @@
this.splitContainer1.SuspendLayout();
this.groupBoxGroups.SuspendLayout();
this.contextMenuStripGroups.SuspendLayout();
this.contextMenuStripListViewFixes.SuspendLayout();
this.SuspendLayout();
//
// groupBoxLinesFound
@ -148,24 +150,18 @@
this.buttonReplacesSelectAll.UseVisualStyleBackColor = true;
this.buttonReplacesSelectAll.Click += new System.EventHandler(this.buttonReplacesSelectAll_Click);
//
// contextMenuStripListViewFixes
//
this.contextMenuStripListViewFixes.Name = "contextMenuStripListViewFixes";
this.contextMenuStripListViewFixes.Size = new System.Drawing.Size(285, 776);
this.contextMenuStripListViewFixes.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripListViewFixesOpening);
//
// listViewFixes
//
this.listViewFixes.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.listViewFixes.CheckBoxes = true;
this.listViewFixes.ContextMenuStrip = this.contextMenuStripListViewFixes;
this.listViewFixes.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader4,
this.columnHeader5,
this.columnHeader7,
this.columnHeader8});
this.listViewFixes.ContextMenuStrip = this.contextMenuStripListViewFixes;
this.listViewFixes.FullRowSelect = true;
this.listViewFixes.HideSelection = false;
this.listViewFixes.Location = new System.Drawing.Point(8, 21);
@ -177,6 +173,12 @@
this.listViewFixes.ClientSizeChanged += new System.EventHandler(this.listViewFixes_ClientSizeChanged);
this.listViewFixes.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listViewFixes_KeyDown);
//
// contextMenuStripListViewFixes
//
this.contextMenuStripListViewFixes.Name = "contextMenuStripListViewFixes";
this.contextMenuStripListViewFixes.Size = new System.Drawing.Size(61, 4);
this.contextMenuStripListViewFixes.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripListViewFixesOpening);
//
// columnHeader4
//
this.columnHeader4.Text = "Apply";
@ -396,7 +398,7 @@
this.selectAllToolStripMenuItem,
this.inverseSelectionToolStripMenuItem});
this.contextMenuStripRules.Name = "contextMenuStrip1";
this.contextMenuStripRules.Size = new System.Drawing.Size(228, 292);
this.contextMenuStripRules.Size = new System.Drawing.Size(228, 270);
this.contextMenuStripRules.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
//
// deleteToolStripMenuItem
@ -483,6 +485,25 @@
this.toolStripMenuItemExport.Text = "Export...";
this.toolStripMenuItemExport.Click += new System.EventHandler(this.toolStripMenuItem4_Click);
//
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(224, 6);
//
// selectAllToolStripMenuItem
//
this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem";
this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(227, 22);
this.selectAllToolStripMenuItem.Text = "Select all";
this.selectAllToolStripMenuItem.Click += new System.EventHandler(this.selectAllToolStripMenuItem_Click);
//
// inverseSelectionToolStripMenuItem
//
this.inverseSelectionToolStripMenuItem.Name = "inverseSelectionToolStripMenuItem";
this.inverseSelectionToolStripMenuItem.Size = new System.Drawing.Size(227, 22);
this.inverseSelectionToolStripMenuItem.Text = "Inverse selection";
this.inverseSelectionToolStripMenuItem.Click += new System.EventHandler(this.inverseSelectionToolStripMenuItem_Click);
//
// radioButtonNormal
//
this.radioButtonNormal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@ -610,6 +631,7 @@
this.listViewGroups.TabIndex = 0;
this.listViewGroups.UseCompatibleStateImageBehavior = false;
this.listViewGroups.View = System.Windows.Forms.View.Details;
this.listViewGroups.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listViewGroups_KeyDown);
//
// columnHeaderForName
//
@ -629,9 +651,12 @@
this.moveToBottomToolStripMenuItem,
this.toolStripSeparatorGroupImportExport,
this.importToolStripMenuItem,
this.exportToolStripMenuItem});
this.exportToolStripMenuItem,
this.toolStripSeparator6,
this.toolStripMenuItemGroupsSelectAll,
this.toolStripMenuItemGroupsInvertSelection});
this.contextMenuStripGroups.Name = "contextMenuStripGroups";
this.contextMenuStripGroups.Size = new System.Drawing.Size(216, 214);
this.contextMenuStripGroups.Size = new System.Drawing.Size(216, 286);
this.contextMenuStripGroups.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripGroups_Opening);
//
// newToolStripMenuItem
@ -732,24 +757,24 @@
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// toolStripSeparator5
// toolStripSeparator6
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(224, 6);
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(212, 6);
//
// selectAllToolStripMenuItem
// toolStripMenuItemGroupsSelectAll
//
this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem";
this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(227, 22);
this.selectAllToolStripMenuItem.Text = "Select all";
this.selectAllToolStripMenuItem.Click += new System.EventHandler(this.selectAllToolStripMenuItem_Click);
this.toolStripMenuItemGroupsSelectAll.Name = "toolStripMenuItemGroupsSelectAll";
this.toolStripMenuItemGroupsSelectAll.Size = new System.Drawing.Size(215, 22);
this.toolStripMenuItemGroupsSelectAll.Text = "Select all";
this.toolStripMenuItemGroupsSelectAll.Click += new System.EventHandler(this.toolStripMenuItemGroupsSelectAll_Click);
//
// inverseSelectionToolStripMenuItem
// toolStripMenuItemGroupsInvertSelection
//
this.inverseSelectionToolStripMenuItem.Name = "inverseSelectionToolStripMenuItem";
this.inverseSelectionToolStripMenuItem.Size = new System.Drawing.Size(227, 22);
this.inverseSelectionToolStripMenuItem.Text = "Inverse selection";
this.inverseSelectionToolStripMenuItem.Click += new System.EventHandler(this.inverseSelectionToolStripMenuItem_Click);
this.toolStripMenuItemGroupsInvertSelection.Name = "toolStripMenuItemGroupsInvertSelection";
this.toolStripMenuItemGroupsInvertSelection.Size = new System.Drawing.Size(215, 22);
this.toolStripMenuItemGroupsInvertSelection.Text = "Inverse selection";
this.toolStripMenuItemGroupsInvertSelection.Click += new System.EventHandler(this.toolStripMenuItemGroupsInvertSelection_Click);
//
// MultipleReplace
//
@ -779,7 +804,6 @@
this.splitContainer1.ResumeLayout(false);
this.groupBoxGroups.ResumeLayout(false);
this.contextMenuStripGroups.ResumeLayout(false);
this.contextMenuStripListViewFixes.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -854,5 +878,8 @@
private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem inverseSelectionToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip contextMenuStripListViewFixes;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemGroupsSelectAll;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemGroupsInvertSelection;
}
}

View File

@ -116,6 +116,8 @@ namespace Nikse.SubtitleEdit.Forms
deleteToolStripMenuItem1.Text = LanguageSettings.Current.MultipleReplace.Remove;
selectAllToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.ContextMenu.SelectAll;
inverseSelectionToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.Edit.InverseSelection;
toolStripMenuItemGroupsSelectAll.Text = LanguageSettings.Current.Main.Menu.ContextMenu.SelectAll;
toolStripMenuItemGroupsInvertSelection.Text = LanguageSettings.Current.Main.Menu.Edit.InverseSelection;
radioButtonCaseSensitive.Left = radioButtonNormal.Left + radioButtonNormal.Width + 40;
radioButtonRegEx.Left = radioButtonCaseSensitive.Left + radioButtonCaseSensitive.Width + 40;
@ -1213,7 +1215,10 @@ namespace Nikse.SubtitleEdit.Forms
{
if (item != newToolStripMenuItem &&
item != toolStripSeparatorGroupImportExport &&
item != importToolStripMenuItem)
item != importToolStripMenuItem &&
item != toolStripSeparator6 &&
item != toolStripMenuItemGroupsSelectAll &&
item != toolStripMenuItemGroupsInvertSelection)
{
item.Visible = doShow;
}
@ -1404,5 +1409,40 @@ namespace Nikse.SubtitleEdit.Forms
listViewFixes.Columns[4].Text = LanguageSettings.Current.MultipleReplace.RuleInfo;
listViewFixes.AutoSizeLastColumn();
}
private void listViewGroups_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.A && e.Modifiers == Keys.Control)
{
toolStripMenuItemGroupsSelectAll_Click(null, null);
e.SuppressKeyPress = true;
}
else if (e.KeyCode == Keys.D && e.Modifiers == Keys.Control)
{
listViewGroups.SelectFirstSelectedItemOnly();
e.SuppressKeyPress = true;
}
else if (e.KeyCode == Keys.I && e.Modifiers == (Keys.Control | Keys.Shift)) //InverseSelection
{
toolStripMenuItemGroupsInvertSelection_Click(null, null);
e.SuppressKeyPress = true;
}
}
private void toolStripMenuItemGroupsSelectAll_Click(object sender, EventArgs e)
{
foreach (ListViewItem item in listViewGroups.Items)
{
item.Checked = true;
}
}
private void toolStripMenuItemGroupsInvertSelection_Click(object sender, EventArgs e)
{
foreach (ListViewItem item in listViewGroups.Items)
{
item.Checked = !item.Checked;
}
}
}
}

View File

@ -117,16 +117,19 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="contextMenuStripRules.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="contextMenuStripListViewFixes.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="contextMenuStripRules.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>237, 17</value>
</metadata>
<metadata name="contextMenuStripGroups.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>448, 17</value>
<value>691, 17</value>
</metadata>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>172, 17</value>
<value>415, 17</value>
</metadata>
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>312, 17</value>
<value>555, 17</value>
</metadata>
</root>