void FileDialog::_unhandled_input(const InputEvent& p_event) { if (p_event.type==InputEvent::KEY && is_window_modal_on_top()) { const InputEventKey &k=p_event.key; if (k.pressed) { bool handled=true; switch (k.scancode) { case KEY_H: { if (k.mod.command) { set_show_hidden_files(!show_hidden_files); } else { handled=false; } } break; case KEY_F5: { invalidate(); } break; default: { handled=false; } } if (handled) accept_event(); } } }
void FileDialog::_unhandled_input(const Ref<InputEvent> &p_event) { Ref<InputEventKey> k = p_event; if (k.is_valid() && is_window_modal_on_top()) { if (k->is_pressed()) { bool handled = true; switch (k->get_scancode()) { case KEY_H: { if (k->get_command()) { set_show_hidden_files(!show_hidden_files); } else { handled = false; } } break; case KEY_F5: { invalidate(); } break; default: { handled = false; } } if (handled) accept_event(); } } }
void EditorFileDialog::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { mode_thumbnails->set_icon(get_icon("FileThumbnail","EditorIcons")); mode_list->set_icon(get_icon("FileList","EditorIcons")); dir_prev->set_icon(get_icon("ArrowLeft","EditorIcons")); dir_next->set_icon(get_icon("ArrowRight","EditorIcons")); dir_up->set_icon(get_icon("ArrowUp","EditorIcons")); refresh->set_icon(get_icon("Reload","EditorIcons")); favorite->set_icon(get_icon("Favorites","EditorIcons")); fav_up->set_icon(get_icon("MoveUp","EditorIcons")); fav_down->set_icon(get_icon("MoveDown","EditorIcons")); fav_rm->set_icon(get_icon("RemoveSmall","EditorIcons")); } else if (p_what==NOTIFICATION_PROCESS) { if (preview_waiting) { preview_wheel_timeout-=get_process_delta_time(); if (preview_wheel_timeout<=0) { preview_wheel_index++; if (preview_wheel_index>=8) preview_wheel_index=0; Ref<Texture> frame = get_icon("WaitPreview"+itos(preview_wheel_index+1),"EditorIcons"); preview->set_texture(frame); preview_wheel_timeout=0.1; } } } else if (p_what==NOTIFICATION_DRAW) { //RID ci = get_canvas_item(); //get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size())); } else if (p_what==NOTIFICATION_POPUP_HIDE) { set_process_unhandled_input(false); } else if (p_what==EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { bool show_hidden=EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"); if (show_hidden_files!=show_hidden) set_show_hidden_files(show_hidden); set_display_mode((DisplayMode)EditorSettings::get_singleton()->get("file_dialog/display_mode").operator int()); } }
void EditorFileDialog::_unhandled_input(const InputEvent& p_event) { if (p_event.type==InputEvent::KEY && is_window_modal_on_top()) { const InputEventKey &k=p_event.key; if (k.pressed) { bool handled=true; switch (k.scancode) { case KEY_H: { if (k.mod.command) { bool show=!show_hidden_files; set_show_hidden_files(show); EditorSettings::get_singleton()->set("file_dialog/show_hidden_files",show); } else { handled=false; } } break; case KEY_F5: { invalidate(); } break; default: { handled=false; } } if (handled) accept_event(); } } }
void EditorFileDialog::_unhandled_input(const InputEvent& p_event) { if (p_event.type==InputEvent::KEY && is_window_modal_on_top()) { if (p_event.key.pressed) { bool handled=false; if (ED_IS_SHORTCUT("file_dialog/go_back", p_event)) { _go_back(); handled=true; } if (ED_IS_SHORTCUT("file_dialog/go_forward", p_event)) { _go_forward(); handled=true; } if (ED_IS_SHORTCUT("file_dialog/go_up", p_event)) { _go_up(); handled=true; } if (ED_IS_SHORTCUT("file_dialog/refresh", p_event)) { invalidate(); handled=true; } if (ED_IS_SHORTCUT("file_dialog/toggle_hidden_files", p_event)) { bool show=!show_hidden_files; set_show_hidden_files(show); EditorSettings::get_singleton()->set("file_dialog/show_hidden_files",show); handled=true; } if (ED_IS_SHORTCUT("file_dialog/toggle_favorite", p_event)) { _favorite_toggled(favorite->is_pressed()); handled=true; } if (ED_IS_SHORTCUT("file_dialog/toggle_mode", p_event)) { if (mode_thumbnails->is_pressed()) { set_display_mode(DISPLAY_LIST); } else { set_display_mode(DISPLAY_THUMBNAILS); } handled=true; } if (ED_IS_SHORTCUT("file_dialog/create_folder", p_event)) { _make_dir(); handled=true; } if (ED_IS_SHORTCUT("file_dialog/focus_path", p_event)) { dir->grab_focus(); handled=true; } if (ED_IS_SHORTCUT("file_dialog/move_favorite_up", p_event)) { _favorite_move_up(); handled=true; } if (ED_IS_SHORTCUT("file_dialog/move_favorite_down", p_event)) { _favorite_move_down(); handled=true; } if (handled) { accept_event(); } } } }