feat(statusbar): scrollable layout tabs + layout-list dropdown (#199)

Keep the right-side status-bar tools from being pushed off the bar when a
drawing has many layouts: the layout tabs now live in a horizontal scrollable
that only takes the space left between the menu and the tools, with ‹ › arrows
(and the mouse wheel) to scroll them.

Repurpose the leftmost hamburger — which previously fired a no-op MENU command
— to open a dropdown listing Model and every layout (scrollable, current
highlighted); picking one switches to it, an outside click dismisses it.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-27 14:24:47 +03:00
1 parent 4116b85af0
commit 3def2f2034
5 files changed
+173 -9

No files matched your search

+10
View File
@@ -202,6 +202,8 @@ pub(super) struct OpenCADStudio {
scale_popup_open: bool,
/// True while the status-bar customization menu is open.
statusbar_menu_open: bool,
/// True while the leftmost hamburger's Model/layout list dropdown is open.
layout_list_open: bool,
/// True while the drawing-units picker is open.
units_popup_open: bool,
/// True while the Isolate pill's action menu is open.
@@ -1011,6 +1013,9 @@ pub enum Message {
OpenRecent(PathBuf),
/// Open a URL in the system browser (start-page intro video, links).
OpenUrl(String),
/// Scroll the status-bar layout-tab strip horizontally by `delta` px
/// (negative = left). Driven by the ‹ › arrows next to the tabs.
ScrollLayoutTabs(f32),
/// Drop a path from the recent-documents list.
RecentRemove(PathBuf),
/// User clicked Cancel on the loading overlay. The parser thread keeps
@@ -1215,6 +1220,10 @@ pub enum Message {
ToggleScalePopup,
/// Close the scale picker popup.
CloseScalePopup,
/// Toggle the leftmost hamburger's Model/layout list dropdown.
ToggleLayoutList,
/// Close the Model/layout list dropdown.
CloseLayoutList,
/// Toggle the status-bar customization menu open/closed.
ToggleStatusBarMenu,
/// Close the status-bar customization menu.
@@ -1794,6 +1803,7 @@ impl OpenCADStudio {
snap_popup_open: false,
scale_popup_open: false,
statusbar_menu_open: false,
layout_list_open: false,
units_popup_open: false,
isolate_popup_open: false,
selection_filter_popup_open: false,
+17 -1
View File
@@ -213,6 +213,11 @@ impl OpenCADStudio {
Task::none()
}
Message::ScrollLayoutTabs(dx) => iced::widget::operation::scroll_by(
iced::advanced::widget::Id::new(crate::ui::statusbar::LAYOUT_TABS_SCROLL_ID),
iced::widget::scrollable::AbsoluteOffset { x: dx, y: 0.0 },
),
Message::OpenRecent(path) => {
// Recents are read from disk every save → the path may be
// stale. Skip silently if the file no longer exists; the
@@ -1336,6 +1341,14 @@ impl OpenCADStudio {
self.scale_popup_open = false;
Task::none()
}
Message::ToggleLayoutList => {
self.layout_list_open ^= true;
Task::none()
}
Message::CloseLayoutList => {
self.layout_list_open = false;
Task::none()
}
Message::ToggleStatusBarMenu => {
self.statusbar_menu_open ^= true;
Task::none()
@@ -1946,7 +1959,10 @@ impl OpenCADStudio {
Task::none()
}
Message::LayoutSwitch(name) => self.on_layout_switch(name),
Message::LayoutSwitch(name) => {
self.layout_list_open = false;
self.on_layout_switch(name)
}
Message::LayoutCreate => self.on_layout_create(),
+10
View File
@@ -1222,6 +1222,15 @@ impl OpenCADStudio {
iced::widget::Space::new().width(0).height(0).into()
};
let layout_list_layer: Element<'_, Message> = if self.layout_list_open && !tab.is_start {
crate::ui::statusbar::statusbar_menu::layout_list_overlay(
&tab.scene.layout_names(),
&tab.scene.current_layout,
)
} else {
iced::widget::Space::new().width(0).height(0).into()
};
let units_layer: Element<'_, Message> = if self.units_popup_open {
crate::ui::popup::units_popup::units_popup_overlay(tab.scene.document.header.insertion_units)
} else {
@@ -1286,6 +1295,7 @@ impl OpenCADStudio {
snap_layer,
scale_layer,
statusbar_menu_layer,
layout_list_layer,
units_layer,
isolate_layer,
sel_filter_layer,