diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2023-11-06 12:41:08 +0100 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2024-01-27 19:38:39 +0100 |
commit | 04a930d9a696ca984d2962d8001c50cb65593f29 (patch) | |
tree | 92a171fb0a197fa58d9fde29e81069670844244c /editor/plugins/script_editor_plugin.cpp | |
parent | 17e7f85c06366b427e5068c5b3e2940e27ff5f1d (diff) | |
download | redot-engine-04a930d9a696ca984d2962d8001c50cb65593f29.tar.gz |
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.
Diffstat (limited to 'editor/plugins/script_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
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); |