diff --git a/Translations/Translations.pot b/Translations/Translations.pot index c0eb0b6b2..75155db3d 100644 --- a/Translations/Translations.pot +++ b/Translations/Translations.pot @@ -130,6 +130,13 @@ msgstr "" msgid "Delete" msgstr "" +msgid "Delete Permanently" +msgstr "" + +#. When you move something to recycle bin +msgid "Move to Trash" +msgstr "" + msgid "New Brush" msgstr "" diff --git a/src/Autoload/Palettes.gd b/src/Autoload/Palettes.gd index befd57fb6..6e24842bb 100644 --- a/src/Autoload/Palettes.gd +++ b/src/Autoload/Palettes.gd @@ -213,13 +213,16 @@ func current_palette_edit(palette_name: String, comment: String, width: int, hei palettes[palette_path] = current_palette -func _delete_palette(path: String) -> void: - DirAccess.open(path).remove(path) +func _delete_palette(path: String, permanent := true) -> void: + if permanent: + DirAccess.remove_absolute(path) + else: + OS.move_to_trash(path) palettes.erase(path) -func current_palete_delete() -> void: - _delete_palette(current_palette.resource_path) +func current_palete_delete(permanent := true) -> void: + _delete_palette(current_palette.resource_path, permanent) if palettes.size() > 0: select_palette(palettes.keys()[0]) diff --git a/src/Palette/CreatePaletteDialog.tscn b/src/Palette/CreatePaletteDialog.tscn index 939718f33..d28afc9cb 100644 --- a/src/Palette/CreatePaletteDialog.tscn +++ b/src/Palette/CreatePaletteDialog.tscn @@ -3,16 +3,18 @@ [ext_resource type="Script" path="res://src/Palette/CreatePaletteDialog.gd" id="1"] [node name="CreatePaletteDialog" type="ConfirmationDialog"] +title = "Create a new palette" +size = Vector2i(325, 437) script = ExtResource("1") [node name="VBoxContainer" type="VBoxContainer" parent="."] anchors_preset = -1 anchor_left = 0.000793701 anchor_right = 0.000793701 -offset_left = 7.76189 +offset_left = 7.74205 offset_top = 8.0 -offset_right = 291.762 -offset_bottom = 401.0 +offset_right = 316.742 +offset_bottom = 388.0 [node name="PaletteMetadata" type="GridContainer" parent="VBoxContainer"] layout_mode = 2 @@ -118,12 +120,18 @@ layout_mode = 2 size_flags_vertical = 7 theme_override_colors/font_color = Color(1, 0.603922, 0.603922, 1) text = "Palette with the same name and path already exists!" +horizontal_alignment = 1 +vertical_alignment = 2 +autowrap_mode = 3 [node name="EnterNameWarning" type="Label" parent="VBoxContainer"] layout_mode = 2 size_flags_vertical = 7 theme_override_colors/font_color = Color(1, 0.603922, 0.603922, 1) text = "Palette name is required!" +horizontal_alignment = 1 +vertical_alignment = 2 +autowrap_mode = 3 [connection signal="confirmed" from="." to="." method="_on_CreatePaletteDialog_confirmed"] [connection signal="visibility_changed" from="." to="." method="_on_CreatePaletteDialog_visibility_changed"] diff --git a/src/Palette/EditPaletteDialog.gd b/src/Palette/EditPaletteDialog.gd index 110df19b5..93f132246 100644 --- a/src/Palette/EditPaletteDialog.gd +++ b/src/Palette/EditPaletteDialog.gd @@ -5,6 +5,7 @@ signal saved(name, comment, width, height) signal deleted const DELETE_ACTION := "delete" +const BIN_ACTION := "trash" # Keeps original size of edited palette var origin_width := 0 @@ -16,15 +17,17 @@ var old_name := "" @onready var comment_input := $VBoxContainer/PaletteMetadata/Comment @onready var width_input := $VBoxContainer/PaletteMetadata/Width @onready var height_input := $VBoxContainer/PaletteMetadata/Height -@onready var path_input := $VBoxContainer/PaletteMetadata/Path3D +@onready var path_input := $VBoxContainer/PaletteMetadata/Path @onready var size_reduced_warning := $VBoxContainer/SizeReducedWarning @onready var already_exists_warning := $VBoxContainer/AlreadyExistsWarning +@onready var delete_confirmation := $DeleteConfirmation func _ready() -> void: # Add delete button to edit palette dialog add_button(tr("Delete"), false, DELETE_ACTION) + delete_confirmation.add_button(tr("Move to Trash"), false, BIN_ACTION) func open(current_palette: Palette) -> void: @@ -78,8 +81,20 @@ func _on_EditPaletteDialog_confirmed() -> void: func _on_EditPaletteDialog_custom_action(action: String) -> void: if action == DELETE_ACTION: + delete_confirmation.popup_centered() + + +func _on_delete_confirmation_confirmed() -> void: + deleted.emit(true) + delete_confirmation.hide() + hide() + + +func _on_delete_confirmation_custom_action(action: StringName) -> void: + if action == BIN_ACTION: + deleted.emit(false) + delete_confirmation.hide() hide() - deleted.emit(deleted) func _on_size_value_changed(_value): diff --git a/src/Palette/EditPaletteDialog.tscn b/src/Palette/EditPaletteDialog.tscn index 76864a170..2aecddf76 100644 --- a/src/Palette/EditPaletteDialog.tscn +++ b/src/Palette/EditPaletteDialog.tscn @@ -3,6 +3,8 @@ [ext_resource type="Script" path="res://src/Palette/EditPaletteDialog.gd" id="1"] [node name="EditPaletteDialog" type="ConfirmationDialog"] +title = "Edit Palette" +size = Vector2i(409, 559) script = ExtResource("1") [node name="VBoxContainer" type="VBoxContainer" parent="."] @@ -12,10 +14,11 @@ anchor_bottom = 1.0 offset_left = 8.0 offset_top = 8.0 offset_right = -8.0 -offset_bottom = -36.0 +offset_bottom = -49.0 [node name="PaletteMetadata" type="GridContainer" parent="VBoxContainer"] layout_mode = 2 +size_flags_vertical = 3 columns = 2 [node name="NameLabel" type="Label" parent="VBoxContainer/PaletteMetadata"] @@ -31,12 +34,14 @@ size_flags_horizontal = 3 [node name="CommentLabel" type="Label" parent="VBoxContainer/PaletteMetadata"] custom_minimum_size = Vector2(50, 0) layout_mode = 2 +size_flags_vertical = 0 text = "Comment:" [node name="Comment" type="TextEdit" parent="VBoxContainer/PaletteMetadata"] custom_minimum_size = Vector2(0, 75) layout_mode = 2 size_flags_horizontal = 3 +size_flags_vertical = 3 [node name="WidthLabel" type="Label" parent="VBoxContainer/PaletteMetadata"] layout_mode = 2 @@ -64,9 +69,9 @@ value = 1.0 [node name="PathLabel" type="Label" parent="VBoxContainer/PaletteMetadata"] layout_mode = 2 -text = "Path3D:" +text = "Path:" -[node name="Path3D" type="TextEdit" parent="VBoxContainer/PaletteMetadata"] +[node name="Path" type="TextEdit" parent="VBoxContainer/PaletteMetadata"] custom_minimum_size = Vector2(0, 50) layout_mode = 2 size_flags_horizontal = 3 @@ -75,11 +80,35 @@ size_flags_horizontal = 3 layout_mode = 2 theme_override_colors/font_color = Color(1, 0.603922, 0.603922, 1) text = "Reducing palette size will reset positions of colors. Colors that don't fit in new palette size will be lost!" +horizontal_alignment = 1 +vertical_alignment = 2 +autowrap_mode = 3 [node name="AlreadyExistsWarning" type="Label" parent="VBoxContainer"] layout_mode = 2 theme_override_colors/font_color = Color(1, 0.603922, 0.603922, 1) text = "Palette with the same name and path already exists!" +horizontal_alignment = 1 +vertical_alignment = 1 +autowrap_mode = 3 + +[node name="DeleteConfirmation" type="ConfirmationDialog" parent="."] +size = Vector2i(445, 105) +ok_button_text = "Delete Permanently" + +[node name="Label" type="Label" parent="DeleteConfirmation"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 8.0 +offset_top = 8.0 +offset_right = -8.0 +offset_bottom = -49.0 +grow_horizontal = 2 +grow_vertical = 2 +text = "Delete Palette?" +horizontal_alignment = 1 +vertical_alignment = 1 [connection signal="confirmed" from="." to="." method="_on_EditPaletteDialog_confirmed"] [connection signal="custom_action" from="." to="." method="_on_EditPaletteDialog_custom_action"] @@ -87,3 +116,5 @@ text = "Palette with the same name and path already exists!" [connection signal="text_changed" from="VBoxContainer/PaletteMetadata/Name" to="." method="_on_Name_text_changed"] [connection signal="value_changed" from="VBoxContainer/PaletteMetadata/Width" to="." method="_on_size_value_changed"] [connection signal="value_changed" from="VBoxContainer/PaletteMetadata/Height" to="." method="_on_size_value_changed"] +[connection signal="confirmed" from="DeleteConfirmation" to="." method="_on_delete_confirmation_confirmed"] +[connection signal="custom_action" from="DeleteConfirmation" to="." method="_on_delete_confirmation_custom_action"] diff --git a/src/Palette/PalettePanel.gd b/src/Palette/PalettePanel.gd index 97150333c..bf5eb3189 100644 --- a/src/Palette/PalettePanel.gd +++ b/src/Palette/PalettePanel.gd @@ -215,8 +215,8 @@ func _on_HiddenColorPickerButton_popup_closed(): Palettes.current_palette_set_color(edited_swatch_index, edited_swatch_color) -func _on_EditPaletteDialog_deleted() -> void: - Palettes.current_palete_delete() +func _on_EditPaletteDialog_deleted(permanent: bool) -> void: + Palettes.current_palete_delete(permanent) setup_palettes_selector() redraw_current_palette() diff --git a/src/UI/ReferenceImages/ReferenceImageButton.gd b/src/UI/ReferenceImages/ReferenceImageButton.gd index 8b56cbb9d..aa789c68f 100644 --- a/src/UI/ReferenceImages/ReferenceImageButton.gd +++ b/src/UI/ReferenceImages/ReferenceImageButton.gd @@ -7,11 +7,11 @@ var _ignore_spinbox_changes := false func _ready(): if OS.get_name() == "Web": - $Interior/PathHeader/Path3D.visible = false + $Interior/PathHeader/Path.visible = false $Interior/PathHeader/PathHTML.text = element.image_path else: $Interior/PathHeader/PathHTML.visible = false - $Interior/PathHeader/Path3D.text = element.image_path + $Interior/PathHeader/Path.text = element.image_path if !element.texture: $Interior/PreviewAndOptions/PreviewPanel/Warning.text = "Image not found!" @@ -79,7 +79,7 @@ func _on_Opacity_value_changed(value: float): func _on_Path_pressed() -> void: - OS.shell_open($Interior/PathHeader/Path3D.text.get_base_dir()) + OS.shell_open($Interior/PathHeader/Path.text.get_base_dir()) func _on_Silhouette_toggled(button_pressed: bool) -> void: diff --git a/src/UI/ReferenceImages/ReferenceImageButton.tscn b/src/UI/ReferenceImages/ReferenceImageButton.tscn index f2336ab33..9ffa9d2f8 100644 --- a/src/UI/ReferenceImages/ReferenceImageButton.tscn +++ b/src/UI/ReferenceImages/ReferenceImageButton.tscn @@ -19,7 +19,7 @@ layout_mode = 2 layout_mode = 2 theme_override_constants/separation = 0 -[node name="Path3D" type="LinkButton" parent="Interior/PathHeader"] +[node name="Path" type="LinkButton" parent="Interior/PathHeader"] modulate = Color(0.552941, 1, 0.298039, 1) layout_mode = 2 size_flags_horizontal = 3 @@ -117,7 +117,7 @@ layout_mode = 2 theme_override_colors/font_color = Color(1, 0.266667, 0.266667, 1) text = "Remove" -[connection signal="pressed" from="Interior/PathHeader/Path3D" to="." method="_on_Path_pressed"] +[connection signal="pressed" from="Interior/PathHeader/Path" to="." method="_on_Path_pressed"] [connection signal="value_changed" from="Interior/PreviewAndOptions/Options/Position/X" to="." method="_on_X_value_changed"] [connection signal="value_changed" from="Interior/PreviewAndOptions/Options/Position/Y" to="." method="_on_Y_value_changed"] [connection signal="value_changed" from="Interior/PreviewAndOptions/Options/Scale" to="." method="_on_Scale_value_changed"]