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/window_wrapper.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/window_wrapper.cpp')
-rw-r--r-- | editor/window_wrapper.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/editor/window_wrapper.cpp b/editor/window_wrapper.cpp index a085c2e44f..b2b237269a 100644 --- a/editor/window_wrapper.cpp +++ b/editor/window_wrapper.cpp @@ -315,7 +315,7 @@ void WindowWrapper::set_margins_enabled(bool p_enabled) { } WindowWrapper::WindowWrapper() { - if (SceneTree::get_singleton()->get_root()->is_embedding_subwindows() || EDITOR_GET("interface/editor/single_window_mode") || !EDITOR_GET("interface/multi_window/enable")) { + if (!EditorNode::get_singleton()->is_multi_window_enabled()) { return; } @@ -375,7 +375,9 @@ void ScreenSelect::_build_advanced_menu() { } void ScreenSelect::_emit_screen_signal(int p_screen_idx) { - emit_signal("request_open_in_screen", p_screen_idx); + if (!is_disabled()) { + emit_signal("request_open_in_screen", p_screen_idx); + } } void ScreenSelect::_bind_methods() { @@ -436,13 +438,19 @@ void ScreenSelect::pressed() { } ScreenSelect::ScreenSelect() { - set_tooltip_text(TTR("Make this panel floating.\nRight click to open the screen selector.")); set_button_mask(MouseButtonMask::RIGHT); set_flat(true); set_toggle_mode(true); set_focus_mode(FOCUS_NONE); set_action_mode(ACTION_MODE_BUTTON_PRESS); + if (!EditorNode::get_singleton()->is_multi_window_enabled()) { + set_disabled(true); + set_tooltip_text(EditorNode::get_singleton()->get_multiwindow_support_tooltip_text()); + } else { + set_tooltip_text(TTR("Make this panel floating.\nRight-click to open the screen selector.")); + } + // Create the popup. const Size2 borders = Size2(4, 4) * EDSCALE; |