From 768eaf5b2d79958f6e13a0e94f2899ac7afc8ba8 Mon Sep 17 00:00:00 2001 From: ramox81 <184937705+ramox81@users.noreply.github.com> Date: Mon, 14 Sep 2026 21:05:53 +0300 Subject: [PATCH 1/2] feat(annotate): expose annotation panel tools --- src/modules/annotate/mod.rs | 40 ++++++- src/ui/ribbon/annotation_panel.rs | 170 ++++++++++++++++++++++++++++++ src/ui/ribbon/draw_panel.rs | 6 ++ src/ui/ribbon/mod.rs | 1 + 4 files changed, 216 insertions(+), 1 deletion(-) create mode 100644 src/ui/ribbon/annotation_panel.rs diff --git a/src/modules/annotate/mod.rs b/src/modules/annotate/mod.rs index 6ff2016ae..c9e783fc2 100644 --- a/src/modules/annotate/mod.rs +++ b/src/modules/annotate/mod.rs @@ -42,7 +42,7 @@ impl CadModule for AnnotateModule { } fn ribbon_groups(&self) -> &[RibbonGroup] { - use crate::modules::draw::draw::{revcloud, wipeout}; + use crate::modules::draw::draw::{centerline, dimcenter, revcloud, wipeout}; static GROUPS: std::sync::OnceLock> = std::sync::OnceLock::new(); GROUPS.get_or_init(|| { @@ -148,6 +148,44 @@ impl CadModule for AnnotateModule { }, ], }, + // ── Centerlines ─────────────────────────────────────────────── + RibbonGroup { + title: "Centerlines", + tools: vec![ + RibbonItem::LargeTool(dimcenter::tool()), + RibbonItem::LargeTool(centerline::tool()), + RibbonItem::Dropdown { + id: "ANNOTATE_CENTER_ASSOCIATIVITY", + icon: crate::modules::IconKind::Svg(include_bytes!( + "../../../assets/icons/line.svg" + )), + items: vec![ + ( + "CENTERREASSOCIATE", + "Reassociate Center Object", + crate::modules::IconKind::Svg(include_bytes!( + "../../../assets/icons/line.svg" + )), + ), + ( + "CENTERDISASSOCIATE", + "Disassociate Center Object", + crate::modules::IconKind::Svg(include_bytes!( + "../../../assets/icons/line.svg" + )), + ), + ( + "CENTERRESET", + "Reset Center Object", + crate::modules::IconKind::Svg(include_bytes!( + "../../../assets/icons/line.svg" + )), + ), + ], + default: "CENTERREASSOCIATE", + }, + ], + }, // ── Leaders ────────────────────────────────────────────────── RibbonGroup { title: "Leaders", diff --git a/src/ui/ribbon/annotation_panel.rs b/src/ui/ribbon/annotation_panel.rs new file mode 100644 index 000000000..7b0a8839c --- /dev/null +++ b/src/ui/ribbon/annotation_panel.rs @@ -0,0 +1,170 @@ +//! Additional annotation tools reached from the Draw tab's Annotation panel title. + +use super::draw_panel::Tool; + +pub(super) const TOOLS: &[Tool] = &[ + Tool { + command: "DDEDIT", + label: "Edit Text", + icon: include_bytes!("../../../assets/icons/ddedit.svg"), + options: &[], + }, + Tool { + command: "TOLERANCE", + label: "Geometric Tolerance", + icon: include_bytes!("../../../assets/icons/tolerance.svg"), + options: &[], + }, + Tool { + command: "DIMALIGNED", + label: "Aligned Dimension", + icon: include_bytes!("../../../assets/icons/dim_aligned.svg"), + options: &[], + }, + Tool { + command: "DIMARC", + label: "Arc Length Dimension", + icon: include_bytes!("../../../assets/icons/dim_angular.svg"), + options: &[], + }, + Tool { + command: "DIMJOGGED", + label: "Jogged Radius Dimension", + icon: include_bytes!("../../../assets/icons/dim_jog.svg"), + options: &[], + }, + Tool { + command: "DIMDIAMETER", + label: "Diameter Dimension", + icon: include_bytes!("../../../assets/icons/dim_diameter.svg"), + options: &[], + }, + Tool { + command: "DIMORDINATE", + label: "Ordinate Dimension", + icon: include_bytes!("../../../assets/icons/dim_ordinate.svg"), + options: &[], + }, + Tool { + command: "QDIM", + label: "Quick Dimension", + icon: include_bytes!("../../../assets/icons/qdim.svg"), + options: &[], + }, + Tool { + command: "DIMCONTINUE", + label: "Continue Dimension", + icon: include_bytes!("../../../assets/icons/dim_continue.svg"), + options: &[], + }, + Tool { + command: "DIMBASELINE", + label: "Baseline Dimension", + icon: include_bytes!("../../../assets/icons/dim_baseline.svg"), + options: &[], + }, + Tool { + command: "DIMBREAK", + label: "Dimension Break", + icon: include_bytes!("../../../assets/icons/dim_break.svg"), + options: &[], + }, + Tool { + command: "DIMEDIT", + label: "Edit Dimension", + icon: include_bytes!("../../../assets/icons/dim_edit.svg"), + options: &[], + }, + Tool { + command: "DIMTEDIT", + label: "Edit Dimension Text", + icon: include_bytes!("../../../assets/icons/dim_tedit.svg"), + options: &[], + }, + Tool { + command: "DIMSPACE", + label: "Adjust Dimension Space", + icon: include_bytes!("../../../assets/icons/dim_space.svg"), + options: &[], + }, + Tool { + command: "DIMJOGLINE", + label: "Add or Remove Jog Line", + icon: include_bytes!("../../../assets/icons/dim_jog.svg"), + options: &[], + }, + Tool { + command: "MLEADERADD", + label: "Add Leader", + icon: include_bytes!("../../../assets/icons/mleader_add.svg"), + options: &[], + }, + Tool { + command: "MLEADERREMOVE", + label: "Remove Leader", + icon: include_bytes!("../../../assets/icons/mleader_remove.svg"), + options: &[], + }, + Tool { + command: "MLEADERALIGN", + label: "Align Leaders", + icon: include_bytes!("../../../assets/icons/mleader_align.svg"), + options: &[], + }, + Tool { + command: "MLEADERCOLLECT", + label: "Collect Leaders", + icon: include_bytes!("../../../assets/icons/mleader_collect.svg"), + options: &[], + }, + Tool { + command: "WIPEOUT", + label: "Wipeout", + icon: include_bytes!("../../../assets/icons/wipeout.svg"), + options: &[], + }, + Tool { + command: "TABLE", + label: "Table and Data", + icon: include_bytes!("../../../assets/icons/table.svg"), + options: &[ + ("TABLE", "Table"), + ("DATALINK", "Link Data"), + ("DATAEXTRACTION", "Extract Data"), + ], + }, + Tool { + command: "CENTERMARK", + label: "Center Mark and Line", + icon: include_bytes!("../../../assets/icons/line.svg"), + options: &[ + ("CENTERMARK", "Center Mark"), + ("CENTERLINE", "Center Line"), + ("CENTERREASSOCIATE", "Reassociate Center Object"), + ("CENTERDISASSOCIATE", "Disassociate Center Object"), + ("CENTERRESET", "Reset Center Object"), + ], + }, + Tool { + command: "REVCLOUD", + label: "Revision Cloud", + icon: include_bytes!("../../../assets/icons/revcloud.svg"), + options: &[ + ("REVCLOUD_RECTANGULAR", "Rectangular"), + ("REVCLOUD_POLYGONAL", "Polygonal"), + ("REVCLOUD_FREEHAND", "Freehand"), + ], + }, + Tool { + command: "OBJECTSCALE", + label: "Annotation Scales", + icon: include_bytes!("../../../assets/icons/add_scale.svg"), + options: &[ + ("OBJECTSCALE ADD", "Add Current Scale"), + ("OBJECTSCALE DELETE", "Delete Current Scale"), + ("OBJECTSCALE", "Add or Delete Scales"), + ("SCALELISTEDIT", "Edit Scale List"), + ("ANNORESET", "Sync Scale Positions"), + ], + }, +]; diff --git a/src/ui/ribbon/draw_panel.rs b/src/ui/ribbon/draw_panel.rs index f2e4677c4..897dd528a 100644 --- a/src/ui/ribbon/draw_panel.rs +++ b/src/ui/ribbon/draw_panel.rs @@ -140,6 +140,12 @@ const PANELS: &[Panel] = &[ title: "Modify", tools: super::modify_panel::TOOLS, }, + Panel { + id: "annotation_extension", + title_id: "annotation_extension_title", + title: "Annotation", + tools: super::annotation_panel::TOOLS, + }, ]; fn panel_for_dropdown(id: &str) -> Option { diff --git a/src/ui/ribbon/mod.rs b/src/ui/ribbon/mod.rs index a5eb2ffe3..d57cf6c22 100644 --- a/src/ui/ribbon/mod.rs +++ b/src/ui/ribbon/mod.rs @@ -21,6 +21,7 @@ use crate::plugin::all_ribbon_modules; use crate::ui::properties::{linetype_display_name, lw_options, LinetypeItem}; mod widgets; +mod annotation_panel; mod draw_panel; mod modify_panel; use widgets::{StyleContext, *}; From ec14c98f07cc6bd7a42befe7e04a6e7fea8fc790 Mon Sep 17 00:00:00 2001 From: ramox81 <184937705+ramox81@users.noreply.github.com> Date: Mon, 14 Sep 2026 21:59:20 +0300 Subject: [PATCH 2/2] fix(annotate): keep tools in their ribbon tab --- src/ui/ribbon/annotation_panel.rs | 170 ------------------------------ src/ui/ribbon/draw_panel.rs | 6 -- src/ui/ribbon/mod.rs | 1 - 3 files changed, 177 deletions(-) delete mode 100644 src/ui/ribbon/annotation_panel.rs diff --git a/src/ui/ribbon/annotation_panel.rs b/src/ui/ribbon/annotation_panel.rs deleted file mode 100644 index 7b0a8839c..000000000 --- a/src/ui/ribbon/annotation_panel.rs +++ /dev/null @@ -1,170 +0,0 @@ -//! Additional annotation tools reached from the Draw tab's Annotation panel title. - -use super::draw_panel::Tool; - -pub(super) const TOOLS: &[Tool] = &[ - Tool { - command: "DDEDIT", - label: "Edit Text", - icon: include_bytes!("../../../assets/icons/ddedit.svg"), - options: &[], - }, - Tool { - command: "TOLERANCE", - label: "Geometric Tolerance", - icon: include_bytes!("../../../assets/icons/tolerance.svg"), - options: &[], - }, - Tool { - command: "DIMALIGNED", - label: "Aligned Dimension", - icon: include_bytes!("../../../assets/icons/dim_aligned.svg"), - options: &[], - }, - Tool { - command: "DIMARC", - label: "Arc Length Dimension", - icon: include_bytes!("../../../assets/icons/dim_angular.svg"), - options: &[], - }, - Tool { - command: "DIMJOGGED", - label: "Jogged Radius Dimension", - icon: include_bytes!("../../../assets/icons/dim_jog.svg"), - options: &[], - }, - Tool { - command: "DIMDIAMETER", - label: "Diameter Dimension", - icon: include_bytes!("../../../assets/icons/dim_diameter.svg"), - options: &[], - }, - Tool { - command: "DIMORDINATE", - label: "Ordinate Dimension", - icon: include_bytes!("../../../assets/icons/dim_ordinate.svg"), - options: &[], - }, - Tool { - command: "QDIM", - label: "Quick Dimension", - icon: include_bytes!("../../../assets/icons/qdim.svg"), - options: &[], - }, - Tool { - command: "DIMCONTINUE", - label: "Continue Dimension", - icon: include_bytes!("../../../assets/icons/dim_continue.svg"), - options: &[], - }, - Tool { - command: "DIMBASELINE", - label: "Baseline Dimension", - icon: include_bytes!("../../../assets/icons/dim_baseline.svg"), - options: &[], - }, - Tool { - command: "DIMBREAK", - label: "Dimension Break", - icon: include_bytes!("../../../assets/icons/dim_break.svg"), - options: &[], - }, - Tool { - command: "DIMEDIT", - label: "Edit Dimension", - icon: include_bytes!("../../../assets/icons/dim_edit.svg"), - options: &[], - }, - Tool { - command: "DIMTEDIT", - label: "Edit Dimension Text", - icon: include_bytes!("../../../assets/icons/dim_tedit.svg"), - options: &[], - }, - Tool { - command: "DIMSPACE", - label: "Adjust Dimension Space", - icon: include_bytes!("../../../assets/icons/dim_space.svg"), - options: &[], - }, - Tool { - command: "DIMJOGLINE", - label: "Add or Remove Jog Line", - icon: include_bytes!("../../../assets/icons/dim_jog.svg"), - options: &[], - }, - Tool { - command: "MLEADERADD", - label: "Add Leader", - icon: include_bytes!("../../../assets/icons/mleader_add.svg"), - options: &[], - }, - Tool { - command: "MLEADERREMOVE", - label: "Remove Leader", - icon: include_bytes!("../../../assets/icons/mleader_remove.svg"), - options: &[], - }, - Tool { - command: "MLEADERALIGN", - label: "Align Leaders", - icon: include_bytes!("../../../assets/icons/mleader_align.svg"), - options: &[], - }, - Tool { - command: "MLEADERCOLLECT", - label: "Collect Leaders", - icon: include_bytes!("../../../assets/icons/mleader_collect.svg"), - options: &[], - }, - Tool { - command: "WIPEOUT", - label: "Wipeout", - icon: include_bytes!("../../../assets/icons/wipeout.svg"), - options: &[], - }, - Tool { - command: "TABLE", - label: "Table and Data", - icon: include_bytes!("../../../assets/icons/table.svg"), - options: &[ - ("TABLE", "Table"), - ("DATALINK", "Link Data"), - ("DATAEXTRACTION", "Extract Data"), - ], - }, - Tool { - command: "CENTERMARK", - label: "Center Mark and Line", - icon: include_bytes!("../../../assets/icons/line.svg"), - options: &[ - ("CENTERMARK", "Center Mark"), - ("CENTERLINE", "Center Line"), - ("CENTERREASSOCIATE", "Reassociate Center Object"), - ("CENTERDISASSOCIATE", "Disassociate Center Object"), - ("CENTERRESET", "Reset Center Object"), - ], - }, - Tool { - command: "REVCLOUD", - label: "Revision Cloud", - icon: include_bytes!("../../../assets/icons/revcloud.svg"), - options: &[ - ("REVCLOUD_RECTANGULAR", "Rectangular"), - ("REVCLOUD_POLYGONAL", "Polygonal"), - ("REVCLOUD_FREEHAND", "Freehand"), - ], - }, - Tool { - command: "OBJECTSCALE", - label: "Annotation Scales", - icon: include_bytes!("../../../assets/icons/add_scale.svg"), - options: &[ - ("OBJECTSCALE ADD", "Add Current Scale"), - ("OBJECTSCALE DELETE", "Delete Current Scale"), - ("OBJECTSCALE", "Add or Delete Scales"), - ("SCALELISTEDIT", "Edit Scale List"), - ("ANNORESET", "Sync Scale Positions"), - ], - }, -]; diff --git a/src/ui/ribbon/draw_panel.rs b/src/ui/ribbon/draw_panel.rs index 897dd528a..f2e4677c4 100644 --- a/src/ui/ribbon/draw_panel.rs +++ b/src/ui/ribbon/draw_panel.rs @@ -140,12 +140,6 @@ const PANELS: &[Panel] = &[ title: "Modify", tools: super::modify_panel::TOOLS, }, - Panel { - id: "annotation_extension", - title_id: "annotation_extension_title", - title: "Annotation", - tools: super::annotation_panel::TOOLS, - }, ]; fn panel_for_dropdown(id: &str) -> Option { diff --git a/src/ui/ribbon/mod.rs b/src/ui/ribbon/mod.rs index d57cf6c22..a5eb2ffe3 100644 --- a/src/ui/ribbon/mod.rs +++ b/src/ui/ribbon/mod.rs @@ -21,7 +21,6 @@ use crate::plugin::all_ribbon_modules; use crate::ui::properties::{linetype_display_name, lw_options, LinetypeItem}; mod widgets; -mod annotation_panel; mod draw_panel; mod modify_panel; use widgets::{StyleContext, *};