diff options
Diffstat (limited to 'editor/editor_help.cpp')
-rw-r--r-- | editor/editor_help.cpp | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 11fa9396a0..11cb61370d 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -61,14 +61,16 @@ void EditorHelpSearch::_text_changed(const String &p_newtext) { _update_search(); } -void EditorHelpSearch::_sbox_input(const InputEvent &p_ie) { +void EditorHelpSearch::_sbox_input(const Ref<InputEvent> &p_ie) { - if (p_ie.type == InputEvent::KEY && (p_ie.key.scancode == KEY_UP || - p_ie.key.scancode == KEY_DOWN || - p_ie.key.scancode == KEY_PAGEUP || - p_ie.key.scancode == KEY_PAGEDOWN)) { + Ref<InputEventKey> k = p_ie; - search_options->call("_gui_input", p_ie); + if (k.is_valid() && (k->get_scancode() == KEY_UP || + k->get_scancode() == KEY_DOWN || + k->get_scancode() == KEY_PAGEUP || + k->get_scancode() == KEY_PAGEDOWN)) { + + search_options->call("_gui_input", k); search_box->accept_event(); } } @@ -250,8 +252,8 @@ void EditorHelpSearch::_confirmed() { return; String mdata = ti->get_metadata(0); + EditorNode::get_singleton()->set_visible_editor(EditorNode::EDITOR_SCRIPT); emit_signal("go_to_help", mdata); - editor->call("_editor_select", EditorNode::EDITOR_SCRIPT); // in case EditorHelpSearch beeen invoked on top of other editor window // go to that hide(); } @@ -286,7 +288,6 @@ void EditorHelpSearch::_bind_methods() { EditorHelpSearch::EditorHelpSearch() { - editor = EditorNode::get_singleton(); VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); @@ -360,8 +361,8 @@ void EditorHelpIndex::_tree_item_selected() { if (!s) return; + EditorNode::get_singleton()->set_visible_editor(EditorNode::EDITOR_SCRIPT); emit_signal("open_class", s->get_text(0)); - hide(); //_goto_desc(s->get_text(0)); @@ -448,14 +449,16 @@ void EditorHelpIndex::_update_class_list() { } } -void EditorHelpIndex::_sbox_input(const InputEvent &p_ie) { +void EditorHelpIndex::_sbox_input(const Ref<InputEvent> &p_ie) { + + Ref<InputEventKey> k = p_ie; - if (p_ie.type == InputEvent::KEY && (p_ie.key.scancode == KEY_UP || - p_ie.key.scancode == KEY_DOWN || - p_ie.key.scancode == KEY_PAGEUP || - p_ie.key.scancode == KEY_PAGEDOWN)) { + if (k.is_valid() && (k->get_scancode() == KEY_UP || + k->get_scancode() == KEY_DOWN || + k->get_scancode() == KEY_PAGEUP || + k->get_scancode() == KEY_PAGEDOWN)) { - class_list->call("_gui_input", p_ie); + class_list->call("_gui_input", k); search_box->accept_event(); } } @@ -499,11 +502,14 @@ EditorHelpIndex::EditorHelpIndex() { /// ///////////////////////////////// DocData *EditorHelp::doc = NULL; -void EditorHelp::_unhandled_key_input(const InputEvent &p_ev) { +void EditorHelp::_unhandled_key_input(const Ref<InputEvent> &p_ev) { if (!is_visible_in_tree()) return; - if (p_ev.key.mod.control && p_ev.key.scancode == KEY_F) { + + Ref<InputEventKey> k = p_ev; + + if (k.is_valid() && k->get_control() && k->get_scancode() == KEY_F) { search->grab_focus(); search->select_all(); @@ -598,8 +604,11 @@ void EditorHelp::_class_desc_select(const String &p_select) { } } -void EditorHelp::_class_desc_input(const InputEvent &p_input) { - if (p_input.type == InputEvent::MOUSE_BUTTON && p_input.mouse_button.pressed && p_input.mouse_button.button_index == 1) { +void EditorHelp::_class_desc_input(const Ref<InputEvent> &p_input) { + + Ref<InputEventMouseButton> mb = p_input; + + if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == 1) { class_desc->set_selection_enabled(false); class_desc->set_selection_enabled(true); } @@ -1269,7 +1278,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { void EditorHelp::_request_help(const String &p_string) { Error err = _goto_desc(p_string); if (err == OK) { - editor->call("_editor_select", EditorNode::EDITOR_SCRIPT); + EditorNode::get_singleton()->set_visible_editor(EditorNode::EDITOR_SCRIPT); } //100 palabras } @@ -1679,8 +1688,6 @@ void EditorHelp::_bind_methods() { EditorHelp::EditorHelp() { - editor = EditorNode::get_singleton(); - VBoxContainer *vbc = this; EDITOR_DEF("text_editor/help/sort_functions_alphabetically", true); @@ -1776,7 +1783,7 @@ void EditorHelpBit::_bind_methods() { void EditorHelpBit::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - add_style_override("panel", get_stylebox("normal", "TextEdit")); + add_style_override("panel", get_stylebox("ScriptPanel", "EditorStyles")); } } |