mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-11 21:31:10 +01:00
Initial cleanup for the FileEdtitor.
This commit is contained in:
parent
614464725b
commit
3f304192f4
File diff suppressed because it is too large
Load Diff
@ -1,216 +1,130 @@
|
|||||||
#ifndef FILEEDITOR_H
|
#ifndef FILEEDITOR_H
|
||||||
#define FILEEDITOR_H
|
#define FILEEDITOR_H
|
||||||
|
|
||||||
|
#include "core/reference.h"
|
||||||
|
#include "core/ustring.h"
|
||||||
|
#include "core/variant.h"
|
||||||
|
#include "core/vector.h"
|
||||||
|
|
||||||
|
#include "scene/gui/control.h"
|
||||||
|
|
||||||
|
class MenuButton;
|
||||||
|
class PopupMenu;
|
||||||
|
class HSplitContainer;
|
||||||
|
class VBoxContainer;
|
||||||
|
class ItemList;
|
||||||
|
class LineEdit;
|
||||||
|
class OptionButton;
|
||||||
|
class FileDialog;
|
||||||
|
class AcceptDialog;
|
||||||
|
class ConfirmationDialog;
|
||||||
|
class LastOpenedFiles;
|
||||||
|
class DynamicFont;
|
||||||
|
class VanillaEditor;
|
||||||
|
|
||||||
class FileEditor : public Control {
|
class FileEditor : public Control {
|
||||||
GDCLASS(FileEditor, Control);
|
GDCLASS(FileEditor, Control);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
|
||||||
String get_DIRECTORY();
|
void _ready();
|
||||||
void set_DIRECTORY(const String &val);
|
void connect_signals();
|
||||||
|
|
||||||
String get_EXCEPTIONS();
|
void create_selected_file();
|
||||||
void set_EXCEPTIONS(const String &val);
|
void open_selected_file();
|
||||||
|
void delete_selected_file();
|
||||||
|
void save_current_file_as();
|
||||||
|
|
||||||
PoolStringArray get_EXTENSIONS();
|
void _on_file_btn_pressed(const int index);
|
||||||
void set_EXTENSIONS(const PoolStringArray &val);
|
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);
|
||||||
|
|
||||||
MenuButton get_*file_btn();
|
void open_file(const String &path, const String &font = "null");
|
||||||
void set_*file_btn(const MenuButton &val);
|
void generate_file_item(const String &path, Control *veditor);
|
||||||
|
VanillaEditor *open_in_vanillaeditor(const String &path);
|
||||||
|
void close_file(const int index);
|
||||||
|
void confirm_close(const int index);
|
||||||
|
|
||||||
MenuButton get_*preview_btn();
|
void _on_update_file();
|
||||||
void set_*preview_btn(const MenuButton &val);
|
|
||||||
|
|
||||||
MenuButton get_*settings_btn();
|
void delete_file(const PoolStringArray &files_selected);
|
||||||
void set_*settings_btn(const MenuButton &val);
|
void open_new_file_dialogue();
|
||||||
|
void open_file_list();
|
||||||
|
void create_new_file(const String &given_path);
|
||||||
|
void save_file(const String ¤t_path);
|
||||||
|
|
||||||
PopupMenu get_*file_btn_popup();
|
void clean_editor();
|
||||||
void set_*file_btn_popup(const PopupMenu &val);
|
void csv_preview();
|
||||||
|
void bbcode_preview();
|
||||||
|
void markdown_preview();
|
||||||
|
void html_preview();
|
||||||
|
|
||||||
PopupMenu get_*preview_btn_popup();
|
void _on_vanillaeditor_text_changed();
|
||||||
void set_*preview_btn_popup(const PopupMenu &val);
|
void update_list();
|
||||||
|
|
||||||
PopupMenu get_*settings_btn_popup();
|
void on_wrap_button(const int index);
|
||||||
void set_*settings_btn_popup(const PopupMenu &val);
|
void on_minimap_button(const int index);
|
||||||
|
void check_file_preview(const String &file);
|
||||||
|
|
||||||
HSplitContainer get_*editor_container();
|
void _on_ConfirmationDialog_confirmed();
|
||||||
void set_*editor_container(const HSplitContainer &val);
|
|
||||||
|
|
||||||
VBoxContainer get_*file_container();
|
FileEditor();
|
||||||
void set_*file_container(const VBoxContainer &val);
|
~FileEditor();
|
||||||
|
|
||||||
ItemList get_*open_file_list();
|
protected:
|
||||||
void set_*open_file_list(const ItemList &val);
|
static void _bind_methods();
|
||||||
|
|
||||||
VBoxContainer get_*split_editor_container();
|
String DIRECTORY;
|
||||||
void set_*split_editor_container(const VBoxContainer &val);
|
String EXCEPTIONS;
|
||||||
|
Vector<String> EXTENSIONS;
|
||||||
|
|
||||||
LineEdit get_*open_file_name();
|
MenuButton *file_btn;
|
||||||
void set_*open_file_name(const LineEdit &val);
|
MenuButton *preview_btn;
|
||||||
|
MenuButton *settings_btn;
|
||||||
|
|
||||||
OptionButton get_*wrap_btn();
|
PopupMenu *file_btn_popup;
|
||||||
void set_*wrap_btn(const OptionButton &val);
|
PopupMenu *preview_btn_popup;
|
||||||
|
PopupMenu *settings_btn_popup;
|
||||||
|
|
||||||
OptionButton get_*map_btn();
|
HSplitContainer *editor_container;
|
||||||
void set_*map_btn(const OptionButton &val);
|
VBoxContainer *file_container;
|
||||||
|
ItemList *_open_file_list;
|
||||||
|
VBoxContainer *split_editor_container;
|
||||||
|
LineEdit *open_file_name;
|
||||||
|
OptionButton *wrap_btn;
|
||||||
|
OptionButton *map_btn;
|
||||||
|
|
||||||
FileDialog get_*file_list();
|
FileDialog *file_list;
|
||||||
void set_*file_list(const FileDialog &val);
|
AcceptDialog *new_file_dialogue;
|
||||||
|
LineEdit *new_file_dialogue_name;
|
||||||
|
ConfirmationDialog *confirmation_close;
|
||||||
|
FileDialog *select_font_dialog;
|
||||||
|
|
||||||
AcceptDialog get_*new_file_dialogue();
|
Ref<LastOpenedFiles> last_opened_files;
|
||||||
void set_*new_file_dialogue(const AcceptDialog &val);
|
|
||||||
|
|
||||||
LineEdit get_*new_file_dialogue_name();
|
Array directories;
|
||||||
void set_*new_file_dialogue_name(const LineEdit &val);
|
Array files;
|
||||||
|
|
||||||
ConfirmationDialog get_*confirmation_close();
|
int current_file_index;
|
||||||
void set_*confirmation_close(const ConfirmationDialog &val);
|
String current_file_path;
|
||||||
|
bool save_as;
|
||||||
|
|
||||||
FileDialog get_*select_font_dialog();
|
VanillaEditor *current_editor;
|
||||||
void set_*select_font_dialog(const FileDialog &val);
|
|
||||||
|
|
||||||
Reference get_*LastOpenedFiles();
|
Ref<DynamicFont> current_font;
|
||||||
void set_*LastOpenedFiles(const Reference &val);
|
bool editing_file;
|
||||||
|
|
||||||
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
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user