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
|
||||
#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 {
|
||||
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 set_DIRECTORY(const String &val);
|
||||
void _ready();
|
||||
void connect_signals();
|
||||
|
||||
String get_EXCEPTIONS();
|
||||
void set_EXCEPTIONS(const String &val);
|
||||
void create_selected_file();
|
||||
void open_selected_file();
|
||||
void delete_selected_file();
|
||||
void save_current_file_as();
|
||||
|
||||
PoolStringArray get_EXTENSIONS();
|
||||
void set_EXTENSIONS(const PoolStringArray &val);
|
||||
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);
|
||||
|
||||
MenuButton get_*file_btn();
|
||||
void set_*file_btn(const MenuButton &val);
|
||||
void open_file(const String &path, const String &font = "null");
|
||||
void generate_file_item(const String &path, Control *veditor);
|
||||
VanillaEditor *open_in_vanillaeditor(const String &path);
|
||||
void close_file(const int index);
|
||||
void confirm_close(const int index);
|
||||
|
||||
MenuButton get_*preview_btn();
|
||||
void set_*preview_btn(const MenuButton &val);
|
||||
void _on_update_file();
|
||||
|
||||
MenuButton get_*settings_btn();
|
||||
void set_*settings_btn(const MenuButton &val);
|
||||
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);
|
||||
|
||||
PopupMenu get_*file_btn_popup();
|
||||
void set_*file_btn_popup(const PopupMenu &val);
|
||||
void clean_editor();
|
||||
void csv_preview();
|
||||
void bbcode_preview();
|
||||
void markdown_preview();
|
||||
void html_preview();
|
||||
|
||||
PopupMenu get_*preview_btn_popup();
|
||||
void set_*preview_btn_popup(const PopupMenu &val);
|
||||
void _on_vanillaeditor_text_changed();
|
||||
void update_list();
|
||||
|
||||
PopupMenu get_*settings_btn_popup();
|
||||
void set_*settings_btn_popup(const PopupMenu &val);
|
||||
void on_wrap_button(const int index);
|
||||
void on_minimap_button(const int index);
|
||||
void check_file_preview(const String &file);
|
||||
|
||||
HSplitContainer get_*editor_container();
|
||||
void set_*editor_container(const HSplitContainer &val);
|
||||
void _on_ConfirmationDialog_confirmed();
|
||||
|
||||
VBoxContainer get_*file_container();
|
||||
void set_*file_container(const VBoxContainer &val);
|
||||
FileEditor();
|
||||
~FileEditor();
|
||||
|
||||
ItemList get_*open_file_list();
|
||||
void set_*open_file_list(const ItemList &val);
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
VBoxContainer get_*split_editor_container();
|
||||
void set_*split_editor_container(const VBoxContainer &val);
|
||||
String DIRECTORY;
|
||||
String EXCEPTIONS;
|
||||
Vector<String> EXTENSIONS;
|
||||
|
||||
LineEdit get_*open_file_name();
|
||||
void set_*open_file_name(const LineEdit &val);
|
||||
MenuButton *file_btn;
|
||||
MenuButton *preview_btn;
|
||||
MenuButton *settings_btn;
|
||||
|
||||
OptionButton get_*wrap_btn();
|
||||
void set_*wrap_btn(const OptionButton &val);
|
||||
PopupMenu *file_btn_popup;
|
||||
PopupMenu *preview_btn_popup;
|
||||
PopupMenu *settings_btn_popup;
|
||||
|
||||
OptionButton get_*map_btn();
|
||||
void set_*map_btn(const OptionButton &val);
|
||||
HSplitContainer *editor_container;
|
||||
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();
|
||||
void set_*file_list(const FileDialog &val);
|
||||
FileDialog *file_list;
|
||||
AcceptDialog *new_file_dialogue;
|
||||
LineEdit *new_file_dialogue_name;
|
||||
ConfirmationDialog *confirmation_close;
|
||||
FileDialog *select_font_dialog;
|
||||
|
||||
AcceptDialog get_*new_file_dialogue();
|
||||
void set_*new_file_dialogue(const AcceptDialog &val);
|
||||
Ref<LastOpenedFiles> last_opened_files;
|
||||
|
||||
LineEdit get_*new_file_dialogue_name();
|
||||
void set_*new_file_dialogue_name(const LineEdit &val);
|
||||
Array directories;
|
||||
Array files;
|
||||
|
||||
ConfirmationDialog get_*confirmation_close();
|
||||
void set_*confirmation_close(const ConfirmationDialog &val);
|
||||
int current_file_index;
|
||||
String current_file_path;
|
||||
bool save_as;
|
||||
|
||||
FileDialog get_*select_font_dialog();
|
||||
void set_*select_font_dialog(const FileDialog &val);
|
||||
VanillaEditor *current_editor;
|
||||
|
||||
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,
|
||||
Ref<DynamicFont> current_font;
|
||||
bool editing_file;
|
||||
};
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user