summaryrefslogtreecommitdiff
path: root/editor/plugins/text_editor.h
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins/text_editor.h')
-rw-r--r--editor/plugins/text_editor.h107
1 files changed, 48 insertions, 59 deletions
diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h
index 9d9025a2c4..c066d51b18 100644
--- a/editor/plugins/text_editor.h
+++ b/editor/plugins/text_editor.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -37,28 +37,19 @@ class TextEditor : public ScriptEditorBase {
GDCLASS(TextEditor, ScriptEditorBase);
private:
- CodeTextEditor *code_editor;
+ CodeTextEditor *code_editor = nullptr;
Ref<TextFile> text_file;
+ bool editor_enabled = false;
- HBoxContainer *edit_hb;
- MenuButton *edit_menu;
- PopupMenu *highlighter_menu;
- MenuButton *search_menu;
- PopupMenu *bookmarks_menu;
- PopupMenu *context_menu;
-
- GotoLineDialog *goto_line_dialog;
-
- struct ColorsCache {
- Color font_color;
- Color symbol_color;
- Color keyword_color;
- Color basetype_color;
- Color type_color;
- Color comment_color;
- Color string_color;
- } colors_cache;
+ HBoxContainer *edit_hb = nullptr;
+ MenuButton *edit_menu = nullptr;
+ PopupMenu *highlighter_menu = nullptr;
+ MenuButton *search_menu = nullptr;
+ PopupMenu *bookmarks_menu = nullptr;
+ PopupMenu *context_menu = nullptr;
+
+ GotoLineDialog *goto_line_dialog = nullptr;
enum {
EDIT_UNDO,
@@ -98,13 +89,11 @@ private:
protected:
static void _bind_methods();
- void _notification(int p_what);
-
void _edit_option(int p_op);
void _make_context_menu(bool p_selection, bool p_can_fold, bool p_is_folded, Vector2 p_position);
void _text_edit_gui_input(const Ref<InputEvent> &ev);
- Map<String, SyntaxHighlighter *> highlighters;
+ Map<String, Ref<EditorSyntaxHighlighter>> highlighters;
void _change_syntax_highlighter(int p_idx);
void _load_theme_settings();
@@ -116,42 +105,42 @@ protected:
void _bookmark_item_pressed(int p_idx);
public:
- virtual void add_syntax_highlighter(SyntaxHighlighter *p_highlighter);
- virtual void set_syntax_highlighter(SyntaxHighlighter *p_highlighter);
-
- virtual String get_name();
- virtual Ref<Texture2D> get_theme_icon();
- virtual RES get_edited_resource() const;
- virtual void set_edited_resource(const RES &p_res);
- void set_edited_file(const Ref<TextFile> &p_file);
- virtual void reload_text();
- virtual void apply_code();
- virtual bool is_unsaved();
- virtual Variant get_edit_state();
- virtual void set_edit_state(const Variant &p_state);
- virtual Vector<String> get_functions();
- virtual void get_breakpoints(List<int> *p_breakpoints);
- virtual void goto_line(int p_line, bool p_with_error = false);
+ virtual void add_syntax_highlighter(Ref<EditorSyntaxHighlighter> p_highlighter) override;
+ virtual void set_syntax_highlighter(Ref<EditorSyntaxHighlighter> p_highlighter) override;
+
+ virtual String get_name() override;
+ virtual Ref<Texture2D> get_theme_icon() override;
+ virtual RES get_edited_resource() const override;
+ virtual void set_edited_resource(const RES &p_res) override;
+ virtual void enable_editor() override;
+ virtual void reload_text() override;
+ virtual void apply_code() override;
+ virtual bool is_unsaved() override;
+ virtual Variant get_edit_state() override;
+ virtual void set_edit_state(const Variant &p_state) override;
+ virtual Vector<String> get_functions() override;
+ virtual Array get_breakpoints() override;
+ virtual void goto_line(int p_line, bool p_with_error = false) override;
void goto_line_selection(int p_line, int p_begin, int p_end);
- virtual void set_executing_line(int p_line);
- virtual void clear_executing_line();
- virtual void trim_trailing_whitespace();
- virtual void insert_final_newline();
- virtual void convert_indent_to_spaces();
- virtual void convert_indent_to_tabs();
- virtual void ensure_focus();
- virtual void tag_saved_version();
- virtual void update_settings();
- virtual bool show_members_overview();
- virtual bool can_lose_focus_on_node_selection() { return true; }
- virtual void set_debugger_active(bool p_active);
- virtual void set_tooltip_request_func(String p_method, Object *p_obj);
- virtual void add_callback(const String &p_function, PackedStringArray p_args);
-
- virtual Control *get_edit_menu();
- virtual void clear_edit_menu();
-
- virtual void validate();
+ virtual void set_executing_line(int p_line) override;
+ virtual void clear_executing_line() override;
+ virtual void trim_trailing_whitespace() override;
+ virtual void insert_final_newline() override;
+ virtual void convert_indent_to_spaces() override;
+ virtual void convert_indent_to_tabs() override;
+ virtual void ensure_focus() override;
+ virtual void tag_saved_version() override;
+ virtual void update_settings() override;
+ virtual bool show_members_overview() override;
+ virtual bool can_lose_focus_on_node_selection() override { return true; }
+ virtual void set_debugger_active(bool p_active) override;
+ virtual void set_tooltip_request_func(String p_method, Object *p_obj) override;
+ virtual void add_callback(const String &p_function, PackedStringArray p_args) override;
+
+ virtual Control *get_edit_menu() override;
+ virtual void clear_edit_menu() override;
+
+ virtual void validate() override;
static void register_editor();