Reimplemented missing initialization for the classes that need it.

This commit is contained in:
Relintai 2022-07-16 00:36:35 +02:00
parent 383475a650
commit 22b4fbb357
6 changed files with 45 additions and 39 deletions

View File

@ -243,13 +243,17 @@ TextEditorPreview::TextEditorPreview() {
table_preview->set_h_size_flags(SIZE_EXPAND_FILL);
table_preview->set_v_size_flags(SIZE_EXPAND_FILL);
table_preview->hide();
connect("popup_hide", this, "_on_TextEditorPreview_popup_hide");
}
TextEditorPreview::~TextEditorPreview() {
}
void TextEditorPreview::_notification(int p_what) {
if (p_what == NOTIFICATION_POSTINITIALIZE) {
connect("popup_hide", this, "_on_TextEditorPreview_popup_hide");
}
}
void TextEditorPreview::_bind_methods() {
ADD_SIGNAL(MethodInfo("image_downloaded"));
ADD_SIGNAL(MethodInfo("image_loaded"));

View File

@ -23,6 +23,8 @@ public:
~TextEditorPreview();
protected:
void _notification(int p_what);
static void _bind_methods();
RichTextLabel *text_preview;

View File

@ -40,19 +40,6 @@ void TextEditorVanillaEditor::set_search_flag(const int val) {
search_flag = val;
}
void TextEditorVanillaEditor::_init() {
}
void TextEditorVanillaEditor::_ready() {
text_editor->connect("text_changed", this, "_on_text_editor_text_changed");
//FileList = get_parent().get_parent().get_parent().get_parent().get_node("FileList");
file_info_read_only->connect("toggled", this, "_on_Readonly_toggled");
//file_info_read_only.set("custom_icons/checked",IconLoader.load_icon_from_name("read"));
//file_info_read_only.set("custom_icons/unchecked",IconLoader.load_icon_from_name("edit"));
add_to_group("vanilla_editor");
load_default_font();
}
void TextEditorVanillaEditor::set_font(const String &font_path) {
Ref<DynamicFont> dynamic_font;
Ref<DynamicFontData> dynamic_font_data;
@ -427,6 +414,18 @@ TextEditorVanillaEditor::TextEditorVanillaEditor() {
TextEditorVanillaEditor::~TextEditorVanillaEditor() {
}
void TextEditorVanillaEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_POST_ENTER_TREE) {
text_editor->connect("text_changed", this, "_on_text_editor_text_changed");
//FileList = get_parent().get_parent().get_parent().get_parent().get_node("FileList");
file_info_read_only->connect("toggled", this, "_on_Readonly_toggled");
//file_info_read_only.set("custom_icons/checked",IconLoader.load_icon_from_name("read"));
//file_info_read_only.set("custom_icons/unchecked",IconLoader.load_icon_from_name("edit"));
add_to_group("vanilla_editor");
load_default_font();
}
}
void TextEditorVanillaEditor::_bind_methods() {
ADD_SIGNAL(MethodInfo("text_changed"));

View File

@ -31,8 +31,6 @@ public:
int get_search_flag() const;
void set_search_flag(const int val);
void _init();
void _ready();
void set_font(const String &font_path);
void load_default_font();
void set_wrap_enabled(const bool enabled);
@ -62,6 +60,8 @@ public:
TextEdit *text_editor;
protected:
void _notification(int p_what);
static void _bind_methods();
Ref<TextEditorSettings> last_opened_files;

View File

@ -26,25 +26,6 @@
#include "scene/gui/text_edit.h"
#include "scene/resources/dynamic_font.h"
void TextFileEditor::_ready() {
if (!Engine::get_singleton()->is_editor_hint()) {
return;
}
clean_editor();
connect_signals();
Array opened_files = last_opened_files->load_opened_files();
for (int i = 0; i < opened_files.size(); ++i) {
Array opened_file = opened_files[i];
open_file(opened_file[1], opened_file[2]);
}
file_list->set_filters(EXTENSIONS);
}
void TextFileEditor::connect_signals() {
file_list->connect("confirmed", this, "update_list");
file_btn_popup->connect("id_pressed", this, "_on_file_btn_pressed");
@ -732,9 +713,28 @@ TextFileEditor::TextFileEditor() {
TextFileEditor::~TextFileEditor() {
}
void TextFileEditor::_bind_methods() {
//ClassDB::bind_method(D_METHOD("_ready"), &TextFileEditor::_ready);
void TextFileEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_POST_ENTER_TREE) {
if (!Engine::get_singleton()->is_editor_hint()) {
return;
}
clean_editor();
connect_signals();
Array opened_files = last_opened_files->load_opened_files();
for (int i = 0; i < opened_files.size(); ++i) {
Array opened_file = opened_files[i];
open_file(opened_file[1], opened_file[2]);
}
file_list->set_filters(EXTENSIONS);
}
}
void TextFileEditor::_bind_methods() {
//ClassDB::bind_method(D_METHOD("connect_signals"), &TextFileEditor::connect_signals);
//ClassDB::bind_method(D_METHOD("create_selected_file"), &TextFileEditor::create_selected_file);
//ClassDB::bind_method(D_METHOD("open_selected_file"), &TextFileEditor::open_selected_file);

View File

@ -37,7 +37,6 @@ public:
FILE_MENU_OPTION_REPLACE = 7,
};
void _ready();
void connect_signals();
void create_selected_file();
@ -84,6 +83,8 @@ public:
~TextFileEditor();
protected:
void _notification(int p_what);
static void _bind_methods();
String DIRECTORY;