forked from 1b-agent/opencadstudio-upstream
Merge pull request #1753 from ramox81/codex/insert-reference-ribbon
Insert ribbon: Reference panel order and Snap to Underlays state
This commit is contained in:
commit
7d306eec5e
6 files changed
+63
-50
No files matched your search
@@ -3849,6 +3849,7 @@ insert =
|
||||
.display-and-plot-frames = Display and plot frames
|
||||
.display-not-plot-frames = Display but don't plot frames
|
||||
.frames-vary = *Frames vary*
|
||||
.underlay-osnaps-vary = *Underlay OSnap's vary*
|
||||
.regenerating-model = Regenerating model.
|
||||
.requires-int-0-2 = Requires an integer between 0 and 2.
|
||||
.insert-prompt-hint = INSERT __ocs_arg_prompt____ocs_arg_hint__:
|
||||
|
||||
@@ -3818,6 +3818,7 @@ insert =
|
||||
.display-and-plot-frames = Çerçeveleri göster ve çizdir
|
||||
.display-not-plot-frames = Çerçeveleri göster, çizdirme
|
||||
.frames-vary = *Çerçeveler farklı*
|
||||
.underlay-osnaps-vary = *Altlık nesne yakalamaları farklı*
|
||||
.regenerating-model = Model yeniden oluşturuluyor.
|
||||
.requires-int-0-2 = 0 ile 2 arasında bir tamsayı gerekli.
|
||||
.insert-prompt-hint = INSERT __ocs_arg_prompt____ocs_arg_hint__:
|
||||
|
||||
@@ -362,6 +362,12 @@ impl OpenCADStudio {
|
||||
_ => "FRAMES3",
|
||||
};
|
||||
self.ribbon.set_dropdown_current("FRAMES_DROPDOWN", current);
|
||||
let uosnap = match crate::scene::model::pdf_vector::uosnap() {
|
||||
0 => "UOSNAP0",
|
||||
1 => "UOSNAP1",
|
||||
_ => "UOSNAP2",
|
||||
};
|
||||
self.ribbon.set_dropdown_current("UOSNAP_DROPDOWN", uosnap);
|
||||
let attmode = match tab.scene.document.header.attribute_visibility {
|
||||
0 => "ATTMODE0",
|
||||
2 => "ATTMODE2",
|
||||
|
||||
@@ -1601,6 +1601,7 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static
|
||||
"Display and plot frames" => Some(("insert", "display-and-plot-frames")),
|
||||
"Display but don't plot frames" => Some(("insert", "display-not-plot-frames")),
|
||||
"*Frames vary*" => Some(("insert", "frames-vary")),
|
||||
"*Underlay OSnap's vary*" => Some(("insert", "underlay-osnaps-vary")),
|
||||
"Regenerating model." => Some(("insert", "regenerating-model")),
|
||||
"Requires an integer between 0 and 2." => Some(("insert", "requires-int-0-2")),
|
||||
"Frames On, Not Plotted" => Some(("draw", "frames-on-not-plotted")),
|
||||
|
||||
+53
-49
@@ -50,55 +50,6 @@ impl CadModule for InsertModule {
|
||||
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, DGN or a point cloud; 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),
|
||||
("POINTCLOUDATTACH", "Attach Point Cloud", pc_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",
|
||||
},
|
||||
],
|
||||
},
|
||||
// ── Block ─────────────────────────────────────────────────────────
|
||||
RibbonGroup {
|
||||
title: "Block",
|
||||
@@ -139,6 +90,59 @@ impl CadModule for InsertModule {
|
||||
RibbonItem::LargeTool(edit_block::tool()),
|
||||
],
|
||||
},
|
||||
// ── Reference ────────────────────────────────────────────────────
|
||||
RibbonGroup {
|
||||
title: "Reference",
|
||||
tools: vec![
|
||||
RibbonItem::LargeTool(xattach::tool()),
|
||||
// PDF, DWF, DGN or a point cloud; 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),
|
||||
("POINTCLOUDATTACH", "Attach Point Cloud", pc_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",
|
||||
// An empty label shows the current state.
|
||||
label: "",
|
||||
icon: snap_underlays::ICON,
|
||||
items: vec![
|
||||
("UOSNAP1", "Snap to Underlays ON", snap_underlays::ICON),
|
||||
("UOSNAP0", "Snap to Underlays OFF", snap_underlays::ICON),
|
||||
// Shown (not selectable) while PDFOSNAP, DWFOSNAP
|
||||
// and DGNOSNAP differ (UOSNAP 2).
|
||||
("UOSNAP2", "*Underlay OSnap's vary*", snap_underlays::ICON),
|
||||
],
|
||||
default: "UOSNAP1",
|
||||
},
|
||||
],
|
||||
},
|
||||
// ── Import ────────────────────────────────────────────────────────
|
||||
RibbonGroup {
|
||||
title: "Import",
|
||||
|
||||
@@ -99,7 +99,7 @@ thread_local! {
|
||||
|
||||
/// Dropdown items that report a state and cannot be picked.
|
||||
pub(super) fn is_disabled_item(cmd: &str) -> bool {
|
||||
cmd == "FRAMES3"
|
||||
matches!(cmd, "FRAMES3" | "UOSNAP2")
|
||||
}
|
||||
|
||||
fn ribbon_label_bounds(
|
||||
|
||||
Reference in new issue
Block a user