forked from 1b-agent/opencadstudio-upstream
Merge PR #1585 from ramox81/codex/field-command: FIELD command and Field dialog; attribute definition field buttons
The PR pinned the codec to its fork through [patch]; codec #75 is merged upstream and main already points at it, so the patch section is dropped. The two windows-sys features it adds (Globalization, Identity) stay.
This commit is contained in:
commit
0de1e91f99
45 files changed
+2456
-15
No files matched your search
@@ -1025,6 +1025,7 @@ impl OpenCADStudio {
|
||||
| "DWFOSNAP"
|
||||
| "DGNOSNAP"
|
||||
| "UOSNAP"
|
||||
| "FIELDDISPLAY"
|
||||
| "PDFIMPORTMODE"
|
||||
| "PDFIMPORTFILTER"
|
||||
| "PDFIMPORTLAYERS"
|
||||
@@ -1232,6 +1233,40 @@ impl OpenCADStudio {
|
||||
}
|
||||
return Some(self.finish_dispatch(cmd));
|
||||
}
|
||||
if name == "FIELDDISPLAY" {
|
||||
let current = i16::from(crate::entities::field::display());
|
||||
match value.as_deref().map(|v| v.trim().parse::<i16>().ok().filter(|v| (0..=1).contains(v))) {
|
||||
Some(Some(mode)) => {
|
||||
if current != mode {
|
||||
crate::entities::field::set_display(mode == 1);
|
||||
// A profile setting: redraw the fields of every open drawing.
|
||||
for tab in &mut self.tabs {
|
||||
let changes: Vec<_> = tab
|
||||
.scene
|
||||
.document
|
||||
.entities()
|
||||
.filter(|e| crate::entities::field::hosts_field(&tab.scene.document, e))
|
||||
.map(|e| (e.common().handle, crate::scene::ChangeKind::Modified))
|
||||
.collect();
|
||||
if !changes.is_empty() {
|
||||
tab.scene.bump_entities(&changes);
|
||||
}
|
||||
}
|
||||
self.save_config();
|
||||
}
|
||||
}
|
||||
Some(None) => {
|
||||
self.command_line.push_error(crate::t!("Requires 0 or 1 only.").as_ref());
|
||||
self.command_line.push_output(&format!("Enter new value for FIELDDISPLAY <{current}>:"));
|
||||
self.pending_setvar = Some(name.clone());
|
||||
}
|
||||
None => {
|
||||
self.command_line.push_output(&format!("Enter new value for FIELDDISPLAY <{current}>:"));
|
||||
self.pending_setvar = Some(name.clone());
|
||||
}
|
||||
}
|
||||
return Some(self.finish_dispatch(cmd));
|
||||
}
|
||||
if matches!(name.as_str(), "PDFOSNAP" | "DWFOSNAP" | "DGNOSNAP" | "UOSNAP") {
|
||||
use crate::scene::model::pdf_vector as pv;
|
||||
use codec::entities::UnderlayType;
|
||||
|
||||
Reference in new issue
Block a user