DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge branch 'pr/575' into batch1
Brandon Thomas99c229486d4e
diff --cc ROADMAP.mdindex 1e0fcdc21,2dbfe0ef0..ac0fbcf7a--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -141,15 -132,7 +141,16 @@@ Newest first- **2026-10-12** · Window close and application/menu Quit ask about unsaved documents; later Cancel keeps every tab open, including earlier Don't Save choices. Approvals are rechecked after edits. Cancelable macOS Dock Quit remains open (#544). No readiness percentage change.- **2026-10-12** · Each running app keeps recovery data in its own locked folder; current folder and lock ownership are checked before writes and cleanup. Failed isolation disables recovery with a warning instead of sharing document IDs. No readiness percentage change.- **2026-10-12** · Native engine saves and exports replace files atomically; failed writes retain the original, private staging preserves Unix permissions, and valid long filenames work. Desktop Services and CLI raster exports remain separate follow-ups. No readiness percentage change.+- **2026-10-12** · Hyphenation Zone applies to the Single-line Composer only, as in InDesign. With the default Paragraph Composer, ragged text hyphenates where InDesign does (aper-natem), giving the same line breaks. No readiness percentage change.+- **2026-10-12** · The Tools panel's Fill/Stroke keys work: D (default fill and stroke), X (fill or stroke in front), Shift+X (swap per object, tints included) and / (Apply None), as `color.*` commands; swap and default are one undo step (`object.swapFillStroke`, `object.defaultFillStroke`); the Color panel follows the proxy's fill/stroke choice. No readiness percentage change.+- **2026-10-11** · Corner Options keep curved sides curved and round every corner point, including where an arc meets a line (a Pathfinder quarter circle with rounded corners stayed a triangle). No readiness percentage change.+- **2026-10-11** · `story.replaceRange`, `story.setText`, notes, footnotes, endnotes, type on a path and table cells read `\r` and `\r\n` as paragraph returns, as `frame.create` and `text.insert` already did. No readiness percentage change.+- **2026-10-11** · The View menu follows InDesign's: proofing first, then zoom, Rotate Spread, Screen Mode, Display Performance, rulers, Extras, Grids & Guides and Structure; the view items that sat at the end of the Type menu moved there. No readiness percentage change.+- **2026-10-12** · Underlines and strikethroughs are drawn as one bar per stretch of text on screen, as in PDF export: a bar per letter left faint seams between the letters. No readiness percentage change.+- **2026-10-12** · Properties › Transform shows rotation, shear and X/Y scale, and Rotate 90° and Flip Horizontal/Vertical buttons, as InDesign's does. No readiness percentage change.+- **2026-10-12** · Edit › Step and Repeat has its InDesign dialog: Repeat (Count, or Rows and Columns with Create as a grid), Offset (Vertical, Horizontal, in ruler units) and Preview, which shows the copies while the dialog is open; Cancel takes them away and OK makes them as one undo step. No readiness percentage change.+- **2026-10-12** · Double-clicking the Fill or Stroke box in the Tools panel opens the Color Picker with the selection's colour, as in InDesign (it opened the Swatches panel). No readiness percentage change.+ - **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-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-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.diff --cc crates/ui-egui/src/i18n.rsindex 6893eb54b,62c92553a..718e740bf--- a/crates/ui-egui/src/i18n.rs+++ b/crates/ui-egui/src/i18n.rs@@@ -750,14 -739,10 +750,18 @@@ const TABLE: &[(&str, [&str; 5])] = &),("Apply Cell Style", ["Apply Cell Style", "Apply Cell Style", "Apply Cell Style", "Apply Cell Style", "应用单元格样式"]),("Apply Color", ["Apply Color", "Apply Color", "Apply Color", "Apply Color", "应用颜色"]),+ ("Repeat", ["Wiederholen", "Répéter", "Repetir", "繰り返し", "重复"]),+ ("Count:", ["Anzahl:", "Nombre :", "Recuento:", "繰り返し数:", "计数:"]),+ ("Create as a grid", ["Als Raster erstellen", "Créer en tant que grille", "Crear como cuadrícula", "グリッドとして作成", "创建为网格"]),+ ("Rows:", ["Zeilen:", "Rangées :", "Filas:", "行:", "行:"]),+ ("Columns:", ["Spalten:", "Colonnes :", "Columnas:", "列:", "列:"]),+ ("Vertical:", ["Vertikal:", "Vertical :", "Vertical:", "垂直方向:", "垂直:"]),+ ("Horizontal:", ["Horizontal:", "Horizontal :", "Horizontal:", "水平方向:", "水平:"]),+ ("Invalid value", ["Ungültiger Wert", "Valeur non valide", "Valor no válido", "無効な値", "无效值"]),+ ("Isolate Blending", ["Füllmethode isolieren", "Isoler le mode de fusion", "Aislar fusión", "描画モードを分離", "分离混合"]),+ ("Knockout Group", ["Aussparungsgruppe", "Groupe de masquage", "Grupo de exclusión", "グループの抜き", "挖空组"]),+ ("Object:", ["Objekt:", "Objet :", "Objeto:", "オブジェクト:", "对象:"]),+ ("Group:", ["Gruppe:", "Groupe :", "Grupo:", "グループ:", "编组:"]),("Apply Condition", ["Apply Condition", "Apply Condition", "Apply Condition", "Apply Condition", "应用条件"]),("Apply Parent to Pages…",diff --cc crates/ui-egui/src/i18n/ar.rsindex 3cdc44a16,9e37dfdb1..74b724c92--- a/crates/ui-egui/src/i18n/ar.rs+++ b/crates/ui-egui/src/i18n/ar.rs@@@ -1046,14 -1041,10 +1046,18 @@@ pub(super) const TABLE: &[(&str, &str)("Formatting affects container (J)", "تطبيق التنسيق على الحاوية (J)"),("Formatting affects text (J)", "تطبيق التنسيق على النص (J)"),("Apply Color", "تطبيق اللون"),+ ("Repeat", "تكرار"),+ ("Count:", "العدد:"),+ ("Create as a grid", "إنشاء كشبكة"),+ ("Rows:", "الصفوف:"),+ ("Columns:", "الأعمدة:"),+ ("Vertical:", "رأسي:"),+ ("Horizontal:", "أفقي:"),+ ("Invalid value", "قيمة غير صالحة"),+ ("Isolate Blending", "عزل المزج"),+ ("Knockout Group", "مجموعة مفرغة"),+ ("Object:", "الكائن:"),+ ("Group:", "المجموعة:"),("Apply None", "إزالة اللون"),("Height Only", "الارتفاع فقط"),("Width Only", "العرض فقط"),diff --cc crates/ui-egui/src/i18n/it.rsindex 9ffc64cf8,b14398d16..77a632e11--- a/crates/ui-egui/src/i18n/it.rs+++ b/crates/ui-egui/src/i18n/it.rs@@@ -417,14 -412,10 +417,18 @@@ pub(super) const TABLE: &[(&str, &str)("Apply Attributes (Eyedropper)", "Applica attributi (Contagocce)"),("Apply Cell Style", "Applica stile di cella"),("Apply Color", "Applica colore"),+ ("Repeat", "Ripeti"),+ ("Count:", "Conteggio:"),+ ("Create as a grid", "Crea come griglia"),+ ("Rows:", "Righe:"),+ ("Columns:", "Colonne:"),+ ("Vertical:", "Verticale:"),+ ("Horizontal:", "Orizzontale:"),+ ("Invalid value", "Valore non valido"),+ ("Isolate Blending", "Isola fusione"),+ ("Knockout Group", "Gruppo di foratura"),+ ("Object:", "Oggetto:"),+ ("Group:", "Gruppo:"),("Apply Condition", "Applica condizione"),("Apply Parent to Pages…", "Applica pagina mastro alle pagine…"),("ArtCraft App Page…", "Pagina dell'app ArtCraft…"),diff --cc crates/ui-egui/src/i18n/ja.rsindex 01c72ce53,a90da290f..056bf0232--- a/crates/ui-egui/src/i18n/ja.rs+++ b/crates/ui-egui/src/i18n/ja.rs@@@ -419,11 -414,10 +419,15 @@@ pub(super) const TABLE: &[(&str, &str)("Apply Attributes (Eyedropper)", "属性を適用 (スポイト)"),("Apply Cell Style", "セルスタイルを適用"),("Apply Color", "カラーを適用"),+ ("Repeat", "繰り返し"),+ ("Count:", "繰り返し数:"),+ ("Create as a grid", "グリッドとして作成"),+ ("Rows:", "行:"),+ ("Invalid value", "無効な値"),+ ("Isolate Blending", "描画モードを分離"),+ ("Knockout Group", "グループの抜き"),+ ("Object:", "オブジェクト:"),+ ("Group:", "グループ:"),("Apply Condition", "条件を適用"),("Apply Parent to Pages…", "ページに親ページを適用…"),("ArtCraft App Page…", "ArtCraft アプリページ…"),diff --cc crates/ui-egui/src/i18n/pt_br.rsindex 25b7269b2,ee51a3916..325d4415f--- a/crates/ui-egui/src/i18n/pt_br.rs+++ b/crates/ui-egui/src/i18n/pt_br.rs@@@ -1050,14 -1045,10 +1050,18 @@@ pub(super) const TABLE: &[(&str, &str)("Formatting affects container (J)", "Formatação afeta o contêiner (J)"),("Formatting affects text (J)", "Formatação afeta o texto (J)"),("Apply Color", "Aplicar cor"),+ ("Repeat", "Repetir"),+ ("Count:", "Contagem:"),+ ("Create as a grid", "Criar como grade"),+ ("Rows:", "Linhas:"),+ ("Columns:", "Colunas:"),+ ("Vertical:", "Vertical:"),+ ("Horizontal:", "Horizontal:"),+ ("Invalid value", "Valor inválido"),+ ("Isolate Blending", "Isolar mesclagem"),+ ("Knockout Group", "Grupo de vazamento"),+ ("Object:", "Objeto:"),+ ("Group:", "Grupo:"),("Apply None", "Aplicar nenhum"),("Height Only", "Somente altura"),("Width Only", "Somente largura"),diff --cc crates/ui-egui/src/i18n/uk.rsindex 4158c2f47,0314ee403..cd000bf3c--- a/crates/ui-egui/src/i18n/uk.rs+++ b/crates/ui-egui/src/i18n/uk.rs@@@ -420,14 -415,10 +420,18 @@@ pub(super) const TABLE: &[(&str, &str)("Apply Attributes (Eyedropper)", "Застосувати атрибути (піпетка)"),("Apply Cell Style", "Застосувати стиль клітинки"),("Apply Color", "Застосувати колір"),+ ("Repeat", "Повторення"),+ ("Count:", "Кількість:"),+ ("Create as a grid", "Створити як сітку"),+ ("Rows:", "Рядки:"),+ ("Columns:", "Стовпці:"),+ ("Vertical:", "Вертикально:"),+ ("Horizontal:", "Горизонтально:"),+ ("Invalid value", "Неприпустиме значення"),+ ("Isolate Blending", "Ізолювати змішування"),+ ("Knockout Group", "Група вибивання"),+ ("Object:", "Об’єкт:"),+ ("Group:", "Група:"),("Apply Condition", "Застосувати умову"),("Apply Parent to Pages…", "Застосувати шаблон до сторінок…"),("ArtCraft App Page…", "Сторінка програми ArtCraft…"),diff --cc crates/ui-egui/src/panels/properties.rsindex 17473fba0,6ef2de8a7..d48ac6e91--- a/crates/ui-egui/src/panels/properties.rs+++ b/crates/ui-egui/src/panels/properties.rs@@@ -2258,44 -2228,95 +2279,135 @@@ mod testslet after = h.state().session.active().unwrap().doc.item(designcraft_doc::ids::ItemId(id)).unwrap().fill.swatch.clone();assert_eq!(after, name, "clicking the swatch chip applies it");}++ #[test]+ fn transform_flips_and_rotates_from_properties() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({})).unwrap();+ let id = app.run("frame.create", json!({"rect": [72, 72, 300, 200]})).unwrap()["id"].as_u64().unwrap();+ app.run("selection.set", json!({"ids": [id]})).unwrap();+ let mut h = Harness::builder().with_size(vec2(320.0, 1400.0)).build_ui_state(+ |ui, app: &mut DesignApp| {+ let id = egui::Id::new("test_fonts");+ if ui.data(|d| d.get_temp::<bool>(id)).is_none() {+ crate::theme::install_fonts(ui.ctx(), "");+ ui.data_mut(|d| d.insert_temp(id, true));+ return;+ }+ show(app, ui);+ },+ app,+ );+ h.run_steps(3);+ let xf = |h: &Harness<'_, DesignApp>| h.state().session.active().unwrap().doc.item(designcraft_doc::ids::ItemId(id)).unwrap().xf;+ // Flip Horizontal mirrors the frame (a negative determinant); Flip Vertical as well brings it+ // back to a half turn, as in the tutorial's petal.+ h.get_by_label("Flip Horizontal").click();+ h.run_steps(3);+ assert!(xf(&h).determinant() < 0.0, "{:?}", xf(&h));+ h.get_by_label("Flip Vertical").click();+ h.run_steps(3);+ let c = xf(&h).as_coeffs();+ assert!((c[0] + 1.0).abs() < 1e-9 && (c[3] + 1.0).abs() < 1e-9, "a half turn: {c:?}");+ let info = h.state_mut().session.execute("transform.info", &json!({})).unwrap();+ assert!((info["rotation"].as_f64().unwrap().abs() - 180.0).abs() < 1e-6, "{info}");+ // A quarter turn clockwise from there.+ h.get_by_label("Rotate 90° Clockwise").click();+ h.run_steps(3);+ let info = h.state_mut().session.execute("transform.info", &json!({})).unwrap();+ assert!((info["rotation"].as_f64().unwrap() - 90.0).abs() < 1e-6, "{info}");+ // The angle and scale fields are there.+ assert!(h.query_by(|n| n.role() == egui::accesskit::Role::TextInput && n.value().as_deref() == Some("90°")).is_some());+ }}++ #[cfg(test)]+ mod effects_panel_tests {+ use super::*;++ /// One frame of the Effects panel: the text painted and where.+ fn frame(app: &mut DesignApp, ctx: &egui::Context, events: Vec<egui::Event>) -> Vec<(String, egui::Rect)> {+ let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, vec2(320.0, 400.0));+ let time = ctx.input(|i| i.time) + 1.0 / 60.0;+ let mut out =+ ctx.run_ui(egui::RawInput { screen_rect: Some(screen), time: Some(time), events, ..Default::default() }, |ui| effects_panel(app, ui));+ out.textures_delta.clear();+ let mut v = Vec::new();+ for s in out.shapes {+ if let egui::Shape::Text(t) = s.shape {+ v.push((t.galley.job.text.clone(), t.visual_bounding_rect()));+ }+ }+ v+ }++ fn click(app: &mut DesignApp, ctx: &egui::Context, label: &str) {+ let labels = frame(app, ctx, vec![]);+ let pos = labels.iter().find(|(t, _)| t == label).unwrap_or_else(|| panic!("{label} is painted")).1.center();+ for pressed in [true, false] {+ frame(+ app,+ ctx,+ vec![+ egui::Event::PointerMoved(pos),+ egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE },+ ],+ );+ }+ }++ #[test]+ fn the_effects_panel_shows_the_level_and_isolate_blending_and_knockout_group_for_groups() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), Default::default());+ app.run("file.new", json!({})).unwrap();+ let a = app.run("frame.create", json!({"rect": [72, 72, 144, 144]})).unwrap()["id"].as_u64().unwrap();+ let b = app.run("frame.create", json!({"rect": [100, 100, 200, 200]})).unwrap()["id"].as_u64().unwrap();+ let g = app.run("object.group", json!({"ids": [a, b]})).unwrap()["id"].as_u64().unwrap();+ app.run("selection.set", json!({"ids": [g]})).unwrap();+ app.run("object.opacity", json!({"opacity": 1.0, "blend": "colorDodge"})).unwrap();+ let ctx = egui::Context::default();+ crate::theme::install_fonts(&ctx, "en");+ crate::theme::apply(&ctx, &Tokens::for_brightness(crate::theme::Brightness::default()));+ let texts: Vec<String> = frame(&mut app, &ctx, vec![]).into_iter().map(|(t, _)| t).collect();+ for expected in ["Group:", "Color Dodge 100%", "Isolate Blending", "Knockout Group"] {+ assert!(texts.iter().any(|t| t == expected), "{expected} in {texts:?}");+ }+ let item = |app: &DesignApp, id: u64| app.session.doc().unwrap().doc.item(designcraft_doc::ItemId(id)).cloned().unwrap();+ click(&mut app, &ctx, "Isolate Blending");+ assert!(item(&app, g).isolate);+ click(&mut app, &ctx, "Knockout Group");+ assert!(item(&app, g).knockout);+ // Another object: the level is Object, and the group options are greyed.+ app.run("selection.set", json!({"ids": [a]})).unwrap();+ let texts: Vec<String> = frame(&mut app, &ctx, vec![]).into_iter().map(|(t, _)| t).collect();+ assert!(texts.iter().any(|t| t == "Object:"), "{texts:?}");+ click(&mut app, &ctx, "Knockout Group");+ assert!(!item(&app, a).knockout);+ }++ #[test]+ fn pasted_into_frames_keep_object_level_and_disable_group_blending() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), Default::default());+ app.run("file.new", json!({})).unwrap();+ let child = app.run("frame.create", json!({"rect": [80, 80, 120, 120]})).unwrap()["id"].clone();+ app.run("selection.set", json!({"ids": [child]})).unwrap();+ app.run("edit.copy", json!({})).unwrap();+ let container = app.run("frame.create", json!({"rect": [72, 72, 200, 200]})).unwrap()["id"].as_u64().unwrap();+ app.run("selection.set", json!({"ids": [container]})).unwrap();+ app.run("edit.pasteInto", json!({})).unwrap();+ app.run("selection.set", json!({"ids": [container]})).unwrap();+ let ctx = egui::Context::default();+ crate::theme::install_fonts(&ctx, "en");+ crate::theme::apply(&ctx, &Tokens::for_brightness(crate::theme::Brightness::default()));+ let texts: Vec<String> = frame(&mut app, &ctx, vec![]).into_iter().map(|(t, _)| t).collect();+ assert!(texts.iter().any(|t| t == "Object:"), "a frame remains an object after Paste Into: {texts:?}");+ let undo = app.session.doc().unwrap().history.undo.len();+ click(&mut app, &ctx, "Isolate Blending");+ click(&mut app, &ctx, "Knockout Group");+ let st = app.session.doc().unwrap();+ let it = st.doc.item(designcraft_doc::ItemId(container)).unwrap();+ assert!(it.has_nested_items());+ assert!(!it.isolate && !it.knockout, "group-only options stay disabled for a frame holding content");+ assert_eq!(st.history.undo.len(), undo, "disabled controls do not create undo steps");+ }+ }