DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge #342: feat(ui): Lay out Numbering & Section Options like InDesign's
aiongg816ce1b75650
diff --cc ROADMAP.mdindex 323521ba3,52e995cfc..1c87ef260--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -199,7 -166,7 +199,8 @@@ DesignCraft aims at full Adobe InDesig- 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.+- New Document (⌘N) as in InDesign: Recent, Saved, Print, Web and Mobile tabs of page cards (double-click creates), and preset details beside them — 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.new` takes `intent`, `units`, `startPage` and per-edge `bleed`/`slug`.+ - Layout › Numbering & Section Options as in InDesign: Start Section, automatic or explicit page numbering, section prefix, style, marker and Include Prefix, and the document's chapter numbering with its book; opens on the page in view, OK and Cancel beside the options.- Document chapter numbering (`layout.chapterNumbering`): style (1, I, i, A, a, 01, 001, 0001), Automatic Chapter Numbering, Start Chapter Numbering at, Same as Previous Document in the Book; a book's Update Numbering resolves chapter numbers in order; Chapter Number variables and cross-references use the style.- 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.diff --cc crates/ui-egui/src/dialogs.rsindex 0dd48a912,4be365a5a..97b4027ff--- a/crates/ui-egui/src/dialogs.rs+++ b/crates/ui-egui/src/dialogs.rs@@@ -1128,11 -1127,10 +1128,12 @@@ pub fn show(app: &mut DesignApp, ctx: &"insertTable" => crate::i18n::tr(&app.ui.language, "Create Table"),"textFrameOptions" => crate::i18n::tr(&app.ui.language, "Text Frame Options"),"documentSetup" => crate::i18n::tr(&app.ui.language, "Document Setup"),+ "numberingSection" => crate::i18n::tr(&app.ui.language, "Numbering & Section Options…").trim_end_matches('…'),"findChange" => crate::i18n::tr(&app.ui.language, "Find/Change"),"paragraphStyleOptions" => crate::i18n::tr(&app.ui.language, "Paragraph Style Options"),+ "deleteParagraphStyle" => crate::i18n::tr(&app.ui.language, "Delete Paragraph Style"),"characterStyleOptions" => crate::i18n::tr(&app.ui.language, "Character Style Options"),+ "deleteCharacterStyle" => crate::i18n::tr(&app.ui.language, "Delete Character Style"),"footnoteOptions" => crate::i18n::tr(&app.ui.language, "Footnote Options"),"paragraphRules" => crate::i18n::tr(&app.ui.language, "Paragraph Rules"),"insertXref" => crate::i18n::tr(&app.ui.language, "New Cross-Reference"),@@@ -1164,7 -1162,8 +1165,8 @@@let preferred_width: f32 = match d.id.as_str() {"alert" => 440.0,"closeDocument" => 380.0,+ "newDocument" => 960.0,+ "numberingSection" => 560.0,- "newDocument" if crate::i18n::is_rtl(&app.ui.language) => 380.0,_ => 640.0,};let width = preferred_width.min(available.x);@@@ -1182,15 -1181,113 +1184,44 @@@ui.add_space(10.0);// Keep the title and action buttons outside the scrollable body. Oversized// forms remain reachable at large UI scales, without shrinking their text.- let footer_height = ui.spacing().interact_size.y.max(ui.text_style_height(&egui::TextStyle::Button) + 2.0 * ui.spacing().button_padding.y);+ // Numbering & Section Options keeps OK and Cancel in a column beside the options, as+ // InDesign does; other dialogs have them in a footer.+ let side_actions = d.id == "numberingSection";+ let footer_height = if side_actions {+ 0.0+ } else {+ ui.spacing().interact_size.y.max(ui.text_style_height(&egui::TextStyle::Button) + 2.0 * ui.spacing().button_padding.y)+ };let body_height = (available.y - ui.min_size().y - footer_height - 12.0 - 2.0 * ui.spacing().item_spacing.y).max(1.0);- egui::ScrollArea::both().id_salt(("dialog_body", &d.id)).min_scrolled_width(1.0).min_scrolled_height(1.0).max_width(width).max_height(body_height).show(ui, |ui| {+ let mut body_width = width;+ if side_actions {+ // The column is beside the options, not in the layout: keep the window wide enough.+ ui.set_min_width(width);+ body_width = (width - crate::section_options::ACTIONS_W - 12.0).max(1.0);+ let top = ui.cursor().min;+ // On the right in every language, like the other dialogs' OK.+ let column = egui::Rect::from_min_size(egui::pos2(top.x + width - crate::section_options::ACTIONS_W, top.y), egui::vec2(crate::section_options::ACTIONS_W, 60.0));+ let mut actions = ui.new_child(egui::UiBuilder::new().max_rect(column).layout(egui::Layout::top_down_justified(egui::Align::Center)));+ if let Some(ok) = crate::section_options::actions(app, &mut actions) {+ result = Some(ok);+ }+ if ui.input(|i| i.key_pressed(egui::Key::Enter)) {+ result = Some(true);+ }+ if ui.input(|i| i.key_pressed(egui::Key::Escape)) {+ result = Some(false);+ }+ }+ // A centred window only offers its body last frame's height: let this one grow to its+ // options' height (the screen still caps it).+ let min_body = if side_actions { body_height.min(crate::section_options::BODY_H) } else { 1.0 };+ egui::ScrollArea::both().id_salt(("dialog_body", &d.id)).min_scrolled_width(1.0).min_scrolled_height(min_body).max_width(body_width).max_height(body_height).show(ui, |ui| {match d.id.as_str() {"newDocument" => {- ui.horizontal(|ui| {- ui.with_layout(if crate::i18n::is_rtl(&app.ui.language) { egui::Layout::right_to_left(egui::Align::Center) } else { egui::Layout::left_to_right(egui::Align::Center) }, |ui| {- crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Preset"));- let cur = d.s("preset");- egui::ComboBox::from_id_salt("preset").selected_text(&cur).width(180.0).show_ui(ui, |ui| {- for p in designcraft_doc::build::PRESETS {- if ui.selectable_label(cur == p.name, p.name).clicked() {- d.fields.insert("preset".into(), json!(p.name));- d.fields.insert("width".into(), json!(format_measure(p.width, p.units)));- d.fields.insert("height".into(), json!(format_measure(p.height, p.units)));- d.fields.insert("facingPages".into(), json!(p.intent == designcraft_doc::Intent::Print));- }- }- });- });- });- if crate::i18n::is_rtl(&app.ui.language) {- // egui Grid currently supports LTR only. Use explicit RTL rows;- // the numeric editors retain LTR alignment and logical values.- for (first, key, second, other, toggle) in [- ("Width", "width", "Height", "height", false),- ("Pages", "pages", "Facing Pages", "facingPages", true),- ("Columns", "columns", "Gutter", "gutter", false),- ("Top", "marginTop", "Bottom", "marginBottom", false),- ("Inside", "marginInside", "Outside", "marginOutside", false),- ("Bleed", "bleed", "Primary Text Frame", "primaryTextFrame", true),- ] {- ui.horizontal(|ui| {- ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {- crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, first));- text_field(ui, &mut d, key, 80.0);- if toggle {- check(ui, &mut d, other, crate::i18n::tr(&app.ui.language, second));- } else {- crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, second));- text_field(ui, &mut d, other, 80.0);- }- });- });- }- } else {- egui::Grid::new("nd").num_columns(4).spacing([8.0, 6.0]).show(ui, |ui| {- crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Width"));- text_field(ui, &mut d, "width", 80.0);- crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Height"));- text_field(ui, &mut d, "height", 80.0);- ui.end_row();- crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Pages"));- text_field(ui, &mut d, "pages", 80.0);- ui.label("");- check(ui, &mut d, "facingPages", crate::i18n::tr(&app.ui.language, "Facing Pages"));- ui.end_row();- crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Columns"));- text_field(ui, &mut d, "columns", 80.0);- crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Gutter"));- text_field(ui, &mut d, "gutter", 80.0);- ui.end_row();- crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Top"));- text_field(ui, &mut d, "marginTop", 80.0);- crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Bottom"));- text_field(ui, &mut d, "marginBottom", 80.0);- ui.end_row();- crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Inside"));- text_field(ui, &mut d, "marginInside", 80.0);- crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Outside"));- text_field(ui, &mut d, "marginOutside", 80.0);- ui.end_row();- crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Bleed"));- text_field(ui, &mut d, "bleed", 80.0);- ui.label("");- check(ui, &mut d, "primaryTextFrame", crate::i18n::tr(&app.ui.language, "Primary Text Frame"));- ui.end_row();- });+ // A double-clicked preset creates the document at once.+ let create = crate::new_document::body(app, ui, &mut d, width, body_height);+ if create {+ result = Some(true);}}"frameSize" => {@@@ -1638,18 -1734,11 +1670,21 @@@_ => {}}});+ if side_actions {+ return;+ }ui.add_space(12.0);- let ok_label = if d.id == "closeDocument" { " Save " } else { " OK " };+ let ok_label = match d.id.as_str() {+ "closeDocument" => crate::i18n::tr(&app.ui.language, " Save ").to_string(),+ "findFont" => crate::i18n::tr(&app.ui.language, "Replace All").to_string(),+ "newDocument" => format!(" {} ", crate::i18n::tr(&app.ui.language, "Create")),+ _ => crate::i18n::tr(&app.ui.language, " OK ").to_string(),+ };+ let cancel_label = match d.id.as_str() {+ "newDocument" => "Close",+ "findFont" => "Done",+ _ => "Cancel",+ };ui.horizontal(|ui| {ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {if ui@@@ -3979,18 -3785,306 +4023,50 @@@ fn find_font(app: &mut DesignApp, ui: &mod tests {use super::*;- fn dialog_context(language: &str) -> egui::Context {- let ctx = egui::Context::default();- crate::theme::install_fonts(&ctx, language);- crate::theme::apply(&ctx, &crate::theme::Tokens::for_brightness(crate::theme::Brightness::default()));- ctx- }-- fn dialog_frame(app: &mut DesignApp, ctx: &egui::Context, screen: egui::Rect, events: Vec<egui::Event>) -> Vec<(String, egui::Rect, egui::Rect)> {- let time = ctx.input(|i| i.time) + 1.0 / 60.0;- let mut output = ctx.run_ui(egui::RawInput { screen_rect: Some(screen), time: Some(time), events, ..Default::default() }, |ui| {- show(app, ui.ctx());- });- output.textures_delta.clear();- fn collect(shape: &egui::Shape, clip: egui::Rect, labels: &mut Vec<(String, egui::Rect, egui::Rect)>) {- match shape {- egui::Shape::Text(t) => labels.push((t.galley.job.text.clone(), t.visual_bounding_rect(), clip)),- egui::Shape::Vec(shapes) => {- for s in shapes {- collect(s, clip, labels);- }- }- _ => {}- }- }- let mut labels = Vec::new();- for shape in output.shapes {- collect(&shape.shape, shape.clip_rect, &mut labels);- }- labels- }-- fn visible_label(labels: &[(String, egui::Rect, egui::Rect)], screen: egui::Rect, expected: &str) -> egui::Rect {- let (_, rect, clip) = labels.iter().find(|(text, _, _)| text.trim() == expected).unwrap_or_else(|| panic!("{expected} is painted"));- assert!(screen.contains_rect(*rect), "{expected} must stay on screen: {rect:?}");- assert!(clip.contains_rect(*rect), "{expected} must not be clipped: {rect:?}, {clip:?}");- *rect- }-- fn click_dialog(app: &mut DesignApp, ctx: &egui::Context, screen: egui::Rect, pos: egui::Pos2) {- for pressed in [true, false] {- dialog_frame(- app,- ctx,- screen,- vec![- egui::Event::PointerMoved(pos),- egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE },- ],- );- }- }-- fn scroll_dialog(app: &mut DesignApp, ctx: &egui::Context, screen: egui::Rect, pos: egui::Pos2, delta: egui::Vec2) {- dialog_frame(- app,- ctx,- screen,- vec![- egui::Event::PointerMoved(pos),- egui::Event::MouseWheel { unit: egui::MouseWheelUnit::Point, delta, phase: egui::TouchPhase::Move, modifiers: egui::Modifiers::NONE },- ],- );- // Let smooth wheel scrolling and scrollbar visibility settle before clicking.- for _ in 0..30 {- dialog_frame(app, ctx, screen, vec![]);- }- }-- #[test]- fn dialog_title_and_actions_fit_scaled_viewports() {- for language in ["en", "ar"] {- for size in [egui::vec2(1178.0, 814.0), egui::vec2(589.0, 407.0), egui::vec2(392.0, 271.0), egui::vec2(450.0, 280.0)] {- for (command, title) in [("app.preferences", "Preferences"), ("app.newDocumentDialog", "New Document")] {- let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());- app.ui.language = language.into();- app.run("file.new", json!({})).unwrap();- app.run(command, json!({})).unwrap();- let ctx = dialog_context(language);- let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, size);- for _ in 0..3 {- dialog_frame(&mut app, &ctx, screen, vec![]);- }- let labels = dialog_frame(&mut app, &ctx, screen, vec![]);- for expected in [title, "OK", "Cancel"] {- visible_label(&labels, screen, crate::i18n::tr(language, expected));- }- }- }- }- }-+ #[test]+ fn numbering_and_section_options_keep_their_actions_in_view() {+ for language in ["en", "ar"] {+ for size in [egui::vec2(1178.0, 814.0), egui::vec2(392.0, 271.0)] {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.ui.language = language.into();+ app.run("file.new", json!({"pages": 2})).unwrap();+ crate::menus::activate(&mut app, "layout.section", &Value::Null);+ let ctx = dialog_context(language);+ let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, size);+ for _ in 0..3 {+ dialog_frame(&mut app, &ctx, screen, vec![]);+ }+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);+ let tr = |s| crate::i18n::tr(language, s);+ for expected in [tr("Numbering & Section Options…").trim_end_matches('…'), tr("OK"), tr("Cancel"), tr("Start Section")] {+ visible_label(&labels, screen, expected);+ }+ if size.x > 1000.0 {+ // Every option fits without scrolling, and choosing one then OK applies it.+ visible_label(&labels, screen, &format!("{} {}", tr("Book Name:"), tr("N/A")));+ click_dialog(&mut app, &ctx, screen, visible_label(&labels, screen, tr("Automatic Page Numbering")).center());+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);+ click_dialog(&mut app, &ctx, screen, visible_label(&labels, screen, tr("OK")).center());+ assert!(app.ui.dialog.is_none(), "{language}: OK closes the dialog");+ let doc = &app.session.active().unwrap().doc;+ assert!(doc.sections.iter().all(|s| s.start != 0 || s.start_number.is_none()), "{language}: page 1 numbers automatically");+ }+ }+ }+ }+- #[test]- fn preferences_sidebar_scroll_keeps_selected_options_visible() {- let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());- app.run("file.new", json!({})).unwrap();- app.run("app.preferences", json!({})).unwrap();- let ctx = dialog_context("en");- let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(589.0, 407.0));- for _ in 0..3 {- dialog_frame(&mut app, &ctx, screen, vec![]);- }- let labels = dialog_frame(&mut app, &ctx, screen, vec![]);- let sidebar = visible_label(&labels, screen, "General").center();- assert!(- !labels.iter().any(|(text, rect, clip)| text == "File Handling" && clip.contains_rect(*rect)),- "last section starts below the sidebar"- );- scroll_dialog(&mut app, &ctx, screen, sidebar, egui::vec2(0.0, -600.0));- let labels = dialog_frame(&mut app, &ctx, screen, vec![]);- let files = visible_label(&labels, screen, "File Handling").center();- click_dialog(&mut app, &ctx, screen, files);- assert_eq!(app.ui.dialog.as_ref().unwrap().s("section"), "files");- let labels = dialog_frame(&mut app, &ctx, screen, vec![]);- for expected in ["Document Recovery Data", "Save recovery data every:", "OK", "Cancel"] {- visible_label(&labels, screen, expected);- }- }-- #[test]- fn preferences_horizontal_scroll_reaches_clipped_options() {- let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());- app.run("app.preferences", json!({})).unwrap();- let ctx = dialog_context("en");- let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(450.0, 280.0));- for _ in 0..3 {- dialog_frame(&mut app, &ctx, screen, vec![]);- }- let labels = dialog_frame(&mut app, &ctx, screen, vec![]);- let body = visible_label(&labels, screen, "When Scaling").center();- let option = "Absolute Numbering (instead of Section Numbering)";- let (_, rect, clip) = labels.iter().find(|(text, _, _)| text == option).unwrap();- assert!(rect.right() > clip.right(), "rightmost option starts horizontally clipped: {rect:?}, {clip:?}");- scroll_dialog(&mut app, &ctx, screen, body, egui::vec2(-600.0, 0.0));- let labels = dialog_frame(&mut app, &ctx, screen, vec![]);- for expected in [option, "Preferences", "OK", "Cancel"] {- visible_label(&labels, screen, expected);- }- click_dialog(&mut app, &ctx, screen, visible_label(&labels, screen, option).center());- assert!(app.ui.dialog.as_ref().unwrap().b("absolutePageNumbers"));- }-- #[test]- fn new_document_vertical_scroll_reaches_last_field() {- let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());- app.run("app.newDocumentDialog", json!({})).unwrap();- let ctx = dialog_context("en");- let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(392.0, 271.0));- for _ in 0..3 {- dialog_frame(&mut app, &ctx, screen, vec![]);- }- let labels = dialog_frame(&mut app, &ctx, screen, vec![]);- let body = visible_label(&labels, screen, "Width").center();- let (_, rect, clip) = labels.iter().find(|(text, _, _)| text == "Primary Text Frame").unwrap();- assert!(rect.bottom() > clip.bottom(), "last field starts vertically clipped");- scroll_dialog(&mut app, &ctx, screen, body, egui::vec2(0.0, -600.0));- let labels = dialog_frame(&mut app, &ctx, screen, vec![]);- for expected in ["Primary Text Frame", "New Document", "OK", "Cancel"] {- visible_label(&labels, screen, expected);- }- click_dialog(&mut app, &ctx, screen, visible_label(&labels, screen, "Primary Text Frame").center());- assert!(app.ui.dialog.as_ref().unwrap().b("primaryTextFrame"));- }-- #[test]- fn arabic_new_document_leftmost_fields_remain_reachable() {- for size in [egui::vec2(392.0, 271.0), egui::vec2(450.0, 280.0)] {- let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());- app.ui.language = "ar".into();- app.run("app.newDocumentDialog", json!({})).unwrap();- let fields = [("height", "66p1"), ("gutter", "1p2"), ("marginBottom", "3p3"), ("marginOutside", "3p4")];- for (field, value) in fields {- app.ui.dialog.as_mut().unwrap().fields.insert(field.into(), json!(value));- }- let ctx = dialog_context("ar");- let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, size);- for _ in 0..3 {- dialog_frame(&mut app, &ctx, screen, vec![]);- }- let labels = dialog_frame(&mut app, &ctx, screen, vec![]);- for (_, value) in fields {- visible_label(&labels, screen, value);- }- let body = visible_label(&labels, screen, "66p1").center();- for x in [-600.0, 600.0] {- scroll_dialog(&mut app, &ctx, screen, body, egui::vec2(x, 0.0));- let labels = dialog_frame(&mut app, &ctx, screen, vec![]);- for (_, value) in fields {- visible_label(&labels, screen, value);- }- }- let labels = dialog_frame(&mut app, &ctx, screen, vec![]);- click_dialog(&mut app, &ctx, screen, visible_label(&labels, screen, "66p1").center());- dialog_frame(- &mut app,- &ctx,- screen,- vec![- egui::Event::Key {- key: egui::Key::A,- physical_key: None,- pressed: true,- repeat: false,- modifiers: egui::Modifiers { ctrl: true, command: true, ..Default::default() },- },- egui::Event::Text("88p8".into()),- ],- );- assert_eq!(app.ui.dialog.as_ref().unwrap().s("height"), "88p8", "leftmost numeric field accepts edits");- scroll_dialog(&mut app, &ctx, screen, body, egui::vec2(0.0, -600.0));- let labels = dialog_frame(&mut app, &ctx, screen, vec![]);- let label = crate::i18n::tr("ar", "Primary Text Frame");- click_dialog(&mut app, &ctx, screen, visible_label(&labels, screen, label).center());- assert!(app.ui.dialog.as_ref().unwrap().b("primaryTextFrame"), "leftmost checkbox remains clickable after scrolling");- }- }-- #[test]- fn resized_dialogs_cancel_and_reopen_without_applying_edits() {- for (command, title, field) in [("app.preferences", "Preferences", "recoveryMinutes"), ("app.newDocumentDialog", "New Document", "pages")] {- let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());- app.run(command, json!({})).unwrap();- let original = app.ui.dialog.as_ref().unwrap().fields[field].clone();- app.ui.dialog.as_mut().unwrap().fields.insert(field.into(), json!(42));- let ctx = dialog_context("en");- for size in [egui::vec2(1178.0, 814.0), egui::vec2(392.0, 271.0), egui::vec2(589.0, 407.0)] {- let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, size);- for _ in 0..3 {- dialog_frame(&mut app, &ctx, screen, vec![]);- }- let labels = dialog_frame(&mut app, &ctx, screen, vec![]);- for expected in [title, "OK", "Cancel"] {- visible_label(&labels, screen, expected);- }- }- let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(589.0, 407.0));- let labels = dialog_frame(&mut app, &ctx, screen, vec![]);- click_dialog(&mut app, &ctx, screen, visible_label(&labels, screen, "Cancel").center());- assert!(app.ui.dialog.is_none());- assert!(app.session.active().is_none(), "cancelling must not create a document");- app.run(command, json!({})).unwrap();- assert_eq!(app.ui.dialog.as_ref().unwrap().fields[field], original, "cancelled edits must not survive reopening");- for _ in 0..3 {- dialog_frame(&mut app, &ctx, screen, vec![]);- }- let labels = dialog_frame(&mut app, &ctx, screen, vec![]);- visible_label(&labels, screen, title);- dialog_frame(- &mut app,- &ctx,- screen,- vec![egui::Event::Key { key: egui::Key::Escape, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::NONE }],- );- assert!(app.ui.dialog.is_none(), "Escape must also close the reopened dialog");- }- }-- fn draw(app: &mut DesignApp, ctx: &egui::Context) {- let input =- egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1400.0, 900.0))), ..Default::default() };- let mut out = ctx.run_ui(input, |ui| {- app.logic(&ui.ctx().clone());- app.ui(ui);- });- out.textures_delta.clear();- }-- /// A paragraph styled "Ruled Child", whose Rule Below comes from its parent "Ruled".- fn ruled_paragraph() -> (DesignApp, Value) {+ fn draw(app: &mut DesignApp, ctx: &egui::Context) {+ let input =+ egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1400.0, 900.0))), ..Default::default() };+ let mut out = ctx.run_ui(input, |ui| {+ app.logic(&ui.ctx().clone());+ app.ui(ui);+ });+ out.textures_delta.clear();+ }++ /// A paragraph styled "Ruled Child", whose Rule Below comes from its parent "Ruled".+ fn ruled_paragraph() -> (DesignApp, Value) {let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());app.run("file.new", json!({})).unwrap();let rule = json!({"on": true, "weight": 3.0, "color": "[Black]", "tint": 0.5, "columnWidth": false, "offset": 4.0, "leftIndent": 6.0, "rightIndent": 2.0});diff --cc crates/ui-egui/src/i18n.rsindex 3b148ae28,12699e32c..5cc516a68--- a/crates/ui-egui/src/i18n.rs+++ b/crates/ui-egui/src/i18n.rs@@@ -2866,64 -2811,76 +2866,134 @@@ const TABLE: &[(&str, [&str; 5])] = &("Rule Below", ["Linie unterhalb", "Filet après", "Filete después", "後境界線", "下方横线"]),("Tint:", ["Farbton:", "Teinte:", "Matiz:", "濃淡:", "色调:"]),("Column", ["Spalte", "Colonne", "Columna", "段", "栏"]),+ // File › New › Document+ ("Recent", ["Zuletzt verwendet", "Récents", "Recientes", "最近使用", "最近"]),+ ("Saved", ["Gespeichert", "Enregistrés", "Guardados", "保存済み", "已保存"]),+ ("[Default]", ["[Standard]", "[Par défaut]", "[Predeterminado]", "[初期設定]", "[默认]"]),+ ("Your Recent Items", ["Zuletzt verwendete Elemente", "Éléments récents", "Elementos recientes", "最近使用した項目", "最近使用的项目"]),+ (+ "Saved Presets",+ ["Gespeicherte Vorgaben", "Paramètres prédéfinis enregistrés", "Ajustes preestablecidos guardados", "保存済みプリセット", "已保存的预设"],+ ),+ (+ "Blank Document Presets",+ [+ "Vorgaben für leere Dokumente",+ "Paramètres prédéfinis de document vierge",+ "Ajustes preestablecidos de documento en blanco",+ "空のドキュメントプリセット",+ "空白文档预设",+ ],+ ),+ (+ "No saved presets yet. Set the details, then click Save Document Preset.",+ [+ "Noch keine gespeicherten Vorgaben. Legen Sie die Details fest und klicken Sie auf Dokumentvorgabe speichern.",+ "Aucun paramètre prédéfini enregistré. Définissez les détails, puis cliquez sur Enregistrer le paramètre prédéfini de document.",+ "Aún no hay ajustes preestablecidos guardados. Defina los detalles y haga clic en Guardar ajuste preestablecido de documento.",+ "保存済みのプリセットはありません。詳細を設定してから「ドキュメントプリセットを保存」をクリックしてください。",+ "尚无已保存的预设。请设置详细信息,然后单击“存储文档预设”。",+ ],+ ),+ ("Delete Preset", ["Vorgabe löschen", "Supprimer le paramètre prédéfini", "Eliminar ajuste preestablecido", "プリセットを削除", "删除预设"]),+ (+ "Preset Details",+ ["Vorgabedetails", "Détails du paramètre prédéfini", "Detalles del ajuste preestablecido", "プリセットの詳細", "预设详细信息"],+ ),+ ("Document Name", ["Dokumentname", "Nom du document", "Nombre del documento", "ドキュメント名", "文档名称"]),+ (+ "Save Document Preset",+ [+ "Dokumentvorgabe speichern",+ "Enregistrer le paramètre prédéfini de document",+ "Guardar ajuste preestablecido de documento",+ "ドキュメントプリセットを保存",+ "存储文档预设",+ ],+ ),+ (+ "Save Document Preset As:",+ [+ "Dokumentvorgabe speichern unter:",+ "Enregistrer le paramètre prédéfini de document sous :",+ "Guardar ajuste preestablecido de documento como:",+ "ドキュメントプリセットの保存名:",+ "存储文档预设为:",+ ],+ ),+ ("Save Preset", ["Vorgabe speichern", "Enregistrer le paramètre prédéfini", "Guardar ajuste preestablecido", "プリセットを保存", "存储预设"]),+ ("Start #", ["Startseitennr.", "N° de début", "N.º inicial", "開始ページ番号", "起始页码"]),+ ("Column Gutter", ["Spaltenabstand", "Gouttière", "Medianil", "列間隔", "栏间距"]),+ // Layout › Numbering & Section Options+ ("Start Section", ["Abschnittsanfang", "Début de section", "Iniciar sección", "セクション開始", "开始新章节"]),+ (+ "Automatic Page Numbering",+ [+ "Automatische Seitennummerierung",+ "Numérotation automatique des pages",+ "Numeración de páginas automática",+ "自動ページ番号",+ "自动编排页码",+ ],+ ),+ (+ "Start Page Numbering at:",+ ["Seitennummerierung beginnen bei:", "Commencer la numérotation à :", "Iniciar numeración de páginas en:", "開始ページ番号:", "起始页码:"],+ ),+ ("Section Prefix:", ["Abschnittspräfix:", "Préfixe de section :", "Prefijo de sección:", "セクションプレフィックス:", "章节前缀:"]),+ ("Section Marker:", ["Abschnittsmarke:", "Marqueur de section :", "Marcador de sección:", "セクションマーカー:", "章节标志符:"]),+ (+ "Include Prefix when Numbering Pages",+ [+ "Präfix in Seitennummerierung einschließen",+ "Inclure le préfixe lors de la numérotation des pages",+ "Incluir prefijo al numerar páginas",+ "ページ番号にプレフィックスを含める",+ "编排页码时包含前缀",+ ],+ ),+ (+ "Document Chapter Numbering",+ [+ "Kapitelnummerierung des Dokuments",+ "Numérotation des chapitres du document",+ "Numeración de capítulos del documento",+ "ドキュメントの章番号",+ "文档章节编号",+ ],+ ),+ (+ "Automatic Chapter Numbering",+ [+ "Automatische Kapitelnummerierung",+ "Numérotation automatique des chapitres",+ "Numeración de capítulos automática",+ "自動章番号",+ "自动为章节编号",+ ],+ ),+ (+ "Start Chapter Numbering at:",+ [+ "Kapitelnummerierung beginnen bei:",+ "Commencer la numérotation des chapitres à :",+ "Iniciar numeración de capítulos en:",+ "開始章番号:",+ "起始章节编号:",+ ],+ ),+ (+ "Same as Previous Document in the Book",+ [+ "Wie vorheriges Dokument im Buch",+ "Identique au document précédent du livre",+ "Igual que el documento anterior del libro",+ "ブック内の前のドキュメントと同じ",+ "与书籍中的上一文档相同",+ ],+ ),+ ("Book Name:", ["Buchname:", "Nom du livre :", "Nombre del libro:", "ブック名:", "书籍名称:"]),+ ("N/A", ["–", "S.O.", "N/D", "なし", "不适用"]),];/// Interface direction; independent of document binding and paragraph direction.diff --cc crates/ui-egui/src/i18n/it.rsindex a724ae16c,63096fcfd..23387e08d--- a/crates/ui-egui/src/i18n/it.rs+++ b/crates/ui-egui/src/i18n/it.rs@@@ -1492,45 -1492,17 +1492,58 @@@ pub(super) const TABLE: &[(&str, &str)("Paragraph Rules", "Filetti paragrafo"),("Rule Below", "Filetto sotto"),("Tint:", "Tinta:"),+ // Machine-translated; not yet reviewed by a native speaker.+ ("Align Left Edge", "Allinea bordo sinistro"),+ ("Characters:", "Caratteri:"),+ ("Drop Caps", "Capilettera"),+ ("Drop Chars", "Caratteri capolettera"),+ ("Drop Lines", "Righe capolettera"),+ ("Lines:", "Righe:"),+ ("Scale for Descenders", "Ridimensiona per i discendenti"),+ ("Select an object or text to color its fill or stroke.", "Seleziona un oggetto o del testo per colorarne il riempimento o la traccia."),+ ("dropcap", "capolettera"),+ ("Left-aligned tab", "Tabulazione allineata a sinistra"),+ ("Centered tab", "Tabulazione centrata"),+ ("Right-aligned tab", "Tabulazione allineata a destra"),+ ("Tab aligned on a character", "Tabulazione allineata a un carattere"),+ ("X:", "X:"),+ ("Leader:", "Carattere di riempimento:"),+ ("Align On:", "Allinea a:"),+ ("Position panel above text frame", "Posiziona il pannello sopra la cornice di testo"),+ ("Clear All", "Cancella tutto"),+ ("Delete Tab", "Elimina tabulazione"),+ ("Repeat Tab", "Ripeti tabulazione"),+ ("Reset Indents", "Ripristina rientri"),+ // File › New › Document+ ("Recent", "Recenti"),+ ("Saved", "Salvati"),+ ("[Default]", "[Predefinito]"),+ ("Your Recent Items", "Elementi recenti"),+ ("Saved Presets", "Predefiniti salvati"),+ ("Blank Document Presets", "Predefiniti documento vuoto"),+ (+ "No saved presets yet. Set the details, then click Save Document Preset.",+ "Nessun predefinito salvato. Imposta i dettagli, poi fai clic su Salva predefinito documento.",+ ),+ ("Delete Preset", "Elimina predefinito"),+ ("Preset Details", "Dettagli predefinito"),+ ("Document Name", "Nome documento"),+ ("Save Document Preset", "Salva predefinito documento"),+ ("Save Document Preset As:", "Salva predefinito documento come:"),+ ("Save Preset", "Salva predefinito"),+ ("Start #", "N. iniziale"),+ ("Column Gutter", "Spazio tra colonne"),+ // Layout › Numbering & Section Options+ ("Start Section", "Inizia sezione"),+ ("Automatic Page Numbering", "Numerazione automatica delle pagine"),+ ("Start Page Numbering at:", "Inizia numerazione pagine da:"),+ ("Section Prefix:", "Prefisso sezione:"),+ ("Section Marker:", "Marcatore sezione:"),+ ("Include Prefix when Numbering Pages", "Includi prefisso nella numerazione delle pagine"),+ ("Document Chapter Numbering", "Numerazione capitoli del documento"),+ ("Automatic Chapter Numbering", "Numerazione automatica dei capitoli"),+ ("Start Chapter Numbering at:", "Inizia numerazione capitoli da:"),+ ("Same as Previous Document in the Book", "Uguale al documento precedente nel libro"),+ ("Book Name:", "Nome libro:"),+ ("N/A", "N/D"),];