Make the Design tab sidebar dockable and collapsible like Prepare's

The sidebar can move to either side, float, be resized, and collapse with
the canvas button or Shift+Tab. Its layout is remembered separately from
Prepare's, starts where Prepare's sidebar is, and View > Reset Window
Layout resets both tabs.
This commit is contained in:
SoftFever
2026-10-03 19:05:53 +08:00
parent a9c8721380
commit d47fb804c3
17 changed files with 420 additions and 164 deletions
+22
View File
@@ -1672,5 +1672,27 @@ float GLToolbar::get_scaled_icon_size()
return m_layout.icons_size * m_layout.scale;
}
bool setup_collapse_toolbar(GLToolbar& toolbar, std::function<void()> toggle)
{
toolbar.set_layout_type(GLToolbar::Layout::Vertical);
toolbar.set_horizontal_orientation(GLToolbar::Layout::HO_Right);
toolbar.set_vertical_orientation(GLToolbar::Layout::VO_Top);
toolbar.set_border(4.0f);
toolbar.set_separator_size(4);
toolbar.set_gap_size(2);
toolbar.del_all_item();
GLToolbarItem::Data item;
item.name = "collapse_sidebar";
// set collapse svg name
item.icon_filename = "collapse.svg";
item.sprite_id = 0;
item.left.action_callback = std::move(toggle);
return toolbar.add_item(item);
}
} // namespace GUI
} // namespace Slic3r