DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Properties: Edit Page takes the Page tool to the page and shows its own size, as InDesign's
moppeeer09f808994313
diff --git a/ROADMAP.md b/ROADMAP.mdindex d60a6bf49..491fa37b6 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -347,6 +347,7 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.mNewest first.+- 2026-10-15: Properties › Edit Page works as InDesign's: the Page tool on the page in view, and Properties shows that page alone (Page Size: page, preset, orientation, W/H; Margins and Columns; Quick Actions) with Back. It opened Document Setup, which changes every page.- **2026-10-14** · The Type tool draws a new text frame over a locked empty frame, as InDesign does, instead of turning the locked frame into a text frame. No readiness percentage change.- **2026-10-14** · 100% black shows as pure black on screen by default, as InDesign's Appearance of Black does out of the box (Display All Blacks as Rich Black); Preferences › Appearance of Black › Display All Blacks Accurately still shows it as the dark grey it prints, and a saved choice is kept. No readiness percentage change.- **2026-10-14** · Pathfinder keeps the frontmost object, as InDesign does: a photo placed over shapes and intersected with them shows through the shapes (it was dropped, and the shapes kept their black fill); Add, Exclude Overlap and Minus Back take the front object's fill too, Subtract still keeps the back one. No readiness percentage change.diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rsindex 245a6e287..bf7b07adc 100644--- a/crates/ui-egui/src/i18n.rs+++ b/crates/ui-egui/src/i18n.rs@@ -58,6 +58,8 @@ const TABLE: &[(&str, [&str; 5])] = &[("Cut", ["Ausschneiden", "Couper", "Cortar", "カット", "剪切"]),("Copy", ["Kopieren", "Copier", "Copiar", "コピー", "复制"]),("Paste", ["Einfügen", "Coller", "Pegar", "ペースト", "粘贴"]),+ ("Back", ["Zurück", "Retour", "Atrás", "戻る", "返回"]),+ ("Margins and Columns", ["Ränder und Spalten", "Marges et colonnes", "Márgenes y columnas", "マージン・段組", "边距和分栏"]),("Bulleted & Numbered Lists",[diff --git a/crates/ui-egui/src/i18n/ar.rs b/crates/ui-egui/src/i18n/ar.rsindex d1dcb7acf..b99ab0afe 100644--- a/crates/ui-egui/src/i18n/ar.rs+++ b/crates/ui-egui/src/i18n/ar.rs@@ -30,6 +30,7 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Cut", "قص"),("Copy", "نسخ"),("Paste", "لصق"),+ ("Back", "رجوع"),("Bulleted & Numbered Lists", "القوائم ذات التعداد النقطي والرقمي"),("Current Page Number", "رقم الصفحة الحالية"),("Apply Color (,)", "تطبيق اللون (,)"),diff --git a/crates/ui-egui/src/i18n/de.rs b/crates/ui-egui/src/i18n/de.rsindex 0f55578b5..a5f0c1150 100644--- a/crates/ui-egui/src/i18n/de.rs+++ b/crates/ui-egui/src/i18n/de.rs@@ -30,6 +30,7 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Cut", "Ausschneiden"),("Copy", "Kopieren"),("Paste", "Einfügen"),+ ("Back", "Zurück"),("Clear", "Löschen"),("Duplicate", "Duplizieren"),("Select All", "Alles auswählen"),diff --git a/crates/ui-egui/src/i18n/it.rs b/crates/ui-egui/src/i18n/it.rsindex 00328ac9f..9c83a2510 100644--- a/crates/ui-egui/src/i18n/it.rs+++ b/crates/ui-egui/src/i18n/it.rs@@ -28,6 +28,8 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Cut", "Taglia"),("Copy", "Copia"),("Paste", "Incolla"),+ ("Back", "Indietro"),+ ("Margins and Columns", "Margini e colonne"),("Bulleted & Numbered Lists", "Elenchi puntati e numerati"),("Current Page Number", "Numero di pagina corrente"),("Apply Color (,)", "Applica colore (,)"),diff --git a/crates/ui-egui/src/i18n/ja.rs b/crates/ui-egui/src/i18n/ja.rsindex fe9e213e7..4ad3b361d 100644--- a/crates/ui-egui/src/i18n/ja.rs+++ b/crates/ui-egui/src/i18n/ja.rs@@ -30,6 +30,7 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Cut", "カット"),("Copy", "コピー"),("Paste", "ペースト"),+ ("Back", "戻る"),("Bulleted & Numbered Lists", "箇条書き"),("Apply Color (,)", "カラーを適用 (,)"),("Apply Gradient (.)", "グラデーションを適用 (.)"),diff --git a/crates/ui-egui/src/i18n/ka.rs b/crates/ui-egui/src/i18n/ka.rsindex b3379c6d7..2cb9d7855 100644--- a/crates/ui-egui/src/i18n/ka.rs+++ b/crates/ui-egui/src/i18n/ka.rs@@ -31,6 +31,7 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Cut", "ამოჭრა"),("Copy", "კოპირება"),("Paste", "ჩასმა"),+ ("Back", "უკან"),("Reverse Path", "ტრაექტორიის შებრუნება"),("Set Anchor", "საყრდენი წერტილის დაყენება"),("Clear", "გასუფთავება"),diff --git a/crates/ui-egui/src/i18n/pt_br.rs b/crates/ui-egui/src/i18n/pt_br.rsindex 0675a2f66..a3eb30c20 100644--- a/crates/ui-egui/src/i18n/pt_br.rs+++ b/crates/ui-egui/src/i18n/pt_br.rs@@ -31,6 +31,8 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Cut", "Recortar"),("Copy", "Copiar"),("Paste", "Colar"),+ ("Back", "Voltar"),+ ("Margins and Columns", "Margens e colunas"),("Bulleted & Numbered Lists", "Listas com marcadores e numeradas"),("Show Hidden Characters", "Mostrar caracteres ocultos"),("Current Page Number", "Número da página atual"),diff --git a/crates/ui-egui/src/i18n/uk.rs b/crates/ui-egui/src/i18n/uk.rsindex 8f1d27f84..a92229fd6 100644--- a/crates/ui-egui/src/i18n/uk.rs+++ b/crates/ui-egui/src/i18n/uk.rs@@ -31,6 +31,8 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Cut", "Вирізати"),("Copy", "Копіювати"),("Paste", "Вставити"),+ ("Back", "Назад"),+ ("Margins and Columns", "Поля та колонки"),("Bulleted & Numbered Lists", "Марковані й нумеровані списки"),("Current Page Number", "Номер поточної сторінки"),("Apply Color (,)", "Застосувати колір (,)"),diff --git a/crates/ui-egui/src/panels/properties.rs b/crates/ui-egui/src/panels/properties.rsindex 52ce7e688..dff9d1ab0 100644--- a/crates/ui-egui/src/panels/properties.rs+++ b/crates/ui-egui/src/panels/properties.rs@@ -84,7 +84,9 @@ pub fn show(app: &mut DesignApp, ui: &mut egui::Ui) {ui.spacing_mut().item_spacing = vec2(6.0, 5.0);let info = sel_info(app);let has_text = app.session.active().is_some_and(|s| s.selection.text.is_some());- selection_band(ui, &selection_title(app, &info));+ if !(info.is_none() && !has_text && app.session.tool_id() == "page") {+ selection_band(ui, &selection_title(app, &info));+ }if has_text {text_style_section(app, ui);divider(ui);@@ -104,6 +106,14 @@ pub fn show(app: &mut DesignApp, ui: &mut egui::Ui) {quick_actions_text(app, ui);return;}+ // The Page tool with no objects selected: the page's own settings, as InDesign's.+ if info.is_none() && app.session.tool_id() == "page" {+ let page = app.session.active().and_then(|st| st.selection.page).or_else(|| crate::canvas::current_page(app));+ if let Some(page) = page {+ page_sections(app, ui, page);+ return;+ }+ }let Some(i) = info else {document_sections(app, ui);return;@@ -190,6 +200,104 @@ pub(crate) fn preset_name(w: f64, h: f64) -> &'static str {PAGE_PRESETS.iter().find(|p| (p.1 - a).abs() < 0.6 && (p.2 - b).abs() < 0.6).map(|p| p.0).unwrap_or("Custom")}+/// Properties with the Page tool (Properties › Edit Page), as InDesign's: a "Page" band with Back,+/// Page Size for this page alone (which page, preset, orientation, W/H), Margins and Columns and+/// Quick Actions. Back returns to the Selection tool and the document's properties.+fn page_sections(app: &mut DesignApp, ui: &mut Ui, page: usize) {+ let u = units(app);+ let lang = app.ui.language.clone();+ let Some(st) = app.session.active() else { return };+ let d = st.doc.clone();+ let Some((si, pi)) = d.page_loc(page) else { return };+ let Some(pg) = d.spreads.get(si).and_then(|s| s.pages.get(pi)).cloned() else { return };+ let n = page + 1;+ let t = Tokens::get(ui.ctx());+ // The band: "Page", and Back at its end.+ let band = block(ui, 33.0);+ crate::rtl::paint(+ ui.painter(),+ pos2(band.min.x, band.center().y + 1.0),+ egui::Align2::LEFT_CENTER,+ crate::i18n::tr(&lang, "Page"),+ crate::theme::semibold(11.5),+ t.text_strong,+ );+ let back = place(ui, Rect::from_min_size(pos2(band.max.x - 58.0, band.center().y - 10.0), vec2(54.0, 20.0)), |ui| {+ outline_button(ui, crate::i18n::tr(&lang, "Back"), 54.0).clicked()+ });+ rule(ui);+ if back {+ let _ = app.run("layout.selectPage", json!({"page": null}));+ app.select_tool("selection");+ return;+ }+ section(ui, crate::i18n::tr(&lang, "Page Size"), true);+ // Which page.+ let b = block(ui, FIELD_H);+ let names: Vec<String> = (0..d.page_count()).map(|i| app.session.page_label(i)).collect();+ let picked = place(ui, sub(b, 0.0, 0.0, 93.0, FIELD_H), |ui| {+ widgets::dropdown_list(ui, names.get(page).map_or("", String::as_str), 93.0, &names, Some(page))+ });+ if let Some(p) = picked {+ let _ = app.run("layout.selectPage", json!({"page": p + 1}));+ crate::canvas::go_to_page(app, p);+ return;+ }+ ui.add_space(3.0);+ // Preset and orientation: this page alone.+ let (w, h) = (pg.width, pg.height);+ let landscape = w > h;+ let b = block(ui, FIELD_H);+ let mut size = None;+ place(ui, sub(b, 0.0, 0.0, 93.0, FIELD_H), |ui| {+ let resp = dropdown(ui, crate::i18n::tr(&lang, preset_name(w, h)), 93.0);+ egui::Popup::menu(&resp).show(|ui| {+ ui.set_min_width(140.0);+ for p in PAGE_PRESETS {+ if ui.selectable_label(preset_name(w, h) == p.0, crate::i18n::tr(&lang, p.0)).clicked() {+ size = Some(if landscape { (p.2, p.1) } else { (p.1, p.2) });+ ui.close();+ }+ }+ });+ });+ place(ui, sub(b, 126.0, 0.0, 52.0, FIELD_H), |ui| {+ ui.spacing_mut().item_spacing.x = 4.0;+ if icon_toggle(ui, "orient-portrait", !landscape, crate::i18n::tr(&lang, "Portrait")).clicked() && landscape {+ size = Some((h, w));+ }+ if icon_toggle(ui, "orient-landscape", landscape, crate::i18n::tr(&lang, "Landscape")).clicked() && !landscape {+ size = Some((h, w));+ }+ });+ ui.add_space(3.0);+ let b = block(ui, 2.0 * FIELD_H + 5.0);+ for (row, (label, v, key)) in [("W:", w, "width"), ("H:", h, "height")].into_iter().enumerate() {+ let y = row as f32 * 26.0;+ place(ui, sub(b, 0.0, y, 20.0, FIELD_H), |ui| widgets::caption_w(ui, label, 20.0));+ let nv = place(ui, sub(b, 21.0, y, 72.0, FIELD_H), |ui| {+ NumField::measure(&format!("page_{key}"), Some(v), u).width(72.0).spinner().range(1.0, 15552.0).show(ui)+ });+ if let Some(nv) = nv {+ size = Some(if key == "width" { (nv, h) } else { (w, nv) });+ }+ }+ if let Some((nw, nh)) = size {+ let _ = app.run("layout.pageSize", json!({"pages": [n], "width": nw, "height": nh, "anchor": app.ui.ref_point.min(8)}));+ }+ ui.add_space(6.0);+ let fw = full_width(ui);+ if outline_button(ui, crate::i18n::tr(&lang, "Margins and Columns"), fw).clicked() {+ crate::canvas::go_to_page(app, page);+ crate::menus::activate(app, "layout.marginsAndColumns", &Value::Null);+ }+ divider(ui);+ section(ui, crate::i18n::tr(&lang, "Quick Actions"), true);+ if outline_button(ui, crate::i18n::tr(&lang, "Import File"), fw).clicked() {+ let _ = app.run("app.placeDialog", json!({}));+ }+}+fn document_sections(app: &mut DesignApp, ui: &mut Ui) {let u = units(app);let Some(st) = app.session.active() else { return };@@ -354,7 +462,9 @@ fn document_sections(app: &mut DesignApp, ui: &mut Ui) {}ui.add_space(3.0);if outline_button(ui, crate::i18n::tr(&app.ui.language, "Edit Page"), fw).clicked() {- crate::dialogs::open_document_setup(app);+ // As in InDesign: the Page tool on this page; Properties shows the page's own settings.+ app.select_tool("page");+ let _ = app.run("layout.selectPage", json!({"page": cur + 1}));}divider(ui);// Rulers & Grids / Guides: icon toggle rows.@@ -2542,6 +2652,36 @@ mod tests {h}+ /// As InDesign's: Edit Page takes the Page tool to the page in view, and Properties sets that+ /// page alone; Back returns to the document.+ #[test]+ fn edit_page_shows_the_page_and_sets_its_size_alone() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({"pages": 3, "facingPages": false})).unwrap();+ app.ui.dock_tab = "properties".into();+ let mut h = crate::test_window::open(app, vec2(1400.0, 900.0));+ crate::canvas::go_to_page(&mut h.state_mut().app, 1);+ h.run_steps(3);+ h.get_by_label("Edit Page").click();+ h.run_steps(3);+ let st = h.state().app.session.active().unwrap();+ assert_eq!((h.state().app.session.tool_id(), st.selection.page), ("page", Some(1)));+ assert!(h.query_by_label("Document Setup").is_none(), "no dialog");+ let _ = h.get_by_label("Page Size");+ let _ = h.get_by_label("Margins and Columns");+ h.get_by_label("Landscape").click();+ h.run_steps(3);+ let doc = &h.state().app.session.active().unwrap().doc;+ let size = |abs: usize| doc.page(abs).map(|p| (p.width, p.height)).unwrap();+ assert_eq!(size(1), (792.0, 612.0), "the page turns");+ assert_eq!((size(0), size(2)), ((612.0, 792.0), (612.0, 792.0)), "the others don't");+ h.get_by_label("Back").click();+ h.run_steps(3);+ let st = h.state().app.session.active().unwrap();+ assert_eq!((h.state().app.session.tool_id(), st.selection.page), ("selection", None));+ let _ = h.get_by_label("Edit Page");+ }+#[test]fn links_panel_distinguishes_same_named_sources_and_keeps_link_actions() {let first = "/project/assets/studio-a/photo.svg";diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rsindex 44316fda4..b4e0c4abf 100644--- a/crates/ui-egui/src/widgets.rs+++ b/crates/ui-egui/src/widgets.rs@@ -334,6 +334,8 @@ pub fn outline_button(ui: &mut Ui, label: &str, width: f32) -> Response {}p.rect_stroke(r, 2.0, Stroke::new(1.0, t.field_border), StrokeKind::Inside);crate::rtl::paint(p, r.center(), egui::Align2::CENTER_CENTER, label, label_font(), t.text);+ // Screen readers (and tests) find it by its label.+ resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, label));resp}