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

Saved is false after any action and is true at the beginning

Also hide QuitDialog after saving
This commit is contained in:
OverloadedOrama 2020-02-22 17:14:32 +02:00
parent 3ea3bd7b40
commit 52fa460876
2 changed files with 11 additions and 8 deletions

View file

@ -8,8 +8,8 @@ var config_cache := ConfigFile.new()
# warning-ignore:unused_class_variable
var loaded_locales : Array
var undo_redo : UndoRedo
var undos := 0 #The number of times we added undo properties
var saved := false #Checks if the user has saved
var undos := 0 # The number of times we added undo properties
var saved := true # Checks if the user has saved
# Canvas related stuff
var current_frame := 0 setget frame_changed
@ -426,6 +426,7 @@ func undo(_canvases : Array, layer_index : int = -1) -> void:
canvas_parent.move_child(_canvases[0], _canvases[0].frame)
canvas.update()
saved = false
notification_label("Undo: %s" % action_name)
@ -466,6 +467,7 @@ func redo(_canvases : Array, layer_index : int = -1) -> void:
canvas_parent.move_child(_canvases[0], _canvases[0].frame)
canvas.update()
saved = false
if control.redone:
notification_label("Redo: %s" % action_name)

View file

@ -167,10 +167,10 @@ func _ready() -> void:
Global.canvas.generate_layer_panels()
Import.import_brushes("Brushes")
$MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorPickersCenter/ColorPickersHorizontal/LeftColorPickerButton.get_picker().presets_visible = false
$MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/ColorButtonsVertical/ColorPickersCenter/ColorPickersHorizontal/RightColorPickerButton.get_picker().presets_visible = false
if not Global.config_cache.has_section_key("preferences", "startup"):
Global.config_cache.set_value("preferences", "startup", true)
if Global.config_cache.get_value("preferences", "startup"):
@ -476,14 +476,14 @@ func _on_OpenSprite_file_selected(path : String) -> void:
brush_line = file.get_line()
file.close()
current_save_path = path
$SaveSprite.current_path = path
$ExportSprites.current_export_path = path.trim_suffix(".pxo") + ".png"
$ExportSprites.current_path = $ExportSprites.current_export_path
file_menu.set_item_text(2, tr("Save") + " %s" % path.get_file())
file_menu.set_item_text(5, tr("Export") + " %s" % $ExportSprites.current_path.get_file())
OS.set_window_title(path.get_file() + " - Pixelorama")
@ -861,11 +861,12 @@ func _on_QuitDialog_confirmed() -> void:
get_tree().quit()
func _on_QuitDialog_custom_action(action):
func _on_QuitDialog_custom_action(action : String) -> void:
if action == "Save":
$SaveSprite.popup_centered()
$QuitDialog.hide()
Global.can_draw = false
func _on_QuitDialog_popup_hide():
func _on_QuitDialog_popup_hide() -> void:
if !Global.saved:
SaveButton.queue_free()