feat(xref): 8-item filtered row menu, preview on selection, details display size

Row right-click menu is exactly Open, Attach..., Unload, Reload, Detach, Change Path Type group with Make Absolute, Make Relative, Remove Path, Select New Path, Find and Replace. Change Path Type renders as indented group. Open uses OCS for DWG and OS default for images and PDFs. Preview decodes on selection change, not only at refresh. Details shows placed display width and height for image instances.
This commit is contained in:
Karim Jerbi committed 2026-09-15 23:56:31 +01:00
1 parent 37085949a6
commit 1c8e3ff3d7
25 files changed
+256 -25

No files matched your search

+4
View File
@@ -924,6 +924,7 @@ pub(super) fn on_ribbon_tool_click(&mut self, tool_id: String, event: ModuleEven
return;
}
let label = match op {
XrefPaletteOp::Open => "XREF-OPEN",
XrefPaletteOp::Detach => "XREF-DETACH",
XrefPaletteOp::Unload => "XREF-UNLOAD",
XrefPaletteOp::Reload => "XREF-RELOAD",
@@ -1190,6 +1191,9 @@ pub(super) fn on_ribbon_tool_click(&mut self, tool_id: String, event: ModuleEven
}
}
}
XrefPaletteOp::Open | XrefPaletteOp::Attach => {
// Handled in update/mod.rs XrefRowOp dispatch (navigation / picker), not here.
}
}
if done > 0 {
self.post_ref_op(i);
+27
View File
@@ -2304,6 +2304,33 @@ impl OpenCADStudio {
Task::none()
}
Message::XrefRowOp(index, op) => {
// Open is not a palette op — it navigates to the file.
if op == crate::ui::window::xref_manager::XrefPaletteOp::Open {
self.xref_manager.right_click_select(index);
if let Some(entry) = self.xref_manager.entries.get(index) {
if let Some(found) = entry.found_at.clone() {
let is_dwg = found.to_ascii_lowercase().ends_with(".dwg")
|| found.to_ascii_lowercase().ends_with(".dxf");
if is_dwg {
return Task::done(Message::OpenRecent(std::path::PathBuf::from(found)));
} else {
let _ = open::that_detached(&found);
}
} else {
self.command_line.push_error(
crate::t!("File not found — check the saved path.").as_ref(),
);
}
}
return Task::none();
}
// For XrefPathPick the row menu just sets the anchor; the
// picker's result handler does the work. Don't run it through
// xref_manager_op.
if matches!(op, crate::ui::window::xref_manager::XrefPaletteOp::Attach) {
self.xref_manager.right_click_select(index);
return Task::done(Message::XAttachPick);
}
// Row-scoped op: select the row first, then run the op.
self.xref_manager.right_click_select(index);
self.xref_manager_op(op);