From 733029bbb7aad5bd6e061c0749441f87d8329745 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 24 Jul 2021 21:02:39 +0200 Subject: [PATCH 1/2] Move commands for opening panes to `Window` menu and add commands for the "Assemblies" and "Analyzer" panes. While the command isn't really necessary to open these panes ("Assemblies" is always open and "Analyzer" opens automatically when analyzing), it is useful to focus these panes without having to use the mouse. --- ILSpy/Commands/ShowDebugSteps.cs | 18 ------------- ILSpy/Commands/ShowPane.cs | 35 ++++++++++++++++++++++++++ ILSpy/ILSpy.csproj | 2 +- ILSpy/Properties/Resources.Designer.cs | 18 +++++++++++++ ILSpy/Properties/Resources.resx | 6 +++++ ILSpy/Search/SearchPane.cs | 2 +- 6 files changed, 61 insertions(+), 20 deletions(-) delete mode 100644 ILSpy/Commands/ShowDebugSteps.cs create mode 100644 ILSpy/Commands/ShowPane.cs diff --git a/ILSpy/Commands/ShowDebugSteps.cs b/ILSpy/Commands/ShowDebugSteps.cs deleted file mode 100644 index 21f1c069e..000000000 --- a/ILSpy/Commands/ShowDebugSteps.cs +++ /dev/null @@ -1,18 +0,0 @@ -#if DEBUG - -using ICSharpCode.ILSpy.Docking; -using ICSharpCode.ILSpy.Properties; -using ICSharpCode.ILSpy.ViewModels; - -namespace ICSharpCode.ILSpy.Commands -{ - [ExportMainMenuCommand(Menu = nameof(Resources._View), Header = nameof(Resources._ShowDebugSteps), MenuOrder = 5000)] - class ShowDebugSteps : SimpleCommand - { - public override void Execute(object parameter) - { - DockWorkspace.Instance.ShowToolPane(DebugStepsPaneModel.PaneContentId); - } - } -} -#endif \ No newline at end of file diff --git a/ILSpy/Commands/ShowPane.cs b/ILSpy/Commands/ShowPane.cs new file mode 100644 index 000000000..2a5b14030 --- /dev/null +++ b/ILSpy/Commands/ShowPane.cs @@ -0,0 +1,35 @@ +using ICSharpCode.ILSpy.Docking; +using ICSharpCode.ILSpy.Properties; +using ICSharpCode.ILSpy.ViewModels; + +namespace ICSharpCode.ILSpy.Commands +{ + [ExportMainMenuCommand(Menu = nameof(Resources._Window), Header = nameof(Resources._Assemblies), MenuCategory = "pane", MenuOrder = 5000)] + class ShowAssemblies : SimpleCommand + { + public override void Execute(object parameter) + { + DockWorkspace.Instance.ShowToolPane(AssemblyListPaneModel.PaneContentId); + } + } + + [ExportMainMenuCommand(Menu = nameof(Resources._Window), Header = nameof(Resources._Analyzer), MenuCategory = "pane", MenuOrder = 5000)] + class ShowAnalyzer : SimpleCommand + { + public override void Execute(object parameter) + { + DockWorkspace.Instance.ShowToolPane(AnalyzerPaneModel.PaneContentId); + } + } + +#if DEBUG + [ExportMainMenuCommand(Menu = nameof(Resources._Window), Header = nameof(Resources._ShowDebugSteps), MenuCategory = "pane", MenuOrder = 5000)] + class ShowDebugSteps : SimpleCommand + { + public override void Execute(object parameter) + { + DockWorkspace.Instance.ShowToolPane(DebugStepsPaneModel.PaneContentId); + } + } +#endif +} \ No newline at end of file diff --git a/ILSpy/ILSpy.csproj b/ILSpy/ILSpy.csproj index 4757e9ffe..360ef0d3b 100644 --- a/ILSpy/ILSpy.csproj +++ b/ILSpy/ILSpy.csproj @@ -132,6 +132,6 @@ - + diff --git a/ILSpy/Properties/Resources.Designer.cs b/ILSpy/Properties/Resources.Designer.cs index 9302e2f9f..8d8550eb3 100644 --- a/ILSpy/Properties/Resources.Designer.cs +++ b/ILSpy/Properties/Resources.Designer.cs @@ -78,6 +78,24 @@ namespace ICSharpCode.ILSpy.Properties { } } + /// + /// Looks up a localized string similar to Analy_zer. + /// + public static string _Analyzer { + get { + return ResourceManager.GetString("_Analyzer", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _Assemblies. + /// + public static string _Assemblies { + get { + return ResourceManager.GetString("_Assemblies", resourceCulture); + } + } + /// /// Looks up a localized string similar to _Check for Updates. /// diff --git a/ILSpy/Properties/Resources.resx b/ILSpy/Properties/Resources.resx index 4952cb74d..5641b507a 100644 --- a/ILSpy/Properties/Resources.resx +++ b/ILSpy/Properties/Resources.resx @@ -933,6 +933,12 @@ Do you want to continue? _Add To Main List + + Analy_zer + + + _Assemblies + _Check for Updates diff --git a/ILSpy/Search/SearchPane.cs b/ILSpy/Search/SearchPane.cs index 54fc2cad9..5c446c9bf 100644 --- a/ILSpy/Search/SearchPane.cs +++ b/ILSpy/Search/SearchPane.cs @@ -397,7 +397,7 @@ namespace ICSharpCode.ILSpy } } - [ExportMainMenuCommand(Menu = nameof(Properties.Resources._View), Header = nameof(Properties.Resources.Search), MenuIcon = "Images/Search", MenuCategory = nameof(Properties.Resources.View), MenuOrder = 100)] + [ExportMainMenuCommand(Menu = nameof(Properties.Resources._Window), Header = nameof(Properties.Resources.Search), MenuIcon = "Images/Search", MenuCategory = "pane", MenuOrder = 100)] [ExportToolbarCommand(ToolTip = nameof(Properties.Resources.SearchCtrlShiftFOrCtrlE), ToolbarIcon = "Images/Search", ToolbarCategory = nameof(Properties.Resources.View), ToolbarOrder = 100)] sealed class ShowSearchCommand : CommandWrapper { From 52dad2f005c557c069e07c04aabe60d1736b2d8b Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 24 Jul 2021 21:46:21 +0200 Subject: [PATCH 2/2] Add hotkeys for focusing the toolbar combo boxes --- ILSpy/MainWindow.xaml | 2 +- ILSpy/MainWindow.xaml.cs | 23 +++++++++++++++++++++++ ILSpy/Properties/Resources.Designer.cs | 24 ++++++++++++------------ ILSpy/Properties/Resources.resx | 12 ++++++------ ILSpy/Properties/Resources.zh-Hans.resx | 6 +++--- 5 files changed, 45 insertions(+), 22 deletions(-) diff --git a/ILSpy/MainWindow.xaml b/ILSpy/MainWindow.xaml index 36b0649f0..8a20d45cb 100644 --- a/ILSpy/MainWindow.xaml +++ b/ILSpy/MainWindow.xaml @@ -107,7 +107,7 @@ - + diff --git a/ILSpy/MainWindow.xaml.cs b/ILSpy/MainWindow.xaml.cs index 7e3132d0e..89d711c95 100644 --- a/ILSpy/MainWindow.xaml.cs +++ b/ILSpy/MainWindow.xaml.cs @@ -371,6 +371,29 @@ namespace ICSharpCode.ILSpy } #endregion + protected override void OnKeyDown(KeyEventArgs e) + { + base.OnKeyDown(e); + if (!e.Handled && e.KeyboardDevice.Modifiers == ModifierKeys.Alt && e.Key == Key.System) + { + switch (e.SystemKey) + { + case Key.A: + assemblyListComboBox.Focus(); + e.Handled = true; + break; + case Key.L: + languageComboBox.Focus(); + e.Handled = true; + break; + case Key.E: // Alt+V was already taken by _View menu + languageVersionComboBox.Focus(); + e.Handled = true; + break; + } + } + } + public AssemblyList CurrentAssemblyList { get { return assemblyList; } } diff --git a/ILSpy/Properties/Resources.Designer.cs b/ILSpy/Properties/Resources.Designer.cs index 8d8550eb3..302ff79c6 100644 --- a/ILSpy/Properties/Resources.Designer.cs +++ b/ILSpy/Properties/Resources.Designer.cs @@ -1712,15 +1712,6 @@ namespace ICSharpCode.ILSpy.Properties { } } - /// - /// Looks up a localized string similar to Language. - /// - public static string Language { - get { - return ResourceManager.GetString("Language", resourceCulture); - } - } - /// /// Looks up a localized string similar to Are you sure that you want to delete the selected assembly list?. /// @@ -2238,7 +2229,7 @@ namespace ICSharpCode.ILSpy.Properties { } /// - /// Looks up a localized string similar to Select a list of assemblies. + /// Looks up a localized string similar to Select a list of assemblies (Alt+A). /// public static string SelectAssemblyListDropdownTooltip { get { @@ -2247,7 +2238,7 @@ namespace ICSharpCode.ILSpy.Properties { } /// - /// Looks up a localized string similar to Select language to decompile to. + /// Looks up a localized string similar to Select language to decompile to (Alt+L). /// public static string SelectLanguageDropdownTooltip { get { @@ -2274,7 +2265,7 @@ namespace ICSharpCode.ILSpy.Properties { } /// - /// Looks up a localized string similar to Select version of language to output. + /// Looks up a localized string similar to Select version of language to output (Alt+E). /// public static string SelectVersionDropdownTooltip { get { @@ -2543,6 +2534,15 @@ namespace ICSharpCode.ILSpy.Properties { } } + /// + /// Looks up a localized string similar to UI Language. + /// + public static string UILanguage { + get { + return ResourceManager.GetString("UILanguage", resourceCulture); + } + } + /// /// Looks up a localized string similar to System. /// diff --git a/ILSpy/Properties/Resources.resx b/ILSpy/Properties/Resources.resx index 5641b507a..80b5a36ad 100644 --- a/ILSpy/Properties/Resources.resx +++ b/ILSpy/Properties/Resources.resx @@ -591,9 +591,6 @@ Are you sure you want to continue? Insert using declarations - - Language - Are you sure that you want to delete the selected assembly list? @@ -769,10 +766,10 @@ Do you want to continue? Select assemblies to open: - Select a list of assemblies + Select a list of assemblies (Alt+A) - Select language to decompile to + Select language to decompile to (Alt+L) Select a list: @@ -781,7 +778,7 @@ Do you want to continue? Select PDB... - Select version of language to output + Select version of language to output (Alt+E) You must restart ILSpy for the change to take effect. @@ -870,6 +867,9 @@ Do you want to continue? Type + + UI Language + System diff --git a/ILSpy/Properties/Resources.zh-Hans.resx b/ILSpy/Properties/Resources.zh-Hans.resx index 594ac91ee..fb8c6cc94 100644 --- a/ILSpy/Properties/Resources.zh-Hans.resx +++ b/ILSpy/Properties/Resources.zh-Hans.resx @@ -585,9 +585,6 @@ 插入使用声明 - - 语言 - 是否删除选中的程序集列表? @@ -858,6 +855,9 @@ 类型 + + 语言 + 系统