Files
OneCAD-Draft/src/modules/insert/mod.rs
T
ramox81andClaude Opus 5.5 b060d46894 Insert Reference panel: separate Attach XREF and Attach PDF buttons
The single Attach button gives way to Attach XREF (XATTACH, the external
reference picker and dialog) and Attach PDF (PDFATTACH, the PDF picker and
Attach PDF Underlay dialog) with their own icons. ATTACH stays available
as a command. The Turkish label reads "PDF Bağla".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-25 15:08:20 +03:00

129 lines
5.5 KiB
Rust

// Insert module — references, point clouds, blocks, attributes, import, content.
mod attdef;
mod attedit;
mod attman;
mod attsync;
pub mod base_point;
mod content_browser;
pub(crate) mod create_block;
mod design_center;
mod edit_block;
pub(crate) mod insert_block;
mod landxml;
pub(crate) mod picker;
pub mod minsert;
mod mview_block;
mod open_obj;
mod pc_attach;
pub(crate) mod pdf_attach;
pub(crate) mod pdf_clip;
pub(crate) mod pdf_import;
mod snap_underlays;
pub(crate) mod solid3d_cmds;
mod underlay_layers;
pub(crate) mod wblock;
mod xadjust;
pub(crate) mod xattach;
pub(crate) mod xref_cmd;
pub(crate) mod xclip;
use crate::modules::{CadModule, IconKind, RibbonGroup, RibbonItem};
const FRAMES_ICON: IconKind =
IconKind::Svg(include_bytes!("../../../assets/icons/underlay_frames.svg"));
pub struct InsertModule;
impl CadModule for InsertModule {
fn id(&self) -> &'static str {
"insert"
}
fn title(&self) -> &'static str {
"Insert"
}
fn ribbon_groups(&self) -> &[RibbonGroup] {
static GROUPS: std::sync::OnceLock<Vec<RibbonGroup>> = std::sync::OnceLock::new();
GROUPS.get_or_init(|| {
vec![
// ── Reference ────────────────────────────────────────────────────
RibbonGroup {
title: "Reference",
tools: vec![
RibbonItem::LargeTool(xattach::tool()),
RibbonItem::LargeTool(pdf_attach::tool()),
RibbonItem::LargeTool(xclip::tool()),
RibbonItem::LargeTool(xadjust::tool()),
RibbonItem::LabeledTool(underlay_layers::tool()),
// An empty label shows the chosen item's.
RibbonItem::LabeledDropdown {
id: "FRAMES_DROPDOWN",
label: "",
icon: FRAMES_ICON,
items: vec![
("FRAMES0", "Frames Off", FRAMES_ICON),
("FRAMES1", "Frames On", FRAMES_ICON),
("FRAMES2", "Frames On, Not Plotted", FRAMES_ICON),
],
default: "FRAMES1",
},
RibbonItem::LabeledDropdown {
id: "UOSNAP_DROPDOWN",
label: "Snap to Underlays",
icon: snap_underlays::ICON,
items: vec![
("UOSNAP1", "Snap to Underlays ON", snap_underlays::ICON),
("UOSNAP0", "Snap to Underlays OFF", snap_underlays::ICON),
],
default: "UOSNAP1",
},
],
},
// ── Point Cloud ───────────────────────────────────────────────────
RibbonGroup {
title: "Point Cloud",
tools: vec![RibbonItem::LargeTool(pc_attach::tool())],
},
// ── Block ─────────────────────────────────────────────────────────
RibbonGroup {
title: "Block",
tools: vec![
RibbonItem::LargeTool(mview_block::tool()),
RibbonItem::LargeTool(insert_block::tool()),
RibbonItem::Tool(create_block::tool()),
RibbonItem::Tool(edit_block::tool()),
RibbonItem::Tool(base_point::tool()),
],
},
// ── Attributes ────────────────────────────────────────────────────
RibbonGroup {
title: "Attributes",
tools: vec![
RibbonItem::LargeTool(attdef::tool()),
RibbonItem::LargeTool(attedit::tool()),
RibbonItem::Tool(attman::tool()),
RibbonItem::Tool(attsync::tool()),
],
},
// ── Import ────────────────────────────────────────────────────────
RibbonGroup {
title: "Import",
tools: vec![
RibbonItem::LargeTool(open_obj::tool()),
RibbonItem::LargeTool(landxml::tool()),
],
},
// ── Content ───────────────────────────────────────────────────────
RibbonGroup {
title: "Content",
tools: vec![
RibbonItem::LargeTool(content_browser::tool()),
RibbonItem::LargeTool(design_center::tool()),
],
},
]
})
}
}