1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

An asterisk is added to the tab name if there are changes

The window title also changes when switching tabs. And yes, "has_changed_changed" is a stupid method name, I'll find another one sometime later.
This commit is contained in:
OverloadedOrama 2020-06-05 20:15:40 +03:00
parent 6d87901056
commit 9ffce37c0b
5 changed files with 22 additions and 6 deletions

View file

@ -472,7 +472,7 @@ func clear_frames() -> void:
play_forward.pressed = false
animation_timer.stop()
self.window_title = "(" + tr("untitled") + ") - Pixelorama " + Global.current_version
self.window_title = tr("untitled") + " - Pixelorama " + Global.current_version
OpenSave.current_save_path = ""
control.get_node("ExportDialog").was_exported = false
control.file_menu.set_item_text(3, tr("Save..."))

View file

@ -277,6 +277,7 @@ func save_pxo_file(path : String, autosave : bool) -> void:
Global.notification_label("File saved")
if backup_save_path == "":
Global.current_project.name = path.get_file()
Global.window_title = path.get_file() + " - Pixelorama " + Global.current_version
else:

View file

@ -2,11 +2,11 @@ class_name Project extends Reference
# A class for project properties.
var name := ""
var name := "" setget name_changed
var size : Vector2
var undo_redo : UndoRedo
var undos := 0 # The number of times we added undo properties
var has_changed := false
var has_changed := false setget has_changed_changed
var frames := [] setget frames_changed # Array of Frames (that contain Cels)
var layers := [] setget layers_changed # Array of Layers
var current_frame := 0 setget frame_changed
@ -117,6 +117,14 @@ func change_project() -> void:
Global.canvas.update()
Global.transparent_checker._ready()
Global.window_title = "%s - Pixelorama %s" % [name, Global.current_version]
if has_changed:
Global.window_title = Global.window_title + "(*)"
func name_changed(value : String) -> void:
name = value
Global.tabs.set_tab_title(Global.tabs.current_tab, name)
func frames_changed(value : Array) -> void:
@ -305,3 +313,11 @@ func set_timeline_first_and_last_frames() -> void:
if current_frame + 1 >= tag.from && current_frame + 1 <= tag.to:
Global.animation_timeline.first_frame = tag.from - 1
Global.animation_timeline.last_frame = min(frames.size() - 1, tag.to - 1)
func has_changed_changed(value : bool) -> void:
has_changed = value
if value:
Global.tabs.set_tab_title(Global.tabs.current_tab, name + "(*)")
else:
Global.tabs.set_tab_title(Global.tabs.current_tab, name)

View file

@ -18,7 +18,7 @@ func _ready() -> void:
setup_image_menu()
setup_help_menu()
Global.window_title = "(" + tr("untitled") + ") - Pixelorama " + Global.current_version
Global.window_title = tr("untitled") + " - Pixelorama " + Global.current_version
Global.current_project.layers[0].name = tr("Layer") + " 0"
Global.layers_container.get_child(0).label.text = Global.current_project.layers[0].name
@ -225,9 +225,7 @@ func handle_loading_files(files : PoolStringArray) -> void:
if file.get_extension().to_lower() == "pxo":
_on_OpenSprite_file_selected(file)
else:
$ImportSprites.new_frame = false
$ImportSprites._on_ImportSprites_files_selected([file])
$ImportSprites.new_frame = true
func _notification(what : int) -> void:

View file

@ -24,6 +24,7 @@ margin_bottom = 312.0
margin_right = 161.0
margin_bottom = 304.0
mouse_default_cursor_shape = 2
disabled = true
text = "Import as new frame"
[node name="ImportSpritesheet" type="CheckBox" parent="HBoxContainer2"]