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/plugins | |
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/plugins')
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 18 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.h | 3 |
2 files changed, 17 insertions, 4 deletions
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index a01565a046..83cf753692 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -394,7 +394,6 @@ ScriptTextEditor::ScriptTextEditor() { /*** SCRIPT EDITOR ******/ - String ScriptEditor::_get_debug_tooltip(const String&p_text,Node *_ste) { ScriptTextEditor *ste=_ste->cast_to<ScriptTextEditor>(); @@ -752,6 +751,13 @@ void ScriptEditor::_menu_option(int p_option) { debugger->show(); } } break; + case HELP_CONTEXTUAL: { + String text = current->get_text_edit()->get_selection_text(); + if (text == "") + text = current->get_text_edit()->get_word_under_cursor(); + if (text != "") + editor->emit_signal("request_help", text); + } break; case WINDOW_CLOSE: { erase_tab_confirm->set_text("Close Tab?:\n\""+current->get_name()+"\""); @@ -1051,9 +1057,6 @@ void ScriptEditor::_bind_methods() { ObjectTypeDB::bind_method("_show_debugger",&ScriptEditor::_show_debugger); ObjectTypeDB::bind_method("_get_debug_tooltip",&ScriptEditor::_get_debug_tooltip); - - - } @@ -1362,6 +1365,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("Contextual", HELP_CONTEXTUAL, KEY_MASK_SHIFT|KEY_F1); + help_menu->get_popup()->connect("item_pressed", this,"_menu_option"); + tab_container->connect("tab_changed", this,"_tab_changed"); find_replace_dialog = memnew(FindReplaceDialog); @@ -1414,6 +1423,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { v_split->add_child(debugger); debugger->connect("breaked",this,"_breaked"); // debugger_gui->hide(); + } diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index e0cf3c1a49..97f1702f8f 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_CONTEXTUAL, 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; @@ -185,6 +187,7 @@ class ScriptEditor : public VBoxContainer { void _breaked(bool p_breaked,bool p_can_debug); void _show_debugger(bool p_show); void _update_window_menu(); + static ScriptEditor *script_editor; protected: void _notification(int p_what); |