DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
fix(ui): View items in the View menu, laid out like InDesign's
moppeeerfb296eacac42
diff --git a/ROADMAP.md b/ROADMAP.mdindex 4b7163c76..6dcb644fb 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -132,6 +132,7 @@ 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-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** · 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 --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rsindex 5976d7d07..b6898c7f4 100644--- a/crates/ui-egui/src/i18n.rs+++ b/crates/ui-egui/src/i18n.rs@@ -2811,6 +2811,9 @@ const TABLE: &[(&str, [&str; 5])] = &[("Paragraph Rules", ["Absatzlinien", "Filets de paragraphe", "Filetes de párrafo", "段落境界線", "段落线"]),("Rule Below", ["Linie unterhalb", "Filet après", "Filete después", "後境界線", "下方横线"]),("Tint:", ["Farbton:", "Teinte:", "Matiz:", "濃淡:", "色调:"]),+ ("Slug", ["Infobereich", "Ligne-bloc", "Indicaciones", "印刷可能領域", "辅助信息区"]),+ ("Presentation", ["Präsentation", "Présentation", "Presentación", "プレゼンテーション", "演示文稿"]),+ ("Extras", ["Extras", "Options supplémentaires", "Extras", "エクストラ", "附加"]),("Column", ["Spalte", "Colonne", "Columna", "段", "栏"]),];diff --git a/crates/ui-egui/src/i18n/it.rs b/crates/ui-egui/src/i18n/it.rsindex 34766cf22..7747e87ec 100644--- a/crates/ui-egui/src/i18n/it.rs+++ b/crates/ui-egui/src/i18n/it.rs@@ -1493,4 +1493,5 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Paragraph Rules", "Filetti paragrafo"),("Rule Below", "Filetto sotto"),("Tint:", "Tinta:"),+ ("Presentation", "Presentazione"),];diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rsindex cb1422394..b0049865d 100644--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@ -403,34 +403,6 @@ pub const MENUS: &[(&str, &[&str])] = &["cmd:type.sizeDown","-","ui:view.hiddenCharacters",- "ui:view.taggedFrames",- ">Rotate Spread",- "ui:view.rotateSpread|90° CW|{\"angle\": 90}",- "ui:view.rotateSpread|90° CCW|{\"angle\": -90}",- "ui:view.rotateSpread|180°|{\"angle\": 180}",- "ui:view.rotateSpread|Clear Rotation|{\"angle\": 0}",- "<",- ">Proof Setup",- "ui:view.proofSetup|Working CMYK|{\"target\": \"workingCmyk\"}",- "ui:view.proofSetup|Internet Standard RGB (sRGB)|{\"target\": \"srgb\"}",- "ui:view.proofSetup|Legacy Macintosh RGB|{\"target\": \"legacyMacRgb\"}",- "ui:view.proofSetup|Monitor RGB|{\"target\": \"monitorRgb\"}",- "ui:view.proofSetup|Color Blindness – Protanopia|{\"target\": \"protanopia\"}",- "ui:view.proofSetup|Color Blindness – Deuteranopia|{\"target\": \"deuteranopia\"}",- "-",- "ui:view.proofSetup|Simulate Paper Color|{\"simulatePaper\": \"toggle\"}",- "<",- "ui:view.proofColors",- "ui:view.flattenerPreview",- "ui:view.tagMarkers",- ">Separations Preview",- "ui:view.separations|Off|{\"plate\": null, \"inkLimit\": null}",- "ui:view.separations|Cyan|{\"plate\": \"cyan\"}",- "ui:view.separations|Magenta|{\"plate\": \"magenta\"}",- "ui:view.separations|Yellow|{\"plate\": \"yellow\"}",- "ui:view.separations|Black|{\"plate\": \"black\"}",- "ui:view.separations|Ink Limit 300%|{\"inkLimit\": 300}",- "<","-",">Hyperlinks & Cross-References","cmd:hyperlink.create",@@ -620,6 +592,28 @@ pub const MENUS: &[(&str, &[&str])] = &[("View",&[+ "ui:view.overprintPreview",+ ">Proof Setup",+ "ui:view.proofSetup|Working CMYK|{\"target\": \"workingCmyk\"}",+ "ui:view.proofSetup|Internet Standard RGB (sRGB)|{\"target\": \"srgb\"}",+ "ui:view.proofSetup|Legacy Macintosh RGB|{\"target\": \"legacyMacRgb\"}",+ "ui:view.proofSetup|Monitor RGB|{\"target\": \"monitorRgb\"}",+ "ui:view.proofSetup|Color Blindness – Protanopia|{\"target\": \"protanopia\"}",+ "ui:view.proofSetup|Color Blindness – Deuteranopia|{\"target\": \"deuteranopia\"}",+ "-",+ "ui:view.proofSetup|Simulate Paper Color|{\"simulatePaper\": \"toggle\"}",+ "<",+ "ui:view.proofColors",+ ">Separations Preview",+ "ui:view.separations|Off|{\"plate\": null, \"inkLimit\": null}",+ "ui:view.separations|Cyan|{\"plate\": \"cyan\"}",+ "ui:view.separations|Magenta|{\"plate\": \"magenta\"}",+ "ui:view.separations|Yellow|{\"plate\": \"yellow\"}",+ "ui:view.separations|Black|{\"plate\": \"black\"}",+ "ui:view.separations|Ink Limit 300%|{\"inkLimit\": 300}",+ "<",+ "ui:view.flattenerPreview",+ "-","ui:view.zoomIn","ui:view.zoomOut","ui:view.fitPage",@@ -628,8 +622,20 @@ pub const MENUS: &[(&str, &[&str])] = &["ui:view.actualSize","ui:view.entirePasteboard","-",- "ui:view.overprintPreview",- "ui:view.togglePreview",+ ">Rotate Spread",+ "ui:view.rotateSpread|90° CW|{\"angle\": 90}",+ "ui:view.rotateSpread|90° CCW|{\"angle\": -90}",+ "ui:view.rotateSpread|180°|{\"angle\": 180}",+ "ui:view.rotateSpread|Clear Rotation|{\"angle\": 0}",+ "<",+ "-",+ ">Screen Mode",+ "ui:view.screenMode|Normal|{\"mode\": \"normal\"}",+ "ui:view.screenMode|Preview|{\"mode\": \"preview\"}",+ "ui:view.screenMode|Bleed|{\"mode\": \"bleed\"}",+ "ui:view.screenMode|Slug|{\"mode\": \"slug\"}",+ "ui:view.screenMode|Presentation|{\"mode\": \"presentation\"}",+ "<",">Display Performance","ui:view.fastDisplay","ui:view.typicalDisplay",@@ -637,10 +643,11 @@ pub const MENUS: &[(&str, &[&str])] = &["<","-","ui:view.rulers",+ "-",+ ">Extras","ui:view.frameEdges","ui:view.textThreads",- "ui:view.hiddenCharacters",- "-",+ "<",">Grids & Guides","ui:view.guides","ui:view.snapToGuides",@@ -650,6 +657,11 @@ pub const MENUS: &[(&str, &[&str])] = &["-","ui:app.deleteAllGuides","<",+ "-",+ ">Structure",+ "ui:view.taggedFrames",+ "ui:view.tagMarkers",+ "<",],),(@@ -2279,6 +2291,34 @@ pub fn quick_apply_items(session: &designcraft_engine::Session, query: &str) ->mod tests {use super::*;+ /// The entries (command ids) of a menu bar menu, submenus included.+ fn menu_ids(title: &str) -> Vec<&'static str> {+ let items = MENUS.iter().find(|(t, _)| *t == title).map(|(_, items)| *items).unwrap_or_default();+ items.iter().filter_map(|e| e.split_once(':').map(|(_, rest)| rest.split('|').next().unwrap_or(rest))).collect()+ }++ #[test]+ fn view_items_are_in_the_view_menu_as_in_indesign() {+ let (view, typ) = (menu_ids("View"), menu_ids("Type"));+ for id in [+ "view.rotateSpread",+ "view.proofSetup",+ "view.proofColors",+ "view.flattenerPreview",+ "view.separations",+ "view.taggedFrames",+ "view.tagMarkers",+ ] {+ assert!(view.contains(&id), "{id} is in View");+ assert!(!typ.contains(&id), "{id} isn't in Type");+ }+ // Screen Mode and Extras are View submenus; Show Hidden Characters stays in Type.+ assert!(view.contains(&"view.screenMode") && view.contains(&"view.frameEdges"));+ assert!(typ.contains(&"view.hiddenCharacters") && !view.contains(&"view.hiddenCharacters"));+ // W still toggles Normal / Preview without a menu entry.+ assert_eq!(ui_label("view.togglePreview").and_then(|c| c.1), Some("W"));+ }+fn walk(items: &[Item], out: &mut Vec<(String, String, Value)>) {for it in items {match it {