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

Added layout selection

Users can currently select between Default and Tallscreen
This commit is contained in:
Manolis Papadeas 2022-02-01 02:31:13 +02:00
parent cbae8bdc77
commit 12b64316da
3 changed files with 172 additions and 37 deletions

View file

@ -5,106 +5,94 @@
[ext_resource path="res://addons/dockable_container/layout.gd" type="Script" id=3]
[sub_resource type="Resource" id=1]
resource_name = "Tabs"
script = ExtResource( 1 )
names = PoolStringArray( "Tools" )
current_tab = 0
[sub_resource type="Resource" id=8]
resource_name = "Tabs"
script = ExtResource( 1 )
names = PoolStringArray( "Main Canvas" )
current_tab = 0
[sub_resource type="Resource" id=9]
resource_name = "Tabs"
script = ExtResource( 1 )
names = PoolStringArray( "Animation Timeline" )
current_tab = 0
[sub_resource type="Resource" id=10]
resource_name = "Split"
script = ExtResource( 2 )
direction = 1
percent = 0.90625
percent = 0.882812
first = SubResource( 8 )
second = SubResource( 9 )
[sub_resource type="Resource" id=11]
resource_name = "Tabs"
script = ExtResource( 1 )
names = PoolStringArray( "Canvas Preview" )
current_tab = 0
[sub_resource type="Resource" id=20]
resource_name = "Tabs"
[sub_resource type="Resource" id=23]
script = ExtResource( 1 )
names = PoolStringArray( "Color Pickers" )
current_tab = 0
[sub_resource type="Resource" id=21]
resource_name = "Split"
[sub_resource type="Resource" id=24]
script = ExtResource( 2 )
direction = 1
percent = 0.911765
percent = 0.0
first = SubResource( 11 )
second = SubResource( 20 )
second = SubResource( 23 )
[sub_resource type="Resource" id=22]
[sub_resource type="Resource" id=25]
resource_name = "Tabs"
script = ExtResource( 1 )
names = PoolStringArray( "Left tool options" )
names = PoolStringArray( "Left Tool Options" )
current_tab = 0
[sub_resource type="Resource" id=23]
[sub_resource type="Resource" id=26]
resource_name = "Tabs"
script = ExtResource( 1 )
names = PoolStringArray( "Right tool options" )
names = PoolStringArray( "Right Tool Options" )
current_tab = 0
[sub_resource type="Resource" id=24]
[sub_resource type="Resource" id=27]
resource_name = "Split"
script = ExtResource( 2 )
direction = 0
percent = 0.5
first = SubResource( 22 )
second = SubResource( 23 )
first = SubResource( 25 )
second = SubResource( 26 )
[sub_resource type="Resource" id=21]
script = ExtResource( 2 )
direction = 1
percent = 0.182692
first = SubResource( 24 )
second = SubResource( 27 )
[sub_resource type="Resource" id=13]
resource_name = "Tabs"
script = ExtResource( 1 )
names = PoolStringArray( "Palette Panel" )
current_tab = 0
[sub_resource type="Resource" id=14]
resource_name = "Split"
[sub_resource type="Resource" id=15]
script = ExtResource( 2 )
direction = 1
percent = 0.754808
first = SubResource( 24 )
percent = 1.0
first = SubResource( 21 )
second = SubResource( 13 )
[sub_resource type="Resource" id=15]
resource_name = "Split"
script = ExtResource( 2 )
direction = 1
percent = 0.332031
first = SubResource( 21 )
second = SubResource( 14 )
[sub_resource type="Resource" id=16]
resource_name = "Split"
script = ExtResource( 2 )
direction = 0
percent = 0.962785
percent = 0.972488
first = SubResource( 10 )
second = SubResource( 15 )
[sub_resource type="Resource" id=5]
resource_name = "Split"
script = ExtResource( 2 )
direction = 0
percent = 0.0
percent = 0.00695249
first = SubResource( 1 )
second = SubResource( 16 )

View file

@ -0,0 +1,116 @@
[gd_resource type="Resource" load_steps=19 format=2]
[ext_resource path="res://addons/dockable_container/layout_panel.gd" type="Script" id=1]
[ext_resource path="res://addons/dockable_container/layout.gd" type="Script" id=2]
[ext_resource path="res://addons/dockable_container/layout_split.gd" type="Script" id=3]
[sub_resource type="Resource" id=8]
resource_name = "Tabs"
script = ExtResource( 1 )
names = PoolStringArray( "Main Canvas" )
current_tab = 0
[sub_resource type="Resource" id=9]
resource_name = "Tabs"
script = ExtResource( 1 )
names = PoolStringArray( "Tools" )
current_tab = 0
[sub_resource type="Resource" id=10]
resource_name = "Tabs"
script = ExtResource( 1 )
names = PoolStringArray( "Left Tool Options" )
current_tab = 0
[sub_resource type="Resource" id=11]
resource_name = "Tabs"
script = ExtResource( 1 )
names = PoolStringArray( "Right Tool Options" )
current_tab = 0
[sub_resource type="Resource" id=12]
resource_name = "Split"
script = ExtResource( 3 )
direction = 0
percent = 0.5
first = SubResource( 10 )
second = SubResource( 11 )
[sub_resource type="Resource" id=13]
resource_name = "Tabs"
script = ExtResource( 1 )
names = PoolStringArray( "Color Pickers" )
current_tab = 0
[sub_resource type="Resource" id=14]
resource_name = "Tabs"
script = ExtResource( 1 )
names = PoolStringArray( "Canvas Preview" )
current_tab = 0
[sub_resource type="Resource" id=15]
resource_name = "Split"
script = ExtResource( 3 )
direction = 1
percent = 0.5
first = SubResource( 13 )
second = SubResource( 14 )
[sub_resource type="Resource" id=16]
resource_name = "Tabs"
script = ExtResource( 1 )
names = PoolStringArray( "Palette Panel" )
current_tab = 0
[sub_resource type="Resource" id=17]
resource_name = "Split"
script = ExtResource( 3 )
direction = 0
percent = 0.5
first = SubResource( 15 )
second = SubResource( 16 )
[sub_resource type="Resource" id=18]
resource_name = "Split"
script = ExtResource( 3 )
direction = 0
percent = 0.501251
first = SubResource( 12 )
second = SubResource( 17 )
[sub_resource type="Resource" id=19]
resource_name = "Tabs"
script = ExtResource( 1 )
names = PoolStringArray( "Animation Timeline" )
current_tab = 0
[sub_resource type="Resource" id=20]
resource_name = "Split"
script = ExtResource( 3 )
direction = 1
percent = 0.8125
first = SubResource( 18 )
second = SubResource( 19 )
[sub_resource type="Resource" id=21]
resource_name = "Split"
script = ExtResource( 3 )
direction = 0
percent = 0.0
first = SubResource( 9 )
second = SubResource( 20 )
[sub_resource type="Resource" id=22]
resource_name = "Split"
script = ExtResource( 3 )
direction = 1
percent = 0.5
first = SubResource( 8 )
second = SubResource( 21 )
[resource]
resource_name = "Layout"
script = ExtResource( 2 )
root = SubResource( 22 )
hidden_tabs = {
}

View file

@ -11,6 +11,7 @@ enum ViewMenuId {
SHOW_RULERS,
SHOW_GUIDES,
DOCKERS,
LAYOUTS,
EDIT_MODE,
ZEN_MODE,
FULLSCREEN_MODE
@ -41,8 +42,12 @@ enum HelpMenuId {
var file_menu: PopupMenu
var view_menu: PopupMenu
var zen_mode := false
var recent_projects := []
var layouts := [
["Default", preload("res://assets/layouts/default.tres")],
["Tallscreen", preload("res://assets/layouts/tallscreen.tres")],
]
var zen_mode := false
onready var ui_elements: Array = Global.control.find_node("DockableContainer").get_children()
onready var file_menu_button: MenuButton = find_node("FileMenu")
@ -56,6 +61,7 @@ onready var new_image_dialog: ConfirmationDialog = Global.control.find_node("Cre
onready var window_opacity_dialog: AcceptDialog = Global.control.find_node("WindowOpacityDialog")
onready var tile_mode_submenu := PopupMenu.new()
onready var dockers_submenu := PopupMenu.new()
onready var layouts_submenu := PopupMenu.new()
onready var panel_layout_submenu := PopupMenu.new()
onready var recent_projects_submenu := PopupMenu.new()
@ -145,6 +151,7 @@ func _setup_view_menu() -> void:
"Show Rulers": InputMap.get_action_list("show_rulers")[0].get_scancode_with_modifiers(),
"Show Guides": InputMap.get_action_list("show_guides")[0].get_scancode_with_modifiers(),
"Dockers": 0,
"Layouts": 0,
"Edit Mode": InputMap.get_action_list("edit_mode")[0].get_scancode_with_modifiers(),
"Zen Mode": InputMap.get_action_list("zen_mode")[0].get_scancode_with_modifiers(),
"Fullscreen Mode":
@ -158,6 +165,8 @@ func _setup_view_menu() -> void:
_setup_tile_mode_submenu(item)
elif item == "Dockers":
_setup_dockers_submenu(item)
elif item == "Layouts":
_setup_layouts_submenu(item)
elif item == "Window Opacity":
view_menu.add_item(item, i, view_menu_items[item])
else:
@ -200,6 +209,19 @@ func _setup_dockers_submenu(item: String) -> void:
view_menu.add_submenu_item(item, dockers_submenu.get_name())
func _setup_layouts_submenu(item: String) -> void:
layouts_submenu.set_name("layouts_submenu")
layouts_submenu.hide_on_checkable_item_selection = false
for layout in layouts:
layouts_submenu.add_radio_check_item(layout[0])
layouts_submenu.set_item_checked(0, true)
layouts_submenu.connect("id_pressed", self, "_layouts_submenu_id_pressed")
view_menu.add_child(layouts_submenu)
view_menu.add_submenu_item(item, layouts_submenu.get_name())
func _setup_image_menu() -> void:
var image_menu_items := { # order as in ImageMenuId enum
"Scale Image": 0,
@ -412,6 +434,15 @@ func _dockers_submenu_id_pressed(id: int) -> void:
dockers_submenu.set_item_checked(id, !element_visible)
func _layouts_submenu_id_pressed(id: int) -> void:
Global.control.ui.layout = layouts[id][1].clone()
for i in layouts.size():
layouts_submenu.set_item_checked(i, i == id)
for i in ui_elements.size():
dockers_submenu.set_item_checked(i, true)
func _toggle_mirror_view() -> void:
Global.mirror_view = !Global.mirror_view
var marching_ants_outline: Sprite = Global.canvas.selection.marching_ants_outline