From 145b8c5e6fb755a2454312dc6f49ca50ff5175b2 Mon Sep 17 00:00:00 2001 From: marynate Date: Mon, 5 May 2014 21:59:18 +0800 Subject: [PATCH] Start working on script editor help --- tools/editor/editor_help.cpp | 13 +++++++++++-- tools/editor/plugins/script_editor_plugin.cpp | 11 +++++++++++ tools/editor/plugins/script_editor_plugin.h | 2 ++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index 19e65f3844f..a77d27d6997 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -43,9 +43,16 @@ void EditorHelpSearch::popup(const String& p_term) { if (p_term!="") { search_box->set_text(p_term); search_box->select_all(); - } else + _update_search(); + //TreeItem *ti = search_options->select_single_item(); + //if (!ti) + // return; + search_options->grab_focus(); + + } else { search_box->clear(); - search_box->grab_focus(); + search_box->grab_focus(); + } } @@ -863,6 +870,8 @@ void EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_vs void EditorHelp::_request_help(const String& p_string) { _goto_desc(p_string); + class_search->popup(p_string); + //100 palabras diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index a01565a0469..2d2e02f5c4a 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -752,6 +752,11 @@ void ScriptEditor::_menu_option(int p_option) { debugger->show(); } } break; + case HELP_SELECTED: { + String selected = current->get_text_edit()->get_selection_text(); + editor->call("_editor_select", 3); + editor->emit_signal("request_help", selected); + } break; case WINDOW_CLOSE: { erase_tab_confirm->set_text("Close Tab?:\n\""+current->get_name()+"\""); @@ -1362,6 +1367,12 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { window_menu->get_popup()->add_separator(); window_menu->get_popup()->connect("item_pressed", this,"_menu_option"); + help_menu = memnew( MenuButton ); + menu_hb->add_child(help_menu); + help_menu->set_text("Help"); + help_menu->get_popup()->add_item("Selected", HELP_SELECTED, KEY_MASK_CTRL|KEY_MASK_SHIFT|KEY_D); + help_menu->get_popup()->connect("item_pressed", this,"_menu_option"); + tab_container->connect("tab_changed", this,"_tab_changed"); find_replace_dialog = memnew(FindReplaceDialog); diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index e0cf3c1a49d..af1fe1c6c34 100644 --- a/tools/editor/plugins/script_editor_plugin.h +++ b/tools/editor/plugins/script_editor_plugin.h @@ -133,6 +133,7 @@ class ScriptEditor : public VBoxContainer { DEBUG_BREAK, DEBUG_CONTINUE, DEBUG_SHOW, + HELP_SELECTED, WINDOW_CLOSE, WINDOW_MOVE_LEFT, WINDOW_MOVE_RIGHT, @@ -145,6 +146,7 @@ class ScriptEditor : public VBoxContainer { MenuButton *search_menu; MenuButton *window_menu; MenuButton *debug_menu; + MenuButton *help_menu; uint64_t idle; TabContainer *tab_container;