mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-18 05:29:53 +00:00
Merge pull request #7709 from dotCooCoo/feat/arrange-documents-layouts
Window: Arrange Documents tiles the documents side by side, stacked or 2-Up to 6-Up
This commit is contained in:
@@ -803,7 +803,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",
|
||||
|
||||
@@ -64,7 +64,7 @@ pub use overlays::SharedPaths;
|
||||
#[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, note_drop, noted_cursor, pane, release_on_noted, tile, tiled_area};
|
||||
pub(crate) use raster::{KeptFrame, color_image, color_image_owned, render_job};
|
||||
use raster::{changed_pixels, frame_ppp, pixel_region, upload};
|
||||
|
||||
@@ -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. A Selection drag released in it drops the dragged
|
||||
//! artwork into its document ([`crate::document_drag::drop_on_pane`]). Each view Window › New
|
||||
@@ -39,6 +40,9 @@ pub struct Panes {
|
||||
pending: HashMap<Slot, CacheKey>,
|
||||
/// 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<Option<Slot>>,
|
||||
/// 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<Slot, (egui::Vec2, f64, Point)>,
|
||||
@@ -50,6 +54,7 @@ impl Panes {
|
||||
self.shown.clear();
|
||||
self.pending.clear();
|
||||
self.last.clear();
|
||||
self.last_slots.clear();
|
||||
self.fits.clear();
|
||||
}
|
||||
|
||||
@@ -162,37 +167,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<egui::Rect> {
|
||||
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<Layout, String> {
|
||||
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<egui::Rect> {
|
||||
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<serde_json::Value, String> {
|
||||
/// 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<Win>) -> Vec<Win> {
|
||||
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<serde_json::Value, String> {
|
||||
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
|
||||
@@ -220,27 +311,43 @@ 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<Slot> = 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<Slot> =
|
||||
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 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<Option<Slot>> = shown.iter().map(|w| slot(app, *w)).collect();
|
||||
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 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) {
|
||||
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;
|
||||
|
||||
@@ -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<egui::Rect> {
|
||||
layout_cells(Layout::Grid, n, area)
|
||||
}
|
||||
|
||||
/// The documents' indices in the panes the last frame drew, and the panes.
|
||||
fn panes(app: &VectorcraftApp) -> (Vec<usize>, Vec<egui::Rect>) {
|
||||
app.canvas.panes.last.iter().map(|(w, r)| (w.0, *r)).unzip()
|
||||
@@ -84,6 +89,336 @@ 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<u32> = c.iter().map(|r| r.left().to_bits()).collect();
|
||||
let tops: BTreeSet<u32> = 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:?}");
|
||||
}
|
||||
|
||||
/// 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);
|
||||
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<egui::Event>) -> Vec<egui::accesskit::Node> {
|
||||
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<egui::Event>, width: f32) -> Vec<egui::accesskit::Node> {
|
||||
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()
|
||||
}
|
||||
|
||||
/// 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<Pos2> {
|
||||
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"));
|
||||
let (arrange, search) = (arrange.expect("the application bar has Arrange Documents"), search.expect("the search shows"));
|
||||
assert!(arrange.x > search.x && (arrange.y - search.y).abs() < 1.0, "right of the search: {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);
|
||||
}
|
||||
|
||||
/// As the application bar narrows, Arrange Documents goes before the search.
|
||||
#[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").is_some());
|
||||
assert!(search || !arrange, "{width} pt: Arrange Documents shows without the search");
|
||||
search_alone |= search && !arrange;
|
||||
}
|
||||
assert!(search_alone, "some width shows the search without Arrange Documents");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tile_shows_a_pane_for_each_document_fitted_to_it() {
|
||||
let mut app = app_with(3);
|
||||
@@ -91,7 +426,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]);
|
||||
@@ -454,7 +789,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();
|
||||
|
||||
@@ -110,7 +110,7 @@ pub fn app_bar(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
gap: ui.spacing().item_spacing.x,
|
||||
community: crate::community::discord_width(ui, false),
|
||||
});
|
||||
let (switcher, ws_w, learn, discord) = (fit.switcher, fit.switcher_w, fit.learn, fit.community);
|
||||
let (switcher, ws_w, arrange, learn, discord) = (fit.switcher, fit.switcher_w, fit.arrange, fit.learn, fit.community);
|
||||
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.
|
||||
@@ -129,6 +129,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, BAR_ICON);
|
||||
egui::Popup::menu(&resp).show(|ui| arrange_documents_popup(app, ui));
|
||||
}
|
||||
// Search → command palette (its shortcut opens it too).
|
||||
let with_shortcut = |text: &str| match &field.shortcut {
|
||||
Some(sc) => format!("{text} ({sc})"),
|
||||
@@ -181,7 +186,34 @@ pub fn app_bar(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
}
|
||||
}
|
||||
|
||||
/// The side of the app bar's square icon buttons (the search icon, Explore tutorials).
|
||||
/// 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);
|
||||
}
|
||||
}
|
||||
|
||||
/// The side of the app bar's square icon buttons (the search icon, Arrange Documents, Explore tutorials).
|
||||
const BAR_ICON: f32 = 28.0;
|
||||
/// The narrowest the workspace switcher gets.
|
||||
const MIN_SWITCHER: f32 = 64.0;
|
||||
@@ -225,6 +257,8 @@ struct RightGroup {
|
||||
switcher_w: f32,
|
||||
/// How the search shows.
|
||||
search: Search,
|
||||
/// Whether Arrange Documents shows.
|
||||
arrange: bool,
|
||||
/// Whether Explore tutorials shows.
|
||||
learn: bool,
|
||||
/// Whether the community button shows.
|
||||
@@ -232,8 +266,8 @@ struct RightGroup {
|
||||
}
|
||||
|
||||
/// The right-hand group for the room it has. As the room runs short, the community button goes first
|
||||
/// (it is also under Help), then Explore tutorials (also Window › Learn), then the search field becomes the
|
||||
/// search icon, then the workspace switcher narrows to [`MIN_SWITCHER`], then the icon goes. In Safe
|
||||
/// (it is also under Help), then Explore tutorials (also Window › Learn), then Arrange Documents (also Window ›
|
||||
/// Arrange), then the search field becomes the search icon, then the workspace switcher narrows to [`MIN_SWITCHER`], then the icon goes. In Safe
|
||||
/// Mode the label's width is taken first, and the switcher (also under Window › Workspace) goes when
|
||||
/// a minimal one does not fit.
|
||||
fn fit_right_group(w: &RightWidths) -> RightGroup {
|
||||
@@ -254,10 +288,12 @@ fn fit_right_group(w: &RightWidths) -> RightGroup {
|
||||
Search::Hidden => 0.0,
|
||||
};
|
||||
let switcher_w = w.switcher.min(room - 8.0 - search_w).max(MIN_SWITCHER);
|
||||
let learn_end = switcher_w + 8.0 + search_w + w.gap + w.icon;
|
||||
let learn = field && room >= learn_end;
|
||||
let arrange_end = switcher_w + 8.0 + search_w + w.gap + w.icon;
|
||||
let arrange = field && room >= arrange_end;
|
||||
let learn_end = arrange_end + w.gap + w.icon;
|
||||
let learn = arrange && room >= learn_end;
|
||||
let community = learn && room >= learn_end + 10.0 + w.gap + w.community;
|
||||
RightGroup { switcher, switcher_w, search, learn, community }
|
||||
RightGroup { switcher, switcher_w, search, arrange, learn, community }
|
||||
}
|
||||
|
||||
/// The app bar's search field: a button drawn as a field. The command palette's popup holds the
|
||||
|
||||
@@ -172,11 +172,11 @@ fn right_stage(g: &super::RightGroup) -> String {
|
||||
w if w > super::MIN_SWITCHER => "narrower switcher",
|
||||
_ => "minimal switcher",
|
||||
};
|
||||
format!("community {}, learn {}, {:?}, {switcher}", g.community, g.learn, g.search)
|
||||
format!("community {}, learn {}, arrange {}, {:?}, {switcher}", g.community, g.learn, g.arrange, g.search)
|
||||
}
|
||||
|
||||
/// As the app bar's room runs short, the community button goes first, then Explore tutorials, then the search
|
||||
/// field becomes the icon, then the workspace switcher narrows to its minimum, then the icon goes.
|
||||
/// As the app bar's room runs short, the community button goes first, then Explore tutorials, then Arrange
|
||||
/// Documents, then the search field becomes the icon, then the workspace switcher narrows to its minimum, then the icon goes.
|
||||
/// Whatever shows fits in the room, down to the minimal switcher alone.
|
||||
#[test]
|
||||
fn the_app_bar_gives_up_its_right_hand_controls_in_order() {
|
||||
@@ -193,31 +193,33 @@ fn the_app_bar_gives_up_its_right_hand_controls_in_order() {
|
||||
super::Search::Icon => w.gap + w.icon,
|
||||
super::Search::Hidden => 0.0,
|
||||
};
|
||||
let arrange = if g.arrange { w.gap + w.icon } else { 0.0 };
|
||||
let learn = if g.learn { w.gap + w.icon } else { 0.0 };
|
||||
let community = if g.community { 10.0 + w.gap + w.community } else { 0.0 };
|
||||
let used = g.switcher_w + 8.0 + search + learn + community;
|
||||
let used = g.switcher_w + 8.0 + search + arrange + learn + community;
|
||||
assert!(used <= room || g.switcher_w == super::MIN_SWITCHER && g.search == super::Search::Hidden, "{room}: {g:?} needs {used}");
|
||||
}
|
||||
assert_eq!(
|
||||
stages,
|
||||
[
|
||||
"community true, learn true, Field, full switcher",
|
||||
"community false, learn true, Field, full switcher",
|
||||
"community false, learn false, Field, full switcher",
|
||||
"community false, learn false, Icon, full switcher",
|
||||
"community false, learn false, Icon, narrower switcher",
|
||||
"community false, learn false, Icon, minimal switcher",
|
||||
"community true, learn true, arrange true, Field, full switcher",
|
||||
"community false, learn true, arrange true, Field, full switcher",
|
||||
"community false, learn false, arrange true, Field, full switcher",
|
||||
"community false, learn false, arrange false, Field, full switcher",
|
||||
"community false, learn false, arrange false, Icon, full switcher",
|
||||
"community false, learn false, arrange false, Icon, narrower switcher",
|
||||
"community false, learn false, arrange false, Icon, minimal switcher",
|
||||
// Once the icon has gone, the switcher takes the room it leaves.
|
||||
"community false, learn false, Hidden, narrower switcher",
|
||||
"community false, learn false, Hidden, minimal switcher",
|
||||
"community false, learn false, arrange false, Hidden, narrower switcher",
|
||||
"community false, learn false, arrange false, Hidden, minimal switcher",
|
||||
]
|
||||
);
|
||||
// In Safe Mode the label's width is taken first (not counted in `room`), and the switcher goes
|
||||
// when a minimal one does not fit.
|
||||
let safe = |room| right_stage(&super::fit_right_group(&right_widths(room, true)));
|
||||
assert_eq!(safe(700.0), "community true, learn true, Field, full switcher");
|
||||
assert_eq!(safe(72.0), "community false, learn false, Hidden, minimal switcher");
|
||||
assert_eq!(safe(71.0), "community false, learn false, Hidden, no switcher");
|
||||
assert_eq!(safe(700.0), "community true, learn true, arrange true, Field, full switcher");
|
||||
assert_eq!(safe(72.0), "community false, learn false, arrange false, Hidden, minimal switcher");
|
||||
assert_eq!(safe(71.0), "community false, learn false, arrange false, Hidden, no switcher");
|
||||
}
|
||||
|
||||
/// What screen readers call the app bar's search field, and the icon it becomes, before the shortcut.
|
||||
|
||||
@@ -275,11 +275,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,
|
||||
|
||||
@@ -259,7 +259,7 @@ fn tile_brings_floating_documents_back_into_the_grid() {
|
||||
frame(&mut app, &ctx, vec![]);
|
||||
let docs: Vec<usize> = 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<usize> = 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;
|
||||
|
||||
@@ -3902,6 +3902,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 Покриване на цели страници
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -710,6 +710,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
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5081,6 +5081,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
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -721,6 +721,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
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3371,6 +3371,13 @@ liquify-list-end {0}, {1} {0} og {1}
|
||||
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
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4001,6 +4001,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
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2280,6 +2280,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 Χρωματική απόχρωση περιγράμματος
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4053,6 +4053,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
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -712,6 +712,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
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -4038,6 +4038,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
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4126,6 +4126,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: ટાઇલ શ્રેણી:
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 72 and column 5.
|
@@ -5477,6 +5477,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… टाइल एज रंग…
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4746,6 +4746,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
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -669,6 +669,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
|
||||
|
||||
|
@@ -4103,6 +4103,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
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -757,6 +757,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 すべてのウィンドウを統合
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2842,6 +2842,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 ყველა ფანჯრის გაერთიანება
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -750,6 +750,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 모든 창 통합
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1242,6 +1242,13 @@ liquify-list-end {0}, {1} {0} en {1}
|
||||
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
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -678,6 +678,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
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3314,6 +3314,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:
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4082,6 +4082,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 Плитка целых страниц
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3967,6 +3967,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
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -565,6 +565,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() {
|
||||
|
||||
@@ -3824,6 +3824,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
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4096,6 +4096,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 Плитка цілих сторінок
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4466,6 +4466,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
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 206 and column 5.
|
@@ -3913,6 +3913,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 并排完整页面
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5250,6 +5250,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 並排完整頁面
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -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;
|
||||
|
||||
|
||||
@@ -673,7 +673,7 @@ fn run_ui_part6(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Result<
|
||||
},
|
||||
"window.newWindow" => 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),
|
||||
|
||||
@@ -99,6 +99,8 @@ pub fn checked(app: &VectorcraftApp, id: &str, p: &Value) -> Option<bool> {
|
||||
}
|
||||
"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),
|
||||
|
||||
@@ -655,16 +655,16 @@ pub fn menu_tree_named(english_names: bool) -> Vec<(&'static str, Vec<Item>)> {
|
||||
("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"),
|
||||
@@ -781,6 +781,27 @@ pub(super) fn transform_items() -> Vec<Item> {
|
||||
]
|
||||
}
|
||||
|
||||
/// Window → Arrange's Tile layouts, one `window.arrange.tile` `layout` each (also under the
|
||||
/// application bar's Arrange Documents button).
|
||||
fn tile_items() -> Vec<Item> {
|
||||
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<Item> {
|
||||
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<Item> {
|
||||
vec![
|
||||
|
||||
@@ -804,7 +804,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",
|
||||
|
||||
@@ -606,6 +606,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.
|
||||
@@ -1224,6 +1228,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,
|
||||
|
||||
+16
-9
@@ -7600,15 +7600,22 @@ 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 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
|
||||
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 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
|
||||
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
|
||||
|
||||
@@ -796,6 +796,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`.
|
||||
|
||||
Reference in New Issue
Block a user