summaryrefslogtreecommitdiff
path: root/tools/editor/plugins/script_text_editor.h
diff options
context:
space:
mode:
authorAndreas Haas <liu.gam3@gmail.com>2016-09-29 09:12:45 +0200
committerAndreas Haas <liu.gam3@gmail.com>2016-09-29 09:12:45 +0200
commitf81d0095259c3affeec0de79e4ad1f38ea9bba39 (patch)
tree04c052636e2aed98b5d82b6e433ea8498e546c71 /tools/editor/plugins/script_text_editor.h
parent5e7db2a5b47a66337517b01e5d43ac87a0ac70b3 (diff)
Add inline ColorPicker to Script text editor.
Adds an option to the script editor context menu that lets you open a ColorPicker in order to easily edit `Color()` constructors. To do this, right click on the word `Color` and select `Pick Color`. A side effect of this change is that the script editor now has its own context menu instead of re-using the one from TextEdit. It's now possible to indent left/right and to toggle comments via this menu. I also felt free to make it more context-sensitive than before: Now "Cut" and "Copy" will only be shown if text has actually been selected. I also added default shortcuts for indent left/right. (alt + left/right) Closes #6232
Diffstat (limited to 'tools/editor/plugins/script_text_editor.h')
-rw-r--r--tools/editor/plugins/script_text_editor.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/editor/plugins/script_text_editor.h b/tools/editor/plugins/script_text_editor.h
index 2c7eac6095..ceef50f0bc 100644
--- a/tools/editor/plugins/script_text_editor.h
+++ b/tools/editor/plugins/script_text_editor.h
@@ -30,6 +30,7 @@
#define SCRIPT_TEXT_EDITOR_H
#include "script_editor_plugin.h"
+#include "scene/gui/color_picker.h"
class ScriptTextEditor : public ScriptEditorBase {
@@ -47,10 +48,16 @@ class ScriptTextEditor : public ScriptEditorBase {
MenuButton *edit_menu;
MenuButton *search_menu;
+ PopupMenu *context_menu;
GotoLineDialog *goto_line_dialog;
ScriptEditorQuickOpen *quick_open;
+ PopupPanel *color_panel;
+ ColorPicker *color_picker;
+ int color_line;
+ String color_args;
+
enum {
EDIT_UNDO,
EDIT_REDO,
@@ -67,6 +74,7 @@ class ScriptTextEditor : public ScriptEditorBase {
EDIT_INDENT_RIGHT,
EDIT_INDENT_LEFT,
EDIT_CLONE_DOWN,
+ EDIT_PICK_COLOR,
SEARCH_FIND,
SEARCH_FIND_NEXT,
SEARCH_FIND_PREV,
@@ -96,6 +104,9 @@ protected:
static void _bind_methods();
void _edit_option(int p_op);
+ void _make_context_menu(bool p_selection, bool p_color);
+ void _text_edit_input_event(const InputEvent& ev);
+ void _color_changed(const Color& p_color);
void _goto_line(int p_line) { goto_line(p_line); }
void _lookup_symbol(const String& p_symbol,int p_row, int p_column);