From 04a930d9a696ca984d2962d8001c50cb65593f29 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Mon, 6 Nov 2023 12:41:08 +0100 Subject: Disable multi-window buttons instead of hiding them when support is unavailable This is more explicit as for why this functionality isn't available depending on editor settings and current platform. This also exposes a `EditorInterface.is_multi_window_enabled()` method so that editor plugins can easily query whether the editor is able and expected to create multiple windows. --- editor/plugins/script_editor_plugin.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'editor/plugins/script_editor_plugin.cpp') diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 55191f44d4..c8e65e98a7 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -4074,18 +4074,19 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { script_forward->set_disabled(true); script_forward->set_tooltip_text(TTR("Go to next edited document.")); - if (p_wrapper->is_window_available()) { - menu_hb->add_child(memnew(VSeparator)); + menu_hb->add_child(memnew(VSeparator)); - make_floating = memnew(ScreenSelect); - make_floating->set_flat(true); + make_floating = memnew(ScreenSelect); + make_floating->set_flat(true); + make_floating->connect("request_open_in_screen", callable_mp(window_wrapper, &WindowWrapper::enable_window_on_screen).bind(true)); + if (!make_floating->is_disabled()) { + // Override default ScreenSelect tooltip if multi-window support is available. make_floating->set_tooltip_text(TTR("Make the script editor floating.")); - make_floating->connect("request_open_in_screen", callable_mp(window_wrapper, &WindowWrapper::enable_window_on_screen).bind(true)); - - menu_hb->add_child(make_floating); - p_wrapper->connect("window_visibility_changed", callable_mp(this, &ScriptEditor::_window_changed)); } + menu_hb->add_child(make_floating); + p_wrapper->connect("window_visibility_changed", callable_mp(this, &ScriptEditor::_window_changed)); + tab_container->connect("tab_changed", callable_mp(this, &ScriptEditor::_tab_changed)); erase_tab_confirm = memnew(ConfirmationDialog); -- cgit v1.2.3