forked from 1b-agent/opencadstudio-upstream
feat(dimstyle): add Annotative toggle to the Dimension Style editor
Adds the annotative property (DsField::Annotative) to the dim-style edit buffers, load/apply, and a checkbox on the Fit/Scale tab — consistent with the Text Style editor's annotative toggle. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
52850947d2
commit
07a2a05975
4 files changed
+9
No files matched your search
@@ -390,6 +390,7 @@ pub(super) struct OpenCADStudio {
|
||||
ds_dimtm: String,
|
||||
ds_dimtdec: String,
|
||||
ds_dimtfac: String,
|
||||
ds_annotative: bool,
|
||||
}
|
||||
|
||||
/// What triggered the "unsaved changes" dialog.
|
||||
@@ -432,6 +433,7 @@ pub enum DsField {
|
||||
Dimtm,
|
||||
Dimtdec,
|
||||
Dimtfac,
|
||||
Annotative,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -1100,6 +1102,7 @@ impl OpenCADStudio {
|
||||
ds_dimtm: "0".to_string(),
|
||||
ds_dimtdec: "2".to_string(),
|
||||
ds_dimtfac: "1".to_string(),
|
||||
ds_annotative: false,
|
||||
};
|
||||
app.sync_ribbon_layers();
|
||||
app
|
||||
|
||||
@@ -6500,6 +6500,7 @@ impl OpenCADStudio {
|
||||
self.ds_dimtm = format!("{}", ds.dimtm);
|
||||
self.ds_dimtdec = format!("{}", ds.dimtdec);
|
||||
self.ds_dimtfac = format!("{}", ds.dimtfac);
|
||||
self.ds_annotative = ds.annotative;
|
||||
}
|
||||
|
||||
/// Write edit buffers back into the selected dim style document entry.
|
||||
@@ -6551,6 +6552,7 @@ impl OpenCADStudio {
|
||||
ds.dimlim = self.ds_dimlim;
|
||||
ds.dimpost = self.ds_dimpost.clone();
|
||||
ds.dimtxsty = self.ds_dimtxsty.clone();
|
||||
ds.annotative = self.ds_annotative;
|
||||
self.tabs[tab].dirty = true;
|
||||
self.command_line
|
||||
.push_output(&format!("DimStyle '{}' updated.", self.dimstyle_selected));
|
||||
@@ -6597,6 +6599,7 @@ impl OpenCADStudio {
|
||||
Dimtoh => self.ds_dimtoh = !self.ds_dimtoh,
|
||||
Dimtol => self.ds_dimtol = !self.ds_dimtol,
|
||||
Dimlim => self.ds_dimlim = !self.ds_dimlim,
|
||||
Annotative => self.ds_annotative = !self.ds_annotative,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,6 +215,7 @@ impl OpenCADStudio {
|
||||
dimtm: &self.ds_dimtm,
|
||||
dimtdec: &self.ds_dimtdec,
|
||||
dimtfac: &self.ds_dimtfac,
|
||||
annotative: self.ds_annotative,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ pub struct DimStyleValues<'a> {
|
||||
pub dimtm: &'a str,
|
||||
pub dimtdec: &'a str,
|
||||
pub dimtfac: &'a str,
|
||||
pub annotative: bool,
|
||||
}
|
||||
|
||||
fn btn_s(accent: bool) -> impl Fn(&Theme, button::Status) -> button::Style {
|
||||
@@ -422,6 +423,7 @@ pub fn view_window<'a>(
|
||||
.into(),
|
||||
3 => column![
|
||||
text("Scale").size(11).color(ACCENT),
|
||||
chk("Annotative", vals.annotative, DsField::Annotative),
|
||||
row![
|
||||
lbl("Overall scale (DIMSCALE)"),
|
||||
mk_field(DsField::Dimscale, vals.dimscale)
|
||||
|
||||
Reference in new issue
Block a user