1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Added the left and right tool icon option to be saved and restored on startup

Update PreferencesDialog.tscn and PreferencesDialog.gd
This commit is contained in:
Matheus Pesegoginski 2020-04-10 16:40:14 -03:00
parent 6213eddb7e
commit 796cd124d4
2 changed files with 17 additions and 3 deletions

View file

@ -5,6 +5,7 @@
[ext_resource path="res://Assets/Fonts/CJK/NotoSansCJKtc-Regular.tres" type="DynamicFont" id=3]
[node name="PreferencesDialog" type="AcceptDialog"]
visible = true
margin_right = 430.0
margin_bottom = 1347.0
rect_min_size = Vector2( 430, 0 )
@ -110,9 +111,9 @@ text = "Show right tool icon"
[node name="PressureSentivity" type="HBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/General"]
visible = false
margin_top = 46.0
margin_top = 116.0
margin_right = 334.0
margin_bottom = 66.0
margin_bottom = 136.0
[node name="PressureSensitivityLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/General/PressureSentivity"]
margin_top = 3.0

View file

@ -11,6 +11,8 @@ onready var shortcuts = $HSplitContainer/ScrollContainer/VBoxContainer/Shortcuts
onready var smooth_zoom_button = $"HSplitContainer/ScrollContainer/VBoxContainer/General/SmoothZoom"
onready var sensitivity_option = $"HSplitContainer/ScrollContainer/VBoxContainer/General/PressureSentivity/PressureSensitivityOptionButton"
onready var left_tool_icon = $HSplitContainer/ScrollContainer/VBoxContainer/General/GridContainer/LeftToolIconCheckbox
onready var right_tool_icon = $HSplitContainer/ScrollContainer/VBoxContainer/General/GridContainer/RightToolIconCheckbox
onready var default_width_value = $HSplitContainer/ScrollContainer/VBoxContainer/Image/ImageOptions/ImageDefaultWidth
onready var default_height_value = $HSplitContainer/ScrollContainer/VBoxContainer/Image/ImageOptions/ImageDefaultHeight
@ -58,6 +60,13 @@ func _ready() -> void:
if Global.config_cache.has_section_key("preferences", "pressure_sensitivity"):
Global.pressure_sensitivity_mode = Global.config_cache.get_value("preferences", "pressure_sensitivity")
sensitivity_option.selected = Global.pressure_sensitivity_mode
if Global.config_cache.has_section_key("preferences", "show_left_tool_icon"):
Global.show_left_tool_icon = Global.config_cache.get_value("preferences", "show_left_tool_icon")
left_tool_icon.pressed = Global.show_left_tool_icon
if Global.config_cache.has_section_key("preferences", "show_right_tool_icon"):
Global.show_right_tool_icon = Global.config_cache.get_value("preferences", "show_right_tool_icon")
right_tool_icon.pressed = Global.show_right_tool_icon
# Set default values for Grid & Guide options
if Global.config_cache.has_section_key("preferences", "grid_size"):
@ -400,7 +409,7 @@ func _on_DefaultBackground_color_changed(color: Color) -> void:
func _on_LeftIndicatorCheckbox_toggled(button_pressed : bool) -> void:
Global.left_square_indicator_visible = button_pressed
Global.left_square_indicator_visible = button_pressed
func _on_RightIndicatorCheckbox_toggled(button_pressed : bool) -> void:
@ -409,10 +418,14 @@ func _on_RightIndicatorCheckbox_toggled(button_pressed : bool) -> void:
func _on_LeftToolIconCheckbox_toggled(button_pressed : bool) -> void:
Global.show_left_tool_icon = button_pressed
Global.config_cache.set_value("preferences", "show_left_tool_icon", Global.show_left_tool_icon)
Global.config_cache.save("user://cache.ini")
func _on_RightToolIconCheckbox_toggled(button_pressed : bool) -> void:
Global.show_right_tool_icon = button_pressed
Global.config_cache.set_value("preferences", "show_right_tool_icon", Global.show_right_tool_icon)
Global.config_cache.save("user://cache.ini")
func _on_Shortcut_button_pressed(button : Button) -> void: