summaryrefslogtreecommitdiff
path: root/editor/plugins/text_editor.cpp
diff options
context:
space:
mode:
authorEric M <itsjusteza@gmail.com>2020-09-17 11:40:00 +1000
committerEric M <itsjusteza@gmail.com>2020-11-23 21:14:26 +1000
commitefe5c250d5c0f749ed594ddd04fa76ca20abe4a4 (patch)
tree4f646765d7c89472d5d516bc84803e6c7af5e964 /editor/plugins/text_editor.cpp
parentfc806409f491f7585eecd0f01bd50609dfc93729 (diff)
Implement new shortcuts system.
unhandled_key_input changed to unhandled_button_input. Controls can set a 'shortcut_context' which they can then use to determine if their shortcuts should be triggered or not, based on if the viewport's focused GUI control is a child of their 'shortcut context'.
Diffstat (limited to 'editor/plugins/text_editor.cpp')
-rw-r--r--editor/plugins/text_editor.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index 8935b698b6..9894d0e1b0 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -563,6 +563,7 @@ TextEditor::TextEditor() {
edit_hb = memnew(HBoxContainer);
search_menu = memnew(MenuButton);
+ search_menu->set_shortcut_context(this);
edit_hb->add_child(search_menu);
search_menu->set_text(TTR("Search"));
search_menu->set_switch_on_hover(true);
@@ -577,6 +578,7 @@ TextEditor::TextEditor() {
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace_in_files"), REPLACE_IN_FILES);
edit_menu = memnew(MenuButton);
+ edit_menu->set_shortcut_context(this);
edit_hb->add_child(edit_menu);
edit_menu->set_text(TTR("Edit"));
edit_menu->set_switch_on_hover(true);
@@ -631,6 +633,7 @@ TextEditor::TextEditor() {
set_syntax_highlighter(plain_highlighter);
MenuButton *goto_menu = memnew(MenuButton);
+ goto_menu->set_shortcut_context(this);
edit_hb->add_child(goto_menu);
goto_menu->set_text(TTR("Go To"));
goto_menu->set_switch_on_hover(true);