forked from 1b-agent/opencadstudio-upstream
- Insert > Reference: the PDF Attach button becomes an Attach Underlay menu (PDF / DWF / DGN); its face runs the last one chosen. - DWFATTACH, DGNATTACH and ATTACH on a .dwf/.dwfx/.dgn open the Attach dialog for that kind: sheets or models with thumbnails (one chosen), placement, path type, file details with the sheet / model size, and for DGN the conversion units (sub units offer 1 / sub units per master as the scale). - DGN V8 true colours come from the ExtendedColors record packed in the non-model attributes stream; the colour word's high part numbers them. - A DGN model's extent includes each text's box (its length along the baseline and 1.5 x its height), as the reference sizes a model. - DWFx text uses the family named in its embedded (deobfuscated) font. - DWF contrast pivots at 0.73 once colours are turned over for a dark background. - Hairline strokes are drawn solid one pixel wide, and underlay rasters are made at or below their size on screen so those lines stay unbroken. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
144 lines
6.4 KiB
Rust
144 lines
6.4 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 image_transparency;
|
|
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()),
|
|
// PDF, DWF or DGN; the face runs the last one chosen.
|
|
RibbonItem::LargeDropdown {
|
|
id: "UNDERLAY_ATTACH",
|
|
label: "Attach Underlay",
|
|
icon: pdf_attach::ICON,
|
|
items: vec![
|
|
("PDFATTACH", "Attach PDF", pdf_attach::ICON),
|
|
("DWFATTACH", "Attach DWF", pdf_attach::ICON),
|
|
("DGNATTACH", "Attach DGN", pdf_attach::ICON),
|
|
],
|
|
default: "PDFATTACH",
|
|
},
|
|
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", "Hide frames", FRAMES_ICON),
|
|
("FRAMES1", "Display and plot frames", FRAMES_ICON),
|
|
("FRAMES2", "Display but don't plot frames", FRAMES_ICON),
|
|
// Shown (not selectable) while the frame
|
|
// variables differ from each other.
|
|
("FRAMES3", "*Frames vary*", 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()),
|
|
],
|
|
},
|
|
]
|
|
})
|
|
}
|
|
}
|