mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-12 05:41:15 +01:00
Also renamed classes, fixed include guards, and includes.
This commit is contained in:
parent
2346176cd0
commit
573011b373
@ -1,22 +1,22 @@
|
||||
|
||||
#include "preview.h"
|
||||
#include "text_editor_preview.h"
|
||||
|
||||
#include "scene/gui/grid_container.h"
|
||||
#include "scene/gui/rich_text_label.h"
|
||||
|
||||
#include "modules/regex/regex.h"
|
||||
|
||||
void Preview::print_preview(const String &content) {
|
||||
void TextEditorPreview::print_preview(const String &content) {
|
||||
text_preview->append_bbcode(content);
|
||||
text_preview->show();
|
||||
}
|
||||
|
||||
void Preview::print_bb(const String &content) {
|
||||
void TextEditorPreview::print_bb(const String &content) {
|
||||
text_preview->append_bbcode(content);
|
||||
text_preview->show();
|
||||
}
|
||||
|
||||
void Preview::print_markdown(const String &p_content) {
|
||||
void TextEditorPreview::print_markdown(const String &p_content) {
|
||||
String content = p_content;
|
||||
|
||||
Array result;
|
||||
@ -160,7 +160,7 @@ void Preview::print_markdown(const String &p_content) {
|
||||
text_preview->show();
|
||||
}
|
||||
|
||||
void Preview::print_html(const String &p_content) {
|
||||
void TextEditorPreview::print_html(const String &p_content) {
|
||||
String content = p_content;
|
||||
|
||||
content = content.replace("<i>", "[i]");
|
||||
@ -190,7 +190,7 @@ void Preview::print_html(const String &p_content) {
|
||||
text_preview->show();
|
||||
}
|
||||
|
||||
void Preview::print_csv(const Array &rows) {
|
||||
void TextEditorPreview::print_csv(const Array &rows) {
|
||||
table_preview->set_columns(rows[0].size());
|
||||
|
||||
for (item in rows) {
|
||||
@ -207,11 +207,11 @@ void Preview::print_csv(const Array &rows) {
|
||||
table_preview->show();
|
||||
}
|
||||
|
||||
void Preview::_on_Preview_popup_hide() {
|
||||
void TextEditorPreview::_on_TextEditorPreview_popup_hide() {
|
||||
queue_delete();
|
||||
}
|
||||
|
||||
Preview::Preview() {
|
||||
TextEditorPreview::TextEditorPreview() {
|
||||
set_window_title("File preview");
|
||||
set_resizable(true);
|
||||
set_anchors_and_margins_preset(PRESET_WIDE);
|
||||
@ -238,21 +238,21 @@ Preview::Preview() {
|
||||
table_preview->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
table_preview->hide();
|
||||
|
||||
connect("popup_hide", this, "_on_Preview_popup_hide");
|
||||
connect("popup_hide", this, "_on_TextEditorPreview_popup_hide");
|
||||
}
|
||||
|
||||
Preview::~Preview() {
|
||||
TextEditorPreview::~TextEditorPreview() {
|
||||
}
|
||||
|
||||
void Preview::_bind_methods() {
|
||||
void TextEditorPreview::_bind_methods() {
|
||||
signal image_downloaded();
|
||||
signal image_loaded();
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_init"), &Preview::_init);
|
||||
ClassDB::bind_method(D_METHOD("print_preview", "content"), &Preview::print_preview);
|
||||
ClassDB::bind_method(D_METHOD("print_bb", "content"), &Preview::print_bb);
|
||||
ClassDB::bind_method(D_METHOD("print_markdown", "content"), &Preview::print_markdown);
|
||||
ClassDB::bind_method(D_METHOD("print_html", "content"), &Preview::print_html);
|
||||
ClassDB::bind_method(D_METHOD("print_csv", "rows"), &Preview::print_csv);
|
||||
ClassDB::bind_method(D_METHOD("_on_Preview_popup_hide"), &Preview::_on_Preview_popup_hide);
|
||||
ClassDB::bind_method(D_METHOD("_init"), &TextEditorPreview::_init);
|
||||
ClassDB::bind_method(D_METHOD("print_preview", "content"), &TextEditorPreview::print_preview);
|
||||
ClassDB::bind_method(D_METHOD("print_bb", "content"), &TextEditorPreview::print_bb);
|
||||
ClassDB::bind_method(D_METHOD("print_markdown", "content"), &TextEditorPreview::print_markdown);
|
||||
ClassDB::bind_method(D_METHOD("print_html", "content"), &TextEditorPreview::print_html);
|
||||
ClassDB::bind_method(D_METHOD("print_csv", "rows"), &TextEditorPreview::print_csv);
|
||||
ClassDB::bind_method(D_METHOD("_on_TextEditorPreview_popup_hide"), &TextEditorPreview::_on_TextEditorPreview_popup_hide);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef PREVIEW_H
|
||||
#define PREVIEW_H
|
||||
#ifndef TEXT_EDITOR_PREVIEW_H
|
||||
#define TEXT_EDITOR_PREVIEW_H
|
||||
|
||||
#include "core/ustring.h"
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
class RichTextLabel;
|
||||
class GridContainer;
|
||||
|
||||
class Preview : public WindowDialog {
|
||||
GDCLASS(Preview, WindowDialog);
|
||||
class TextEditorPreview : public WindowDialog {
|
||||
GDCLASS(TextEditorPreview, WindowDialog);
|
||||
|
||||
public:
|
||||
void print_preview(const String &content);
|
||||
@ -17,10 +17,10 @@ public:
|
||||
void print_markdown(const String &content);
|
||||
void print_html(const String &content);
|
||||
void print_csv(const Array &rows);
|
||||
void _on_Preview_popup_hide();
|
||||
void _on_TextEditorPreview_popup_hide();
|
||||
|
||||
Preview();
|
||||
~Preview();
|
||||
TextEditorPreview();
|
||||
~TextEditorPreview();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
@ -1,20 +1,20 @@
|
||||
|
||||
#include "lastopenedfiles.h"
|
||||
#include "text_editor_settings.h"
|
||||
|
||||
#include "editor/editor_settings.h"
|
||||
|
||||
#include "core/variant.h"
|
||||
#include "scene/gui/item_list.h"
|
||||
#include "vanillaeditor.h"
|
||||
#include "text_editor_vanilla_editor.h"
|
||||
|
||||
void LastOpenedFiles::store_opened_files(ItemList *filecontainer) {
|
||||
void TextEditorSettings::store_opened_files(ItemList *filecontainer) {
|
||||
Array arr;
|
||||
|
||||
for (int child = 0; child < filecontainer->get_item_count(); ++child) {
|
||||
Array metaarr = filecontainer->get_item_metadata(child);
|
||||
Variant e = metaarr[0];
|
||||
Control *c = e;
|
||||
VanillaEditor *ed = Object::cast_to<VanillaEditor>(c);
|
||||
TextEditorVanillaEditor *ed = Object::cast_to<TextEditorVanillaEditor>(c);
|
||||
|
||||
String filepath = ed->get_current_path();
|
||||
Array a = Array();
|
||||
@ -26,11 +26,11 @@ void LastOpenedFiles::store_opened_files(ItemList *filecontainer) {
|
||||
EditorSettings::get_singleton()->set_project_metadata("file_editor", "files", arr);
|
||||
}
|
||||
|
||||
void LastOpenedFiles::remove_opened_file(const int index, ItemList *filecontainer) {
|
||||
void TextEditorSettings::remove_opened_file(const int index, ItemList *filecontainer) {
|
||||
Array metaarr = filecontainer->get_item_metadata(index);
|
||||
Variant e = metaarr[0];
|
||||
Control *c = e;
|
||||
VanillaEditor *ed = Object::cast_to<VanillaEditor>(c);
|
||||
TextEditorVanillaEditor *ed = Object::cast_to<TextEditorVanillaEditor>(c);
|
||||
|
||||
String filepath = ed->get_current_path();
|
||||
String f = filepath.get_file();
|
||||
@ -54,7 +54,7 @@ void LastOpenedFiles::remove_opened_file(const int index, ItemList *filecontaine
|
||||
}
|
||||
}
|
||||
|
||||
Array LastOpenedFiles::load_opened_files() {
|
||||
Array TextEditorSettings::load_opened_files() {
|
||||
Array arr = EditorSettings::get_singleton()->get_project_metadata("file_editor", "files", Array());
|
||||
Dictionary fonts_dict = EditorSettings::get_singleton()->get_project_metadata("file_editor", "file_fonts", Dictionary());
|
||||
Array keys;
|
||||
@ -80,26 +80,26 @@ Array LastOpenedFiles::load_opened_files() {
|
||||
return keys;
|
||||
}
|
||||
|
||||
void LastOpenedFiles::store_editor_fonts(const String &file_name, const String &font_path) {
|
||||
void TextEditorSettings::store_editor_fonts(const String &file_name, const String &font_path) {
|
||||
Dictionary fonts_dict = EditorSettings::get_singleton()->get_project_metadata("file_editor", "file_fonts", Dictionary());
|
||||
fonts_dict[file_name] = font_path;
|
||||
EditorSettings::get_singleton()->set_project_metadata("file_editor", "file_fonts", fonts_dict);
|
||||
}
|
||||
|
||||
String LastOpenedFiles::get_editor_font() {
|
||||
String TextEditorSettings::get_editor_font() {
|
||||
return EditorSettings::get_singleton()->get_setting("interface/editor/code_font");
|
||||
}
|
||||
|
||||
LastOpenedFiles::LastOpenedFiles() {
|
||||
TextEditorSettings::TextEditorSettings() {
|
||||
}
|
||||
|
||||
LastOpenedFiles::~LastOpenedFiles() {
|
||||
TextEditorSettings::~TextEditorSettings() {
|
||||
}
|
||||
|
||||
void LastOpenedFiles::_bind_methods() {
|
||||
//ClassDB::bind_method(D_METHOD("store_opened_files", "filecontainer"), &LastOpenedFiles::store_opened_files);
|
||||
//ClassDB::bind_method(D_METHOD("remove_opened_file", "index", "filecontainer"), &LastOpenedFiles::remove_opened_file);
|
||||
//ClassDB::bind_method(D_METHOD("load_opened_files"), &LastOpenedFiles::load_opened_files);
|
||||
//ClassDB::bind_method(D_METHOD("store_editor_fonts", "file_name", "font_path"), &LastOpenedFiles::store_editor_fonts);
|
||||
//ClassDB::bind_method(D_METHOD("get_editor_font"), &LastOpenedFiles::get_editor_font);
|
||||
void TextEditorSettings::_bind_methods() {
|
||||
//ClassDB::bind_method(D_METHOD("store_opened_files", "filecontainer"), &TextEditorSettings::store_opened_files);
|
||||
//ClassDB::bind_method(D_METHOD("remove_opened_file", "index", "filecontainer"), &TextEditorSettings::remove_opened_file);
|
||||
//ClassDB::bind_method(D_METHOD("load_opened_files"), &TextEditorSettings::load_opened_files);
|
||||
//ClassDB::bind_method(D_METHOD("store_editor_fonts", "file_name", "font_path"), &TextEditorSettings::store_editor_fonts);
|
||||
//ClassDB::bind_method(D_METHOD("get_editor_font"), &TextEditorSettings::get_editor_font);
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
#ifndef LASTOPENEDFILES_H
|
||||
#define LASTOPENEDFILES_H
|
||||
#ifndef TEXT_EDITOR_SETTINGS_H
|
||||
#define TEXT_EDITOR_SETTINGS_H
|
||||
|
||||
#include "core/reference.h"
|
||||
|
||||
class ItemList;
|
||||
|
||||
class LastOpenedFiles : public Reference {
|
||||
GDCLASS(LastOpenedFiles, Reference);
|
||||
class TextEditorSettings : public Reference {
|
||||
GDCLASS(TextEditorSettings, Reference);
|
||||
|
||||
public:
|
||||
void store_opened_files(ItemList *filecontainer);
|
||||
@ -15,8 +15,8 @@ public:
|
||||
void store_editor_fonts(const String &file_name, const String &font_path);
|
||||
String get_editor_font();
|
||||
|
||||
LastOpenedFiles();
|
||||
~LastOpenedFiles();
|
||||
TextEditorSettings();
|
||||
~TextEditorSettings();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
#include "vanillaeditor.h"
|
||||
#include "text_editor_vanilla_editor.h"
|
||||
|
||||
#include "core/color.h"
|
||||
#include "core/object.h"
|
||||
#include "lastopenedfiles.h"
|
||||
#include "text_editor_settings.h"
|
||||
|
||||
#include "scene/gui/box_container.h"
|
||||
#include "scene/gui/button.h"
|
||||
@ -16,34 +16,34 @@
|
||||
|
||||
#include "scene/resources/dynamic_font.h"
|
||||
|
||||
String VanillaEditor::get_current_path() {
|
||||
String TextEditorVanillaEditor::get_current_path() {
|
||||
return current_path;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_current_path(const String &val) {
|
||||
void TextEditorVanillaEditor::set_current_path(const String &val) {
|
||||
current_path = val;
|
||||
}
|
||||
|
||||
String VanillaEditor::get_current_filename() {
|
||||
String TextEditorVanillaEditor::get_current_filename() {
|
||||
return current_filename;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_current_filename(const String &val) {
|
||||
void TextEditorVanillaEditor::set_current_filename(const String &val) {
|
||||
current_filename = val;
|
||||
}
|
||||
|
||||
int VanillaEditor::get_search_flag() const {
|
||||
int TextEditorVanillaEditor::get_search_flag() const {
|
||||
return search_flag;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_search_flag(const int val) {
|
||||
void TextEditorVanillaEditor::set_search_flag(const int val) {
|
||||
search_flag = val;
|
||||
}
|
||||
|
||||
void VanillaEditor::_init() {
|
||||
void TextEditorVanillaEditor::_init() {
|
||||
}
|
||||
|
||||
void VanillaEditor::_ready() {
|
||||
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");
|
||||
@ -53,7 +53,7 @@ void VanillaEditor::_ready() {
|
||||
load_default_font();
|
||||
}
|
||||
|
||||
void VanillaEditor::set_font(const String &font_path) {
|
||||
void TextEditorVanillaEditor::set_font(const String &font_path) {
|
||||
Ref<DynamicFont> dynamic_font;
|
||||
Ref<DynamicFontData> dynamic_font_data;
|
||||
|
||||
@ -65,7 +65,7 @@ void VanillaEditor::set_font(const String &font_path) {
|
||||
text_editor->set("custom_fonts/font", dynamic_font);
|
||||
}
|
||||
|
||||
void VanillaEditor::load_default_font() {
|
||||
void TextEditorVanillaEditor::load_default_font() {
|
||||
String default_font = last_opened_files->get_editor_font();
|
||||
|
||||
if (default_font != "") {
|
||||
@ -73,17 +73,17 @@ void VanillaEditor::load_default_font() {
|
||||
}
|
||||
}
|
||||
|
||||
void VanillaEditor::set_wrap_enabled(const bool enabled) {
|
||||
void TextEditorVanillaEditor::set_wrap_enabled(const bool enabled) {
|
||||
text_editor->set_wrap_enabled(enabled);
|
||||
text_editor->update();
|
||||
}
|
||||
|
||||
void VanillaEditor::draw_minimap(const bool value) {
|
||||
void TextEditorVanillaEditor::draw_minimap(const bool value) {
|
||||
text_editor->set_draw_minimap(value);
|
||||
text_editor->update();
|
||||
}
|
||||
|
||||
void VanillaEditor::color_region(const String &fileextension) {
|
||||
void TextEditorVanillaEditor::color_region(const String &fileextension) {
|
||||
if (fileextension == "bbs") {
|
||||
text_editor->add_color_region("[b]", "[/b]", Color::color8(153, 153, 255, 255), false);
|
||||
text_editor->add_color_region("[i]", "[/i]", Color::color8(153, 255, 153, 255), false);
|
||||
@ -133,7 +133,7 @@ void VanillaEditor::color_region(const String &fileextension) {
|
||||
}
|
||||
}
|
||||
|
||||
void VanillaEditor::clean_editor() {
|
||||
void TextEditorVanillaEditor::clean_editor() {
|
||||
text_editor->set_text("");
|
||||
//file_info_last_modified_icon.texture = IconLoader.load_icon_from_name("save");
|
||||
file_info_last_modified->set_text("");
|
||||
@ -142,7 +142,7 @@ void VanillaEditor::clean_editor() {
|
||||
current_path = "";
|
||||
}
|
||||
|
||||
void VanillaEditor::new_file_open(const String &file_content, const Dictionary &last_modified, const String ¤t_file_path) {
|
||||
void TextEditorVanillaEditor::new_file_open(const String &file_content, const Dictionary &last_modified, const String ¤t_file_path) {
|
||||
current_path = current_file_path;
|
||||
current_filename = current_file_path.get_file();
|
||||
color_region(current_filename.get_extension());
|
||||
@ -152,18 +152,18 @@ void VanillaEditor::new_file_open(const String &file_content, const Dictionary &
|
||||
count_characters();
|
||||
}
|
||||
|
||||
void VanillaEditor::update_lastmodified(const Dictionary &last_modified, const String &icon) {
|
||||
void TextEditorVanillaEditor::update_lastmodified(const Dictionary &last_modified, const String &icon) {
|
||||
file_info_last_modified->set_text(str(last_modified.hour) + ":" + str(last_modified.minute) + " " + str(last_modified.day) + "/" + str(last_modified.month) + "/" + str(last_modified.year));
|
||||
}
|
||||
|
||||
//file_info_last_modified_icon.texture = IconLoader.load_icon_from_name(icon);
|
||||
|
||||
void VanillaEditor::new_file_create(const String &file_name) {
|
||||
void TextEditorVanillaEditor::new_file_create(const String &file_name) {
|
||||
text_editor->set_text("");
|
||||
file_list->invalidate();
|
||||
}
|
||||
|
||||
void VanillaEditor::_on_Readonly_toggled(const bool button_pressed) {
|
||||
void TextEditorVanillaEditor::_on_Readonly_toggled(const bool button_pressed) {
|
||||
if (button_pressed) {
|
||||
file_info_read_only->set_text("Read Only");
|
||||
text_editor->set_readonly((true));
|
||||
@ -173,13 +173,13 @@ void VanillaEditor::_on_Readonly_toggled(const bool button_pressed) {
|
||||
}
|
||||
}
|
||||
|
||||
void VanillaEditor::_on_text_editor_text_changed() {
|
||||
void TextEditorVanillaEditor::_on_text_editor_text_changed() {
|
||||
//file_info_last_modified_icon.texture = IconLoader.load_icon_from_name("saveas");
|
||||
count_characters();
|
||||
emit_signal("text_changed");
|
||||
}
|
||||
|
||||
void VanillaEditor::count_characters() {
|
||||
void TextEditorVanillaEditor::count_characters() {
|
||||
int counted = 0;
|
||||
|
||||
for (int line = 0; line < text_editor->get_line_count(); ++line) { //line in range(text_editor.get_line_count())
|
||||
@ -189,7 +189,7 @@ void VanillaEditor::count_characters() {
|
||||
file_info_c_counter->set_text(itos(counted));
|
||||
}
|
||||
|
||||
void VanillaEditor::_on_LineEdit_text_changed(const String &new_text) {
|
||||
void TextEditorVanillaEditor::_on_LineEdit_text_changed(const String &new_text) {
|
||||
int linecount = text_editor->get_line_count();
|
||||
|
||||
if (new_text != "") {
|
||||
@ -216,7 +216,7 @@ void VanillaEditor::_on_LineEdit_text_changed(const String &new_text) {
|
||||
}
|
||||
}
|
||||
|
||||
void VanillaEditor::_on_matchcase_toggled(const bool button_pressed) {
|
||||
void TextEditorVanillaEditor::_on_matchcase_toggled(const bool button_pressed) {
|
||||
if (button_pressed) {
|
||||
search_flag = 1;
|
||||
} else {
|
||||
@ -230,7 +230,7 @@ void VanillaEditor::_on_matchcase_toggled(const bool button_pressed) {
|
||||
_on_LineEdit_text_changed(search_box_line_edit->get_text());
|
||||
}
|
||||
|
||||
void VanillaEditor::_on_wholewords_toggled(const bool button_pressed) {
|
||||
void TextEditorVanillaEditor::_on_wholewords_toggled(const bool button_pressed) {
|
||||
if (button_pressed) {
|
||||
search_flag = 2;
|
||||
} else {
|
||||
@ -244,11 +244,11 @@ void VanillaEditor::_on_wholewords_toggled(const bool button_pressed) {
|
||||
_on_LineEdit_text_changed(search_box_line_edit->get_text());
|
||||
}
|
||||
|
||||
void VanillaEditor::_on_close_pressed() {
|
||||
void TextEditorVanillaEditor::_on_close_pressed() {
|
||||
search_box->hide();
|
||||
}
|
||||
|
||||
void VanillaEditor::open_search_box() {
|
||||
void TextEditorVanillaEditor::open_search_box() {
|
||||
if (search_box->get_visible()) {
|
||||
search_box->hide();
|
||||
} else {
|
||||
@ -257,7 +257,7 @@ void VanillaEditor::open_search_box() {
|
||||
}
|
||||
}
|
||||
|
||||
void VanillaEditor::_on_Button_pressed() {
|
||||
void TextEditorVanillaEditor::_on_Button_pressed() {
|
||||
//int linecount = text_editor->get_line_count() - 1;
|
||||
String old_text = replace_box_replace_le->get_text();
|
||||
String new_text = replace_box_with->get_text();
|
||||
@ -265,7 +265,7 @@ void VanillaEditor::_on_Button_pressed() {
|
||||
text_editor->set_text(text.replace(old_text, new_text));
|
||||
}
|
||||
|
||||
void VanillaEditor::open_replace_box() {
|
||||
void TextEditorVanillaEditor::open_replace_box() {
|
||||
if (replace_box->get_visible()) {
|
||||
replace_box->hide();
|
||||
} else {
|
||||
@ -274,15 +274,15 @@ void VanillaEditor::open_replace_box() {
|
||||
}
|
||||
}
|
||||
|
||||
void VanillaEditor::_on_close2_pressed() {
|
||||
void TextEditorVanillaEditor::_on_close2_pressed() {
|
||||
replace_box->hide();
|
||||
}
|
||||
|
||||
void VanillaEditor::_on_LineEdit_focus_entered() {
|
||||
void TextEditorVanillaEditor::_on_LineEdit_focus_entered() {
|
||||
_on_LineEdit_text_changed(search_box_line_edit->get_text());
|
||||
}
|
||||
|
||||
VanillaEditor::VanillaEditor() {
|
||||
TextEditorVanillaEditor::TextEditorVanillaEditor() {
|
||||
search_flag = 0;
|
||||
|
||||
set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
@ -422,43 +422,43 @@ VanillaEditor::VanillaEditor() {
|
||||
file_info_read_only->set_h_size_flags(SIZE_EXPAND | SIZE_SHRINK_END);
|
||||
}
|
||||
|
||||
VanillaEditor::~VanillaEditor() {
|
||||
TextEditorVanillaEditor::~TextEditorVanillaEditor() {
|
||||
}
|
||||
|
||||
void VanillaEditor::_bind_methods() {
|
||||
void TextEditorVanillaEditor::_bind_methods() {
|
||||
signal text_changed();
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_current_path"), &VanillaEditor::get_current_path);
|
||||
ClassDB::bind_method(D_METHOD("set_current_path", "value"), &VanillaEditor::set_current_path);
|
||||
ClassDB::bind_method(D_METHOD("get_current_path"), &TextEditorVanillaEditor::get_current_path);
|
||||
ClassDB::bind_method(D_METHOD("set_current_path", "value"), &TextEditorVanillaEditor::set_current_path);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_path"), "set_current_path", "get_current_path");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_current_filename"), &VanillaEditor::get_current_filename);
|
||||
ClassDB::bind_method(D_METHOD("set_current_filename", "value"), &VanillaEditor::set_current_filename);
|
||||
ClassDB::bind_method(D_METHOD("get_current_filename"), &TextEditorVanillaEditor::get_current_filename);
|
||||
ClassDB::bind_method(D_METHOD("set_current_filename", "value"), &TextEditorVanillaEditor::set_current_filename);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_filename"), "set_current_filename", "get_current_filename");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_search_flag"), &VanillaEditor::get_search_flag);
|
||||
ClassDB::bind_method(D_METHOD("set_search_flag", "value"), &VanillaEditor::set_search_flag);
|
||||
ClassDB::bind_method(D_METHOD("get_search_flag"), &TextEditorVanillaEditor::get_search_flag);
|
||||
ClassDB::bind_method(D_METHOD("set_search_flag", "value"), &TextEditorVanillaEditor::set_search_flag);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "search_flag"), "set_search_flag", "get_search_flag");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_font", "font_path"), &VanillaEditor::set_font);
|
||||
ClassDB::bind_method(D_METHOD("load_default_font"), &VanillaEditor::load_default_font);
|
||||
ClassDB::bind_method(D_METHOD("set_wrap_enabled", "enabled"), &VanillaEditor::set_wrap_enabled);
|
||||
ClassDB::bind_method(D_METHOD("draw_minimap", "value"), &VanillaEditor::draw_minimap);
|
||||
ClassDB::bind_method(D_METHOD("color_region", "filextension"), &VanillaEditor::color_region);
|
||||
ClassDB::bind_method(D_METHOD("clean_editor"), &VanillaEditor::clean_editor);
|
||||
ClassDB::bind_method(D_METHOD("new_file_open", "file_content", "last_modified", "current_file_path"), &VanillaEditor::new_file_open);
|
||||
ClassDB::bind_method(D_METHOD("update_lastmodified", "last_modified", "icon"), &VanillaEditor::update_lastmodified);
|
||||
ClassDB::bind_method(D_METHOD("new_file_create", "file_name"), &VanillaEditor::new_file_create);
|
||||
ClassDB::bind_method(D_METHOD("_on_Readonly_toggled", "button_pressed"), &VanillaEditor::_on_Readonly_toggled);
|
||||
ClassDB::bind_method(D_METHOD("_on_text_editor_text_changed"), &VanillaEditor::_on_text_editor_text_changed);
|
||||
ClassDB::bind_method(D_METHOD("count_characters"), &VanillaEditor::count_characters);
|
||||
ClassDB::bind_method(D_METHOD("_on_LineEdit_text_changed", "new_text"), &VanillaEditor::_on_LineEdit_text_changed);
|
||||
ClassDB::bind_method(D_METHOD("_on_matchcase_toggled", "button_pressed"), &VanillaEditor::_on_matchcase_toggled);
|
||||
ClassDB::bind_method(D_METHOD("_on_wholewords_toggled", "button_pressed"), &VanillaEditor::_on_wholewords_toggled);
|
||||
ClassDB::bind_method(D_METHOD("_on_close_pressed"), &VanillaEditor::_on_close_pressed);
|
||||
ClassDB::bind_method(D_METHOD("open_search_box"), &VanillaEditor::open_search_box);
|
||||
ClassDB::bind_method(D_METHOD("_on_Button_pressed"), &VanillaEditor::_on_Button_pressed);
|
||||
ClassDB::bind_method(D_METHOD("open_replace_box"), &VanillaEditor::open_replace_box);
|
||||
ClassDB::bind_method(D_METHOD("_on_close2_pressed"), &VanillaEditor::_on_close2_pressed);
|
||||
ClassDB::bind_method(D_METHOD("_on_LineEdit_focus_entered"), &VanillaEditor::_on_LineEdit_focus_entered);
|
||||
ClassDB::bind_method(D_METHOD("set_font", "font_path"), &TextEditorVanillaEditor::set_font);
|
||||
ClassDB::bind_method(D_METHOD("load_default_font"), &TextEditorVanillaEditor::load_default_font);
|
||||
ClassDB::bind_method(D_METHOD("set_wrap_enabled", "enabled"), &TextEditorVanillaEditor::set_wrap_enabled);
|
||||
ClassDB::bind_method(D_METHOD("draw_minimap", "value"), &TextEditorVanillaEditor::draw_minimap);
|
||||
ClassDB::bind_method(D_METHOD("color_region", "filextension"), &TextEditorVanillaEditor::color_region);
|
||||
ClassDB::bind_method(D_METHOD("clean_editor"), &TextEditorVanillaEditor::clean_editor);
|
||||
ClassDB::bind_method(D_METHOD("new_file_open", "file_content", "last_modified", "current_file_path"), &TextEditorVanillaEditor::new_file_open);
|
||||
ClassDB::bind_method(D_METHOD("update_lastmodified", "last_modified", "icon"), &TextEditorVanillaEditor::update_lastmodified);
|
||||
ClassDB::bind_method(D_METHOD("new_file_create", "file_name"), &TextEditorVanillaEditor::new_file_create);
|
||||
ClassDB::bind_method(D_METHOD("_on_Readonly_toggled", "button_pressed"), &TextEditorVanillaEditor::_on_Readonly_toggled);
|
||||
ClassDB::bind_method(D_METHOD("_on_text_editor_text_changed"), &TextEditorVanillaEditor::_on_text_editor_text_changed);
|
||||
ClassDB::bind_method(D_METHOD("count_characters"), &TextEditorVanillaEditor::count_characters);
|
||||
ClassDB::bind_method(D_METHOD("_on_LineEdit_text_changed", "new_text"), &TextEditorVanillaEditor::_on_LineEdit_text_changed);
|
||||
ClassDB::bind_method(D_METHOD("_on_matchcase_toggled", "button_pressed"), &TextEditorVanillaEditor::_on_matchcase_toggled);
|
||||
ClassDB::bind_method(D_METHOD("_on_wholewords_toggled", "button_pressed"), &TextEditorVanillaEditor::_on_wholewords_toggled);
|
||||
ClassDB::bind_method(D_METHOD("_on_close_pressed"), &TextEditorVanillaEditor::_on_close_pressed);
|
||||
ClassDB::bind_method(D_METHOD("open_search_box"), &TextEditorVanillaEditor::open_search_box);
|
||||
ClassDB::bind_method(D_METHOD("_on_Button_pressed"), &TextEditorVanillaEditor::_on_Button_pressed);
|
||||
ClassDB::bind_method(D_METHOD("open_replace_box"), &TextEditorVanillaEditor::open_replace_box);
|
||||
ClassDB::bind_method(D_METHOD("_on_close2_pressed"), &TextEditorVanillaEditor::_on_close2_pressed);
|
||||
ClassDB::bind_method(D_METHOD("_on_LineEdit_focus_entered"), &TextEditorVanillaEditor::_on_LineEdit_focus_entered);
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
#ifndef VANILLA_EDITOR_H
|
||||
#define VANILLA_EDITOR_H
|
||||
#ifndef TEXT_EDITOR_VANILLA_EDITOR_H
|
||||
#define TEXT_EDITOR_VANILLA_EDITOR_H
|
||||
|
||||
#include "core/reference.h"
|
||||
#include "core/ustring.h"
|
||||
|
||||
#include "scene/gui/box_container.h"
|
||||
|
||||
class LastOpenedFiles;
|
||||
class TextEditorSettings;
|
||||
|
||||
class TextEdit;
|
||||
class FileDialog;
|
||||
@ -17,8 +17,8 @@ class Button;
|
||||
class TextureRect;
|
||||
class Label;
|
||||
|
||||
class VanillaEditor : public VBoxContainer {
|
||||
GDCLASS(VanillaEditor, VBoxContainer);
|
||||
class TextEditorVanillaEditor : public VBoxContainer {
|
||||
GDCLASS(TextEditorVanillaEditor, VBoxContainer);
|
||||
|
||||
public:
|
||||
String get_current_path();
|
||||
@ -54,13 +54,13 @@ public:
|
||||
void _on_close2_pressed();
|
||||
void _on_LineEdit_focus_entered();
|
||||
|
||||
VanillaEditor();
|
||||
~VanillaEditor();
|
||||
TextEditorVanillaEditor();
|
||||
~TextEditorVanillaEditor();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
Ref<LastOpenedFiles> last_opened_files;
|
||||
Ref<TextEditorSettings> last_opened_files;
|
||||
|
||||
TextEdit *text_editor;
|
||||
FileDialog *file_list;
|
||||
|
@ -1,10 +1,10 @@
|
||||
|
||||
#include "fileeditor.h"
|
||||
#include "text_file_editor.h"
|
||||
|
||||
#include "core/array.h"
|
||||
#include "core/engine.h"
|
||||
#include "lastopenedfiles.h"
|
||||
#include "vanillaeditor.h"
|
||||
#include "text_editor_settings.h"
|
||||
#include "text_editor_vanilla_editor.h"
|
||||
|
||||
#include "scene/gui/box_container.h"
|
||||
#include "scene/gui/dialogs.h"
|
||||
@ -17,7 +17,7 @@
|
||||
#include "scene/gui/split_container.h"
|
||||
#include "scene/resources/dynamic_font.h"
|
||||
|
||||
void FileEditor::_ready() {
|
||||
void TextFileEditor::_ready() {
|
||||
if (!Engine::get_singleton()->is_editor_hint()) {
|
||||
return;
|
||||
}
|
||||
@ -36,7 +36,7 @@ void FileEditor::_ready() {
|
||||
file_list->set_filters(EXTENSIONS);
|
||||
}
|
||||
|
||||
void FileEditor::connect_signals() {
|
||||
void TextFileEditor::connect_signals() {
|
||||
file_list->connect("confirmed", this, "update_list");
|
||||
file_btn_popup->connect("id_pressed", this, "_on_file_btn_pressed");
|
||||
preview_btn_popup->connect("id_pressed", this, "_on_preview_btn_pressed");
|
||||
@ -47,7 +47,7 @@ void FileEditor::connect_signals() {
|
||||
select_font_dialog->connect("file_selected", this, "_on_font_selected");
|
||||
}
|
||||
|
||||
void FileEditor::create_selected_file() {
|
||||
void TextFileEditor::create_selected_file() {
|
||||
update_list();
|
||||
|
||||
file_list->set_mode(FileDialog::MODE_SAVE_FILE);
|
||||
@ -68,7 +68,7 @@ void FileEditor::create_selected_file() {
|
||||
open_file_list();
|
||||
}
|
||||
|
||||
void FileEditor::open_selected_file() {
|
||||
void TextFileEditor::open_selected_file() {
|
||||
update_list();
|
||||
|
||||
file_list->set_mode(FileDialog::MODE_OPEN_FILE);
|
||||
@ -89,7 +89,7 @@ void FileEditor::open_selected_file() {
|
||||
open_file_list();
|
||||
}
|
||||
|
||||
void FileEditor::delete_selected_file() {
|
||||
void TextFileEditor::delete_selected_file() {
|
||||
update_list();
|
||||
|
||||
file_list->set_mode(FileDialog::MODE_OPEN_FILES);
|
||||
@ -110,7 +110,7 @@ void FileEditor::delete_selected_file() {
|
||||
open_file_list();
|
||||
}
|
||||
|
||||
void FileEditor::save_current_file_as() {
|
||||
void TextFileEditor::save_current_file_as() {
|
||||
update_list();
|
||||
|
||||
file_list->set_mode(FileDialog::MODE_SAVE_FILE);
|
||||
@ -131,7 +131,7 @@ void FileEditor::save_current_file_as() {
|
||||
open_file_list();
|
||||
}
|
||||
|
||||
void FileEditor::_on_file_btn_pressed(const int index) {
|
||||
void TextFileEditor::_on_file_btn_pressed(const int index) {
|
||||
switch (index) {
|
||||
case FILE_MENU_OPTION_NEW: {
|
||||
create_selected_file();
|
||||
@ -171,7 +171,7 @@ void FileEditor::_on_file_btn_pressed(const int index) {
|
||||
}
|
||||
}
|
||||
|
||||
void FileEditor::_on_preview_btn_pressed(const int id) {
|
||||
void TextFileEditor::_on_preview_btn_pressed(const int id) {
|
||||
if (id == 0) {
|
||||
bbcode_preview();
|
||||
} else if (id == 1) {
|
||||
@ -183,18 +183,18 @@ void FileEditor::_on_preview_btn_pressed(const int id) {
|
||||
}
|
||||
}
|
||||
|
||||
void FileEditor::_on_settings_btn_pressed(const int index) {
|
||||
void TextFileEditor::_on_settings_btn_pressed(const int index) {
|
||||
if (index == 0) {
|
||||
select_font_dialog->popup();
|
||||
}
|
||||
}
|
||||
|
||||
void FileEditor::_on_font_selected(const String &font_path) {
|
||||
void TextFileEditor::_on_font_selected(const String &font_path) {
|
||||
current_editor->set_font(font_path);
|
||||
last_opened_files->store_editor_fonts(current_file_path.get_file(), font_path);
|
||||
}
|
||||
|
||||
void FileEditor::_on_fileitem_pressed(const int index) {
|
||||
void TextFileEditor::_on_fileitem_pressed(const int index) {
|
||||
current_file_index = index;
|
||||
Array selected_item_metadata = open_file_list->get_item_metadata(current_file_index);
|
||||
String extension = selected_item_metadata[0].current_path.get_file().get_extension();
|
||||
@ -230,10 +230,10 @@ void FileEditor::_on_fileitem_pressed(const int index) {
|
||||
}
|
||||
}
|
||||
|
||||
void FileEditor::open_file(const String &path, const String &font) {
|
||||
void TextFileEditor::open_file(const String &path, const String &font) {
|
||||
if (current_file_path != path) {
|
||||
current_file_path = path;
|
||||
VanillaEditor *vanilla_editor = open_in_vanillaeditor(path);
|
||||
TextEditorVanillaEditor *vanilla_editor = open_in_vanillaeditor(path);
|
||||
|
||||
if (font != "null" && vanilla_editor.get("custom_fonts/font") != nullptr) {
|
||||
vanilla_editor->set_font(font);
|
||||
@ -246,7 +246,7 @@ void FileEditor::open_file(const String &path, const String &font) {
|
||||
current_editor->show();
|
||||
}
|
||||
|
||||
void FileEditor::generate_file_item(const String &path, const Control &veditor) {
|
||||
void TextFileEditor::generate_file_item(const String &path, const Control &veditor) {
|
||||
open_file_name->set_text(path);
|
||||
_open_file_list->add_item(path.get_file(), nullptr, true);
|
||||
current_file_index = _open_file_list.get_item_count() - 1;
|
||||
@ -254,9 +254,9 @@ void FileEditor::generate_file_item(const String &path, const Control &veditor)
|
||||
_open_file_list->select(_open_file_list->get_item_count() - 1);
|
||||
}
|
||||
|
||||
Control FileEditor::open_in_vanillaeditor(const String &path) {
|
||||
Control *editor = VanillaEditor.new();
|
||||
editor.last_opened_files = LastOpenedFiles;
|
||||
Control TextFileEditor::open_in_vanillaeditor(const String &path) {
|
||||
Control *editor = TextEditorVanillaEditor.new();
|
||||
editor.last_opened_files = TextEditorSettings;
|
||||
editor.file_list = file_list;
|
||||
split_editor_container.add_child(editor, true);
|
||||
|
||||
@ -285,7 +285,7 @@ Control FileEditor::open_in_vanillaeditor(const String &path) {
|
||||
return editor;
|
||||
}
|
||||
|
||||
void FileEditor::close_file(const int index) {
|
||||
void TextFileEditor::close_file(const int index) {
|
||||
if (editing_file) {
|
||||
confirmation_close.popup();
|
||||
} else {
|
||||
@ -293,7 +293,7 @@ void FileEditor::close_file(const int index) {
|
||||
}
|
||||
}
|
||||
|
||||
void FileEditor::confirm_close(const int index) {
|
||||
void TextFileEditor::confirm_close(const int index) {
|
||||
last_opened_files->remove_opened_file(index, open_file_list);
|
||||
open_file_list->remove_item(index);
|
||||
open_file_name->clear();
|
||||
@ -305,7 +305,7 @@ void FileEditor::confirm_close(const int index) {
|
||||
}
|
||||
}
|
||||
|
||||
void FileEditor::_on_update_file() {
|
||||
void TextFileEditor::_on_update_file() {
|
||||
File *current_file = memnew(File);
|
||||
current_file.open(current_file_path, File.READ);
|
||||
|
||||
@ -315,7 +315,7 @@ void FileEditor::_on_update_file() {
|
||||
current_editor->new_file_open(current_content, last_modified, current_file_path);
|
||||
}
|
||||
|
||||
void FileEditor::delete_file(const PoolStringArray &files_selected) {
|
||||
void TextFileEditor::delete_file(const PoolStringArray &files_selected) {
|
||||
Directory dir = Directory.new();
|
||||
|
||||
for (file in files_selected) {
|
||||
@ -325,18 +325,18 @@ void FileEditor::delete_file(const PoolStringArray &files_selected) {
|
||||
update_list();
|
||||
}
|
||||
|
||||
void FileEditor::open_new_file_dialogue() {
|
||||
void TextFileEditor::open_new_file_dialogue() {
|
||||
new_file_dialogue.popup();
|
||||
new_file_dialogue.set_position(OS::get_singleton()->get_screen_size() / 2 - new_file_dialogue->get_size() / 2);
|
||||
}
|
||||
|
||||
void FileEditor::open_file_list() {
|
||||
void TextFileEditor::open_file_list() {
|
||||
update_list();
|
||||
file_list.popup();
|
||||
file_list.set_position(OS::get_singleton()->get_screen_size() / 2 - file_list->get_size() / 2);
|
||||
}
|
||||
|
||||
void FileEditor::create_new_file(const String &given_path) {
|
||||
void TextFileEditor::create_new_file(const String &given_path) {
|
||||
File *current_file = File.new();
|
||||
current_file.open(given_path, File.WRITE);
|
||||
|
||||
@ -348,7 +348,7 @@ void FileEditor::create_new_file(const String &given_path) {
|
||||
open_file(given_path);
|
||||
}
|
||||
|
||||
void FileEditor::save_file(const String ¤t_path) {
|
||||
void TextFileEditor::save_file(const String ¤t_path) {
|
||||
//print("Saving file: ", current_path);
|
||||
|
||||
File *current_file = File.new();
|
||||
@ -377,7 +377,7 @@ void FileEditor::save_file(const String ¤t_path) {
|
||||
update_list();
|
||||
}
|
||||
|
||||
void FileEditor::clean_editor() {
|
||||
void TextFileEditor::clean_editor() {
|
||||
Array nodes = get_tree()->get_nodes_in_group("vanilla_editor");
|
||||
|
||||
for (int i = 0; i < nodes.size(); ++i) { //i in range(nodes.size())
|
||||
@ -389,8 +389,8 @@ void FileEditor::clean_editor() {
|
||||
open_file_list.clear();
|
||||
}
|
||||
|
||||
void FileEditor::csv_preview() {
|
||||
Preview *preview = memnew(Preview);
|
||||
void TextFileEditor::csv_preview() {
|
||||
TextEditorPreview *preview = memnew(TextEditorPreview);
|
||||
get_parent().get_parent().get_parent().add_child(preview);
|
||||
preview->popup();
|
||||
preview->set_window_title(" (" + current_file_path.get_file() + ")");
|
||||
@ -404,42 +404,42 @@ void FileEditor::csv_preview() {
|
||||
preview.print_csv(rows);
|
||||
}
|
||||
|
||||
void FileEditor::bbcode_preview() {
|
||||
Preview *preview = memnew(Preview);
|
||||
void TextFileEditor::bbcode_preview() {
|
||||
TextEditorPreview *preview = memnew(TextEditorPreview);
|
||||
get_parent().get_parent().get_parent().add_child(preview);
|
||||
preview->popup();
|
||||
preview->set_window_title(" (" + current_file_path.get_file() + ")");
|
||||
preview->print_bb(current_editor.text_editor.get_text());
|
||||
}
|
||||
|
||||
void FileEditor::markdown_preview() {
|
||||
Preview *preview = memnew(Preview);
|
||||
void TextFileEditor::markdown_preview() {
|
||||
TextEditorPreview *preview = memnew(TextEditorPreview);
|
||||
get_parent().get_parent().get_parent().add_child(preview);
|
||||
preview->popup();
|
||||
preview->set_window_title(" (" + current_file_path.get_file() + ")");
|
||||
preview->print_markdown(current_editor.text_editor.get_text());
|
||||
}
|
||||
|
||||
void FileEditor::html_preview() {
|
||||
Preview *preview = memnew(Preview);
|
||||
void TextFileEditor::html_preview() {
|
||||
TextEditorPreview *preview = memnew(TextEditorPreview);
|
||||
get_parent().get_parent().get_parent().add_child(preview);
|
||||
preview->popup();
|
||||
preview->set_window_title(" (" + current_file_path.get_file() + ")");
|
||||
preview->print_html(current_editor.text_editor.get_text());
|
||||
}
|
||||
|
||||
void FileEditor::_on_vanillaeditor_text_changed() {
|
||||
void TextFileEditor::_on_vanillaeditor_text_changed() {
|
||||
if (!open_file_list->get_item_text(current_file_index).begins_with("(*)")) {
|
||||
open_file_list->set_item_text(current_file_index, "(*)" + open_file_list.get_item_text(current_file_index));
|
||||
editing_file = true;
|
||||
}
|
||||
}
|
||||
|
||||
void FileEditor::update_list() {
|
||||
void TextFileEditor::update_list() {
|
||||
file_list->invalidate();
|
||||
}
|
||||
|
||||
void FileEditor::on_wrap_button(const int index) {
|
||||
void TextFileEditor::on_wrap_button(const int index) {
|
||||
switch (index) {
|
||||
case 0: {
|
||||
current_editor.set_wrap_enabled(false);
|
||||
@ -452,7 +452,7 @@ void FileEditor::on_wrap_button(const int index) {
|
||||
}
|
||||
}
|
||||
|
||||
void FileEditor::on_minimap_button(const int index) {
|
||||
void TextFileEditor::on_minimap_button(const int index) {
|
||||
switch (index) {
|
||||
case 0: {
|
||||
current_editor.draw_minimap(false);
|
||||
@ -465,15 +465,15 @@ void FileEditor::on_minimap_button(const int index) {
|
||||
}
|
||||
}
|
||||
|
||||
void FileEditor::check_file_preview(const String &file) {
|
||||
void TextFileEditor::check_file_preview(const String &file) {
|
||||
// check whether the opened file has a corresponding preview session for its extension;
|
||||
}
|
||||
|
||||
void FileEditor::_on_ConfirmationDialog_confirmed() {
|
||||
void TextFileEditor::_on_ConfirmationDialog_confirmed() {
|
||||
confirm_close(current_file_index);
|
||||
}
|
||||
|
||||
FileEditor::FileEditor() {
|
||||
TextFileEditor::TextFileEditor() {
|
||||
last_opened_files.instance();
|
||||
|
||||
DIRECTORY = "res://";
|
||||
@ -567,16 +567,16 @@ FileEditor::FileEditor() {
|
||||
hotkey->set_control(true);
|
||||
file_btn_popup->add_item("Replace occurencies", FILE_MENU_OPTION_REPLACE, hotkey->get_scancode_with_modifiers());
|
||||
|
||||
//Preview;
|
||||
//TextEditorPreview;
|
||||
preview_btn = memnew(MenuButton);
|
||||
tob_bar->add_child(preview_btn);
|
||||
preview_btn->set_text("Preview");
|
||||
preview_btn->set_text("TextEditorPreview");
|
||||
|
||||
preview_btn_popup = preview_btn->get_popup();
|
||||
preview_btn_popup->add_item("BBCode Preview");
|
||||
preview_btn_popup->add_item("Markdown Preview");
|
||||
preview_btn_popup->add_item("HTML Preview");
|
||||
preview_btn_popup->add_item("CSV Preview");
|
||||
preview_btn_popup->add_item("BBCode TextEditorPreview");
|
||||
preview_btn_popup->add_item("Markdown TextEditorPreview");
|
||||
preview_btn_popup->add_item("HTML TextEditorPreview");
|
||||
preview_btn_popup->add_item("CSV TextEditorPreview");
|
||||
|
||||
//Settings;
|
||||
settings_btn = memnew(MenuButton);
|
||||
@ -694,50 +694,50 @@ FileEditor::FileEditor() {
|
||||
select_font_dialog->set_filters(farr);
|
||||
}
|
||||
|
||||
FileEditor::~FileEditor() {
|
||||
TextFileEditor::~TextFileEditor() {
|
||||
}
|
||||
|
||||
void FileEditor::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_ready"), &FileEditor::_ready);
|
||||
void TextFileEditor::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_ready"), &TextFileEditor::_ready);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("connect_signals"), &FileEditor::connect_signals);
|
||||
ClassDB::bind_method(D_METHOD("create_selected_file"), &FileEditor::create_selected_file);
|
||||
ClassDB::bind_method(D_METHOD("open_selected_file"), &FileEditor::open_selected_file);
|
||||
ClassDB::bind_method(D_METHOD("delete_selected_file"), &FileEditor::delete_selected_file);
|
||||
ClassDB::bind_method(D_METHOD("save_current_file_as"), &FileEditor::save_current_file_as);
|
||||
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);
|
||||
ClassDB::bind_method(D_METHOD("delete_selected_file"), &TextFileEditor::delete_selected_file);
|
||||
ClassDB::bind_method(D_METHOD("save_current_file_as"), &TextFileEditor::save_current_file_as);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_on_file_btn_pressed", "index"), &FileEditor::_on_file_btn_pressed);
|
||||
ClassDB::bind_method(D_METHOD("_on_preview_btn_pressed", "id"), &FileEditor::_on_preview_btn_pressed);
|
||||
ClassDB::bind_method(D_METHOD("_on_settings_btn_pressed", "index"), &FileEditor::_on_settings_btn_pressed);
|
||||
ClassDB::bind_method(D_METHOD("_on_font_selected", "font_path"), &FileEditor::_on_font_selected);
|
||||
ClassDB::bind_method(D_METHOD("_on_fileitem_pressed", "index"), &FileEditor::_on_fileitem_pressed);
|
||||
ClassDB::bind_method(D_METHOD("_on_file_btn_pressed", "index"), &TextFileEditor::_on_file_btn_pressed);
|
||||
ClassDB::bind_method(D_METHOD("_on_preview_btn_pressed", "id"), &TextFileEditor::_on_preview_btn_pressed);
|
||||
ClassDB::bind_method(D_METHOD("_on_settings_btn_pressed", "index"), &TextFileEditor::_on_settings_btn_pressed);
|
||||
ClassDB::bind_method(D_METHOD("_on_font_selected", "font_path"), &TextFileEditor::_on_font_selected);
|
||||
ClassDB::bind_method(D_METHOD("_on_fileitem_pressed", "index"), &TextFileEditor::_on_fileitem_pressed);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("open_file", "path", "font"), &FileEditor::open_file, "null");
|
||||
ClassDB::bind_method(D_METHOD("generate_file_item", "path", "veditor"), &FileEditor::generate_file_item);
|
||||
ClassDB::bind_method(D_METHOD("open_in_vanillaeditor", "path"), &FileEditor::open_in_vanillaeditor);
|
||||
ClassDB::bind_method(D_METHOD("open_file", "path", "font"), &TextFileEditor::open_file, "null");
|
||||
ClassDB::bind_method(D_METHOD("generate_file_item", "path", "veditor"), &TextFileEditor::generate_file_item);
|
||||
ClassDB::bind_method(D_METHOD("open_in_vanillaeditor", "path"), &TextFileEditor::open_in_vanillaeditor);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("close_file", "index"), &FileEditor::close_file);
|
||||
ClassDB::bind_method(D_METHOD("confirm_close", "index"), &FileEditor::confirm_close);
|
||||
ClassDB::bind_method(D_METHOD("_on_update_file"), &FileEditor::_on_update_file);
|
||||
ClassDB::bind_method(D_METHOD("close_file", "index"), &TextFileEditor::close_file);
|
||||
ClassDB::bind_method(D_METHOD("confirm_close", "index"), &TextFileEditor::confirm_close);
|
||||
ClassDB::bind_method(D_METHOD("_on_update_file"), &TextFileEditor::_on_update_file);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("delete_file", "files_selected"), &FileEditor::delete_file);
|
||||
ClassDB::bind_method(D_METHOD("open_new_file_dialogue"), &FileEditor::open_new_file_dialogue);
|
||||
ClassDB::bind_method(D_METHOD("open_file_list"), &FileEditor::open_file_list);
|
||||
ClassDB::bind_method(D_METHOD("create_new_file", "given_path"), &FileEditor::create_new_file);
|
||||
ClassDB::bind_method(D_METHOD("save_file", "current_path"), &FileEditor::save_file);
|
||||
ClassDB::bind_method(D_METHOD("delete_file", "files_selected"), &TextFileEditor::delete_file);
|
||||
ClassDB::bind_method(D_METHOD("open_new_file_dialogue"), &TextFileEditor::open_new_file_dialogue);
|
||||
ClassDB::bind_method(D_METHOD("open_file_list"), &TextFileEditor::open_file_list);
|
||||
ClassDB::bind_method(D_METHOD("create_new_file", "given_path"), &TextFileEditor::create_new_file);
|
||||
ClassDB::bind_method(D_METHOD("save_file", "current_path"), &TextFileEditor::save_file);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("clean_editor"), &FileEditor::clean_editor);
|
||||
ClassDB::bind_method(D_METHOD("csv_preview"), &FileEditor::csv_preview);
|
||||
ClassDB::bind_method(D_METHOD("bbcode_preview"), &FileEditor::bbcode_preview);
|
||||
ClassDB::bind_method(D_METHOD("markdown_preview"), &FileEditor::markdown_preview);
|
||||
ClassDB::bind_method(D_METHOD("html_preview"), &FileEditor::html_preview);
|
||||
ClassDB::bind_method(D_METHOD("clean_editor"), &TextFileEditor::clean_editor);
|
||||
ClassDB::bind_method(D_METHOD("csv_preview"), &TextFileEditor::csv_preview);
|
||||
ClassDB::bind_method(D_METHOD("bbcode_preview"), &TextFileEditor::bbcode_preview);
|
||||
ClassDB::bind_method(D_METHOD("markdown_preview"), &TextFileEditor::markdown_preview);
|
||||
ClassDB::bind_method(D_METHOD("html_preview"), &TextFileEditor::html_preview);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_on_vanillaeditor_text_changed"), &FileEditor::_on_vanillaeditor_text_changed);
|
||||
ClassDB::bind_method(D_METHOD("update_list"), &FileEditor::update_list);
|
||||
ClassDB::bind_method(D_METHOD("_on_vanillaeditor_text_changed"), &TextFileEditor::_on_vanillaeditor_text_changed);
|
||||
ClassDB::bind_method(D_METHOD("update_list"), &TextFileEditor::update_list);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("on_wrap_button", "index"), &FileEditor::on_wrap_button);
|
||||
ClassDB::bind_method(D_METHOD("on_minimap_button", "index"), &FileEditor::on_minimap_button);
|
||||
ClassDB::bind_method(D_METHOD("check_file_preview", "file"), &FileEditor::check_file_preview);
|
||||
ClassDB::bind_method(D_METHOD("on_wrap_button", "index"), &TextFileEditor::on_wrap_button);
|
||||
ClassDB::bind_method(D_METHOD("on_minimap_button", "index"), &TextFileEditor::on_minimap_button);
|
||||
ClassDB::bind_method(D_METHOD("check_file_preview", "file"), &TextFileEditor::check_file_preview);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_on_ConfirmationDialog_confirmed"), &FileEditor::_on_ConfirmationDialog_confirmed);
|
||||
ClassDB::bind_method(D_METHOD("_on_ConfirmationDialog_confirmed"), &TextFileEditor::_on_ConfirmationDialog_confirmed);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef FILEEDITOR_H
|
||||
#define FILEEDITOR_H
|
||||
#ifndef TEXT_FILE_EDITOR_H
|
||||
#define TEXT_FILE_EDITOR_H
|
||||
|
||||
#include "core/reference.h"
|
||||
#include "core/ustring.h"
|
||||
@ -18,12 +18,12 @@ class OptionButton;
|
||||
class FileDialog;
|
||||
class AcceptDialog;
|
||||
class ConfirmationDialog;
|
||||
class LastOpenedFiles;
|
||||
class TextEditorSettings;
|
||||
class DynamicFont;
|
||||
class VanillaEditor;
|
||||
class TextEditorVanillaEditor;
|
||||
|
||||
class FileEditor : public Control {
|
||||
GDCLASS(FileEditor, Control);
|
||||
class TextFileEditor : public Control {
|
||||
GDCLASS(TextFileEditor, Control);
|
||||
|
||||
public:
|
||||
enum FileMenuOptions {
|
||||
@ -53,7 +53,7 @@ public:
|
||||
|
||||
void open_file(const String &path, const String &font = "null");
|
||||
void generate_file_item(const String &path, Control *veditor);
|
||||
VanillaEditor *open_in_vanillaeditor(const String &path);
|
||||
TextEditorVanillaEditor *open_in_vanillaeditor(const String &path);
|
||||
void close_file(const int index);
|
||||
void confirm_close(const int index);
|
||||
|
||||
@ -80,8 +80,8 @@ public:
|
||||
|
||||
void _on_ConfirmationDialog_confirmed();
|
||||
|
||||
FileEditor();
|
||||
~FileEditor();
|
||||
TextFileEditor();
|
||||
~TextFileEditor();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
@ -112,7 +112,7 @@ protected:
|
||||
ConfirmationDialog *confirmation_close;
|
||||
FileDialog *select_font_dialog;
|
||||
|
||||
Ref<LastOpenedFiles> last_opened_files;
|
||||
Ref<TextEditorSettings> last_opened_files;
|
||||
|
||||
Array directories;
|
||||
Array files;
|
||||
@ -121,7 +121,7 @@ protected:
|
||||
String current_file_path;
|
||||
bool save_as;
|
||||
|
||||
VanillaEditor *current_editor;
|
||||
TextEditorVanillaEditor *current_editor;
|
||||
|
||||
Ref<DynamicFont> current_font;
|
||||
bool editing_file;
|
||||
|
Loading…
Reference in New Issue
Block a user