From c3d7655b9e9fcd4befd11dfde9a3fe43e39a0fb7 Mon Sep 17 00:00:00 2001 From: aiongg Date: Tue, 17 Nov 2026 04:03:17 +0000 Subject: [PATCH] Shell and mock: AppShell::tools and Slot::columns removed; the gallery mock's toolbar is a stepped dock column drawn through group_view, with a collapsed Navigator column and flyout binding --- crates/ui-gallery/src/mock/commands.rs | 5 ++ crates/ui-gallery/src/mock/editor.rs | 59 +++++++++++-------- crates/ui-gallery/src/mock/model.rs | 20 ++++++- crates/ui-gallery/src/mock/panels.rs | 48 ++++++++++++++- crates/ui-gallery/tests/it/main.rs | 1 + crates/ui-gallery/tests/it/mock.rs | 32 ++++++++++ crates/ui-shell/src/shell/app_shell.rs | 20 ++----- .../ui-shell/src/shell/app_shell/stories.rs | 5 +- crates/ui-shell/src/shell/canvas_shell.rs | 10 ++-- crates/ui-shell/src/shell/regions.rs | 17 +----- crates/ui-shell/src/shell/words.rs | 1 - crates/ui-shell/tests/it/shell/app_shell.rs | 52 +--------------- crates/ui-shell/tests/it/shell/reveal.rs | 6 +- .../api-map/app-shell-and-title-bar.toml | 4 +- 14 files changed, 153 insertions(+), 127 deletions(-) create mode 100644 crates/ui-gallery/tests/it/mock.rs diff --git a/crates/ui-gallery/src/mock/commands.rs b/crates/ui-gallery/src/mock/commands.rs index e67342090..84ce5e610 100644 --- a/crates/ui-gallery/src/mock/commands.rs +++ b/crates/ui-gallery/src/mock/commands.rs @@ -33,6 +33,9 @@ pub enum AppCommand { /// Shows or hides the rulers. #[command(label = "Rulers", kind = "toggle", default = "Cmd+R")] Rulers, + /// Shows or hides the toolbar. + #[command(label = "Tools", kind = "toggle")] + ShowTools, /// Shows or hides the canvas panel. #[command(label = "Canvas", kind = "toggle")] ShowCanvas, @@ -48,6 +51,7 @@ impl AppCommand { /// The command that shows or hides `panel`. pub const fn showing(panel: Panel) -> AppCommand { match panel { + Panel::Tools => AppCommand::ShowTools, Panel::Canvas => AppCommand::ShowCanvas, Panel::Navigator => AppCommand::ShowNavigator, Panel::Layers => AppCommand::ShowLayers, @@ -57,6 +61,7 @@ impl AppCommand { /// The panel the command shows or hides. pub const fn panel(self) -> Option { match self { + AppCommand::ShowTools => Some(Panel::Tools), AppCommand::ShowCanvas => Some(Panel::Canvas), AppCommand::ShowNavigator => Some(Panel::Navigator), AppCommand::ShowLayers => Some(Panel::Layers), diff --git a/crates/ui-gallery/src/mock/editor.rs b/crates/ui-gallery/src/mock/editor.rs index e10abf224..2cc3757c7 100644 --- a/crates/ui-gallery/src/mock/editor.rs +++ b/crates/ui-gallery/src/mock/editor.rs @@ -11,7 +11,7 @@ use craft_theme::variant::Tone; use craft_ui::bars::{Bar, BarKind, StatusMessage, StatusReadout, StatusValues}; use craft_ui::buttons::{IconButton, Link}; use craft_ui::canvas::{PickStep, ViewCommands}; -use craft_ui::contract::{Bind, BodyCx, PaneEdge, Props as _, Remember as _, SaveKey, Show as _, ShowContainer as _}; +use craft_ui::contract::{Bind, BodyCx, Props as _, Remember as _, SaveKey, Show as _, ShowContainer as _}; use craft_ui::dialog::{DialogResult, PromptChoice, StandardPrompt}; use craft_ui::display::{Divider, Text}; use craft_ui::docking::{DockConfig, DockEvent, DockPanels as _}; @@ -20,7 +20,6 @@ use craft_ui::patterns::dock::DockArea; use craft_ui::patterns::form_dialogs::{ DialogFields, HostedImageSize, HostedParamDialog, ImageSize, ImageSizeValues, Param, ParamDialog, ParamResult, }; -use craft_ui::rails::ToolRail; use craft_ui::runtime::commands::{self, CommandRef, Commands as _, EditCommands}; use craft_ui::runtime::env::{Env, Label, WindowKey}; use craft_ui::shell::{AppShell, AppShellOutput, CaptionFamily, Captions, Frame, ScreenMode, ShellDialogsCx as _, Title, TitleBar}; @@ -36,10 +35,10 @@ const BLUR_KEY: &str = "gaussianBlur"; /// Where Gaussian Blur remembers its values. const BLUR_MEMORY: SaveKey = SaveKey::new("craft_ui_gallery.gaussianBlur"); -/// The mock editor: the shell with its title bar and menus, options bar, tool rail and status bar around a dock whose -/// canvas group holds the document tabs, the canvas with its rulers and pasteboard, and the Navigator and layer panels. +/// The mock editor: the shell with its title bar and menus, options bar and status bar around a dock whose canvas group +/// holds the document tabs, the canvas with its rulers and pasteboard, and the toolbar, Navigator and layer panels. /// -/// - Tool: the rail and the tool keys pick the current tool; Hand and Zoom run in the canvas's tool host. +/// - Tool: the toolbar (a stepped dock column) and the tool keys pick the current tool; Hand and Zoom run in the canvas's tool host. /// - Menus: every row is an app command with its chord; the body takes them. /// - Dialogs: Layer, Delete, Layer and Filter, Gaussian Blur open on the window's dialog host; Image, Image Size /// shows its dialog over the document's size. @@ -82,7 +81,6 @@ impl<'a> EditorMock<'a> { .screen_mode(screen_mode) .title_bar_if(true, |ui, _, state: &mut MockState| title_bar(ui, state)) .options_bar(true, |ui, _, state: &mut MockState| options_bar(ui, state)) - .tools(PaneEdge::Start, 1, true, |ui, _, state: &mut MockState| tool_rail(ui, state)) .status(true, |ui, _, state: &mut MockState| status_bar(ui, state)) .body_label(label) .body(|ui, cx, state: &mut MockState| body(ui, cx, state)); @@ -96,15 +94,22 @@ impl<'a> EditorMock<'a> { /// The dock, then the commands and dialog answers of this pass. fn body(ui: &mut Ui, cx: &mut BodyCx<'_>, state: &mut MockState) { let mut tools = cx.keep::().clone(); - let events = { - let mut panels = Panels { document: &mut state.document, tool: state.tool, tools: &mut tools }; + let ctx = ui.ctx().clone(); + let (events, picked) = { + let mut panels = + Panels { document: &mut state.document, tool: state.tool, tools: &mut tools, last_used: &mut state.last_used, picked: None, ctx: &ctx }; // The mock app is a preview inside the gallery's page: its floats stay in it. - let mut area = DockArea::new("Dock", Bind::bound(&mut state.workspace), &mut panels, DockConfig::default().native_windows(false)); + let mut area = DockArea::new("Dock", Bind::bound(&mut state.workspace), &mut panels, DockConfig::default().native_windows(false)) + .flyout(Bind::bound(&mut state.flyout)); if let Some(panel) = state.maximized { area = area.maximized(panel); } - area.show(ui).events + let events = area.show(ui).events; + (events, panels.picked) }; + if let Some(tool) = picked { + select(ui, state, tool); + } for event in events { if let DockEvent::ToggleMaximize { panel, .. } = event { state.maximized = if state.maximized == Some(panel) { None } else { Some(panel) }; @@ -132,8 +137,20 @@ fn body(ui: &mut Ui, cx: &mut BodyCx<'_>, state: &mut MockState) { let mut dialogs = Vec::new(); for command in asked { if let Some(panel) = command.panel() { + // A panel in a column collapsed to icons shows in its flyout: the command opens or closes that. + if state.workspace.layout.opens_in_flyout(&panel) { + state.flyout = if state.flyout == Some(panel) { None } else { Some(panel) }; + continue; + } let shown = state.workspace.layout.panel_state(&panel) != PanelState::Hidden; - let panels = Panels { document: &mut state.document, tool: state.tool, tools: &mut tools }; + let panels = Panels { + document: &mut state.document, + tool: state.tool, + tools: &mut tools, + last_used: &mut state.last_used, + picked: None, + ctx: &ctx, + }; let _ = state.workspace.set_visible(panel, !shown, None, false, |panel| panels.permissions(panel)); continue; } @@ -249,7 +266,12 @@ fn title_bar(ui: &mut Ui, state: &MockState) { }), MenuTitle::new("&Window", |ui| { for panel in Panel::ALL { - let shown = state.workspace.layout.panel_state(&panel) != PanelState::Hidden; + let layout = &state.workspace.layout; + let shown = if layout.opens_in_flyout(&panel) { + state.flyout == Some(panel) + } else { + layout.panel_state(&panel) != PanelState::Hidden + }; MenuItem::command(AppCommand::showing(panel)).check(shown).enabled(!panel.protected()).show(ui); } }), @@ -269,19 +291,6 @@ fn options_bar(ui: &mut Ui, state: &MockState) { }); } -fn tool_rail(ui: &mut Ui, state: &mut MockState) { - let slots = Tool::slots(); - let current = state.tool; - let last_used = state.last_used.clone(); - let output = ToolRail::new("Tools", &slots, ¤t, &last_used).show_rail(ui, |_, _| {}); - if let Some(tool) = output.select { - select(ui, state, tool); - } - if let Some(last_used) = output.last_used { - state.last_used = last_used; - } -} - /// The status bar: the zoom and the chosen readout item, the colour mode, the layer count and the message, and the /// render-path warning at the end. fn status_bar(ui: &mut Ui, state: &mut MockState) { diff --git a/crates/ui-gallery/src/mock/model.rs b/crates/ui-gallery/src/mock/model.rs index 183bb1b1e..b3454f7ea 100644 --- a/crates/ui-gallery/src/mock/model.rs +++ b/crates/ui-gallery/src/mock/model.rs @@ -25,6 +25,9 @@ const DOCUMENT_HEIGHT: f64 = 800.0; /// The share of the dock the canvas group takes. const CANVAS_SHARE: f32 = 0.8; +/// The width of the dock that holds the toolbar: room for its column at two steps. +const TOOLS_DOCK_WIDTH: f32 = 120.0; + /// The tools of the rail. Each is a command of the `tools` group; a tool alone in its slot carries its letter, and the /// letter of a slot with several is the pick command of [`ToolKey`]. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, CommandSet)] @@ -146,6 +149,8 @@ impl ColorPair { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[non_exhaustive] pub enum Panel { + /// The toolbar: a stepped column of tool buttons that docks and floats by dragging. + Tools, /// The document tabs over the canvas. Canvas, /// The Navigator. @@ -156,7 +161,7 @@ pub enum Panel { impl Panel { /// Every panel, in the Window menu's order. - pub const ALL: [Panel; 3] = [Panel::Canvas, Panel::Navigator, Panel::Layers]; + pub const ALL: [Panel; 4] = [Panel::Tools, Panel::Canvas, Panel::Navigator, Panel::Layers]; /// Whether the panel stays docked and open: the canvas. pub const fn protected(self) -> bool { @@ -412,12 +417,20 @@ pub struct MockState { pub colors: ColorPair, /// The panel whose frame shows alone. pub maximized: Option, + /// The panel open in the flyout of a column collapsed to icons. + pub flyout: Option, } impl Default for MockState { fn default() -> Self { - let side = Column::new(vec![Group::new(vec![Panel::Navigator], 0), Group::new(vec![Panel::Layers], 0)]).with_width(SIDE_WIDTH); - let root = Node::split(Axis::X, SplitSize::Ratio(CANVAS_SHARE), Node::tabs(vec![Panel::Canvas], 0), Node::dock(DockEdge::End, vec![side])); + // The toolbar sits in a dock of its own at the start, one tool column wide; its column keeps that grid. + let tools = Column::new(vec![Group::new(vec![Panel::Tools], 0)]).with_steps(1); + let side = Column::new(vec![Group::new(vec![Panel::Layers], 0)]).with_width(SIDE_WIDTH); + let mut icons = Column::new(vec![Group::new(vec![Panel::Navigator], 0)]).with_width(SIDE_WIDTH); + icons.iconic = true; + let canvas = + Node::split(Axis::X, SplitSize::Ratio(CANVAS_SHARE), Node::tabs(vec![Panel::Canvas], 0), Node::dock(DockEdge::End, vec![side, icons])); + let root = Node::split(Axis::X, SplitSize::FixedFirst(TOOLS_DOCK_WIDTH), Node::dock(DockEdge::Start, vec![tools]), canvas); MockState { workspace: Workspace::new(Layout::new(Some(root), Vec::new())), document: Document::default(), @@ -427,6 +440,7 @@ impl Default for MockState { status: None, colors: ColorPair::default(), maximized: None, + flyout: None, } } } diff --git a/crates/ui-gallery/src/mock/panels.rs b/crates/ui-gallery/src/mock/panels.rs index e63333d99..7fad69c94 100644 --- a/crates/ui-gallery/src/mock/panels.rs +++ b/crates/ui-gallery/src/mock/panels.rs @@ -21,6 +21,7 @@ use craft_ui::docking::{DockPanels, GroupAt, PanelSpec}; use craft_ui::list::{ListRow, ToggleCell}; use craft_ui::patterns::canvas::NavigatorPanel; use craft_ui::primitives::textures::Revision; +use craft_ui::rails::{LastUsed, ToolRail}; use craft_ui::runtime::env::UnitKind; use craft_ui::shell::CanvasPanel; use craft_ui::table::Table; @@ -42,9 +43,36 @@ pub(super) struct Panels<'a> { pub(super) document: &'a mut Document, pub(super) tool: Tool, pub(super) tools: &'a mut Tools, + /// The tool each toolbar slot showed last; the toolbar writes it. + pub(super) last_used: &'a mut LastUsed, + /// The tool the toolbar picked in this pass. + pub(super) picked: Option, + /// The context the toolbar's grid is measured in. + pub(super) ctx: &'a egui::Context, } impl Panels<'_> { + /// The toolbar's rail in the rect the dock gives it, or its height at a width: as many tool columns as the width + /// holds. The rail's own padding surrounds the buttons, so no group padding applies. + fn toolbar(&mut self, ui: &mut Ui, at: GroupAt) -> f32 { + let slots = Tool::slots(); + let (current, last_used) = (self.tool, self.last_used.clone()); + let rail = ToolRail::new("Tools", &slots, ¤t, &last_used); + match at { + GroupAt::Measure(width) => rail.measure_rail(ui, width, |_, _| {}).y, + GroupAt::Show(rect) => { + let output = rail.show_rail(ui, |_, _| {}); + if output.select.is_some() { + self.picked = output.select; + } + if let Some(next) = output.last_used { + *self.last_used = next; + } + rect.height() + } + } + } + /// The document tab's title: the name, the zoom of the device and the current layer. fn tab_title(&self, ui: &Ui, cx: &BodyCx<'_>) -> String { let document = &self.document; @@ -56,6 +84,7 @@ impl Panels<'_> { fn name(panel: Panel) -> &'static str { match panel { + Panel::Tools => "Tools", Panel::Canvas => "Canvas", Panel::Navigator => "Navigator", Panel::Layers => "Layers", @@ -65,11 +94,21 @@ fn name(panel: Panel) -> &'static str { impl DockPanels for Panels<'_> { fn spec(&self, panel: &Panel) -> PanelSpec { let spec = PanelSpec::new(name(*panel)).limits(SizeLimits::default()); - if *panel == Panel::Canvas { spec.canvas() } else { spec } + match panel { + Panel::Canvas => spec.canvas(), + // The toolbar's column is whole tool columns wide. + Panel::Tools => spec.grid(ToolRail::::dock_grid(self.ctx, Tool::slots().len())), + _ => spec, + } } fn permissions(&self, panel: &Panel) -> Permissions { - if panel.protected() { Permissions::PROTECTED } else { Permissions::ALL } + match panel { + // The toolbar never collapses to icons and never shares its column. + Panel::Tools => Permissions::ALL.collapses(false).shares_column(false), + _ if panel.protected() => Permissions::PROTECTED, + _ => Permissions::ALL, + } } fn body(&mut self, panel: &Panel, ui: &mut Ui, cx: &mut BodyCx<'_>) { @@ -79,11 +118,14 @@ impl DockPanels for Panels<'_> { let _ = NavigatorPanel::new("Navigator", Bind::bound(&mut self.document.view), size).show(ui); } Panel::Layers => layers(ui, cx, self.document), - Panel::Canvas => {} + Panel::Canvas | Panel::Tools => {} } } fn group_view(&mut self, panels: &[Panel], _: usize, ui: &mut Ui, at: GroupAt, cx: &mut BodyCx<'_>) -> Option { + if panels.contains(&Panel::Tools) { + return Some(self.toolbar(ui, at)); + } // The canvas fills the rect it is shown in; protected, it never sits in a flyout, which is what measures. let GroupAt::Show(rect) = at else { return None }; if !panels.contains(&Panel::Canvas) { diff --git a/crates/ui-gallery/tests/it/main.rs b/crates/ui-gallery/tests/it/main.rs index 742a2d1ed..48506bd19 100644 --- a/crates/ui-gallery/tests/it/main.rs +++ b/crates/ui-gallery/tests/it/main.rs @@ -1,5 +1,6 @@ //! The viewer's integration tests: one binary, run by `libtest-mimic` over the registered trials. +mod mock; mod overview; mod viewer; diff --git a/crates/ui-gallery/tests/it/mock.rs b/crates/ui-gallery/tests/it/mock.rs new file mode 100644 index 000000000..ff50c46b2 --- /dev/null +++ b/crates/ui-gallery/tests/it/mock.rs @@ -0,0 +1,32 @@ +//! The mock editor's dock: the toolbar is a stepped column and the Navigator a collapsed one. + +use craft_ui::runtime::access::Role; +use craft_ui::testing::{Fixture, trial}; +use craft_ui_gallery::mock::{EditorMock, MockState}; +use egui::Vec2; +use std::cell::RefCell; +use std::rc::Rc; + +fn editor() -> Fixture { + let state = Rc::new(RefCell::new(MockState::default())); + let mut fixture = Fixture::new(move |ui| { + let mut state = state.borrow_mut(); + EditorMock::new("Editor", &mut state).show(ui); + }); + fixture.room(Vec2::new(1000.0, 700.0)).settle(); + fixture +} + +/// The toolbar is one tool column of the dock, not a shell rail: its buttons stand in one column that ends above the +/// foot of the window, and the Navigator shows as an icon of a collapsed column. +#[trial] +fn the_mock_toolbar_is_a_stepped_dock_column_and_the_navigator_an_icon() { + let fixture = editor(); + let rect = |label: &str| fixture.by_label(label).unwrap_or_else(|| panic!("{label} is shown")).rect; + let (first, last) = (rect("Move"), rect("Clone Stamp")); + assert!((first.left() - last.left()).abs() < 1.0, "the tools stand in one column: {first:?} and {last:?}"); + assert!(last.bottom() < fixture.shown().bottom() - 20.0, "the column ends above the foot of the window: {last:?}"); + let tree = fixture.tree(); + let navigator = fixture.by_role(Role::BUTTON).into_iter().any(|button| tree.name_of(button.node) == Some("Navigator")); + assert!(navigator, "the Navigator shows as an icon of its collapsed column"); +} diff --git a/crates/ui-shell/src/shell/app_shell.rs b/crates/ui-shell/src/shell/app_shell.rs index b220395c3..ef3c9bd83 100644 --- a/crates/ui-shell/src/shell/app_shell.rs +++ b/crates/ui-shell/src/shell/app_shell.rs @@ -191,7 +191,7 @@ impl Placed<'_, S> { } } - /// The slot's extent along its edge: its size, or the default of its edge, with a rail's columns side by side. + /// The slot's extent along its edge: its size, or the default of its edge. fn extent(&self, tokens: &UiTokens) -> f32 { let size = self.slot.slot_size().unwrap_or(match self.edge { PaneEdge::Top if self.title => SlotSize::TitleBar, @@ -199,8 +199,7 @@ impl Placed<'_, S> { PaneEdge::Bottom => SlotSize::StatusBar, _ => SlotSize::RailWidth, }); - let columns = if matches!(self.edge, PaneEdge::Start | PaneEdge::End) { self.slot.column_count() } else { 1 }; - size.resolve(tokens) * columns as f32 + size.resolve(tokens) } } @@ -263,8 +262,8 @@ impl Outcome for AppShellOutput { /// a reveal. The shell takes its own window's Tab toggles from the frame state in the pass that records them: in /// normal mode Tab hides every slot and panel and shows them again. /// - **Canvas preset.** [`title_bar_if`](Self::title_bar_if), [`options_bar`](Self::options_bar), -/// [`tools`](Self::tools) and [`status`](Self::status) add the slots of a document editor under the keys of -/// [`slots`](super::slots), named by `ShellWords`; each takes the host's `visible` flag, passed every frame. +/// and [`status`](Self::status) add the slots of a document editor under the keys of [`slots`](super::slots), +/// named by `ShellWords`; the toolbar is a panel of the dock, not a slot; each takes the host's `visible` flag, passed every frame. /// - **Shell data.** Slots and the body read the skeleton with `BodyCx::shell()`. /// - **App state.** `S` is the state the slots and the body edit; [`show`](Self::show) hands each of them `&mut S` in /// turn, so a title bar, a rail and a body that edit one document share it without interior mutability. An app with @@ -370,15 +369,6 @@ impl<'a, S> AppShell<'a, S> { self } - /// The tool rail, a slot keyed `"tools"` at `edge` (the reading start or end) that reveals in body-only mode, as - /// wide as the rail's `columns` (1 or 2, the count the host gives its `ToolRail`). It is the Tools region on either - /// edge. - pub fn tools(mut self, edge: PaneEdge, columns: usize, visible: bool, add: impl FnMut(&mut Ui, &mut BodyCx<'_>, &mut S) + 'a) -> Self { - let slot = Slot::new(keys::TOOLS).columns(columns).visible(visible).reveal(); - self.slots.push(Placed { slot, edge, title: false, named: Some(|words| words.tools.clone()), add: Box::new(add) }); - self - } - /// The status bar, a bottom slot keyed `"status"` that never reveals. pub fn status(mut self, visible: bool, add: impl FnMut(&mut Ui, &mut BodyCx<'_>, &mut S) + 'a) -> Self { let slot = Slot::new(keys::STATUS).visible(visible); @@ -412,7 +402,7 @@ impl<'a, S> AppShell<'a, S> { } /// Gives the slot keyed `key`, added before, the version of the app data it shows ([`Slot::content`]), for the - /// slots the `options_bar`, `tools` and `status` builders make. + /// slots the `options_bar` and `status` builders make. pub fn content(mut self, key: SlotKey, version: u64) -> Self { for placed in self.title.iter_mut().chain(self.slots.iter_mut()).filter(|placed| placed.slot.key() == key) { placed.slot = placed.slot.clone().content(version); diff --git a/crates/ui-shell/src/shell/app_shell/stories.rs b/crates/ui-shell/src/shell/app_shell/stories.rs index 79d52d24d..c1b226c83 100644 --- a/crates/ui-shell/src/shell/app_shell/stories.rs +++ b/crates/ui-shell/src/shell/app_shell/stories.rs @@ -2,7 +2,7 @@ use super::{AppShell, ShellRegion}; use crate::choice::Checkbox; -use crate::contract::{Bind, PaneEdge, Props as _, Show as _, ShowContainer as _}; +use crate::contract::{Bind, Props as _, Show as _, ShowContainer as _}; use crate::dialog::Dialog; use crate::display::Text; use crate::layout_components::Grid; @@ -45,9 +45,6 @@ fn app_shell_canvas(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { .options_bar(true, |ui, _, _| { Text::new("Options").show(ui); }) - .tools(PaneEdge::Start, 1, true, |ui, _, _| { - Text::new("Tools").show(ui); - }) .status(true, |ui, _, _| { Text::new("Status").show(ui); }) diff --git a/crates/ui-shell/src/shell/canvas_shell.rs b/crates/ui-shell/src/shell/canvas_shell.rs index 2e996b749..5167630fc 100644 --- a/crates/ui-shell/src/shell/canvas_shell.rs +++ b/crates/ui-shell/src/shell/canvas_shell.rs @@ -1,13 +1,13 @@ //! The canvas preset's slot keys and `CanvasPanel`, which lays out the canvas panel in the body of a document editor's -//! shell. The editor's slots are the canvas setters of `AppShell` (`title_bar_if`, `options_bar`, `tools`, `status`). +//! shell. The editor's slots are the canvas setters of `AppShell` (`title_bar_if`, `options_bar`, `status`). //! //! ```text //! +-----------------------------------------+ //! | title | //! | options | -//! +-------+---------------------------------+ -//! | tools | body (dock with canvas panel) | -//! +-------+---------------------------------+ +//! +-----------------------------------------+ +//! | body (dock with toolbar, canvas panel) | +//! +-----------------------------------------+ //! | status | //! +-----------------------------------------+ //! @@ -37,8 +37,6 @@ pub mod slots { pub const TITLE: SlotKey = "title"; /// The options bar, below the title. pub const OPTIONS: SlotKey = "options"; - /// The tool rail at the start edge. - pub const TOOLS: SlotKey = "tools"; /// The status bar, the lowest bottom bar. pub const STATUS: SlotKey = "status"; } diff --git a/crates/ui-shell/src/shell/regions.rs b/crates/ui-shell/src/shell/regions.rs index e94e90aad..118a12dd0 100644 --- a/crates/ui-shell/src/shell/regions.rs +++ b/crates/ui-shell/src/shell/regions.rs @@ -20,7 +20,7 @@ pub enum SlotSize { OptionsBar, /// `size.bar.options_narrow`: the options bar of a window too small for the full bar. OptionsBarNarrow, - /// `size.rail.width`: one column of a rail; [`Slot::columns`] says how many columns the slot lays out. + /// `size.rail.width`: the default extent of a start or end slot. RailWidth, } @@ -52,7 +52,6 @@ impl SlotSize { pub struct Slot { key: SlotKey, size: Option, - columns: usize, visible: bool, reveal: bool, label: Option