mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Merge pull request #7926 from caioeverest/feature/add-sort-rules-to-multiple-replace-tool
Implement simple sort method for multiple replace rules view
This commit is contained in:
commit
9103458930
17
src/ui/Forms/MultipleReplace.Designer.cs
generated
17
src/ui/Forms/MultipleReplace.Designer.cs
generated
@ -1,4 +1,4 @@
|
|||||||
namespace Nikse.SubtitleEdit.Forms
|
namespace Nikse.SubtitleEdit.Forms
|
||||||
{
|
{
|
||||||
sealed partial class MultipleReplace
|
sealed partial class MultipleReplace
|
||||||
{
|
{
|
||||||
@ -72,6 +72,7 @@
|
|||||||
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.inverseSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.inverseSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.sortToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.radioButtonNormal = new System.Windows.Forms.RadioButton();
|
this.radioButtonNormal = new System.Windows.Forms.RadioButton();
|
||||||
this.buttonOK = new System.Windows.Forms.Button();
|
this.buttonOK = new System.Windows.Forms.Button();
|
||||||
this.buttonCancel = new System.Windows.Forms.Button();
|
this.buttonCancel = new System.Windows.Forms.Button();
|
||||||
@ -329,7 +330,14 @@
|
|||||||
this.labelReplaceWith.Size = new System.Drawing.Size(72, 13);
|
this.labelReplaceWith.Size = new System.Drawing.Size(72, 13);
|
||||||
this.labelReplaceWith.TabIndex = 3;
|
this.labelReplaceWith.TabIndex = 3;
|
||||||
this.labelReplaceWith.Text = "Replace with:";
|
this.labelReplaceWith.Text = "Replace with:";
|
||||||
//
|
//
|
||||||
|
// sortToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.sortToolStripMenuItem.Name = "sortItems";
|
||||||
|
this.sortToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Home)));
|
||||||
|
this.sortToolStripMenuItem.Size = new System.Drawing.Size(227, 22);
|
||||||
|
this.sortToolStripMenuItem.Text = "Sort items";
|
||||||
|
this.sortToolStripMenuItem.Click += new System.EventHandler(this.sortToolStripMenuItem_Click);
|
||||||
// listViewRules
|
// listViewRules
|
||||||
//
|
//
|
||||||
this.listViewRules.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
this.listViewRules.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
@ -353,6 +361,7 @@
|
|||||||
this.listViewRules.View = System.Windows.Forms.View.Details;
|
this.listViewRules.View = System.Windows.Forms.View.Details;
|
||||||
this.listViewRules.SelectedIndexChanged += new System.EventHandler(this.ListViewReplaceListSelectedIndexChanged);
|
this.listViewRules.SelectedIndexChanged += new System.EventHandler(this.ListViewReplaceListSelectedIndexChanged);
|
||||||
this.listViewRules.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ListViewRulesKeyDown);
|
this.listViewRules.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ListViewRulesKeyDown);
|
||||||
|
this.listViewRules.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewSort_ColumnClick);
|
||||||
//
|
//
|
||||||
// columnHeader1
|
// columnHeader1
|
||||||
//
|
//
|
||||||
@ -396,7 +405,8 @@
|
|||||||
this.toolStripMenuItemExport,
|
this.toolStripMenuItemExport,
|
||||||
this.toolStripSeparator5,
|
this.toolStripSeparator5,
|
||||||
this.selectAllToolStripMenuItem,
|
this.selectAllToolStripMenuItem,
|
||||||
this.inverseSelectionToolStripMenuItem});
|
this.inverseSelectionToolStripMenuItem,
|
||||||
|
this.sortToolStripMenuItem});
|
||||||
this.contextMenuStripRules.Name = "contextMenuStrip1";
|
this.contextMenuStripRules.Name = "contextMenuStrip1";
|
||||||
this.contextMenuStripRules.Size = new System.Drawing.Size(228, 270);
|
this.contextMenuStripRules.Size = new System.Drawing.Size(228, 270);
|
||||||
this.contextMenuStripRules.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
|
this.contextMenuStripRules.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
|
||||||
@ -881,5 +891,6 @@
|
|||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
|
||||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemGroupsSelectAll;
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemGroupsSelectAll;
|
||||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemGroupsInvertSelection;
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemGroupsInvertSelection;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem sortToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -120,6 +120,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
inverseSelectionToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.Edit.InverseSelection;
|
inverseSelectionToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.Edit.InverseSelection;
|
||||||
toolStripMenuItemGroupsSelectAll.Text = LanguageSettings.Current.Main.Menu.ContextMenu.SelectAll;
|
toolStripMenuItemGroupsSelectAll.Text = LanguageSettings.Current.Main.Menu.ContextMenu.SelectAll;
|
||||||
toolStripMenuItemGroupsInvertSelection.Text = LanguageSettings.Current.Main.Menu.Edit.InverseSelection;
|
toolStripMenuItemGroupsInvertSelection.Text = LanguageSettings.Current.Main.Menu.Edit.InverseSelection;
|
||||||
|
sortToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.Tools.SortBy;
|
||||||
|
|
||||||
radioButtonCaseSensitive.Left = radioButtonNormal.Left + radioButtonNormal.Width + 40;
|
radioButtonCaseSensitive.Left = radioButtonNormal.Left + radioButtonNormal.Width + 40;
|
||||||
radioButtonRegEx.Left = radioButtonCaseSensitive.Left + radioButtonCaseSensitive.Width + 40;
|
radioButtonRegEx.Left = radioButtonCaseSensitive.Left + radioButtonCaseSensitive.Width + 40;
|
||||||
@ -1532,5 +1533,35 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
item.Checked = !item.Checked;
|
item.Checked = !item.Checked;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SortItems(int column)
|
||||||
|
{
|
||||||
|
var items = new List<MultipleSearchAndReplaceSetting>();
|
||||||
|
|
||||||
|
switch (column)
|
||||||
|
{
|
||||||
|
case 0: items = _currentGroup.Rules.OrderBy(i => i.Enabled).ToList(); break;
|
||||||
|
case 1: items = _currentGroup.Rules.OrderBy(i => i.FindWhat).ToList(); break;
|
||||||
|
case 2: items = _currentGroup.Rules.OrderBy(i => i.ReplaceWith).ToList(); break;
|
||||||
|
case 3: items = _currentGroup.Rules.OrderBy(i => i.SearchType).ToList(); break;
|
||||||
|
case 4: items = _currentGroup.Rules.OrderBy(i => i.Description).ToList(); break;
|
||||||
|
default: items = _currentGroup.Rules.OrderBy(i => i.FindWhat).ToList(); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_currentGroup.Rules.Clear();
|
||||||
|
_currentGroup.Rules.AddRange(items);
|
||||||
|
UpdateViewFromModel(Configuration.Settings.MultipleSearchAndReplaceGroups, _currentGroup);
|
||||||
|
GeneratePreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sortToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SortItems(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void listViewSort_ColumnClick(object sender, ColumnClickEventArgs e)
|
||||||
|
{
|
||||||
|
SortItems(e.Column);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user