1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-28 16:07:14 +00:00

Focus the search box when pressing Ctrl+F in Project/Editor Settings

This commit is contained in:
Hugo Locurcio
2019-10-06 17:13:56 +02:00
parent 1d9233c388
commit 724b9bc0ce
3 changed files with 48 additions and 26 deletions

View File

@@ -140,32 +140,35 @@ void EditorSettingsDialog::_notification(int p_what) {
void EditorSettingsDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> k = p_event;
const Ref<InputEventKey> k = p_event;
if (k.is_valid() && is_window_modal_on_top()) {
if (k.is_valid() && is_window_modal_on_top() && k->is_pressed()) {
if (k->is_pressed()) {
bool handled = false;
bool handled = false;
if (ED_IS_SHORTCUT("editor/undo", p_event)) {
String action = undo_redo->get_current_action_name();
if (action != "")
EditorNode::get_log()->add_message("Undo: " + action, EditorLog::MSG_TYPE_EDITOR);
undo_redo->undo();
handled = true;
}
if (ED_IS_SHORTCUT("editor/undo", p_event)) {
String action = undo_redo->get_current_action_name();
if (action != "")
EditorNode::get_log()->add_message("Undo: " + action, EditorLog::MSG_TYPE_EDITOR);
undo_redo->undo();
handled = true;
}
if (ED_IS_SHORTCUT("editor/redo", p_event)) {
undo_redo->redo();
String action = undo_redo->get_current_action_name();
if (action != "")
EditorNode::get_log()->add_message("Redo: " + action, EditorLog::MSG_TYPE_EDITOR);
handled = true;
}
if (ED_IS_SHORTCUT("editor/redo", p_event)) {
undo_redo->redo();
String action = undo_redo->get_current_action_name();
if (action != "")
EditorNode::get_log()->add_message("Redo: " + action, EditorLog::MSG_TYPE_EDITOR);
handled = true;
}
if (handled) {
accept_event();
}
if (k->get_scancode_with_modifiers() == (KEY_MASK_CMD | KEY_F)) {
_focus_current_search_box();
handled = true;
}
if (handled) {
accept_event();
}
}
}
@@ -408,7 +411,6 @@ EditorSettingsDialog::EditorSettingsDialog() {
tabs->set_tab_align(TabContainer::ALIGN_LEFT);
tabs->connect("tab_changed", this, "_tabs_tab_changed");
add_child(tabs);
//set_child_rect(tabs);
// General Tab
@@ -425,7 +427,6 @@ EditorSettingsDialog::EditorSettingsDialog() {
hbc->add_child(search_box);
inspector = memnew(SectionedInspector);
//inspector->hide_top_label();
inspector->get_inspector()->set_use_filter(true);
inspector->register_search_box(search_box);
inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL);
@@ -474,7 +475,6 @@ EditorSettingsDialog::EditorSettingsDialog() {
shortcuts->set_v_size_flags(SIZE_EXPAND_FILL);
shortcuts->set_columns(2);
shortcuts->set_hide_root(true);
//shortcuts->set_hide_folding(true);
shortcuts->set_column_titles_visible(true);
shortcuts->set_column_title(0, TTR("Name"));
shortcuts->set_column_title(1, TTR("Binding"));
@@ -495,9 +495,7 @@ EditorSettingsDialog::EditorSettingsDialog() {
press_a_key->connect("gui_input", this, "_wait_for_key");
press_a_key->connect("confirmed", this, "_press_a_key_confirm");
//get_ok()->set_text("Apply");
set_hide_on_ok(true);
//get_cancel()->set_text("Close");
timer = memnew(Timer);
timer->set_wait_time(1.5);