1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-25 15:37:42 +00:00

Merge pull request #83987 from bruvzg/macos_window_and_help

[macOS] Add default Window and Help menus, allow special menu customization.
This commit is contained in:
Yuri Sizov
2023-12-18 18:17:41 +01:00
11 changed files with 477 additions and 228 deletions

View File

@@ -7357,6 +7357,20 @@ EditorNode::EditorNode() {
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/file_quit", TTR("Quit"), KeyModifierMask::CMD_OR_CTRL + Key::Q), FILE_QUIT, true);
}
ED_SHORTCUT_AND_COMMAND("editor/editor_settings", TTR("Editor Settings..."));
ED_SHORTCUT_OVERRIDE("editor/editor_settings", "macos", KeyModifierMask::META + Key::COMMA);
#ifdef MACOS_ENABLED
if (global_menu) {
apple_menu = memnew(PopupMenu);
apple_menu->set_system_menu_root("_apple");
main_menu->add_child(apple_menu);
apple_menu->add_shortcut(ED_GET_SHORTCUT("editor/editor_settings"), SETTINGS_PREFERENCES);
apple_menu->add_separator();
apple_menu->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));
}
#endif
project_menu = memnew(PopupMenu);
project_menu->set_name(TTR("Project"));
main_menu->add_child(project_menu);
@@ -7422,9 +7436,13 @@ EditorNode::EditorNode() {
settings_menu->set_name(TTR("Editor"));
main_menu->add_child(settings_menu);
ED_SHORTCUT_AND_COMMAND("editor/editor_settings", TTR("Editor Settings..."));
ED_SHORTCUT_OVERRIDE("editor/editor_settings", "macos", KeyModifierMask::META + Key::COMMA);
#ifdef MACOS_ENABLED
if (!global_menu) {
settings_menu->add_shortcut(ED_GET_SHORTCUT("editor/editor_settings"), SETTINGS_PREFERENCES);
}
#else
settings_menu->add_shortcut(ED_GET_SHORTCUT("editor/editor_settings"), SETTINGS_PREFERENCES);
#endif
settings_menu->add_shortcut(ED_SHORTCUT("editor/command_palette", TTR("Command Palette..."), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::P), HELP_COMMAND_PALETTE);
settings_menu->add_separator();
@@ -7471,6 +7489,7 @@ EditorNode::EditorNode() {
help_menu = memnew(PopupMenu);
help_menu->set_name(TTR("Help"));
help_menu->set_system_menu_root("_help");
main_menu->add_child(help_menu);
help_menu->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));