Merge pull request #52595 from lewiji/mono-build-solution-shortcut
[3.x] Add editor keyboard shortcut for Mono Build solution button
This commit is contained in:
commit
154cca3d5d
@ -39,9 +39,11 @@
|
||||
#include "core/project_settings.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "core/os/keyboard.h"
|
||||
#include "editor/bindings_generator.h"
|
||||
#include "editor/csharp_project.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/node_dock.h"
|
||||
#endif
|
||||
|
||||
@ -1178,6 +1180,7 @@ void CSharpLanguage::_editor_init_callback() {
|
||||
|
||||
// Enable it as a plugin
|
||||
EditorNode::add_editor_plugin(godotsharp_editor);
|
||||
ED_SHORTCUT("mono/build_solution", TTR("Build Solution"), KEY_MASK_ALT | KEY_B);
|
||||
godotsharp_editor->enable_plugin();
|
||||
|
||||
get_singleton()->godotsharp_editor = godotsharp_editor;
|
||||
|
@ -440,11 +440,15 @@ namespace GodotTools
|
||||
|
||||
AddToolSubmenuItem("C#", menuPopup);
|
||||
|
||||
var buildSolutionShortcut = (ShortCut)EditorShortcut("mono/build_solution");
|
||||
|
||||
toolBarButton = new ToolButton
|
||||
{
|
||||
Text = "Build",
|
||||
HintTooltip = "Build solution",
|
||||
FocusMode = Control.FocusModeEnum.None
|
||||
HintTooltip = "Build Solution".TTR(),
|
||||
FocusMode = Control.FocusModeEnum.None,
|
||||
Shortcut = buildSolutionShortcut,
|
||||
ShortcutInTooltip = true
|
||||
};
|
||||
toolBarButton.Connect("pressed", this, nameof(BuildSolutionPressed));
|
||||
AddControlToContainer(CustomControlContainer.Toolbar, toolBarButton);
|
||||
|
@ -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);
|
||||
|
||||
@ -27,6 +30,9 @@ namespace GodotTools.Internals
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
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);
|
||||
}
|
||||
|
@ -349,6 +349,12 @@ MonoObject *godot_icall_Globals_EditorDef(MonoString *p_setting, MonoObject *p_d
|
||||
return GDMonoMarshal::variant_to_mono_object(result);
|
||||
}
|
||||
|
||||
MonoObject *godot_icall_Globals_EditorShortcut(MonoString *p_setting) {
|
||||
String setting = GDMonoMarshal::mono_string_to_godot(p_setting);
|
||||
Ref<ShortCut> result = ED_GET_SHORTCUT(setting);
|
||||
return GDMonoMarshal::variant_to_mono_object(result);
|
||||
}
|
||||
|
||||
MonoString *godot_icall_Globals_TTR(MonoString *p_text) {
|
||||
String text = GDMonoMarshal::mono_string_to_godot(p_text);
|
||||
return GDMonoMarshal::mono_string_from_godot(TTR(text));
|
||||
@ -427,6 +433,7 @@ void register_editor_internal_calls() {
|
||||
GDMonoUtils::add_internal_call("GodotTools.Internals.Globals::internal_EditorScale", godot_icall_Globals_EditorScale);
|
||||
GDMonoUtils::add_internal_call("GodotTools.Internals.Globals::internal_GlobalDef", godot_icall_Globals_GlobalDef);
|
||||
GDMonoUtils::add_internal_call("GodotTools.Internals.Globals::internal_EditorDef", godot_icall_Globals_EditorDef);
|
||||
GDMonoUtils::add_internal_call("GodotTools.Internals.Globals::internal_EditorShortcut", godot_icall_Globals_EditorShortcut);
|
||||
GDMonoUtils::add_internal_call("GodotTools.Internals.Globals::internal_TTR", godot_icall_Globals_TTR);
|
||||
|
||||
// Utils.OS
|
||||
|
Loading…
Reference in New Issue
Block a user