2022-08-25 10:56:43 +02:00
|
|
|
tool
|
2022-08-25 11:03:21 +02:00
|
|
|
extends VBoxContainer
|
2022-08-25 10:56:43 +02:00
|
|
|
|
|
|
|
var _entry : WebPageEntry = null
|
|
|
|
|
2022-08-25 11:03:21 +02:00
|
|
|
var _entry_type_label : Label = null
|
2022-08-25 15:09:54 +02:00
|
|
|
var _main_container : Control = null
|
|
|
|
|
|
|
|
var _editor : Control = null
|
|
|
|
|
|
|
|
var WebPageEntryTitleTextEditor : PackedScene = null
|
2022-08-25 16:05:45 +02:00
|
|
|
var WebPageEntryTextEditor : PackedScene = null
|
2022-08-25 11:03:21 +02:00
|
|
|
|
|
|
|
signal entry_add_requested_after(entry)
|
|
|
|
signal entry_move_up_requested(entry)
|
|
|
|
signal entry_move_down_requested(entry)
|
|
|
|
signal entry_delete_requested(entry)
|
|
|
|
|
2022-08-25 15:09:54 +02:00
|
|
|
func set_entry(entry : WebPageEntry, undo_redo : UndoRedo) -> void:
|
2022-08-25 10:56:43 +02:00
|
|
|
_entry = entry
|
2022-08-25 11:03:21 +02:00
|
|
|
|
2022-08-25 15:20:18 +02:00
|
|
|
var cls : String = entry.get_page_entry_class_name()
|
2022-08-25 15:09:54 +02:00
|
|
|
_entry_type_label.text = cls
|
|
|
|
|
|
|
|
if cls == "WebPageEntryTitleText":
|
|
|
|
_editor = WebPageEntryTitleTextEditor.instance()
|
2022-08-25 16:05:45 +02:00
|
|
|
elif cls == "WebPageEntryText":
|
|
|
|
_editor = WebPageEntryTextEditor.instance()
|
2022-08-25 15:09:54 +02:00
|
|
|
|
|
|
|
if _editor:
|
2022-08-25 15:20:18 +02:00
|
|
|
_editor.set_entry(entry, undo_redo)
|
2022-08-25 15:09:54 +02:00
|
|
|
_main_container.add_child(_editor)
|
2022-08-25 10:56:43 +02:00
|
|
|
|
|
|
|
func _on_add_button_pressed():
|
2022-08-25 11:03:21 +02:00
|
|
|
emit_signal("entry_add_requested_after", _entry)
|
2022-08-25 10:56:43 +02:00
|
|
|
|
|
|
|
func _on_up_button_pressed():
|
2022-08-25 11:03:21 +02:00
|
|
|
emit_signal("entry_move_up_requested", _entry)
|
2022-08-25 10:56:43 +02:00
|
|
|
|
|
|
|
func _on_down_button_pressed():
|
2022-08-25 11:03:21 +02:00
|
|
|
emit_signal("entry_move_down_requested", _entry)
|
2022-08-25 10:56:43 +02:00
|
|
|
|
|
|
|
func _on_delete_button_pressed():
|
2022-08-25 11:03:21 +02:00
|
|
|
emit_signal("entry_delete_requested", _entry)
|
2022-08-25 10:56:43 +02:00
|
|
|
|
|
|
|
func _notification(what):
|
|
|
|
if what == NOTIFICATION_INSTANCED:
|
2022-08-25 15:09:54 +02:00
|
|
|
WebPageEntryTitleTextEditor = ResourceLoader.load("res://addons/web_pages/editor/post_entries/WebPageEntryTitleTextEditor.tscn", "PackedScene")
|
2022-08-25 16:05:45 +02:00
|
|
|
WebPageEntryTextEditor = ResourceLoader.load("res://addons/web_pages/editor/post_entries/WebPageEntryTextEditor.tscn", "PackedScene")
|
2022-08-25 15:09:54 +02:00
|
|
|
|
2022-08-25 11:03:21 +02:00
|
|
|
_entry_type_label = get_node("PC/VBC/TopBar/EntryTypeLabel")
|
2022-08-25 15:09:54 +02:00
|
|
|
_main_container = get_node("PC/VBC/MainContainer")
|
2022-08-25 11:03:21 +02:00
|
|
|
|
2022-08-25 15:28:46 +02:00
|
|
|
get_node("HBoxContainer/AddButton").connect("pressed", self, "_on_add_button_pressed")
|
2022-08-25 11:03:21 +02:00
|
|
|
get_node("PC/VBC/TopBar/UpButton").connect("pressed", self, "_on_up_button_pressed")
|
|
|
|
get_node("PC/VBC/TopBar/DownButton").connect("pressed", self, "_on_down_button_pressed")
|
|
|
|
get_node("PC/VBC/TopBar/Delete").connect("pressed", self, "_on_delete_button_pressed")
|
2022-08-25 10:56:43 +02:00
|
|
|
|