mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-29 12:17:14 -06:00
No behaviour change: every command keeps its id, label, menu, shortcut and params doc. - Engine: swatch.* -> cmd/swatch.rs, graphicStyle.* -> cmd/style.rs, appearance.* (incl. copyFrom) -> cmd/appearance.rs, stroke.set/setAdvanced -> cmd/stroke.rs, paint.editGradient/setGradientGeom -> cmd/gradient.rs. Shared helpers in cmd/mod.rs: leaf_targets/paint_targets (replacing three copies) and unique_name (swatch and graphic style naming). - UI: dialogs.rs -> dialogs/ with one file per dialog and a DialogSpec registry (one DialogKind row per dialog); shared field widgets in dialogs/form.rs. Headless frame tests draw and confirm every dialog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 lines
767 B
Rust
20 lines
767 B
Rust
//! Save Changes (closing a modified document): Save / Don't Save / Cancel. The flow lives in
|
|
//! [`crate::unsaved`]; this is its face in the shared dialog frame.
|
|
|
|
use super::DialogSpec;
|
|
|
|
pub(super) const SPEC: DialogSpec = DialogSpec {
|
|
heading: |d| format!("Do you want to save the changes you made to “{}”?", d.str("name")),
|
|
body: |_, ui, _| {
|
|
let t = crate::theme::Tokens::get(ui.ctx());
|
|
ui.label(egui::RichText::new("Your changes will be lost if you don't save them.").color(t.text_dim));
|
|
false
|
|
},
|
|
confirm: |app, _| crate::unsaved::confirm(app),
|
|
ok: Some("Save"),
|
|
discard: Some("Don't Save"),
|
|
// Long document names wrap instead of widening the dialog.
|
|
max_width: Some(420.0),
|
|
..DialogSpec::FORM
|
|
};
|