feat: shortcuts for edit window
This commit is contained in:
parent
3d87fd8fcb
commit
7195ae9da5
6 changed files with 81 additions and 46 deletions
|
|
@ -32,10 +32,6 @@ window/size/transparent=true
|
||||||
window/subwindows/embed_subwindows=false
|
window/subwindows/embed_subwindows=false
|
||||||
window/per_pixel_transparency/allowed=true
|
window/per_pixel_transparency/allowed=true
|
||||||
|
|
||||||
[editor_plugins]
|
|
||||||
|
|
||||||
enabled=PackedStringArray("res://addons/markdown_text_edit/plugin.cfg")
|
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
renderer/rendering_method="gl_compatibility"
|
renderer/rendering_method="gl_compatibility"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
extends HBoxContainer
|
class_name DoneBox extends HBoxContainer
|
||||||
|
|
||||||
@export var edit_menu: PackedScene
|
@export var edit_menu: PackedScene
|
||||||
@export var options_menu: MenuButton
|
@export var options_menu: MenuButton
|
||||||
|
|
|
||||||
35
src/UI/done_box.tscn
Normal file
35
src/UI/done_box.tscn
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
[gd_scene load_steps=6 format=3 uid="uid://d1b10b44uwo8y"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://buvowannsky2u" path="res://src/UI/done_box.gd" id="1_kikfe"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dcifyvgobrvp5" path="res://src/UI/editmenu.tscn" id="2_qm8q0"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://c1ccasyx80msg" path="res://src/assets/icons/dots-vertical.svg" id="3_leupd"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://ne4o3drvj5vw" path="res://src/assets/icons/color-picker.svg" id="4_qqlum"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://s3vf3vhl8y3e" path="res://src/assets/icons/trash.svg" id="5_k527k"]
|
||||||
|
|
||||||
|
[node name="DoneBox" type="HBoxContainer" node_paths=PackedStringArray("options_menu", "entry_text_box")]
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
theme_override_constants/separation = 20
|
||||||
|
script = ExtResource("1_kikfe")
|
||||||
|
edit_menu = ExtResource("2_qm8q0")
|
||||||
|
options_menu = NodePath("MenuButton")
|
||||||
|
entry_text_box = NodePath("RichTextLabel")
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
focus_mode = 2
|
||||||
|
bbcode_enabled = true
|
||||||
|
fit_content = true
|
||||||
|
context_menu_enabled = true
|
||||||
|
selection_enabled = true
|
||||||
|
|
||||||
|
[node name="MenuButton" type="MenuButton" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
icon = ExtResource("3_leupd")
|
||||||
|
item_count = 2
|
||||||
|
popup/item_0/text = "Edit"
|
||||||
|
popup/item_0/icon = ExtResource("4_qqlum")
|
||||||
|
popup/item_0/id = 0
|
||||||
|
popup/item_1/text = "Delete"
|
||||||
|
popup/item_1/icon = ExtResource("5_k527k")
|
||||||
|
popup/item_1/id = 1
|
||||||
|
|
@ -14,16 +14,30 @@ func _process(delta: float) -> void:
|
||||||
|
|
||||||
|
|
||||||
func _on_close_requested() -> void:
|
func _on_close_requested() -> void:
|
||||||
SignalBus.edit_window_closed.emit()
|
cancel()
|
||||||
|
|
||||||
|
|
||||||
func on_edit_window_requested(text: String) -> void:
|
func on_edit_window_requested(text: String) -> void:
|
||||||
text_edit.text = text
|
text_edit.text = text
|
||||||
|
|
||||||
func _on_cancel_button_button_down() -> void:
|
func _on_cancel_button_button_down() -> void:
|
||||||
SignalBus.edit_window_closed.emit()
|
cancel()
|
||||||
|
|
||||||
|
|
||||||
func _on_save_button_button_down() -> void:
|
func _on_save_button_button_down() -> void:
|
||||||
|
save()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_save_button_pressed() -> void:
|
||||||
|
save()
|
||||||
|
|
||||||
|
|
||||||
|
func cancel() -> void:
|
||||||
|
SignalBus.edit_window_closed.emit()
|
||||||
|
|
||||||
|
|
||||||
|
func save() -> void:
|
||||||
SignalBus.edit_window_text_saved.emit(text_edit.text)
|
SignalBus.edit_window_text_saved.emit(text_edit.text)
|
||||||
SignalBus.edit_window_closed.emit()
|
SignalBus.edit_window_closed.emit()
|
||||||
|
|
||||||
|
func _on_cancel_button_pressed() -> void:
|
||||||
|
cancel()
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,25 @@
|
||||||
[gd_scene load_steps=4 format=3 uid="uid://dcifyvgobrvp5"]
|
[gd_scene load_steps=8 format=3 uid="uid://dcifyvgobrvp5"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cdkqu7he8lkb6" path="res://src/UI/editmenu.gd" id="1_qmobg"]
|
[ext_resource type="Script" uid="uid://cdkqu7he8lkb6" path="res://src/UI/editmenu.gd" id="1_qmobg"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bpvgbghct7ayv" path="res://src/assets/icons/x.svg" id="2_lut1q"]
|
[ext_resource type="Texture2D" uid="uid://bpvgbghct7ayv" path="res://src/assets/icons/x.svg" id="2_lut1q"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cbj48abbpldb" path="res://src/assets/icons/device-floppy.svg" id="3_i6crh"]
|
[ext_resource type="Texture2D" uid="uid://cbj48abbpldb" path="res://src/assets/icons/device-floppy.svg" id="3_i6crh"]
|
||||||
|
|
||||||
|
[sub_resource type="InputEventKey" id="InputEventKey_i6crh"]
|
||||||
|
device = -1
|
||||||
|
keycode = 4194305
|
||||||
|
|
||||||
|
[sub_resource type="Shortcut" id="Shortcut_hou23"]
|
||||||
|
events = [SubResource("InputEventKey_i6crh")]
|
||||||
|
|
||||||
|
[sub_resource type="InputEventKey" id="InputEventKey_lut1q"]
|
||||||
|
device = -1
|
||||||
|
ctrl_pressed = true
|
||||||
|
keycode = 83
|
||||||
|
unicode = 115
|
||||||
|
|
||||||
|
[sub_resource type="Shortcut" id="Shortcut_i6crh"]
|
||||||
|
events = [SubResource("InputEventKey_lut1q")]
|
||||||
|
|
||||||
[node name="Control" type="Window" node_paths=PackedStringArray("text_edit")]
|
[node name="Control" type="Window" node_paths=PackedStringArray("text_edit")]
|
||||||
title = "Edit Entry"
|
title = "Edit Entry"
|
||||||
initial_position = 1
|
initial_position = 1
|
||||||
|
|
@ -45,14 +61,18 @@ size_flags_horizontal = 4
|
||||||
|
|
||||||
[node name="CancelButton" type="Button" parent="Panel/MarginContainer/VBoxContainer/HBoxContainer"]
|
[node name="CancelButton" type="Button" parent="Panel/MarginContainer/VBoxContainer/HBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
shortcut = SubResource("Shortcut_hou23")
|
||||||
text = "Cancel"
|
text = "Cancel"
|
||||||
icon = ExtResource("2_lut1q")
|
icon = ExtResource("2_lut1q")
|
||||||
|
|
||||||
[node name="SaveButton" type="Button" parent="Panel/MarginContainer/VBoxContainer/HBoxContainer"]
|
[node name="SaveButton" type="Button" parent="Panel/MarginContainer/VBoxContainer/HBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
shortcut = SubResource("Shortcut_i6crh")
|
||||||
text = "Save"
|
text = "Save"
|
||||||
icon = ExtResource("3_i6crh")
|
icon = ExtResource("3_i6crh")
|
||||||
|
|
||||||
[connection signal="close_requested" from="." to="." method="_on_close_requested"]
|
[connection signal="close_requested" from="." to="." method="_on_close_requested"]
|
||||||
[connection signal="button_down" from="Panel/MarginContainer/VBoxContainer/HBoxContainer/CancelButton" to="." method="_on_cancel_button_button_down"]
|
[connection signal="button_down" from="Panel/MarginContainer/VBoxContainer/HBoxContainer/CancelButton" to="." method="_on_cancel_button_button_down"]
|
||||||
|
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/HBoxContainer/CancelButton" to="." method="_on_cancel_button_pressed"]
|
||||||
[connection signal="button_down" from="Panel/MarginContainer/VBoxContainer/HBoxContainer/SaveButton" to="." method="_on_save_button_button_down"]
|
[connection signal="button_down" from="Panel/MarginContainer/VBoxContainer/HBoxContainer/SaveButton" to="." method="_on_save_button_button_down"]
|
||||||
|
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/HBoxContainer/SaveButton" to="." method="_on_save_button_pressed"]
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,11 @@
|
||||||
[gd_scene load_steps=11 format=3 uid="uid://cirolvhfd455u"]
|
[gd_scene load_steps=7 format=3 uid="uid://cirolvhfd455u"]
|
||||||
|
|
||||||
[ext_resource type="Theme" uid="uid://bal6yp0a25hf2" path="res://src/theme/main_theme.tres" id="1_c0dr6"]
|
[ext_resource type="Theme" uid="uid://bal6yp0a25hf2" path="res://src/theme/main_theme.tres" id="1_c0dr6"]
|
||||||
[ext_resource type="Script" uid="uid://bmsw85eprqln1" path="res://src/UI/main_panel.gd" id="2_5qsb6"]
|
[ext_resource type="Script" uid="uid://bmsw85eprqln1" path="res://src/UI/main_panel.gd" id="2_5qsb6"]
|
||||||
[ext_resource type="StyleBox" uid="uid://b7rqx5hwj7wff" path="res://src/UI/main_panel.tres" id="3_enj05"]
|
[ext_resource type="StyleBox" uid="uid://b7rqx5hwj7wff" path="res://src/UI/main_panel.tres" id="3_enj05"]
|
||||||
[ext_resource type="Script" uid="uid://b4q5pgorn5osd" path="res://src/UI/m_panel.gd" id="4_1citv"]
|
[ext_resource type="Script" uid="uid://b4q5pgorn5osd" path="res://src/UI/m_panel.gd" id="4_1citv"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dof65a47bfapk" path="res://src/assets/icons/library-plus.svg" id="5_1citv"]
|
[ext_resource type="Texture2D" uid="uid://dof65a47bfapk" path="res://src/assets/icons/library-plus.svg" id="5_1citv"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c1ccasyx80msg" path="res://src/assets/icons/dots-vertical.svg" id="5_bb2jg"]
|
[ext_resource type="PackedScene" uid="uid://d1b10b44uwo8y" path="res://src/UI/done_box.tscn" id="5_bb2jg"]
|
||||||
[ext_resource type="Script" uid="uid://buvowannsky2u" path="res://src/UI/done_box.gd" id="5_w3kqg"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dcifyvgobrvp5" path="res://src/UI/editmenu.tscn" id="6_qxra8"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://s3vf3vhl8y3e" path="res://src/assets/icons/trash.svg" id="7_8bhwf"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://ne4o3drvj5vw" path="res://src/assets/icons/color-picker.svg" id="8_8bhwf"]
|
|
||||||
|
|
||||||
[node name="MainPanel" type="ScrollContainer" node_paths=PackedStringArray("container_name_label")]
|
[node name="MainPanel" type="ScrollContainer" node_paths=PackedStringArray("container_name_label")]
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
|
|
@ -65,17 +61,17 @@ layout_mode = 2
|
||||||
[node name="DayContainer" type="VBoxContainer" parent="Panel/VBoxContainer/MarginContainer/VBoxContainer"]
|
[node name="DayContainer" type="VBoxContainer" parent="Panel/VBoxContainer/MarginContainer/VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="Panel/VBoxContainer/MarginContainer/VBoxContainer/DayContainer"]
|
[node name="DateMarker" type="HBoxContainer" parent="Panel/VBoxContainer/MarginContainer/VBoxContainer/DayContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 0
|
size_flags_vertical = 0
|
||||||
theme_override_constants/separation = -150
|
theme_override_constants/separation = -150
|
||||||
|
|
||||||
[node name="HSeparator" type="HSeparator" parent="Panel/VBoxContainer/MarginContainer/VBoxContainer/DayContainer/HBoxContainer"]
|
[node name="HSeparator" type="HSeparator" parent="Panel/VBoxContainer/MarginContainer/VBoxContainer/DayContainer/DateMarker"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
theme_override_constants/separation = 10
|
theme_override_constants/separation = 10
|
||||||
|
|
||||||
[node name="RichTextLabel" type="RichTextLabel" parent="Panel/VBoxContainer/MarginContainer/VBoxContainer/DayContainer/HBoxContainer"]
|
[node name="RichTextLabel" type="RichTextLabel" parent="Panel/VBoxContainer/MarginContainer/VBoxContainer/DayContainer/DateMarker"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
|
|
@ -84,39 +80,13 @@ fit_content = true
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
[node name="HSeparator2" type="HSeparator" parent="Panel/VBoxContainer/MarginContainer/VBoxContainer/DayContainer/HBoxContainer"]
|
[node name="HSeparator2" type="HSeparator" parent="Panel/VBoxContainer/MarginContainer/VBoxContainer/DayContainer/DateMarker"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
theme_override_constants/separation = 10
|
theme_override_constants/separation = 10
|
||||||
|
|
||||||
[node name="DoneBox" type="HBoxContainer" parent="Panel/VBoxContainer/MarginContainer/VBoxContainer/DayContainer" node_paths=PackedStringArray("options_menu", "entry_text_box")]
|
[node name="DoneBox" parent="Panel/VBoxContainer/MarginContainer/VBoxContainer/DayContainer" instance=ExtResource("5_bb2jg")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/separation = 20
|
|
||||||
script = ExtResource("5_w3kqg")
|
|
||||||
edit_menu = ExtResource("6_qxra8")
|
|
||||||
options_menu = NodePath("MenuButton")
|
|
||||||
entry_text_box = NodePath("RichTextLabel")
|
|
||||||
|
|
||||||
[node name="RichTextLabel" type="RichTextLabel" parent="Panel/VBoxContainer/MarginContainer/VBoxContainer/DayContainer/DoneBox"]
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
focus_mode = 2
|
|
||||||
bbcode_enabled = true
|
|
||||||
text = "Haaaalooo"
|
|
||||||
fit_content = true
|
|
||||||
context_menu_enabled = true
|
|
||||||
selection_enabled = true
|
|
||||||
|
|
||||||
[node name="MenuButton" type="MenuButton" parent="Panel/VBoxContainer/MarginContainer/VBoxContainer/DayContainer/DoneBox"]
|
|
||||||
layout_mode = 2
|
|
||||||
icon = ExtResource("5_bb2jg")
|
|
||||||
item_count = 2
|
|
||||||
popup/item_0/text = "Edit"
|
|
||||||
popup/item_0/icon = ExtResource("8_8bhwf")
|
|
||||||
popup/item_0/id = 0
|
|
||||||
popup/item_1/text = "Delete"
|
|
||||||
popup/item_1/icon = ExtResource("7_8bhwf")
|
|
||||||
popup/item_1/id = 1
|
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="Panel/VBoxContainer/MarginContainer/VBoxContainer"]
|
[node name="Button" type="Button" parent="Panel/VBoxContainer/MarginContainer/VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue