Browse Source

Start working on script editor help

marynate 11 years ago
parent
commit
145b8c5e6f

+ 11 - 2
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

+ 11 - 0
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);

+ 2 - 0
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;