From b7d85212961739db08326e6dd69a94ddf660aaf4 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 15:32:49 -0800 Subject: [PATCH 1/5] Window: Arrange Documents tiles the documents side by side, stacked or 2-Up to 6-Up Tile laid the open documents out in one grid only, and the application bar had no Arrange Documents button. Window > Arrange now also has Tile All Vertically (side by side in one row), Tile All Horizontally (stacked in one column) and 2-Up, 3-Up, 4-Up and 6-Up layouts, which show that many documents and leave the others under their tabs. Those layouts show the first documents in tab order, and the current document takes the last pane when it is not among them. An Arrange Documents button on the application bar, beside the workspace switcher, lists Consolidate All Windows and the Tile layouts. The item for the layout the panes show is checked. window.arrange.tile takes `layout` (grid, vertical, horizontal, 2up, 3up, 4up or 6up; grid when omitted), refuses any other value, and returns it with {tiled, panes}. ui.inspect reports tileLayout. --- crates/mcp/src/ui_catalog.rs | 2 +- crates/ui-egui/src/canvas.rs | 2 +- crates/ui-egui/src/canvas/panes.rs | 149 ++++++++++-- crates/ui-egui/src/canvas/panes/tests.rs | 282 ++++++++++++++++++++++- crates/ui-egui/src/chrome.rs | 47 +++- crates/ui-egui/src/control.rs | 7 +- crates/ui-egui/src/doc_windows/tests.rs | 4 +- crates/ui-egui/src/i18n/bg.tsv | 7 + crates/ui-egui/src/i18n/bs.tsv | 7 + crates/ui-egui/src/i18n/ca.tsv | 7 + crates/ui-egui/src/i18n/cs.tsv | 7 + crates/ui-egui/src/i18n/da.tsv | 7 + crates/ui-egui/src/i18n/de.tsv | 7 + crates/ui-egui/src/i18n/el.tsv | 7 + crates/ui-egui/src/i18n/es.tsv | 7 + crates/ui-egui/src/i18n/fi.tsv | 7 + crates/ui-egui/src/i18n/fr.tsv | 7 + crates/ui-egui/src/i18n/gu.tsv | 7 + crates/ui-egui/src/i18n/hi.tsv | 7 + crates/ui-egui/src/i18n/hu.tsv | 7 + crates/ui-egui/src/i18n/id.tsv | 7 + crates/ui-egui/src/i18n/it.tsv | 7 + crates/ui-egui/src/i18n/ja.tsv | 7 + crates/ui-egui/src/i18n/ka.tsv | 7 + crates/ui-egui/src/i18n/ko.tsv | 7 + crates/ui-egui/src/i18n/nl.tsv | 7 + crates/ui-egui/src/i18n/pl.tsv | 7 + crates/ui-egui/src/i18n/pt-br.tsv | 7 + crates/ui-egui/src/i18n/ru.tsv | 7 + crates/ui-egui/src/i18n/sv.tsv | 7 + crates/ui-egui/src/i18n/tests.rs | 11 + crates/ui-egui/src/i18n/tr.tsv | 7 + crates/ui-egui/src/i18n/uk.tsv | 7 + crates/ui-egui/src/i18n/vi.tsv | 7 + crates/ui-egui/src/i18n/zh-hans.tsv | 7 + crates/ui-egui/src/i18n/zh-hant.tsv | 7 + crates/ui-egui/src/menus.rs | 1 + crates/ui-egui/src/menus/run.rs | 2 +- crates/ui-egui/src/menus/state.rs | 2 + crates/ui-egui/src/menus/tree.rs | 35 ++- crates/ui-egui/src/menus/ui_commands.rs | 2 +- crates/ui-egui/src/state.rs | 5 + docs/mcp.md | 22 +- docs/target-app-parity.md | 1 + 44 files changed, 716 insertions(+), 54 deletions(-) diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index 1bc2d14442..0429a7af31 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -768,7 +768,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "window.arrange.tile", "Tile", "", - "{} show every open document and each further view of one (window.newWindow) at once, edge to edge in the document area, one pane each in a grid (columns: the square root of the number of panes, rounded up), each fitted to its pane; the current window's pane takes the tools, a click in another pane makes its window the current one; the tabs stay; windows floating come back under the tabs first; with fewer than two windows open the view stays as it is; returns {tiled, panes}", + "{layout?: grid|vertical|horizontal|2up|3up|4up|6up} show the open documents and each further view of one (window.newWindow) at once, edge to edge in the document area, one pane each, each fitted to its pane: `grid` (the default) in a grid (columns: the square root of the number of panes, rounded up), `vertical` side by side in one row (Tile All Vertically), `horizontal` stacked in one column (Tile All Horizontally), `2up`, `3up`, `4up` and `6up` at most that many panes (2up and 3up side by side, 4up two by two, 6up three by two) with the other windows under their tabs: the first windows in tab order, the current window in the last pane when it is not among them; the current window's pane takes the tools, a click in another pane makes its window the current one; the tabs stay; windows floating come back under the tabs first; with fewer than two windows open the view and the layout stay as they are; any other `layout` is an error; returns {tiled, panes, layout}", ), ( "window.arrange.floatInWindow", diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 5c30f96246..1cc1abd5ca 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -63,7 +63,7 @@ use outline::{OVERLAY_MAX_ANCHORS, c32, node_outline, walk_drawn}; #[cfg(test)] use overlays::selected_anchor; use overlays::{HandleLook, blend_widgets_overlay, draw_inside_overlay, draw_overlays, hover_highlight, ime_geometry, selection_overlay}; -pub use panes::Panes; +pub use panes::{Layout as TileLayout, Panes}; pub(crate) use panes::{consolidate, pane, tile, tiled_area}; use raster::{changed_pixels, pixel_region, upload}; pub(crate) use raster::{color_image, color_image_owned, render_job}; diff --git a/crates/ui-egui/src/canvas/panes.rs b/crates/ui-egui/src/canvas/panes.rs index 0a26f26843..6b8eea9440 100644 --- a/crates/ui-egui/src/canvas/panes.rs +++ b/crates/ui-egui/src/canvas/panes.rs @@ -1,5 +1,6 @@ //! Window › Arrange › Tile: every open document in a pane of its own, edge to edge in the document -//! area. The current document's pane is the canvas ([`super::show`]). Each other pane draws its +//! area, in a grid, side by side or stacked; the 2-up to 6-up layouts show that many and leave the +//! rest under their tabs ([`Layout`]). The current document's pane is the canvas ([`super::show`]). Each other pane draws its //! document from a render of its own, with its artboards, guides and selected objects, and a press //! in it makes its document the current one. Each view Window › New Window opened has a pane of //! its own ([`crate::doc_windows`]). @@ -38,6 +39,9 @@ pub struct Panes { pending: HashMap, /// The panes the last frame drew, as (window, pane rect). pub(crate) last: Vec<(Win, egui::Rect)>, + /// The slots of `last`'s windows, in the same order: which windows they were, as document + /// indices shift when a document closes. + last_slots: Vec>, /// By slot: the size of the view's area its view was last fitted to in a pane, and the zoom and /// center the fit gave. fits: HashMap, @@ -49,6 +53,7 @@ impl Panes { self.shown.clear(); self.pending.clear(); self.last.clear(); + self.last_slots.clear(); self.fits.clear(); } @@ -158,37 +163,123 @@ fn render_pane( img } -/// The grid of `n` panes in `area`, filled row by row: as many columns as the square root of `n` -/// rounded up, and as many rows as those columns need. The panes meet edge to edge and cover -/// `area`; the spare cells of the last row stay empty. -pub(crate) fn cells(n: usize, area: egui::Rect) -> Vec { - if n == 0 { - return vec![]; +/// How Tile lays out the panes (`window.arrange.tile`'s `layout`). +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub enum Layout { + /// A grid: as many columns as the square root of the number of panes rounded up. + #[default] + Grid, + /// Side by side in one row, each pane as tall as the document area. + Vertical, + /// Stacked in one column, each pane as wide as the document area. + Horizontal, + /// At most this many panes (2, 3, 4 or 6); the other windows stay under their tabs. + Up(usize), +} + +impl Layout { + /// Each layout with its name in `layout`, in the order the menus list them. + pub(crate) const ALL: [(&'static str, Layout); 7] = [ + ("grid", Layout::Grid), + ("vertical", Layout::Vertical), + ("horizontal", Layout::Horizontal), + ("2up", Layout::Up(2)), + ("3up", Layout::Up(3)), + ("4up", Layout::Up(4)), + ("6up", Layout::Up(6)), + ]; + + /// The layout's name in `layout`. + pub(crate) fn name(self) -> &'static str { + Self::ALL.iter().find(|(_, l)| *l == self).map_or("grid", |(n, _)| n) } + + /// The layout `p`'s `layout` names, the grid without one. Any other value is an error. + pub(crate) fn from_params(p: &serde_json::Value) -> Result { + let key = "layout"; + match p.get(key) { + None => Ok(Layout::Grid), + Some(v) => v + .as_str() + .and_then(|s| Self::ALL.iter().find(|(n, _)| *n == s)) + .map(|(_, l)| *l) + .ok_or_else(|| format!("`{key}` must be one of {}", Self::ALL.map(|(n, _)| n).join(", "))), + } + } + + /// How many of `n` windows the layout gives a pane. + fn panes(self, n: usize) -> usize { + match self { + Layout::Up(k) => n.min(k), + _ => n, + } + } + + /// How many columns the layout puts `n` panes in. + fn columns(self, n: usize) -> usize { + match self { + Layout::Grid => grid_columns(n), + Layout::Vertical => n, + Layout::Horizontal => 1, + Layout::Up(k) if k <= 3 => n, + Layout::Up(k) => grid_columns(k).min(n), + } + } +} + +/// The square root of `n` rounded up. +fn grid_columns(n: usize) -> usize { let mut cols = 1; while cols * cols < n { cols += 1; } + cols +} + +/// The `n` panes `layout` places in `area`, filled row by row, in as many rows as its columns +/// need (the grid: as many columns as the square root of `n` rounded up). The panes meet edge to +/// edge and cover `area`; the spare cells of the last row stay empty. +pub(crate) fn layout_cells(layout: Layout, n: usize, area: egui::Rect) -> Vec { + if n == 0 { + return vec![]; + } + let cols = layout.columns(n).clamp(1, n); let rows = n.div_ceil(cols); let x = |c: usize| if c == cols { area.right() } else { area.left() + area.width() * c as f32 / cols as f32 }; let y = |r: usize| if r == rows { area.bottom() } else { area.top() + area.height() * r as f32 / rows as f32 }; (0..n).map(|i| egui::Rect::from_min_max(pos2(x(i % cols), y(i / cols)), pos2(x(i % cols + 1), y(i / cols + 1)))).collect() } -/// `window.arrange.tile`: every open document, and each further view of one, in a pane of its own, -/// each fitted to its pane. With fewer than two windows open (when the menu item is grayed out) it -/// leaves the view and `tiled` as they are. The windows floating come back under the tabs for it. -pub(crate) fn tile(app: &mut VectorcraftApp) -> Result { +/// The windows of `docked` (in tab order) that `layout` gives a pane: all of them, or as many of +/// the first ones as it shows, with the current window `active` in the last pane when it is not +/// among them. +pub(crate) fn shown_windows(layout: Layout, docked: &[Win], active: Option) -> Vec { + let k = layout.panes(docked.len()); + let mut shown = docked[..k].to_vec(); + if let (Some(a), Some(last)) = (active.filter(|a| !shown.contains(a) && docked.contains(a)), shown.last_mut()) { + *last = a; + } + shown +} + +/// `window.arrange.tile`: every open document, and each further view of one, in a pane of its own +/// as `layout` places them (the grid without one), each fitted to its pane. With fewer than two +/// windows open (when the menu item is grayed out) it leaves the view, `tiled` and the layout as +/// they are. The windows floating come back under the tabs for it. A `layout` that is not one of +/// [`Layout::ALL`]'s names is an error. +pub(crate) fn tile(app: &mut VectorcraftApp, p: &serde_json::Value) -> Result { + let layout = Layout::from_params(p)?; app.sync_views(); let n = crate::doc_windows::windows(app).len(); if n < 2 { - return Ok(json!({"tiled": app.ui.tiled, "panes": n})); + return Ok(json!({"tiled": app.ui.tiled, "panes": n, "layout": app.ui.tile_layout.name()})); } crate::doc_windows::dock_all(app); app.ui.tiled = true; + app.ui.tile_layout = layout; app.ui.home = None; crate::doc_windows::unfit_all(app); - Ok(json!({"tiled": app.ui.tiled, "panes": n})) + Ok(json!({"tiled": app.ui.tiled, "panes": layout.panes(n), "layout": layout.name()})) } /// `window.arrange.consolidateAllWindows`: one document at a time again, under its tab, the @@ -216,27 +307,41 @@ pub(crate) fn tiled_area(app: &mut VectorcraftApp, ui: &mut Ui) -> bool { app.canvas.panes.clear(); } app.canvas.panes.last.clear(); + app.canvas.panes.last_slots.clear(); return false; } // The current window's pane is the canvas, unless it is a floating one. let active = crate::doc_windows::current(app).filter(|a| docked.contains(a)); + // The 2-up to 6-up layouts leave the windows past their panes under the tabs. + let layout = app.ui.tile_layout; + let shown = shown_windows(layout, &docked, active); app.sync_views(); - let live: Vec = crate::doc_windows::windows(app).into_iter().filter_map(|w| slot(app, w)).collect(); + // The renders of the panes and the floating windows stay; a window under its tab has none. + let live: Vec = + crate::doc_windows::windows(app).into_iter().filter(|w| shown.contains(w) || !docked.contains(w)).filter_map(|w| slot(app, w)).collect(); app.canvas.panes.shown.retain(|s, _| live.contains(s)); app.canvas.panes.pending.retain(|s, _| live.contains(s)); app.canvas.panes.fits.retain(|s, _| live.contains(s)); - // A window opened, closed, floated or docked changes the grid, and so does coming back to the - // panes from one window: each window fits its new pane. - if app.canvas.panes.last.iter().map(|(w, _)| *w).ne(docked.iter().copied()) { - for w in &docked { - if let Some(v) = crate::doc_windows::view_mut(app, *w) { - v.fitted = false; - } + // A window opened, closed, floated or docked changes the panes, and so does coming back to the + // panes from one window: each window fits its new pane. With as many panes as before, only a + // window that moved to another pane fits it, as when a tab brings its window into the last pane + // of a 2-up to 6-up layout: the others keep their zoom and scroll. Windows are compared by + // their slots, since a closed document shifts the indices of the documents after it. + let before = std::mem::take(&mut app.canvas.panes.last_slots); + let now: Vec> = shown.iter().map(|w| slot(app, *w)).collect(); + let same_panes = before.len() == now.len(); + for (i, (w, s)) in shown.iter().zip(&now).enumerate() { + if same_panes && s.is_some() && before.get(i) == Some(s) { + continue; + } + if let Some(v) = crate::doc_windows::view_mut(app, *w) { + v.fitted = false; } } + app.canvas.panes.last_slots = now; let t = Tokens::get(ui.ctx()); let ppp = ui.ctx().pixels_per_point(); - let cells: Vec<(Win, egui::Rect)> = docked.iter().copied().zip(cells(n, ui.available_rect_before_wrap())).collect(); + let cells: Vec<(Win, egui::Rect)> = shown.iter().copied().zip(layout_cells(layout, shown.len(), ui.available_rect_before_wrap())).collect(); let areas: Vec<(Win, egui::Rect)> = cells.iter().map(|(w, cell)| (*w, view_rects(app, *cell, ppp).1)).collect(); let unfitted = refit_resized(app, &areas); let mut activate = None; diff --git a/crates/ui-egui/src/canvas/panes/tests.rs b/crates/ui-egui/src/canvas/panes/tests.rs index 005b930d01..2ad0af3dc1 100644 --- a/crates/ui-egui/src/canvas/panes/tests.rs +++ b/crates/ui-egui/src/canvas/panes/tests.rs @@ -43,6 +43,11 @@ fn button(pos: Pos2, pressed: bool) -> egui::Event { egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() } } +/// Tile's grid of `n` panes in `area`. +fn cells(n: usize, area: egui::Rect) -> Vec { + layout_cells(Layout::Grid, n, area) +} + /// The documents' indices in the panes the last frame drew, and the panes. fn panes(app: &VectorcraftApp) -> (Vec, Vec) { app.canvas.panes.last.iter().map(|(w, r)| (w.0, *r)).unzip() @@ -84,6 +89,279 @@ fn cells_tile_the_area_edge_to_edge() { } } +/// The distinct left and top edges of `c`: how many columns and rows its panes take. +fn columns_and_rows(c: &[egui::Rect]) -> (usize, usize) { + let lefts: BTreeSet = c.iter().map(|r| r.left().to_bits()).collect(); + let tops: BTreeSet = c.iter().map(|r| r.top().to_bits()).collect(); + (lefts.len(), tops.len()) +} + +#[test] +fn each_tile_layout_places_its_panes_edge_to_edge() { + let area = egui::Rect::from_min_size(pos2(10.0, 35.0), vec2(1001.0, 703.0)); + let cases = [ + (Layout::Vertical, 3, (3, 1)), + (Layout::Vertical, 7, (7, 1)), + (Layout::Horizontal, 3, (1, 3)), + (Layout::Up(2), 2, (2, 1)), + (Layout::Up(3), 3, (3, 1)), + (Layout::Up(3), 2, (2, 1)), + (Layout::Up(4), 4, (2, 2)), + (Layout::Up(4), 3, (2, 2)), + (Layout::Up(6), 6, (3, 2)), + (Layout::Up(6), 4, (3, 2)), + (Layout::Up(6), 2, (2, 1)), + ]; + for (layout, n, shape) in cases { + let c = layout_cells(layout, n, area); + assert_eq!(c.len(), n); + assert_eq!(columns_and_rows(&c), shape, "{layout:?} with {n} panes: columns and rows"); + assert_eq!(c[0].min, area.min, "{layout:?}: the first pane starts at the corner"); + let right = c.iter().map(|r| r.right()).fold(f32::MIN, f32::max); + let bottom = c.iter().map(|r| r.bottom()).fold(f32::MIN, f32::max); + assert_eq!((right, bottom), (area.right(), area.bottom()), "{layout:?} with {n} panes reaches the far edges"); + for (i, r) in c.iter().enumerate() { + assert!(r.width() > 0.0 && r.height() > 0.0 && area.contains_rect(*r), "{layout:?}: {r:?}"); + for o in &c[i + 1..] { + assert!(r.intersect(*o).area() <= 0.0, "{layout:?} panes overlap: {r:?} {o:?}"); + } + } + } + assert!(layout_cells(Layout::Up(2), 0, area).is_empty()); +} + +#[test] +fn tile_layouts_line_the_documents_up_side_by_side_or_stacked() { + let mut app = app_with(3); + let ctx = egui::Context::default(); + let reply = app.run("window.arrange.tile", json!({"layout": "vertical"})).unwrap(); + assert_eq!(reply, json!({"tiled": true, "panes": 3, "layout": "vertical"})); + frame(&mut app, &ctx, vec![]); + let (docs, rects) = panes(&app); + assert_eq!(docs, [0, 1, 2]); + assert!(rects.windows(2).all(|p| p[0].top() == p[1].top() && p[0].height() == p[1].height() && p[0].right() == p[1].left()), "{rects:?}"); + let reply = app.run("window.arrange.tile", json!({"layout": "horizontal"})).unwrap(); + assert_eq!(reply, json!({"tiled": true, "panes": 3, "layout": "horizontal"})); + frame(&mut app, &ctx, vec![]); + let (docs, rects) = panes(&app); + assert_eq!(docs, [0, 1, 2]); + assert!(rects.windows(2).all(|p| p[0].left() == p[1].left() && p[0].width() == p[1].width() && p[0].bottom() == p[1].top()), "{rects:?}"); + // Each document fits its new pane. + let artboard = Rect::new(0.0, 0.0, 400.0, 300.0); + let canvas = app.canvas_rect.unwrap(); + for (i, r) in docs.iter().zip(&rects) { + let shown = if *i == 2 { canvas } else { view_rects(&app, *r, ctx.pixels_per_point()).1 }; + let v = app.views[*i]; + assert!(v.fitted && (v.zoom - fit_zoom(shown, artboard, 0.0, 1.0)).abs() < 1e-9, "document {i} fits its pane: {v:?}"); + } + assert_eq!(crate::control::inspect(&app, &ctx)["tileLayout"], json!("horizontal")); + assert_eq!(app.run("window.arrange.tile", json!({})).unwrap()["layout"], json!("grid"), "Tile without a layout is the grid"); +} + +#[test] +fn n_up_shows_that_many_documents_and_keeps_the_rest_under_their_tabs() { + let mut app = app_with(5); + let ctx = egui::Context::default(); + assert_eq!(app.run("window.arrange.tile", json!({"layout": "2up"})).unwrap(), json!({"tiled": true, "panes": 2, "layout": "2up"})); + frame(&mut app, &ctx, vec![]); + assert_eq!(panes(&app).0, [0, 4], "the current document takes the last pane"); + app.run("document.activate", json!({"index": 1})).unwrap(); + frame(&mut app, &ctx, vec![]); + assert_eq!(panes(&app).0, [0, 1], "the first documents in tab order"); + let second = (app.session.documents()[1].uid, 1); + app.run("document.activate", json!({"index": 0})).unwrap(); + frame(&mut app, &ctx, vec![]); + assert!(app.canvas.panes.shown.contains_key(&second), "the second document is rendered for its pane"); + app.run("document.activate", json!({"index": 3})).unwrap(); + frame(&mut app, &ctx, vec![]); + let (docs, rects) = panes(&app); + assert_eq!(docs, [0, 3], "a document chosen under its tab comes into the last pane"); + assert!(!app.canvas.panes.shown.contains_key(&second), "a document under its tab keeps no render"); + let artboard = Rect::new(0.0, 0.0, 400.0, 300.0); + let shown = view_rects(&app, rects[0], ctx.pixels_per_point()).1; + assert!((app.views[0].zoom - fit_zoom(shown, artboard, 0.0, 1.0)).abs() < 1e-9); + assert!(app.canvas_rect.is_some_and(|c| rects[1].contains_rect(c)), "the current document's pane is the canvas"); + // A document brought into the last pane leaves the first pane's zoom as it is. + app.views[0].zoom *= 2.0; + let zoomed = app.views[0].zoom; + app.run("document.activate", json!({"index": 2})).unwrap(); + frame(&mut app, &ctx, vec![]); + assert_eq!(panes(&app).0, [0, 2]); + assert_eq!(app.views[0].zoom, zoomed, "the document that stayed in its pane keeps its zoom"); + let last = app.canvas_rect.unwrap(); + assert!((app.views[2].zoom - fit_zoom(last, artboard, 0.0, 1.0)).abs() < 1e-9, "the document brought in fits its pane"); + assert_eq!(app.run("window.arrange.tile", json!({"layout": "4up"})).unwrap()["panes"], json!(4)); + frame(&mut app, &ctx, vec![]); + let (docs, rects) = panes(&app); + assert_eq!((docs, columns_and_rows(&rects)), (vec![0, 1, 2, 3], (2, 2))); + assert_eq!(app.run("window.arrange.tile", json!({"layout": "6up"})).unwrap()["panes"], json!(5), "6-Up with five documents shows them all"); + frame(&mut app, &ctx, vec![]); + let (docs, rects) = panes(&app); + assert_eq!((docs, columns_and_rows(&rects)), (vec![0, 1, 2, 3, 4], (3, 2))); + assert_eq!(app.run("window.arrange.tile", json!({"layout": "3up"})).unwrap()["panes"], json!(3)); + frame(&mut app, &ctx, vec![]); + let (docs, rects) = panes(&app); + assert_eq!((docs, columns_and_rows(&rects)), (vec![0, 1, 2], (3, 1))); + app.run("document.activate", json!({"index": 4})).unwrap(); + frame(&mut app, &ctx, vec![]); + assert_eq!(panes(&app).0, [0, 1, 4]); +} + +/// A document closed before the panes shifts the indices of the ones after it: the document that +/// moves into another pane fits it. +#[test] +fn closing_a_document_in_an_n_up_layout_fits_the_documents_that_change_panes() { + let mut app = app_with(4); + let ctx = egui::Context::default(); + app.run("document.activate", json!({"index": 1})).unwrap(); + app.run("window.arrange.tile", json!({"layout": "2up"})).unwrap(); + frame(&mut app, &ctx, vec![]); + app.run("document.activate", json!({"index": 3})).unwrap(); + frame(&mut app, &ctx, vec![]); + assert_eq!(panes(&app).0, [0, 3]); + let moving = app.session.documents()[1].uid; + // The second document's view, under its tab, is zoomed away from its fit. + app.views[1].zoom *= 3.0; + app.run("file.close", json!({"index": 0})).unwrap(); + frame(&mut app, &ctx, vec![]); + let (docs, rects) = panes(&app); + assert_eq!(docs, [0, 2], "the former second document is first now, the current one stays last"); + assert_eq!(app.session.documents()[0].uid, moving); + let area = view_rects(&app, rects[0], ctx.pixels_per_point()).1; + let v = app.views[0]; + assert!(v.fitted && (v.zoom - fit_zoom(area, Rect::new(0.0, 0.0, 400.0, 300.0), 0.0, 1.0)).abs() < 1e-9, "it fits its new pane: {v:?}"); +} + +#[test] +fn tile_refuses_a_layout_it_does_not_have() { + let mut app = app_with(3); + for bad in [json!("5up"), json!("Vertical"), json!(3), json!(null), json!({})] { + let err = app.run("window.arrange.tile", json!({"layout": bad})).unwrap_err(); + assert_eq!(err, "`layout` must be one of grid, vertical, horizontal, 2up, 3up, 4up, 6up", "{bad}"); + assert!(!app.ui.tiled && app.ui.tile_layout == Layout::Grid, "{bad}: the view stays as it is"); + } + app.run("window.arrange.tile", json!({"layout": "vertical"})).unwrap(); + assert!(app.run("window.arrange.tile", json!({"layout": "diagonal"})).is_err()); + assert_eq!(app.ui.tile_layout, Layout::Vertical, "a refused layout leaves the tiled one"); + // With one document the layout is still checked, and nothing changes. + let mut one = app_with(1); + assert!(one.run("window.arrange.tile", json!({"layout": "7up"})).is_err()); + assert_eq!(one.run("window.arrange.tile", json!({"layout": "2up"})).unwrap(), json!({"tiled": false, "panes": 1, "layout": "grid"})); +} + +#[test] +fn the_tile_items_check_the_layout_the_panes_show() { + let mut app = app_with(3); + let checked = |app: &VectorcraftApp, layout: Option<&str>| { + let p = layout.map_or(serde_json::Value::Null, |l| json!({"layout": l})); + crate::menus::checked(app, "window.arrange.tile", &p) + }; + assert_eq!(checked(&app, None), Some(false), "not tiled"); + app.run("window.arrange.tile", json!({"layout": "4up"})).unwrap(); + assert_eq!(checked(&app, Some("4up")), Some(true)); + assert_eq!(checked(&app, None), Some(false)); + assert_eq!(checked(&app, Some("2up")), Some(false)); + app.run("window.arrange.tile", json!({})).unwrap(); + assert_eq!(checked(&app, None), Some(true), "Tile is the grid"); + app.run("window.arrange.consolidateAllWindows", json!({})).unwrap(); + assert_eq!(checked(&app, None), Some(false)); + // Window › Arrange lists every layout, after Cascade and before Float in Window. + let window = crate::menus::menu_tree().into_iter().find(|(t, _)| *t == "Window").map(|(_, items)| items).unwrap(); + let arrange = window + .into_iter() + .find_map(|i| match i { + crate::menus::Item::Sub("Arrange", items) => Some(items), + _ => None, + }) + .unwrap(); + let labels: Vec<&str> = arrange + .iter() + .filter_map(|i| match i { + crate::menus::Item::Cmd(l, ..) => Some(*l), + _ => None, + }) + .collect(); + assert_eq!( + labels, + [ + "Cascade", + "Tile", + "Tile All Vertically", + "Tile All Horizontally", + "2-Up Layout", + "3-Up Layout", + "4-Up Layout", + "6-Up Layout", + "Float in Window", + "Float All in Windows", + "Consolidate All Windows" + ] + ); + // Each item's params run, as the menu sends them. + for item in &arrange { + if let crate::menus::Item::Cmd(_, "window.arrange.tile", p) = item { + let p = if p.is_null() { json!({}) } else { p.clone() }; + assert!(app.run("window.arrange.tile", p.clone()).is_ok(), "{p}"); + } + } +} + +/// One frame of the application bar with screen-reader nodes on → the nodes. +fn app_bar_frame(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec) -> Vec { + let screen = egui::Rect::from_min_size(Pos2::ZERO, vec2(1400.0, 800.0)); + let mut out = ctx.run_ui(egui::RawInput { events, screen_rect: Some(screen), ..Default::default() }, |ui| crate::chrome::app_bar(app, ui)); + out.textures_delta.clear(); + out.platform_output.accesskit_update.map(|u| u.nodes.into_iter().map(|(_, n)| n).collect()).unwrap_or_default() +} + +/// The center of the application bar's node whose label, without its leading spaces, is `name` +/// (or starts with it and a shortcut in parentheses). +fn app_bar_node(nodes: &[egui::accesskit::Node], name: &str) -> Option { + let named = |l: &str| l.trim_start().strip_prefix(name).is_some_and(|rest| rest.is_empty() || rest.trim_start().starts_with('(')); + let b = nodes.iter().find(|n| n.label().is_some_and(named))?.bounds()?; + Some(pos2(((b.x0 + b.x1) / 2.0) as f32, ((b.y0 + b.y1) / 2.0) as f32)) +} + +/// Click the application bar's node labeled `name`. +fn click_app_bar(app: &mut VectorcraftApp, ctx: &egui::Context, name: &str) { + let at = app_bar_node(&app_bar_frame(app, ctx, vec![]), name).unwrap_or_else(|| panic!("{name} is drawn")); + app_bar_frame(app, ctx, vec![egui::Event::PointerMoved(at), button(at, true)]); + app_bar_frame(app, ctx, vec![button(at, false)]); +} + +#[test] +fn the_arrange_documents_button_tiles_and_consolidates() { + crate::i18n::set_current(crate::i18n::Lang::EN); + let mut app = app_with(3); + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + crate::theme::install_fonts(&ctx); + app_bar_frame(&mut app, &ctx, vec![]); + let nodes = app_bar_frame(&mut app, &ctx, vec![]); + let (arrange, search) = (app_bar_node(&nodes, "Arrange Documents"), app_bar_node(&nodes, "Search commands and tools")); + let (arrange, search) = (arrange.expect("the application bar has Arrange Documents"), search.expect("the search icon shows")); + assert!(arrange.x > search.x && (arrange.y - search.y).abs() < 1.0, "right of the search icon: {arrange:?}, {search:?}"); + click_app_bar(&mut app, &ctx, "Arrange Documents"); + let menu = app_bar_frame(&mut app, &ctx, vec![]); + for item in [ + "Consolidate All Windows", + "Tile", + "Tile All Vertically", + "Tile All Horizontally", + "2-Up Layout", + "3-Up Layout", + "4-Up Layout", + "6-Up Layout", + ] { + assert!(app_bar_node(&menu, item).is_some(), "the menu lists {item}"); + } + click_app_bar(&mut app, &ctx, "Tile All Vertically"); + assert!(app.ui.tiled && app.ui.tile_layout == Layout::Vertical, "{}", app.ui.status); + click_app_bar(&mut app, &ctx, "Arrange Documents"); + click_app_bar(&mut app, &ctx, "Consolidate All Windows"); + assert!(!app.ui.tiled); +} + #[test] fn tile_shows_a_pane_for_each_document_fitted_to_it() { let mut app = app_with(3); @@ -91,7 +369,7 @@ fn tile_shows_a_pane_for_each_document_fitted_to_it() { frame(&mut app, &ctx, vec![]); assert!(panes(&app).0.is_empty(), "documents open under their tabs"); let tabbed = app.canvas_rect.unwrap(); - assert_eq!(app.run("window.arrange.tile", json!({})).unwrap(), json!({"tiled": true, "panes": 3})); + assert_eq!(app.run("window.arrange.tile", json!({})).unwrap(), json!({"tiled": true, "panes": 3, "layout": "grid"})); frame(&mut app, &ctx, vec![]); let (docs, rects) = panes(&app); assert_eq!(docs, [0, 1, 2]); @@ -206,7 +484,7 @@ fn arrange_items_follow_the_open_documents() { fn tile_with_one_document_leaves_the_next_one_under_its_tab() { let mut app = app_with(1); let ctx = egui::Context::default(); - assert_eq!(app.run("window.arrange.tile", json!({})).unwrap(), json!({"tiled": false, "panes": 1})); + assert_eq!(app.run("window.arrange.tile", json!({})).unwrap(), json!({"tiled": false, "panes": 1, "layout": "grid"})); assert!(!app.ui.tiled); assert!(!enabled(&app, "window.arrange.consolidateAllWindows")); app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rs index fc0234885b..96b4d12965 100644 --- a/crates/ui-egui/src/chrome.rs +++ b/crates/ui-egui/src/chrome.rs @@ -85,7 +85,7 @@ pub fn app_bar(app: &mut VectorcraftApp, ui: &mut Ui) { // The right-side group fills the space after the menus from the right; when it runs // short, Discord goes first (it is also under Help), then Explore tutorials (also // Window › Learn), then the search icon (the palette stays under its shortcut), then - // the workspace switcher narrows. + // Arrange Documents (also Window › Arrange), then the workspace switcher narrows. let full = ui.max_rect(); let right_edge = if captions_right > 0.0 { full.right() - captions_right - 10.0 } else { full.right() }; let right = egui::Rect::from_min_max(egui::pos2(menus_end + 8.0, full.top()), egui::pos2(right_edge, full.bottom())); @@ -105,13 +105,16 @@ pub fn app_bar(app: &mut VectorcraftApp, ui: &mut Ui) { let ws = ui.painter().layout_no_wrap(ws_name, egui::FontId::proportional(12.0), t.text); let ws_w = (ws.size().x + 36.0).clamp(112.0, 190.0); let gap = ui.spacing().item_spacing.x; - // The search icon, as in PhotoCraft: shown while a minimal switcher fits beside it. + // Arrange Documents, beside the switcher, then the search icon, as in PhotoCraft: each + // shown while a minimal switcher fits beside it. let icon = 28.0; - let search = switcher && room >= 64.0 + 8.0 + gap + icon; - let ws_w = ws_w.min(room - 8.0 - gap - if search { icon } else { 0.0 }).max(64.0); + let arrange = switcher && room >= 64.0 + 8.0 + gap + icon; + let search = arrange && room >= 64.0 + 8.0 + 2.0 * (gap + icon); + let icons = f32::from(u8::from(arrange) + u8::from(search)); + let ws_w = ws_w.min(room - 8.0 - icons * (gap + icon)).max(64.0); // Explore tutorials, beside the search icon, opens the Learn panel. - let learn = search && room >= ws_w + 8.0 + 2.0 * (gap + icon); - let discord = learn && room >= ws_w + 8.0 + 2.0 * (gap + icon) + 10.0 + gap + crate::community::discord_width(ui, false); + let learn = search && room >= ws_w + 8.0 + 3.0 * (gap + icon); + let discord = learn && room >= ws_w + 8.0 + 3.0 * (gap + icon) + 10.0 + gap + crate::community::discord_width(ui, false); let mut rui = ui.new_child(egui::UiBuilder::new().max_rect(right).layout(egui::Layout::right_to_left(egui::Align::Center))); let ui = &mut rui; // Workspace switcher: shows the current workspace, opens Window → Workspace. @@ -130,6 +133,11 @@ pub fn app_bar(app: &mut VectorcraftApp, ui: &mut Ui) { } ui.add_space(8.0); } + // Arrange Documents: Consolidate All Windows and the Tile layouts. + if arrange { + let resp = widgets::icon_button(ui, "layout-grid", tl!("Arrange Documents"), app.ui.tiled, icon); + egui::Popup::menu(&resp).show(|ui| arrange_documents_popup(app, ui)); + } // Search → command palette (its shortcut opens it too). if search { let tip = match menus::shortcut_of("help.commandPalette") { @@ -168,6 +176,33 @@ pub fn app_bar(app: &mut VectorcraftApp, ui: &mut Ui) { } } +/// The Arrange Documents menu ([`menus::arrange_documents_items`]): each item as the Window menu +/// shows it, grayed out while its command can't run, the Tile layout the panes show checked. +fn arrange_documents_popup(app: &mut VectorcraftApp, ui: &mut Ui) { + ui.set_min_width(200.0); + let mut clicked = None; + for it in menus::arrange_documents_items() { + match it { + menus::Item::Sep => { + ui.separator(); + } + menus::Item::Cmd(label, id, p) => { + let Some((enabled, checked)) = menus::shown_state(app, id, &p) else { continue }; + let label = crate::i18n::t_id(id, label); + let text = if checked == Some(true) { format!("✓ {label}") } else { format!(" {label}") }; + if ui.add_enabled(enabled, egui::Button::new(text).min_size(vec2(200.0, 0.0))).clicked() { + clicked = Some((id, if p.is_null() { json!({}) } else { p })); + ui.close(); + } + } + _ => {} + } + } + if let Some((id, p)) = clicked { + menus::invoke(app, id, p); + } +} + /// Whether the window shows the system's title bar instead of the app drawing its own /// ([`VectorcraftApp::desktop_frame`]): Windows with Preferences › User Interface › System Title /// Bar, and Linux whenever the desktop draws the frame, with or without the preference. The diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs index 26f67a0365..461b352c4e 100644 --- a/crates/ui-egui/src/control.rs +++ b/crates/ui-egui/src/control.rs @@ -273,11 +273,12 @@ pub fn inspect(app: &VectorcraftApp, ctx: &egui::Context) -> Value { // The display profile the canvas is drawn through, or why none (Preferences › // Performance › Use Monitor Profile for Canvas). "displayProfile": app.display_profile.status(app.session.prefs.monitor_profile_display), - // Window › Arrange › Tile (not saved, so not in `ui`) and the panes the last frame drew: - // each one's document index, view number (Window › New Window) and rect. Canvas - // coordinates map to the current window's pane, inside its rulers and scroll bars + // Window › Arrange › Tile and its layout (not saved, so not in `ui`) and the panes the + // last frame drew: each one's document index, view number (Window › New Window) and rect. + // Canvas coordinates map to the current window's pane, inside its rulers and scroll bars // (`canvasRect`). "tiled": app.ui.tiled, + "tileLayout": app.ui.tile_layout.name(), "panes": app.canvas.panes.last.iter().map(|(w, c)| json!({ "document": w.0, "view": w.1, diff --git a/crates/ui-egui/src/doc_windows/tests.rs b/crates/ui-egui/src/doc_windows/tests.rs index 64a693a09b..91a0ef23e4 100644 --- a/crates/ui-egui/src/doc_windows/tests.rs +++ b/crates/ui-egui/src/doc_windows/tests.rs @@ -259,7 +259,7 @@ fn tile_brings_floating_documents_back_into_the_grid() { frame(&mut app, &ctx, vec![]); let docs: Vec = app.canvas.panes.last.iter().map(|(w, _)| w.0).collect(); assert_eq!(docs, [0, 1], "a floating document leaves the grid; the tabbed ones share it"); - assert_eq!(app.run("window.arrange.tile", json!({})).unwrap(), json!({"tiled": true, "panes": 3})); + assert_eq!(app.run("window.arrange.tile", json!({})).unwrap(), json!({"tiled": true, "panes": 3, "layout": "grid"})); frame(&mut app, &ctx, vec![]); let docs: Vec = app.canvas.panes.last.iter().map(|(w, _)| w.0).collect(); assert_eq!(docs, [0, 1, 2]); @@ -844,7 +844,7 @@ fn arrange_treats_each_view_as_a_window() { assert!(!enabled(&app, "window.arrange.tile") && !enabled(&app, "window.arrange.cascade"), "one window"); app.run("window.newWindow", json!({})).unwrap(); assert!(enabled(&app, "window.arrange.tile") && enabled(&app, "window.arrange.cascade"), "two views of one document"); - assert_eq!(app.run("window.arrange.tile", json!({})).unwrap(), json!({"tiled": true, "panes": 2})); + assert_eq!(app.run("window.arrange.tile", json!({})).unwrap(), json!({"tiled": true, "panes": 2, "layout": "grid"})); app.run("window.arrange.cascade", json!({})).unwrap(); frame(&mut app, &ctx, vec![]); let uid = app.session.documents()[0].uid; diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index d0a770b2b1..ffeacfc3f5 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -3643,6 +3643,13 @@ digits Malayalam Малаялам Thumbnail View Изглед с миниатюри Thumbnails: Миниатюри: Tile Мозайка + Tile All Vertically Всички в мозайка вертикално + Tile All Horizontally Всички в мозайка хоризонтално + 2-Up Layout Подредба по 2 + 3-Up Layout Подредба по 3 + 4-Up Layout Подредба по 4 + 6-Up Layout Подредба по 6 + Arrange Documents Подреждане на документите Tile Edge Color Цвят на ръба на плочката Tile Edge Color… Цвят на ръба на плочката… Tile Full Pages Покриване на цели страници diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 5fca937f98..916a3e6b5f 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -689,6 +689,13 @@ Previous Document Prethodni dokument Cascade Kaskadno Tile Popločaj + Tile All Vertically Popločaj sve okomito + Tile All Horizontally Popločaj sve vodoravno + 2-Up Layout Raspored po 2 + 3-Up Layout Raspored po 3 + 4-Up Layout Raspored po 4 + 6-Up Layout Raspored po 6 + Arrange Documents Rasporedi dokumente Float in Window Odvoji u prozor Float All in Windows Odvoji sve u prozore Consolidate All Windows Objedini sve prozore diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index b6fdc2a6a6..7fe0977ead 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -4740,6 +4740,13 @@ digits Malayalam Malaiàlam TIFF (8-bit Color) TIFF (color de 8 bits) TIFF (Black & White) TIFF (blanc i negre) Tile Mosaic + Tile All Vertically Mosaic vertical de tot + Tile All Horizontally Mosaic horitzontal de tot + 2-Up Layout Disposició de 2 + 3-Up Layout Disposició de 3 + 4-Up Layout Disposició de 4 + 6-Up Layout Disposició de 6 + Arrange Documents Organitza els documents Tile Edge Color Color de la vora del mosaic Tile Edge Color… Color de la vora del mosaic… Tile Full Pages Mosaic de pàgines senceres diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 47ca092cc0..d9fa87f2bf 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -702,6 +702,13 @@ Previous Document Předchozí dokument Cascade Do kaskády Tile Vedle sebe + Tile All Vertically Vše vedle sebe svisle + Tile All Horizontally Vše vedle sebe vodorovně + 2-Up Layout Rozvržení po 2 + 3-Up Layout Rozvržení po 3 + 4-Up Layout Rozvržení po 4 + 6-Up Layout Rozvržení po 6 + Arrange Documents Uspořádat dokumenty Float in Window Uvolnit do samostatného okna Float All in Windows Uvolnit vše do samostatných oken Consolidate All Windows Sloučit všechna okna diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index ca27bdd2f9..57322a818e 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -1257,6 +1257,13 @@ Previous Document Forrige dokument Cascade Kaskade Tile Fliselæg + Tile All Vertically Fliselæg alle lodret + Tile All Horizontally Fliselæg alle vandret + 2-Up Layout Layout med 2 + 3-Up Layout Layout med 3 + 4-Up Layout Layout med 4 + 6-Up Layout Layout med 6 + Arrange Documents Arrangér dokumenter Float in Window Flyd i vindue Float All in Windows Flyd alle i vinduer Consolidate All Windows Saml alle vinduer diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index df4d5df82e..3da18ee5ba 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -3686,6 +3686,13 @@ effect Points Punkte Thumbnail View Miniaturansicht Thumbnails: Miniaturen: Tile Nebeneinander + Tile All Vertically Alle vertikal nebeneinander + Tile All Horizontally Alle horizontal nebeneinander + 2-Up Layout Layout mit 2 + 3-Up Layout Layout mit 3 + 4-Up Layout Layout mit 4 + 6-Up Layout Layout mit 6 + Arrange Documents Dokumente anordnen Tile Edge Color Farbe der Kachelkante Tile Edge Color… Farbe der Kachelkante… Tile Full Pages Ganze Seiten aufteilen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 9f3ee177e5..739d63f664 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -2171,6 +2171,13 @@ font-technology Variable Μεταβλητές Templates Πρότυπα Threshold Κατώφλι Tile Παράθεση + Tile All Vertically Παράθεση όλων κατακόρυφα + Tile All Horizontally Παράθεση όλων οριζόντια + 2-Up Layout Διάταξη ανά 2 + 3-Up Layout Διάταξη ανά 3 + 4-Up Layout Διάταξη ανά 4 + 6-Up Layout Διάταξη ανά 6 + Arrange Documents Διάταξη εγγράφων Tint Χρωματική απόχρωση Fill Tint Χρωματική απόχρωση γεμίσματος Stroke Tint Χρωματική απόχρωση περιγράμματος diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 555e51b8c7..8244d1fee3 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -3734,6 +3734,13 @@ digits Malayalam Malayálam Thumbnail View Vista de miniaturas Thumbnails: Miniaturas: Tile Mosaico + Tile All Vertically Mosaico vertical de todo + Tile All Horizontally Mosaico horizontal de todo + 2-Up Layout Disposición de 2 + 3-Up Layout Disposición de 3 + 4-Up Layout Disposición de 4 + 6-Up Layout Disposición de 6 + Arrange Documents Organizar documentos Tile Edge Color Color del borde del mosaico Tile Edge Color… Color del borde del mosaico… Tile Full Pages Mosaico de páginas completas diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 363042b43d..85043309b2 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -693,6 +693,13 @@ Previous Document Edellinen asiakirja Cascade Porrasta Tile Vierekkäin + Tile All Vertically Kaikki vierekkäin pystysuunnassa + Tile All Horizontally Kaikki vierekkäin vaakasuunnassa + 2-Up Layout 2 ikkunan asettelu + 3-Up Layout 3 ikkunan asettelu + 4-Up Layout 4 ikkunan asettelu + 6-Up Layout 6 ikkunan asettelu + Arrange Documents Järjestä asiakirjat Float in Window Kelluta ikkunassa Float All in Windows Kelluta kaikki ikkunoissa Consolidate All Windows Yhdistä kaikki ikkunat diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 494a2d944a..6ea29e0c88 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -3726,6 +3726,13 @@ digits Malayalam Malayalam Thumbnail View Vignettes Thumbnails: Vignettes : Tile Mosaïque + Tile All Vertically Tout en mosaïque verticale + Tile All Horizontally Tout en mosaïque horizontale + 2-Up Layout Disposition par 2 + 3-Up Layout Disposition par 3 + 4-Up Layout Disposition par 4 + 6-Up Layout Disposition par 6 + Arrange Documents Disposer les documents Tile Edge Color Couleur du bord du carreau Tile Edge Color… Couleur du bord du carreau… Tile Full Pages Mosaïque de pages entières diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index 7382b4fe9e..f7d8b1c2a9 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -3837,6 +3837,13 @@ Three Point Perspective Preset 5 ત્રણ બિંદુ પર્સ્પેક્ટિવ પ્રીસેટ 5 Thumbnails: થંબનેલ: Tile ટાઇલ + Tile All Vertically બધું ઊભી રીતે ટાઇલ કરો + Tile All Horizontally બધું આડી રીતે ટાઇલ કરો + 2-Up Layout 2 નું લેઆઉટ + 3-Up Layout 3 નું લેઆઉટ + 4-Up Layout 4 નું લેઆઉટ + 6-Up Layout 6 નું લેઆઉટ + Arrange Documents દસ્તાવેજો ગોઠવો Tile Edge Color ટાઇલ કિનારીનો રંગ Tile Edge Color… ટાઇલ કિનારીનો રંગ… Tile Range: ટાઇલ શ્રેણી: diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index edfbe0818f..a1bbffcb84 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -5130,6 +5130,13 @@ antiAlias Sharp शार्प TIFF (8-bit Color) TIFF (8-बिट रंग) TIFF (Black & White) TIFF (ब्लैक एंड व्हाइट) Tile टाइल + Tile All Vertically सभी को लंबवत टाइल करें + Tile All Horizontally सभी को क्षैतिज टाइल करें + 2-Up Layout 2 का लेआउट + 3-Up Layout 3 का लेआउट + 4-Up Layout 4 का लेआउट + 6-Up Layout 6 का लेआउट + Arrange Documents दस्तावेज़ व्यवस्थित करें tile {number} टाइल {number} Tile Edge Color टाइल एज रंग Tile Edge Color… टाइल एज रंग… diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 27dda10840..b57ce2d524 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -4420,6 +4420,13 @@ mark-style Japanese Japán TIFF (8-bit Color) TIFF (8 bites színes) TIFF (Black & White) TIFF (fekete-fehér) Tile Mozaikelrendezés + Tile All Vertically Összes mozaikelrendezése függőlegesen + Tile All Horizontally Összes mozaikelrendezése vízszintesen + 2-Up Layout 2-es elrendezés + 3-Up Layout 3-as elrendezés + 4-Up Layout 4-es elrendezés + 6-Up Layout 6-os elrendezés + Arrange Documents Dokumentumok elrendezése Tile Edge Color Csempeszél színe Tile Edge Color… Csempeszél színe… Tile Full Pages Teljes oldalak csempézése diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index f870492477..d323f3fb3d 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -648,6 +648,13 @@ Previous Document Dokumen sebelumnya Cascade Bertingkat Tile Ubin + Tile All Vertically Ubin semua secara vertikal + Tile All Horizontally Ubin semua secara horizontal + 2-Up Layout Tata letak 2 + 3-Up Layout Tata letak 3 + 4-Up Layout Tata letak 4 + 6-Up Layout Tata letak 6 + Arrange Documents Susun dokumen Float in Window Mengambang di jendela Float All in Windows Mengambangkan semua di jendela Consolidate All Windows Konsolidasikan semua jendela diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 7ef7dedc00..be1847efa5 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -3780,6 +3780,13 @@ digits Malayalam Malayalam Thumbnail View Vista miniature Thumbnails: Miniature: Tile Affianca + Tile All Vertically Affianca tutto verticalmente + Tile All Horizontally Affianca tutto orizzontalmente + 2-Up Layout Layout a 2 + 3-Up Layout Layout a 3 + 4-Up Layout Layout a 4 + 6-Up Layout Layout a 6 + Arrange Documents Disponi documenti Tile Edge Color Colore bordo tassello Tile Edge Color… Colore bordo tassello… Tile Full Pages Affianca pagine intere diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index c18d4c55ca..aabea31a78 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -725,6 +725,13 @@ digits Malayalam マラヤーラム数字 Previous Document 前のドキュメント Cascade 重ねて表示 Tile 並べて表示 + Tile All Vertically すべてを左右に並べて表示 + Tile All Horizontally すべてを上下に並べて表示 + 2-Up Layout 2 分割レイアウト + 3-Up Layout 3 分割レイアウト + 4-Up Layout 4 分割レイアウト + 6-Up Layout 6 分割レイアウト + Arrange Documents ドキュメントの配置 Float in Window ウィンドウを分離 Float All in Windows すべてをウィンドウに分離 Consolidate All Windows すべてのウィンドウを統合 diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 5ab6945aec..33cafdc24e 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -622,6 +622,13 @@ Previous Document წინა დოკუმენტი Cascade კასკადად Tile ფილებად + Tile All Vertically ყველა ფილებად ვერტიკალურად + Tile All Horizontally ყველა ფილებად ჰორიზონტალურად + 2-Up Layout 2-იანი განლაგება + 3-Up Layout 3-იანი განლაგება + 4-Up Layout 4-იანი განლაგება + 6-Up Layout 6-იანი განლაგება + Arrange Documents დოკუმენტების დალაგება Float in Window ცალკე ფანჯარაში გამოტანა Float All in Windows ყველას ცალკე ფანჯრებში გამოტანა Consolidate All Windows ყველა ფანჯრის გაერთიანება diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 9ed9cd6a98..bbfc3bfed6 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -718,6 +718,13 @@ digits Malayalam 말라얄람어 Previous Document 이전 문서 Cascade 계단식 배열 Tile 바둑판식 배열 + Tile All Vertically 모두 세로로 바둑판식 배열 + Tile All Horizontally 모두 가로로 바둑판식 배열 + 2-Up Layout 2분할 레이아웃 + 3-Up Layout 3분할 레이아웃 + 4-Up Layout 4분할 레이아웃 + 6-Up Layout 6분할 레이아웃 + Arrange Documents 문서 정렬 Float in Window 창에 플로팅 Float All in Windows 모두 창에 플로팅 Consolidate All Windows 모든 창 통합 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 711ce4c8a8..002aabacc0 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -1166,6 +1166,13 @@ Previous Document Vorig document Cascade Trapsgewijs schikken Tile Naast elkaar schikken + Tile All Vertically Alles verticaal naast elkaar schikken + Tile All Horizontally Alles horizontaal naast elkaar schikken + 2-Up Layout Indeling met 2 + 3-Up Layout Indeling met 3 + 4-Up Layout Indeling met 4 + 6-Up Layout Indeling met 6 + Arrange Documents Documenten schikken Float in Window In venster zweven Float All in Windows Alles in vensters zweven Consolidate All Windows Alle vensters samenvoegen diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 7e29ed89c5..cde65748c8 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -659,6 +659,13 @@ Previous Document Poprzedni dokument Cascade Kaskadowo Tile Sąsiadująco + Tile All Vertically Wszystkie sąsiadująco w pionie + Tile All Horizontally Wszystkie sąsiadująco w poziomie + 2-Up Layout Układ po 2 + 3-Up Layout Układ po 3 + 4-Up Layout Układ po 4 + 6-Up Layout Układ po 6 + Arrange Documents Rozmieść dokumenty Float in Window Pływające w oknie Float All in Windows Wszystkie pływające w oknach Consolidate All Windows Scal wszystkie okna diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index b9d233f1c9..8867015300 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -3088,6 +3088,13 @@ digits Malayalam Malaiala Threshold Limite Thumbnail View Exibição em Miniatura Tile Bloco + Tile All Vertically Todos em Bloco na Vertical + Tile All Horizontally Todos em Bloco na Horizontal + 2-Up Layout Layout de 2 + 3-Up Layout Layout de 3 + 4-Up Layout Layout de 4 + 6-Up Layout Layout de 6 + Arrange Documents Organizar Documentos Tile Edge Color Cor da Borda do Bloco Tile Edge Color… Cor da Borda do Bloco… Tile Range: Intervalo de Blocos: diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 5845c34c1d..3940cb892d 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -3766,6 +3766,13 @@ digits Malayalam Малаялам Thumbnail View Миниатюры Thumbnails: Миниатюры: Tile Плитка + Tile All Vertically Все плиткой по вертикали + Tile All Horizontally Все плиткой по горизонтали + 2-Up Layout Макет на 2 + 3-Up Layout Макет на 3 + 4-Up Layout Макет на 4 + 6-Up Layout Макет на 6 + Arrange Documents Упорядочить документы Tile Edge Color Цвет края плитки Tile Edge Color… Цвет края плитки… Tile Full Pages Плитка целых страниц diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 9e37b924b0..b070c937a1 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -3656,6 +3656,13 @@ digits Malayalam Malayalam Thumbnail View Miniatyrvy Thumbnails: Miniatyrer: Tile Sida vid sida + Tile All Vertically Alla sida vid sida lodrätt + Tile All Horizontally Alla sida vid sida vågrätt + 2-Up Layout Layout med 2 + 3-Up Layout Layout med 3 + 4-Up Layout Layout med 4 + 6-Up Layout Layout med 6 + Arrange Documents Ordna dokument Tile Edge Color Rutkantsfärg Tile Edge Color… Rutkantsfärg… Tile Full Pages Dela upp i hela sidor diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index b23fc994a9..7f86184a60 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -421,6 +421,17 @@ fn built_in_library_brush_names_are_in_complete_catalogs() { assert!(bad.is_empty(), "{}", bad.join("\n")); } +/// Window › Arrange's Tile layouts and the application bar's Arrange Documents button. +#[test] +fn tile_layout_labels_are_in_complete_catalogs() { + for lang in LANGUAGES.iter().filter(|lang| lang.complete_menus) { + for label in ["Tile All Vertically", "Tile All Horizontally", "2-Up Layout", "3-Up Layout", "4-Up Layout", "6-Up Layout", "Arrange Documents"] + { + assert!(lang.catalog().plain(label).is_some(), "{} is missing {label}", lang.code); + } + } +} + /// Preference choices and the marquee's E hint share the same translated labels. #[test] fn marquee_selection_labels_are_in_complete_catalogs() { diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index e5278e58c6..9096a2d401 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -3519,6 +3519,13 @@ digits Malayalam Malayalam Thumbnail View Küçük Resim Görünümü Thumbnails: Küçük resimler: Tile Fayans + Tile All Vertically Tümünü Dikey Fayans + Tile All Horizontally Tümünü Yatay Fayans + 2-Up Layout 2'li Düzen + 3-Up Layout 3'lü Düzen + 4-Up Layout 4'lü Düzen + 6-Up Layout 6'lı Düzen + Arrange Documents Belgeleri Düzenle Tile Edge Color Döşeme Kenar Rengi Tile Edge Color… Döşeme Kenar Rengi… Tile Full Pages Tam Sayfaları Döşe diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 160d9a2c09..c01d0a2141 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -3773,6 +3773,13 @@ effect Points Точки Thumbnail View Мініатюри Thumbnails: Мініатюри: Tile Плитка + Tile All Vertically Усі плиткою вертикально + Tile All Horizontally Усі плиткою горизонтально + 2-Up Layout Макет на 2 + 3-Up Layout Макет на 3 + 4-Up Layout Макет на 4 + 6-Up Layout Макет на 6 + Arrange Documents Упорядкувати документи Tile Edge Color Колір краю плитки Tile Edge Color… Колір краю плитки… Tile Full Pages Плитка цілих сторінок diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 45312793f3..66942a71d3 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -4130,6 +4130,13 @@ mark-style Japanese Kiểu Nhật Thumbnail View Dạng xem hình thu nhỏ Thumbnails: Hình thu nhỏ: Tile Ô + Tile All Vertically Xếp tất cả theo chiều dọc + Tile All Horizontally Xếp tất cả theo chiều ngang + 2-Up Layout Bố cục 2 + 3-Up Layout Bố cục 3 + 4-Up Layout Bố cục 4 + 6-Up Layout Bố cục 6 + Arrange Documents Sắp xếp tài liệu Tile Edge Color Màu cạnh ô Tile Edge Color… Màu cạnh ô… Tile Full Pages Ô toàn trang diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 0b3c38c9ca..a9f4e1d7e0 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -3594,6 +3594,13 @@ digits Malayalam 马拉雅拉姆数字 Threshold 阈值 Thumbnail View 缩略图视图 Tile 平铺 + Tile All Vertically 全部垂直平铺 + Tile All Horizontally 全部水平平铺 + 2-Up Layout 双联布局 + 3-Up Layout 三联布局 + 4-Up Layout 四联布局 + 6-Up Layout 六联布局 + Arrange Documents 排列文档 Tile Edge Color 拼贴边缘颜色 Tile Edge Color… 拼贴边缘颜色… Tile Full Pages 并排完整页面 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 4c8b7f2d3e..d63d2a05fc 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -4853,6 +4853,13 @@ digits Malayalam 馬來亞拉姆數字 Thumbnail View 縮圖檢視 Thumbnails: 縮圖: Tile 並排顯示 + Tile All Vertically 全部垂直並排顯示 + Tile All Horizontally 全部水平並排顯示 + 2-Up Layout 雙聯版面 + 3-Up Layout 三聯版面 + 4-Up Layout 四聯版面 + 6-Up Layout 六聯版面 + Arrange Documents 排列文件 Tile Edge Color 拼貼邊緣顏色 Tile Edge Color… 拼貼邊緣顏色… Tile Full Pages 並排完整頁面 diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index 4e2d80bb45..8cb75fdae9 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -80,6 +80,7 @@ pub(crate) use run::{normalize_panel, opt_bool, opt_index, opt_number}; use slots::RECENT_FONT_IDS; pub use state::{checked, enabled, plugin_revision, shortcut_of, shown_state}; pub(crate) use submenus::PATH_EFFECTS; +pub(crate) use tree::arrange_documents_items; pub use tree::{menu_tree, menu_tree_named}; pub use ui_commands::UI_COMMANDS; diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index 7b7f7a6b21..4be65589c9 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -671,7 +671,7 @@ fn run_ui_part6(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option crate::doc_windows::new_window(app), "window.arrange.cascade" => crate::doc_windows::cascade(app), - "window.arrange.tile" => crate::canvas::tile(app), + "window.arrange.tile" => crate::canvas::tile(app, p), "window.arrange.floatInWindow" => crate::doc_windows::float_in_window(app, p), "window.arrange.floatAllInWindows" => crate::doc_windows::float_all(app), "window.arrange.consolidateAllWindows" if p.get("index").is_some_and(|i| !i.is_null()) => crate::doc_windows::dock(app, p), diff --git a/crates/ui-egui/src/menus/state.rs b/crates/ui-egui/src/menus/state.rs index 0d5775ffe9..5f76ce6efd 100644 --- a/crates/ui-egui/src/menus/state.rs +++ b/crates/ui-egui/src/menus/state.rs @@ -98,6 +98,8 @@ pub fn checked(app: &VectorcraftApp, id: &str, p: &Value) -> Option { } "window.collapseDock" => crate::panel_docking::dock_collapsed(&app.ui), "window.workspace" => p.get("name").and_then(Value::as_str) == Some(app.ui.workspace.as_str()), + // The Tile layout the panes show. + "window.arrange.tile" => app.ui.tiled && crate::canvas::TileLayout::from_params(p) == Ok(app.ui.tile_layout), "window.brightness" => p.get("brightness").and_then(Value::as_str).and_then(Brightness::parse) == Some(app.ui.brightness), "view.slices.lock" => app.session.slices_locked(), "object.slice.clipToArtboard" => app.session.active().is_some_and(|d| d.doc.slices_clip_to_artboard), diff --git a/crates/ui-egui/src/menus/tree.rs b/crates/ui-egui/src/menus/tree.rs index 4b86b4152d..2f93db6520 100644 --- a/crates/ui-egui/src/menus/tree.rs +++ b/crates/ui-egui/src/menus/tree.rs @@ -631,16 +631,16 @@ pub fn menu_tree_named(english_names: bool) -> Vec<(&'static str, Vec)> { ("Window", { let mut window_items = vec![ c("New Window", "window.newWindow"), - sub( - "Arrange", - vec![ - c("Cascade", "window.arrange.cascade"), - c("Tile", "window.arrange.tile"), + sub("Arrange", { + let mut arrange = vec![c("Cascade", "window.arrange.cascade")]; + arrange.extend(tile_items()); + arrange.extend([ c("Float in Window", "window.arrange.floatInWindow"), c("Float All in Windows", "window.arrange.floatAllInWindows"), c("Consolidate All Windows", "window.arrange.consolidateAllWindows"), - ], - ), + ]); + arrange + }), sub("Workspace", crate::workspaces::menu_items()), Sep, c("Control", "window.control"), @@ -755,6 +755,27 @@ pub(super) fn transform_items() -> Vec { ] } +/// Window → Arrange's Tile layouts, one `window.arrange.tile` `layout` each (also under the +/// application bar's Arrange Documents button). +fn tile_items() -> Vec { + vec![ + c("Tile", "window.arrange.tile"), + cp("Tile All Vertically", "window.arrange.tile", json!({"layout": "vertical"})), + cp("Tile All Horizontally", "window.arrange.tile", json!({"layout": "horizontal"})), + cp("2-Up Layout", "window.arrange.tile", json!({"layout": "2up"})), + cp("3-Up Layout", "window.arrange.tile", json!({"layout": "3up"})), + cp("4-Up Layout", "window.arrange.tile", json!({"layout": "4up"})), + cp("6-Up Layout", "window.arrange.tile", json!({"layout": "6up"})), + ] +} + +/// The application bar's Arrange Documents menu: Consolidate All Windows, then the Tile layouts. +pub(crate) fn arrange_documents_items() -> Vec { + let mut items = vec![c("Consolidate All Windows", "window.arrange.consolidateAllWindows"), Sep]; + items.extend(tile_items()); + items +} + /// Object → Arrange (also in the canvas context menu). pub(super) fn arrange_items() -> Vec { vec![ diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 21b8795662..e54b366be3 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -769,7 +769,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "window.arrange.tile", "Tile", "", - "{} show every open document and each further view of one (window.newWindow) at once, edge to edge in the document area, one pane each in a grid (columns: the square root of the number of panes, rounded up), each fitted to its pane; the current window's pane takes the tools, a click in another pane makes its window the current one; the tabs stay; windows floating come back under the tabs first; with fewer than two windows open the view stays as it is; returns {tiled, panes}", + "{layout?: grid|vertical|horizontal|2up|3up|4up|6up} show the open documents and each further view of one (window.newWindow) at once, edge to edge in the document area, one pane each, each fitted to its pane: `grid` (the default) in a grid (columns: the square root of the number of panes, rounded up), `vertical` side by side in one row (Tile All Vertically), `horizontal` stacked in one column (Tile All Horizontally), `2up`, `3up`, `4up` and `6up` at most that many panes (2up and 3up side by side, 4up two by two, 6up three by two) with the other windows under their tabs: the first windows in tab order, the current window in the last pane when it is not among them; the current window's pane takes the tools, a click in another pane makes its window the current one; the tabs stay; windows floating come back under the tabs first; with fewer than two windows open the view and the layout stay as they are; any other `layout` is an error; returns {tiled, panes, layout}", ), ( "window.arrange.floatInWindow", diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index 80a87b4563..97ffd12af0 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -598,6 +598,10 @@ pub struct UiState { /// Consolidate All Windows. Not saved: the reference app does not save windows with a document. #[serde(skip)] pub tiled: bool, + /// How Tile lays the panes out: in a grid, side by side, stacked, or 2-up to 6-up. Not saved, + /// as `tiled` is not. + #[serde(skip)] + pub tile_layout: crate::canvas::TileLayout, /// Window › Arrange › Float in Window, Float All in Windows and Cascade: the documents in /// floating windows of their own, out of the tab strip, until Consolidate All Windows. Not /// saved, as `tiled` is not. @@ -1176,6 +1180,7 @@ impl Default for UiState { palette_query: String::new(), screen_mode: 0, tiled: false, + tile_layout: crate::canvas::TileLayout::Grid, floating: Vec::new(), tab_document: None, draw_mode: 0, diff --git a/docs/mcp.md b/docs/mcp.md index fc03d070b6..550e2249dd 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -6606,14 +6606,20 @@ current, or the one before it when it was the last tab. In the desktop app a mod to ask whether to save it. `window.arrange.tile` (Window › Arrange › Tile) shows every open document in its own pane, edge to edge in the document area, in a grid of as many columns as the square root of the number of documents, rounded up, and fits each document to -its pane; with fewer than two documents open it leaves the view and `tiled` as they are. It returns `{tiled, panes}`. -The current document's pane is the canvas, and a press in another pane makes its document the current one. -`window.arrange.consolidateAllWindows` (Window › Arrange › Consolidate All Windows) shows one document under its tab -again and returns `{tiled: false}`. The arrangement is not saved. `ui.inspect` reports `tiled` and `panes` (each pane's -`document` index, `rect` and whether it is `active`); canvas coordinates map to the current document's pane -(`canvasRect`). -its pane; it returns `{tiled, panes}`. The current document's pane is the canvas, and a press in another pane makes its -document the current one. `window.arrange.floatInWindow` (Window › Arrange › Float in Window) moves the current document +its pane; with fewer than two documents open it leaves the view, `tiled` and the layout as they are. It returns +`{tiled, panes, layout}`. `window.arrange.tile {layout}` picks another layout, as the other Tile items of Window › +Arrange and of the application bar's Arrange Documents button do: `grid` (the default), `vertical` (Tile All +Vertically: side by side in one row), `horizontal` (Tile All Horizontally: stacked in one column), and `2up`, `3up`, +`4up` and `6up`, which show at most that many documents (2-Up and 3-Up side by side, 4-Up two by two, 6-Up three by +two) and leave the others under their tabs. Those layouts show the first documents in tab order, and the current +document takes the last pane when it is not among them, so a click on another tab brings that document into the last +pane. Any other `layout` is an error, and the view stays as it is. The set of layouts and how each one places the panes +are VectorCraft's own. The current document's pane is the canvas, and a press in another pane makes its document the +current one. `window.arrange.consolidateAllWindows` (Window › Arrange › Consolidate All Windows, also first in Arrange +Documents) shows one document under its tab again and returns `{tiled: false}`. The arrangement is not saved. +`ui.inspect` reports `tiled`, `tileLayout` and `panes` (each pane's `document` index, `rect` and whether it is +`active`); canvas coordinates map to the current document's pane (`canvasRect`). +`window.arrange.floatInWindow` (Window › Arrange › Float in Window) moves the current document out of the tab strip into a floating window of its own, `window.arrange.floatAllInWindows` (Float All in Windows) does so for every tabbed document, and `window.arrange.cascade` (Cascade) floats every document and stacks the windows 30 pt apart from the upper left of the document area; each returns `{floating}`, the floating documents' indices. On the diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 0a1f7c81b8..51d04da8c8 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -724,6 +724,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Fade Region Outside Artboard:** Artboard Options' Global checkboxes Fade Region Outside Artboard and Update While Dragging ([user guide, Artboard options](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf)) are application preferences (`fadeRegionOutsideArtboard`, `artboardUpdateWhileDragging`), both on by default. While the Artboard tool is active the canvas draws everything outside the artboards, the pasteboard and the art on it, with each color channel at 60% of its value (VectorCraft's own amount), or only outside the box around all the artboards when crossing artboards would leave more than 4,096 rectangles in view; with Update While Dragging off it draws as usual during an artboard move or resize. Presentation Mode, exports and print do not change. Regression tests: `canvas::tests` (`the_artboard_tool_fades_the_pasteboard`, `presentation_mode_draws_no_fade`, `the_fade_darkens_art_on_the_pasteboard_and_not_on_the_artboard`, `outside_rects_cover_the_bounds_minus_the_boards`, `outside_rects_of_a_row_of_boards_stay_few`, `the_fade_of_crossing_boards_stays_bounded`, `update_while_dragging_keeps_or_drops_the_fade_during_an_artboard_drag`, `the_pasteboard_fade_leaves_exports_unchanged`), `dialogs/tests.rs` (`artboard_options_global_checkboxes_set_the_preferences`, `artboard_options_error_leaves_the_global_preferences_unchanged`). - **Saved views (G7):** View › New View… and Edit Views… ([public source](https://helpx.adobe.com/illustrator/using/viewing-artwork.html): up to 25 views per document, saved with it, renamed or deleted in Edit Views, chosen from the bottom of the View menu). Each view keeps the zoom, centre and rotation; the View menu lists all 25 (`view.goto1`–`view.goto25`), and Edit Views… lists them to rename or delete, applied together as one undo step. A file's views are checked when it opens (at most 25, unique names up to 255 characters, a finite centre and a positive zoom). Tests: `saved_views_round_trip_and_from_a_file_are_tidied` (`crates/format/tests/prop_format.rs`), `crates/engine/src/cmd/views.rs`, `crates/ui-egui/src/dialogs/edit_views.rs` and `every_saved_view_is_listed_at_the_bottom_of_the_view_menu` (`crates/ui-egui/src/menus.rs`). - **Window › Arrange › Tile (G7):** Tile (`window.arrange.tile`) shows every open document at once, edge to edge in the document area ([public source](https://helpx.adobe.com/illustrator/using/viewing-artwork.html)), one pane each in a grid of as many columns as the square root of the number of documents, rounded up, each fitted to its pane. The current document's pane is the canvas; the other panes draw their documents with their artboards, guides and selected objects, and a press in one makes its document the current one. Consolidate All Windows (`window.arrange.consolidateAllWindows`) shows one document under its tab again. The grid and when the two items are enabled (Tile with two documents or more, Consolidate All Windows while they are tiled) are VectorCraft's own. Tests: `crates/ui-egui/src/canvas/panes/tests.rs`. +- **Arrange Documents (G7):** the application bar's Arrange Documents button arranges the open documents in grid and tile layouts ([public source](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/workspace-overview.html)). Its menu, and Window › Arrange, have Consolidate All Windows, Tile (the grid), Tile All Vertically (side by side), Tile All Horizontally (stacked) and the 2-Up, 3-Up, 4-Up and 6-Up layouts, which show that many documents and leave the others under their tabs, the current one in the last pane (`window.arrange.tile {layout}`). The set of layouts and how each places the panes are VectorCraft's own. Tests: `crates/ui-egui/src/canvas/panes/tests.rs`. - **Window › Arrange › Float in Window, Float All in Windows and Cascade (G7):** documents float in windows of their own, out of the tab strip ([public source](https://helpx.adobe.com/illustrator/using/customizing-workspace.html)). Float in Window (`window.arrange.floatInWindow`) floats the current document, Float All in Windows (`window.arrange.floatAllInWindows`) every tabbed one, and Cascade (`window.arrange.cascade`) floats every document and stacks the windows from the upper left to the lower right ([public source](https://helpx.adobe.com/illustrator/using/viewing-artwork.html)). On the desktop each window is an OS window; on the web and on Wayland it is a window inside the app's window. The window of the current document holds the canvas; the others draw their documents as Tile's panes do, and a press in one makes its document the current one. Closing a window closes its document, asking to save unsaved changes. Consolidate All Windows brings every document back under the tabs, and Tile brings them back into its grid. The cascade's 30 pt step, the windows' size and when the items are enabled (Cascade with two documents or more, Float in Window for a tabbed current document, Float All in Windows while a document is tabbed, Consolidate All Windows while documents are tiled or floating) are VectorCraft's own. Tests: `crates/ui-egui/src/doc_windows/tests.rs`. - **Dragging a document tab out and a document window back (G7):** a document tab dragged more than 24 pt above or below the tab strip floats its document in a window under the pointer, and a document window dragged onto the tab strip goes back under the tabs ([public source](https://helpx.adobe.com/illustrator/using/customizing-workspace.html)). A window inside the app's window is dragged by its title bar; an OS window by the document's tab at its top, and the window follows the pointer. The 24 pt distance and the tab at the top of an OS window are VectorCraft's own. Tests: `crates/ui-egui/src/doc_windows/tests.rs`. - **Reordering document tabs (G7, #5663):** a document tab dragged along the tab strip moves its document among the others ([public source](https://helpx.adobe.com/illustrator/using/customizing-workspace.html)); a line marks the gap it goes in. The current document stays current, each document keeps its own zoom, centre and artboard, the views Window › New Window opened move with their document, and Window › Next/Previous Document follow the new order. `document.move` (`{from?, to}`) does the same from MCP, the control channel and recordings. `crates/ui-egui/src/tests/tab_reorder.rs`, `crates/engine/src/tests/document_move.rs`. From 40e1a80d5cdfce1feb7a1c1a8d8c8ed49b40180f Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 16:26:11 -0800 Subject: [PATCH 2/5] Window: a document that keeps its pane keeps its zoom when another closes Panes refit a view when its slot or its place in the layout changes, not when the number of panes changes. Closing the sixth document in 6-Up leaves the other five in their panes with their zoom and scroll; side by side and stacked, every pane changes size and each document fits its new pane. --- crates/ui-egui/src/canvas/panes.rs | 16 +++++++----- crates/ui-egui/src/canvas/panes/tests.rs | 33 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/crates/ui-egui/src/canvas/panes.rs b/crates/ui-egui/src/canvas/panes.rs index 6b8eea9440..703c6b46bd 100644 --- a/crates/ui-egui/src/canvas/panes.rs +++ b/crates/ui-egui/src/canvas/panes.rs @@ -322,16 +322,18 @@ pub(crate) fn tiled_area(app: &mut VectorcraftApp, ui: &mut Ui) -> bool { app.canvas.panes.shown.retain(|s, _| live.contains(s)); app.canvas.panes.pending.retain(|s, _| live.contains(s)); app.canvas.panes.fits.retain(|s, _| live.contains(s)); - // A window opened, closed, floated or docked changes the panes, and so does coming back to the - // panes from one window: each window fits its new pane. With as many panes as before, only a - // window that moved to another pane fits it, as when a tab brings its window into the last pane - // of a 2-up to 6-up layout: the others keep their zoom and scroll. Windows are compared by - // their slots, since a closed document shifts the indices of the documents after it. + // A window that moved to another pane fits it, and so does a window whose pane changed place or + // size because a window opened, closed, floated or docked, or because the panes came back from + // one window. A window that keeps its pane keeps its zoom and scroll, as when a tab brings its + // window into the last pane of a 2-up to 6-up layout, or when 6-Up loses its sixth document. + // Windows are compared by their slots, since a closed document shifts the indices of the + // documents after it, and panes by their place in the layout. let before = std::mem::take(&mut app.canvas.panes.last_slots); let now: Vec> = shown.iter().map(|w| slot(app, *w)).collect(); - let same_panes = before.len() == now.len(); + let unit = egui::Rect::from_min_size(pos2(0.0, 0.0), vec2(1.0, 1.0)); + let (cells_before, cells_now) = (layout_cells(layout, before.len(), unit), layout_cells(layout, now.len(), unit)); for (i, (w, s)) in shown.iter().zip(&now).enumerate() { - if same_panes && s.is_some() && before.get(i) == Some(s) { + if s.is_some() && before.get(i) == Some(s) && cells_before.get(i) == cells_now.get(i) { continue; } if let Some(v) = crate::doc_windows::view_mut(app, *w) { diff --git a/crates/ui-egui/src/canvas/panes/tests.rs b/crates/ui-egui/src/canvas/panes/tests.rs index 2ad0af3dc1..1fcbd7cc61 100644 --- a/crates/ui-egui/src/canvas/panes/tests.rs +++ b/crates/ui-egui/src/canvas/panes/tests.rs @@ -232,6 +232,39 @@ fn closing_a_document_in_an_n_up_layout_fits_the_documents_that_change_panes() { assert!(v.fitted && (v.zoom - fit_zoom(area, Rect::new(0.0, 0.0, 400.0, 300.0), 0.0, 1.0)).abs() < 1e-9, "it fits its new pane: {v:?}"); } +/// 6-Up keeps its three columns and two rows with five documents: closing the sixth leaves the +/// others in their panes with the zoom they had. Side by side, closing one widens every pane, and +/// each document fits its new pane. +#[test] +fn closing_a_document_keeps_the_zoom_of_the_documents_whose_panes_stay() { + let mut app = app_with(6); + let ctx = egui::Context::default(); + app.run("document.activate", json!({"index": 0})).unwrap(); + app.run("window.arrange.tile", json!({"layout": "6up"})).unwrap(); + frame(&mut app, &ctx, vec![]); + assert_eq!(panes(&app).0, [0, 1, 2, 3, 4, 5]); + app.views[1].zoom *= 2.0; + let zoomed = app.views[1].zoom; + app.run("file.close", json!({"index": 5})).unwrap(); + frame(&mut app, &ctx, vec![]); + let (docs, rects) = panes(&app); + assert_eq!((docs, columns_and_rows(&rects)), (vec![0, 1, 2, 3, 4], (3, 2))); + assert_eq!(app.views[1].zoom, zoomed, "the document that kept its pane keeps its zoom"); + + let mut app = app_with(3); + app.run("document.activate", json!({"index": 0})).unwrap(); + app.run("window.arrange.tile", json!({"layout": "vertical"})).unwrap(); + frame(&mut app, &ctx, vec![]); + app.views[1].zoom *= 2.0; + app.run("file.close", json!({"index": 2})).unwrap(); + frame(&mut app, &ctx, vec![]); + let (docs, rects) = panes(&app); + assert_eq!(docs, [0, 1]); + let area = view_rects(&app, rects[1], ctx.pixels_per_point()).1; + let v = app.views[1]; + assert!(v.fitted && (v.zoom - fit_zoom(area, Rect::new(0.0, 0.0, 400.0, 300.0), 0.0, 1.0)).abs() < 1e-9, "it fits its wider pane: {v:?}"); +} + #[test] fn tile_refuses_a_layout_it_does_not_have() { let mut app = app_with(3); From 02351b0105c30c98d9e6e1122b49abd9769cfb12 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 16:45:34 -0800 Subject: [PATCH 3/5] Window: a narrow application bar drops Arrange Documents before the search icon The search icon takes the first icon slot beside the workspace switcher, as before Arrange Documents was added; Arrange Documents shows only when a second slot fits. --- crates/ui-egui/src/canvas/panes/tests.rs | 26 +++++++++++++++++++++++- crates/ui-egui/src/chrome.rs | 14 ++++++------- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/crates/ui-egui/src/canvas/panes/tests.rs b/crates/ui-egui/src/canvas/panes/tests.rs index 1fcbd7cc61..e3da1a6a60 100644 --- a/crates/ui-egui/src/canvas/panes/tests.rs +++ b/crates/ui-egui/src/canvas/panes/tests.rs @@ -341,7 +341,12 @@ fn the_tile_items_check_the_layout_the_panes_show() { /// One frame of the application bar with screen-reader nodes on → the nodes. fn app_bar_frame(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec) -> Vec { - let screen = egui::Rect::from_min_size(Pos2::ZERO, vec2(1400.0, 800.0)); + app_bar_frame_in(app, ctx, events, 1400.0) +} + +/// [`app_bar_frame`] on a window `width` points wide. +fn app_bar_frame_in(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec, width: f32) -> Vec { + let screen = egui::Rect::from_min_size(Pos2::ZERO, vec2(width, 800.0)); let mut out = ctx.run_ui(egui::RawInput { events, screen_rect: Some(screen), ..Default::default() }, |ui| crate::chrome::app_bar(app, ui)); out.textures_delta.clear(); out.platform_output.accesskit_update.map(|u| u.nodes.into_iter().map(|(_, n)| n).collect()).unwrap_or_default() @@ -395,6 +400,25 @@ fn the_arrange_documents_button_tiles_and_consolidates() { assert!(!app.ui.tiled); } +/// As the application bar narrows, Arrange Documents goes before the search icon. +#[test] +fn a_narrow_application_bar_keeps_search_before_arrange_documents() { + crate::i18n::set_current(crate::i18n::Lang::EN); + let mut app = app_with(3); + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + crate::theme::install_fonts(&ctx); + let mut search_alone = false; + for width in (200..=1400).rev().step_by(4) { + app_bar_frame_in(&mut app, &ctx, vec![], width as f32); + let nodes = app_bar_frame_in(&mut app, &ctx, vec![], width as f32); + let (arrange, search) = (app_bar_node(&nodes, "Arrange Documents").is_some(), app_bar_node(&nodes, "Search commands and tools").is_some()); + assert!(search || !arrange, "{width} pt: Arrange Documents shows without the search icon"); + search_alone |= search && !arrange; + } + assert!(search_alone, "some width shows the search icon without Arrange Documents"); +} + #[test] fn tile_shows_a_pane_for_each_document_fitted_to_it() { let mut app = app_with(3); diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rs index 96b4d12965..989cebadc0 100644 --- a/crates/ui-egui/src/chrome.rs +++ b/crates/ui-egui/src/chrome.rs @@ -84,8 +84,8 @@ pub fn app_bar(app: &mut VectorcraftApp, ui: &mut Ui) { let menus_end = if app.services.native_menu.is_some() { ui.cursor().min.x } else { menus::menu_bar(app, ui) }; // The right-side group fills the space after the menus from the right; when it runs // short, Discord goes first (it is also under Help), then Explore tutorials (also - // Window › Learn), then the search icon (the palette stays under its shortcut), then - // Arrange Documents (also Window › Arrange), then the workspace switcher narrows. + // Window › Learn), then Arrange Documents (also Window › Arrange), then the search icon + // (the palette stays under its shortcut), then the workspace switcher narrows. let full = ui.max_rect(); let right_edge = if captions_right > 0.0 { full.right() - captions_right - 10.0 } else { full.right() }; let right = egui::Rect::from_min_max(egui::pos2(menus_end + 8.0, full.top()), egui::pos2(right_edge, full.bottom())); @@ -105,15 +105,15 @@ pub fn app_bar(app: &mut VectorcraftApp, ui: &mut Ui) { let ws = ui.painter().layout_no_wrap(ws_name, egui::FontId::proportional(12.0), t.text); let ws_w = (ws.size().x + 36.0).clamp(112.0, 190.0); let gap = ui.spacing().item_spacing.x; - // Arrange Documents, beside the switcher, then the search icon, as in PhotoCraft: each - // shown while a minimal switcher fits beside it. + // The search icon, as in PhotoCraft, then Arrange Documents between it and the switcher: + // each shown while a minimal switcher fits beside it. let icon = 28.0; - let arrange = switcher && room >= 64.0 + 8.0 + gap + icon; - let search = arrange && room >= 64.0 + 8.0 + 2.0 * (gap + icon); + let search = switcher && room >= 64.0 + 8.0 + gap + icon; + let arrange = search && room >= 64.0 + 8.0 + 2.0 * (gap + icon); let icons = f32::from(u8::from(arrange) + u8::from(search)); let ws_w = ws_w.min(room - 8.0 - icons * (gap + icon)).max(64.0); // Explore tutorials, beside the search icon, opens the Learn panel. - let learn = search && room >= ws_w + 8.0 + 3.0 * (gap + icon); + let learn = arrange && room >= ws_w + 8.0 + 3.0 * (gap + icon); let discord = learn && room >= ws_w + 8.0 + 3.0 * (gap + icon) + 10.0 + gap + crate::community::discord_width(ui, false); let mut rui = ui.new_child(egui::UiBuilder::new().max_rect(right).layout(egui::Layout::right_to_left(egui::Align::Center))); let ui = &mut rui; From 62ef2f4e6871c7abe29f458368444b9791496198 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 16 Nov 2026 10:24:23 -0800 Subject: [PATCH 4/5] Docs: Tile counts each view of a document as a window window.arrange.tile counts windows for its two-window minimum, its grid columns and the panes of the 2-Up to 6-Up layouts. docs/mcp.md said documents. --- docs/mcp.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/mcp.md b/docs/mcp.md index 4be2808189..b7372cec7a 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -7345,14 +7345,15 @@ document current, and its tool keeps its state; closing the current document mak current, or the one before it when it was the last tab. In the desktop app a modified document comes to the front first, to ask whether to save it. `window.arrange.tile` (Window › Arrange › Tile) shows every open document in its own pane, edge to edge in the document -area, in a grid of as many columns as the square root of the number of documents, rounded up, and fits each document to -its pane; with fewer than two documents open it leaves the view, `tiled` and the layout as they are. It returns +area, in a grid of as many columns as the square root of the number of windows, rounded up, and fits each document to +its pane. Each view of a document counts as a window (see `window.newWindow` below). With fewer than two windows open it +leaves the view, `tiled` and the layout as they are. It returns `{tiled, panes, layout}`. `window.arrange.tile {layout}` picks another layout, as the other Tile items of Window › Arrange and of the application bar's Arrange Documents button do: `grid` (the default), `vertical` (Tile All Vertically: side by side in one row), `horizontal` (Tile All Horizontally: stacked in one column), and `2up`, `3up`, -`4up` and `6up`, which show at most that many documents (2-Up and 3-Up side by side, 4-Up two by two, 6-Up three by -two) and leave the others under their tabs. Those layouts show the first documents in tab order, and the current -document takes the last pane when it is not among them, so a click on another tab brings that document into the last +`4up` and `6up`, which show at most that many windows (2-Up and 3-Up side by side, 4-Up two by two, 6-Up three by +two) and leave the others under their tabs. Those layouts show the first windows in tab order, and the current +window takes the last pane when it is not among them, so a click on another tab brings that window into the last pane. Any other `layout` is an error, and the view stays as it is. The set of layouts and how each one places the panes are VectorCraft's own. The current document's pane is the canvas, and a press in another pane makes its document the current one. `window.arrange.consolidateAllWindows` (Window › Arrange › Consolidate All Windows, also first in Arrange From 46c8a86fbd81c9a52301efd04ec4c3f4d94a7618 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 16 Nov 2026 12:01:11 -0800 Subject: [PATCH 5/5] Window: Arrange Documents tests find the search icon by its current label The command palette's search icon is labeled "Search commands, tools, panels and effects" since 44f75df965. The two application bar tests still looked for "Search commands and tools", so the narrow-bar test saw Arrange Documents without the search icon at every width. --- crates/ui-egui/src/canvas/panes/tests.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/canvas/panes/tests.rs b/crates/ui-egui/src/canvas/panes/tests.rs index 24a4690b3c..8b3f7277b1 100644 --- a/crates/ui-egui/src/canvas/panes/tests.rs +++ b/crates/ui-egui/src/canvas/panes/tests.rs @@ -376,7 +376,7 @@ fn the_arrange_documents_button_tiles_and_consolidates() { crate::theme::install_fonts(&ctx); app_bar_frame(&mut app, &ctx, vec![]); let nodes = app_bar_frame(&mut app, &ctx, vec![]); - let (arrange, search) = (app_bar_node(&nodes, "Arrange Documents"), app_bar_node(&nodes, "Search commands and tools")); + let (arrange, search) = (app_bar_node(&nodes, "Arrange Documents"), app_bar_node(&nodes, "Search commands, tools, panels and effects")); let (arrange, search) = (arrange.expect("the application bar has Arrange Documents"), search.expect("the search icon shows")); assert!(arrange.x > search.x && (arrange.y - search.y).abs() < 1.0, "right of the search icon: {arrange:?}, {search:?}"); click_app_bar(&mut app, &ctx, "Arrange Documents"); @@ -412,7 +412,8 @@ fn a_narrow_application_bar_keeps_search_before_arrange_documents() { for width in (200..=1400).rev().step_by(4) { app_bar_frame_in(&mut app, &ctx, vec![], width as f32); let nodes = app_bar_frame_in(&mut app, &ctx, vec![], width as f32); - let (arrange, search) = (app_bar_node(&nodes, "Arrange Documents").is_some(), app_bar_node(&nodes, "Search commands and tools").is_some()); + let (arrange, search) = + (app_bar_node(&nodes, "Arrange Documents").is_some(), app_bar_node(&nodes, "Search commands, tools, panels and effects").is_some()); assert!(search || !arrange, "{width} pt: Arrange Documents shows without the search icon"); search_alone |= search && !arrange; }