From 23e8cf2db39b6a968e8775d7e95852d12fe75a9f Mon Sep 17 00:00:00 2001 From: Michael Seibt Date: Sat, 2 Apr 2022 23:33:51 +0200 Subject: [PATCH] Replace ShortcutKeys Ctrl+F with Hotkeys --- GitUI/BranchTreePanel/RepoObjectsTree.Command.cs | 10 +++++----- .../CommandsDialogs/RevisionDiffControl.Designer.cs | 1 - GitUI/CommandsDialogs/RevisionDiffControl.cs | 6 ++++-- .../RevisionFileTreeControl.Designer.cs | 1 - GitUI/CommandsDialogs/RevisionFileTreeControl.cs | 5 ++++- GitUI/Editor/FileViewer.Designer.cs | 1 - GitUI/Editor/FileViewer.cs | 1 + GitUI/Hotkey/HotkeySettingsManager.cs | 12 +++++++----- 8 files changed, 21 insertions(+), 16 deletions(-) diff --git a/GitUI/BranchTreePanel/RepoObjectsTree.Command.cs b/GitUI/BranchTreePanel/RepoObjectsTree.Command.cs index cb56effb546..681e5d1e3f9 100644 --- a/GitUI/BranchTreePanel/RepoObjectsTree.Command.cs +++ b/GitUI/BranchTreePanel/RepoObjectsTree.Command.cs @@ -4,11 +4,11 @@ public partial class RepoObjectsTree { public enum Command { - Delete, - Rename, - Search, - MultiSelect, - MultiSelectWithChildren + Delete = 0, + Rename = 1, + Search = 2, + MultiSelect = 3, + MultiSelectWithChildren = 4, } } } diff --git a/GitUI/CommandsDialogs/RevisionDiffControl.Designer.cs b/GitUI/CommandsDialogs/RevisionDiffControl.Designer.cs index 5d004c162c5..073ed985651 100644 --- a/GitUI/CommandsDialogs/RevisionDiffControl.Designer.cs +++ b/GitUI/CommandsDialogs/RevisionDiffControl.Designer.cs @@ -437,7 +437,6 @@ private void InitializeComponent() // this.findInDiffToolStripMenuItem.Image = global::GitUI.Properties.Images.Preview; this.findInDiffToolStripMenuItem.Name = "findInDiffToolStripMenuItem"; - this.findInDiffToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F))); this.findInDiffToolStripMenuItem.Size = new System.Drawing.Size(296, 22); this.findInDiffToolStripMenuItem.Text = "&Find"; this.findInDiffToolStripMenuItem.Click += new System.EventHandler(this.findInDiffToolStripMenuItem_Click); diff --git a/GitUI/CommandsDialogs/RevisionDiffControl.cs b/GitUI/CommandsDialogs/RevisionDiffControl.cs index 59487528bd4..c22e306f80a 100644 --- a/GitUI/CommandsDialogs/RevisionDiffControl.cs +++ b/GitUI/CommandsDialogs/RevisionDiffControl.cs @@ -129,7 +129,8 @@ public enum Command UnStageSelectedFile = 11, ShowFileTree = 12, FilterFileInGrid = 13, - SelectFirstGroupChanges = 14 + SelectFirstGroupChanges = 14, + Find = 15, } public CommandStatus ExecuteCommand(Command cmd) @@ -163,7 +164,7 @@ protected override CommandStatus ExecuteCommand(int cmd) case Command.ShowFileTree: diffShowInFileTreeToolStripMenuItem.PerformClick(); break; case Command.FilterFileInGrid: diffFilterFileInGridToolStripMenuItem.PerformClick(); break; case Command.SelectFirstGroupChanges: return SelectFirstGroupChangesIfFileNotFocused(); - + case Command.Find: findInDiffToolStripMenuItem.PerformClick(); break; default: return base.ExecuteCommand(cmd); } @@ -199,6 +200,7 @@ public void ReloadHotkeys() unstageFileToolStripMenuItem.ShortcutKeyDisplayString = GetShortcutKeyDisplayString(Command.UnStageSelectedFile); diffShowInFileTreeToolStripMenuItem.ShortcutKeyDisplayString = GetShortcutKeyDisplayString(Command.ShowFileTree); diffFilterFileInGridToolStripMenuItem.ShortcutKeyDisplayString = GetShortcutKeyDisplayString(Command.FilterFileInGrid); + findInDiffToolStripMenuItem.ShortcutKeyDisplayString = GetShortcutKeyDisplayString(Command.Find); DiffText.ReloadHotkeys(); } diff --git a/GitUI/CommandsDialogs/RevisionFileTreeControl.Designer.cs b/GitUI/CommandsDialogs/RevisionFileTreeControl.Designer.cs index 52819e9dd6f..20a9cebf87f 100644 --- a/GitUI/CommandsDialogs/RevisionFileTreeControl.Designer.cs +++ b/GitUI/CommandsDialogs/RevisionFileTreeControl.Designer.cs @@ -307,7 +307,6 @@ private void InitializeComponent() // this.findToolStripMenuItem.Image = global::GitUI.Properties.Images.Preview; this.findToolStripMenuItem.Name = "findToolStripMenuItem"; - this.findToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F))); this.findToolStripMenuItem.Size = new System.Drawing.Size(325, 22); this.findToolStripMenuItem.Text = "Find in file tree..."; this.findToolStripMenuItem.Click += new System.EventHandler(this.findToolStripMenuItem_Click); diff --git a/GitUI/CommandsDialogs/RevisionFileTreeControl.cs b/GitUI/CommandsDialogs/RevisionFileTreeControl.cs index d35e8e846cd..d8da671d9cb 100644 --- a/GitUI/CommandsDialogs/RevisionFileTreeControl.cs +++ b/GitUI/CommandsDialogs/RevisionFileTreeControl.cs @@ -257,7 +257,8 @@ public enum Command OpenAsTempFile = 3, OpenAsTempFileWith = 4, EditFile = 5, - FilterFileInGrid = 6 + FilterFileInGrid = 6, + Find = 7, } public CommandStatus ExecuteCommand(Command cmd) @@ -276,6 +277,7 @@ protected override CommandStatus ExecuteCommand(int cmd) case Command.OpenAsTempFileWith: openFileWithToolStripMenuItem.PerformClick(); break; case Command.EditFile: editCheckedOutFileToolStripMenuItem.PerformClick(); break; case Command.FilterFileInGrid: filterFileInGridToolStripMenuItem.PerformClick(); break; + case Command.Find: findToolStripMenuItem.PerformClick(); break; default: return base.ExecuteCommand(cmd); } @@ -300,6 +302,7 @@ public void ReloadHotkeys() openFileWithToolStripMenuItem.ShortcutKeyDisplayString = GetShortcutKeyDisplayString(Command.OpenAsTempFileWith); editCheckedOutFileToolStripMenuItem.ShortcutKeyDisplayString = GetShortcutKeyDisplayString(Command.EditFile); filterFileInGridToolStripMenuItem.ShortcutKeyDisplayString = GetShortcutKeyDisplayString(Command.FilterFileInGrid); + findToolStripMenuItem.ShortcutKeyDisplayString = GetShortcutKeyDisplayString(Command.Find); FileText.ReloadHotkeys(); } diff --git a/GitUI/Editor/FileViewer.Designer.cs b/GitUI/Editor/FileViewer.Designer.cs index d8215b6c1a4..219c5d0932c 100644 --- a/GitUI/Editor/FileViewer.Designer.cs +++ b/GitUI/Editor/FileViewer.Designer.cs @@ -144,7 +144,6 @@ private void InitializeComponent() // findToolStripMenuItem // this.findToolStripMenuItem.Name = "findToolStripMenuItem"; - this.findToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F))); this.findToolStripMenuItem.Size = new System.Drawing.Size(243, 22); this.findToolStripMenuItem.Text = "Find"; this.findToolStripMenuItem.Click += new System.EventHandler(this.FindToolStripMenuItemClick); diff --git a/GitUI/Editor/FileViewer.cs b/GitUI/Editor/FileViewer.cs index b72a95db6a9..cadd78d6fe6 100644 --- a/GitUI/Editor/FileViewer.cs +++ b/GitUI/Editor/FileViewer.cs @@ -336,6 +336,7 @@ public void ClearBlameGutter() public void ReloadHotkeys() { Hotkeys = HotkeySettingsManager.LoadHotkeys(HotkeySettingsName); + findToolStripMenuItem.ShortcutKeyDisplayString = GetShortcutKeyDisplayString(Command.Find); stageSelectedLinesToolStripMenuItem.ShortcutKeyDisplayString = GetShortcutKeyDisplayString(Command.StageLines); unstageSelectedLinesToolStripMenuItem.ShortcutKeyDisplayString = GetShortcutKeyDisplayString(Command.UnstageLines); resetSelectedLinesToolStripMenuItem.ShortcutKeyDisplayString = GetShortcutKeyDisplayString(Command.ResetLines); diff --git a/GitUI/Hotkey/HotkeySettingsManager.cs b/GitUI/Hotkey/HotkeySettingsManager.cs index e78975172f8..e07f7436635 100644 --- a/GitUI/Hotkey/HotkeySettingsManager.cs +++ b/GitUI/Hotkey/HotkeySettingsManager.cs @@ -300,10 +300,10 @@ public static HotkeySettings[] CreateDefaultSettings() new HotkeySettings( RepoObjectsTree.HotkeySettingsName, Hk(RepoObjectsTree.Command.Delete, Keys.Delete), - Hk(RepoObjectsTree.Command.Rename, Keys.F2), - Hk(RepoObjectsTree.Command.Search, Keys.F3), Hk(RepoObjectsTree.Command.MultiSelect, Keys.Control | Keys.Space), - Hk(RepoObjectsTree.Command.MultiSelectWithChildren, Keys.Control | Keys.Shift | Keys.Space)), + Hk(RepoObjectsTree.Command.MultiSelectWithChildren, Keys.Control | Keys.Shift | Keys.Space), + Hk(RepoObjectsTree.Command.Rename, Keys.F2), + Hk(RepoObjectsTree.Command.Search, Keys.F3)), new HotkeySettings( RevisionGridControl.HotkeySettingsName, Hk(RevisionGridControl.Command.CompareSelectedCommits, Keys.None), @@ -378,6 +378,7 @@ public static HotkeySettings[] CreateDefaultSettings() Hk(RevisionDiffControl.Command.DeleteSelectedFiles, Keys.Delete), Hk(RevisionDiffControl.Command.EditFile, EditFileHotkey), Hk(RevisionDiffControl.Command.FilterFileInGrid, Keys.F), + Hk(RevisionDiffControl.Command.Find, Keys.Control | Keys.F), Hk(RevisionDiffControl.Command.OpenAsTempFile, OpenAsTempFileHotkey), Hk(RevisionDiffControl.Command.OpenAsTempFileWith, OpenAsTempFileWithHotkey), Hk(RevisionDiffControl.Command.OpenWithDifftool, OpenWithDifftoolHotkey), @@ -393,11 +394,12 @@ public static HotkeySettings[] CreateDefaultSettings() RevisionFileTreeControl.HotkeySettingsName, Hk(RevisionFileTreeControl.Command.Blame, BlameHotkey), Hk(RevisionFileTreeControl.Command.EditFile, EditFileHotkey), + Hk(RevisionFileTreeControl.Command.FilterFileInGrid, Keys.F), + Hk(RevisionFileTreeControl.Command.Find, Keys.Control | Keys.F), Hk(RevisionFileTreeControl.Command.OpenAsTempFile, OpenAsTempFileHotkey), Hk(RevisionFileTreeControl.Command.OpenAsTempFileWith, OpenAsTempFileWithHotkey), Hk(RevisionFileTreeControl.Command.OpenWithDifftool, OpenWithDifftoolHotkey), - Hk(RevisionFileTreeControl.Command.ShowHistory, ShowHistoryHotkey), - Hk(RevisionFileTreeControl.Command.FilterFileInGrid, Keys.F)), + Hk(RevisionFileTreeControl.Command.ShowHistory, ShowHistoryHotkey)), new HotkeySettings( FormStash.HotkeySettingsName, Hk(FormStash.Command.NextStash, Keys.Control | Keys.N),