diff --git a/crates/ui-egui/src/panels/doc_info.rs b/crates/ui-egui/src/panels/doc_info.rs index ed6bdcdaab..83e45e4151 100644 --- a/crates/ui-egui/src/panels/doc_info.rs +++ b/crates/ui-egui/src/panels/doc_info.rs @@ -22,10 +22,16 @@ struct Cache { /// A `label: value` row. `label` is shown as given: translate an interface label first, a name /// stays as it is. pub(crate) fn row(ui: &mut Ui, label: &str, value: String) { + row_with(ui, label, value, |_| {}); +} + +/// A [`row`] with `end` drawn at its right end, after the value. +pub(crate) fn row_with(ui: &mut Ui, label: &str, value: String, end: impl FnOnce(&mut Ui)) { let t = Tokens::get(ui.ctx()); ui.horizontal(|ui| { ui.label(egui::RichText::new(label).size(12.0).color(t.text_dim)); ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { + end(ui); // Long values (paths) are cut to the panel's width; hovering shows them whole. ui.add(egui::Label::new(egui::RichText::new(value).size(12.0).color(t.text)).truncate()); }); diff --git a/crates/ui-egui/src/panels/links.rs b/crates/ui-egui/src/panels/links.rs index 4c491efb6b..a3962ade38 100644 --- a/crates/ui-egui/src/panels/links.rs +++ b/crates/ui-egui/src/panels/links.rs @@ -3,7 +3,8 @@ //! its image, Ctrl/Cmd-click adds or removes it, and Shift-click selects the images of the rows //! from the last row clicked without Shift to it (with Ctrl/Cmd, adds them); the buttons Relink, //! Go To, Update and Edit Original act on the selected rows (Relink through its dialog, with the -//! Replace choice: `ui.relinkDialog`); Link Info shows the details of the first. The flyout adds Relink to Folder, Find in Folder (Find Linked Files: +//! Replace choice: `ui.relinkDialog`); Link Info shows the details of the first, with a Show in +//! Folder button on its Location row. The flyout adds Relink to Folder, Find in Folder (Find Linked Files: //! `ui.findLinksInFolder`), Embed / Unembed, Placement Options, Select Linked / Embedded / Missing / //! Modified (`addon.select.byLinkStatus`, Shift adds), Show filters, Sort, Copy Info (the selected //! rows' file names to the clipboard: `links.copyInfo`), thumbnail size, Show in Folder and Show DCS Transparency Interactions (a warning on the rows of images placed @@ -721,7 +722,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { } if o.info { let units = app.session.general_unit(); - link_info(ui, cache.info.as_ref().map(|(_, i)| i), units); + link_info(app, ui, cache.info.as_ref().map(|(id, i)| (*id, i)), units); } let sel = selected_rows(&cache.list, &selected); let modified = ids(&sel, |r| status_is(r, "modified") || r["preview"] == true && !status_is(r, "missing")); @@ -876,10 +877,10 @@ pub(crate) fn date_label(ms: u64) -> String { format!("{y:04}-{mo:02}-{d:02} {h:02}:{mi:02} UTC") } -/// The Link Info section: the details of `info` (`links.info`), or a hint. -fn link_info(ui: &mut Ui, info: Option<&Value>, units: vectorcraft_doc::Unit) { +/// The Link Info section: the details of `info` (`links.info` of image `id`), or a hint. +fn link_info(app: &mut VectorcraftApp, ui: &mut Ui, info: Option<(u64, &Value)>, units: vectorcraft_doc::Unit) { widgets::divider(ui); - let Some(i) = info else { + let Some((id, i)) = info else { widgets::dim_label(ui, tl!("Select an image to see its Link Info.")); return; }; @@ -896,7 +897,14 @@ fn link_info(ui: &mut Ui, info: Option<&Value>, units: vectorcraft_doc::Unit) { row(ui, tl!("Format"), i["format"].as_str().unwrap_or_default().into()); row(ui, tl!("Color Space"), i["colorMode"].as_str().unwrap_or_default().into()); if let Some(l) = i["location"].as_str() { - row(ui, tl!("Location"), l.into()); + // Show in Folder for the image shown here: off while its file is missing and without a + // file manager (the web). + let can_reveal = i["path"].is_string() && i["status"] != "missing" && app.services.reveal.is_some(); + super::doc_info::row_with(ui, tl!("Location"), l.into(), |ui| { + if widgets::icon_button_enabled(ui, "folder-open", tl!("Show in Folder"), false, can_reveal, 18.0).clicked() { + crate::menus::invoke(app, "links.reveal", json!({ "id": id })); + } + }); } // A placed document has no resolution: its rows are left out. for (label, k) in [(tl!("PPI"), "ppi"), (tl!("Effective PPI"), "effectivePpi")] { diff --git a/crates/ui-egui/src/panels/tests_links.rs b/crates/ui-egui/src/panels/tests_links.rs index 85a26e557a..1494b75925 100644 --- a/crates/ui-egui/src/panels/tests_links.rs +++ b/crates/ui-egui/src/panels/tests_links.rs @@ -558,6 +558,70 @@ fn edit_original_and_show_in_folder_hand_the_file_to_the_system() { assert!(app.run("links.editOriginal", json!({"id": linked})).is_err()); } +/// Frames of the panel in a fresh context (Link Info read anew), the pointer clicking the middle of +/// the button that screen readers name `name` → whether that button was on, or `None` when it was +/// not drawn. +fn click_panel_button(app: &mut VectorcraftApp, name: &str) -> Option { + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + crate::theme::install_fonts(&ctx); + let mut time = 0.0; + let mut frame = |app: &mut VectorcraftApp, events: Vec| { + time += 0.1; + let mut out = ctx.run_ui(egui::RawInput { events, time: Some(time), ..Default::default() }, |ui| super::links::show(app, ui)); + out.textures_delta.clear(); + out + }; + frame(app, vec![]); + let out = frame(app, vec![]); + let nodes = &out.platform_output.accesskit_update.as_ref().expect("an accessibility tree").nodes; + let node = &nodes.iter().find(|(_, n)| n.role() == egui::accesskit::Role::Button && n.label() == Some(name))?.1; + let on = !node.is_disabled(); + let b = node.bounds().expect("bounds"); + let at = egui::pos2((b.x0 + b.x1) as f32 * 0.5, (b.y0 + b.y1) as f32 * 0.5); + let button = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE }; + frame(app, vec![egui::Event::PointerMoved(at)]); + frame(app, vec![button(true)]); + frame(app, vec![button(false)]); + Some(on) +} + +/// The Location row of Link Info has a Show in Folder button that shows the file of the image Link +/// Info shows. An embedded image has no Location row; the button is off while the file is missing +/// and without a file manager (the web). +#[test] +fn link_infos_location_row_shows_the_file_in_its_folder() { + crate::i18n::set_current(crate::i18n::Lang::EN); + let dir = Folder::new("location-reveal"); + let (mut app, linked, embedded) = app(&dir); + let other = dir.file("other.png", &png(30, 20)); + let other = app.run("file.place", json!({"path": other, "at": [50, 50]})).unwrap()["ids"][0].as_u64().unwrap(); + app.run("select.set", json!({"ids": [embedded]})).unwrap(); + let revealed: Rc>> = Rc::default(); + let r = revealed.clone(); + app.services.reveal = Some(Box::new(move |p: &str| { + r.borrow_mut().push(p.to_string()); + Ok(()) + })); + let path = |app: &mut VectorcraftApp, id: u64| app.run("links.info", json!({"id": id})).unwrap()["path"].as_str().unwrap().to_string(); + let (linked_path, other_path) = (path(&mut app, linked), path(&mut app, other)); + // An embedded image has no file to show. + assert_eq!(click_panel_button(&mut app, "Show in Folder"), None); + app.run("select.set", json!({"ids": [linked]})).unwrap(); + assert_eq!(click_panel_button(&mut app, "Show in Folder"), Some(true)); + app.run("select.set", json!({"ids": [other]})).unwrap(); + assert_eq!(click_panel_button(&mut app, "Show in Folder"), Some(true)); + assert_eq!(*revealed.borrow(), [linked_path, other_path.clone()]); + // A missing file: the row stays, the button is off. + std::fs::remove_file(&other_path).unwrap(); + assert_eq!(click_panel_button(&mut app, "Show in Folder"), Some(false)); + // Without a file manager (the web): off. + app.run("select.set", json!({"ids": [linked]})).unwrap(); + app.services.reveal = None; + assert_eq!(click_panel_button(&mut app, "Show in Folder"), Some(false)); + assert_eq!(revealed.borrow().len(), 2, "nothing more was shown"); +} + /// #5236: with Preferences › File Handling › Use System Defaults for Edit Original off, Edit /// Original opens a raster image in the app that made it, PhotoCraft, and falls back to the /// system's default app when PhotoCraft isn't installed or the file isn't a raster image. diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 57ac87a396..86edfe41d6 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1387,6 +1387,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur Select by Artboards (Object › Plug-ins › Selection Tools, a VectorCraft addition: #5525, #5548, #5549) selects the objects overlapping, fully inside or fully outside one or more chosen artboards (`addon.select.byArtboards {artboards, relation}`). Overlapping is All on Active Artboard's test, shared as `select::on_artboard`; Fully inside means within one artboard, edges included; Fully outside means on none. It looks at what Select All takes, so hidden, locked and locked-artboard art stays out. Its dialog lists each artboard's number, name and size in the document's units, filters by name, chooses rows with click, Shift-click and Cmd/Ctrl-click, and fits a row's artboard in the window on double-click (`view.goToArtboard`). Tests: `crates/engine/src/cmd/addons/select/tests.rs`, `crates/ui-egui/src/addons/select/tests.rs`, `crates/engine/tests/command_sweep.rs`. Select by Link Status (Object › Plug-ins › Selection Tools and the Links panel menu, a VectorCraft addition: #5526) selects the image objects and placed documents whose link is linked (its file found unchanged), embedded, missing or modified, as `links.list` reports it (`addon.select.byLinkStatus {status, ids?, add?, zoom?}`); Select Linked, Embedded, Missing and Modified are off when no image has that status and add to the selection with Shift. Objects that are hidden or locked, inside a hidden or locked object or layer, on a template layer, on a locked artboard, or outside the isolated group are left out (the `select::is_selectable` test) and returned with the reason, and the status bar says how many, in plural forms of every catalog. Select by Link Status… lists each image and placed document with its name, status and format, searches by name, filters by status, picks rows with checkboxes and All / None, and zooms to the selection with the existing Zoom to Selection (`addon.arrange.zoomSelection`). Missing-link markers on the canvas are #5547. Tests: `crates/engine/src/cmd/addons/select/tests.rs` (`by_link_status`), `crates/ui-egui/src/addons/select/link_status/tests.rs`, `crates/engine/tests/command_sweep.rs`. The Links panel provides an item right-click context menu on link rows offering Relink…, Go To Link, Update Link, Edit Original, Show in Folder, Separator, and Embed Image / Unembed…. Right-clicking an unselected row selects that row first; right-clicking a row that is already part of a multi-selection preserves the multi-selection. Tests: `panels::tests_links::right_click_context_menu_in_links_panel`. + The Location row of the Links panel's Link Info has a folder button, Show in Folder, that opens the folder of the file Link Info shows in the system's file manager (`links.reveal {id}` with that image's id); the help page describes a folder icon on this row ([Links information](https://helpx.adobe.com/illustrator/using/links-info.html)). The button's name and its off state while the file is missing or no file manager is available (the web build) are VectorCraft's own. Tests: `panels::tests_links::link_infos_location_row_shows_the_file_in_its_folder`. A marquee selects a clip group, or an object on a layer with a clipping mask, only when it reaches the area inside the clipping path, and it measures the art only within that path's bounds. Within the bounds of a mask that is not a rectangle, it can still select art that the mask hides. Direct Selection's marquee still selects the hidden anchor points inside it (#2345). When a clip group, a layer with a clipping mask or a single object in one is isolated, the Selection, Direct Selection and Group Selection tools also select the art that the mask hides, by a click or a marquee, and a drag from that art moves it (#3748). In isolation mode the canvas Unlock submenu also lists that art when it is locked. Outside isolation mode a click selects clipped art only inside the mask. A marquee selects a Shaper Group only when it reaches the art the group shows, not the original shapes kept under it, and Direct Selection's clicks and marquee do not select those shapes' anchor points. In Construction mode a marquee selects the original shapes, and Direct Selection selects their anchor points.