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 <noreply@anthropic.com>
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

+11
View File
@@ -3396,6 +3396,17 @@ impl Scene {
self.bump_entities_with_parametric_policy(changes, &[], false);
}
/// Update the fields an evaluation event re-evaluates (see
/// [`crate::entities::field::update_fields`]) and redraw the hosts whose
/// text changed. Returns the number of fields the hosts hold.
pub fn update_fields(&mut self, event: i32, hosts: Option<&[Handle]>) -> usize {
let (changed, found) = crate::entities::field::update_fields(&mut self.document, event, hosts);
if !changed.is_empty() {
self.bump_text_hosts(&changed);
}
found
}
/// Redraw text hosts whose stored text changed (re-evaluated fields). An
/// attribute is drawn by its INSERT, and a host inside a block definition
/// by every reference to that block, so those redraw instead of the host;