Moved File Filter When Filesystem Dock is on the Bottom Panel

When the Filesystem Dock is on the bottom panel vertical space is more
valuable than horizontal space. Moving the file filter to be horizontal
with the current path LineEdit makes the dock more space efficient when
on the bottom panel. When docked on the side, the file filter is
unchanged.
This commit is contained in:
DallasHuff
2025-10-17 08:36:08 -05:00
parent 60710df3b6
commit ffe00d53bf
2 changed files with 15 additions and 3 deletions

View File

@ -489,7 +489,11 @@ void FileSystemDock::_update_display_mode(bool p_force) {
button_toggle_display_mode->set_button_icon(get_editor_theme_icon(SNAME("Panels1")));
tree->show();
tree->set_v_size_flags(SIZE_EXPAND_FILL);
toolbar2_hbc->show();
if (horizontal) {
toolbar2_hbc->hide();
} else {
toolbar2_hbc->show();
}
_update_tree(get_uncollapsed_paths());
file_list_vb->hide();
@ -4019,12 +4023,14 @@ MenuButton *FileSystemDock::_create_file_menu_button() {
}
void FileSystemDock::update_layout(EditorDock::DockLayout p_layout) {
bool horizontal = p_layout == EditorDock::DOCK_LAYOUT_HORIZONTAL;
horizontal = p_layout == EditorDock::DOCK_LAYOUT_HORIZONTAL;
if (button_dock_placement->is_visible() == horizontal) {
return;
}
if (horizontal) {
path_hb->reparent(toolbar_hbc, false);
toolbar_hbc->move_child(path_hb, 2);
set_meta("_dock_display_mode", get_display_mode());
set_meta("_dock_file_display_mode", get_file_list_display_mode());
@ -4035,6 +4041,8 @@ void FileSystemDock::update_layout(EditorDock::DockLayout p_layout) {
set_file_list_display_mode(new_file_display_mode);
set_custom_minimum_size(Size2(0, 200) * EDSCALE);
} else {
path_hb->reparent(file_list_vb);
file_list_vb->move_child(path_hb, 0);
set_meta("_bottom_display_mode", get_display_mode());
set_meta("_bottom_file_display_mode", get_file_list_display_mode());
@ -4180,7 +4188,7 @@ FileSystemDock::FileSystemDock() {
VBoxContainer *top_vbc = memnew(VBoxContainer);
main_vb->add_child(top_vbc);
HBoxContainer *toolbar_hbc = memnew(HBoxContainer);
toolbar_hbc = memnew(HBoxContainer);
top_vbc->add_child(toolbar_hbc);
HBoxContainer *nav_hbc = memnew(HBoxContainer);
@ -4276,6 +4284,7 @@ FileSystemDock::FileSystemDock() {
split_box->add_child(file_list_vb);
path_hb = memnew(HBoxContainer);
path_hb->set_h_size_flags(SIZE_EXPAND_FILL);
file_list_vb->add_child(path_hb);
file_list_search_box = memnew(LineEdit);

View File

@ -165,6 +165,7 @@ private:
Button *button_hist_prev = nullptr;
LineEdit *current_path_line_edit = nullptr;
HBoxContainer *toolbar_hbc = nullptr;
HBoxContainer *toolbar2_hbc = nullptr;
LineEdit *tree_search_box = nullptr;
MenuButton *tree_button_sort = nullptr;
@ -182,6 +183,8 @@ private:
DisplayMode display_mode;
DisplayMode old_display_mode;
bool horizontal = false;
PopupMenu *file_list_popup = nullptr;
PopupMenu *tree_popup = nullptr;