mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-02-02 14:25:55 +01:00
Used the gdscript to cpp converter script to turn https://github.com/Relintai/godot-engine.file-editor into a module.
This commit is contained in:
parent
bbe6fdcc68
commit
d8f28e77fd
22
modules/text_editor/LICENSE
Normal file
22
modules/text_editor/LICENSE
Normal file
@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 fenix-hub
|
||||
Copyright (c) 2022 Péter Magyar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
10
modules/text_editor/SCsub
Normal file
10
modules/text_editor/SCsub
Normal file
@ -0,0 +1,10 @@
|
||||
import os
|
||||
|
||||
Import('env')
|
||||
|
||||
module_env = env.Clone()
|
||||
|
||||
module_env.add_source_files(env.modules_sources,"register_types.cpp")
|
||||
|
||||
#if env["tools"]:
|
||||
# module_env.add_source_files(env.modules_sources,"paint_editor_plugin.cpp")
|
16
modules/text_editor/config.py
Normal file
16
modules/text_editor/config.py
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
def can_build(env, platform):
|
||||
return True
|
||||
|
||||
|
||||
def configure(env):
|
||||
pass
|
||||
|
||||
|
||||
def get_doc_classes():
|
||||
return [
|
||||
]
|
||||
|
||||
def get_doc_path():
|
||||
return "doc_classes"
|
110
modules/text_editor/file-editor.cpp
Normal file
110
modules/text_editor/file-editor.cpp
Normal file
@ -0,0 +1,110 @@
|
||||
|
||||
#include "file-editor.h"
|
||||
|
||||
|
||||
Variant File-editor::get_Variant() {
|
||||
return Variant;
|
||||
}
|
||||
|
||||
void File-editor::set_Variant(const Variant &val) {
|
||||
Variant = val;
|
||||
}
|
||||
|
||||
|
||||
Variant File-editor::get_Variant() {
|
||||
return Variant;
|
||||
}
|
||||
|
||||
void File-editor::set_Variant(const Variant &val) {
|
||||
Variant = val;
|
||||
}
|
||||
|
||||
|
||||
Variant File-editor::get_Variant() {
|
||||
return Variant;
|
||||
}
|
||||
|
||||
void File-editor::set_Variant(const Variant &val) {
|
||||
Variant = val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//tool;
|
||||
//var IconLoader = preload("res://addons/file-editor/scripts/IconLoader.gd").new();
|
||||
//var LastOpenedFiles = preload("res://addons/file-editor/scripts/LastOpenedFiles.gd").new();
|
||||
Variant ;
|
||||
|
||||
void File-editor::_enter_tree() {
|
||||
LastOpenedFiles.editor_plugin = self;
|
||||
LastOpenedFiles.editor_settings = get_editor_interface().get_editor_settings();
|
||||
FileEditor = preload("res://addons/file-editor/scripts/FileEditor.gd").new();
|
||||
FileEditor.LastOpenedFiles = LastOpenedFiles;
|
||||
get_editor_interface().get_editor_viewport().add_child(FileEditor);
|
||||
FileEditor.hide();
|
||||
}
|
||||
|
||||
|
||||
void File-editor::_exit_tree() {
|
||||
get_editor_interface().get_editor_viewport().remove_child(FileEditor);
|
||||
}
|
||||
|
||||
|
||||
void File-editor::has_main_screen() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void File-editor::get_plugin_name() {
|
||||
return "File";
|
||||
}
|
||||
|
||||
|
||||
void File-editor::get_plugin_icon() {
|
||||
return IconLoader.load_icon_from_name("file");
|
||||
}
|
||||
|
||||
|
||||
void File-editor::make_visible(const Variant &visible) {
|
||||
FileEditor.visible = visible;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File-editor::File-editor() {
|
||||
//var IconLoader = preload("res://addons/file-editor/scripts/IconLoader.gd").new();
|
||||
//var LastOpenedFiles = preload("res://addons/file-editor/scripts/LastOpenedFiles.gd").new();
|
||||
;
|
||||
}
|
||||
|
||||
File-editor::~File-editor() {
|
||||
}
|
||||
|
||||
|
||||
static void File-editor::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_Variant"), &File-editor::get_Variant);
|
||||
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &File-editor::set_Variant);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_Variant"), &File-editor::get_Variant);
|
||||
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &File-editor::set_Variant);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_Variant"), &File-editor::get_Variant);
|
||||
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &File-editor::set_Variant);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_enter_tree"), &File-editor::_enter_tree);
|
||||
ClassDB::bind_method(D_METHOD("_exit_tree"), &File-editor::_exit_tree);
|
||||
ClassDB::bind_method(D_METHOD("has_main_screen"), &File-editor::has_main_screen);
|
||||
ClassDB::bind_method(D_METHOD("get_plugin_name"), &File-editor::get_plugin_name);
|
||||
ClassDB::bind_method(D_METHOD("get_plugin_icon"), &File-editor::get_plugin_icon);
|
||||
ClassDB::bind_method(D_METHOD("make_visible", "visible"), &File-editor::make_visible);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
39
modules/text_editor/file-editor.h
Normal file
39
modules/text_editor/file-editor.h
Normal file
@ -0,0 +1,39 @@
|
||||
#ifndef FILE-EDITOR_H
|
||||
#define FILE-EDITOR_H
|
||||
|
||||
|
||||
class File-editor : public EditorPlugin {
|
||||
GDCLASS(File-editor, EditorPlugin);
|
||||
|
||||
public:
|
||||
|
||||
Variant get_Variant();
|
||||
void set_Variant(const Variant &val);
|
||||
|
||||
Variant get_Variant();
|
||||
void set_Variant(const Variant &val);
|
||||
|
||||
Variant get_Variant();
|
||||
void set_Variant(const Variant &val);
|
||||
|
||||
void _enter_tree();
|
||||
void _exit_tree();
|
||||
void has_main_screen();
|
||||
void get_plugin_name();
|
||||
void get_plugin_icon();
|
||||
void make_visible(const Variant &visible);
|
||||
|
||||
File-editor();
|
||||
~File-editor();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
//tool
|
||||
Variant = preload("res://addons/file-editor/scripts/IconLoader.gd").new();
|
||||
Variant = preload("res://addons/file-editor/scripts/LastOpenedFiles.gd").new();
|
||||
Variant ;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
1306
modules/text_editor/fileeditor.cpp
Normal file
1306
modules/text_editor/fileeditor.cpp
Normal file
File diff suppressed because it is too large
Load Diff
216
modules/text_editor/fileeditor.h
Normal file
216
modules/text_editor/fileeditor.h
Normal file
@ -0,0 +1,216 @@
|
||||
#ifndef FILEEDITOR_H
|
||||
#define FILEEDITOR_H
|
||||
|
||||
|
||||
class FileEditor : public Control {
|
||||
GDCLASS(FileEditor, Control);
|
||||
|
||||
public:
|
||||
|
||||
String get_DIRECTORY();
|
||||
void set_DIRECTORY(const String &val);
|
||||
|
||||
String get_EXCEPTIONS();
|
||||
void set_EXCEPTIONS(const String &val);
|
||||
|
||||
PoolStringArray get_EXTENSIONS();
|
||||
void set_EXTENSIONS(const PoolStringArray &val);
|
||||
|
||||
MenuButton get_*file_btn();
|
||||
void set_*file_btn(const MenuButton &val);
|
||||
|
||||
MenuButton get_*preview_btn();
|
||||
void set_*preview_btn(const MenuButton &val);
|
||||
|
||||
MenuButton get_*settings_btn();
|
||||
void set_*settings_btn(const MenuButton &val);
|
||||
|
||||
PopupMenu get_*file_btn_popup();
|
||||
void set_*file_btn_popup(const PopupMenu &val);
|
||||
|
||||
PopupMenu get_*preview_btn_popup();
|
||||
void set_*preview_btn_popup(const PopupMenu &val);
|
||||
|
||||
PopupMenu get_*settings_btn_popup();
|
||||
void set_*settings_btn_popup(const PopupMenu &val);
|
||||
|
||||
HSplitContainer get_*editor_container();
|
||||
void set_*editor_container(const HSplitContainer &val);
|
||||
|
||||
VBoxContainer get_*file_container();
|
||||
void set_*file_container(const VBoxContainer &val);
|
||||
|
||||
ItemList get_*open_file_list();
|
||||
void set_*open_file_list(const ItemList &val);
|
||||
|
||||
VBoxContainer get_*split_editor_container();
|
||||
void set_*split_editor_container(const VBoxContainer &val);
|
||||
|
||||
LineEdit get_*open_file_name();
|
||||
void set_*open_file_name(const LineEdit &val);
|
||||
|
||||
OptionButton get_*wrap_btn();
|
||||
void set_*wrap_btn(const OptionButton &val);
|
||||
|
||||
OptionButton get_*map_btn();
|
||||
void set_*map_btn(const OptionButton &val);
|
||||
|
||||
FileDialog get_*file_list();
|
||||
void set_*file_list(const FileDialog &val);
|
||||
|
||||
AcceptDialog get_*new_file_dialogue();
|
||||
void set_*new_file_dialogue(const AcceptDialog &val);
|
||||
|
||||
LineEdit get_*new_file_dialogue_name();
|
||||
void set_*new_file_dialogue_name(const LineEdit &val);
|
||||
|
||||
ConfirmationDialog get_*confirmation_close();
|
||||
void set_*confirmation_close(const ConfirmationDialog &val);
|
||||
|
||||
FileDialog get_*select_font_dialog();
|
||||
void set_*select_font_dialog(const FileDialog &val);
|
||||
|
||||
Reference get_*LastOpenedFiles();
|
||||
void set_*LastOpenedFiles(const Reference &val);
|
||||
|
||||
Variant get_Variant();
|
||||
void set_Variant(const Variant &val);
|
||||
|
||||
Variant get_Variant();
|
||||
void set_Variant(const Variant &val);
|
||||
|
||||
Array get_directories();
|
||||
void set_directories(const Array &val);
|
||||
|
||||
Array get_files();
|
||||
void set_files(const Array &val);
|
||||
|
||||
int get_current_file_index() const;
|
||||
void set_current_file_index(const int val);
|
||||
|
||||
String get_current_file_path();
|
||||
void set_current_file_path(const String &val);
|
||||
|
||||
bool get_save_as() const;
|
||||
void set_save_as(const bool val);
|
||||
|
||||
Control get_*current_editor();
|
||||
void set_*current_editor(const Control &val);
|
||||
|
||||
Ref<DynamicFont> get_current_font();
|
||||
void set_current_font(const Ref<DynamicFont> &val);
|
||||
|
||||
bool get_editing_file() const;
|
||||
void set_editing_file(const bool val);
|
||||
|
||||
enum FileMenuOptions {
|
||||
|
||||
FILE_MENU_OPTION_NEW = 0,
|
||||
FILE_MENU_OPTION_OPEN = 1,
|
||||
FILE_MENU_OPTION_CLOSE = 2,
|
||||
FILE_MENU_OPTION_SAVE = 3,
|
||||
FILE_MENU_OPTION_SAVE_AS = 4,
|
||||
FILE_MENU_OPTION_DELETE = 5,
|
||||
FILE_MENU_OPTION_SEARCH = 6,
|
||||
FILE_MENU_OPTION_REPLACE = 7,
|
||||
};
|
||||
|
||||
void _init();
|
||||
void _ready();
|
||||
void connect_signals();
|
||||
void create_selected_file();
|
||||
void open_selected_file();
|
||||
void delete_selected_file();
|
||||
void save_current_file_as();
|
||||
void _on_file_btn_pressed(const int index);
|
||||
void _on_preview_btn_pressed(const int id);
|
||||
void _on_settings_btn_pressed(const int index);
|
||||
void _on_font_selected(const String &font_path);
|
||||
void _on_fileitem_pressed(const int index);
|
||||
void open_file(const String &path, const String &font = "null");
|
||||
void generate_file_item(const String &path, const Control &veditor);
|
||||
Control open_in_vanillaeditor(const String &path);
|
||||
void close_file(const int index);
|
||||
void confirm_close(const int index);
|
||||
void _on_update_file();
|
||||
void delete_file(const PoolStringArray &files_selected);
|
||||
void open_new_file_dialogue();
|
||||
void open_file_list();
|
||||
void create_new_file(const String &given_path);
|
||||
void save_file(const String ¤t_path);
|
||||
void clean_editor();
|
||||
void csv_preview();
|
||||
void bbcode_preview();
|
||||
void markdown_preview();
|
||||
void html_preview();
|
||||
void _on_vanillaeditor_text_changed();
|
||||
void update_list();
|
||||
void on_wrap_button(const int index);
|
||||
void on_minimap_button(const int index);
|
||||
void check_file_preview(const String &file);
|
||||
void _on_ConfirmationDialog_confirmed();
|
||||
|
||||
FileEditor();
|
||||
~FileEditor();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
//tool
|
||||
};
|
||||
String DIRECTORY = "res://";
|
||||
String EXCEPTIONS = "addons";
|
||||
PoolStringArray EXTENSIONS = [;
|
||||
"*.txt ; Plain Text File",;
|
||||
"*.rtf ; Rich Text Format File",;
|
||||
"*.log ; Log File",;
|
||||
"*.md ; MD File",;
|
||||
"*.doc ; WordPad Document",;
|
||||
"*.doc ; Microsoft Word Document",;
|
||||
"*.docm ; Word Open XML Macro-Enabled Document",;
|
||||
"*.docx ; Microsoft Word Open XML Document",;
|
||||
"*.bbs ; Bulletin Board System Text",;
|
||||
"*.dat ; Data File",;
|
||||
"*.xml ; XML File",;
|
||||
"*.sql ; SQL database file",;
|
||||
"*.json ; JavaScript Object Notation File",;
|
||||
"*.html ; HyperText Markup Language",;
|
||||
"*.csv ; Comma-separated values",;
|
||||
"*.cfg ; Configuration File",;
|
||||
"*.ini ; Initialization File (same as .cfg Configuration File)",;
|
||||
"*.csv ; Comma-separated values File",;
|
||||
"*.res ; Resource File",;
|
||||
];
|
||||
MenuButton *file_btn = null;
|
||||
MenuButton *preview_btn = null;
|
||||
MenuButton *settings_btn = null;
|
||||
PopupMenu *file_btn_popup = null;
|
||||
PopupMenu *preview_btn_popup = null;
|
||||
PopupMenu *settings_btn_popup = null;
|
||||
HSplitContainer *editor_container = null;
|
||||
VBoxContainer *file_container = null;
|
||||
ItemList *open_file_list = null;
|
||||
VBoxContainer *split_editor_container = null;
|
||||
LineEdit *open_file_name = null;
|
||||
OptionButton *wrap_btn = null;
|
||||
OptionButton *map_btn = null;
|
||||
FileDialog *file_list = null;
|
||||
AcceptDialog *new_file_dialogue = null;
|
||||
LineEdit *new_file_dialogue_name = null;
|
||||
ConfirmationDialog *confirmation_close = null;
|
||||
FileDialog *select_font_dialog = null;
|
||||
Reference *LastOpenedFiles = null;
|
||||
Variant = preload("res://addons/file-editor/scripts/Preview.gd");
|
||||
Variant = preload("res://addons/file-editor/scripts/VanillaEditor.gd");
|
||||
Array directories = ;
|
||||
Array files = ;
|
||||
int current_file_index = -1;
|
||||
String current_file_path = ;
|
||||
bool save_as = false;
|
||||
Control *current_editor;
|
||||
Ref<DynamicFont> current_font;
|
||||
bool editing_file = false;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
35
modules/text_editor/iconloader.cpp
Normal file
35
modules/text_editor/iconloader.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
#include "iconloader.h"
|
||||
|
||||
|
||||
|
||||
//tool;
|
||||
|
||||
ImageTexture IconLoader::load_icon_from_name(const String &icon_name) {
|
||||
File *file = File.new();
|
||||
Ref<Image> image = Image.new();
|
||||
Ref<ImageTexture> texture = ImageTexture.new();
|
||||
file.open("res://addons/file-editor/icons.pngs/"+icon_name+".png.buttonicon", File.READ);
|
||||
PoolByteArray buffer = file.get_buffer(file.get_len());
|
||||
file.close();
|
||||
image.load_png_from_buffer(buffer);
|
||||
texture.create_from_image(image);
|
||||
return texture;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
IconLoader::IconLoader() {
|
||||
}
|
||||
|
||||
IconLoader::~IconLoader() {
|
||||
}
|
||||
|
||||
|
||||
static void IconLoader::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("load_icon_from_name", "icon_name"), &IconLoader::load_icon_from_name);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
22
modules/text_editor/iconloader.h
Normal file
22
modules/text_editor/iconloader.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef ICONLOADER_H
|
||||
#define ICONLOADER_H
|
||||
|
||||
|
||||
class IconLoader : public Node {
|
||||
GDCLASS(IconLoader, Node);
|
||||
|
||||
public:
|
||||
|
||||
ImageTexture load_icon_from_name(const String &icon_name);
|
||||
|
||||
IconLoader();
|
||||
~IconLoader();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
//tool
|
||||
};
|
||||
|
||||
|
||||
#endif
|
140
modules/text_editor/lastopenedfiles.cpp
Normal file
140
modules/text_editor/lastopenedfiles.cpp
Normal file
@ -0,0 +1,140 @@
|
||||
|
||||
#include "lastopenedfiles.h"
|
||||
|
||||
|
||||
EditorPlugin LastOpenedFiles::get_*editor_plugin() {
|
||||
return *editor_plugin;
|
||||
}
|
||||
|
||||
void LastOpenedFiles::set_*editor_plugin(const EditorPlugin &val) {
|
||||
*editor_plugin = val;
|
||||
}
|
||||
|
||||
|
||||
Ref<EditorSettings> LastOpenedFiles::get_editor_settings() {
|
||||
return editor_settings;
|
||||
}
|
||||
|
||||
void LastOpenedFiles::set_editor_settings(const Ref<EditorSettings> &val) {
|
||||
editor_settings = val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//tool;
|
||||
EditorPlugin *editor_plugin = null;
|
||||
Ref<EditorSettings> editor_settings = null;
|
||||
|
||||
void LastOpenedFiles::store_opened_files(const Control &filecontainer) {
|
||||
Array arr = Array();
|
||||
|
||||
for (int child = 0; child < filecontainer.get_item_count(); ++child) { //child in range(filecontainer.get_item_count())
|
||||
String filepath = filecontainer.get_item_metadata(child)[0].current_path;
|
||||
Array a = Array();
|
||||
a.push_back(filepath.get_file());
|
||||
a.push_back(filepath);
|
||||
arr.push_back(a);
|
||||
}
|
||||
|
||||
editor_settings.set_project_metadata("file_editor", "files", arr);
|
||||
}
|
||||
|
||||
|
||||
void LastOpenedFiles::remove_opened_file(const int index, const Control &filecontainer) {
|
||||
String filepath = filecontainer.get_item_metadata(index)[0].current_path;
|
||||
String f = filepath.get_file();
|
||||
Array arr = editor_settings.get_project_metadata("file_editor", "files", Array());
|
||||
|
||||
for (int i = 0; i < arr.size(); ++i) { //i in range(arr.size())
|
||||
Array a = arr[i];
|
||||
|
||||
if (a[0] == f) {
|
||||
arr.remove(i);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
editor_settings.set_project_metadata("file_editor", "files", arr);
|
||||
Dictionary fonts_dict = editor_settings.get_project_metadata("file_editor", "file_fonts", Dictionary());
|
||||
|
||||
if (fonts_dict.has(f)) {
|
||||
fonts_dict.erase(f);
|
||||
editor_settings.set_project_metadata("file_editor", "file_fonts", fonts_dict);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Array LastOpenedFiles::load_opened_files() {
|
||||
Array arr = editor_settings.get_project_metadata("file_editor", "files", Array());
|
||||
Dictionary fonts_dict = editor_settings.get_project_metadata("file_editor", "file_fonts", Dictionary());
|
||||
Array keys = Array();
|
||||
|
||||
for (int i = 0; i < arr.size(); ++i) { //i in range(arr.size())
|
||||
Array a = arr[i];
|
||||
// creating and returning an Array with this format [1:file name, 2:file path, 3:file font];
|
||||
Array k = ;
|
||||
k.push_back(a[0]);
|
||||
k.push_back(a[1]);
|
||||
|
||||
if (fonts_dict.has(a[0])) {
|
||||
k.push_back(fonts_dict[a[0]]);
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
k.push_back("null");
|
||||
}
|
||||
|
||||
keys.append(k);
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
|
||||
void LastOpenedFiles::store_editor_fonts(const String &file_name, const String &font_path) {
|
||||
Dictionary fonts_dict = editor_settings.get_project_metadata("file_editor", "file_fonts", Dictionary());
|
||||
fonts_dict[file_name] = font_path;
|
||||
editor_settings.set_project_metadata("file_editor", "file_fonts", fonts_dict);
|
||||
}
|
||||
|
||||
|
||||
String LastOpenedFiles::get_editor_font() {
|
||||
//var editor_plugin : EditorPlugin = EditorPlugin.new();
|
||||
return editor_plugin.get_editor_interface().get_editor_settings().get_setting("interface/editor/code_font");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LastOpenedFiles::LastOpenedFiles() {
|
||||
*editor_plugin = null;
|
||||
editor_settings = null;
|
||||
}
|
||||
|
||||
LastOpenedFiles::~LastOpenedFiles() {
|
||||
}
|
||||
|
||||
|
||||
static void LastOpenedFiles::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_*editor_plugin"), &LastOpenedFiles::get_*editor_plugin);
|
||||
ClassDB::bind_method(D_METHOD("set_*editor_plugin", "value"), &LastOpenedFiles::set_*editor_plugin);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*editor_plugin", PROPERTY_HINT_RESOURCE_TYPE, "EditorPlugin"), "set_*editor_plugin", "get_*editor_plugin");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_editor_settings"), &LastOpenedFiles::get_editor_settings);
|
||||
ClassDB::bind_method(D_METHOD("set_editor_settings", "value"), &LastOpenedFiles::set_editor_settings);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "editor_settings", PROPERTY_HINT_RESOURCE_TYPE, "Ref<EditorSettings>"), "set_editor_settings", "get_editor_settings");
|
||||
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
34
modules/text_editor/lastopenedfiles.h
Normal file
34
modules/text_editor/lastopenedfiles.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef LASTOPENEDFILES_H
|
||||
#define LASTOPENEDFILES_H
|
||||
|
||||
|
||||
class LastOpenedFiles : public Reference {
|
||||
GDCLASS(LastOpenedFiles, Reference);
|
||||
|
||||
public:
|
||||
|
||||
EditorPlugin get_*editor_plugin();
|
||||
void set_*editor_plugin(const EditorPlugin &val);
|
||||
|
||||
Ref<EditorSettings> get_editor_settings();
|
||||
void set_editor_settings(const Ref<EditorSettings> &val);
|
||||
|
||||
void store_opened_files(const Control &filecontainer);
|
||||
void remove_opened_file(const int index, const Control &filecontainer);
|
||||
Array load_opened_files();
|
||||
void store_editor_fonts(const String &file_name, const String &font_path);
|
||||
String get_editor_font();
|
||||
|
||||
LastOpenedFiles();
|
||||
~LastOpenedFiles();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
//tool
|
||||
EditorPlugin *editor_plugin = null;
|
||||
Ref<EditorSettings> editor_settings = null;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
57
modules/text_editor/paint_editor_plugin.cpp
Normal file
57
modules/text_editor/paint_editor_plugin.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Péter Magyar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "paint_editor_plugin.h"
|
||||
|
||||
#include "paint_window.h"
|
||||
|
||||
void PaintEditorPlugin::make_visible(const bool visible) {
|
||||
window->set_visible(visible);
|
||||
}
|
||||
|
||||
String PaintEditorPlugin::get_name() const {
|
||||
return "Paint";
|
||||
}
|
||||
|
||||
const Ref<Texture> PaintEditorPlugin::get_icon() const {
|
||||
return _icon;
|
||||
}
|
||||
bool PaintEditorPlugin::has_main_screen() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
PaintEditorPlugin::PaintEditorPlugin(EditorNode *p_node) {
|
||||
editor = p_node;
|
||||
|
||||
window = memnew(PaintWindow);
|
||||
|
||||
get_editor_interface()->get_editor_viewport()->add_child(window);
|
||||
window->set_owner(get_editor_interface()->get_editor_viewport());
|
||||
make_visible(false);
|
||||
_icon = get_editor_interface()->get_base_control()->get_icon("CanvasModulate", "EditorIcons");
|
||||
}
|
||||
|
||||
PaintEditorPlugin::~PaintEditorPlugin() {
|
||||
}
|
||||
|
||||
void PaintEditorPlugin::_bind_methods() {
|
||||
}
|
54
modules/text_editor/paint_editor_plugin.h
Normal file
54
modules/text_editor/paint_editor_plugin.h
Normal file
@ -0,0 +1,54 @@
|
||||
#ifndef PAINT_EDITOR__PLUGIN_H
|
||||
#define PAINT_EDITOR__PLUGIN_H
|
||||
|
||||
/*
|
||||
Copyright (c) 2019-2022 Péter Magyar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "editor/editor_plugin.h"
|
||||
#include "core/reference.h"
|
||||
|
||||
class PaintWindow;
|
||||
class Texture;
|
||||
|
||||
class PaintEditorPlugin : public EditorPlugin {
|
||||
GDCLASS(PaintEditorPlugin, EditorPlugin);
|
||||
|
||||
public:
|
||||
void make_visible(const bool visible);
|
||||
const Ref<Texture> get_icon() const;
|
||||
bool has_main_screen() const;
|
||||
String get_name() const;
|
||||
|
||||
PaintEditorPlugin(EditorNode *p_node);
|
||||
~PaintEditorPlugin();
|
||||
|
||||
EditorNode *editor;
|
||||
|
||||
PaintWindow *window;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
Ref<Texture> _icon;
|
||||
};
|
||||
|
||||
#endif
|
307
modules/text_editor/preview.cpp
Normal file
307
modules/text_editor/preview.cpp
Normal file
@ -0,0 +1,307 @@
|
||||
|
||||
#include "preview.h"
|
||||
|
||||
|
||||
RichTextLabel Preview::get_*text_preview() {
|
||||
return *text_preview;
|
||||
}
|
||||
|
||||
void Preview::set_*text_preview(const RichTextLabel &val) {
|
||||
*text_preview = val;
|
||||
}
|
||||
|
||||
|
||||
GridContainer Preview::get_*table_preview() {
|
||||
return *table_preview;
|
||||
}
|
||||
|
||||
void Preview::set_*table_preview(const GridContainer &val) {
|
||||
*table_preview = val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//tool;
|
||||
RichTextLabel *text_preview = null;
|
||||
GridContainer *table_preview = null;
|
||||
signal image_downloaded();
|
||||
signal image_loaded();
|
||||
|
||||
void Preview::_init() {
|
||||
window_title = "File preview";
|
||||
resizable = true;
|
||||
set_anchors_and_margins_preset(Control.PRESET_WIDE);
|
||||
margin_left = 81;
|
||||
margin_top = 47;
|
||||
margin_right = -80;
|
||||
margin_bottom = -48;
|
||||
VBoxContainer *vbc = VBoxContainer.new();
|
||||
vbc.set_anchors_and_margins_preset(Control.PRESET_WIDE);
|
||||
add_child(vbc);
|
||||
text_preview = RichTextLabel.new();
|
||||
vbc.add_child(text_preview);
|
||||
text_preview.scroll_following = true;
|
||||
text_preview.bbcode_enabled = true;
|
||||
text_preview.size_flags_vertical = SIZE_EXPAND_FILL;
|
||||
text_preview.hide();
|
||||
table_preview = GridContainer.new();
|
||||
vbc.add_child(table_preview);
|
||||
table_preview.columns = 3;
|
||||
table_preview.size_flags_horizontal = SIZE_EXPAND_FILL;
|
||||
table_preview.size_flags_vertical = SIZE_EXPAND_FILL;
|
||||
table_preview.hide();
|
||||
connect("popup_hide", self, "_on_Preview_popup_hide");
|
||||
}
|
||||
|
||||
|
||||
void Preview::print_preview(const String &content) {
|
||||
text_preview.append_bbcode(content);
|
||||
text_preview.show();
|
||||
}
|
||||
|
||||
|
||||
void Preview::print_bb(const String &content) {
|
||||
text_preview.append_bbcode(content);
|
||||
text_preview.show();
|
||||
}
|
||||
|
||||
|
||||
void Preview::print_markdown(const String &content) {
|
||||
Array result = Array();
|
||||
Array bolded = Array();
|
||||
Array italics = Array();
|
||||
Array striked = Array();
|
||||
Array coded = Array();
|
||||
Array linknames = Array();
|
||||
Array images = Array();
|
||||
Array links = Array();
|
||||
Array lists = Array();
|
||||
Array underlined = Array();
|
||||
Ref<RegEx> regex = RegEx.new();
|
||||
regex.compile('\\*\\*(?<boldtext>.*)\\*\\*');
|
||||
result = regex.search_all(content);
|
||||
|
||||
for (int i = 0; i < result.size(); ++i) { //i in range(result.size())
|
||||
Ref<RegExMatch> res = result[i];
|
||||
bolded.append(res.get_string("boldtext"));
|
||||
}
|
||||
|
||||
regex.compile('\\_\\_(?<underlinetext>.*)\\_\\_');
|
||||
result = regex.search_all(content);
|
||||
|
||||
for (int i = 0; i < result.size(); ++i) { //i in range(result.size())
|
||||
Ref<RegExMatch> res = result[i];
|
||||
underlined.append(res.get_string("underlinetext"));
|
||||
}
|
||||
|
||||
regex.compile("\\*(?<italictext>.*)\\*");
|
||||
result = regex.search_all(content);
|
||||
|
||||
for (int i = 0; i < result.size(); ++i) { //i in range(result.size())
|
||||
Ref<RegExMatch> res = result[i];
|
||||
italics.append(res.get_string("italictext"));
|
||||
}
|
||||
|
||||
regex.compile("~~(?<strikedtext>.*)~~");
|
||||
result = regex.search_all(content);
|
||||
|
||||
for (int i = 0; i < result.size(); ++i) { //i in range(result.size())
|
||||
Ref<RegExMatch> res = result[i];
|
||||
striked.append(res.get_string("strikedtext"));
|
||||
}
|
||||
|
||||
regex.compile("`(?<coded>.*)`");
|
||||
result = regex.search_all(content);
|
||||
|
||||
for (int i = 0; i < result.size(); ++i) { //i in range(result.size())
|
||||
Ref<RegExMatch> res = result[i];
|
||||
coded.append(res.get_string("coded"));
|
||||
}
|
||||
|
||||
regex.compile("[+-*](?<element>\\s.*)");
|
||||
result = regex.search_all(content);
|
||||
|
||||
for (int i = 0; i < result.size(); ++i) { //i in range(result.size())
|
||||
Ref<RegExMatch> res = result[i];
|
||||
lists.append(res.get_string("element"));
|
||||
}
|
||||
|
||||
regex.compile("(?<img>!\\[.*?\\))");
|
||||
result = regex.search_all(content);
|
||||
|
||||
for (int i = 0; i < result.size(); ++i) { //i in range(result.size())
|
||||
Ref<RegExMatch> res = result[i];
|
||||
images.append(res.get_string("img"));
|
||||
}
|
||||
|
||||
regex.compile("\\[(?<linkname>.*?)\\]|\\((?<link>[h\\.]\\S*?)\\)");
|
||||
result = regex.search_all(content);
|
||||
|
||||
for (int i = 0; i < result.size(); ++i) { //i in range(result.size())
|
||||
Ref<RegExMatch> res = result[i];
|
||||
|
||||
if (res.get_string("link")!="") {
|
||||
links.append(res.get_string("link"));
|
||||
}
|
||||
|
||||
|
||||
if (res.get_string("linkname")!="") {
|
||||
linknames.append(res.get_string("linkname"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < bolded.size(); ++i) { //i in range(bolded.size())
|
||||
String bold = bolded[i];
|
||||
content = content.replace("**"+bold+"**","[b]"+bold+"[/b]");
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < italics.size(); ++i) { //i in range(italics.size())
|
||||
String italic = italics[i];
|
||||
content = content.replace("*"+italic+"*","[i]"+italic+"[/i]");
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < striked.size(); ++i) { //i in range(striked.size())
|
||||
String strik = striked[i];
|
||||
content = content.replace("~~"+strik+"~~","[s]"+strik+"[/s]");
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < underlined.size(); ++i) { //i in range(underlined.size())
|
||||
String underline = underlined[i];
|
||||
content = content.replace("__"+underline+"__","[u]"+underline+"[/u]");
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < coded.size(); ++i) { //i in range(coded.size())
|
||||
String code = coded[i];
|
||||
content = content.replace("`"+code+"`","[code]"+code+"[/code]");
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < images.size(); ++i) { //i in range(images.size())
|
||||
String image = images[i];
|
||||
Variant = image.split("(");
|
||||
Variant = substr[1].rstrip(")");
|
||||
content = content.replace(image,"[img]"+imglink+"[/img]");
|
||||
}
|
||||
|
||||
|
||||
for (i in links.size()) {
|
||||
content = content.replace("["+linknames[i]+"]("+links[i]+")","[url="+links[i]+"]"+linknames[i]+"[/url]");
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < lists.size(); ++i) { //i in range(lists.size())
|
||||
String element = lists[i];
|
||||
|
||||
if (content.find("- "+element)) {
|
||||
content = content.replace("-"+element,"[indent]-"+element+"[/indent]");
|
||||
}
|
||||
|
||||
|
||||
if (content.find("+ "+element)) {
|
||||
content = content.replace("+"+element,"[indent]-"+element+"[/indent]");
|
||||
}
|
||||
|
||||
|
||||
if (content.find("* "+element)) {
|
||||
content = content.replace("+"+element,"[indent]-"+element+"[/indent]");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
text_preview.append_bbcode(content);
|
||||
text_preview.show();
|
||||
}
|
||||
|
||||
|
||||
void Preview::print_html(const String &content) {
|
||||
content = content.replace("<i>","[i]");
|
||||
content = content.replace("</i>","[/i]");
|
||||
content = content.replace("<b>","[b]");
|
||||
content = content.replace("</b>","[/b]");
|
||||
content = content.replace("<u>","[u]");
|
||||
content = content.replace("</u>","[/u]");
|
||||
content = content.replace("<ins>","[u]");
|
||||
content = content.replace("</ins>","[/u]");
|
||||
content = content.replace("<del>","[s]");
|
||||
content = content.replace("</del>","[/s]");
|
||||
content = content.replace('<a href="',"[url=");
|
||||
content = content.replace('">',"]");
|
||||
content = content.replace("</a>","[/url]");
|
||||
content = content.replace('<img src="',"[img]");
|
||||
content = content.replace('" />',"[/img]");
|
||||
content = content.replace('"/>',"[/img]");
|
||||
content = content.replace("<pre>","[code]");
|
||||
content = content.replace("</pre>","[/code]");
|
||||
content = content.replace("<center>","[center]");
|
||||
content = content.replace("</center>","[/center]");
|
||||
content = content.replace("<right>","[right]");
|
||||
content = content.replace("</right>","[/right]");
|
||||
text_preview.append_bbcode(content);
|
||||
text_preview.show();
|
||||
}
|
||||
|
||||
|
||||
void Preview::print_csv(const Array &rows) {
|
||||
table_preview.columns = rows[0].size();
|
||||
|
||||
for (item in rows) {
|
||||
|
||||
for (string in item) {
|
||||
Variant = Label.new();
|
||||
label.text = str(string);
|
||||
label.set_h_size_flags(SIZE_EXPAND);
|
||||
label.set_align(1);
|
||||
label.set_valign(1);
|
||||
table_preview.add_child(label);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
table_preview.show();
|
||||
}
|
||||
|
||||
|
||||
void Preview::_on_Preview_popup_hide() {
|
||||
queue_free();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Preview::Preview() {
|
||||
*text_preview = null;
|
||||
*table_preview = null;
|
||||
}
|
||||
|
||||
Preview::~Preview() {
|
||||
}
|
||||
|
||||
|
||||
static void Preview::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_*text_preview"), &Preview::get_*text_preview);
|
||||
ClassDB::bind_method(D_METHOD("set_*text_preview", "value"), &Preview::set_*text_preview);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*text_preview", PROPERTY_HINT_RESOURCE_TYPE, "RichTextLabel"), "set_*text_preview", "get_*text_preview");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_*table_preview"), &Preview::get_*table_preview);
|
||||
ClassDB::bind_method(D_METHOD("set_*table_preview", "value"), &Preview::set_*table_preview);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*table_preview", PROPERTY_HINT_RESOURCE_TYPE, "GridContainer"), "set_*table_preview", "get_*table_preview");
|
||||
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
38
modules/text_editor/preview.h
Normal file
38
modules/text_editor/preview.h
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef PREVIEW_H
|
||||
#define PREVIEW_H
|
||||
|
||||
|
||||
class Preview : public WindowDialog {
|
||||
GDCLASS(Preview, WindowDialog);
|
||||
|
||||
public:
|
||||
|
||||
RichTextLabel get_*text_preview();
|
||||
void set_*text_preview(const RichTextLabel &val);
|
||||
|
||||
GridContainer get_*table_preview();
|
||||
void set_*table_preview(const GridContainer &val);
|
||||
|
||||
void _init();
|
||||
void print_preview(const String &content);
|
||||
void print_bb(const String &content);
|
||||
void print_markdown(const String &content);
|
||||
void print_html(const String &content);
|
||||
void print_csv(const Array &rows);
|
||||
void _on_Preview_popup_hide();
|
||||
|
||||
Preview();
|
||||
~Preview();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
//tool
|
||||
RichTextLabel *text_preview = null;
|
||||
GridContainer *table_preview = null;
|
||||
signal image_downloaded();
|
||||
signal image_loaded();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
37
modules/text_editor/register_types.cpp
Normal file
37
modules/text_editor/register_types.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Péter Magyar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "register_types.h"
|
||||
|
||||
//#ifdef TOOLS_ENABLED
|
||||
//#endif
|
||||
|
||||
void register_text_editor_types() {
|
||||
//ClassDB::register_class<PaintWindow>();
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
//EditorPlugins::add_by_type<PaintEditorPlugin>();
|
||||
#endif
|
||||
}
|
||||
|
||||
void unregister_text_editor_types() {
|
||||
}
|
24
modules/text_editor/register_types.h
Normal file
24
modules/text_editor/register_types.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Péter Magyar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
void register_text_editor_types();
|
||||
void unregister_text_editor_types();
|
816
modules/text_editor/vanillaeditor.cpp
Normal file
816
modules/text_editor/vanillaeditor.cpp
Normal file
@ -0,0 +1,816 @@
|
||||
|
||||
#include "vanillaeditor.h"
|
||||
|
||||
|
||||
Reference VanillaEditor::get_*LastOpenedFiles() {
|
||||
return *LastOpenedFiles;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_*LastOpenedFiles(const Reference &val) {
|
||||
*LastOpenedFiles = val;
|
||||
}
|
||||
|
||||
|
||||
TextEdit VanillaEditor::get_*text_editor() {
|
||||
return *text_editor;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_*text_editor(const TextEdit &val) {
|
||||
*text_editor = val;
|
||||
}
|
||||
|
||||
|
||||
FileDialog VanillaEditor::get_*file_list() {
|
||||
return *file_list;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_*file_list(const FileDialog &val) {
|
||||
*file_list = val;
|
||||
}
|
||||
|
||||
|
||||
HBoxContainer VanillaEditor::get_*search_box() {
|
||||
return *search_box;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_*search_box(const HBoxContainer &val) {
|
||||
*search_box = val;
|
||||
}
|
||||
|
||||
|
||||
LineEdit VanillaEditor::get_*search_box_line_edit() {
|
||||
return *search_box_line_edit;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_*search_box_line_edit(const LineEdit &val) {
|
||||
*search_box_line_edit = val;
|
||||
}
|
||||
|
||||
|
||||
CheckBox VanillaEditor::get_*search_box_match_case_cb() {
|
||||
return *search_box_match_case_cb;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_*search_box_match_case_cb(const CheckBox &val) {
|
||||
*search_box_match_case_cb = val;
|
||||
}
|
||||
|
||||
|
||||
CheckBox VanillaEditor::get_*search_box_whole_words_cb() {
|
||||
return *search_box_whole_words_cb;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_*search_box_whole_words_cb(const CheckBox &val) {
|
||||
*search_box_whole_words_cb = val;
|
||||
}
|
||||
|
||||
|
||||
Button VanillaEditor::get_*search_box_close_button() {
|
||||
return *search_box_close_button;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_*search_box_close_button(const Button &val) {
|
||||
*search_box_close_button = val;
|
||||
}
|
||||
|
||||
|
||||
HBoxContainer VanillaEditor::get_*replace_box() {
|
||||
return *replace_box;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_*replace_box(const HBoxContainer &val) {
|
||||
*replace_box = val;
|
||||
}
|
||||
|
||||
|
||||
LineEdit VanillaEditor::get_*replace_box_replace_le() {
|
||||
return *replace_box_replace_le;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_*replace_box_replace_le(const LineEdit &val) {
|
||||
*replace_box_replace_le = val;
|
||||
}
|
||||
|
||||
|
||||
LineEdit VanillaEditor::get_*replace_box_with() {
|
||||
return *replace_box_with;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_*replace_box_with(const LineEdit &val) {
|
||||
*replace_box_with = val;
|
||||
}
|
||||
|
||||
|
||||
Button VanillaEditor::get_*replace_box_button() {
|
||||
return *replace_box_button;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_*replace_box_button(const Button &val) {
|
||||
*replace_box_button = val;
|
||||
}
|
||||
|
||||
|
||||
Button VanillaEditor::get_*replace_box_close() {
|
||||
return *replace_box_close;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_*replace_box_close(const Button &val) {
|
||||
*replace_box_close = val;
|
||||
}
|
||||
|
||||
|
||||
TextureRect VanillaEditor::get_*file_info_last_modified_icon() {
|
||||
return *file_info_last_modified_icon;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_*file_info_last_modified_icon(const TextureRect &val) {
|
||||
*file_info_last_modified_icon = val;
|
||||
}
|
||||
|
||||
|
||||
Label VanillaEditor::get_*file_info_last_modified() {
|
||||
return *file_info_last_modified;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_*file_info_last_modified(const Label &val) {
|
||||
*file_info_last_modified = val;
|
||||
}
|
||||
|
||||
|
||||
Label VanillaEditor::get_*file_info_c_counter() {
|
||||
return *file_info_c_counter;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_*file_info_c_counter(const Label &val) {
|
||||
*file_info_c_counter = val;
|
||||
}
|
||||
|
||||
|
||||
CheckBox VanillaEditor::get_*file_info_read_only() {
|
||||
return *file_info_read_only;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_*file_info_read_only(const CheckBox &val) {
|
||||
*file_info_read_only = val;
|
||||
}
|
||||
|
||||
|
||||
String VanillaEditor::get_current_path() {
|
||||
return current_path;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_current_path(const String &val) {
|
||||
current_path = val;
|
||||
}
|
||||
|
||||
|
||||
String VanillaEditor::get_current_filename() {
|
||||
return current_filename;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_current_filename(const String &val) {
|
||||
current_filename = val;
|
||||
}
|
||||
|
||||
|
||||
int VanillaEditor::get_search_flag() const {
|
||||
return search_flag;
|
||||
}
|
||||
|
||||
void VanillaEditor::set_search_flag(const int val) {
|
||||
search_flag = val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//tool;
|
||||
Reference *LastOpenedFiles = null;
|
||||
TextEdit *text_editor = null;
|
||||
FileDialog *file_list = null;
|
||||
HBoxContainer *search_box = null;
|
||||
LineEdit *search_box_line_edit = null;
|
||||
CheckBox *search_box_match_case_cb = null;
|
||||
CheckBox *search_box_whole_words_cb = null;
|
||||
Button *search_box_close_button = null;
|
||||
HBoxContainer *replace_box = null;
|
||||
LineEdit *replace_box_replace_le = null;
|
||||
LineEdit *replace_box_with = null;
|
||||
Button *replace_box_button = null;
|
||||
Button *replace_box_close = null;
|
||||
TextureRect *file_info_last_modified_icon = null;
|
||||
Label *file_info_last_modified = null;
|
||||
Label *file_info_c_counter = null;
|
||||
CheckBox *file_info_read_only = null;
|
||||
String current_path = "";
|
||||
String current_filename = "";
|
||||
int search_flag = 0;
|
||||
signal text_changed();
|
||||
|
||||
void VanillaEditor::_init() {
|
||||
size_flags_vertical = SIZE_EXPAND_FILL;
|
||||
set_anchors_and_margins_preset(Control.PRESET_WIDE);
|
||||
text_editor = TextEdit.new();
|
||||
add_child(text_editor);
|
||||
text_editor.highlight_current_line = true;
|
||||
text_editor.syntax_highlighting = true;
|
||||
text_editor.show_line_numbers = true;
|
||||
text_editor.breakpoint_gutter = true;
|
||||
text_editor.highlight_all_occurrences = true;
|
||||
text_editor.override_selected_font_color = true;
|
||||
text_editor.smooth_scrolling = true;
|
||||
text_editor.hiding_enabled = true;
|
||||
//todo look this up from the editor settings;
|
||||
//text_editor.caret_blink = true;
|
||||
//text_editor.caret_blink_speed = 1;
|
||||
text_editor.caret_moving_by_right_click = false;
|
||||
text_editor.minimap_draw = true;
|
||||
text_editor.size_flags_vertical = SIZE_EXPAND_FILL;
|
||||
text_editor.set("custom_colors/member_variable_color", Color(0.737255, 0.882353, 1));
|
||||
text_editor.set("custom_colors/code_folding_color", Color(1, 1, 1, 0.701961));
|
||||
text_editor.set("custom_colors/function_color", Color(0.341176, 0.701961, 1));
|
||||
text_editor.set("custom_colors/safe_line_number_color", Color(0.8, 0.968627, 0.827451, 0.74902));
|
||||
text_editor.set("custom_colors/symbol_color", Color(0.670588, 0.788235, 1));
|
||||
text_editor.set("custom_colors/caret_background_color", Color(0, 0, 0));
|
||||
text_editor.set("custom_colors/selection_color", Color(0.411765, 0.611765, 0.909804, 0.34902));
|
||||
text_editor.set("custom_colors/caret_color", Color(1, 1, 1));
|
||||
text_editor.set("custom_colors/breakpoint_color", Color(1, 0.470588, 0.419608));
|
||||
text_editor.set("custom_colors/font_color_selected", Color(0, 0, 0));
|
||||
text_editor.set("custom_colors/font_color", Color(1, 1, 1));
|
||||
text_editor.set("custom_colors/completion_font_color", Color(1, 1, 1, 0.392157));
|
||||
text_editor.set("custom_colors/completion_scroll_color", Color(1, 1, 1, 0.070588));
|
||||
text_editor.set("custom_colors/background_color", Color(0.121569, 0.145098, 0.192157));
|
||||
text_editor.set("custom_colors/number_color", Color(0.631373, 1, 0.882353));
|
||||
text_editor.set("custom_colors/completion_background_color", Color(0.196078, 0.231373, 0.309804));
|
||||
text_editor.set("custom_colors/brace_mismatch_color", Color(1, 0.470588, 0.419608));
|
||||
text_editor.set("custom_colors/current_line_color", Color(1, 1, 1, 0.070588));
|
||||
text_editor.set("custom_colors/completion_selected_color", Color(1, 1, 1, 0.070588));
|
||||
text_editor.set("custom_colors/mark_color", Color(1, 0.470588, 0.419608, 0.301961));
|
||||
text_editor.set("custom_colors/word_highlighted_color", Color(1, 1, 1, 0.392157));
|
||||
text_editor.set("custom_colors/completion_existing_color", Color(1, 1, 1, 0.392157));
|
||||
text_editor.set("custom_constants/completion_lines", 20);
|
||||
text_editor.set("custom_constants/completion_max_width", 20);
|
||||
text_editor.set("custom_constants/completion_scroll_width", 20);
|
||||
//text_editor.owner = self;
|
||||
search_box = HBoxContainer.new();
|
||||
add_child(search_box);
|
||||
search_box.hide();
|
||||
Label *selabel = Label.new();
|
||||
search_box.add_child(selabel);
|
||||
selabel.text = "Search:";
|
||||
search_box_line_edit = LineEdit.new();
|
||||
search_box.add_child(search_box_line_edit);
|
||||
search_box_line_edit.size_flags_horizontal = SIZE_EXPAND_FILL;
|
||||
search_box_line_edit.connect("text_changed", self, "_on_LineEdit_text_changed");
|
||||
search_box_line_edit.connect("focus_entered", self, "_on_LineEdit_focus_entered");
|
||||
search_box_match_case_cb = CheckBox.new();
|
||||
search_box.add_child(search_box_match_case_cb);
|
||||
search_box_match_case_cb.text = "Match Case";
|
||||
search_box_match_case_cb.connect("toggled", self, "_on_matchcase_toggled");
|
||||
search_box_whole_words_cb = CheckBox.new();
|
||||
search_box.add_child(search_box_whole_words_cb);
|
||||
search_box_whole_words_cb.text = "Whole Words";
|
||||
search_box_whole_words_cb.connect("toggled", self, "_on_wholewords_toggled");
|
||||
search_box_close_button = Button.new();
|
||||
search_box.add_child(search_box_close_button);
|
||||
search_box_close_button.text = "x";
|
||||
search_box_close_button.flat = true;
|
||||
search_box_whole_words_cb.connect("pressed", self, "_on_close_pressed");
|
||||
replace_box = HBoxContainer.new();
|
||||
add_child(replace_box);
|
||||
replace_box.hide();
|
||||
Label *rblabel = Label.new();
|
||||
replace_box.add_child(rblabel);
|
||||
rblabel.text = "Replace:";
|
||||
replace_box_replace_le = LineEdit.new();
|
||||
replace_box.add_child(replace_box_replace_le);
|
||||
replace_box_replace_le.size_flags_horizontal = SIZE_EXPAND_FILL;
|
||||
Label *rb2label = Label.new();
|
||||
replace_box.add_child(rb2label);
|
||||
rb2label.text = "With:";
|
||||
replace_box_with = LineEdit.new();
|
||||
replace_box.add_child(replace_box_with);
|
||||
replace_box_with.size_flags_horizontal = SIZE_EXPAND_FILL;
|
||||
replace_box_button = Button.new();
|
||||
replace_box.add_child(replace_box_button);
|
||||
replace_box_button.text = "Replace";
|
||||
replace_box_button.connect("pressed", self, "_on_Button_pressed");
|
||||
replace_box_close = Button.new();
|
||||
replace_box.add_child(replace_box_close);
|
||||
replace_box_close.text = "x";
|
||||
replace_box_close.flat = true;
|
||||
replace_box_button.connect("pressed", self, "_on_close2_pressed");
|
||||
HBoxContainer *file_info = HBoxContainer.new();
|
||||
add_child(file_info);
|
||||
file_info_last_modified_icon = TextureRect.new();
|
||||
file_info.add_child(file_info_last_modified_icon);
|
||||
file_info_last_modified_icon.stretch_mode = TextureRect.STRETCH_KEEP_CENTERED;
|
||||
Label *filabel = Label.new();
|
||||
file_info.add_child(filabel);
|
||||
filabel.text = "Last modified time:";
|
||||
file_info_last_modified = Label.new();
|
||||
file_info.add_child(file_info_last_modified);
|
||||
Label *fi2label = Label.new();
|
||||
file_info.add_child(fi2label);
|
||||
fi2label.text = "Characters counter:";
|
||||
fi2label.align = Label.ALIGN_RIGHT;
|
||||
fi2label.size_flags_horizontal = SIZE_EXPAND | SIZE_FILL | SIZE_SHRINK_CENTER | SIZE_SHRINK_END;
|
||||
file_info_c_counter = Label.new();
|
||||
file_info.add_child(file_info_c_counter);
|
||||
file_info_c_counter.size_flags_horizontal = SIZE_EXPAND;
|
||||
file_info_read_only = CheckBox.new();
|
||||
file_info.add_child(file_info_read_only);
|
||||
file_info_read_only.text = "Can Edit";
|
||||
file_info_read_only.flat = true;
|
||||
file_info_read_only.size_flags_horizontal = SIZE_EXPAND | SIZE_SHRINK_END;
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::_ready() {
|
||||
text_editor.connect("text_changed", self, "_on_text_editor_text_changed");
|
||||
//FileList = get_parent().get_parent().get_parent().get_parent().get_node("FileList");
|
||||
file_info_read_only.connect("toggled",self,"_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 VanillaEditor::set_font(const String &font_path) {
|
||||
Ref<DynamicFont> dynamic_font = DynamicFont.new();
|
||||
Ref<DynamicFontData> dynamic_font_data = DynamicFontData.new();
|
||||
dynamic_font_data.set_font_path(font_path);
|
||||
dynamic_font.set_font_data(dynamic_font_data);
|
||||
text_editor.set("custom_fonts/font",dynamic_font);
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::load_default_font() {
|
||||
String default_font = LastOpenedFiles.get_editor_font();
|
||||
|
||||
if (default_font != "") {
|
||||
set_font(default_font);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::set_wrap_enabled(const bool enabled) {
|
||||
text_editor.set_wrap_enabled(enabled);
|
||||
text_editor.update();
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::draw_minimap(const bool value) {
|
||||
text_editor.draw_minimap(value);
|
||||
text_editor.update();
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::color_region(const String &filextension) {
|
||||
|
||||
{
|
||||
|
||||
{
|
||||
text_editor.add_color_region("[b]","[/b]",Color8(153,153,255,255),false);
|
||||
text_editor.add_color_region("[i]","[/i]",Color8(153,255,153,255),false);
|
||||
text_editor.add_color_region("[s]","[/s]",Color8(255,153,153,255),false);
|
||||
text_editor.add_color_region("[u]","[/u]",Color8(255,255,102,255),false);
|
||||
text_editor.add_color_region("[url","[/url]",Color8(153,204,255,255),false);
|
||||
text_editor.add_color_region("[code]","[/code]",Color8(192,192,192,255),false);
|
||||
text_editor.add_color_region("[img]","[/img]",Color8(255,204,153,255),false);
|
||||
text_editor.add_color_region("[center]","[/center]",Color8(175,238,238,255),false);
|
||||
text_editor.add_color_region("[right]","[/right]",Color8(135,206,235,255),false);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
text_editor.add_color_region("<b>","</b>",Color8(153,153,255,255),false);
|
||||
text_editor.add_color_region("<i>","</i>",Color8(153,255,153,255),false);
|
||||
text_editor.add_color_region("<del>","</del>",Color8(255,153,153,255),false);
|
||||
text_editor.add_color_region("<ins>","</ins>",Color8(255,255,102,255),false);
|
||||
text_editor.add_color_region("<a","</a>",Color8(153,204,255,255),false);
|
||||
text_editor.add_color_region("<img","/>",Color8(255,204,153,255),true);
|
||||
text_editor.add_color_region("<pre>","</pre>",Color8(192,192,192,255),false);
|
||||
text_editor.add_color_region("<center>","</center>",Color8(175,238,238,255),false);
|
||||
text_editor.add_color_region("<right>","</right>",Color8(135,206,235,255),false);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
text_editor.add_color_region("***","***",Color8(126,186,181,255),false);
|
||||
text_editor.add_color_region("**","**",Color8(153,153,255,255),false);
|
||||
text_editor.add_color_region("*","*",Color8(153,255,153,255),false);
|
||||
text_editor.add_color_region("+ ","",Color8(255,178,102,255),false);
|
||||
text_editor.add_color_region("- ","",Color8(255,178,102,255),false);
|
||||
text_editor.add_color_region("~~","~~",Color8(255,153,153,255),false);
|
||||
text_editor.add_color_region("__","__",Color8(255,255,102,255),false);
|
||||
text_editor.add_color_region("[",")",Color8(153,204,255,255),false);
|
||||
text_editor.add_color_region("`","`",Color8(192,192,192,255),false);
|
||||
text_editor.add_color_region('"*.','"',Color8(255,255,255,255),true);
|
||||
// ","",Color8(105,105,105,255),true);
|
||||
text_editor.add_color_region(";
|
||||
//// ","",Color8(128,128,128,255),true);
|
||||
text_editor.add_color_region(";
|
||||
////// ","",Color8(169,169,169,255),true);
|
||||
text_editor.add_color_region(";
|
||||
//////// ","",Color8(192,192,192,255),true);
|
||||
text_editor.add_color_region(";
|
||||
////////// ","",Color8(211,211,211,255),true);
|
||||
text_editor.add_color_region(";
|
||||
//////////// ","",Color8(255,255,255,255),true);
|
||||
text_editor.add_color_region(";
|
||||
text_editor.add_color_region("> ","",Color8(172,138,79,255),true);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
text_editor.add_color_region("[","]",Color8(153,204,255,255),false);
|
||||
text_editor.add_color_region('"','"',Color8(255,255,102,255),false);
|
||||
text_editor.add_color_region(';','',Color8(128,128,128,255),true);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
text_editor.add_color_region("[","]",Color8(153,204,255,255),false);
|
||||
text_editor.add_color_region('"','"',Color8(255,255,102,255),false);
|
||||
text_editor.add_color_region(';','',Color8(128,128,128,255),true);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
pass;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::clean_editor() {
|
||||
text_editor.set_text("");
|
||||
//file_info_last_modified_icon.texture = IconLoader.load_icon_from_name("save");
|
||||
file_info_last_modified.set_text("");
|
||||
file_list.invalidate();
|
||||
current_filename = "";
|
||||
current_path = "";
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::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());
|
||||
text_editor.set_text(file_content);
|
||||
update_lastmodified(last_modified,"save");
|
||||
file_list.invalidate();
|
||||
count_characters();
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::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) {
|
||||
text_editor.set_text("");
|
||||
file_list.invalidate();
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::_on_Readonly_toggled(const bool button_pressed) {
|
||||
|
||||
if (button_pressed) {
|
||||
file_info_read_only.set_text("Read Only");
|
||||
text_editor.readonly = (true);
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
file_info_read_only.set_text("Can Edit");
|
||||
text_editor.readonly = (false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::_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() {
|
||||
int counted = 0;
|
||||
|
||||
for (int line = 0; line < text_editor.get_line_count(); ++line) { //line in range(text_editor.get_line_count())
|
||||
counted += text_editor.get_line(line).length();
|
||||
}
|
||||
|
||||
file_info_c_counter.set_text(str(counted));
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::_on_LineEdit_text_changed(const String &new_text) {
|
||||
int linecount = text_editor.get_line_count();
|
||||
|
||||
if (new_text != "") {
|
||||
PoolIntArray found = ;
|
||||
bool find = false;
|
||||
|
||||
for (int line = 0; line < linecount; ++line) { //line in range(linecount)
|
||||
|
||||
for (int column = 0; column < text_editor.get_line(line).length(); ++column) { //column in range(text_editor.get_line(line).length())
|
||||
found = text_editor.search( new_text, search_flag, line , column );
|
||||
|
||||
if (found.size()) {
|
||||
|
||||
if (found[1] == line) {
|
||||
// if not find:;
|
||||
text_editor.select(line,found[0],found[1],found[0]+new_text.length());
|
||||
}
|
||||
|
||||
// find = true;
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
text_editor.select(0,0,0,0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
text_editor.select(0,0,0,0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::_on_matchcase_toggled(const bool button_pressed) {
|
||||
|
||||
if (button_pressed) {
|
||||
search_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
|
||||
if (search_box_whole_words_cb.is_pressed()) {
|
||||
search_flag = 2;
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
search_flag = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_on_LineEdit_text_changed(search_box_line_edit.get_text());
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::_on_wholewords_toggled(const bool button_pressed) {
|
||||
|
||||
if (button_pressed) {
|
||||
search_flag = 2;
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
|
||||
if (search_box_match_case_cb.is_pressed()) {
|
||||
search_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
search_flag = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_on_LineEdit_text_changed(search_box_line_edit.get_text());
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::_on_close_pressed() {
|
||||
search_box.hide();
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::open_search_box() {
|
||||
|
||||
if (search_box.visible) {
|
||||
search_box.hide();
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
search_box.show();
|
||||
search_box.get_node("LineEdit").grab_focus();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::_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();
|
||||
String text = text_editor.get_text();
|
||||
text_editor.set_text(text.replace(old_text,new_text));
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::open_replace_box() {
|
||||
|
||||
if (replace_box.visible) {
|
||||
replace_box.hide();
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
replace_box.show();
|
||||
replace_box.get_node("replace").grab_focus();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::_on_close2_pressed() {
|
||||
replace_box.hide();
|
||||
}
|
||||
|
||||
|
||||
void VanillaEditor::_on_LineEdit_focus_entered() {
|
||||
_on_LineEdit_text_changed(search_box_line_edit.get_text());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
VanillaEditor::VanillaEditor() {
|
||||
*LastOpenedFiles = null;
|
||||
*text_editor = null;
|
||||
*file_list = null;
|
||||
*search_box = null;
|
||||
*search_box_line_edit = null;
|
||||
*search_box_match_case_cb = null;
|
||||
*search_box_whole_words_cb = null;
|
||||
*search_box_close_button = null;
|
||||
*replace_box = null;
|
||||
*replace_box_replace_le = null;
|
||||
*replace_box_with = null;
|
||||
*replace_box_button = null;
|
||||
*replace_box_close = null;
|
||||
*file_info_last_modified_icon = null;
|
||||
*file_info_last_modified = null;
|
||||
*file_info_c_counter = null;
|
||||
*file_info_read_only = null;
|
||||
current_path = "";
|
||||
current_filename = "";
|
||||
search_flag = 0;
|
||||
}
|
||||
|
||||
VanillaEditor::~VanillaEditor() {
|
||||
}
|
||||
|
||||
|
||||
static void VanillaEditor::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_*LastOpenedFiles"), &VanillaEditor::get_*LastOpenedFiles);
|
||||
ClassDB::bind_method(D_METHOD("set_*LastOpenedFiles", "value"), &VanillaEditor::set_*LastOpenedFiles);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*LastOpenedFiles", PROPERTY_HINT_RESOURCE_TYPE, "Reference"), "set_*LastOpenedFiles", "get_*LastOpenedFiles");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_*text_editor"), &VanillaEditor::get_*text_editor);
|
||||
ClassDB::bind_method(D_METHOD("set_*text_editor", "value"), &VanillaEditor::set_*text_editor);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*text_editor", PROPERTY_HINT_RESOURCE_TYPE, "TextEdit"), "set_*text_editor", "get_*text_editor");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_*file_list"), &VanillaEditor::get_*file_list);
|
||||
ClassDB::bind_method(D_METHOD("set_*file_list", "value"), &VanillaEditor::set_*file_list);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*file_list", PROPERTY_HINT_RESOURCE_TYPE, "FileDialog"), "set_*file_list", "get_*file_list");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_*search_box"), &VanillaEditor::get_*search_box);
|
||||
ClassDB::bind_method(D_METHOD("set_*search_box", "value"), &VanillaEditor::set_*search_box);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*search_box", PROPERTY_HINT_RESOURCE_TYPE, "HBoxContainer"), "set_*search_box", "get_*search_box");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_*search_box_line_edit"), &VanillaEditor::get_*search_box_line_edit);
|
||||
ClassDB::bind_method(D_METHOD("set_*search_box_line_edit", "value"), &VanillaEditor::set_*search_box_line_edit);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*search_box_line_edit", PROPERTY_HINT_RESOURCE_TYPE, "LineEdit"), "set_*search_box_line_edit", "get_*search_box_line_edit");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_*search_box_match_case_cb"), &VanillaEditor::get_*search_box_match_case_cb);
|
||||
ClassDB::bind_method(D_METHOD("set_*search_box_match_case_cb", "value"), &VanillaEditor::set_*search_box_match_case_cb);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*search_box_match_case_cb", PROPERTY_HINT_RESOURCE_TYPE, "CheckBox"), "set_*search_box_match_case_cb", "get_*search_box_match_case_cb");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_*search_box_whole_words_cb"), &VanillaEditor::get_*search_box_whole_words_cb);
|
||||
ClassDB::bind_method(D_METHOD("set_*search_box_whole_words_cb", "value"), &VanillaEditor::set_*search_box_whole_words_cb);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*search_box_whole_words_cb", PROPERTY_HINT_RESOURCE_TYPE, "CheckBox"), "set_*search_box_whole_words_cb", "get_*search_box_whole_words_cb");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_*search_box_close_button"), &VanillaEditor::get_*search_box_close_button);
|
||||
ClassDB::bind_method(D_METHOD("set_*search_box_close_button", "value"), &VanillaEditor::set_*search_box_close_button);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*search_box_close_button", PROPERTY_HINT_RESOURCE_TYPE, "Button"), "set_*search_box_close_button", "get_*search_box_close_button");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_*replace_box"), &VanillaEditor::get_*replace_box);
|
||||
ClassDB::bind_method(D_METHOD("set_*replace_box", "value"), &VanillaEditor::set_*replace_box);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*replace_box", PROPERTY_HINT_RESOURCE_TYPE, "HBoxContainer"), "set_*replace_box", "get_*replace_box");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_*replace_box_replace_le"), &VanillaEditor::get_*replace_box_replace_le);
|
||||
ClassDB::bind_method(D_METHOD("set_*replace_box_replace_le", "value"), &VanillaEditor::set_*replace_box_replace_le);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*replace_box_replace_le", PROPERTY_HINT_RESOURCE_TYPE, "LineEdit"), "set_*replace_box_replace_le", "get_*replace_box_replace_le");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_*replace_box_with"), &VanillaEditor::get_*replace_box_with);
|
||||
ClassDB::bind_method(D_METHOD("set_*replace_box_with", "value"), &VanillaEditor::set_*replace_box_with);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*replace_box_with", PROPERTY_HINT_RESOURCE_TYPE, "LineEdit"), "set_*replace_box_with", "get_*replace_box_with");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_*replace_box_button"), &VanillaEditor::get_*replace_box_button);
|
||||
ClassDB::bind_method(D_METHOD("set_*replace_box_button", "value"), &VanillaEditor::set_*replace_box_button);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*replace_box_button", PROPERTY_HINT_RESOURCE_TYPE, "Button"), "set_*replace_box_button", "get_*replace_box_button");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_*replace_box_close"), &VanillaEditor::get_*replace_box_close);
|
||||
ClassDB::bind_method(D_METHOD("set_*replace_box_close", "value"), &VanillaEditor::set_*replace_box_close);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*replace_box_close", PROPERTY_HINT_RESOURCE_TYPE, "Button"), "set_*replace_box_close", "get_*replace_box_close");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_*file_info_last_modified_icon"), &VanillaEditor::get_*file_info_last_modified_icon);
|
||||
ClassDB::bind_method(D_METHOD("set_*file_info_last_modified_icon", "value"), &VanillaEditor::set_*file_info_last_modified_icon);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*file_info_last_modified_icon", PROPERTY_HINT_RESOURCE_TYPE, "TextureRect"), "set_*file_info_last_modified_icon", "get_*file_info_last_modified_icon");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_*file_info_last_modified"), &VanillaEditor::get_*file_info_last_modified);
|
||||
ClassDB::bind_method(D_METHOD("set_*file_info_last_modified", "value"), &VanillaEditor::set_*file_info_last_modified);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*file_info_last_modified", PROPERTY_HINT_RESOURCE_TYPE, "Label"), "set_*file_info_last_modified", "get_*file_info_last_modified");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_*file_info_c_counter"), &VanillaEditor::get_*file_info_c_counter);
|
||||
ClassDB::bind_method(D_METHOD("set_*file_info_c_counter", "value"), &VanillaEditor::set_*file_info_c_counter);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*file_info_c_counter", PROPERTY_HINT_RESOURCE_TYPE, "Label"), "set_*file_info_c_counter", "get_*file_info_c_counter");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_*file_info_read_only"), &VanillaEditor::get_*file_info_read_only);
|
||||
ClassDB::bind_method(D_METHOD("set_*file_info_read_only", "value"), &VanillaEditor::set_*file_info_read_only);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*file_info_read_only", PROPERTY_HINT_RESOURCE_TYPE, "CheckBox"), "set_*file_info_read_only", "get_*file_info_read_only");
|
||||
|
||||
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "search_flag"), "set_search_flag", "get_search_flag");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_init"), &VanillaEditor::_init);
|
||||
ClassDB::bind_method(D_METHOD("_ready"), &VanillaEditor::_ready);
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
126
modules/text_editor/vanillaeditor.h
Normal file
126
modules/text_editor/vanillaeditor.h
Normal file
@ -0,0 +1,126 @@
|
||||
#ifndef VANILLAEDITOR_H
|
||||
#define VANILLAEDITOR_H
|
||||
|
||||
|
||||
class VanillaEditor : public VBoxContainer {
|
||||
GDCLASS(VanillaEditor, VBoxContainer);
|
||||
|
||||
public:
|
||||
|
||||
Reference get_*LastOpenedFiles();
|
||||
void set_*LastOpenedFiles(const Reference &val);
|
||||
|
||||
TextEdit get_*text_editor();
|
||||
void set_*text_editor(const TextEdit &val);
|
||||
|
||||
FileDialog get_*file_list();
|
||||
void set_*file_list(const FileDialog &val);
|
||||
|
||||
HBoxContainer get_*search_box();
|
||||
void set_*search_box(const HBoxContainer &val);
|
||||
|
||||
LineEdit get_*search_box_line_edit();
|
||||
void set_*search_box_line_edit(const LineEdit &val);
|
||||
|
||||
CheckBox get_*search_box_match_case_cb();
|
||||
void set_*search_box_match_case_cb(const CheckBox &val);
|
||||
|
||||
CheckBox get_*search_box_whole_words_cb();
|
||||
void set_*search_box_whole_words_cb(const CheckBox &val);
|
||||
|
||||
Button get_*search_box_close_button();
|
||||
void set_*search_box_close_button(const Button &val);
|
||||
|
||||
HBoxContainer get_*replace_box();
|
||||
void set_*replace_box(const HBoxContainer &val);
|
||||
|
||||
LineEdit get_*replace_box_replace_le();
|
||||
void set_*replace_box_replace_le(const LineEdit &val);
|
||||
|
||||
LineEdit get_*replace_box_with();
|
||||
void set_*replace_box_with(const LineEdit &val);
|
||||
|
||||
Button get_*replace_box_button();
|
||||
void set_*replace_box_button(const Button &val);
|
||||
|
||||
Button get_*replace_box_close();
|
||||
void set_*replace_box_close(const Button &val);
|
||||
|
||||
TextureRect get_*file_info_last_modified_icon();
|
||||
void set_*file_info_last_modified_icon(const TextureRect &val);
|
||||
|
||||
Label get_*file_info_last_modified();
|
||||
void set_*file_info_last_modified(const Label &val);
|
||||
|
||||
Label get_*file_info_c_counter();
|
||||
void set_*file_info_c_counter(const Label &val);
|
||||
|
||||
CheckBox get_*file_info_read_only();
|
||||
void set_*file_info_read_only(const CheckBox &val);
|
||||
|
||||
String get_current_path();
|
||||
void set_current_path(const String &val);
|
||||
|
||||
String get_current_filename();
|
||||
void set_current_filename(const String &val);
|
||||
|
||||
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);
|
||||
void draw_minimap(const bool value);
|
||||
void color_region(const String &filextension);
|
||||
void clean_editor();
|
||||
void new_file_open(const String &file_content, const Dictionary &last_modified, const String ¤t_file_path);
|
||||
void update_lastmodified(const Dictionary &last_modified, const String &icon);
|
||||
void new_file_create(const String &file_name);
|
||||
void _on_Readonly_toggled(const bool button_pressed);
|
||||
void _on_text_editor_text_changed();
|
||||
void count_characters();
|
||||
void _on_LineEdit_text_changed(const String &new_text);
|
||||
void _on_matchcase_toggled(const bool button_pressed);
|
||||
void _on_wholewords_toggled(const bool button_pressed);
|
||||
void _on_close_pressed();
|
||||
void open_search_box();
|
||||
void _on_Button_pressed();
|
||||
void open_replace_box();
|
||||
void _on_close2_pressed();
|
||||
void _on_LineEdit_focus_entered();
|
||||
|
||||
VanillaEditor();
|
||||
~VanillaEditor();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
//tool
|
||||
Reference *LastOpenedFiles = null;
|
||||
TextEdit *text_editor = null;
|
||||
FileDialog *file_list = null;
|
||||
HBoxContainer *search_box = null;
|
||||
LineEdit *search_box_line_edit = null;
|
||||
CheckBox *search_box_match_case_cb = null;
|
||||
CheckBox *search_box_whole_words_cb = null;
|
||||
Button *search_box_close_button = null;
|
||||
HBoxContainer *replace_box = null;
|
||||
LineEdit *replace_box_replace_le = null;
|
||||
LineEdit *replace_box_with = null;
|
||||
Button *replace_box_button = null;
|
||||
Button *replace_box_close = null;
|
||||
TextureRect *file_info_last_modified_icon = null;
|
||||
Label *file_info_last_modified = null;
|
||||
Label *file_info_c_counter = null;
|
||||
CheckBox *file_info_read_only = null;
|
||||
String current_path = "";
|
||||
String current_filename = "";
|
||||
int search_flag = 0;
|
||||
signal text_changed();
|
||||
//file_info_last_modified_icon.texture = IconLoader.load_icon_from_name(icon)
|
||||
};
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user