diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index 969186b432..e3f59edba0 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -1503,6 +1503,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{path?, preset?, range?, useArtboards?, …document.exportPdf options} open the Save PDF dialog with these options (fields = the options, sections are objects; OK writes path, else asks); useArtboards: false: one page of the visible art's bounds, with no Artboards section", ), + ( + "ui.pdfSummary.save", + "Save Summary…", + "", + "{path} write the Summary of the open Save PDF dialog (or PDF preset editor) to path as UTF-8 text without a byte order mark, with LF line endings, line for line as the Summary section shows it: Options and each option that differs from the preset (or the line saying none does), a blank line, then Warnings and each warning (or None.). The Summary the section last drew for the same fields, document, saved PDF and flattener presets, loaded color profiles and available fonts is used without computing the settings again. The web downloads the file under path's file name. The Summary section's Save Summary… button writes the same text to a file picked in a save panel that suggests ` PDF Summary.txt` in the document's folder. The dialog stays open and the document does not change. No such dialog open, a path that is missing, empty or not a string, a path outside the automation write roots and a failed document.pdfSettings are errors that write nothing; a failed write is an error → {path, bytes}", + ), ( "file.exportAs", "Export As…", diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 6797657fad..dcc9bd5153 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -176,6 +176,7 @@ pub(crate) use form::{humanize, number_list_text, plugin_color_button, ppi_suffi pub use new_document::{create_without_dialog as new_document_without_dialog, open as open_new_document, preset_card}; pub(crate) use new_document::{popup_open as new_document_popup_open, preset_name}; pub use png_options::open as open_raster_options; +pub(crate) use save_pdf::{SAVE_SUMMARY as SAVE_PDF_SUMMARY, save_summary as save_pdf_summary, summary_open as pdf_summary_open}; pub use save_pdf::{open as open_save_pdf, open_preset as open_pdf_preset}; pub use tools::open_tool_dialog; diff --git a/crates/ui-egui/src/dialogs/save_pdf.rs b/crates/ui-egui/src/dialogs/save_pdf.rs index 85ff601db0..8f16594f1d 100644 --- a/crates/ui-egui/src/dialogs/save_pdf.rs +++ b/crates/ui-egui/src/dialogs/save_pdf.rs @@ -4,7 +4,8 @@ //! The fields are the `document.exportPdf` options (sections are objects such as `compression`), //! plus `preset`, `range`, `path?` and UI-only `__` keys, so agents fill the dialog with //! `ui.dialog.set`. OK runs `document.exportPdf` through [`io::export_pdf`]; the Summary is -//! `document.pdfSettings`. Save Preset… names the settings as a preset (`pdf.preset.save`). +//! `document.pdfSettings`, and its Save Summary… writes it to a text file (`ui.pdfSummary.save`). +//! Save Preset… names the settings as a preset (`pdf.preset.save`). //! Opened from Export As with Use Artboards off (`__artBounds`), the dialog has no Artboards //! section, and OK writes one page of the visible art's bounds through [`io::export`]; opened //! from Export Selection (`__selection` too), the page is the selection's crop. While Alt (Option @@ -992,26 +993,57 @@ pub(super) fn option_label(option: &str) -> String { } /// `document.pdfSettings` for the dialog with the document's warnings (an export in memory), -/// cached until a field or the document changes. +/// cached until a field, the document, the saved PDF or flattener presets, the loaded color +/// profiles or the available fonts change. fn summary_of(app: &mut VectorcraftApp, ctx: &egui::Context, p: &Value) -> Result { - let revision = app.session.active().map_or(0, |s| s.revision); - let stamp = egui::Id::unique((p.to_string(), revision)); - let key = egui::Id::unique("save-pdf-summary"); + let (key, stamp) = summary_key(app, p); if let Some((s, v)) = ctx.data(|m| m.get_temp::<(egui::Id, Result)>(key)) && s == stamp { return v; } - let mut q = p.clone(); - q["includeDocument"] = json!(true); - let v = app.session.execute("document.pdfSettings", &q).map_err(|e| e.to_string()); + let v = summary_settings(app, p); ctx.data_mut(|m| m.insert_temp(key, (stamp, v.clone()))); v } +/// Where [`summary_of`] keeps the Summary, and the stamp of what it was computed for: the params +/// `p`, the active document and its revision, the saved PDF presets (which `preset` can name), the +/// saved flattener presets (which `flattenerPreset` can name), the loaded color profiles (which +/// `output.destination` and `output.outputIntent` can name) and the available fonts (which decide +/// what is embedded or outlined). +fn summary_key(app: &VectorcraftApp, p: &Value) -> (egui::Id, egui::Id) { + let document = app.session.active().map(|s| (s.uid, s.revision)); + let prefs = &app.session.prefs; + let presets = serde_json::to_string(&(&prefs.pdf_presets, &prefs.flattener_presets)).unwrap_or_default(); + let shared = (vectorcraft_color::cms::profiles_generation(), vectorcraft_text::FontDb::global().generation()); + (egui::Id::unique("save-pdf-summary"), egui::Id::unique((p.to_string(), document, presets, shared))) +} + +/// `document.pdfSettings` for the dialog's `document.exportPdf` params `p`, with the document's +/// warnings (an export in memory). +fn summary_settings(app: &mut VectorcraftApp, p: &Value) -> Result { + let mut q = p.clone(); + q["includeDocument"] = json!(true); + app.session.execute("document.pdfSettings", &q).map_err(|e| e.to_string()) +} + +/// The `document.pdfSettings` params of the Summary: the dialog's export params, without the +/// preset editor's own `name` and `description`, which are not PDF options. +fn summary_params(d: &Dialog) -> Value { + let mut p = params(d); + if d.kind == PRESET_KIND + && let Some(o) = p.as_object_mut() + { + o.remove("name"); + o.remove("description"); + } + p +} + fn summary(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) { let t = Tokens::get(ui.ctx()); - let v = match summary_of(app, ui.ctx(), ¶ms(d)) { + let v = match summary_of(app, ui.ctx(), &summary_params(d)) { Ok(v) => v, Err(e) => { heading(ui, tl!("Error")); @@ -1020,31 +1052,145 @@ fn summary(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) { } }; heading(ui, tl!("Options")); - let mut changed: Vec<&Value> = v["changed"].as_array().map(|a| a.iter().collect()).unwrap_or_default(); - changed.sort_by_key(|c| section_of(c["option"].as_str().unwrap_or_default())); + let changed = changed_options(&v); if changed.is_empty() { - let base = if d.kind == PRESET_KIND { pdf::DEFAULT_PRESET } else { tl!("the preset") }; - note(ui, &crate::i18n::fmt(tl!("Every option matches {base}."), &[("base", base)])); + note(ui, &unchanged_line(d)); } option_rows(ui, changed, option_label); heading(ui, tl!("Warnings")); warning_rows(ui, v["warnings"].as_array().map(Vec::as_slice).unwrap_or_default()); + ui.add_space(8.0); + if widgets::secondary_button(ui, tl!("Save Summary…")).clicked() { + // The text of the Summary drawn now: saving it does not compute the settings again. + let text = summary_text(d, &v); + if let Err(e) = crate::picks::in_dialog(app, d, move |app, d| save_summary_from_dialog(app, d, &text)) { + app.status(e); + } + } +} + +/// The changed options of `document.pdfSettings`'s reply `v`, in the order of the sections. +fn changed_options(v: &Value) -> Vec<&Value> { + let mut changed: Vec<&Value> = v["changed"].as_array().map(|a| a.iter().collect()).unwrap_or_default(); + changed.sort_by_key(|c| section_of(c["option"].as_str().unwrap_or_default())); + changed +} + +/// The Summary's line when no option differs from the preset. +fn unchanged_line(d: &Dialog) -> String { + let base = if d.kind == PRESET_KIND { pdf::DEFAULT_PRESET } else { tl!("the preset") }; + crate::i18n::fmt(tl!("Every option matches {base}."), &[("base", base)]) +} + +/// The Summary of `document.pdfSettings`'s reply `v` as text, line for line as the section shows +/// it in the interface language: Options and each changed option (or the line saying none +/// changed), a blank line, then Warnings and each warning (or "None."). Lines end in LF, including +/// line breaks inside an option's value. +fn summary_text(d: &Dialog, v: &Value) -> String { + let lang = crate::i18n::current(); + let mut lines = vec![tl!("Options").to_string()]; + let changed = changed_options(v); + if changed.is_empty() { + lines.push(unchanged_line(d)); + } + lines.extend(changed.into_iter().map(|c| option_line(c, option_label))); + lines.push(String::new()); + lines.push(tl!("Warnings").to_string()); + let warnings = v["warnings"].as_array().map(Vec::as_slice).unwrap_or_default(); + if warnings.is_empty() { + lines.push(tl!("None.").to_string()); + } + lines.extend(warnings.iter().map(|w| warning_line(lang, w.as_str().unwrap_or_default()))); + let mut text = lines.join("\n").replace("\r\n", "\n").replace('\r', "\n"); + text.push('\n'); + text +} + +/// The UI command that writes the Summary to a text file. +pub(crate) const SAVE_SUMMARY: &str = "ui.pdfSummary.save"; + +/// Is a dialog with the Summary open (Save PDF, or the preset editor)? +pub(crate) fn summary_open(app: &VectorcraftApp) -> bool { + app.ui.dialog.as_ref().is_some_and(|d| d.kind == KIND || d.kind == PRESET_KIND) +} + +/// `ui.pdfSummary.save {path}`: write the open Save PDF dialog's (or preset editor's) Summary as +/// text to `path` (the web downloads it under the path's file name). The Summary the section last +/// drew for the same fields, document, saved PDF and flattener presets, loaded color profiles +/// and available fonts is used as it is; the settings are computed only when there is none. The dialog stays open and the document is not changed → +/// `{path, bytes}`. A missing, empty or non-string `path` is an error that writes nothing. +pub(crate) fn save_summary(app: &mut VectorcraftApp, p: &Value) -> Result { + let key = "path"; + let path = match p.get(key) { + None | Some(Value::Null) => return Err("missing `path`".into()), + Some(Value::String(s)) if s.trim().is_empty() => return Err("path is empty".into()), + Some(Value::String(s)) => Some(s.clone()), + Some(_) => return Err(format!("`{key}` must be a string")), + }; + let d = app.ui.dialog.clone().filter(|_| summary_open(app)).ok_or("the Save PDF dialog is not open")?; + let p = summary_params(&d); + let v = match app.ui_ctx.clone() { + Some(ctx) => summary_of(app, &ctx, &p), + None => summary_settings(app, &p), + }?; + write_summary(app, path, &summary_text(&d, &v)) +} + +/// Save Summary…: the Summary's `text` to a file picked in a save panel (the web downloads it). A +/// write that fails is told in a message over the dialog, which shows again when it closes; a +/// canceled panel writes nothing. +fn save_summary_from_dialog(app: &mut VectorcraftApp, d: &mut Dialog, text: &str) -> Result<(), String> { + let waiting = app.ui.told.len(); + let r = write_summary(app, None, text); + // The message about a failed write: the open dialog when the panel answered after this frame, + // else waiting behind the dialog being drawn. + let told = app.ui.dialog.take_if(|t| t.kind == super::confirm::MESSAGE).or_else(|| { + (app.ui.told.len() > waiting && app.ui.told.last().is_some_and(|t| t.kind == super::confirm::MESSAGE)).then(|| app.ui.told.pop()).flatten() + }); + if let Some(mut told) = told { + told.fields.insert(super::PARENT.into(), serde_json::to_value(&*d).unwrap_or_default()); + *d = told; + } + match r { + Err(e) if e == "cancelled" => Ok(()), + r => r.map(|_| ()), + } +} + +/// Write the Summary's `text` (UTF-8) to `path`, else to a picked ` PDF Summary.txt` +/// next to the document → `{path, bytes}`. +fn write_summary(app: &mut VectorcraftApp, path: Option, text: &str) -> Result { + let title = app.session.active().map(|d| d.title()).unwrap_or_default(); + let stem = std::path::Path::new(&title).file_stem().map_or_else(|| "Untitled".into(), |s| s.to_string_lossy().into_owned()); + let path = io::write_named(app, path, &format!("{stem} PDF Summary.txt"), text.as_bytes())?; + app.status(format!("Saved {path}")); + Ok(json!({ "path": path, "bytes": text.len() })) } /// A Summary line per changed option (`{option, value}`), labelled by `label`. pub(super) fn option_rows<'a>(ui: &mut egui::Ui, changed: impl IntoIterator, label: impl Fn(&str) -> String) { let t = Tokens::get(ui.ctx()); for c in changed { - let value = match &c["value"] { - Value::Bool(b) => if *b { tl!("On") } else { tl!("Off") }.to_string(), - Value::String(s) if c["option"] == "marks.kind" => choice_label(crate::i18n::current(), "marks.kind", s).to_string(), - Value::String(s) => s.clone(), - other => other.to_string(), - }; - ui.label(egui::RichText::new(format!("{} {value}", crate::i18n::colon(&label(c["option"].as_str().unwrap_or_default())))).color(t.text)); + ui.label(egui::RichText::new(option_line(c, &label)).color(t.text)); } } +/// The displayed value of the changed option `c` (`{option, value}`). +fn option_value(c: &Value) -> String { + match &c["value"] { + Value::Bool(b) => if *b { tl!("On") } else { tl!("Off") }.to_string(), + Value::String(s) if c["option"] == "marks.kind" => choice_label(crate::i18n::current(), "marks.kind", s).to_string(), + Value::String(s) => s.clone(), + other => other.to_string(), + } +} + +/// The Summary's line for the changed option `c` (`{option, value}`), labeled by `label`, with the +/// colon the interface language writes. +fn option_line(c: &Value, label: impl Fn(&str) -> String) -> String { + format!("{} {}", crate::i18n::colon(&label(c["option"].as_str().unwrap_or_default())), option_value(c)) +} + /// The Summary's warnings ("None." without any). pub(super) fn warning_rows(ui: &mut egui::Ui, warnings: &[Value]) { let t = Tokens::get(ui.ctx()); diff --git a/crates/ui-egui/src/dialogs/save_pdf/tests.rs b/crates/ui-egui/src/dialogs/save_pdf/tests.rs index 1f04c8c912..b4fa08fb01 100644 --- a/crates/ui-egui/src/dialogs/save_pdf/tests.rs +++ b/crates/ui-egui/src/dialogs/save_pdf/tests.rs @@ -68,6 +68,372 @@ fn every_section_draws() { assert!(warnings.len() == 1 && warnings[0].as_str().unwrap().contains("permissions"), "{warnings:?}"); } +/// `ui.pdfSummary.save` writes the Summary as the section shows it, as UTF-8 text with LF line +/// endings: Options with each changed option in the order of the sections, a blank line, then +/// Warnings. The dialog stays open and the document does not change. +#[test] +fn save_summary_writes_the_summary_as_text() { + let (mut app, written, _) = app(); + app.run("file.export.pdf", json!({})).unwrap(); + set_field(&mut app, "thumbnails", json!(true)); + set_field(&mut app, "security.printing", json!("low")); + let revision = app.session.active().unwrap().revision; + let r = app.run(SAVE_SUMMARY, json!({"path": "/tmp/Ünïcode (1) summary.txt"})).unwrap(); + assert_eq!(r["path"], "/tmp/Ünïcode (1) summary.txt", "the path is used as given"); + let w = written.borrow(); + assert_eq!(w.len(), 1); + assert_eq!(w[0].0, "/tmp/Ünïcode (1) summary.txt"); + assert_eq!(r["bytes"], w[0].1.len()); + let text = String::from_utf8(w[0].1.clone()).expect("UTF-8"); + assert!(!text.contains('\r') && text.ends_with('\n'), "LF line endings: {text:?}"); + let lines: Vec<&str> = text.lines().collect(); + assert_eq!(lines[..5], ["Options", "General › Thumbnails: On", "Security › Printing: low", "", "Warnings"], "{text}"); + assert!(lines.len() == 6 && lines[5].starts_with("⚠ ") && lines[5].contains("permissions"), "{text}"); + assert_eq!(app.ui.dialog.as_ref().map(|d| d.kind.as_str()), Some(KIND), "the dialog stays open"); + assert_eq!(app.session.active().unwrap().revision, revision, "the document does not change"); + assert_eq!(app.ui.status, "Saved /tmp/Ünïcode (1) summary.txt"); +} + +/// A text option whose value holds CRLF or CR line breaks is written with LF line breaks, so the +/// file has one kind of line ending. +#[test] +fn save_summary_writes_line_breaks_in_values_as_lf() { + let (mut app, written, _) = app(); + app.run("file.export.pdf", json!({})).unwrap(); + set_field(&mut app, "output.outputCondition", json!("first\r\nsecond\rthird")); + app.run(SAVE_SUMMARY, json!({"path": "/tmp/summary.txt"})).unwrap(); + let text = String::from_utf8(written.borrow()[0].1.clone()).unwrap(); + assert!(!text.contains('\r'), "LF line endings: {text:?}"); + assert!(text.contains("first\nsecond\nthird\n"), "{text:?}"); +} + +/// With every option as the preset has it and nothing to warn about, the file holds the lines +/// that say so, in the interface language. +#[test] +fn save_summary_writes_the_lines_for_no_changes_and_no_warnings() { + let (mut app, written, _) = app(); + app.run("file.export.pdf", json!({})).unwrap(); + app.run(SAVE_SUMMARY, json!({"path": "/tmp/summary.txt"})).unwrap(); + let text = String::from_utf8(written.borrow()[0].1.clone()).unwrap(); + assert_eq!(text, "Options\nEvery option matches the preset.\n\nWarnings\nNone.\n"); + crate::i18n::set_current(crate::i18n::Lang::from_code("de").expect("de registered")); + let r = app.run(SAVE_SUMMARY, json!({"path": "/tmp/zusammenfassung.txt"})); + crate::i18n::set_current(crate::i18n::Lang::EN); + r.unwrap(); + let de = String::from_utf8(written.borrow()[1].1.clone()).unwrap(); + let de_lang = crate::i18n::Lang::from_code("de").unwrap(); + let expected = format!( + "{}\n{}\n\n{}\n{}\n", + crate::i18n::tr(de_lang, "Options"), + crate::i18n::fmt(crate::i18n::tr(de_lang, "Every option matches {base}."), &[("base", crate::i18n::tr(de_lang, "the preset"))]), + crate::i18n::tr(de_lang, "Warnings"), + crate::i18n::tr(de_lang, "None."), + ); + assert_eq!(de, expected); + assert_ne!(de, text, "the labels are translated"); +} + +/// The preset editor's Summary is saved too, measured against the app's default preset, and the +/// editor stays open. +#[test] +fn save_summary_writes_the_preset_editors_summary() { + let (mut app, written, _) = app(); + open_preset(&mut app, &json!({})).unwrap(); + set_field(&mut app, "thumbnails", json!(true)); + app.run(SAVE_SUMMARY, json!({"path": "/tmp/preset summary.txt"})).unwrap(); + let text = String::from_utf8(written.borrow()[0].1.clone()).unwrap(); + assert_eq!(text, "Options\nGeneral › Thumbnails: On\n\nWarnings\nNone.\n"); + set_field(&mut app, "thumbnails", json!(false)); + app.run(SAVE_SUMMARY, json!({"path": "/tmp/preset summary.txt"})).unwrap(); + let text = String::from_utf8(written.borrow()[1].1.clone()).unwrap(); + assert_eq!(text, format!("Options\nEvery option matches {}.\n\nWarnings\nNone.\n", pdf::DEFAULT_PRESET)); + assert_eq!(app.ui.dialog.as_ref().map(|d| d.kind.as_str()), Some(PRESET_KIND), "the editor stays open"); +} + +/// A path that is empty or not a string, and no Save PDF dialog open, are errors that write +/// nothing. +#[test] +fn save_summary_refuses_a_bad_path_and_a_closed_dialog() { + let (mut app, written, _) = app(); + assert_eq!(app.run(SAVE_SUMMARY, json!({"path": "/tmp/s.txt"})).unwrap_err(), "the Save PDF dialog is not open"); + app.run("file.export.pdf", json!({})).unwrap(); + assert_eq!(app.run(SAVE_SUMMARY, json!({"path": ""})).unwrap_err(), "path is empty"); + assert_eq!(app.run(SAVE_SUMMARY, json!({"path": " "})).unwrap_err(), "path is empty"); + assert_eq!(app.run(SAVE_SUMMARY, json!({"path": 5})).unwrap_err(), "`path` must be a string"); + assert!(written.borrow().is_empty()); + assert_eq!(app.ui.dialog.as_ref().map(|d| d.kind.as_str()), Some(KIND)); +} + +/// The command needs a path: omitted or null, it is an error that shows no save panel and writes +/// nothing. +#[test] +fn save_summary_requires_a_path() { + let (mut app, written, _) = app(); + let asked: Rc> = Rc::default(); + let a = asked.clone(); + app.services.pick_save = Some(Box::new(move |pick: &crate::FilePick| { + *a.borrow_mut() += 1; + Some(format!("/tmp/{}", pick.name)) + })); + app.run("file.export.pdf", json!({})).unwrap(); + assert_eq!(app.run(SAVE_SUMMARY, json!({})).unwrap_err(), "missing `path`"); + assert_eq!(app.run(SAVE_SUMMARY, json!({"path": null})).unwrap_err(), "missing `path`"); + assert_eq!(*asked.borrow(), 0, "no save panel"); + assert!(written.borrow().is_empty()); + assert_eq!(app.ui.dialog.as_ref().map(|d| d.kind.as_str()), Some(KIND)); +} + +/// The command uses the Summary the section drew for the same fields and document, without +/// computing the settings again (an export in memory), and computes them once a field changes. +#[test] +fn save_summary_uses_the_summary_the_section_drew() { + let (mut app, written, _) = app(); + app.run("file.export.pdf", json!({})).unwrap(); + set_field(&mut app, "__section", json!("Summary")); + let ctx = egui::Context::default(); + theme::install_fonts(&ctx); + app.ui_ctx = Some(ctx.clone()); + let mut out = ctx.run_ui(egui::RawInput::default(), |ui| super::super::show(&mut app, ui.ctx())); + out.textures_delta.clear(); + // The drawn Summary, replaced with one that no computation gives. + let (key, stamp) = summary_key(&app, ¶ms(app.ui.dialog.as_ref().unwrap())); + let drawn = ctx.data(|m| m.get_temp::<(egui::Id, Result)>(key)).expect("the section's Summary"); + assert_eq!(drawn.0, stamp, "drawn for these fields"); + let kept: Result = Ok(json!({"changed": [{"option": "thumbnails", "value": "kept"}], "warnings": []})); + ctx.data_mut(|m| m.insert_temp(key, (stamp, kept))); + app.run(SAVE_SUMMARY, json!({"path": "/tmp/a.txt"})).unwrap(); + let text = String::from_utf8(written.borrow()[0].1.clone()).unwrap(); + assert_eq!(text, "Options\nGeneral › Thumbnails: kept\n\nWarnings\nNone.\n"); + set_field(&mut app, "thumbnails", json!(true)); + app.run(SAVE_SUMMARY, json!({"path": "/tmp/b.txt"})).unwrap(); + let text = String::from_utf8(written.borrow()[1].1.clone()).unwrap(); + assert!(text.starts_with("Options\nGeneral › Thumbnails: On\n"), "computed for the changed field: {text}"); +} + +/// The Summary drawn for one document is not used for another that becomes active with the same +/// revision and the same fields. +#[test] +fn save_summary_does_not_use_another_documents_summary() { + let (mut app, written, _) = app(); + let first = app.session.active_index().unwrap(); + let revision = app.session.active().unwrap().revision; + app.run("file.new", json!({"width": 120, "height": 90})).unwrap(); + let second = app.session.active_index().unwrap(); + app.session.set_active(first); + app.run("file.export.pdf", json!({})).unwrap(); + let ctx = egui::Context::default(); + app.ui_ctx = Some(ctx.clone()); + let (key, stamp) = summary_key(&app, ¶ms(app.ui.dialog.as_ref().unwrap())); + let kept: Result = Ok(json!({"changed": [{"option": "thumbnails", "value": "kept"}], "warnings": []})); + ctx.data_mut(|m| m.insert_temp(key, (stamp, kept))); + app.session.set_active(second); + app.session.active_mut().unwrap().revision = revision; + app.run(SAVE_SUMMARY, json!({"path": "/tmp/a.txt"})).unwrap(); + let text = String::from_utf8(written.borrow()[0].1.clone()).unwrap(); + assert!(!text.contains("kept"), "the other document's Summary: {text}"); +} + +/// The Summary is computed again when the saved preset it compares against is replaced while the +/// dialog stays open. +#[test] +fn save_summary_compares_against_a_replaced_preset() { + let (mut app, written, _) = app(); + app.run("pdf.preset.save", json!({"name": "Mine", "thumbnails": true})).unwrap(); + app.run("ui.savePdfDialog", json!({"preset": "Mine"})).unwrap(); + set_field(&mut app, "thumbnails", json!(false)); + app.ui_ctx = Some(egui::Context::default()); + app.run(SAVE_SUMMARY, json!({"path": "/tmp/a.txt"})).unwrap(); + let text = String::from_utf8(written.borrow()[0].1.clone()).unwrap(); + assert!(text.starts_with("Options\nGeneral › Thumbnails: Off\n"), "{text}"); + app.run("pdf.preset.save", json!({"name": "Mine", "thumbnails": false})).unwrap(); + app.run(SAVE_SUMMARY, json!({"path": "/tmp/b.txt"})).unwrap(); + let text = String::from_utf8(written.borrow()[1].1.clone()).unwrap(); + assert!(text.starts_with("Options\nEvery option matches the preset.\n"), "compared against the replaced preset: {text}"); +} + +/// The Summary is computed again when the saved flattener preset the dialog names is deleted while +/// the dialog stays open: the settings are then refused, and nothing is written. +#[test] +fn save_summary_sees_a_deleted_flattener_preset() { + let (mut app, written, _) = app(); + app.run("flattener.presets.save", json!({"name": "Mine Flat", "preset": "Low Resolution"})).unwrap(); + app.run("file.export.pdf", json!({})).unwrap(); + set_field(&mut app, "flattenerPreset", json!("Mine Flat")); + app.ui_ctx = Some(egui::Context::default()); + app.run(SAVE_SUMMARY, json!({"path": "/tmp/a.txt"})).unwrap(); + app.run("flattener.presets.delete", json!({"name": "Mine Flat"})).unwrap(); + let e = app.run(SAVE_SUMMARY, json!({"path": "/tmp/b.txt"})).unwrap_err(); + assert!(e.contains("Mine Flat"), "the deleted preset is refused: {e}"); + assert_eq!(written.borrow().len(), 1, "nothing written for the deleted preset"); +} + +/// The Summary is computed again when a loaded profile the dialog converts to is removed while the +/// dialog stays open: the settings are then refused, and nothing is written. +#[test] +fn save_summary_sees_a_removed_profile() { + use vectorcraft_color::cms; + let name = "Summary Stamp CMYK"; + // The built-in CMYK profile's file renamed `name`: padded with spaces, which names drop. + let utf16 = |s: &str| s.encode_utf16().flat_map(u16::to_be_bytes).collect::>(); + let mut bytes = cms::icc_bytes(cms::DEVICE_CMYK).unwrap().to_vec(); + let (from, to) = (utf16(cms::DEVICE_CMYK), utf16(&format!("{name: PDF +/// Summary.txt`, the file holds the text the section shows, and the dialog stays open. A canceled +/// panel writes nothing; a failed write is told over the dialog, which shows again when the +/// message closes. The web downloads the file under the suggested name. +#[test] +fn the_save_summary_button_writes_the_summary() { + let (mut app, written, _) = app(); + let suggested: Rc>> = Rc::default(); + let s = suggested.clone(); + app.services.pick_save = Some(Box::new(move |pick: &crate::FilePick| { + s.borrow_mut().push(pick.name.clone()); + Some(format!("/tmp/{}", pick.name)) + })); + app.run("file.export.pdf", json!({})).unwrap(); + set_field(&mut app, "__section", json!("Summary")); + set_field(&mut app, "thumbnails", json!(true)); + let ctx = egui::Context::default(); + theme::install_fonts(&ctx); + click_save_summary(&mut app, &ctx); + let title = app.session.active().unwrap().title(); + let stem = std::path::Path::new(&title).file_stem().unwrap().to_string_lossy().into_owned(); + let name = format!("{stem} PDF Summary.txt"); + assert_eq!(suggested.borrow()[..], *std::slice::from_ref(&name)); + { + let w = written.borrow(); + assert_eq!(w.len(), 1, "written once"); + assert_eq!(w[0].0, format!("/tmp/{name}")); + let text = String::from_utf8(w[0].1.clone()).unwrap(); + assert!(text.starts_with("Options\nGeneral › Thumbnails: On\n\nWarnings\n"), "{text}"); + } + assert_eq!(app.ui.dialog.as_ref().map(|d| d.kind.as_str()), Some(KIND), "the dialog stays open"); + // Canceled: nothing written, no status, the dialog stays. + app.services.pick_save = Some(Box::new(|_: &crate::FilePick| None)); + app.ui.status.clear(); + click_save_summary(&mut app, &ctx); + assert_eq!(written.borrow().len(), 1, "a canceled panel writes nothing"); + assert!(app.ui.status.is_empty(), "{}", app.ui.status); + assert_eq!(app.ui.dialog.as_ref().map(|d| d.kind.as_str()), Some(KIND)); + // A failed write: a message names the file, over the dialog. + app.services.pick_save = Some(Box::new(|pick: &crate::FilePick| Some(format!("/tmp/{}", pick.name)))); + app.services.write = Some(Box::new(|_: &str, _: &[u8]| Err("disk full".into()))); + click_save_summary(&mut app, &ctx); + let told = app.ui.dialog.clone().expect("a message"); + assert_eq!(told.kind, super::super::confirm::MESSAGE, "status {:?}, waiting {:?}", app.ui.status, app.ui.told); + assert!(told.str("message").contains(&name), "{:?}", told.fields); + assert_eq!(super::super::parent(&told).map(|d| d.kind), Some(KIND.to_string()), "the dialog is under the message"); + super::super::cancel(&mut app); + assert_eq!(app.ui.dialog.as_ref().map(|d| d.kind.as_str()), Some(KIND), "the dialog shows again"); + // The web downloads it under the suggested name. + let downloads: Log = Log::default(); + let dl = downloads.clone(); + app.services.download = Some(Box::new(move |n: &str, b: &[u8]| { + dl.borrow_mut().push((n.to_string(), b.to_vec())); + Ok(()) + })); + click_save_summary(&mut app, &ctx); + let d = downloads.borrow(); + assert_eq!(d.len(), 1); + assert_eq!(d[0].0, name); + assert!(String::from_utf8(d[0].1.clone()).unwrap().starts_with("Options\n")); +} + +/// The saved Summary writes each option line with the colon the interface language uses, as the +/// Summary section shows it: French puts a no-break space before the colon, Japanese writes a +/// full-width colon. +#[test] +fn the_summary_text_uses_the_languages_colon() { + let changed = json!({"option": "thumbnails", "value": true}); + for (code, colon) in [("en", ":"), ("fr", "\u{a0}:"), ("ja", ":")] { + crate::i18n::set_current(crate::i18n::Lang::from_code(code).expect("registered")); + let line = option_line(&changed, |_| "X".to_string()); + crate::i18n::set_current(crate::i18n::Lang::EN); + assert!(line.starts_with(&format!("X{colon} ")), "{code}: {line:?}"); + } +} + +/// Click the Summary section's Save Summary… button in frames of the dialog layer (the dialog's +/// window draws nothing in its first frame, which sizes it). +fn click_save_summary(app: &mut VectorcraftApp, ctx: &egui::Context) { + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1400.0, 1000.0)); + let run = |app: &mut VectorcraftApp, events: Vec| { + let mut out = ctx.run_ui(egui::RawInput { screen_rect: Some(screen), events, ..Default::default() }, |ui| super::super::show(app, ui.ctx())); + out.textures_delta.clear(); + crate::tests_removeanchors::shapes_text(&out.shapes.iter().map(|c| c.shape.clone()).collect::>()) + }; + run(app, vec![]); + let labels = run(app, vec![]); + let at = + labels.iter().find(|(t, _)| t.trim() == "Save Summary…").map(|(_, r)| r.center()).unwrap_or_else(|| panic!("no Save Summary… in {labels:?}")); + let button = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE }; + run(app, vec![egui::Event::PointerMoved(at), button(true)]); + run(app, vec![button(false)]); +} + #[test] fn confirm_runs_export_pdf_with_the_dialog_options() { let (mut app, written, opened) = app(); diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 43d819807c..14b9a46db4 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -3322,6 +3322,7 @@ digits Malayalam Малаялам Save Preset Запази предварителна настройка Save Document Preset Запази предварителна настройка на документа Save Preset… Запази предварителна настройка… + Save Summary… Запази обобщението… Save Print Preset Запази предварителна настройка за печат Save Recovery Data Запази данни за възстановяване Save Save for Web Preset Запази предварителна настройка за „Запази за уеб“ @@ -5046,6 +5047,7 @@ axis Both И двете @msg the PDF is password-protected: give its password PDF файлът е защитен с парола: въведете паролата му @msg the PDF password is wrong паролата за PDF файла е грешна @msg the Save PDF dialog didn't open диалоговият прозорец за запазване на PDF не се отвори +@msg the Save PDF dialog is not open диалоговият прозорец за запазване на PDF не е отворен @msg the WMF header is damaged WMF заглавната част е повредена @msg the art could not be sampled графиката не можа да бъде проучена @msg the art has no bounds графиката няма граници diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 6bf0d4ee87..fa006cab86 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -2746,6 +2746,7 @@ digits Malayalam Malajalam Rasters Rasteri Replaces the saved preset of that name. Zamjenjuje sačuvani predložak tog naziva. Save Preset… Sačuvaj postavku… + Save Summary… Sačuvaj sažetak… Vectors Vektori A saved copy of the selected preset Sačuvana kopija odabranog predloška Built-in presets don't change: New makes a copy you can edit. Ugrađeni predlošci se ne mijenjaju: Novo pravi kopiju koju možete uređivati. @@ -5490,6 +5491,7 @@ imageTrace Outline Obris @msg the PDF is password-protected: give its password PDF je zaštićen lozinkom: navedite njegovu lozinku @msg the PDF password is wrong PDF lozinka je pogrešna @msg the Save PDF dialog didn't open dijalog Sačuvaj PDF se nije otvorio +@msg the Save PDF dialog is not open dijalog Sačuvaj PDF nije otvoren @msg the WMF header is damaged WMF zaglavlje je oštećeno @msg the art could not be sampled crtež nije moguće uzorkovati @msg the art has no bounds crtež nema granice diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 642654d881..ecfc0287f3 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -4230,6 +4230,7 @@ digits Malayalam Malaiàlam Save Preset Desa el preajust Save Document Preset Desa el preajust de document Save Preset… Desa el preajust… + Save Summary… Desa el resum… Save Print Preset Desa el preajust d’impressió Save Recovery Data Desa les dades de recuperació Save Save for Web Preset Desa el preajust Desa per a web @@ -6636,6 +6637,7 @@ liquify-list-end {0}, {1} {0} i {1} @msg missing `library` (see brush.libraries) falta `library` (vegeu brush.libraries) @msg missing `library` (see symbol.libraries) falta `library` (vegeu symbol.libraries) @msg missing `name` falta `name` +@msg missing `path` falta `path` @msg missing `tool` falta `tool` @msg missing index falta l’index @msg missing integer `{key}` falta el nombre enter `{key}` @@ -7242,6 +7244,7 @@ liquify-list-end {0}, {1} {0} i {1} @msg the PSD file's image data uses an unknown compression ({m}) les dades d’imatge del fitxer PSD utilitzen una compressió desconeguda ({m}) @msg the PSD image is too large to read ({_1} × {_2} pixels) la imatge PSD és massa gran per llegir-la ({_1} × {_2} píxels) @msg the Save PDF dialog didn't open el diàleg Desa PDF no s’ha obert +@msg the Save PDF dialog is not open el diàleg Desa PDF no està obert @msg the scale is not a usable number l’escala no és un nombre utilitzable @msg the screen color sampler is already open el mostrejador de color de pantalla ja és obert @msg the search couldn't start: try again in a moment la cerca no s’ha pogut iniciar: torna-ho a provar d’aquí a un moment diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 99be9ab4d7..2779e1aaf2 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -2829,6 +2829,7 @@ digits Malayalam Malajálamské Save As Preset… Uložit jako předvolbu… Save Changes Uložit změny Save Preset… Uložit přednastavení… + Save Summary… Uložit souhrn… Vectors Vektory A saved copy of the selected preset Uložená kopie vybraného přednastavení Built-in presets don't change: New makes a copy you can edit. Vestavěná přednastavení se nemění: tlačítko Nový vytvoří kopii, kterou lze upravit. @@ -5825,6 +5826,7 @@ liquify-list-end {0}, {1} {0} a {1} @msg the PDF is password-protected: give its password PDF je chráněno heslem: zadejte heslo @msg the PDF password is wrong heslo k PDF je chybné @msg the Save PDF dialog didn't open dialogové okno Uložit PDF se neotevřelo +@msg the Save PDF dialog is not open dialogové okno Uložit PDF není otevřené @msg the WMF header is damaged hlavička WMF je poškozená @msg the art could not be sampled z kresby nelze nabrat vzorek @msg the art has no bounds kresba nemá hranice diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index b6e5751a2a..bc25e7f975 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -5344,6 +5344,7 @@ digits Malayalam Malayalam Save As Preset… Gem som forudindstilling… Save Changes Gem ændringer Save Preset… Gem forudindstilling… + Save Summary… Gem oversigt… Vectors Vektorer A saved copy of the selected preset En gemt kopi af den valgte forudindstilling Built-in presets don't change: New makes a copy you can edit. Indbyggede forudindstillinger ændres ikke: Ny opretter en kopi, du kan redigere. @@ -7957,6 +7958,7 @@ imageTrace Outline Kontur @msg the PDF is password-protected: give its password PDF'en er beskyttet med adgangskode: angiv dens adgangskode @msg the PDF password is wrong PDF-adgangskoden er forkert @msg the Save PDF dialog didn't open dialogen Gem PDF blev ikke åbnet +@msg the Save PDF dialog is not open dialogen Gem PDF er ikke åben @msg the WMF header is damaged WMF-headeren er beskadiget @msg the art could not be sampled der kunne ikke tages prøve af grafikken @msg the art has no bounds grafikken har ingen grænser diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index f42ee98339..2a870ccbe4 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -3393,6 +3393,7 @@ digits Malayalam Malayalam Save Document Preset Dokumentvorgabe speichern Preset {number} Vorgabe {number} Save Preset… Vorgabe speichern… + Save Summary… Übersicht speichern… Save Print Preset Druckvorgabe speichern Save Recovery Data Wiederherstellungsdaten speichern Save Save for Web Preset Vorgabe für „Für Web speichern“ speichern @@ -5403,6 +5404,7 @@ liquify-list-end {0}, {1} {0} und {1} @msg the PDF is password-protected: give its password die PDF-Datei ist kennwortgeschützt: Geben Sie ihr Kennwort an @msg the PDF password is wrong das PDF-Kennwort ist falsch @msg the Save PDF dialog didn't open das Dialogfeld „PDF speichern“ wurde nicht geöffnet +@msg the Save PDF dialog is not open das Dialogfeld „PDF speichern“ ist nicht geöffnet @msg the WMF header is damaged der WMF-Header ist beschädigt @msg the art could not be sampled die Grafik konnte nicht abgetastet werden @msg the art has no bounds die Grafik hat keine Begrenzung diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 3506b3ccb8..2bf71db0d5 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -2243,6 +2243,7 @@ font-technology Variable Μεταβλητές Save As… Αποθήκευση ως… Save for Web (Legacy)… Αποθήκευση για ιστό (παλαιού τύπου)… Save Preset… Αποθήκευση προεπιλογής… + Save Summary… Αποθήκευση σύνοψης… Save Selection… Αποθήκευση επιλογής… Update Selection Ενημέρωση επιλογής Saved Αποθηκεύτηκε @@ -5181,6 +5182,7 @@ digits Malayalam Μαλαγιάλαμ @msg missing `folder` λείπει το `folder` @msg missing `id` (see plugin.list) λείπει το `id` (δείτε plugin.list) @msg missing `name` λείπει το `name` +@msg missing `path` λείπει το `path` @msg missing `tool` λείπει το `tool` @msg missing id λείπει το id @msg missing index λείπει ο δείκτης @@ -5456,6 +5458,7 @@ digits Malayalam Μαλαγιάλαμ @msg the PDF is password-protected: give its password το PDF προστατεύεται με κωδικό: πληκτρολογήστε τον κωδικό του @msg the PDF password is wrong ο κωδικός PDF είναι λανθασμένος @msg the Save PDF dialog didn't open δεν άνοιξε το παράθυρο Αποθήκευση PDF +@msg the Save PDF dialog is not open το παράθυρο Αποθήκευση PDF δεν είναι ανοιχτό @msg the WMF header is damaged η κεφαλίδα WMF είναι κατεστραμμένη @msg the art could not be sampled δεν ήταν δυνατή η δειγματοληψία του σχεδίου @msg the art has no bounds το σχέδιο δεν έχει όρια diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 2ad80b7aaf..d84e61a1c5 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -3429,6 +3429,7 @@ digits Malayalam Malayálam Save Preset Guardar preajuste Save Document Preset Guardar preajuste de documento Save Preset… Guardar preajuste… + Save Summary… Guardar resumen… Save Print Preset Guardar preajuste de impresión Save Recovery Data Guardar datos de recuperación Save Save for Web Preset Guardar preajuste de Guardar para web @@ -5518,6 +5519,7 @@ liquify-list-end {0}, {1} {0}, {1} @msg the PDF is password-protected: give its password el PDF está protegido con contraseña: indica su contraseña @msg the PDF password is wrong la contraseña del PDF es incorrecta @msg the Save PDF dialog didn't open el cuadro de diálogo Guardar PDF no se abrió +@msg the Save PDF dialog is not open el cuadro de diálogo Guardar PDF no está abierto @msg the WMF header is damaged el encabezado WMF está dañado @msg the art could not be sampled no se pudo muestrear la ilustración @msg the art has no bounds la ilustración no tiene límites diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 0ad24dc4cb..9af266a6dc 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -2782,6 +2782,7 @@ digits Malayalam Malajalam Save As Preset… Tallenna esiasetuksena… Save Changes Tallenna muutokset Save Preset… Tallenna esiasetus… + Save Summary… Tallenna yhteenveto… Vectors Vektorit A saved copy of the selected preset Tallennettu kopio valitusta esiasetuksesta Built-in presets don't change: New makes a copy you can edit. Sisäiset esiasetukset eivät muutu: Uusi luo muokattavan kopion. @@ -5466,6 +5467,7 @@ liquify-list-end {0}, {1} {0} ja {1} @msg missing `folder` `folder` puuttuu @msg missing `id` (see plugin.list) `id` puuttuu (ks. plugin.list) @msg missing `name` `name` puuttuu +@msg missing `path` `path` puuttuu @msg missing `tool` `tool` puuttuu @msg missing id id puuttuu @msg missing index indeksi puuttuu @@ -5740,6 +5742,7 @@ liquify-list-end {0}, {1} {0} ja {1} @msg the PDF is password-protected: give its password tämä PDF-tiedosto on suojattu salasanalla: anna sen salasana @msg the PDF password is wrong annettu PDF-salasana on väärä @msg the Save PDF dialog didn't open valintaikkuna Tallenna PDF ei avautunut +@msg the Save PDF dialog is not open valintaikkuna Tallenna PDF ei ole auki @msg the WMF header is damaged tiedoston WMF-otsake on vaurioitunut @msg the art could not be sampled kuvitusta ei voitu näytteistää @msg the art has no bounds kuvituksella ei ole rajoja diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 791eb28462..a91ce79333 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -3417,6 +3417,7 @@ digits Malayalam Malayalam Save Preset Enregistrer le paramètre prédéfini Save Document Preset Enregistrer le paramètre prédéfini du document Save Preset… Enregistrer le paramètre prédéfini… + Save Summary… Enregistrer le résumé… Save Print Preset Enregistrer le paramètre prédéfini d’impression Save Recovery Data Enregistrer les données de récupération Save Save for Web Preset Enregistrer le paramètre prédéfini d’Enregistrer pour le web @@ -5473,6 +5474,7 @@ liquify-list-end {0}, {1} {0} et {1} @msg the PDF is password-protected: give its password le PDF est protégé par un mot de passe : indiquez-le @msg the PDF password is wrong le mot de passe du PDF est incorrect @msg the Save PDF dialog didn't open la boîte de dialogue Enregistrer au format PDF ne s’est pas ouverte +@msg the Save PDF dialog is not open la boîte de dialogue Enregistrer au format PDF n’est pas ouverte @msg the WMF header is damaged l’en-tête WMF est endommagé @msg the art could not be sampled impossible d’échantillonner l’illustration @msg the art has no bounds l’illustration n’a pas de limites diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index c705e6eab0..11ea63328c 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -3488,6 +3488,7 @@ Save Perspective Grid Preset પર્સ્પેક્ટિવ ગ્રિડ પ્રીસેટ સાચવો Save Preset પ્રીસેટ સાચવો Save Preset… પ્રીસેટ સાચવો… + Save Summary… સારાંશ સાચવો… Save Print Preset પ્રિન્ટ પ્રીસેટ સાચવો Save Recovery Data પુનઃપ્રાપ્તિ ડેટા સાચવો Save Save for Web Preset વેબ માટેનો પ્રીસેટ સાચવો diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 5c1f695b5c..cec0468304 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -4861,6 +4861,7 @@ antiAlias Sharp शार्प Save Preset प्रीसेट सेव करें Save Document Preset डॉक्यूमेंट प्रीसेट सेव करें Save Preset… प्रीसेट सेव करें… + Save Summary… सारांश सेव करें… Save Print Preset सेव करें प्रिंट प्रीसेट Save Recovery Data रिकवरी डेटा सेव करें Save Save for Web Preset सेव फॉर वेब प्रीसेट @@ -9246,6 +9247,7 @@ liquify-list-end {0}, {1} {0} और {1} @msg the RTF file is too large to place as type (at most {_1} MB) RTF फ़ाइल टाइप के रूप में प्लेस करने के लिए बहुत बड़ी है (अधिकतम {_1} MB) @msg the runtime panicked रनटाइम क्रैश हो गया @msg the Save PDF dialog didn't open सेव करें PDF संवाद खुला नहीं था +@msg the Save PDF dialog is not open सेव करें PDF संवाद खुला नहीं है @msg the scale is not a usable number स्केल एक प्रयोग योग्य संख्या नहीं है @msg the screen color sampler is already open स्क्रीन रंग नमूना पहले से ही खुला है @msg the search couldn't start: try again in a moment खोज शुरू नहीं हो सका: एक पल में फिर से प्रयास करें diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 1762fcce8b..7dc44ee2c9 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -4048,6 +4048,7 @@ mark-style Japanese Japán Save Document Preset Dokumentum-előbeállítás mentése Preset {number} Előbeállítás {number} Save Preset… Előbeállítás mentése… + Save Summary… Összegzés mentése… Save Print Preset Nyomtatási előbeállítás mentése Save Recovery Data Helyreállítási adatok mentése Save Save for Web Preset Webes mentési előbeállítás mentése @@ -6382,6 +6383,7 @@ liquify-list-end {0}, {1} {0} és {1} @msg HEIC and HEIF images can't be opened in this build a HEIC- és HEIF-képek ebben a buildben nem nyithatók meg @msg the PSD image is too large to read ({_1} × {_2} pixels) a PSD-kép túl nagy a beolvasáshoz ({_1} × {_2} pixel) @msg the Save PDF dialog didn't open a PDF mentése párbeszédablak nem nyílt meg +@msg the Save PDF dialog is not open a PDF mentése párbeszédablak nincs megnyitva @msg the scale is not a usable number a méretarány nem használható szám @msg the search couldn't start: try again in a moment a keresés nem indult el: próbáld újra egy kicsit később @msg the selected stroke's profile is already listed as {_1} a kijelölt körvonal profilja már szerepel a listán: {_1} diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index a7b07fd8d7..3d6a937445 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -2561,6 +2561,7 @@ digits Malayalam Malayalam Save As Preset… Simpan sebagai Preset… Save Changes Simpan Perubahan Save Preset… Simpan preset… + Save Summary… Simpan ringkasan… Vectors Vektor A saved copy of the selected preset Salinan tersimpan dari preset terpilih Built-in presets don't change: New makes a copy you can edit. Preset bawaan tidak berubah: Baru membuat salinan yang dapat Anda edit. @@ -5159,6 +5160,7 @@ imageTrace Outline Kontur @msg the PDF is password-protected: give its password PDF dilindungi kata sandi: berikan kata sandinya @msg the PDF password is wrong kata sandi PDF salah @msg the Save PDF dialog didn't open dialog Simpan PDF tidak terbuka +@msg the Save PDF dialog is not open dialog Simpan PDF tidak sedang terbuka @msg the WMF header is damaged header WMF rusak @msg the art could not be sampled karya seni tidak dapat diambil sampelnya @msg the art has no bounds karya seni tidak memiliki batas diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index d6cdc91a87..59d83c3133 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -3478,6 +3478,7 @@ digits Malayalam Malayalam Save Document Preset Salva preset documento Preset {number} Preset {number} Save Preset… Salva preset… + Save Summary… Salva riepilogo… Save Print Preset Salva preset di stampa Save Recovery Data Salva dati di recupero Save Save for Web Preset Salva preset di Salva per il web @@ -5540,6 +5541,7 @@ liquify-list-end {0}, {1} {0} e {1} @msg the PDF is password-protected: give its password il PDF è protetto da password: specifica la password @msg the PDF password is wrong la password del PDF è errata @msg the Save PDF dialog didn't open la finestra di dialogo Salva PDF non si è aperta +@msg the Save PDF dialog is not open la finestra di dialogo Salva PDF non è aperta @msg the WMF header is damaged l'intestazione WMF è danneggiata @msg the art could not be sampled impossibile campionare la grafica @msg the art has no bounds la grafica non ha limiti diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index d3e416fb48..30ebde2317 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -3412,6 +3412,7 @@ mark-style Japanese 日本式 Save Document Preset ドキュメントプリセットを保存 Preset {number} プリセット {number} Save Preset… 保存… + Save Summary… サマリーを保存… Save Print Preset プリントプリセットを保存 Save Recovery Data 復帰用データを保存 Save Save for Web Preset Web 用に保存プリセットを保存 @@ -5500,6 +5501,7 @@ variable-list-end {0}, {1} {0}、{1} @msg no file manager here この環境にはファイルマネージャーがありません @msg no revert command 「保存済みの状態に戻す」コマンドがありません @msg the Save PDF dialog didn't open PDF 保存ダイアログが開きませんでした +@msg the Save PDF dialog is not open PDF 保存ダイアログが開いていません @msg the document has never been saved ドキュメントはまだ一度も保存されていません @msg the export returned unreadable data 書き出し処理から読み取れないデータが返されました @msg {status} ({e}) {status} ({e}) diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index d643f6bd3a..a656db08b5 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -4730,6 +4730,7 @@ digits Malayalam მალაიალამური Save As Preset… შენახვა წინასწარ პარამეტრად… Save Changes ცვლილებების შენახვა Save Preset… პრესეტის შენახვა… + Save Summary… შეჯამების შენახვა… Vectors ვექტორები A saved copy of the selected preset მონიშნული პრესეტის შენახული ასლი Built-in presets don't change: New makes a copy you can edit. ჩაშენებული პრესეტები არ იცვლება: „ახალი“ ქმნის რედაქტირებად ასლს. @@ -7257,6 +7258,7 @@ font-technology Variable ცვლადი @msg the PDF is password-protected: give its password PDF პაროლით არის დაცული: მიუთითეთ პაროლი @msg the PDF password is wrong PDF-ის პაროლი არასწორია @msg the Save PDF dialog didn't open PDF-ის შენახვის დიალოგი არ გაიხსნა +@msg the Save PDF dialog is not open PDF-ის შენახვის დიალოგი გახსნილი არ არის @msg the WMF header is damaged WMF-ის სათაური დაზიანებულია @msg the art could not be sampled ნახატიდან ნიმუშის აღება ვერ მოხერხდა @msg the art has no bounds ნახატს საზღვრები არ აქვს diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 0679fdd359..f46e07a3e9 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -3401,6 +3401,7 @@ mark-style Japanese 일본식 Save Document Preset 문서 사전 설정 저장 Preset {number} 사전 설정 {number} Save Preset… 사전 설정 저장… + Save Summary… 요약 저장… Save Print Preset 인쇄 사전 설정 저장 Save Recovery Data 복구 데이터 저장 Save Save for Web Preset 웹용 저장 사전 설정 저장 @@ -5429,6 +5430,7 @@ variable-list-end {0}, {1} {0} 및 {1} @msg no file manager here 여기에는 파일 관리자가 없습니다 @msg no revert command 되돌리기 명령이 없습니다 @msg the Save PDF dialog didn't open PDF 저장 대화상자가 열리지 않았습니다 +@msg the Save PDF dialog is not open PDF 저장 대화상자가 열려 있지 않습니다 @msg the document has never been saved 문서가 저장된 적이 없습니다 @msg the export returned unreadable data 내보내기가 읽을 수 없는 데이터를 반환했습니다 @msg {status} ({e}) {status}({e}) diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 452e4e5f63..445f468e05 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -3215,6 +3215,7 @@ digits Malayalam Malayalam Save As Preset… Opslaan als voorinstelling… Save Changes Wijzigingen opslaan Save Preset… Voorinstelling opslaan… + Save Summary… Samenvatting opslaan… Vectors Vectoren A saved copy of the selected preset Een opgeslagen kopie van de geselecteerde voorinstelling Built-in presets don't change: New makes a copy you can edit. Ingebouwde voorinstellingen veranderen niet: Nieuw maakt een kopie die je kunt bewerken. @@ -5833,6 +5834,7 @@ imageTrace Outline Contour @msg the PDF is password-protected: give its password de PDF is met een wachtwoord beveiligd: geef het wachtwoord op @msg the PDF password is wrong het PDF-wachtwoord is onjuist @msg the Save PDF dialog didn't open het dialoogvenster PDF opslaan is niet geopend +@msg the Save PDF dialog is not open het dialoogvenster PDF opslaan is niet open @msg the WMF header is damaged de WMF-header is beschadigd @msg the art could not be sampled de illustratie kon niet worden bemonsterd @msg the art has no bounds de illustratie heeft geen begrenzing diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 0e0f210f69..0969c6b297 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -2744,6 +2744,7 @@ digits Malayalam Malajalam Save As Preset… Zapisz jako ustawienie predefiniowane… Save Changes Zapisz zmiany Save Preset… Zapisz ustawienie… + Save Summary… Zapisz podsumowanie… Vectors Wektory A saved copy of the selected preset Zapisana kopia zaznaczonego ustawienia Built-in presets don't change: New makes a copy you can edit. Wbudowanych ustawień nie można zmieniać: Nowe tworzy edytowalną kopię. @@ -5645,6 +5646,7 @@ liquify-list-end {0}, {1} {0} i {1} @msg the PDF is password-protected: give its password PDF jest chroniony hasłem: podaj hasło @msg the PDF password is wrong hasło PDF jest nieprawidłowe @msg the Save PDF dialog didn't open okno Zapisz PDF nie otworzyło się +@msg the Save PDF dialog is not open okno Zapisz PDF nie jest otwarte @msg the WMF header is damaged nagłówek WMF jest uszkodzony @msg the art could not be sampled nie udało się pobrać próbki kompozycji @msg the art has no bounds kompozycja nie ma granic diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 9d4a2b1505..de12ec68bb 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -2890,6 +2890,7 @@ digits Malayalam Malaiala Save Preset Salvar Predefinido Save Document Preset Salvar Predefinido de Documento Save Preset… Salvar Predefinido… + Save Summary… Salvar Resumo… Save Print Preset Salvar Predefinido de Impressão Save Recovery Data Salvar Dados de Recuperação Save Save for Web Preset Salvar Predefinido de Salvar para Web @@ -4786,6 +4787,7 @@ axis Both Ambos @msg the PDF is password-protected: give its password o PDF é protegido por senha: informe a senha @msg the PDF password is wrong a senha do PDF está incorreta @msg the Save PDF dialog didn't open a caixa de diálogo Salvar PDF não abriu +@msg the Save PDF dialog is not open a caixa de diálogo Salvar PDF não está aberta @msg the WMF header is damaged o cabeçalho WMF está danificado @msg the art could not be sampled não foi possível amostrar a arte @msg the art has no bounds a arte não tem limites diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 95319e1133..dd294c716b 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -3460,6 +3460,7 @@ digits Malayalam Малаялам Save Document Preset Сохранить набор документа Preset {number} Набор {number} Save Preset… Сохранить набор… + Save Summary… Сохранить сводку… Save Print Preset Сохранить набор печати Save Recovery Data Сохранить данные восстановления Save Save for Web Preset Сохранить набор «Сохранить для web» @@ -5537,6 +5538,7 @@ liquify-list-end {0}, {1} {0} и {1} @msg the PDF is password-protected: give its password PDF защищён паролем: укажите его пароль @msg the PDF password is wrong неверный пароль PDF @msg the Save PDF dialog didn't open диалоговое окно «Сохранить PDF» не открылось +@msg the Save PDF dialog is not open диалоговое окно «Сохранить PDF» не открыто @msg the WMF header is damaged заголовок WMF повреждён @msg the art could not be sampled не удалось взять образец рисунка @msg the art has no bounds у рисунка нет границ diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 4b7631d8f7..705e1ee452 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -3348,6 +3348,7 @@ digits Malayalam Malayalam Save Preset Spara förinställning Save Document Preset Spara dokumentförinställning Save Preset… Spara förinställning… + Save Summary… Spara sammanfattning… Save Print Preset Spara utskriftsförinställning Save Recovery Data Spara återställningsdata Save Save for Web Preset Spara förinställning för Spara för webben @@ -5392,6 +5393,7 @@ liquify-list-end {0}, {1} {0} och {1} @msg the PDF is password-protected: give its password PDF-filen är lösenordsskyddad: ange lösenordet @msg the PDF password is wrong PDF-lösenordet är fel @msg the Save PDF dialog didn't open dialogrutan Spara PDF öppnades inte +@msg the Save PDF dialog is not open dialogrutan Spara PDF är inte öppen @msg the WMF header is damaged WMF-huvudet är skadat @msg the art could not be sampled grafiken kunde inte samplas @msg the art has no bounds grafiken har ingen avgränsning diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 37a25a5797..2f959de54f 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -663,6 +663,21 @@ fn compound_shape_no_area_warning_is_translated() { } } +/// The Save PDF dialog's Save Summary… button and `ui.pdfSummary.save`'s error when no such +/// dialog is open. +#[test] +fn pdf_save_summary_strings_are_in_complete_catalogs() { + for lang in LANGUAGES.iter().filter(|lang| lang.complete_menus) { + assert!(lang.catalog().plain("Save Summary…").is_some(), "{} is missing Save Summary…", lang.code); + } + let closed = "the Save PDF dialog is not open"; + assert!(message_literals().contains(closed)); + for code in COMPLETE_MESSAGES { + let lang = Lang::from_code(code).expect("registered"); + assert_ne!(message(lang, closed), closed, "{code}"); + } +} + /// The status messages the Shape Builder tool gives when a gesture builds nothing come from the /// tools crate, which [`message_literals`] does not scan, so every complete catalog is checked for /// them here. diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 2bf6202686..484ee1ed4f 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -3188,6 +3188,7 @@ digits Malayalam Malayalam Save Preset Ön Ayarı Kaydet Save Document Preset Belge Ön Ayarını Kaydet Save Preset… Ön Ayarı Kaydet… + Save Summary… Özeti Kaydet… Save Print Preset Yazdırma Ön Ayarını Kaydet Save Recovery Data Kurtarma Verilerini Kaydet Save Save for Web Preset Kaydet Web Ön Ayarı için Kaydet @@ -5236,6 +5237,7 @@ liquify-list-end {0}, {1} {0} ve {1} @msg the PDF is password-protected: give its password PDF şifre korumalıdır: şifresini verin @msg the PDF password is wrong PDF şifresi yanlış @msg the Save PDF dialog didn't open PDF'yi Kaydet iletişim kutusu açılmadı +@msg the Save PDF dialog is not open PDF'yi Kaydet iletişim kutusu açık değil @msg the WMF header is damaged WMF başlığı hasarlı @msg the art could not be sampled sanat örneği alınamadı @msg the art has no bounds sanatın sınırı yoktur diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 8666dd32f2..7de5db5b85 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -3470,6 +3470,7 @@ digits Malayalam Малаялам Save Document Preset Зберегти набір документа Preset {number} Набір {number} Save Preset… Зберегти набір… + Save Summary… Зберегти зведення… Save Print Preset Зберегти набір друку Save Recovery Data Зберегти дані відновлення Save Save for Web Preset Зберегти набір «Зберегти для Інтернету» @@ -5524,6 +5525,7 @@ liquify-list-end {0}, {1} {0} і {1} @msg the PDF is password-protected: give its password PDF захищений паролем: вкажіть його пароль @msg the PDF password is wrong неправильний пароль PDF @msg the Save PDF dialog didn't open діалогове вікно «Зберегти PDF» не відкрилося +@msg the Save PDF dialog is not open діалогове вікно «Зберегти PDF» не відкрите @msg the WMF header is damaged заголовок WMF пошкоджений @msg the art could not be sampled не вдалося взяти зразок малюнка @msg the art has no bounds малюнок не має меж diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index e097b6962d..71d8b72fa3 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3818,6 +3818,7 @@ mark-style Japanese Kiểu Nhật Save Document Preset Lưu thiết lập sẵn tài liệu Preset {number} Thiết lập sẵn {number} Save Preset… Lưu thiết lập sẵn… + Save Summary… Lưu tóm tắt… Save Print Preset Lưu thiết lập sẵn in Save Recovery Data Lưu dữ liệu khôi phục Save Save for Web Preset Lưu thiết lập sẵn Lưu cho Web @@ -5612,6 +5613,7 @@ liquify-list-end {0}, {1} {0} và {1} @msg missing `folder` thiếu `folder` @msg missing `id` (see plugin.list) thiếu `id` (xem plugin.list) @msg missing `name` thiếu `name` +@msg missing `path` thiếu `path` @msg missing `tool` thiếu `tool` @msg missing id thiếu id @msg missing index thiếu chỉ mục @@ -6170,6 +6172,7 @@ liquify-list-end {0}, {1} {0} và {1} @msg HEIC and HEIF images can't be opened in this build không thể mở ảnh HEIC và HEIF trong bản dựng này @msg the PSD image is too large to read ({_1} × {_2} pixels) ảnh PSD quá lớn để đọc ({_1} × {_2} pixel) @msg the Save PDF dialog didn't open hộp thoại Lưu PDF không mở +@msg the Save PDF dialog is not open hộp thoại Lưu PDF chưa được mở @msg the scale is not a usable number tỷ lệ không phải là số dùng được @msg the search couldn't start: try again in a moment tìm kiếm không thể bắt đầu: hãy thử lại sau ít lâu @msg the selected stroke's profile is already listed as {_1} hồ sơ của nét đã chọn đã được liệt kê là {_1} diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 0709559367..243e356dc7 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -3325,6 +3325,7 @@ digits Malayalam 马拉雅拉姆数字 Save Document Preset 保存文档预设 Preset {number} 预设 {number} Save Preset… 存储预设… + Save Summary… 存储摘要… Save Print Preset 保存打印预设 Save Recovery Data 保存恢复数据 Save Save for Web Preset 保存 Web 预设 @@ -5178,6 +5179,7 @@ imageTrace Outline 轮廓 @msg no file manager here 此处没有文件管理器 @msg no revert command 没有恢复命令 @msg the Save PDF dialog didn't open “保存 PDF”对话框未打开 +@msg the Save PDF dialog is not open “保存 PDF”对话框没有打开 @msg the document has never been saved 该文档从未保存过 @msg the export returned unreadable data 导出返回了无法读取的数据 @msg {status} ({e}) {status} ({e}) diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index fb35c60377..5f81b70561 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -2627,6 +2627,7 @@ file-filter Templates 範本 @msg no file manager here 此處沒有檔案管理員 @msg no revert command 沒有回復指令 @msg the Save PDF dialog didn't open 「儲存 PDF」對話框未開啟 +@msg the Save PDF dialog is not open 「儲存 PDF」對話框沒有開啟 @msg the document has never been saved 文件從未儲存過 @msg the export returned unreadable data 匯出傳回了無法讀取的資料 @msg {status} ({e}) {status} ({e}) @@ -4725,6 +4726,7 @@ digits Malayalam 馬來亞拉姆數字 Save Document Preset 儲存文件預設集 Preset {number} 預設集 {number} Save Preset… 儲存預設集… + Save Summary… 儲存摘要… Save Print Preset 儲存列印預設集 Save Recovery Data 儲存救援資料 Save Save for Web Preset 儲存「儲存為網頁用」預設集 diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index 5e73712448..6cb16f633d 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -983,6 +983,7 @@ fn run_ui_part10(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option crate::panels::color::rgb_percent_command(app, p), "ui.colorWheel" => crate::panels::color_wheel::command(app, p), "ui.savePdfDialog" => crate::dialogs::open_save_pdf(app, p), + crate::dialogs::SAVE_PDF_SUMMARY => crate::dialogs::save_pdf_summary(app, p), "file.exportAs" if s("path").is_none() => { crate::dialogs::open_export_as(app, s("format").as_deref(), p); Ok(Value::Null) diff --git a/crates/ui-egui/src/menus/state.rs b/crates/ui-egui/src/menus/state.rs index c5d0bfeaa8..8b8e3f98b4 100644 --- a/crates/ui-egui/src/menus/state.rs +++ b/crates/ui-egui/src/menus/state.rs @@ -275,6 +275,7 @@ pub fn enabled(app: &VectorcraftApp, id: &str) -> bool { "file.export.pdf" | "ui.savePdfDialog" | "ui.fileInfoDialog" | "ui.rasterEffectsSettingsDialog" | "ui.svgFilterDialog" => { app.session.active().is_some() } + crate::dialogs::SAVE_PDF_SUMMARY => crate::dialogs::pdf_summary_open(app), "ui.importSvgFilter" => { app.session.active().is_some() && crate::picks::can(app, &crate::picks::PickRequest::Open(crate::dialogs::svg_filter::pick())) } diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 519068f0ba..66bd9a73d1 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -1504,6 +1504,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{path?, preset?, range?, useArtboards?, …document.exportPdf options} open the Save PDF dialog with these options (fields = the options, sections are objects; OK writes path, else asks); useArtboards: false: one page of the visible art's bounds, with no Artboards section", ), + ( + "ui.pdfSummary.save", + "Save Summary…", + "", + "{path} write the Summary of the open Save PDF dialog (or PDF preset editor) to path as UTF-8 text without a byte order mark, with LF line endings, line for line as the Summary section shows it: Options and each option that differs from the preset (or the line saying none does), a blank line, then Warnings and each warning (or None.). The Summary the section last drew for the same fields, document, saved PDF and flattener presets, loaded color profiles and available fonts is used without computing the settings again. The web downloads the file under path's file name. The Summary section's Save Summary… button writes the same text to a file picked in a save panel that suggests ` PDF Summary.txt` in the document's folder. The dialog stays open and the document does not change. No such dialog open, a path that is missing, empty or not a string, a path outside the automation write roots and a failed document.pdfSettings are errors that write nothing; a failed write is an error → {path, bytes}", + ), ( "file.exportAs", "Export As…", diff --git a/docs/mcp.md b/docs/mcp.md index 6ad67e3d40..cc0cbd08c7 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -1411,6 +1411,14 @@ PDF/X-4, where an image in the output intent's profile is DeviceCMYK): a CMYK JP resampled and compressed again (CMYK JPEG or ZIP). `output.conversion` converts them like CMYK colours: `destination` to another CMYK profile or to RGB, `preserveNumbers` (and PDF/X-1a) keeps their numbers in a CMYK destination. `document.pdfSettings` lists the options that differ from the preset and the warnings without writing a file. +The Summary section's Save Summary… button writes what the section shows to a text file (UTF-8 without a byte order +mark, LF line endings), and its save panel suggests ` PDF Summary.txt` in the document's folder; the web +downloads the file under that name. `ui.pdfSummary.save {path}` writes the same text for the open Save PDF dialog or +PDF preset editor to `path` and returns `{path, bytes}`. It uses the Summary the section last drew for the same fields, +document, saved PDF and flattener presets, loaded color profiles and available fonts, and computes the settings only +when there is none. No such dialog open, a `path` that is missing, empty +or not a string, a path outside the automation write roots and settings that +`document.pdfSettings` refuses are errors that write nothing. The dialog stays open and the document does not change. `thumbnails: true` embeds each page drawn small (106 px on its long side, without the layers the page leaves out) as its `/Thumb` image. `fastWebView: true` writes a linearised file (the linearization dictionary first, then the first page with hint tables saying where every other page's objects are), which stays linearised when a password encrypts it. diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 2603cf15d9..23eefddb0a 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -2180,6 +2180,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur PDF export and `.ai` saves write a page with a side longer than 14,400 pt with a `UserUnit` (PDF 1.6), its longer side divided by 14,400 and rounded up to the next thousandth, so that no side is longer than 14,400 units (ISO 32000-1, Annex C.2); a PDF 1.5 file with such a page is written as PDF 1.6 with PDF 1.5's encryption, PDF/X files and PDF 1.3 and 1.4 files write it in points (in PDF 1.3 and 1.4, a page past 32,767 pt that needs a real number past 32,767 is refused with an error naming it), a page whose short side is 3 pt or longer but would be under 3 units at that `UserUnit` gets a smaller one that keeps the short side at 3 units, and the export's warnings give each such page's size and how it is written (#6382). The Save PDF dialog's "Write pages longer than 200 in at full size in points" (`longPagesInPoints`, on by default; `.ai` saves leave it off) writes such pages in points without a `UserUnit` at every PDF version, in files without a PDF/X or PDF/A standard, so readers that ignore `UserUnit` show them at full size. Raster export dialogs retain supplied values for their controls, including PNG resolution, background, anti-aliasing and interlacing, and JPEG quality. Omitted values use the dialog defaults; a nonpositive resolution is rejected on confirmation (#8324; `crates/ui-egui/src/dialogs/tests_raster_supplied_options.rs`). Export As PDF with Use Artboards off also opens the Save PDF dialog, without its Artboards section, and writes one page of the visible art's bounds with the dialog's options (`document.exportPdf {useArtboards: false}`; `crates/ui-egui/src/dialogs/tests_export.rs`, `crates/engine/src/cmd/fileio/tests_pdf.rs`). + The Save PDF dialog's Summary section has a Save Summary… button that writes the summary it shows to a text file, as the help page describes (https://helpx.adobe.com/illustrator/using/pdf-options.html). The file holds the section's lines in UTF-8 with LF line endings, and the save panel suggests ` PDF Summary.txt`; both are VectorCraft's own choices (`ui.pdfSummary.save`; `crates/ui-egui/src/dialogs/save_pdf/tests.rs`). While Alt (Option on macOS) is held, the Save PDF dialog's Cancel button reads Reset, which puts every option back to the chosen preset's settings, passwords included, and leaves the dialog open; letting the key go shows Cancel again (`ui.dialogReset`). [The help page](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf#page=283) says that holding Alt or Option and clicking Reset returns the options to their defaults. Resetting to the chosen preset's settings, and keeping the preset, path, artboard range and section, are VectorCraft's own rules (`crates/ui-egui/src/dialogs/save_pdf/tests.rs`, `crates/ui-egui/src/dialogs/tests.rs`). The Save PDF dialog and the PDF preset editor have a link button beside the four bleed values in Marks and Bleeds: while it is on, editing one value sets the other three to it. [The help page](https://web.archive.org/web/20220911143322/https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=249) describes this button for the PDF dialog. VectorCraft's own rules: the link opens on when the four values are equal and off when they differ, also after choosing a preset or Reset; turning it on gives every side the top value; turning it off leaves the values as they are; with Use Document Bleed Settings on, the button is grayed out and the custom values and link stay as they were. The link is not a PDF option or a preset setting; `ui.dialog.set` sets it as `__bleedLinked` (`crates/ui-egui/src/dialogs/save_pdf/tests.rs`). `document.exportSelection` run without params (a shortcut) takes the same route after its save panel: a picked PDF opens the Save PDF dialog without its Artboards section, and SVG, the raster formats, EPS, DXF, text and exporter plug-ins with parameters open their options, whose OK writes the selection alone, cropped to it, with the chosen options (`crates/ui-egui/src/dialogs/tests_export_selection.rs`).