Fields: stored values on redraw, evaluation events, per-field shading

MTEXT draws its stored text instead of re-evaluating fields on every
redraw. Fields update on their evaluation events as the reference does:
open (1), save (2, not autosave), plot (4) and REGEN/REGENALL (16), each
masked with the drawing's FIELDEVAL (variable dictionary, 0-31, with the
reference's prompt and message), and the new UPDATEFIELD command
(selection, attributes of selected block references, "N field(s)
found." / "N field(s) updated."). A Date field (on demand only) keeps
its value until UPDATEFIELD. The FIELDDISPLAY gray box now covers each
field's own glyphs, one box per line it spans, instead of the whole
text. Codec moved to the update_fields / field_spans revision.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
ramox81andClaude Opus 5.5 committed 2026-10-06 11:38:01 +03:00
1 parent 71cebbb3fe
commit 1c242eb489
13 files changed
+229 -19

No files matched your search

+4
View File
@@ -794,6 +794,8 @@ pub fn load_bytes_finalized(path: &Path, bytes: Vec<u8>) -> Result<(CadDocument,
normalize_block_origins(&mut doc);
resolve_raster_image_paths(&mut doc, path.parent());
doc.source_path = Some(path.to_string_lossy().into_owned());
// Opening is a field evaluation event (FIELDEVAL bit 1).
crate::entities::field::update_fields(&mut doc, 1, None);
let dropped = purge_corrupt_entities(&mut doc);
Ok((doc, dropped))
}
@@ -1047,6 +1049,8 @@ fn finalize_loaded_outcome(
crate::entities::field::local_header_dates(doc);
resolve_raster_image_paths(doc, path.parent());
doc.source_path = Some(path.to_string_lossy().into_owned());
// Opening is a field evaluation event (FIELDEVAL bit 1).
crate::entities::field::update_fields(doc, 1, None);
Ok(outcome)
}