diff --git a/CHANGELOG.md b/CHANGELOG.md index b1c9efa86..f513d0414 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Laurenz Reinthaler (Schweini07), PinyaColada - Buttons for moving the current frame left or right. ([#344](https://github.com/Orama-Interactive/Pixelorama/pull/344)) - Creating palettes from sprites has been enhanced - you can now choose if you want to get colors from the selection, current cel, entire frame or all frames, and if you want the colors to have an alpha component. - A new "Cut" option in the Edit menu or by pressing `Ctrl-X`. It cuts (deletes & copies) the selection, and you can later paste it. ([#345](https://github.com/Orama-Interactive/Pixelorama/pull/345)) +- Added a warning dialog when clicking the remove palette button, to prevent accidental palette deletions. - A new purple theme. ### Changed diff --git a/Translations/Translations.pot b/Translations/Translations.pot index af4ecdd41..87f0762f3 100644 --- a/Translations/Translations.pot +++ b/Translations/Translations.pot @@ -1408,6 +1408,9 @@ msgstr "" msgid "Remove currently selected palette" msgstr "" +msgid "Are you sure you want to remove this palette? (Cannot be undone)" +msgstr "" + msgid "You can't remove more palettes!" msgstr "" diff --git a/src/Palette/PaletteContainer.gd b/src/Palette/PaletteContainer.gd index 3df3a44e7..c2058614f 100644 --- a/src/Palette/PaletteContainer.gd +++ b/src/Palette/PaletteContainer.gd @@ -9,6 +9,7 @@ var current_palette = "Default" var from_palette : Palette onready var palette_from_sprite_dialog = $"../../../../PaletteFromSpriteDialog" +onready var remove_palette_warning = $"../../../../RemovePaletteWarning" func _ready() -> void: @@ -411,7 +412,8 @@ func _on_NewPaletteDialog_popup_hide() -> void: func _on_RemovePalette_pressed() -> void: - remove_palette(current_palette) + remove_palette_warning.popup_centered() + Global.dialog_open(true) func _on_PaletteFromSpriteDialog_confirmed() -> void: @@ -420,3 +422,11 @@ func _on_PaletteFromSpriteDialog_confirmed() -> void: func _on_PaletteFromSpriteDialog_popup_hide() -> void: Global.dialog_open(false) + + +func _on_RemovePaletteWarning_confirmed() -> void: + remove_palette(current_palette) + + +func _on_RemovePaletteWarning_popup_hide() -> void: + Global.dialog_open(false) diff --git a/src/Palette/PalettePanelContainer.tscn b/src/Palette/PalettePanelContainer.tscn index 376375406..85feeb56e 100644 --- a/src/Palette/PalettePanelContainer.tscn +++ b/src/Palette/PalettePanelContainer.tscn @@ -244,6 +244,11 @@ mouse_default_cursor_shape = 2 text = "Current cel" items = [ "Current cel", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null ] selected = 0 + +[node name="RemovePaletteWarning" type="ConfirmationDialog" parent="."] +margin_right = 200.0 +margin_bottom = 70.0 +dialog_text = "Are you sure you want to remove this palette? (Cannot be undone)" [connection signal="pressed" from="PaletteVBoxContainer/CenterContainer/PaletteButtons/AddPalette" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_AddPalette_pressed"] [connection signal="pressed" from="PaletteVBoxContainer/CenterContainer/PaletteButtons/EditPalette" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="on_edit_palette"] [connection signal="pressed" from="PaletteVBoxContainer/CenterContainer/PaletteButtons/RemovePalette" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_RemovePalette_pressed"] @@ -254,3 +259,5 @@ selected = 0 [connection signal="popup_hide" from="PaletteImportFileDialog" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_NewPaletteDialog_popup_hide"] [connection signal="confirmed" from="PaletteFromSpriteDialog" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_PaletteFromSpriteDialog_confirmed"] [connection signal="popup_hide" from="PaletteFromSpriteDialog" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_PaletteFromSpriteDialog_popup_hide"] +[connection signal="confirmed" from="RemovePaletteWarning" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_RemovePaletteWarning_confirmed"] +[connection signal="popup_hide" from="RemovePaletteWarning" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_RemovePaletteWarning_popup_hide"]