From ce7a5e77ba63103bd4135ec72657843552288989 Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas Date: Wed, 24 Jan 2024 18:31:22 +0200 Subject: [PATCH] Add a single window mode setting in the preferences True by default, when set to false the UI uses multiple windows --- Translations/Translations.pot | 12 ++++++++++++ src/Autoload/Global.gd | 11 +++++++++++ src/Preferences/PreferencesDialog.gd | 7 +++++++ src/Preferences/PreferencesDialog.tscn | 14 ++++++++++++++ 4 files changed, 44 insertions(+) diff --git a/Translations/Translations.pot b/Translations/Translations.pot index e09ba86c2..e4a696b6a 100644 --- a/Translations/Translations.pot +++ b/Translations/Translations.pot @@ -747,6 +747,18 @@ msgstr "" msgid "Use native file dialogs" msgstr "" +#. Found in the preferences, tooltip of the "Use native file dialogs" option. +msgid "When this setting is enabled, the native file dialogs of the operating system are being used, instead of Pixelorama's custom ones." +msgstr "" + +#. Found in the preferences, under the interface section. When this setting is enabled, Pixelorama's subwindows will be embedded in the main window, otherwise each dialog will be its own separate window. +msgid "Single window mode" +msgstr "" + +#. Found in the preferences, tooltip of the "Single window mode" option. +msgid "When this setting is enabled, Pixelorama's subwindows will be embedded in the main window, otherwise each dialog will be its own separate window." +msgstr "" + msgid "Dark" msgstr "" diff --git a/src/Autoload/Global.gd b/src/Autoload/Global.gd index 4b9060013..b614452c7 100644 --- a/src/Autoload/Global.gd +++ b/src/Autoload/Global.gd @@ -158,6 +158,8 @@ var font_size := 16: control.theme.set_font_size("font_size", "HeaderSmall", value + 2) ## Found in Preferences. If [code]true[/code], the interface dims on popups. var dim_on_popup := true +## Found in Preferences. If [code]true[/code], the native file dialogs of the +## operating system are being used, instead of Godot's FileDialog node. var use_native_file_dialogs := false: set(value): use_native_file_dialogs = value @@ -165,6 +167,14 @@ var use_native_file_dialogs := false: await tree_entered await get_tree().process_frame get_tree().set_group(&"FileDialogs", "use_native_dialog", value) +## Found in Preferences. If [code]true[/code], subwindows are embedded in the main window. +var single_window_mode := true: + set(value): + single_window_mode = value + if OS.has_feature("editor"): + return + ProjectSettings.set_setting("display/window/subwindows/embed_subwindows", value) + ProjectSettings.save_custom(OVERRIDE_FILE) ## Found in Preferences. The modulation color (or simply color) of icons. var modulate_icon_color := Color.GRAY ## Found in Preferences. Determines if [member modulate_icon_color] uses custom or theme color. @@ -542,6 +552,7 @@ func _init() -> void: data_directories.append(default_loc.path_join(HOME_SUBDIR_NAME)) if ProjectSettings.get_setting("display/window/tablet_driver") == "winink": tablet_driver = 1 + single_window_mode = ProjectSettings.get_setting("display/window/subwindows/embed_subwindows") func _ready() -> void: diff --git a/src/Preferences/PreferencesDialog.gd b/src/Preferences/PreferencesDialog.gd index 88723e075..fc07a0c25 100644 --- a/src/Preferences/PreferencesDialog.gd +++ b/src/Preferences/PreferencesDialog.gd @@ -14,6 +14,13 @@ var preferences: Array[Preference] = [ Preference.new( "use_native_file_dialogs", "Interface/InterfaceOptions/NativeFileDialogs", "button_pressed" ), + Preference.new( + "single_window_mode", + "Interface/InterfaceOptions/SingleWindowMode", + "button_pressed", + true, + true + ), Preference.new("icon_color_from", "Interface/ButtonOptions/IconColorOptionButton", "selected"), Preference.new("custom_icon_color", "Interface/ButtonOptions/IconColorButton", "color"), Preference.new("left_tool_color", "Interface/ButtonOptions/LeftToolColorButton", "color"), diff --git a/src/Preferences/PreferencesDialog.tscn b/src/Preferences/PreferencesDialog.tscn index 5457411df..1db38cd78 100644 --- a/src/Preferences/PreferencesDialog.tscn +++ b/src/Preferences/PreferencesDialog.tscn @@ -217,6 +217,20 @@ text = "Use native file dialogs" [node name="NativeFileDialogs" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions"] layout_mode = 2 size_flags_horizontal = 3 +tooltip_text = "When this setting is enabled, the native file dialogs of the operating system are being used, instead of Pixelorama's custom ones." +mouse_default_cursor_shape = 2 +button_pressed = true +text = "On" + +[node name="SingleWindowModeLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Single window mode" + +[node name="SingleWindowMode" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions"] +layout_mode = 2 +size_flags_horizontal = 3 +tooltip_text = "When this setting is enabled, Pixelorama's subwindows will be embedded in the main window, otherwise each dialog will be its own separate window." mouse_default_cursor_shape = 2 button_pressed = true text = "On"