diff options
author | marynate <mary.w.nate@gmail.com> | 2014-05-06 17:41:19 +0800 |
---|---|---|
committer | marynate <mary.w.nate@gmail.com> | 2014-05-06 19:21:21 +0800 |
commit | ab76f541961c9bf11ba51ea6aeeacab529e9e0b9 (patch) | |
tree | b427d8c28779c41254eb0282d0cc90e839b135b2 | |
parent | d3b7f4b1a7f73f3ec69157d2f400ae24b4e02896 (diff) |
Update EditorHelp to response help request other than class; Make sure EditorHelpSearch dialog popup with search results
-rw-r--r-- | tools/editor/editor_help.cpp | 41 | ||||
-rw-r--r-- | tools/editor/editor_help.h | 2 |
2 files changed, 22 insertions, 21 deletions
diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index a77d27d699..ddbc8ee479 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -44,15 +44,9 @@ void EditorHelpSearch::popup(const String& p_term) { search_box->set_text(p_term); search_box->select_all(); _update_search(); - //TreeItem *ti = search_options->select_single_item(); - //if (!ti) - // return; - search_options->grab_focus(); - - } else { + } else search_box->clear(); - search_box->grab_focus(); - } + search_box->grab_focus(); } @@ -77,7 +71,6 @@ void EditorHelpSearch::_sbox_input(const InputEvent& p_ie) { void EditorHelpSearch::_update_search() { - search_options->clear(); search_options->set_hide_root(true); @@ -256,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(); } @@ -325,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(); } } @@ -461,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)) { @@ -477,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; @@ -865,15 +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); - class_search->popup(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 } diff --git a/tools/editor/editor_help.h b/tools/editor/editor_help.h index eac33e5e16..94a31ce902 100644 --- a/tools/editor/editor_help.h +++ b/tools/editor/editor_help.h @@ -139,7 +139,7 @@ class EditorHelp : public VBoxContainer { void _class_list_select(const String& p_select); void _class_desc_select(const String& p_select); - void _goto_desc(const String& p_class,bool p_update_history=true,int p_vscr=-1); + Error _goto_desc(const String& p_class,bool p_update_history=true,int p_vscr=-1); void _update_history_buttons(); void _update_doc(); |