mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-30 23:19:49 +00:00
Added quit dialog
Works when quitting from the menu, when quitting by pressing the close ("X") button and on Alt-F4.
This commit is contained in:
parent
f63d0105d3
commit
c35a8a6854
12
Main.tscn
12
Main.tscn
|
@ -1237,6 +1237,7 @@ margin_right = 200.0
|
||||||
margin_bottom = 70.0
|
margin_bottom = 70.0
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="CreateNewImage"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="CreateNewImage"]
|
||||||
|
editor/display_folded = true
|
||||||
margin_left = 8.0
|
margin_left = 8.0
|
||||||
margin_top = 8.0
|
margin_top = 8.0
|
||||||
margin_right = 192.0
|
margin_right = 192.0
|
||||||
|
@ -1365,6 +1366,7 @@ margin_right = 200.0
|
||||||
margin_bottom = 114.0
|
margin_bottom = 114.0
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="ScaleImage"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="ScaleImage"]
|
||||||
|
editor/display_folded = true
|
||||||
margin_left = 8.0
|
margin_left = 8.0
|
||||||
margin_top = 8.0
|
margin_top = 8.0
|
||||||
margin_right = 192.0
|
margin_right = 192.0
|
||||||
|
@ -1466,11 +1468,13 @@ Developed by Orama Interactive
|
||||||
align = 1
|
align = 1
|
||||||
|
|
||||||
[node name="Links" type="CenterContainer" parent="AboutDialog/AboutUI"]
|
[node name="Links" type="CenterContainer" parent="AboutDialog/AboutUI"]
|
||||||
|
editor/display_folded = true
|
||||||
margin_top = 87.0
|
margin_top = 87.0
|
||||||
margin_right = 268.0
|
margin_right = 268.0
|
||||||
margin_bottom = 107.0
|
margin_bottom = 107.0
|
||||||
|
|
||||||
[node name="LinkButtons" type="HBoxContainer" parent="AboutDialog/AboutUI/Links"]
|
[node name="LinkButtons" type="HBoxContainer" parent="AboutDialog/AboutUI/Links"]
|
||||||
|
editor/display_folded = true
|
||||||
margin_left = 22.0
|
margin_left = 22.0
|
||||||
margin_right = 246.0
|
margin_right = 246.0
|
||||||
margin_bottom = 20.0
|
margin_bottom = 20.0
|
||||||
|
@ -1500,6 +1504,12 @@ text = "
|
||||||
Copyright 2019 - Orama Interactive"
|
Copyright 2019 - Orama Interactive"
|
||||||
align = 1
|
align = 1
|
||||||
|
|
||||||
|
[node name="QuitDialog" type="ConfirmationDialog" parent="."]
|
||||||
|
margin_right = 200.0
|
||||||
|
margin_bottom = 70.0
|
||||||
|
resizable = true
|
||||||
|
dialog_text = "Are you sure you want to exit Pixelorama?"
|
||||||
|
|
||||||
[node name="AnimationTimer" type="Timer" parent="."]
|
[node name="AnimationTimer" type="Timer" parent="."]
|
||||||
[connection signal="color_changed" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/ColorPickersCenter/ColorPickersHorizontal/LeftColorPickerButton" to="." method="_on_LeftColorPickerButton_color_changed"]
|
[connection signal="color_changed" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/ColorPickersCenter/ColorPickersHorizontal/LeftColorPickerButton" to="." method="_on_LeftColorPickerButton_color_changed"]
|
||||||
[connection signal="popup_closed" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/ColorPickersCenter/ColorPickersHorizontal/LeftColorPickerButton" to="." method="_can_draw_true"]
|
[connection signal="popup_closed" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/ColorPickersCenter/ColorPickersHorizontal/LeftColorPickerButton" to="." method="_can_draw_true"]
|
||||||
|
@ -1568,4 +1578,6 @@ align = 1
|
||||||
[connection signal="pressed" from="AboutDialog/AboutUI/Links/LinkButtons/Website" to="AboutDialog" method="_on_Website_pressed"]
|
[connection signal="pressed" from="AboutDialog/AboutUI/Links/LinkButtons/Website" to="AboutDialog" method="_on_Website_pressed"]
|
||||||
[connection signal="pressed" from="AboutDialog/AboutUI/Links/LinkButtons/GitHub" to="AboutDialog" method="_on_GitHub_pressed"]
|
[connection signal="pressed" from="AboutDialog/AboutUI/Links/LinkButtons/GitHub" to="AboutDialog" method="_on_GitHub_pressed"]
|
||||||
[connection signal="pressed" from="AboutDialog/AboutUI/Links/LinkButtons/Donate" to="AboutDialog" method="_on_Donate_pressed"]
|
[connection signal="pressed" from="AboutDialog/AboutUI/Links/LinkButtons/Donate" to="AboutDialog" method="_on_Donate_pressed"]
|
||||||
|
[connection signal="confirmed" from="QuitDialog" to="." method="_on_QuitDialog_confirmed"]
|
||||||
|
[connection signal="popup_hide" from="QuitDialog" to="." method="_can_draw_true"]
|
||||||
[connection signal="timeout" from="AnimationTimer" to="." method="_on_AnimationTimer_timeout"]
|
[connection signal="timeout" from="AnimationTimer" to="." method="_on_AnimationTimer_timeout"]
|
||||||
|
|
|
@ -17,6 +17,7 @@ var animation_forward := true
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
get_tree().set_auto_accept_quit(false)
|
||||||
OS.set_window_title("(untitled) - Pixelorama")
|
OS.set_window_title("(untitled) - Pixelorama")
|
||||||
# Set a minimum window size to prevent UI elements from collapsing on each other.
|
# Set a minimum window size to prevent UI elements from collapsing on each other.
|
||||||
# This property is only available in 3.2alpha or later, so use `set()` to fail gracefully if it doesn't exist.
|
# This property is only available in 3.2alpha or later, so use `set()` to fail gracefully if it doesn't exist.
|
||||||
|
@ -141,7 +142,7 @@ func _ready() -> void:
|
||||||
brushes_dir.list_dir_end()
|
brushes_dir.list_dir_end()
|
||||||
Global.brushes_from_files = Global.custom_brushes.size()
|
Global.brushes_from_files = Global.custom_brushes.size()
|
||||||
|
|
||||||
func _input(event):
|
func _input(event) -> void:
|
||||||
if event.is_action_pressed("toggle_fullscreen"):
|
if event.is_action_pressed("toggle_fullscreen"):
|
||||||
OS.window_fullscreen = !OS.window_fullscreen
|
OS.window_fullscreen = !OS.window_fullscreen
|
||||||
|
|
||||||
|
@ -152,6 +153,11 @@ func _input(event):
|
||||||
elif event.is_action_pressed(t[1]): #Shortcut for left button
|
elif event.is_action_pressed(t[1]): #Shortcut for left button
|
||||||
_on_Tool_pressed(t[0], false, true)
|
_on_Tool_pressed(t[0], false, true)
|
||||||
|
|
||||||
|
func _notification(what) -> void:
|
||||||
|
if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST: #Handle exit
|
||||||
|
$QuitDialog.popup_centered()
|
||||||
|
Global.can_draw = false
|
||||||
|
|
||||||
func file_menu_id_pressed(id : int) -> void:
|
func file_menu_id_pressed(id : int) -> void:
|
||||||
match id:
|
match id:
|
||||||
0: #New
|
0: #New
|
||||||
|
@ -184,7 +190,8 @@ func file_menu_id_pressed(id : int) -> void:
|
||||||
$ExportSprites.popup_centered()
|
$ExportSprites.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
7: #Quit
|
7: #Quit
|
||||||
get_tree().quit()
|
$QuitDialog.popup_centered()
|
||||||
|
Global.can_draw = false
|
||||||
|
|
||||||
func edit_menu_id_pressed(id : int) -> void:
|
func edit_menu_id_pressed(id : int) -> void:
|
||||||
match id:
|
match id:
|
||||||
|
@ -953,6 +960,9 @@ func _on_RightHorizontalMirroring_toggled(button_pressed) -> void:
|
||||||
func _on_RightVerticalMirroring_toggled(button_pressed) -> void:
|
func _on_RightVerticalMirroring_toggled(button_pressed) -> void:
|
||||||
Global.right_vertical_mirror = button_pressed
|
Global.right_vertical_mirror = button_pressed
|
||||||
|
|
||||||
|
func _on_QuitDialog_confirmed() -> void:
|
||||||
|
get_tree().quit()
|
||||||
|
|
||||||
func _exit_tree() -> void:
|
func _exit_tree() -> void:
|
||||||
# Save the window position and size to remember it when restarting the application
|
# Save the window position and size to remember it when restarting the application
|
||||||
config_cache.set_value("window", "screen", OS.current_screen)
|
config_cache.set_value("window", "screen", OS.current_screen)
|
||||||
|
@ -960,4 +970,3 @@ func _exit_tree() -> void:
|
||||||
config_cache.set_value("window", "position", OS.window_position)
|
config_cache.set_value("window", "position", OS.window_position)
|
||||||
config_cache.set_value("window", "size", OS.window_size)
|
config_cache.set_value("window", "size", OS.window_size)
|
||||||
config_cache.save("user://cache.ini")
|
config_cache.save("user://cache.ini")
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
extends Label
|
extends Label
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
var tween := $Tween
|
var tween := $Tween
|
||||||
|
|
Loading…
Reference in a new issue