feat(save): warn before dropping AEC/Civil objects or overwriting on Save-As
Two in-canvas confirmations on the Save-As path: - AEC/Civil drop warning: when the drawing carries unsupported AEC/Civil (application) objects that survive only as verbatim source-version bytes, saving to a different version or to DXF would silently drop them. The dialog reports the count and offers "Save in source version" (keep) vs "Save anyway" (drop). Same-version DWG saves are lossless and skip it. - Overwrite confirmation: when the chosen filename already exists in the target folder, "Replace" / "Cancel" before clobbering it. The two chain (AEC first, then overwrite) via per-flow acknowledgement flags reset whenever the Save dialog opens or closes. Detection is a new io::dropped_on_save_count over the document's Unknown (raw-passthrough) objects/entities. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
ab9285f114
commit
b77187e672
7 changed files with 267 additions and 1 deletions
|
|
@ -332,6 +332,13 @@ pub(super) struct OpenCADStudio {
|
|||
/// The open in-canvas modal dialog, if any (Plan B: shared overlay instead
|
||||
/// of OS windows).
|
||||
active_modal: Option<ModalKind>,
|
||||
/// Set once the user acknowledges the AEC-drop warning, so re-entering the
|
||||
/// save path proceeds instead of re-showing the warning.
|
||||
aec_drop_acknowledged: bool,
|
||||
/// Number of unsupported objects shown in the AEC-drop warning modal.
|
||||
aec_drop_count: usize,
|
||||
/// Set once the user confirms overwriting an existing file on Save-As.
|
||||
overwrite_acknowledged: bool,
|
||||
/// Pixel offset of the active modal from screen-centre (drag-to-move).
|
||||
/// Reset to zero whenever a modal closes so each dialog opens centred.
|
||||
modal_offset: iced::Vector,
|
||||
|
|
@ -923,6 +930,8 @@ pub enum ModalKind {
|
|||
DimStyle,
|
||||
Unsaved,
|
||||
SaveDialog,
|
||||
AecDropWarning,
|
||||
OverwriteWarning,
|
||||
#[cfg_attr(target_arch = "wasm32", allow(dead_code))]
|
||||
AssocPrompt,
|
||||
PointStyle,
|
||||
|
|
@ -1093,6 +1102,18 @@ pub enum Message {
|
|||
UnsavedDialogDiscard,
|
||||
/// User clicked "Cancel" in the unsaved-changes dialog.
|
||||
UnsavedDialogCancel,
|
||||
// ── AEC / unsupported-object drop warning (lossy Save-As) ──────────────
|
||||
/// Save as the source DWG version so the unsupported objects survive.
|
||||
AecDropSameVersion,
|
||||
/// Proceed with the chosen target format, dropping the unsupported objects.
|
||||
AecDropProceed,
|
||||
/// Go back to the Save dialog from the AEC-drop warning.
|
||||
AecDropBack,
|
||||
// ── Overwrite confirmation (Save-As over an existing file) ────────────
|
||||
/// Replace the existing file and save.
|
||||
OverwriteConfirm,
|
||||
/// Go back to the Save dialog from the overwrite warning.
|
||||
OverwriteCancel,
|
||||
/// Save-as path picked for the unsaved-changes → save → close flow.
|
||||
UnsavedPickedSavePath(Option<std::path::PathBuf>),
|
||||
// ─────────────────────────────────────────────────────────────────────
|
||||
|
|
@ -1868,6 +1889,9 @@ impl OpenCADStudio {
|
|||
main_window: None,
|
||||
color_pick_target: None,
|
||||
active_modal: None,
|
||||
aec_drop_acknowledged: false,
|
||||
aec_drop_count: 0,
|
||||
overwrite_acknowledged: false,
|
||||
modal_offset: iced::Vector::ZERO,
|
||||
modal_drag_last: None,
|
||||
modal_dragging: false,
|
||||
|
|
|
|||
Loading…
Reference in a new issue