Correct plot style mode handling
This commit is contained in:
parent
97ec3ed67e
commit
df8e42af8e
2 changed files with 27 additions and 23 deletions
|
|
@ -203,11 +203,15 @@ impl OpenCADStudio {
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| "ByLayer".to_string())
|
.unwrap_or_else(|| "ByLayer".to_string())
|
||||||
};
|
};
|
||||||
let plot_style = match header.current_plotstyle_type {
|
let plot_style = if header.plotstyle_mode {
|
||||||
|
"ByColor"
|
||||||
|
} else {
|
||||||
|
match header.current_plotstyle_type {
|
||||||
1 => "ByBlock",
|
1 => "ByBlock",
|
||||||
2 => "ByColor",
|
2 => "Normal",
|
||||||
3 => "ByObject",
|
3 => "ByObject",
|
||||||
_ => "ByLayer",
|
_ => "ByLayer",
|
||||||
|
}
|
||||||
};
|
};
|
||||||
let layout_plot_table = doc.objects.values().find_map(|object| {
|
let layout_plot_table = doc.objects.values().find_map(|object| {
|
||||||
let acadrust::objects::ObjectType::Layout(layout) = object else {
|
let acadrust::objects::ObjectType::Layout(layout) = object else {
|
||||||
|
|
@ -316,7 +320,7 @@ impl OpenCADStudio {
|
||||||
Property {
|
Property {
|
||||||
label: t!("Plot style").into_owned(),
|
label: t!("Plot style").into_owned(),
|
||||||
field: "plot_style",
|
field: "plot_style",
|
||||||
value: if header.plotstyle_mode {
|
value: if !header.plotstyle_mode {
|
||||||
PropValue::Choice {
|
PropValue::Choice {
|
||||||
selected: plot_style.to_string(),
|
selected: plot_style.to_string(),
|
||||||
options: vec![
|
options: vec![
|
||||||
|
|
@ -327,7 +331,7 @@ impl OpenCADStudio {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PropValue::ReadOnlyWithTooltip {
|
PropValue::ReadOnlyWithTooltip {
|
||||||
value: plot_style.to_string(),
|
value: "ByColor".to_string(),
|
||||||
tooltip: t!("Plot style is locked to color in Color-Dependent (CTB) mode").into_owned(),
|
tooltip: t!("Plot style is locked to color in Color-Dependent (CTB) mode").into_owned(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -344,9 +348,9 @@ impl OpenCADStudio {
|
||||||
read_only(
|
read_only(
|
||||||
t!("Plot table type").as_ref(),
|
t!("Plot table type").as_ref(),
|
||||||
if header.plotstyle_mode {
|
if header.plotstyle_mode {
|
||||||
"Named plot styles".to_string()
|
|
||||||
} else {
|
|
||||||
"Color-dependent plot styles".to_string()
|
"Color-dependent plot styles".to_string()
|
||||||
|
} else {
|
||||||
|
"Named plot styles".to_string()
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
@ -746,11 +750,10 @@ impl OpenCADStudio {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// In named plot-style mode (PSTYLEMODE=1) the Plot style row
|
// Named plot-style mode exposes the drawing's styles. In
|
||||||
// picks a named style from the drawing's plot style table. In
|
// color-dependent mode the object's color determines the
|
||||||
// the color-dependent mode it stays read-only (the object's
|
// style, so the row is locked to ByColor.
|
||||||
// color drives the plot style), so it is left untouched.
|
if !self.tabs[i].scene.document.header.plotstyle_mode {
|
||||||
if self.tabs[i].scene.document.header.plotstyle_mode {
|
|
||||||
let doc = &self.tabs[i].scene.document;
|
let doc = &self.tabs[i].scene.document;
|
||||||
let dict_h = doc.header.acad_plotstylename_dict_handle;
|
let dict_h = doc.header.acad_plotstylename_dict_handle;
|
||||||
let common = entity.common();
|
let common = entity.common();
|
||||||
|
|
@ -797,15 +800,8 @@ impl OpenCADStudio {
|
||||||
if let Some(row) =
|
if let Some(row) =
|
||||||
section.props.iter_mut().find(|p| p.field == "plot_style")
|
section.props.iter_mut().find(|p| p.field == "plot_style")
|
||||||
{
|
{
|
||||||
let common = entity.common();
|
|
||||||
let plot_style_str = match common.plotstyle_flags {
|
|
||||||
0 => "ByLayer",
|
|
||||||
1 => "ByBlock",
|
|
||||||
2 => "Normal",
|
|
||||||
_ => "ByColor",
|
|
||||||
};
|
|
||||||
row.value = crate::scene::model::object::PropValue::ReadOnlyWithTooltip {
|
row.value = crate::scene::model::object::PropValue::ReadOnlyWithTooltip {
|
||||||
value: plot_style_str.to_string(),
|
value: "ByColor".to_string(),
|
||||||
tooltip: t!("Plot style is locked to color in Color-Dependent (CTB) mode").into_owned(),
|
tooltip: t!("Plot style is locked to color in Color-Dependent (CTB) mode").into_owned(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2169,6 +2169,10 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if field == "plot_style" {
|
} else if field == "plot_style" {
|
||||||
|
if self.tabs[i].scene.document.header.plotstyle_mode {
|
||||||
|
self.refresh_properties();
|
||||||
|
return Task::none();
|
||||||
|
}
|
||||||
// Named plot-style pick: ByLayer / ByBlock clear the
|
// Named plot-style pick: ByLayer / ByBlock clear the
|
||||||
// handle; a named style resolves through the drawing's
|
// handle; a named style resolves through the drawing's
|
||||||
// ACAD_PLOTSTYLENAME dictionary to its placeholder handle.
|
// ACAD_PLOTSTYLENAME dictionary to its placeholder handle.
|
||||||
|
|
@ -2349,11 +2353,15 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||||
self.refresh_properties();
|
self.refresh_properties();
|
||||||
}
|
}
|
||||||
"plot_style" => {
|
"plot_style" => {
|
||||||
|
if self.tabs[i].scene.document.header.plotstyle_mode {
|
||||||
|
self.refresh_properties();
|
||||||
|
return Task::none();
|
||||||
|
}
|
||||||
match value.as_str() {
|
match value.as_str() {
|
||||||
"ByBlock" => {
|
"ByBlock" => {
|
||||||
self.tabs[i].scene.document.header.current_plotstyle_type = 1
|
self.tabs[i].scene.document.header.current_plotstyle_type = 1
|
||||||
}
|
}
|
||||||
"Normal" | "ByColor" => {
|
"Normal" => {
|
||||||
self.tabs[i].scene.document.header.current_plotstyle_type = 2
|
self.tabs[i].scene.document.header.current_plotstyle_type = 2
|
||||||
}
|
}
|
||||||
_ => self.tabs[i].scene.document.header.current_plotstyle_type = 0,
|
_ => self.tabs[i].scene.document.header.current_plotstyle_type = 0,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue