From cffba7edde5a3ca871d25fbd5e5db4db7a4a68ae Mon Sep 17 00:00:00 2001 From: Manolis Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Wed, 17 Mar 2021 19:28:01 +0200 Subject: [PATCH] Added an option in the Preferences for interface dimming on dialog popup --- CHANGELOG.md | 1 + Translations/Translations.pot | 3 ++ src/Autoload/Global.gd | 4 ++- src/Preferences/PreferencesDialog.gd | 1 + src/Preferences/PreferencesDialog.tscn | 46 ++++++++++++++++++-------- 5 files changed, 41 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c051a073c..4606f8c3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ Laurenz Reinthaler (Schweini07), kleonc, Fayez Akhtar (Variable), THWLF, Gamespl - Implemented the options to import a spritesheet as a new layer and to import an image and have it replace an already existing frame. ([#453](https://github.com/Orama-Interactive/Pixelorama/pull/453)) - More templates have been added when creating a new sprite. ([#450](https://github.com/Orama-Interactive/Pixelorama/pull/450)) - Added a keyboard shortcut for clear selection, `Control-D`. ([#457](https://github.com/Orama-Interactive/Pixelorama/pull/457)) +- Added an option in the Preferences for interface dimming on dialog popup. If this is enabled, the application background gets darker when a dialog window pops up. ### Changed - Undo and redo now work when their respective keyboard shortcuts are being held. ([#405](https://github.com/Orama-Interactive/Pixelorama/pull/405)) diff --git a/Translations/Translations.pot b/Translations/Translations.pot index a5c9512c1..fe3fe6cb3 100644 --- a/Translations/Translations.pot +++ b/Translations/Translations.pot @@ -446,6 +446,9 @@ msgstr "" msgid "Display Scale" msgstr "" +msgid "Dim interface on dialog popup" +msgstr "" + msgid "Dark" msgstr "" diff --git a/src/Autoload/Global.gd b/src/Autoload/Global.gd index e0b74c4d7..6850db51b 100644 --- a/src/Autoload/Global.gd +++ b/src/Autoload/Global.gd @@ -48,6 +48,7 @@ var default_clear_color := Color.gray var pressure_sensitivity_mode = PressureSensitivity.NONE var open_last_project := false var shrink := 1.0 +var dim_on_popup := true var smooth_zoom := true var theme_type : int = ThemeTypes.DARK var default_image_width := 64 @@ -453,7 +454,8 @@ func project_changed(value : int) -> void: func dialog_open(open : bool) -> void: if open: can_draw = false - control.get_node("ModulateTween").interpolate_property(control, "modulate", control.modulate, Color(0.5, 0.5, 0.5), 0.1, Tween.TRANS_LINEAR, Tween.EASE_OUT) + if dim_on_popup: + control.get_node("ModulateTween").interpolate_property(control, "modulate", control.modulate, Color(0.5, 0.5, 0.5), 0.1, Tween.TRANS_LINEAR, Tween.EASE_OUT) else: can_draw = true control.get_node("ModulateTween").interpolate_property(control, "modulate", control.modulate, Color.white, 0.1, Tween.TRANS_LINEAR, Tween.EASE_OUT) diff --git a/src/Preferences/PreferencesDialog.gd b/src/Preferences/PreferencesDialog.gd index 3531efe91..2796a8fe9 100644 --- a/src/Preferences/PreferencesDialog.gd +++ b/src/Preferences/PreferencesDialog.gd @@ -4,6 +4,7 @@ extends AcceptDialog var preferences = [ ["open_last_project", "Startup/StartupContainer/OpenLastProject", "pressed", Global.open_last_project], ["shrink", "Interface/ShrinkContainer/ShrinkHSlider", "value", Global.shrink], + ["dim_on_popup", "Interface/DimPopup/CheckBox", "pressed", Global.dim_on_popup], ["smooth_zoom", "Canvas/ZoomOptions/SmoothZoom", "pressed", Global.smooth_zoom], ["pressure_sensitivity_mode", "Startup/PressureSentivity/PressureSensitivityOptionButton", "selected", Global.pressure_sensitivity_mode], ["show_left_tool_icon", "Indicators/IndicatorsContainer/LeftToolIconCheckbox", "pressed", Global.show_left_tool_icon], diff --git a/src/Preferences/PreferencesDialog.tscn b/src/Preferences/PreferencesDialog.tscn index 277024174..1fd3fbbcb 100644 --- a/src/Preferences/PreferencesDialog.tscn +++ b/src/Preferences/PreferencesDialog.tscn @@ -115,7 +115,7 @@ text = "System Language" visible = false margin_top = 28.0 margin_right = 498.0 -margin_bottom = 66.0 +margin_bottom = 110.0 [node name="ShrinkContainer" type="HBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface"] margin_right = 498.0 @@ -123,21 +123,21 @@ margin_bottom = 20.0 [node name="Label" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface/ShrinkContainer"] margin_top = 3.0 -margin_right = 68.0 +margin_right = 84.0 margin_bottom = 17.0 text = "Display Scale" [node name="ShrinkLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface/ShrinkContainer"] -margin_left = 72.0 +margin_left = 88.0 margin_top = 3.0 -margin_right = 122.0 +margin_right = 138.0 margin_bottom = 17.0 rect_min_size = Vector2( 50, 0 ) text = "1" align = 2 [node name="ShrinkHSlider" type="HSlider" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface/ShrinkContainer"] -margin_left = 126.0 +margin_left = 142.0 margin_right = 446.0 margin_bottom = 16.0 mouse_default_cursor_shape = 2 @@ -156,20 +156,40 @@ margin_bottom = 20.0 mouse_default_cursor_shape = 2 text = "Apply" -[node name="HSeparator" type="HSeparator" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface"] -margin_right = 40.0 -margin_bottom = 4.0 - -[node name="Label" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface"] +[node name="DimPopup" type="HBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface"] margin_top = 24.0 margin_right = 498.0 -margin_bottom = 38.0 -text = "Themes" +margin_bottom = 48.0 -[node name="Themes" type="HBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface"] +[node name="Label" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface/DimPopup"] +margin_top = 5.0 +margin_right = 207.0 +margin_bottom = 19.0 +text = "Dim interface on dialog popup" + +[node name="CheckBox" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface/DimPopup"] +margin_left = 211.0 +margin_right = 258.0 +margin_bottom = 24.0 +mouse_default_cursor_shape = 2 +pressed = true +text = "On" + +[node name="HSeparator" type="HSeparator" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface"] margin_top = 52.0 margin_right = 498.0 margin_bottom = 56.0 + +[node name="Label" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface"] +margin_top = 60.0 +margin_right = 498.0 +margin_bottom = 74.0 +text = "Themes" + +[node name="Themes" type="HBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface"] +margin_top = 78.0 +margin_right = 498.0 +margin_bottom = 82.0 script = ExtResource( 5 ) [node name="ThemeButtons" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface/Themes"]