Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrlabs committed Aug 15, 2024
1 parent 2281b5b commit 3f409c8
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 27 deletions.
14 changes: 7 additions & 7 deletions lorien/InfiniteCanvas/InfiniteCanvas.gd
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,13 @@ func set_brush_color(color: Color) -> void:
if _active_tool != null:
_active_tool._on_brush_color_changed(_brush_color)

# -------------------------------------------------------------------------------------------------
func enable_constant_pressure(enable: bool):
if enable:
_brush_tool.pressure_curve = _constant_pressure_curve
else:
_brush_tool.pressure_curve = _default_pressure_curve

# -------------------------------------------------------------------------------------------------
func get_camera_zoom() -> float:
return _camera.zoom.x
Expand Down Expand Up @@ -390,10 +397,3 @@ func set_canvas_scale(scale: float) -> void:
# -------------------------------------------------------------------------------------------------
func get_canvas_scale() -> float:
return _scale


func _on_SettingsDialog_constant_pressure_changed(state: bool):
if state:
_brush_tool.pressure_curve = _constant_pressure_curve
else:
_brush_tool.pressure_curve = _default_pressure_curve
5 changes: 5 additions & 0 deletions lorien/Main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func _ready():
_settings_dialog.connect("grid_size_changed", self, "_on_grid_size_changed")
_settings_dialog.connect("grid_pattern_changed", self, "_on_grid_pattern_changed")
_settings_dialog.connect("canvas_color_changed", self, "_on_canvas_color_changed")
_settings_dialog.connect("constant_pressure_changed", self, "_on_constant_pressure_changed")

# Initialize scale
_on_scale_changed()
Expand Down Expand Up @@ -541,6 +542,10 @@ func _on_scale_changed() -> void:
get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_DISABLED, SceneTree.STRETCH_ASPECT_IGNORE, Vector2(0,0), scale)
OS.min_window_size = Config.MIN_WINDOW_SIZE * scale

# --------------------------------------------------------------------------------------------------
func _on_constant_pressure_changed(enable: bool) -> void:
_canvas.enable_constant_pressure(enable)

# --------------------------------------------------------------------------------------------------
func _get_platform_ui_scale() -> float:
var platform: String = OS.get_name()
Expand Down
13 changes: 6 additions & 7 deletions lorien/Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ margin_bottom = 202.0
custom_styles/panel = SubResource( 1 )

[node name="ColorPicker" type="ColorPicker" parent="BackgroundColorPickerPopup/PanelContainer"]
margin_left = 100.0
margin_top = 100.0
margin_right = 409.0
margin_bottom = 504.0
margin_left = 4.0
margin_top = 4.0
margin_right = 313.0
margin_bottom = 408.0
edit_alpha = false
presets_enabled = false
presets_visible = false
Expand Down Expand Up @@ -131,7 +131,7 @@ margin_right = 385.0
margin_bottom = 216.5
theme = ExtResource( 8 )
popup_exclusive = true
window_title = "Salvar um Arquivo"
window_title = ""
access = 2
filters = PoolStringArray( "*.lorien" )
__meta__ = {
Expand Down Expand Up @@ -238,7 +238,7 @@ margin_right = 68.5
margin_bottom = 35.0
theme = ExtResource( 8 )
popup_exclusive = true
window_title = "Alerta!"
window_title = ""
dialog_text = "Generic message. "
__meta__ = {
"_edit_lock_": true
Expand All @@ -251,4 +251,3 @@ __meta__ = {
[connection signal="new_palette_created" from="NewPaletteDialog" to="." method="_on_NewPaletteDialog_new_palette_created"]
[connection signal="palette_deleted" from="DeletePaletteDialog" to="." method="_on_DeletePaletteDialog_palette_deleted"]
[connection signal="palette_changed" from="EditPaletteDialog" to="." method="_on_EditPaletteDialog_palette_changed"]
[connection signal="constant_pressure_changed" from="SettingsDialog" to="InfiniteCanvas" method="_on_SettingsDialog_constant_pressure_changed"]
3 changes: 1 addition & 2 deletions lorien/UI/Dialogs/SettingsDialog.gd
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,7 @@ func _on_UIScale_value_changed(value: float):
func _on_DefaultToolPressure_value_changed(value):
Settings.set_value(Settings.GENERAL_TOOL_PRESSURE, value)


# -------------------------------------------------------------------------------------------------
func _on_ConstantPressure_toggled(button_pressed: bool):
Settings.set_value(Settings.GENERAL_CONSTANT_PRESSURE, button_pressed)
emit_signal("constant_pressure_changed", button_pressed)
pass # Replace with function body.
32 changes: 21 additions & 11 deletions lorien/UI/Themes/theme_dark.tres
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
[gd_resource type="Theme" load_steps=31 format=2]
[gd_resource type="Theme" load_steps=38 format=2]

[ext_resource path="res://Assets/Fonts/font_big_bold.tres" type="DynamicFont" id=1]
[ext_resource path="res://Assets/Fonts/font_normal.tres" type="DynamicFont" id=2]
[ext_resource path="res://Assets/Textures/slider_knob_white.png" type="Texture" id=3]
[ext_resource path="res://Assets/Icons/close.png" type="Texture" id=4]
[ext_resource path="res://Assets/Textures/switch_off.png" type="Texture" id=5]
[ext_resource path="res://Assets/Textures/switch_on.png" type="Texture" id=6]
[ext_resource path="res://Assets/Textures/scrollbar_hl.png" type="Texture" id=7]
[ext_resource path="res://Assets/Textures/scrollbar.png" type="Texture" id=8]
[ext_resource path="res://Assets/Textures/scrollbar_bg.png" type="Texture" id=9]

[sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 6.0
Expand Down Expand Up @@ -43,20 +50,23 @@ corner_radius_bottom_right = 1
corner_radius_bottom_left = 1

[sub_resource type="StyleBoxTexture" id=26]
texture = ExtResource( 8 )
region_rect = Rect2( 0, 0, 12, 12 )
margin_left = 6.0
margin_right = 6.0
expand_margin_left = 2.0
expand_margin_right = 2.0

[sub_resource type="StyleBoxTexture" id=28]
texture = ExtResource( 7 )
region_rect = Rect2( 0, 0, 12, 12 )
margin_left = 6.0
margin_right = 6.0
expand_margin_left = 2.0
expand_margin_right = 2.0

[sub_resource type="StyleBoxTexture" id=29]
texture = ExtResource( 9 )
region_rect = Rect2( 0, 0, 12, 12 )
margin_left = 4.0
margin_right = 4.0
Expand Down Expand Up @@ -230,10 +240,10 @@ CheckButton/colors/font_color_pressed = Color( 1, 1, 1, 1 )
CheckButton/constants/check_vadjust = 0
CheckButton/constants/hseparation = 4
CheckButton/fonts/font = ExtResource( 2 )
CheckButton/icons/off = null
CheckButton/icons/off_disabled = null
CheckButton/icons/on = null
CheckButton/icons/on_disabled = null
CheckButton/icons/off = ExtResource( 5 )
CheckButton/icons/off_disabled = ExtResource( 5 )
CheckButton/icons/on = ExtResource( 6 )
CheckButton/icons/on_disabled = ExtResource( 6 )
CheckButton/styles/disabled = null
CheckButton/styles/focus = null
CheckButton/styles/hover = null
Expand Down Expand Up @@ -269,10 +279,10 @@ HScrollBar/styles/grabber_pressed = SubResource( 28 )
HScrollBar/styles/scroll = SubResource( 29 )
HSeparator/constants/separation = 4
HSeparator/styles/separator = SubResource( 5 )
HSlider/icons/grabber = null
HSlider/icons/grabber_disabled = null
HSlider/icons/grabber_highlight = null
HSlider/icons/tick = null
HSlider/icons/grabber = ExtResource( 3 )
HSlider/icons/grabber_disabled = ExtResource( 3 )
HSlider/icons/grabber_highlight = ExtResource( 3 )
HSlider/icons/tick = ExtResource( 3 )
HSlider/styles/grabber_area = SubResource( 6 )
HSlider/styles/grabber_area_highlight = SubResource( 6 )
HSlider/styles/slider = SubResource( 7 )
Expand Down Expand Up @@ -396,6 +406,6 @@ WindowDialog/constants/close_v_ofs = 18
WindowDialog/constants/scaleborder_size = 4
WindowDialog/constants/title_height = 20
WindowDialog/fonts/title_font = ExtResource( 1 )
WindowDialog/icons/close = null
WindowDialog/icons/close_highlight = null
WindowDialog/icons/close = ExtResource( 4 )
WindowDialog/icons/close_highlight = ExtResource( 4 )
WindowDialog/styles/panel = SubResource( 23 )

0 comments on commit 3f409c8

Please sign in to comment.