mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-07 19:09:50 +00:00
* gdformat . * Lint code - Part 1 * Format code - Part 2 * Lint code - Part 2 Trying to fix the max allowed line length errors * Add normal_map_invert_y to the image .import files Because of Godot 3.4 * Do not call private methods outside of the script's scope Lint code - Part 3 * Format code - Part 3 * Fixed more line length exceeded errors - Lint code Part 3 * Export array of licenses - Lint code part 4 * Clean hint_tooltip code from Global Removes a lot of lines of code * Create static-checks.yml * Fix FreeType's license
56 lines
1.8 KiB
GDScript
56 lines
1.8 KiB
GDScript
extends Tabs
|
|
|
|
onready var unsaved_changes_dialog: ConfirmationDialog = Global.control.find_node(
|
|
"UnsavedCanvasDialog"
|
|
)
|
|
|
|
|
|
func _on_Tabs_tab_changed(tab: int) -> void:
|
|
Global.current_project_index = tab
|
|
|
|
|
|
func _on_Tabs_tab_close(tab: int) -> void:
|
|
if Global.projects.size() == 1:
|
|
return
|
|
|
|
if Global.projects[tab].has_changed:
|
|
if !unsaved_changes_dialog.is_connected("confirmed", self, "delete_tab"):
|
|
unsaved_changes_dialog.connect("confirmed", self, "delete_tab", [tab])
|
|
unsaved_changes_dialog.popup_centered()
|
|
Global.dialog_open(true)
|
|
else:
|
|
delete_tab(tab)
|
|
|
|
|
|
func _on_Tabs_reposition_active_tab_request(idx_to: int) -> void:
|
|
var temp = Global.projects[Global.current_project_index]
|
|
Global.projects.erase(temp)
|
|
Global.projects.insert(idx_to, temp)
|
|
|
|
# Change save paths
|
|
var temp_save_path = OpenSave.current_save_paths[Global.current_project_index]
|
|
OpenSave.current_save_paths[Global.current_project_index] = OpenSave.current_save_paths[idx_to]
|
|
OpenSave.current_save_paths[idx_to] = temp_save_path
|
|
var temp_backup_path = OpenSave.backup_save_paths[Global.current_project_index]
|
|
OpenSave.backup_save_paths[Global.current_project_index] = OpenSave.backup_save_paths[idx_to]
|
|
OpenSave.backup_save_paths[idx_to] = temp_backup_path
|
|
|
|
|
|
func delete_tab(tab: int) -> void:
|
|
remove_tab(tab)
|
|
Global.projects[tab].undo_redo.free()
|
|
OpenSave.remove_backup(tab)
|
|
OpenSave.current_save_paths.remove(tab)
|
|
OpenSave.backup_save_paths.remove(tab)
|
|
Global.projects.remove(tab)
|
|
if Global.current_project_index == tab:
|
|
if tab > 0:
|
|
Global.current_project_index -= 1
|
|
else:
|
|
Global.current_project_index = 0
|
|
else:
|
|
if tab < Global.current_project_index:
|
|
Global.current_project_index -= 1
|
|
if unsaved_changes_dialog.is_connected("confirmed", self, "delete_tab"):
|
|
unsaved_changes_dialog.disconnect("confirmed", self, "delete_tab")
|