add file menu shortcuts to deck holder renderer

This commit is contained in:
Lera Elvoé 2023-12-04 17:27:31 +03:00
parent b7f511709a
commit 3be669da28
No known key found for this signature in database
2 changed files with 69 additions and 1 deletions

View file

@ -13,6 +13,12 @@ const DECK_SCENE := preload("res://graph_node_renderer/deck_renderer_graph_edit.
## Reference to the [FileDialog] used for File operations through the program. ## Reference to the [FileDialog] used for File operations through the program.
@onready var file_dialog: FileDialog = $FileDialog @onready var file_dialog: FileDialog = $FileDialog
@export var new_deck_shortcut: Shortcut
@export var open_deck_shortcut: Shortcut
@export var save_deck_shortcut: Shortcut
@export var save_deck_as_shortcut: Shortcut
@export var close_deck_shortcut: Shortcut
## Enum for storing the Options in the "File" PopupMenu. ## Enum for storing the Options in the "File" PopupMenu.
enum FileMenuId { enum FileMenuId {
NEW, NEW,
@ -21,6 +27,8 @@ enum FileMenuId {
SAVE_AS, SAVE_AS,
CLOSE = 6, CLOSE = 6,
} }
@onready var file_popup_menu: PopupMenu = %File as PopupMenu
enum ConnectionsMenuId { enum ConnectionsMenuId {
OBS, OBS,
@ -46,6 +54,12 @@ func _ready() -> void:
file_dialog.canceled.connect(disconnect_file_dialog_signals) file_dialog.canceled.connect(disconnect_file_dialog_signals)
Connections.obs_websocket = no_obsws Connections.obs_websocket = no_obsws
file_popup_menu.set_item_shortcut(FileMenuId.NEW, new_deck_shortcut)
file_popup_menu.set_item_shortcut(FileMenuId.OPEN, open_deck_shortcut)
file_popup_menu.set_item_shortcut(FileMenuId.SAVE, save_deck_shortcut)
file_popup_menu.set_item_shortcut(FileMenuId.SAVE_AS, save_deck_as_shortcut)
file_popup_menu.set_item_shortcut(FileMenuId.CLOSE, close_deck_shortcut)
## Called when the File button in the [MenuBar] is pressed with the [param id] ## Called when the File button in the [MenuBar] is pressed with the [param id]
## of the button within it that was pressed. ## of the button within it that was pressed.

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=6 format=3 uid="uid://duaah5x0jhkn6"] [gd_scene load_steps=16 format=3 uid="uid://duaah5x0jhkn6"]
[ext_resource type="Script" path="res://graph_node_renderer/deck_holder_renderer.gd" id="1_67g2g"] [ext_resource type="Script" path="res://graph_node_renderer/deck_holder_renderer.gd" id="1_67g2g"]
[ext_resource type="PackedScene" uid="uid://b84f2ngtcm5b8" path="res://graph_node_renderer/tab_container_custom.tscn" id="1_s3ug2"] [ext_resource type="PackedScene" uid="uid://b84f2ngtcm5b8" path="res://graph_node_renderer/tab_container_custom.tscn" id="1_s3ug2"]
@ -6,6 +6,52 @@
[ext_resource type="Script" path="res://addons/no-obs-ws/NoOBSWS.gd" id="4_nu72u"] [ext_resource type="Script" path="res://addons/no-obs-ws/NoOBSWS.gd" id="4_nu72u"]
[ext_resource type="PackedScene" uid="uid://eioso6jb42jy" path="res://graph_node_renderer/obs_websocket_setup_dialog.tscn" id="5_uo2gj"] [ext_resource type="PackedScene" uid="uid://eioso6jb42jy" path="res://graph_node_renderer/obs_websocket_setup_dialog.tscn" id="5_uo2gj"]
[sub_resource type="InputEventKey" id="InputEventKey_giamc"]
device = -1
ctrl_pressed = true
keycode = 78
unicode = 110
[sub_resource type="Shortcut" id="Shortcut_30rq6"]
events = [SubResource("InputEventKey_giamc")]
[sub_resource type="InputEventKey" id="InputEventKey_cyjf4"]
device = -1
ctrl_pressed = true
keycode = 79
unicode = 111
[sub_resource type="Shortcut" id="Shortcut_m48tj"]
events = [SubResource("InputEventKey_cyjf4")]
[sub_resource type="InputEventKey" id="InputEventKey_jgr3p"]
device = -1
ctrl_pressed = true
keycode = 83
unicode = 115
[sub_resource type="Shortcut" id="Shortcut_xr6s4"]
events = [SubResource("InputEventKey_jgr3p")]
[sub_resource type="InputEventKey" id="InputEventKey_762xj"]
device = -1
shift_pressed = true
ctrl_pressed = true
keycode = 83
unicode = 83
[sub_resource type="Shortcut" id="Shortcut_myxuq"]
events = [SubResource("InputEventKey_762xj")]
[sub_resource type="InputEventKey" id="InputEventKey_exx3o"]
device = -1
ctrl_pressed = true
keycode = 87
unicode = 119
[sub_resource type="Shortcut" id="Shortcut_46v8y"]
events = [SubResource("InputEventKey_exx3o")]
[node name="DeckHolderRenderer" type="Control"] [node name="DeckHolderRenderer" type="Control"]
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
@ -15,6 +61,11 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme = ExtResource("1_tgul2") theme = ExtResource("1_tgul2")
script = ExtResource("1_67g2g") script = ExtResource("1_67g2g")
new_deck_shortcut = SubResource("Shortcut_30rq6")
open_deck_shortcut = SubResource("Shortcut_m48tj")
save_deck_shortcut = SubResource("Shortcut_xr6s4")
save_deck_as_shortcut = SubResource("Shortcut_myxuq")
close_deck_shortcut = SubResource("Shortcut_46v8y")
[node name="MarginContainer" type="MarginContainer" parent="."] [node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 1 layout_mode = 1
@ -39,6 +90,7 @@ layout_mode = 2
layout_mode = 2 layout_mode = 2
[node name="File" type="PopupMenu" parent="MarginContainer/VSplitContainer/VBoxContainer/MenuBar"] [node name="File" type="PopupMenu" parent="MarginContainer/VSplitContainer/VBoxContainer/MenuBar"]
unique_name_in_owner = true
item_count = 7 item_count = 7
item_0/text = "New Deck" item_0/text = "New Deck"
item_0/id = 0 item_0/id = 0
@ -58,8 +110,10 @@ item_6/text = "Close Deck"
item_6/id = 6 item_6/id = 6
[node name="Edit" type="PopupMenu" parent="MarginContainer/VSplitContainer/VBoxContainer/MenuBar"] [node name="Edit" type="PopupMenu" parent="MarginContainer/VSplitContainer/VBoxContainer/MenuBar"]
unique_name_in_owner = true
[node name="Connections" type="PopupMenu" parent="MarginContainer/VSplitContainer/VBoxContainer/MenuBar"] [node name="Connections" type="PopupMenu" parent="MarginContainer/VSplitContainer/VBoxContainer/MenuBar"]
unique_name_in_owner = true
item_count = 1 item_count = 1
item_0/text = "OBS..." item_0/text = "OBS..."
item_0/id = 0 item_0/id = 0