diff --git a/src/app/mod.rs b/src/app/mod.rs index a5edc5196..27734313a 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -630,7 +630,6 @@ pub(super) struct OpenCADStudio { mls_line_color: String, mls_text_color: String, mls_description: String, - mls_line_weight: String, mls_align_space: String, mls_block_color: String, mls_block_rotation: String, @@ -2336,6 +2335,7 @@ pub enum Message { field: &'static str, value: String, }, + MLeaderStyleLineWeightChanged(LineWeight), /// Set an Option field (linetype / arrowhead / text style / block) /// from a dropdown of record names ("None" clears it). MLeaderStyleSetHandle { @@ -2677,7 +2677,6 @@ impl OpenCADStudio { mls_line_color: String::new(), mls_text_color: String::new(), mls_description: String::new(), - mls_line_weight: String::new(), mls_align_space: String::new(), mls_block_color: String::new(), mls_block_rotation: String::new(), diff --git a/src/app/update/mod.rs b/src/app/update/mod.rs index 9c4994482..aa6098c76 100644 --- a/src/app/update/mod.rs +++ b/src/app/update/mod.rs @@ -4809,6 +4809,13 @@ impl OpenCADStudio { Message::MLeaderStyleSetEnum { field, value } => { self.on_mleader_style_set_enum(field, value) } + Message::MLeaderStyleLineWeightChanged(line_weight) => { + let i = self.active_tab; + if let Some(s) = self.mleaderstyle_mut(i) { + s.line_weight = line_weight; + } + Task::none() + } Message::MLeaderStyleSetHandle { field, value } => { self.on_mleader_style_set_handle(field, value) } diff --git a/src/app/update/style.rs b/src/app/update/style.rs index ed98de514..90bd1ac0f 100644 --- a/src/app/update/style.rs +++ b/src/app/update/style.rs @@ -178,7 +178,6 @@ impl OpenCADStudio { .map(|c| c.to_string()) .unwrap_or_default(); self.mls_description = s.description.clone(); - self.mls_line_weight = s.line_weight.value().to_string(); self.mls_align_space = format!("{:.4}", s.align_space); self.mls_block_color = s .block_content_color @@ -699,7 +698,6 @@ pub(super) fn on_text_style_dialog_open(&mut self) -> Task { "line_color" => self.mls_line_color = value, "text_color" => self.mls_text_color = value, "description" => self.mls_description = value, - "line_weight" => self.mls_line_weight = value, "align_space" => self.mls_align_space = value, "block_color" => self.mls_block_color = value, "block_rotation" => self.mls_block_rotation = value, @@ -863,7 +861,6 @@ pub(super) fn on_text_style_dialog_open(&mut self) -> Task { self.mls_text_color.parse::().ok(), ); let desc = self.mls_description.clone(); - let lw = self.mls_line_weight.parse::().ok(); let align = self.mls_align_space.parse::().ok(); let bclr = self.mls_block_color.parse::().ok(); let brot = self.mls_block_rotation.parse::().ok(); @@ -906,9 +903,6 @@ pub(super) fn on_text_style_dialog_open(&mut self) -> Task { s.text_color = acadrust::types::Color::from_index(v); } s.description = desc; - if let Some(v) = lw { - s.line_weight = acadrust::types::LineWeight::from_value(v); - } if let Some(v) = align { s.align_space = v; } diff --git a/src/app/view/modal.rs b/src/app/view/modal.rs index db1345b05..80ebb09ff 100644 --- a/src/app/view/modal.rs +++ b/src/app/view/modal.rs @@ -393,7 +393,6 @@ impl OpenCADStudio { line_color: &self.mls_line_color, text_color: &self.mls_text_color, description: &self.mls_description, - line_weight: &self.mls_line_weight, align_space: &self.mls_align_space, block_color: &self.mls_block_color, block_rotation: &self.mls_block_rotation, diff --git a/src/ui/style/mleaderstyle.rs b/src/ui/style/mleaderstyle.rs index c6f3af7a8..e9e7474fa 100644 --- a/src/ui/style/mleaderstyle.rs +++ b/src/ui/style/mleaderstyle.rs @@ -83,7 +83,6 @@ pub struct MLeaderStyleView<'a> { pub line_color: &'a str, pub text_color: &'a str, pub description: &'a str, - pub line_weight: &'a str, pub align_space: &'a str, pub block_color: &'a str, pub block_rotation: &'a str, @@ -176,6 +175,23 @@ fn enum_row<'a>( .into() } +fn lineweight_row<'a>(selected: acadrust::types::LineWeight) -> Element<'a, Message> { + let selected = crate::ui::properties::LwItem(selected); + row![ + text("Line weight:").size(11).color(DIM).width(150), + pick_list( + crate::ui::properties::lw_options(), + Some(selected), + |item| Message::MLeaderStyleLineWeightChanged(item.0) + ) + .text_size(11) + .width(190), + ] + .spacing(8) + .align_y(iced::Center) + .into() +} + /// The 11 horizontal text-attachment variants (debug names). const ATTACH_OPTS: [&str; 11] = [ "TopOfTopLine", @@ -245,7 +261,7 @@ pub fn view_window<'a>(v: MLeaderStyleView<'a>) -> Element<'a, Message> { "path_type" ), color_row("Line color (ACI):", v.line_color, "line_color", v.color_open == Some("line_color")), - num_row("Line weight:", "-2", v.line_weight, "line_weight"), + lineweight_row(s.line_weight), handle_row( "Line type:", v.lt_opts.clone(),