diff options
author | reduz <reduzio@gmail.com> | 2014-05-06 08:59:34 -0300 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2014-05-06 08:59:34 -0300 |
commit | 5044bead5f344a24f971f0bb0c8d282f1785f06a (patch) | |
tree | 554effb91a3c96ae28017bb1ee60d0ef17fc5691 /tools/editor/editor_help.cpp | |
parent | e27bc784ddb71423792f58e88266680d63f4d237 (diff) | |
parent | 6c0f3f8d0ca9e30951f0e6e643af07ca7ed695a9 (diff) |
Merge pull request #373 from marynate/PR-contextual-help
Contextual help for Script Editor
Diffstat (limited to 'tools/editor/editor_help.cpp')
-rw-r--r-- | tools/editor/editor_help.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index 19e65f3844..ddbc8ee479 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -43,6 +43,7 @@ void EditorHelpSearch::popup(const String& p_term) { if (p_term!="") { search_box->set_text(p_term); search_box->select_all(); + _update_search(); } else search_box->clear(); search_box->grab_focus(); @@ -70,7 +71,6 @@ void EditorHelpSearch::_sbox_input(const InputEvent& p_ie) { void EditorHelpSearch::_update_search() { - search_options->clear(); search_options->set_hide_root(true); @@ -249,6 +249,7 @@ void EditorHelpSearch::_confirmed() { String mdata=ti->get_metadata(0); emit_signal("go_to_help",mdata); + editor->call("_editor_select",3); // in case EditorHelpSearch beeen invoked on top of other editor window // go to that hide(); } @@ -318,10 +319,14 @@ DocData *EditorHelp::doc=NULL; void EditorHelp::_unhandled_key_input(const InputEvent& p_ev) { - if (is_visible() && p_ev.key.mod.control && p_ev.key.scancode==KEY_F) { + if (!is_visible()) + return; + if ( p_ev.key.mod.control && p_ev.key.scancode==KEY_F) { search->grab_focus(); search->select_all(); + } else if (p_ev.key.mod.shift && p_ev.key.scancode==KEY_F1) { + class_search->popup(); } } @@ -454,9 +459,11 @@ void EditorHelp::_scroll_changed(double p_scroll) { history[p].scroll=p_scroll; } -void EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_vscr) { +Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_vscr) { - ERR_FAIL_COND(!doc->class_list.has(p_class)); + //ERR_FAIL_COND(!doc->class_list.has(p_class)); + if (!doc->class_list.has(p_class)) + return ERR_DOES_NOT_EXIST; if (tree_item_map.has(p_class)) { @@ -470,7 +477,7 @@ void EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_vs description_line=0; if (p_class==edited_class->get_text()) - return; //already there + return OK; //already there scroll_locked=true; @@ -858,13 +865,16 @@ void EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_vs scroll_locked=false; + return OK; } -void EditorHelp::_request_help(const String& p_string) { - - _goto_desc(p_string); - - +void EditorHelp::_request_help(const String& p_string) { + Error err = _goto_desc(p_string); + if (err==OK) { + editor->call("_editor_select",3); + } else { + class_search->popup(p_string); + } //100 palabras } |