2020-06-04 23:48:38 +00:00
|
|
|
extends Tabs
|
|
|
|
|
|
|
|
|
2020-06-05 14:50:52 +00:00
|
|
|
func _on_Tabs_tab_changed(tab : int) -> void:
|
2020-06-04 23:48:38 +00:00
|
|
|
Global.current_project_index = tab
|
|
|
|
|
|
|
|
|
2020-06-05 14:50:52 +00:00
|
|
|
func _on_Tabs_tab_close(tab : int) -> void:
|
2020-06-04 23:48:38 +00:00
|
|
|
if Global.projects.size() == 1:
|
|
|
|
return
|
|
|
|
|
2020-06-05 14:50:52 +00:00
|
|
|
if Global.current_project.has_changed:
|
|
|
|
if !Global.unsaved_changes_dialog.is_connected("confirmed", self, "delete_tab"):
|
|
|
|
Global.unsaved_changes_dialog.connect("confirmed", self, "delete_tab", [tab])
|
|
|
|
Global.unsaved_changes_dialog.popup_centered()
|
|
|
|
Global.dialog_open(true)
|
|
|
|
else:
|
|
|
|
delete_tab(tab)
|
2020-06-04 23:48:38 +00:00
|
|
|
|
2020-06-05 14:50:52 +00:00
|
|
|
|
|
|
|
func _on_Tabs_reposition_active_tab_request(idx_to : int) -> void:
|
2020-06-05 14:55:41 +00:00
|
|
|
var temp = Global.projects[Global.current_project_index]
|
|
|
|
Global.projects[Global.current_project_index] = Global.projects[idx_to]
|
|
|
|
Global.projects[idx_to] = temp
|
2020-06-05 14:50:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
func delete_tab(tab : int) -> void:
|
|
|
|
remove_tab(tab)
|
|
|
|
Global.current_project.undo_redo.free()
|
|
|
|
Global.projects.remove(tab)
|
|
|
|
if tab > 0:
|
|
|
|
Global.current_project_index -= 1
|
|
|
|
else:
|
|
|
|
Global.current_project_index = 0
|
2020-06-05 15:54:11 +00:00
|
|
|
if Global.unsaved_changes_dialog.is_connected("confirmed", self, "delete_tab"):
|
|
|
|
Global.unsaved_changes_dialog.disconnect("confirmed", self, "delete_tab")
|