1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +00:00

Merge pull request #179 from luiq54/unsavedDialog

Add WarningDialog for unsaved Image before creating a new Image
This commit is contained in:
Manolis Papadeas 2020-04-02 14:45:58 +03:00 committed by GitHub
commit fdf00171af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -1163,6 +1163,12 @@ visible = false
[node name="AboutDialog" parent="." instance=ExtResource( 34 )]
[node name="UnsavedCanvasDialog" type="ConfirmationDialog" parent="."]
margin_right = 200.0
margin_bottom = 70.0
window_title = "Unsaved Image"
dialog_text = "Are you sure want to proceed?"
[node name="QuitDialog" type="ConfirmationDialog" parent="."]
margin_right = 200.0
margin_bottom = 70.0
@ -1252,6 +1258,8 @@ visible = false
[connection signal="popup_hide" from="PreferencesDialog" to="." method="_can_draw_true"]
[connection signal="popup_hide" from="OutlineDialog" to="." method="_can_draw_true"]
[connection signal="popup_hide" from="AboutDialog" to="." method="_can_draw_true"]
[connection signal="confirmed" from="UnsavedCanvasDialog" to="." method="_on_UnsavedCanvasDialog_confirmed"]
[connection signal="popup_hide" from="UnsavedCanvasDialog" to="." method="_can_draw_true"]
[connection signal="confirmed" from="QuitDialog" to="." method="_on_QuitDialog_confirmed"]
[connection signal="popup_hide" from="QuitDialog" to="." method="_can_draw_true"]
[connection signal="confirmed" from="QuitAndSaveDialog" to="." method="_on_QuitDialog_confirmed"]

View file

@ -216,6 +216,9 @@ func _notification(what : int) -> void:
func file_menu_id_pressed(id : int) -> void:
match id:
0: # New
if(!Global.saved):
$UnsavedCanvasDialog.popup_centered()
else:
$CreateNewImage.popup_centered()
Global.can_draw = false
1: # Open
@ -824,3 +827,6 @@ func _on_QuitDialog_confirmed() -> void:
modulate = Color(0.5, 0.5, 0.5)
get_tree().quit()
func _on_UnsavedCanvasDialog_confirmed() -> void :
$CreateNewImage.popup_centered()