| 3452 | } |
| 3453 | |
| 3454 | void ScriptEditor::shortcut_input(const Ref<InputEvent> &p_event) { |
| 3455 | ERR_FAIL_COND(p_event.is_null()); |
| 3456 | |
| 3457 | if (!is_visible_in_tree() || !p_event->is_pressed() || p_event->is_echo()) { |
| 3458 | return; |
| 3459 | } |
| 3460 | if (ED_IS_SHORTCUT("script_editor/next_script", p_event)) { |
| 3461 | if (script_list->get_item_count() > 1) { |
| 3462 | int next_tab = script_list->get_current() + 1; |
| 3463 | next_tab %= script_list->get_item_count(); |
| 3464 | _go_to_tab(script_list->get_item_metadata(next_tab)); |
| 3465 | _update_script_names(); |
| 3466 | } |
| 3467 | accept_event(); |
| 3468 | } |
| 3469 | if (ED_IS_SHORTCUT("script_editor/prev_script", p_event)) { |
| 3470 | if (script_list->get_item_count() > 1) { |
| 3471 | int next_tab = script_list->get_current() - 1; |
| 3472 | next_tab = next_tab >= 0 ? next_tab : script_list->get_item_count() - 1; |
| 3473 | _go_to_tab(script_list->get_item_metadata(next_tab)); |
| 3474 | _update_script_names(); |
| 3475 | } |
| 3476 | accept_event(); |
| 3477 | } |
| 3478 | if (ED_IS_SHORTCUT("script_editor/window_move_up", p_event)) { |
| 3479 | _menu_option(FILE_MENU_MOVE_UP); |
| 3480 | accept_event(); |
| 3481 | } |
| 3482 | if (ED_IS_SHORTCUT("script_editor/window_move_down", p_event)) { |
| 3483 | _menu_option(FILE_MENU_MOVE_DOWN); |
| 3484 | accept_event(); |
| 3485 | } |
| 3486 | |
| 3487 | Callable custom_callback = EditorContextMenuPluginManager::get_singleton()->match_custom_shortcut(EditorContextMenuPlugin::CONTEXT_SLOT_SCRIPT_EDITOR, p_event); |
| 3488 | if (custom_callback.is_valid()) { |
| 3489 | Ref<Resource> resource; |
| 3490 | ScriptEditorBase *current = _get_current_editor(); |
| 3491 | if (current) { |
| 3492 | resource = current->get_edited_resource(); |
| 3493 | } |
| 3494 | EditorContextMenuPluginManager::get_singleton()->invoke_callback(custom_callback, resource); |
| 3495 | accept_event(); |
| 3496 | } |
| 3497 | } |
| 3498 | |
| 3499 | void ScriptEditor::_script_list_clicked(int p_item, Vector2 p_local_mouse_pos, MouseButton p_mouse_button_index) { |
| 3500 | if (p_mouse_button_index == MouseButton::MIDDLE) { |
nothing calls this directly
no test coverage detected