DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge origin/main into codex/new-document-dialog
moppeeer1062d3951158
diff --cc ROADMAP.mdindex b2745f321,d60a6bf49..4acfae586--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -178,13 -438,16 +438,20 @@@ Newest first- **2026-10-12** · The Effects panel shows the level its settings apply to ("Group: Color Dodge 100%") and, as in InDesign, Isolate Blending and Knockout Group for a selected group. No readiness percentage change.- **2026-10-11** · Properties gains InDesign's Pathfinder section (Add, Subtract, Intersect, Exclude Overlap, Minus Back) with several objects selected; section titles and icon buttons have accessible names. No readiness percentage change.- **2026-10-12** · The Eyedropper samples a placed image: clicking the photo with text (or objects) selected fills them with the image's colour under the pointer, as an unnamed colour (`color.sample`), as in InDesign. Images on locked layers can be sampled. No readiness percentage change.+- **2026-10-11** · New Document laid out like InDesign's (#325): Recent, Saved, Print, Web and+ Mobile preset tabs beside the preset's details; saved document presets live in the engine+ (`file.savePreset`, `file.deletePreset`, `file.new {preset}`); `file.new` takes intent, units,+ start page and per-edge bleed and slug.+ - **2026-10-12** · The section marker character shows its section's marker text on document pages (nothing when the section has none) instead of the word "Section", which stays on parent pages; editing the marker recomposes (#556). No readiness percentage change.+ - **2026-10-12** · On screen, blend modes blend with the objects below and not with the paper, as in InDesign and in PDF export: a Color Dodge or Screen object over blank paper shows as it is. No readiness percentage change.+ - **2026-10-12** · A gradient feather on a group fades the group as one, on screen and in PDF. Before, the screen ignored it, and PDF masked the group with a box of zero size because a group has no path of its own. No readiness percentage change.+ - **2026-10-12** · In a CMYK transparency blend space (print documents), blend modes blend in CMYK on screen as in InDesign. Color Dodge with 100% K text turns coloured areas under it white and leaves the paper alone, where RGB blending changed almost nothing. PDF export already did this. No readiness percentage change.+ - **2026-10-11** · Moving a sheared and rotated text frame no longer leaves trails of text behind: canvas repaints cover the frame's whole text box, not just its outline. No readiness percentage change.- **2026-10-12** · Words in capitals hyphenate like capitalized words (FERRUM COM-MODI), as in InDesign; Hyphenate Capitalized Words off keeps them whole. No readiness percentage change.+ - **2026-10-12** · Load Swatches refuses an `.ase` file with more than 100,000 colors, and `swatch.load` merges a file of 100,000 colors in under 0.1 s (it took 9.6 s of CPU in a test build). No readiness percentage change.- **2026-10-11** · `transform.move {copy}`, Edit › Duplicate and Step and Repeat return the copies' ids, so a script can go on with them. No readiness percentage change.- **2026-10-11** · `object.fill` and `object.stroke` refuse a swatch name the document doesn't have (it painted nothing) and suggest the name meant (`Paper` → `[Paper]`). No readiness percentage change.+ - **2026-10-13** · Dropping an `.ase` file on the window loads its swatches, as Load Swatches does (the drop failed with "Can't Place the File"). No readiness percentage change.- **2026-10-11 (printing):** `file.printers` and `file.print` use craft-libs/craft-print for CUPS and Windows. DesignCraft retains PDF export, page selection, spreads, marks and bleed; dry runs create no temporary PDF or print job. Windows selects matching or default driver paper and shrinks oversized sheets without enlarging smaller ones; queue duplex defaults are preserved. Headless tests exercise exported bytes, job settings, dry runs and refusals; shared native Windows CI passes, including paused-queue submission and cleanup. PostScript, production print controls and physical output validation remain open. No readiness percentage change.- **2026-10-10 (UI.4–UI.5):** Panel tabs can move into other groups, split the dock, float, resize and return to their saved locations through shared docking transactions. Layouts persist in custom workspaces; UI and control commands share the same validated action path. Shared pane geometry and widget-state theme application retain all five palettes and local fonts. Split panes send keyboard input only to the focused canvas and scope contextual toolbar IDs per pane. No readiness percentage change.diff --cc crates/engine/src/lib.rsindex 61ee1d506,745e45647..3deede35c--- a/crates/engine/src/lib.rs+++ b/crates/engine/src/lib.rs@@@ -201,8 -213,9 +213,11 @@@ pub struct Prefspub show_note_anchors: bool,/// Preferences › File Handling: minutes between document recovery saves.pub recovery_minutes: f64,+ /// File › New › Document › Save Document Preset: saved document presets, by name (`title`).+ pub document_presets: Vec<designcraft_doc::build::NewDocument>,+ /// Preferences › File Handling › Create Links When Placing Text Files: placed text files are+ /// linked (Links panel) unless `file.place` says otherwise.+ pub link_text_files: bool,}/// A starter autocorrect list (common English typing slips).diff --cc crates/ui-egui/src/dialogs.rsindex 1953e87d2,7d02776a2..357cfa4a4--- a/crates/ui-egui/src/dialogs.rs+++ b/crates/ui-egui/src/dialogs.rs@@@ -1170,8 -1537,8 +1537,8 @@@ pub fn show(app: &mut DesignApp, ctx: &let available = (ctx.content_rect().size() - frame_margin - egui::vec2(16.0, 16.0)).max(egui::Vec2::splat(1.0));let preferred_width: f32 = match d.id.as_str() {"alert" => 440.0,- "closeDocument" => 380.0,+ "closeDocument" | "updateLink" => 380.0,- "newDocument" if crate::i18n::is_rtl(&app.ui.language) => 380.0,+ "newDocument" => 960.0,_ => 640.0,};let width = preferred_width.min(available.x);@@@ -1741,11 -2203,10 +2127,12 @@@});ui.add_space(12.0);let ok_label = match d.id.as_str() {- "closeDocument" => " Save ",- "updateLink" => " Update ",- _ => " OK ",+ "closeDocument" => crate::i18n::tr(&app.ui.language, " Save ").to_string(),++ "updateLink" => crate::i18n::tr(&app.ui.language, " Update ").to_string(),+ "newDocument" => format!(" {} ", crate::i18n::tr(&app.ui.language, "Create")),+ _ => crate::i18n::tr(&app.ui.language, " OK ").to_string(),};+ let cancel_label = if d.id == "newDocument" { "Close" } else { "Cancel" };ui.horizontal(|ui| {ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {if ui@@@ -1810,13 -2274,30 +2197,29 @@@ pub fn confirm(app: &mut DesignApp) ->app.cancel_pdf_import();}match d.id.as_str() {+ "createGuides" | "marginsAndColumns" => {+ // The preview goes; the change is made once, as one undo step.+ if d.fields.contains_key(PREVIEWED) {+ app.session.cancel_interaction();+ }+ let cmd = if d.id == "createGuides" { "layout.createGuides" } else { "layout.marginsAndColumns" };+ let r = layout_dialog_params(&d).and_then(|p| app.run(cmd, p));+ if let Err(e) = &r {+ // A value that does not parse, or a refused one, keeps the dialog open to be fixed.+ let mut d = d.clone();+ d.fields.remove(PREVIEWED);+ d.fields.insert("status".into(), json!(e));+ app.ui.dialog = Some(d);+ }+ r+ }"newDocument" => {- let margins = json!({"top": d.m("marginTop").unwrap_or(36.0), "bottom": d.m("marginBottom").unwrap_or(36.0), "inside": d.m("marginInside").unwrap_or(36.0), "outside": d.m("marginOutside").unwrap_or(36.0)});- app.run(- "file.new",- json!({"width": d.m("width"), "height": d.m("height"), "pages": d.n("pages").unwrap_or(1.0) as u64, "facingPages": d.b("facingPages"),- "columns": d.n("columns").unwrap_or(1.0) as u64, "gutter": d.m("gutter").unwrap_or(12.0), "margins": margins, "bleed": d.m("bleed").unwrap_or(0.0),- "primaryTextFrame": d.b("primaryTextFrame")}),- )+ let p = crate::new_document::params(&d);+ let r = app.run("file.new", p.clone());+ if r.is_ok() {+ crate::new_document::remember(app, &p);+ }+ r}"frameSize" => {let x = d.fields.get("x").and_then(Value::as_f64).unwrap_or(0.0);diff --cc crates/ui-egui/src/icons.rsindex 57e6645fa,d123f89d3..c814f1253--- a/crates/ui-egui/src/icons.rs+++ b/crates/ui-egui/src/icons.rs@@@ -550,16 -564,145 +564,154 @@@ pub fn paint(p: &Painter, r: Rect, name}}}+ // Flex Layout panel (original drawings): direction arrows, wrap, justification, spacing.+ "flex-right" | "flex-left" | "flex-down" | "flex-up" => {+ let pts: [(f32, f32); 5] = match name {+ "flex-right" => [(3.0, 10.0), (16.0, 10.0), (11.5, 6.0), (16.0, 10.0), (11.5, 14.0)],+ "flex-left" => [(17.0, 10.0), (4.0, 10.0), (8.5, 6.0), (4.0, 10.0), (8.5, 14.0)],+ "flex-down" => [(10.0, 3.0), (10.0, 16.0), (6.0, 11.5), (10.0, 16.0), (14.0, 11.5)],+ _ => [(10.0, 17.0), (10.0, 4.0), (6.0, 8.5), (10.0, 4.0), (14.0, 8.5)],+ };+ pen.line(&pts[..2]);+ pen.line(&pts[2..]);+ }+ "flex-wrap" => {+ pen.line(&[(16.0, 4.0), (16.0, 12.0), (5.0, 12.0)]);+ pen.line(&[(8.5, 8.5), (5.0, 12.0), (8.5, 15.5)]);+ }+ "flex-start" | "flex-center" | "flex-end" | "flex-between" | "flex-around" | "flex-evenly" => {+ // Three bars in a box, where the justification puts them.+ pen.rect(1.5, 6.0, 18.5, 14.0);+ let xs: [f32; 3] = match name {+ "flex-start" => [3.0, 6.0, 9.0],+ "flex-center" => [6.5, 9.5, 12.5],+ "flex-end" => [10.0, 13.0, 16.0],+ "flex-between" => [3.0, 9.5, 16.0],+ "flex-around" => [4.5, 9.5, 14.5],+ _ => [5.0, 9.5, 14.0],+ };+ for x in xs {+ pen.frect(x, 7.5, x + 1.8, 12.5);+ }+ }+ "gap-h" => {+ pen.line(&[(3.0, 4.0), (3.0, 16.0)]);+ pen.line(&[(17.0, 4.0), (17.0, 16.0)]);+ pen.line(&[(5.5, 10.0), (14.5, 10.0)]);+ pen.line(&[(8.0, 7.5), (5.5, 10.0), (8.0, 12.5)]);+ pen.line(&[(12.0, 7.5), (14.5, 10.0), (12.0, 12.5)]);+ }+ "gap-v" => {+ pen.line(&[(4.0, 3.0), (16.0, 3.0)]);+ pen.line(&[(4.0, 17.0), (16.0, 17.0)]);+ pen.line(&[(10.0, 5.5), (10.0, 14.5)]);+ pen.line(&[(7.5, 8.0), (10.0, 5.5), (12.5, 8.0)]);+ pen.line(&[(7.5, 12.0), (10.0, 14.5), (12.5, 12.0)]);+ }+ "panel-flex" => {+ pen.rect(2.5, 3.5, 17.5, 16.5);+ pen.frect(5.0, 6.0, 8.5, 14.0);+ pen.frect(11.5, 6.0, 15.0, 14.0);+ pen.line(&[(8.5, 10.0), (11.5, 10.0)]);+ }+ // Pathfinder panel › Paths: a join point, a path opened and one closed, two opposed arrows.+ "path-join" => {+ pen.line(&[(3.0, 16.0), (5.0, 12.0), (10.0, 10.0)]);+ pen.line(&[(10.0, 10.0), (15.0, 8.0), (17.0, 4.0)]);+ pen.fcircle(10.0, 10.0, 2.2);+ }+ "path-open" | "path-close" => {+ let gap = if name == "path-open" { 0.9 } else { 0.0 };+ let n = 28;+ let pts: Vec<(f32, f32)> = (0..=n)+ .map(|i| {+ let a = -std::f32::consts::FRAC_PI_2 + gap / 2.0 + (std::f32::consts::TAU - gap) * i as f32 / n as f32;+ (10.0 + 6.5 * a.cos(), 10.5 + 6.5 * a.sin())+ })+ .collect();+ pen.line(&pts);+ if name == "path-open" {+ pen.frect(11.0, 2.5, 14.0, 5.5);+ pen.frect(6.0, 2.5, 9.0, 5.5);+ } else {+ pen.fcircle(10.0, 4.0, 1.8);+ }+ }+ "path-reverse" => {+ pen.line(&[(3.0, 7.0), (16.0, 7.0)]);+ pen.line(&[(13.0, 4.0), (16.5, 7.0), (13.0, 10.0)]);+ pen.line(&[(17.0, 13.0), (4.0, 13.0)]);+ pen.line(&[(7.0, 10.0), (3.5, 13.0), (7.0, 16.0)]);+ }+ // Pathfinder panel › Convert Shape: the shape outlined.+ "shape-rect" => pen.rect(3.0, 5.0, 17.0, 15.0),+ "shape-rounded" | "shape-beveled" | "shape-inverse" => {+ let (x0, y0, x1, y1, r): (f32, f32, f32, f32, f32) = (3.0, 5.0, 17.0, 15.0, 3.5);+ // Clockwise from the top left: each corner's two ends, and the centre of its arc+ // (inside for a rounded corner, the corner itself for an inverse rounded one).+ let corners = [+ ((x0, y0), (x0, y0 + r), (x0 + r, y0), (x0 + r, y0 + r)),+ ((x1, y0), (x1 - r, y0), (x1, y0 + r), (x1 - r, y0 + r)),+ ((x1, y1), (x1, y1 - r), (x1 - r, y1), (x1 - r, y1 - r)),+ ((x0, y1), (x0 + r, y1), (x0, y1 - r), (x0 + r, y1 - r)),+ ];+ let mut pts = Vec::new();+ for (corner, a, b, inner) in corners {+ if name == "shape-beveled" {+ pts.extend([a, b]);+ continue;+ }+ let c = if name == "shape-inverse" { corner } else { inner };+ let a0 = (a.1 - c.1).atan2(a.0 - c.0);+ let mut d = (b.1 - c.1).atan2(b.0 - c.0) - a0;+ if d > std::f32::consts::PI {+ d -= std::f32::consts::TAU;+ } else if d < -std::f32::consts::PI {+ d += std::f32::consts::TAU;+ }+ pts.extend((0..=6).map(|k| {+ let t = a0 + d * k as f32 / 6.0;+ (c.0 + r * t.cos(), c.1 + r * t.sin())+ }));+ }+ pen.closed(&pts);+ }+ "shape-ellipse" => pen.ellipse(10.0, 10.0, 7.5, 5.0),+ "shape-triangle" => pen.closed(&[(10.0, 3.5), (17.0, 16.0), (3.0, 16.0)]),+ "shape-polygon" => pen.closed(&[(6.5, 4.0), (13.5, 4.0), (17.0, 10.0), (13.5, 16.0), (6.5, 16.0), (3.0, 10.0)]),+ "shape-line" => pen.line(&[(4.0, 16.0), (16.0, 4.0)]),+ "shape-orthogonal" => {+ pen.line(&[(10.0, 3.0), (10.0, 17.0)]);+ pen.line(&[(3.0, 10.0), (17.0, 10.0)]);+ }+ // Pathfinder panel › Convert Point: a point on a path, with its direction handles.+ "point-plain" | "point-corner" | "point-smooth" | "point-symmetrical" => {+ match name {+ "point-plain" | "point-corner" => pen.line(&[(3.0, 16.0), (10.0, 8.0), (17.0, 16.0)]),+ _ => pen.line(&[(3.0, 16.0), (5.5, 11.5), (10.0, 8.0), (14.5, 11.5), (17.0, 16.0)]),+ }+ let handles: &[(f32, f32)] = match name {+ "point-corner" => &[(4.5, 4.0), (16.0, 5.0)],+ "point-smooth" => &[(5.0, 8.0), (17.5, 8.0)],+ "point-symmetrical" => &[(4.0, 8.0), (16.0, 8.0)],+ _ => &[],+ };+ for &(hx, hy) in handles {+ pen.line(&[(10.0, 8.0), (hx, hy)]);+ pen.fcircle(hx, hy, 1.4);+ }+ pen.frect(8.5, 6.5, 11.5, 9.5);+ }// ---- Properties panel glyphs (original drawings)+ "clock" => {+ pen.circle(10.0, 10.0, 7.5);+ pen.line(&[(10.0, 5.5), (10.0, 10.0), (13.5, 12.5)]);+ }+ "preset-save" => {+ pen.line(&[(3.0, 11.0), (3.0, 17.0), (17.0, 17.0), (17.0, 11.0)]);+ pen.line(&[(10.0, 3.0), (10.0, 13.0)]);+ pen.line(&[(6.5, 9.5), (10.0, 13.0), (13.5, 9.5)]);+ }"orient-portrait" => {pen.rect(5.5, 3.0, 14.5, 17.0);pen.fcircle(10.0, 8.0, 1.8);diff --cc crates/ui-egui/src/lib.rsindex ade1dfe27,59c7ebb59..a8c0a500d--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@@ -16,7 -17,7 +17,8 @@@ pub mod dockpub mod i18n;pub mod icons;pub mod menus;+ mod modal_drag;+mod new_document;mod panel_docking;pub mod panels;mod prefs;diff --cc docs/target-app-parity.mdindex 1d739a683,62ba7f08a..e21e1b447--- a/docs/target-app-parity.md+++ b/docs/target-app-parity.md@@@ -424,8 -428,7 +428,8 @@@ It is evidence of breadth: each item ex- View › Display Performance: Fast (grey boxes, no effects, ⌥⇧⌘Z), Typical (72 ppi proxies, ⌥⌘Z), High Quality (⌥⌘H, our default — the renderer is fast enough).- OpenType menu (Character panel): discretionary ligatures, fractions, ordinal, swash, titling, contextual alternates, slashed zero, the four figure styles and stylistic sets 1–20; `type.openType`; mapped to IDML's OTF attributes.- Add Anchor Point (=), Delete Anchor Point (-) and Convert Direction Point (⇧C) tools (click toggles smooth/corner, drag pulls out handles), with `path.addAnchor`, `path.deleteAnchor`, `path.convertAnchor`.- - Gradients: the Gradient Swatch tool (G) drags a gradient's start and end across objects (Shift: 45°); the Gradient panel sets type, angle, reverse and edits stops on a ramp (drag, add, drag off to remove, location, colour). Edited gradients are unnamed swatches; `object.gradient`; the vector round-trips through IDML.+ - Gradients: the Gradient Swatch tool (G) drags a gradient's start and end across objects (Shift: 45°); the Gradient panel sets type, angle, reverse and edits stops on a ramp (drag, add, drag off to remove, location, colour). Edited gradients are unnamed swatches; `object.gradient` (`target: stroke` for a stroke's gradient, drawn across the path's box on screen and in PDF); the vector round-trips through IDML (`GradientFill…`/`GradientStroke…`). The Gradient panel follows the Fill/Stroke proxy. A radial gradient stretches with the object's box as InDesign's does (an ellipse reaching the sides of a non-square frame, on screen and in PDF). Text takes a gradient swatch as its fill or stroke, laid across its frame's box as in InDesign (screen and PDF).+- New Document (⌘N) as in InDesign: Recent, Saved, Print, Web and Mobile tabs of page cards (double-click creates) beside the preset's details: document name, size with arrows, units, orientation, pages, start page #, facing pages, primary text frame, columns, margins, bleed and slug per edge (linked or not); Save Document Preset (`file.savePreset`, `file.deletePreset`; saved presets are kept with the preferences, listed by `file.presets` and made by `file.new {preset: name}`); `file.new` takes `intent`, `units`, `startPage` and per-edge `bleed`/`slug`.- Document Setup (⌥⌘P): intent, number of pages, start page # (an even start begins with a left page), facing pages, size presets and orientation, bleed and slug per edge; `layout.documentSetup {}` reports the setup.- Stroke panel: cap, join, miter limit, alignment, type, Start/End arrowheads (12 kinds, drawn on screen and in PDF; the path is shortened under pointed heads) and gap colour under dashes and dots.- Preferences (⌘K: General, Type, Units & Increments, Grids, Guides & Pasteboard, Display Performance) backed by `prefs.set` (application) and `document.preferences` (units, increments, grids — undoable, saved with the document; right-click a ruler to pick its units, the horizontal and vertical rulers each have their own); scaling applies to content and scales stroke weights (Include Stroke Weight), and X/Y/W/H measure the stroke's outer edge (Dimensions Include Stroke Weight). Quick Apply (⌘Return) finds paragraph, character and object styles as well as commands.