forked from 1b-agent/opencadstudio-upstream
FIELD: Field dialog, FIELD command and the ATTDEF field buttons
A Field dialog with the fields the application evaluates and the reference format choices, FIELD placing a field as multi-line text, the attribute definition dialogs' field buttons, field attachment on commit, system variable / file size / regional date providers for field evaluation, and the codec patch with the field authoring API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
53f2983e9c
commit
87211f4654
40 files changed
+1859
-14
No files matched your search
@@ -226,8 +226,17 @@ impl OpenCADStudio {
|
||||
self.tabs[i].scene.document.header.text_height = attribute.height;
|
||||
}
|
||||
}
|
||||
// A field the committed text shows (FIELD, an ATTDEF Default from the
|
||||
// Field dialog) is attached once the entity has its handle; the field
|
||||
// objects are not part of the add delta, so the step is a snapshot.
|
||||
let text_field = self.tabs[i].active_cmd.as_ref().and_then(|cmd| cmd.text_field());
|
||||
let label = self.history_label_from_active_cmd(i, "ENTITY");
|
||||
let delta_safe = self.delta_add_safe(i, &entity);
|
||||
let delta_safe = text_field.is_none() && self.delta_add_safe(i, &entity);
|
||||
let field_value = match &entity {
|
||||
codec::EntityType::MText(m) => m.value.clone(),
|
||||
codec::EntityType::AttributeDefinition(a) => a.default_value.clone(),
|
||||
_ => String::new(),
|
||||
};
|
||||
let pending = self.begin_undo(i, label, 1, delta_safe);
|
||||
let is_associative_dimension = matches!(
|
||||
entity,
|
||||
@@ -247,6 +256,14 @@ impl OpenCADStudio {
|
||||
.attach_dimension_association(handle, sources);
|
||||
}
|
||||
}
|
||||
if let (Some(handle), Some(field)) = (committed, text_field) {
|
||||
crate::entities::field::set_text_field(
|
||||
&mut self.tabs[i].scene.document,
|
||||
handle,
|
||||
Some(field),
|
||||
&field_value,
|
||||
);
|
||||
}
|
||||
if let Some(handle) = committed {
|
||||
self.apply_continuous_constraints(i, &[handle]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user