feat(styles): complete MLeader field coverage + Dimension DIMUNIT

MLeader Style editor now exposes every MultiLeaderStyle field: line
weight, line type / arrowhead block / text style / block-content blocks
(handle dropdowns from the document's tables), the four text attachments
+ attachment direction, the full block-content group (color, connection,
rotation, X/Y/Z scale, enable scale/rotation), leader & multileader draw
order, align space, and description.

Dimension Style editor adds the last uncovered DIMUNIT field.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-03 21:04:22 +03:00
1 parent a584e772ba
commit 6ae24cceee
5 files changed
+390 -17

No files matched your search

+2
View File
@@ -120,6 +120,7 @@ pub struct DimStyleValues<'a> {
pub dimfrac: &'a str,
pub dimaunit: &'a str,
pub dimadec: &'a str,
pub dimunit: &'a str,
pub dimazin: &'a str,
pub dimalt: bool,
pub dimaltf: &'a str,
@@ -560,6 +561,7 @@ pub fn view_window<'a>(
row![lbl("Fraction format (DIMFRAC)"), mk_field(DsField::Dimfrac, vals.dimfrac)].spacing(8).align_y(iced::Center),
row![lbl("Angular unit (DIMAUNIT)"), mk_field(DsField::Dimaunit, vals.dimaunit)].spacing(8).align_y(iced::Center),
row![lbl("Angular decimals (DIMADEC)"), mk_field(DsField::Dimadec, vals.dimadec)].spacing(8).align_y(iced::Center),
row![lbl("Unit format (DIMUNIT)"), mk_field(DsField::Dimunit, vals.dimunit)].spacing(8).align_y(iced::Center),
row![lbl("Angular zero supp (DIMAZIN)"), mk_field(DsField::Dimazin, vals.dimazin)].spacing(8).align_y(iced::Center),
text("Fit").size(11).color(ACCENT),
row![lbl("Fit (DIMATFIT)"), mk_field(DsField::Dimatfit, vals.dimatfit)].spacing(8).align_y(iced::Center),
+148 -16
View File
@@ -145,6 +145,22 @@ pub struct MLeaderStyleView<'a> {
pub default_text: &'a str,
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,
pub block_scale_x: &'a str,
pub block_scale_y: &'a str,
pub block_scale_z: &'a str,
// Handle dropdown option lists + currently-selected record names.
pub block_opts: Vec<String>,
pub lt_opts: Vec<String>,
pub textstyle_opts: Vec<String>,
pub line_type_name: String,
pub arrowhead_name: String,
pub text_style_name: String,
pub block_content_name: String,
}
fn section<'a>(label: &'static str) -> Element<'a, Message> {
@@ -188,6 +204,46 @@ fn enum_row<'a>(
.into()
}
/// The 11 horizontal text-attachment variants (debug names).
const ATTACH_OPTS: [&str; 11] = [
"TopOfTopLine",
"MiddleOfTopLine",
"MiddleOfText",
"MiddleOfBottomLine",
"BottomOfBottomLine",
"BottomLine",
"BottomOfTopLineUnderlineBottomLine",
"BottomOfTopLineUnderlineTopLine",
"BottomOfTopLineUnderlineAll",
"CenterOfText",
"CenterOfTextOverline",
];
fn opts(list: &[&str]) -> Vec<String> {
list.iter().map(|s| s.to_string()).collect()
}
/// Dropdown for an Option<Handle> field (linetype / arrowhead / text style /
/// block content). Options are record names; "None" clears the handle.
fn handle_row<'a>(
label: &'static str,
options: Vec<String>,
selected: String,
field: &'static str,
) -> Element<'a, Message> {
row![
text(label).size(11).color(DIM).width(150),
pick_list(options, Some(selected), move |value| {
Message::MLeaderStyleSetHandle { field, value }
})
.text_size(11)
.width(190),
]
.spacing(8)
.align_y(iced::Center)
.into()
}
fn chk<'a>(label: &'static str, val: bool, field: &'static str) -> Element<'a, Message> {
checkbox(val)
.label(label)
@@ -277,18 +333,29 @@ pub fn view_window<'a>(v: MLeaderStyleView<'a>) -> Element<'a, Message> {
text(s.name.clone()).size(11),
]
.spacing(8),
num_row("Description:", "", v.description, "description"),
// Leader Format
section("Leader Format"),
enum_row(
"Path type:",
["Invisible", "StraightLineSegments", "Spline"]
.iter()
.map(|s| s.to_string())
.collect(),
opts(&["Invisible", "StraightLineSegments", "Spline"]),
format!("{:?}", s.path_type),
"path_type"
),
num_row("Line color (ACI):", "256", v.line_color, "line_color"),
num_row("Line weight:", "-2", v.line_weight, "line_weight"),
handle_row(
"Line type:",
v.lt_opts.clone(),
v.line_type_name.clone(),
"line_type_handle"
),
handle_row(
"Arrowhead block:",
v.block_opts.clone(),
v.arrowhead_name.clone(),
"arrowhead_handle"
),
num_row("Arrowhead size:", "0.18", v.arrowhead_size, "arrowhead_size"),
num_row("Break gap size:", "0.125", v.break_gap, "break_gap"),
// Leader Structure
@@ -301,41 +368,106 @@ pub fn view_window<'a>(v: MLeaderStyleView<'a>) -> Element<'a, Message> {
num_row("First seg. angle:", "0", v.first_seg_angle, "first_seg_angle"),
num_row("Second seg. angle:", "0", v.second_seg_angle, "second_seg_angle"),
num_row("Scale factor:", "1.0", v.scale_factor, "scale_factor"),
num_row("Align space:", "4.0", v.align_space, "align_space"),
enum_row(
"Leader draw order:",
opts(&["LeaderHeadFirst", "LeaderTailFirst"]),
format!("{:?}", s.leader_draw_order),
"leader_draw_order"
),
enum_row(
"Multileader draw order:",
opts(&["ContentFirst", "LeaderFirst"]),
format!("{:?}", s.multileader_draw_order),
"multileader_draw_order"
),
chk("Annotative", s.is_annotative, "annotative"),
// Content
section("Content"),
enum_row(
"Content type:",
["None", "Block", "MText", "Tolerance"]
.iter()
.map(|s| s.to_string())
.collect(),
opts(&["None", "Block", "MText", "Tolerance"]),
format!("{:?}", s.content_type),
"content_type"
),
num_row("Default text:", "", v.default_text, "default_text"),
handle_row(
"Text style:",
v.textstyle_opts.clone(),
v.text_style_name.clone(),
"text_style_handle"
),
num_row("Text height:", "0.18", v.text_height, "text_height"),
num_row("Text color (ACI):", "256", v.text_color, "text_color"),
enum_row(
"Text angle:",
["ParallelToLastLeaderLine", "Horizontal", "Optimized"]
.iter()
.map(|s| s.to_string())
.collect(),
opts(&["ParallelToLastLeaderLine", "Horizontal", "Optimized"]),
format!("{:?}", s.text_angle_type),
"text_angle_type"
),
enum_row(
"Text alignment:",
["Left", "Center", "Right"]
.iter()
.map(|s| s.to_string())
.collect(),
opts(&["Left", "Center", "Right"]),
format!("{:?}", s.text_alignment),
"text_alignment"
),
enum_row(
"Left attachment:",
opts(&ATTACH_OPTS),
format!("{:?}", s.text_left_attachment),
"text_left_attachment"
),
enum_row(
"Right attachment:",
opts(&ATTACH_OPTS),
format!("{:?}", s.text_right_attachment),
"text_right_attachment"
),
enum_row(
"Top attachment:",
opts(&ATTACH_OPTS),
format!("{:?}", s.text_top_attachment),
"text_top_attachment"
),
enum_row(
"Bottom attachment:",
opts(&ATTACH_OPTS),
format!("{:?}", s.text_bottom_attachment),
"text_bottom_attachment"
),
enum_row(
"Attachment direction:",
opts(&["Horizontal", "Vertical"]),
format!("{:?}", s.text_attachment_direction),
"text_attachment_direction"
),
chk("Text frame", s.text_frame, "text_frame"),
chk("Text always left", s.text_always_left, "text_always_left"),
// Block Content
section("Block Content"),
handle_row(
"Block:",
v.block_opts.clone(),
v.block_content_name.clone(),
"block_content_handle"
),
num_row("Block color (ACI):", "256", v.block_color, "block_color"),
enum_row(
"Block connection:",
opts(&["BlockExtents", "BasePoint"]),
format!("{:?}", s.block_content_connection),
"block_content_connection"
),
num_row("Block rotation:", "0", v.block_rotation, "block_rotation"),
num_row("Block scale X:", "1.0", v.block_scale_x, "block_scale_x"),
num_row("Block scale Y:", "1.0", v.block_scale_y, "block_scale_y"),
num_row("Block scale Z:", "1.0", v.block_scale_z, "block_scale_z"),
chk("Enable block scale", s.enable_block_scale, "enable_block_scale"),
chk(
"Enable block rotation",
s.enable_block_rotation,
"enable_block_rotation"
),
button(text("Apply").size(11))
.on_press(Message::MLeaderStyleApply)
.style(btn_s(true))