mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-30 23:19:49 +00:00
Rename "ui" variable to "main_ui" in Main.gd and TopMenuContainer.gd
This commit is contained in:
parent
2e8cf6a30a
commit
276a872f73
|
@ -6,7 +6,7 @@ var is_quitting_on_save := false
|
||||||
var changed_projects_on_quit: Array[Project]
|
var changed_projects_on_quit: Array[Project]
|
||||||
var cursor_image := preload("res://assets/graphics/cursor.png")
|
var cursor_image := preload("res://assets/graphics/cursor.png")
|
||||||
|
|
||||||
@onready var ui := $MenuAndUI/UI/DockableContainer as DockableContainer
|
@onready var main_ui := $MenuAndUI/UI/DockableContainer as DockableContainer
|
||||||
@onready var backup_confirmation: ConfirmationDialog = $Dialogs/BackupConfirmation
|
@onready var backup_confirmation: ConfirmationDialog = $Dialogs/BackupConfirmation
|
||||||
@onready var save_sprite_html5: ConfirmationDialog = $Dialogs/SaveSpriteHTML5
|
@onready var save_sprite_html5: ConfirmationDialog = $Dialogs/SaveSpriteHTML5
|
||||||
@onready var quit_dialog: ConfirmationDialog = $Dialogs/QuitDialog
|
@onready var quit_dialog: ConfirmationDialog = $Dialogs/QuitDialog
|
||||||
|
|
|
@ -257,7 +257,7 @@ func remove_reference_image(idx: int) -> void:
|
||||||
ri.queue_free()
|
ri.queue_free()
|
||||||
Global.current_project.set_reference_image_index(-1)
|
Global.current_project.set_reference_image_index(-1)
|
||||||
Global.current_project.change_project()
|
Global.current_project.change_project()
|
||||||
Global.control.ui.find_child("Reference Images")._on_references_changed()
|
Global.reference_panel._on_references_changed()
|
||||||
|
|
||||||
|
|
||||||
func _update_on_zoom() -> void:
|
func _update_on_zoom() -> void:
|
||||||
|
|
|
@ -64,7 +64,7 @@ func _on_DeleteLayout_pressed() -> void:
|
||||||
func _on_LayoutSettings_confirmed() -> void:
|
func _on_LayoutSettings_confirmed() -> void:
|
||||||
var file_name := layout_name.text + ".tres"
|
var file_name := layout_name.text + ".tres"
|
||||||
var path := "user://layouts/".path_join(file_name)
|
var path := "user://layouts/".path_join(file_name)
|
||||||
var layout: DockableLayout = Global.control.ui.layout
|
var layout: DockableLayout = Global.control.main_ui.layout
|
||||||
var err := ResourceSaver.save(layout, path)
|
var err := ResourceSaver.save(layout, path)
|
||||||
if err != OK:
|
if err != OK:
|
||||||
print(err)
|
print(err)
|
||||||
|
@ -108,7 +108,7 @@ func _on_DeleteConfirmation_confirmed() -> void:
|
||||||
func refresh_preview():
|
func refresh_preview():
|
||||||
for tab in mimic_ui.get_tabs():
|
for tab in mimic_ui.get_tabs():
|
||||||
mimic_ui.remove_child(tab)
|
mimic_ui.remove_child(tab)
|
||||||
for item in Global.top_menu_container.ui.get_tabs():
|
for item in Global.top_menu_container.main_ui.get_tabs():
|
||||||
var box := TextEdit.new()
|
var box := TextEdit.new()
|
||||||
box.name = item.name
|
box.name = item.name
|
||||||
box.text = item.name
|
box.text = item.name
|
||||||
|
|
|
@ -7,7 +7,7 @@ extends AcceptDialog
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
Global.control.ui.sort_children.connect(_recalculate_opacity)
|
Global.control.main_ui.sort_children.connect(_recalculate_opacity)
|
||||||
|
|
||||||
|
|
||||||
func _on_WindowOpacityDialog_about_to_show() -> void:
|
func _on_WindowOpacityDialog_about_to_show() -> void:
|
||||||
|
@ -34,7 +34,7 @@ func set_window_opacity(value: float) -> void:
|
||||||
|
|
||||||
value = value / 100.0
|
value = value / 100.0
|
||||||
# Find the TabContainer that has the Main Canvas panel
|
# Find the TabContainer that has the Main Canvas panel
|
||||||
for container: Control in Global.control.ui._panel_container.get_children():
|
for container: Control in Global.control.main_ui._panel_container.get_children():
|
||||||
if container is TabContainer:
|
if container is TabContainer:
|
||||||
var center := container.get_rect().get_center()
|
var center := container.get_rect().get_center()
|
||||||
if main_canvas.get_rect().has_point(center):
|
if main_canvas.get_rect().has_point(center):
|
||||||
|
|
|
@ -18,8 +18,8 @@ var default_layout_size := layouts.size()
|
||||||
var selected_layout := 0
|
var selected_layout := 0
|
||||||
var zen_mode := false
|
var zen_mode := false
|
||||||
|
|
||||||
@onready var ui := Global.control.find_child("DockableContainer") as DockableContainer
|
@onready var main_ui := Global.control.find_child("DockableContainer") as DockableContainer
|
||||||
@onready var ui_elements := ui.get_children()
|
@onready var ui_elements := main_ui.get_children()
|
||||||
@onready var file_menu: PopupMenu = $MenuBar/File
|
@onready var file_menu: PopupMenu = $MenuBar/File
|
||||||
@onready var edit_menu: PopupMenu = $MenuBar/Edit
|
@onready var edit_menu: PopupMenu = $MenuBar/Edit
|
||||||
@onready var select_menu: PopupMenu = $MenuBar/Select
|
@onready var select_menu: PopupMenu = $MenuBar/Select
|
||||||
|
@ -28,7 +28,7 @@ var zen_mode := false
|
||||||
@onready var window_menu: PopupMenu = $MenuBar/Window
|
@onready var window_menu: PopupMenu = $MenuBar/Window
|
||||||
@onready var help_menu: PopupMenu = $MenuBar/Help
|
@onready var help_menu: PopupMenu = $MenuBar/Help
|
||||||
|
|
||||||
@onready var greyscale_vision: ColorRect = ui.find_child("GreyscaleVision")
|
@onready var greyscale_vision: ColorRect = main_ui.find_child("GreyscaleVision")
|
||||||
@onready var new_image_dialog: ConfirmationDialog = Global.control.find_child("CreateNewImage")
|
@onready var new_image_dialog: ConfirmationDialog = Global.control.find_child("CreateNewImage")
|
||||||
@onready var window_opacity_dialog: AcceptDialog = Global.control.find_child("WindowOpacityDialog")
|
@onready var window_opacity_dialog: AcceptDialog = Global.control.find_child("WindowOpacityDialog")
|
||||||
@onready var tile_mode_submenu := PopupMenu.new()
|
@onready var tile_mode_submenu := PopupMenu.new()
|
||||||
|
@ -239,7 +239,7 @@ func _setup_panels_submenu(item: String) -> void:
|
||||||
panels_submenu.hide_on_checkable_item_selection = false
|
panels_submenu.hide_on_checkable_item_selection = false
|
||||||
for element in ui_elements:
|
for element in ui_elements:
|
||||||
panels_submenu.add_check_item(element.name)
|
panels_submenu.add_check_item(element.name)
|
||||||
var is_hidden: bool = ui.is_control_hidden(element)
|
var is_hidden: bool = main_ui.is_control_hidden(element)
|
||||||
panels_submenu.set_item_checked(ui_elements.find(element), !is_hidden)
|
panels_submenu.set_item_checked(ui_elements.find(element), !is_hidden)
|
||||||
|
|
||||||
panels_submenu.id_pressed.connect(_panels_submenu_id_pressed)
|
panels_submenu.id_pressed.connect(_panels_submenu_id_pressed)
|
||||||
|
@ -516,8 +516,8 @@ func window_menu_id_pressed(id: int) -> void:
|
||||||
Global.WindowMenu.WINDOW_OPACITY:
|
Global.WindowMenu.WINDOW_OPACITY:
|
||||||
_popup_dialog(window_opacity_dialog)
|
_popup_dialog(window_opacity_dialog)
|
||||||
Global.WindowMenu.MOVABLE_PANELS:
|
Global.WindowMenu.MOVABLE_PANELS:
|
||||||
ui.tabs_visible = !ui.tabs_visible
|
main_ui.tabs_visible = !main_ui.tabs_visible
|
||||||
window_menu.set_item_checked(id, ui.tabs_visible)
|
window_menu.set_item_checked(id, main_ui.tabs_visible)
|
||||||
Global.WindowMenu.ZEN_MODE:
|
Global.WindowMenu.ZEN_MODE:
|
||||||
_toggle_zen_mode()
|
_toggle_zen_mode()
|
||||||
Global.WindowMenu.FULLSCREEN_MODE:
|
Global.WindowMenu.FULLSCREEN_MODE:
|
||||||
|
@ -557,13 +557,13 @@ func _panels_submenu_id_pressed(id: int) -> void:
|
||||||
return
|
return
|
||||||
|
|
||||||
var element_visible := panels_submenu.is_item_checked(id)
|
var element_visible := panels_submenu.is_item_checked(id)
|
||||||
ui.set_control_hidden(ui_elements[id], element_visible)
|
main_ui.set_control_hidden(ui_elements[id], element_visible)
|
||||||
panels_submenu.set_item_checked(id, !element_visible)
|
panels_submenu.set_item_checked(id, !element_visible)
|
||||||
if ui.tabs_visible == false:
|
if main_ui.tabs_visible == false:
|
||||||
ui.tabs_visible = true
|
main_ui.tabs_visible = true
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
ui.tabs_visible = false
|
main_ui.tabs_visible = false
|
||||||
|
|
||||||
|
|
||||||
func _layouts_submenu_id_pressed(id: int) -> void:
|
func _layouts_submenu_id_pressed(id: int) -> void:
|
||||||
|
@ -577,13 +577,13 @@ func set_layout(id: int) -> void:
|
||||||
if id >= layouts.size():
|
if id >= layouts.size():
|
||||||
id = 0
|
id = 0
|
||||||
selected_layout = id
|
selected_layout = id
|
||||||
ui.layout = layouts[id][1].clone() # Clone is needed to avoid modifying premade layouts
|
main_ui.layout = layouts[id][1].clone() # Clone is needed to avoid modifying premade layouts
|
||||||
for i in layouts.size():
|
for i in layouts.size():
|
||||||
var offset := i + 1
|
var offset := i + 1
|
||||||
layouts_submenu.set_item_checked(offset, offset == (id + 1))
|
layouts_submenu.set_item_checked(offset, offset == (id + 1))
|
||||||
|
|
||||||
for i in ui_elements.size():
|
for i in ui_elements.size():
|
||||||
var is_hidden := ui.is_control_hidden(ui_elements[i])
|
var is_hidden := main_ui.is_control_hidden(ui_elements[i])
|
||||||
panels_submenu.set_item_checked(i, !is_hidden)
|
panels_submenu.set_item_checked(i, !is_hidden)
|
||||||
|
|
||||||
if zen_mode: # Turn zen mode off
|
if zen_mode: # Turn zen mode off
|
||||||
|
@ -595,7 +595,7 @@ func set_layout(id: int) -> void:
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
# Call set_tabs_visible to keep tabs visible if there are 2 or more in the same panel
|
# Call set_tabs_visible to keep tabs visible if there are 2 or more in the same panel
|
||||||
ui.tabs_visible = ui.tabs_visible
|
main_ui.tabs_visible = main_ui.tabs_visible
|
||||||
|
|
||||||
|
|
||||||
func _toggle_greyscale_view() -> void:
|
func _toggle_greyscale_view() -> void:
|
||||||
|
@ -665,7 +665,7 @@ func _toggle_zen_mode() -> void:
|
||||||
continue
|
continue
|
||||||
if !panels_submenu.is_item_checked(i):
|
if !panels_submenu.is_item_checked(i):
|
||||||
continue
|
continue
|
||||||
ui.set_control_hidden(ui_elements[i], !zen_mode)
|
main_ui.set_control_hidden(ui_elements[i], !zen_mode)
|
||||||
Global.control.find_child("TabsContainer").visible = zen_mode
|
Global.control.find_child("TabsContainer").visible = zen_mode
|
||||||
zen_mode = !zen_mode
|
zen_mode = !zen_mode
|
||||||
window_menu.set_item_checked(Global.WindowMenu.ZEN_MODE, zen_mode)
|
window_menu.set_item_checked(Global.WindowMenu.ZEN_MODE, zen_mode)
|
||||||
|
|
Loading…
Reference in a new issue