diff options
author | Lewis James <lewiji+github@gmail.com> | 2021-09-13 14:33:56 +0100 |
---|---|---|
committer | Lewis James <lewiji+github@gmail.com> | 2021-09-14 13:13:00 +0100 |
commit | 913aa270c09e62297b0a060ebdd49ac7df67aaae (patch) | |
tree | 1d593e37cf76c8340d67a0e3fd4eb6e6392aebbf /modules/mono/editor/GodotTools | |
parent | f85426e8ad22e2ce875d3b686ab2dfdfa1ecc877 (diff) |
Add editor keyboard shortcut for Mono Build solution button
Apply suggestions from code review
Merging @akien-mga's suggestion with the matching change to the CS project
Co-authored-by: RĂ©mi Verschelde <rverschelde@gmail.com>
Diffstat (limited to 'modules/mono/editor/GodotTools')
-rw-r--r-- | modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs | 8 | ||||
-rw-r--r-- | modules/mono/editor/GodotTools/GodotTools/Internals/Globals.cs | 6 |
2 files changed, 12 insertions, 2 deletions
diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs index 73cabf8561..98c6881166 100644 --- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs +++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs @@ -418,11 +418,15 @@ namespace GodotTools AddToolSubmenuItem("C#", _menuPopup); + var buildSolutionShortcut = (Shortcut)EditorShortcut("mono/build_solution"); + _toolBarBuildButton = new Button { Text = "Build", - HintTooltip = "Build solution", - FocusMode = Control.FocusModeEnum.None + HintTooltip = "Build Solution".TTR(), + FocusMode = Control.FocusModeEnum.None, + Shortcut = buildSolutionShortcut, + ShortcutInTooltip = true }; _toolBarBuildButton.PressedSignal += BuildSolutionPressed; AddControlToContainer(CustomControlContainer.Toolbar, _toolBarBuildButton); diff --git a/modules/mono/editor/GodotTools/GodotTools/Internals/Globals.cs b/modules/mono/editor/GodotTools/GodotTools/Internals/Globals.cs index 793f84fd77..5c5ced8c29 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Internals/Globals.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Internals/Globals.cs @@ -13,6 +13,9 @@ namespace GodotTools.Internals public static object EditorDef(string setting, object defaultValue, bool restartIfChanged = false) => internal_EditorDef(setting, defaultValue, restartIfChanged); + public static object EditorShortcut(string setting) => + internal_EditorShortcut(setting); + [SuppressMessage("ReSharper", "InconsistentNaming")] public static string TTR(this string text) => internal_TTR(text); @@ -28,6 +31,9 @@ namespace GodotTools.Internals private static extern object internal_EditorDef(string setting, object defaultValue, bool restartIfChanged); [MethodImpl(MethodImplOptions.InternalCall)] + private static extern object internal_EditorShortcut(string setting); + + [MethodImpl(MethodImplOptions.InternalCall)] private static extern string internal_TTR(string text); } } |