LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
LRC-LIB-KEYWORDS: the Keywords panel folds its sections and can group the selection's keywords
Nathaniel Ledford366e6891a06e
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex 37fb86df3..4a26e880b 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -1513,6 +1513,9 @@ pub struct Caches {keyword_names: Option<(u64, u64, std::sync::Arc<Vec<panels::keywording::Chip>>)>,/// The Keywording box's chips, by library revision and selection.keyword_chips: Option<(u64, u64, std::sync::Arc<Vec<panels::keywording::Chip>>)>,+ /// The Keywording box's chips grouped by the keyword they are inside, by library revision and+ /// selection.+ keyword_groups: Option<(u64, u64, std::sync::Arc<Vec<panels::keywording::Group>>)>,/// The Keyword List's tick boxes, by library revision and selection.keyword_ticks: Option<(u64, u64, std::sync::Arc<panels::keyword_list::Ticks>)>,folder_tree: Option<(u64, std::sync::Arc<Vec<lightcraft_catalog::FolderNode>>)>,@@ -1653,6 +1656,23 @@ impl Caches {}}}+ /// The selection's keywords grouped by the keyword they are inside (the grouped Keywording box).+ pub(crate) fn keyword_groups(+ &mut self,+ cat: &lightcraft_catalog::Catalog,+ selection: &[lightcraft_catalog::PhotoId],+ ) -> std::sync::Arc<Vec<panels::keywording::Group>> {+ let key = key_of(selection);+ match &self.keyword_groups {+ Some((r, k, g)) if *r == cat.revision && *k == key => g.clone(),+ _ => {+ let chips = self.keyword_chips(cat, selection);+ let g = std::sync::Arc::new(panels::keywording::grouped(&chips));+ self.keyword_groups = Some((cat.revision, key, g.clone()));+ g+ }+ }+ }/// How many selected photos have each keyword (the Keyword List's tick boxes).pub(crate) fn keyword_ticks(&mut self,diff --git a/crates/ui-egui/src/panels/keyword_list.rs b/crates/ui-egui/src/panels/keyword_list.rsindex 2d691112a..647eee777 100644--- a/crates/ui-egui/src/panels/keyword_list.rs+++ b/crates/ui-egui/src/panels/keyword_list.rs@@ -21,7 +21,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {let t = Tokens::get(ui.ctx());crate::widgets::divider(ui);// the title, where a dragged keyword goes back to the top level- let (title, _) = ui.allocate_exact_size(vec2(ui.available_width(), 46.0), Sense::hover());+ let (title, title_resp) = ui.allocate_exact_size(vec2(ui.available_width(), 46.0), Sense::click());register(ui.ctx(), "keywordList:topLevel", title);let dragging = app.ui.dragging_keyword.clone();let (pointer, released) = ui.input(|i| (i.pointer.latest_pos(), i.pointer.any_released()));@@ -29,14 +29,18 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {if dragging.is_some() && over_title {ui.painter().rect_stroke(title.shrink2(vec2(16.0, 6.0)), 4.0, Stroke::new(1.5, t.accent), StrokeKind::Inside);}+ // (it folds the list shut; while a keyword is dragged it says where the drop goes)let heading = if dragging.is_some() { crate::i18n::tr("Drop here for the top level") } else { crate::i18n::tr("Keyword List") };- ui.painter().text(pos2(title.left() + 24.0, title.center().y + 2.0), Align2::LEFT_CENTER, heading, t.semibold(15.0), t.text);+ let open = super::right::fold_title(app, ui, "keywordList", title, &title_resp, heading);if released&& over_title&& let Some(k) = dragging.clone(){drop_keyword(app, ui.ctx(), &k, None);}+ if !open {+ return;+ }let fid = egui::Id::new("keyword-list-filter");let mut filter: String = ui.data(|d| d.get_temp(fid)).unwrap_or_default();ui.horizontal(|ui| {diff --git a/crates/ui-egui/src/panels/keywording.rs b/crates/ui-egui/src/panels/keywording.rsindex 857498599..7913c0ff3 100644--- a/crates/ui-egui/src/panels/keywording.rs+++ b/crates/ui-egui/src/panels/keywording.rs@@ -40,7 +40,7 @@ pub fn names_row(app: &mut LightcraftApp, ui: &mut egui::Ui) {let prefix = if export { "keywordExport" } else { "keywordContaining" };ui.horizontal_wrapped(|ui| {for n in names.iter() {- let (body, _) = chip(ui, &n.path, !n.on_all(), false);+ let (body, _) = chip(ui, &n.path, &n.path, !n.on_all(), false, ui.max_rect().width());register(ui.ctx(), format!("{prefix}:{}", n.path), body.rect);if n.on_all() {body.on_hover_text(&n.path);@@ -52,21 +52,33 @@ pub fn names_row(app: &mut LightcraftApp, ui: &mut egui::Ui) {});}-/// One chip, measured before it is placed so that a wrapping row moves it whole to the next line:-/// the name (cut short to fit the row) and, with `cross`, a × at its end. A `partial` one (only-/// some of the selected photos) is dimmed and marked with an asterisk. Returns the name's response-/// and the ×'s.-fn chip(ui: &mut egui::Ui, path: &str, partial: bool, cross: bool) -> (egui::Response, Option<egui::Response>) {+/// Chips on a line of the grouped box are this far apart.+const GAP: f32 = 6.0;+/// The room a chip's × takes at its end.+const CROSS_W: f32 = 18.0;++/// What a chip shows of `name` in a row `row_w` wide (cut short to fit it), and the chip's width.+fn chip_size(ui: &egui::Ui, name: &str, partial: bool, cross: bool, row_w: f32) -> (String, f32) {+ let font = Tokens::get(ui.ctx()).font(13.0);+ let cross_w = if cross { CROSS_W } else { 0.0 };+ let room = (row_w - 16.0 - cross_w).max(24.0);+ let measure = |s: &str| ui.painter().layout_no_wrap(s.to_string(), font.clone(), egui::Color32::WHITE).size().x;+ let shown = chip_label(name, partial, room, measure);+ let w = measure(&shown) + 16.0 + cross_w;+ (shown, w)+}++/// One chip of the keyword `path`, measured before it is placed so that a wrapping row moves it+/// whole to the next line: `name` (the path, or what the grouped box shows of it; cut short to fit+/// a row `row_w` wide) and, with `cross`, a × at its end. A `partial` one (only some of the+/// selected photos) is dimmed and marked with an asterisk. Returns the name's response and the ×'s.+fn chip(ui: &mut egui::Ui, path: &str, name: &str, partial: bool, cross: bool, row_w: f32) -> (egui::Response, Option<egui::Response>) {use egui::{Align2, Rect, Sense, pos2, vec2};let t = Tokens::get(ui.ctx());let font = t.font(13.0);let color = if partial { t.text_dim } else { t.text_label };- let cross_w = if cross { 18.0 } else { 0.0 };- // at most the row's width- let room = (ui.max_rect().width() - 16.0 - cross_w).max(24.0);- let measure = |s: &str| ui.painter().layout_no_wrap(s.to_string(), font.clone(), color).size().x;- let shown = chip_label(path, partial, room, measure);- let w = measure(&shown) + 16.0 + cross_w;+ let cross_w = if cross { CROSS_W } else { 0.0 };+ let (shown, w) = chip_size(ui, name, partial, cross, row_w);// the row places it; its name and × answer under ids of their own keyword, so an open menu// stays with its keyword when the chips changelet (rect, _) = ui.allocate_exact_size(vec2(w, 22.0), Sense::hover());@@ -118,33 +130,139 @@ fn menu(app: &mut LightcraftApp, ui: &mut egui::Ui, chip: &Chip) {}/// The selection's keywords as chips: the name (right-click for its menu), and × to take it off-/// every selected photo. One only some of them have is marked with an asterisk.+/// every selected photo. One only some of them have is marked with an asterisk. Whole names, or+/// grouped by the keyword they are inside (Settings ▸ Interface).pub fn chip_row(app: &mut LightcraftApp, ui: &mut egui::Ui) {let selection = app.session.targets(&serde_json::Value::Null);let chips = app.caches.keyword_chips(&app.session.catalog, &selection);+ if chips.is_empty() {+ let t = Tokens::get(ui.ctx());+ let r = ui.label(egui::RichText::new(crate::i18n::tr("No keywords yet")).color(t.text_dim));+ register(ui.ctx(), "keywordChipsEmpty", r.rect);+ return;+ }+ if app.ui.settings.keyword_chips == crate::state::KeywordChips::Grouped {+ let groups = app.caches.keyword_groups(&app.session.catalog, &selection);+ chip_groups(app, ui, &groups);+ return;+ }ui.horizontal_wrapped(|ui| {for c in chips.iter() {- let (body, x) = chip(ui, &c.path, !c.on_all(), true);- register(ui.ctx(), format!("keywordChip:{}", c.path), body.rect);- if let Some(x) = x {- register(ui.ctx(), format!("keywordChipRemove:{}", c.path), x.rect);- if x.on_hover_text(crate::i18n::tr("Remove from Selected Photos")).clicked() {- let _ = app.run("photo.setMeta", json!({"removeKeywords": [c.path]}));+ let (body, x) = chip(ui, &c.path, &c.path, !c.on_all(), true, ui.max_rect().width());+ chip_acts(app, ui, c, body, x);+ }+ });+}++/// A drawn chip does its work: its × takes the keyword off the selected photos, its name has the+/// tooltip and the menu.+fn chip_acts(app: &mut LightcraftApp, ui: &egui::Ui, c: &Chip, body: egui::Response, x: Option<egui::Response>) {+ register(ui.ctx(), format!("keywordChip:{}", c.path), body.rect);+ if let Some(x) = x {+ register(ui.ctx(), format!("keywordChipRemove:{}", c.path), x.rect);+ if x.on_hover_text(crate::i18n::tr("Remove from Selected Photos")).clicked() {+ let _ = app.run("photo.setMeta", json!({"removeKeywords": [c.path]}));+ }+ }+ // one tooltip: the whole name (it may be cut short), and how many have it+ let full = c.path.replace('|', " › ");+ let body = if c.on_all() {+ body.on_hover_text(full)+ } else {+ register(ui.ctx(), format!("keywordChipPartial:{}", c.path), body.rect);+ let n = crate::i18n::tr_format!("On {have} of {of} selected photos", have = c.have, of = c.of);+ body.on_hover_text(format!("{full}\n{n}"))+ };+ let c = c.clone();+ body.context_menu(|ui| menu(app, ui, &c));+}++/// When a list is shortened, only this many chips are measured for it: more than fit the lines+/// shown, however narrow they are.+const MEASURED: usize = 128;++/// The grouped box: each group's parent on a line of its own, its chips under it side by side,+/// and "+N more" where a long list stops.+fn chip_groups(app: &mut LightcraftApp, ui: &mut egui::Ui, groups: &[Group]) {+ use egui::{Align2, Sense, vec2};+ let t = Tokens::get(ui.ctx());+ let avail = ui.available_width();+ let all = app.ui.keyword_chips_all;+ // the widths the lines are planned with (past what a shortened list can show: a line each)+ let mut measured = 0_usize;+ let sizes: Vec<(bool, Vec<f32>)> = groups+ .iter()+ .map(|g| {+ let widths = g+ .chips+ .iter()+ .map(|(name, c)| {+ measured = measured.saturating_add(1);+ if all || measured <= MEASURED { chip_size(ui, name, !c.on_all(), true, avail).1 } else { avail }+ })+ .collect();+ (!g.parent.is_empty(), widths)+ })+ .collect();+ let small = t.font(11.5);+ for (i, line) in lines(&sizes, avail, GAP, all).into_iter().enumerate() {+ match line {+ Line::Heading(g) => {+ let Some(group) = groups.get(g) else { continue };+ ui.add_space(if i == 0 { 0.0 } else { 8.0 });+ let (r, resp) = ui.allocate_exact_size(vec2(avail, 18.0), Sense::hover());+ let measure = |s: &str| ui.painter().layout_no_wrap(s.to_string(), small.clone(), t.text_label).size().x;+ let shown = chip_label(&group.parent, false, avail, measure);+ let full = group.parent.replace('|', " › ");+ resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Label, true, &full));+ ui.painter().text(r.left_center(), Align2::LEFT_CENTER, shown, small.clone(), t.text_label);+ register(ui.ctx(), format!("keywordGroup:{}", group.parent), r);+ }+ Line::Chips(g, row) => {+ let Some(group) = groups.get(g) else { continue };+ ui.add_space(if i == 0 { 0.0 } else { 4.0 });+ ui.horizontal(|ui| {+ ui.spacing_mut().item_spacing.x = GAP;+ for (name, c) in group.chips.get(row).into_iter().flatten() {+ let (body, x) = chip(ui, &c.path, name, !c.on_all(), true, avail);+ chip_acts(app, ui, c, body, x);+ }+ });+ }+ Line::More(n) => {+ ui.add_space(6.0);+ let label = crate::i18n::tr_format!("+{n} more", n = n);+ let r = ui.add(egui::Button::new(egui::RichText::new(label).color(t.text_label)).corner_radius(10.0));+ register(ui.ctx(), "keywordChipsMore", r.rect);+ if r.on_hover_text(crate::i18n::tr("Show every keyword of the selected photos")).clicked() {+ app.ui.keyword_chips_all = true;+ }+ }+ Line::Fewer => {+ ui.add_space(6.0);+ let r = ui.add(egui::Button::new(egui::RichText::new(crate::i18n::tr("Show fewer")).color(t.text_label)).corner_radius(10.0));+ register(ui.ctx(), "keywordChipsFewer", r.rect);+ if r.clicked() {+ app.ui.keyword_chips_all = false;}}- // one tooltip: the whole name (it may be cut short), and how many have it- let full = c.path.replace('|', " › ");- let body = if c.on_all() {- body.on_hover_text(full)- } else {- register(ui.ctx(), format!("keywordChipPartial:{}", c.path), body.rect);- let n = crate::i18n::tr_format!("On {have} of {of} selected photos", have = c.have, of = c.of);- body.on_hover_text(format!("{full}\n{n}"))- };- let c = c.clone();- body.context_menu(|ui| menu(app, ui, &c));}- });+ }+}++/// What the grouped box's suggestions say of the keywords `paths`: each one's own name, or its+/// whole path (" › " between its levels) when another of them has the same name.+pub(crate) fn suggestion_names(paths: &[String]) -> Vec<String> {+ use lightcraft_catalog::keywords::SEP;+ let leaf = |p: &str| p.rsplit(SEP).next().unwrap_or(p).to_lowercase();+ let mut named: std::collections::HashMap<String, usize> = Default::default();+ for p in paths {+ *named.entry(leaf(p)).or_default() += 1;+ }+ paths+ .iter()+ .map(|p| if named.get(&leaf(p)).is_some_and(|n| *n > 1) { p.replace(SEP, " › ") } else { p.rsplit(SEP).next().unwrap_or(p).to_string() })+ .collect()}/// A chip's label within `room` (as `measure` measures text): the keyword's path with " › "@@ -171,6 +289,115 @@ pub(crate) fn chip_label(path: &str, partial: bool, room: f32, measure: impl Fn(best}+/// Keywords of the selection that are inside the same keyword, as the grouped box shows them.+#[derive(Clone, Debug, PartialEq, Eq)]+pub(crate) struct Group {+ /// The keyword they are inside, spelled as the first of them spells it; empty for the keywords+ /// that share none with another.+ pub parent: String,+ /// Each keyword's name below `parent`, and its chip.+ pub chips: Vec<(String, Chip)>,+}++/// The chips grouped by the keyword they are inside: the deepest one a chip shares with another+/// chip ("Places|Italy" for "Places|Italy|Rome" next to "Places|Italy|Venice"; "Transport" for+/// "Transport|Rail|Night Train" next to "Transport|Ferry"). Those that share none come first, in a group+/// without a parent; then the groups by name, each in the chips' order.+pub(crate) fn grouped(chips: &[Chip]) -> Vec<Group> {+ use lightcraft_catalog::keywords::SEP;+ let sep = SEP.to_string();+ // a path's first `depth` levels, and the rest+ let head = |levels: &[&str], depth: usize| levels.get(..depth).unwrap_or_default().join(&sep);+ let tail = |levels: &[&str], depth: usize| levels.get(depth..).unwrap_or_default().join(&sep);+ // how many chips are inside each keyword (by its lower-case path)+ let mut inside: std::collections::HashMap<String, usize> = Default::default();+ for c in chips {+ let levels: Vec<&str> = c.path.split(SEP).collect();+ for depth in 1..levels.len() {+ *inside.entry(head(&levels, depth).to_lowercase()).or_default() += 1;+ }+ }+ let mut groups: std::collections::BTreeMap<String, Group> = Default::default();+ for c in chips {+ let levels: Vec<&str> = c.path.split(SEP).collect();+ let shared = |depth: &usize| inside.get(&head(&levels, *depth).to_lowercase()).is_some_and(|n| *n > 1);+ let depth = (1..levels.len()).rev().find(shared).unwrap_or(0);+ let parent = head(&levels, depth);+ groups.entry(parent.to_lowercase()).or_insert_with(|| Group { parent, chips: Vec::new() }).chips.push((tail(&levels, depth), c.clone()));+ }+ groups.into_values().collect()+}++/// Items `widths` wide laid out left to right in rows `avail` wide, `gap` apart: the items of each+/// row. An item wider than a row has a row to itself.+pub(crate) fn rows_of(widths: &[f32], avail: f32, gap: f32) -> Vec<std::ops::Range<usize>> {+ let mut rows = Vec::new();+ let (mut start, mut used) = (0, 0.0_f32);+ for (i, w) in widths.iter().enumerate() {+ let w = if w.is_finite() { w.max(0.0) } else { 0.0 };+ if i > start && used + gap + w > avail {+ rows.push(start..i);+ (start, used) = (i, w);+ } else {+ used = if i == start { w } else { used + gap + w };+ }+ }+ if start < widths.len() {+ rows.push(start..widths.len());+ }+ rows+}++/// A line of the grouped box.+#[derive(Clone, Debug, PartialEq, Eq)]+pub(crate) enum Line {+ /// The name of a group's parent.+ Heading(usize),+ /// Chips of a group (by their place in it).+ Chips(usize, std::ops::Range<usize>),+ /// "+N more": this many chips are not shown.+ More(usize),+ /// "Show fewer", under a list shown whole that would otherwise be shortened.+ Fewer,+}++/// The grouped box shows this many lines of a long list (then "+N more")…+pub(crate) const LINES: usize = 8;+/// …but a list only this many lines longer is shown whole: "+1 more" saves nothing.+pub(crate) const SLACK: usize = 2;++/// The lines of the grouped box: for each group whether it has a heading and how wide its chips+/// are, in rows `avail` wide with chips `gap` apart. A list longer than [`LINES`] + [`SLACK`]+/// lines stops after [`LINES`] and says how many chips are left, unless `all` of it is asked for.+pub(crate) fn lines(groups: &[(bool, Vec<f32>)], avail: f32, gap: f32, all: bool) -> Vec<Line> {+ let mut out = Vec::new();+ for (g, (heading, widths)) in groups.iter().enumerate() {+ if widths.is_empty() {+ continue;+ }+ if *heading {+ out.push(Line::Heading(g));+ }+ out.extend(rows_of(widths, avail, gap).into_iter().map(|row| Line::Chips(g, row)));+ }+ if out.len() <= LINES + SLACK {+ return out;+ }+ if all {+ out.push(Line::Fewer);+ return out;+ }+ out.truncate(LINES);+ if matches!(out.last(), Some(Line::Heading(_))) {+ out.pop();+ }+ let count = |lines: &[Line]| lines.iter().map(|l| if let Line::Chips(_, row) = l { row.len() } else { 0 }).sum::<usize>();+ let total: usize = groups.iter().map(|(_, widths)| widths.len()).sum();+ let left = total.saturating_sub(count(&out));+ out.push(Line::More(left));+ out+}+/// A keyword of the selection, as a chip shows it.#[derive(Clone, Debug, PartialEq, Eq)]pub(crate) struct Chip {@@ -358,7 +585,8 @@ mod tests {for _ in 0..3 {let mut out = ctx.run_ui(egui::RawInput::default(), |ui| {ui.set_max_width(120.0);- let _ = chip(ui, "Places|Portugal|Lisbon|Belém tower", true, true);+ let path = "Places|Portugal|Lisbon|Belém tower";+ let _ = chip(ui, path, "Belém tower", true, true, 120.0);});out.textures_delta.clear();if let Some(update) = out.platform_output.accesskit_update.take() {@@ -370,6 +598,106 @@ mod tests {assert!(has("Button", "Remove “Places › Portugal › Lisbon › Belém tower”"), "{found:?}");}+ fn chip_of(path: &str) -> Chip {+ Chip { path: path.into(), have: 1, of: 1 }+ }++ fn groups_of(paths: &[&str]) -> Vec<(String, Vec<String>)> {+ let chips: Vec<Chip> = paths.iter().map(|p| chip_of(p)).collect();+ grouped(&chips).into_iter().map(|g| (g.parent, g.chips.into_iter().map(|(name, _)| name).collect())).collect()+ }++ /// Given keywords inside the same keyword, when the box groups them, then they share a line+ /// naming that keyword and each says only what is below it; a keyword alone below its parent+ /// joins the nearest keyword it shares with another, and one that shares none comes first+ /// under no name.+ #[test]+ fn keywords_group_under_the_keyword_they_share() {+ let got = groups_of(&[+ "beach",+ "Places|Italy|Florence",+ "Places|Italy|Rome",+ "Places|Portugal|Lisbon",+ "Places|Portugal|Porto",+ "Transport|Ferry",+ "Transport|Rail|Night Train",+ ]);+ let want: Vec<(String, Vec<String>)> = [+ ("", vec!["beach"]),+ ("Places|Italy", vec!["Florence", "Rome"]),+ ("Places|Portugal", vec!["Lisbon", "Porto"]),+ ("Transport", vec!["Ferry", "Rail|Night Train"]),+ ]+ .into_iter()+ .map(|(p, c)| (p.to_string(), c.into_iter().map(str::to_string).collect()))+ .collect();+ assert_eq!(got, want);+ }++ /// A keyword and one inside it are both inside their shared parent; a hierarchy with one+ /// keyword stays whole, under no name; spelling differences of the parent don't split a group.+ #[test]+ fn grouping_holds_at_the_edges() {+ assert_eq!(groups_of(&["A|B", "A|B|C"]), [("A".to_string(), vec!["B".to_string(), "B|C".to_string()])]);+ assert_eq!(groups_of(&["Places|Portugal|Lisbon"]), [(String::new(), vec!["Places|Portugal|Lisbon".to_string()])]);+ assert_eq!(groups_of(&["Places|Rome", "places|Athens"]), [("Places".to_string(), vec!["Rome".to_string(), "Athens".to_string()])]);+ assert_eq!(groups_of(&["İstanbul|Köprü", "i̇stanbul|Kule"]).len(), 1, "a parent whose lower case is longer");+ assert!(groups_of(&[]).is_empty());+ // every chip is in exactly one group+ let paths = ["a", "a|b", "a|b|c", "a|d", "e|f", "g"];+ let n: usize = groups_of(&paths).iter().map(|(_, c)| c.len()).sum();+ assert_eq!(n, paths.len());+ }++ /// Chips fill a row until the next would not fit; one wider than the row has a row to itself,+ /// and widths that are not numbers don't break the layout.+ #[test]+ fn chips_fill_rows() {+ assert_eq!(rows_of(&[40.0, 40.0, 40.0], 100.0, 6.0), [0..2, 2..3]);+ assert_eq!(rows_of(&[40.0, 54.0], 100.0, 6.0).len(), 1, "exactly fits");+ assert_eq!(rows_of(&[300.0, 20.0], 100.0, 6.0), [0..1, 1..2]);+ assert_eq!(rows_of(&[20.0, 300.0, 20.0], 100.0, 6.0), [0..1, 1..2, 2..3]);+ assert!(rows_of(&[], 100.0, 6.0).is_empty());+ assert_eq!(rows_of(&[f32::NAN, f32::INFINITY, 10.0], 100.0, 6.0).iter().map(|r| r.len()).sum::<usize>(), 3);+ assert_eq!(rows_of(&[10.0, 10.0], 0.0, 6.0), [0..1, 1..2], "no room at all");+ }++ /// Given a list of more than LINES + SLACK lines, when it isn't asked for whole, then LINES+ /// lines show and the rest is counted; a heading is never the last line shown. Asked for+ /// whole, it ends in "Show fewer". A shorter list is shown as it is.+ #[test]+ fn a_long_list_is_shortened_and_says_how_much_is_left() {+ // a heading and 3 chips, a heading and 9 (one chip a row): 14 lines+ let groups = vec![(true, vec![90.0; 3]), (true, vec![90.0; 9])];+ let short = lines(&groups, 100.0, 6.0, false);+ assert_eq!(short.len(), LINES + 1, "{short:?}");+ assert_eq!(short.last(), Some(&Line::More(6)), "3 + 3 chips shown: {short:?}");+ let whole = lines(&groups, 100.0, 6.0, true);+ assert_eq!(whole.len(), 15);+ assert_eq!(whole.last(), Some(&Line::Fewer));+ // the eighth line would be the second group's heading: it goes too+ let cut = lines(&[(false, vec![90.0; 7]), (true, vec![90.0; 6])], 100.0, 6.0, false);+ assert_eq!(cut.len(), LINES, "{cut:?}");+ assert_eq!(cut.last(), Some(&Line::More(6)));+ assert!(cut.iter().all(|l| !matches!(l, Line::Heading(_))), "{cut:?}");+ // within the slack: whole, with neither button+ let fits = lines(&[(true, vec![90.0; 9])], 100.0, 6.0, false);+ assert_eq!(fits.len(), 10);+ assert!(fits.iter().all(|l| matches!(l, Line::Heading(_) | Line::Chips(..))));+ assert_eq!(lines(&[(true, vec![90.0; 9])], 100.0, 6.0, true), fits, "nothing to show fewer of");+ assert!(lines(&[], 100.0, 6.0, false).is_empty());+ assert!(lines(&[(true, vec![])], 100.0, 6.0, false).is_empty(), "a group without chips has no heading");+ }++ /// The grouped box's suggestions say a keyword's own name; two with the same name say their+ /// whole paths, so they can be told apart.+ #[test]+ fn suggestions_are_named_apart() {+ let paths: Vec<String> = ["Italy|Rome|Market", "Spain|Madrid|market", "Places|Lisbon", "sea"].iter().map(|s| s.to_string()).collect();+ assert_eq!(suggestion_names(&paths), ["Italy › Rome › Market", "Spain › Madrid › market", "Lisbon", "sea"]);+ assert!(suggestion_names(&[]).is_empty());+ }+/// "Keywords & Containing Keywords": every level of the selection's keywords, flat, each/// counted once per photo.#[test]diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rsindex 8d0cc0d3a..cdbbf6132 100644--- a/crates/ui-egui/src/panels/right.rs+++ b/crates/ui-egui/src/panels/right.rs@@ -20,10 +20,11 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {if app.ui.right == RightPanel::Keywords {egui::ScrollArea::vertical().id_salt("right-scroll").auto_shrink([false, false]).show(ui, |ui| {ui.spacing_mut().item_spacing.y = 0.0;- header(ui, "Keywords");- padded(ui, |ui| {- ui.label(egui::RichText::new(crate::i18n::tr("Select photos to give them keywords.")).color(t.text_dim));- });+ if fold_header(app, ui, "keywording", "Keywords") {+ padded(ui, |ui| {+ ui.label(egui::RichText::new(crate::i18n::tr("Select photos to give them keywords.")).color(t.text_dim));+ });+ }super::keyword_list::show(app, ui);});return;@@ -57,6 +58,36 @@ pub fn header(ui: &mut egui::Ui, title: &str) {ui.painter().text(pos2(r.left() + 24.0, r.center().y + 2.0), Align2::LEFT_CENTER, crate::i18n::tr(title), t.semibold(15.0), t.text);}+/// A panel title that folds its section shut and open again (`section:{id}`; kept in+/// [`crate::state::UiState::folded_sections`]). Says whether the section is open.+pub fn fold_header(app: &mut LightcraftApp, ui: &mut egui::Ui, id: &str, title: &str) -> bool {+ let (r, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 46.0), Sense::click());+ let title = crate::i18n::tr(title);+ fold_title(app, ui, id, r, &resp, title)+}++/// [`fold_header`] for a title whose room is already taken (`r`, answering as `resp`).+pub fn fold_title(app: &mut LightcraftApp, ui: &egui::Ui, id: &str, r: Rect, resp: &egui::Response, title: &str) -> bool {+ let t = Tokens::get(ui.ctx());+ let open = !app.ui.section_folded(id);+ resp.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::CollapsingHeader, true, open, title));+ register(ui.ctx(), format!("section:{id}"), r);+ let p = ui.painter();+ if resp.hovered() {+ p.rect_filled(r, 0.0, t.chrome.gamma_multiply(1.06));+ }+ if resp.has_focus() {+ p.rect_stroke(r.shrink(2.0), 4.0, egui::Stroke::new(1.5, t.accent), egui::StrokeKind::Inside);+ }+ p.text(pos2(r.left() + 24.0, r.center().y + 2.0), Align2::LEFT_CENTER, title, t.semibold(15.0), t.text);+ let chevron = Rect::from_center_size(pos2(r.right() - 30.0, r.center().y + 2.0), vec2(14.0, 14.0));+ paint(p, chevron, if open { Icon::ChevronDown } else { Icon::ChevronRight }, t.icon);+ if resp.clicked() {+ app.ui.toggle_folded(id);+ }+ open+}+pub fn label_row(ui: &mut egui::Ui, label: &str, value: &str) {let t = Tokens::get(ui.ctx());let (r, _) = ui.allocate_exact_size(vec2(ui.available_width(), 24.0), Sense::hover());@@ -818,7 +849,15 @@ fn keywords(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {if app.session.catalog.photo(id).is_none() {return;}- header(ui, "Keywords");+ if fold_header(app, ui, "keywording", "Keywords") {+ keywording(app, ui);+ }+ super::keyword_list::show(app, ui);+}++/// The Keywording box: the field that adds keywords, the selection's keywords, the keyword set,+/// the painter and the suggestions.+fn keywording(app: &mut LightcraftApp, ui: &mut egui::Ui) {let t = Tokens::get(ui.ctx());padded(ui, |ui| {let kid = egui::Id::new("kw-input");@@ -882,10 +921,18 @@ fn keywords(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {let suggestions = (*app.caches.suggestions(&app.session.catalog, &have, &last, 12)).clone();if !suggestions.is_empty() {ui.label(egui::RichText::new(crate::i18n::tr("Suggestions")).color(t.text_dim));+ // grouped: the keyword's own name, its whole path in the tooltip+ let grouped = app.ui.settings.keyword_chips == crate::state::KeywordChips::Grouped;+ let names = if grouped { super::keywording::suggestion_names(&suggestions) } else { Vec::new() };ui.horizontal_wrapped(|ui| {- for k in suggestions {- let r = ui- .add(egui::Button::new(egui::RichText::new(format!("+ {}", k.replace('|', " › "))).color(t.text_label)).corner_radius(10.0));+ if grouped {+ ui.spacing_mut().item_spacing = vec2(6.0, 4.0);+ }+ for (i, k) in suggestions.into_iter().enumerate() {+ let whole = k.replace('|', " › ");+ let name = names.get(i).unwrap_or(&whole);+ let r = ui.add(egui::Button::new(egui::RichText::new(format!("+ {name}")).color(t.text_label)).corner_radius(10.0));+ let r = if grouped { r.on_hover_text(&whole) } else { r };register(ui.ctx(), format!("kwSuggest:{k}"), r.rect);if r.clicked() {let _ = app.run("photo.setMeta", json!({"addKeywords": [k]}));@@ -897,7 +944,6 @@ fn keywords(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {});}});- super::keyword_list::show(app, ui);}/// The keyword set: pick a set, then nine buttons (⌥1–⌥9) that toggle its keywords on thediff --git a/crates/ui-egui/src/panels/settings.rs b/crates/ui-egui/src/panels/settings.rsindex a0717ccfd..ca5e408fc 100644--- a/crates/ui-egui/src/panels/settings.rs+++ b/crates/ui-egui/src/panels/settings.rs@@ -652,6 +652,16 @@ fn interface_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {);});check(ui, "settings.showFilenames", &mut app.ui.show_filenames, "Square Grid: show file names and formats");+ heading(ui, t, crate::i18n::tr("Keywords"));+ row(ui, t, crate::i18n::tr("Keywords of the selection"), |ui| {+ use crate::state::KeywordChips as K;+ choices(ui, "settingsKeywordChips", &[(K::Paths, "Whole names"), (K::Grouped, "Grouped by parent")], &mut app.ui.settings.keyword_chips);+ });+ hint(+ ui,+ t,+ crate::i18n::tr("Grouped: keywords inside the same keyword share a line naming it, and long lists and the suggestions are shortened."),+ );heading(ui, t, crate::i18n::tr("Detail"));check(ui, "settings.navigator", &mut app.ui.navigator, "Show the Navigator while zoomed in");row(ui, t, crate::i18n::tr("Info overlay"), |ui| {diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rsindex cc583e7b3..f3b40a95e 100644--- a/crates/ui-egui/src/state.rs+++ b/crates/ui-egui/src/state.rs@@ -283,6 +283,8 @@ pub struct AppSettings {/// The monitor's ICC profile previews are shown through (`app.displayProfile`; "" = none:/// the display is treated as sRGB).pub display_profile: String,+ /// The Keywording box: whole keyword paths, or grouped by the keyword they are inside.+ pub keyword_chips: KeywordChips,}impl Default for AppSettings {@@ -308,6 +310,7 @@ impl Default for AppSettings {light_theme: LightTheme::Silver,favorite_themes: Vec::new(),display_profile: String::new(),+ keyword_chips: KeywordChips::default(),}}}@@ -490,6 +493,18 @@ pub enum KeywordingView {WillExport,}+/// How the Keywording box lays out the selection's keywords.+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub enum KeywordChips {+ /// One chip per keyword, each with its whole path ("Places › Portugal › Lisbon").+ #[default]+ Paths,+ /// Keywords inside the same keyword share a line naming it, and their chips say only what is+ /// below it; long lists and the suggestions are shortened.+ Grouped,+}+#[derive(Clone, Debug, Serialize, Deserialize)]#[serde(default, rename_all = "camelCase")]pub struct UiState {@@ -711,6 +726,13 @@ pub struct UiState {pub keyword_painter: Option<String>,/// What the Keywording box shows (Lightroom Classic's Keyword Tags views).pub keywording_view: KeywordingView,+ /// The Keywording box, grouped: every keyword is shown, however many lines that takes ("+N+ /// more" was clicked).+ #[serde(skip)]+ pub keyword_chips_all: bool,+ /// Sections of the right panel folded shut by a click on their title (`keywording`,+ /// `keywordList`); the others are open.+ pub folded_sections: Vec<String>,/// The Keyword List's open levels (lower-case paths).pub keyword_list_open: Vec<String>,/// The keyword picked in the Keyword List (− deletes it, Edit edits it).@@ -1141,6 +1163,8 @@ impl Default for UiState {second_window: false,keyword_painter: None,keywording_view: KeywordingView::default(),+ keyword_chips_all: false,+ folded_sections: Vec::new(),keyword_list_open: Vec::new(),keyword_list_selected: None,dragging_keyword: None,@@ -1182,6 +1206,18 @@ impl UiState {self.grading_hidden = h.iter().any(|x| *x).then_some((photo, h));}+ /// A right-panel section that folds by its title is folded shut.+ pub fn section_folded(&self, id: &str) -> bool {+ self.folded_sections.iter().any(|s| s == id)+ }+ pub fn toggle_folded(&mut self, id: &str) {+ if self.section_folded(id) {+ self.folded_sections.retain(|s| s != id);+ } else {+ self.folded_sections.push(id.to_string());+ }+ }+pub fn section_open(&self, id: &str) -> bool {self.open_sections.iter().any(|s| s == id)}diff --git a/crates/ui-egui/src/tests_keywording.rs b/crates/ui-egui/src/tests_keywording.rsindex a130b86b2..ed9ecbd51 100644--- a/crates/ui-egui/src/tests_keywording.rs+++ b/crates/ui-egui/src/tests_keywording.rs@@ -227,3 +227,149 @@ fn containing_keywords_view_lists_parents_too() {}assert!(!has(&h, "keywordChip:beach"), "the chips give way");}++fn rect(h: &Headless, id: &str) -> egui::Rect {+ h.app.widgets.iter().find(|(w, _)| w == id).map(|(_, r)| *r).unwrap_or_else(|| panic!("no widget {id}"))+}++fn count(h: &Headless, prefix: &str) -> usize {+ h.app.widgets.iter().filter(|(w, _)| w.starts_with(prefix)).count()+}++/// Give both selected photos `keywords`, replacing what they had.+fn give(h: &mut Headless, ids: &[u64], keywords: &[String]) {+ ask(h, "engine.execute", json!({"command": "photo.setMeta", "params": {"ids": ids, "keywords": keywords}}));+}++/// Sixteen keywords inside "Subjects", each long enough to take a line of the panel.+fn sixteen() -> Vec<String> {+ (1..=16).map(|i| format!("Subjects|a keyword with quite a long name {i:02}")).collect()+}++// Given keywords inside the same keyword and the box set to group them,+// when the panel is drawn,+// then they share a line naming that keyword and their chips say only what is below it, side by+// side where they fit; each chip still acts on its whole keyword.+#[test]+fn grouped_keywords_share_a_line_naming_their_parent() {+ let (mut h, ids) = two_selected();+ let keywords: Vec<String> = ["Places|Italy|Rome", "Places|Italy|Venice", "Transport|Ferry", "sea"].iter().map(|s| s.to_string()).collect();+ give(&mut h, &ids, &keywords);+ assert_eq!(+ count(&h, "keywordGroup:"),+ 0,+ "whole names unless asked: {:?}",+ h.app.widgets.iter().filter(|(w, _)| w.starts_with("keywordGroup")).collect::<Vec<_>>()+ );+ let whole = rect(&h, "keywordChip:Places|Italy|Rome").width();++ h.app.ui.settings.keyword_chips = crate::state::KeywordChips::Grouped;+ h.settle(SETTLE);+ let heading = rect(&h, "keywordGroup:Places|Italy");+ let (rome, venice) = (rect(&h, "keywordChip:Places|Italy|Rome"), rect(&h, "keywordChip:Places|Italy|Venice"));+ assert!(rome.top() >= heading.bottom(), "under its heading: {rome:?} {heading:?}");+ assert_eq!(rome.top(), venice.top(), "side by side");+ assert!(rome.width() < whole, "the chip says only “Rome”: {} < {whole}", rome.width());+ // a keyword that shares nothing has no heading and comes first+ assert!(!has(&h, "keywordGroup:Transport") && !has(&h, "keywordGroup:"), "one keyword is no group");+ assert!(rect(&h, "keywordChip:sea").top() < heading.top());+ // the × still takes the whole keyword off both+ ask(&mut h, "ui.clickWidget", json!({"id": "keywordChipRemove:Places|Italy|Rome"}));+ assert!(ids.iter().all(|id| !keywords_of(&h, *id).iter().any(|k| k == "Places|Italy|Rome")));+ assert!(ids.iter().all(|id| keywords_of(&h, *id).iter().any(|k| k == "Places|Italy|Venice")));+}++// Given sixteen keywords and the grouped box,+// when the panel is drawn,+// then eight lines show with "+N more" for the rest, which shows them all; "Show fewer" brings the+// short list back. The Keyword List is nearer the top for it.+#[test]+fn a_long_grouped_list_is_shortened_until_asked_for() {+ let (mut h, ids) = two_selected();+ give(&mut h, &ids, &sixteen());+ assert_eq!(count(&h, "keywordChip:"), 16, "whole names: every keyword, as before");+ assert!(!has(&h, "keywordChipsMore"));+ let list_before = rect(&h, "field:keywordFilter").top();++ h.app.ui.settings.keyword_chips = crate::state::KeywordChips::Grouped;+ h.settle(SETTLE);+ assert_eq!(count(&h, "keywordChip:"), 7, "a heading and seven chips");+ assert!(has(&h, "keywordChipsMore") && !has(&h, "keywordChipsFewer"));+ assert!(rect(&h, "field:keywordFilter").top() < list_before - 80.0, "{} from {list_before}", rect(&h, "field:keywordFilter").top());++ ask(&mut h, "ui.clickWidget", json!({"id": "keywordChipsMore"}));+ assert_eq!(count(&h, "keywordChip:"), 16);+ assert!(has(&h, "keywordChipsFewer") && !has(&h, "keywordChipsMore"));+ ask(&mut h, "ui.clickWidget", json!({"id": "keywordChipsFewer"}));+ assert_eq!(count(&h, "keywordChip:"), 7);+}++// Given the grouped box, chips stay inside the panel and never overlap, whatever their length.+#[test]+fn grouped_chips_stay_inside_the_panel() {+ let (mut h, ids) = two_selected();+ h.app.ui.settings.keyword_chips = crate::state::KeywordChips::Grouped;+ let long = "Places|Portugal|Lisbon|Belém tower and the old town square on the river by the bridge";+ let keywords: Vec<String> =+ ["Events|Weddings", "Events|Birthdays", "sunset", "Places|Portugal|Porto", long].iter().map(|s| s.to_string()).collect();+ give(&mut h, &ids, &keywords);+ let panel = rect(&h, "panel:right_panel");+ let chips: Vec<(String, egui::Rect)> = h.app.widgets.iter().filter(|(w, _)| w.starts_with("keywordChip:")).cloned().collect();+ assert_eq!(chips.len(), 5, "{chips:?}");+ for (i, (id, r)) in chips.iter().enumerate() {+ assert!(r.left() >= panel.left() && r.right() <= panel.right(), "{id} inside the panel: {r:?} in {panel:?}");+ for (other, o) in chips.iter().skip(i + 1) {+ assert!(!r.intersects(o.shrink(0.5)), "{id} overlaps {other}");+ }+ }+}++// Given a selection without keywords, the box says so (as its other two views do).+#[test]+fn a_selection_without_keywords_says_so() {+ let (mut h, ids) = two_selected();+ give(&mut h, &ids, &[]);+ assert!(has(&h, "keywordChipsEmpty"));+ h.app.ui.settings.keyword_chips = crate::state::KeywordChips::Grouped;+ h.settle(SETTLE);+ assert!(has(&h, "keywordChipsEmpty"));+}++// Given the Keywords panel,+// when the title of Keywording or of the Keyword List is clicked,+// then that section folds shut and the other stays; a second click opens it, and what is folded is+// kept with the interface's settings.+#[test]+fn the_sections_fold_by_their_titles() {+ let (mut h, _) = two_selected();+ assert!(has(&h, "field:keyword") && has(&h, "field:keywordFilter"));+ let list_before = rect(&h, "field:keywordFilter").top();+ ask(&mut h, "ui.clickWidget", json!({"id": "section:keywording"}));+ assert!(!has(&h, "field:keyword") && !has(&h, "keywordChip:beach") && !has(&h, "kwSet:1"), "Keywording is shut");+ assert!(has(&h, "field:keywordFilter"), "the Keyword List stays");+ assert!(rect(&h, "field:keywordFilter").top() < list_before - 100.0);+ let saved = serde_json::to_string(&h.app.ui).unwrap();+ let back = serde_json::from_str::<crate::UiState>(&saved).unwrap().sanitized();+ assert!(back.section_folded("keywording") && !back.section_folded("keywordList"));+ assert!(!serde_json::from_str::<crate::UiState>("{}").unwrap().section_folded("keywording"), "settings from before: open");++ ask(&mut h, "ui.clickWidget", json!({"id": "section:keywordList"}));+ assert!(!has(&h, "field:keywordFilter") && !has(&h, "keywordCheck:beach"), "the Keyword List is shut");+ ask(&mut h, "ui.clickWidget", json!({"id": "section:keywording"}));+ ask(&mut h, "ui.clickWidget", json!({"id": "section:keywordList"}));+ assert!(has(&h, "field:keyword") && has(&h, "field:keywordFilter") && has(&h, "keywordChip:beach"));+}++// Given the grouped box, the suggestions say only the keyword's own name (its whole path when two+// of them have the same name) and still give the whole keyword.+#[test]+fn grouped_suggestions_name_the_keyword_alone() {+ let (mut h, ids) = two_selected();+ ask(&mut h, "engine.execute", json!({"command": "photo.setMeta", "params": {"ids": [ids[0]], "addKeywords": ["Places|Portugal|Lisbon"]}}));+ let whole = rect(&h, "kwSuggest:Places|Portugal|Lisbon").width();+ h.app.ui.settings.keyword_chips = crate::state::KeywordChips::Grouped;+ h.settle(SETTLE);+ assert!(rect(&h, "kwSuggest:Places|Portugal|Lisbon").width() < whole);+ ask(&mut h, "ui.clickWidget", json!({"id": "kwSuggest:Places|Portugal|Lisbon"}));+ assert!(ids.iter().all(|id| keywords_of(&h, *id).iter().any(|k| k == "Places|Portugal|Lisbon")));+}diff --git a/docs/parity-checklist.md b/docs/parity-checklist.mdindex 7bb187811..290732c53 100644--- a/docs/parity-checklist.md+++ b/docs/parity-checklist.md@@ -704,7 +704,7 @@ From `08-lightroom-classic-extras.md` (Classic-only features) and part 2 of `06-| LRC-LIB-STACKS | Stacks (full) | P1 | ✅ | `crates/catalog/src/stacks.rs`, `cmd:stack.group`, `cmd:stack.split`, `cmd:stack.moveUp`, `cmd:stack.moveDown` | group / ungroup / toggle / set top / remove / auto by time / split / move up and down || LRC-LIB-VC | Virtual copies | P1 | ✅ | `cmd:photo.virtualCopy` | ⌘' || LRC-LIB-LABELS | Colour-label sets | P1 | ✅ | `cmd:label.sets`, `cmd:label.applySet`, `cmd:label.saveSet`, `cmd:label.deleteSet`, `cmd:label.setNames`, `crates/engine/src/cmd/manage.rs` | built-in Colors / Review sets + user sets (Photo ▸ Set Color Label, Edit Label Names… dialog); names written to and read from `xmp:Label` |-| LRC-LIB-KEYWORDS | Hierarchical keywords, sets, painter, Keyword List | P1 | ✅ | `crates/catalog/src/keywords.rs`, `crates/ui-egui/src/panels/keyword_list.rs`, `cmd:keyword.list`, `cmd:keyword.create`, `cmd:keyword.edit`, `cmd:keyword.move`, `cmd:keyword.info`, `cmd:keyword.purgeUnused`, `cmd:keyword.setDefaultParent`, `cmd:keyword.sets`, `cmd:keyword.toggleFromSet`, `cmd:keyword.saveSet`, `cmd:tool.keywordPainter` | hierarchical `a\|b\|c` keywords (tree, parent filters include children, rename moves children); keyword sets + Recent Keywords (⌥1–⌥9); keyword painter (Keywords panel ▸ Paint: click photos in the grid to toggle a keyword, Esc stops). Keyword List (Keywords panel): every keyword, those without photos too (a keyword list in the catalog, format version 4), with counts, a filter box, a tri-state tick box for the selection and an arrow to show its photos; + / Create Keyword Tag (name, synonyms, put inside, add to selected photos), double-click / Edit Keyword Tag, − / Delete with confirmation, context menu (create inside, Put New Keywords Inside This Keyword, purge unused keywords); drag a keyword onto another to nest it or onto the list's title for the top level (a merge asks first), drag photos onto a keyword to tag them. The list is there without a selection too; Put New Keywords Inside This Keyword (kept with the keyword in the library, undoable) also places new keywords typed in the Keywords panel. Keyword tag options include on export, export containing keywords and export synonyms shape exported files (names in `dc:subject`, paths in `lr:hierarchicalSubject`), and files' `lr:hierarchicalSubject` paths come back as keywords on import and from sidecars; Person is stored only. Keywording box (`crates/ui-egui/src/panels/keywording.rs`): the selection's keywords as chips (one only some selected photos have marked with an asterisk; × only removes, from every selected photo; with no selection, the active photo's), a Keywords / & Containing / Will Export switch (Lightroom Classic's Keyword Tags views: the keywords to edit, them with their parents, what exported files carry), keyword-set buttons and suggestions that follow the selection, shared text fields for typing and painting. Edit Keyword Set (Keyword Set ▸ Edit Set…): a set's name and nine slots typed in place, empty slots kept so each keyword stays on its ⌥ key, a set renamed in place (`cmd:keyword.saveSet` `replace`) or saved as a new set (`new`, a taken name refused). File ▸ Import Keywords… / Export Keywords… (`cmd:keyword.import`, `cmd:keyword.export`): keyword list files in Lightroom Classic's format (tab-indented, `{synonym}`, `[left out of export]`), which Capture One, darktable, Bridge and Photo Supreme (its Formatted Vocabulary File) read and write too; import adds what is missing in one undo step, export names the keywords Capture One refuses (; , < >). Not yet: synonyms in search, person keywords tied to faces, Keyword Shortcut, IPTC keywords in exported files (Piwigo, RawTherapee), hierarchy from digiKam / ACDSee / Microsoft XMP fields |+| LRC-LIB-KEYWORDS | Hierarchical keywords, sets, painter, Keyword List | P1 | ✅ | `crates/catalog/src/keywords.rs`, `crates/ui-egui/src/panels/keyword_list.rs`, `cmd:keyword.list`, `cmd:keyword.create`, `cmd:keyword.edit`, `cmd:keyword.move`, `cmd:keyword.info`, `cmd:keyword.purgeUnused`, `cmd:keyword.setDefaultParent`, `cmd:keyword.sets`, `cmd:keyword.toggleFromSet`, `cmd:keyword.saveSet`, `cmd:tool.keywordPainter` | hierarchical `a\|b\|c` keywords (tree, parent filters include children, rename moves children); keyword sets + Recent Keywords (⌥1–⌥9); keyword painter (Keywords panel ▸ Paint: click photos in the grid to toggle a keyword, Esc stops). Keyword List (Keywords panel): every keyword, those without photos too (a keyword list in the catalog, format version 4), with counts, a filter box, a tri-state tick box for the selection and an arrow to show its photos; + / Create Keyword Tag (name, synonyms, put inside, add to selected photos), double-click / Edit Keyword Tag, − / Delete with confirmation, context menu (create inside, Put New Keywords Inside This Keyword, purge unused keywords); drag a keyword onto another to nest it or onto the list's title for the top level (a merge asks first), drag photos onto a keyword to tag them. The list is there without a selection too; Put New Keywords Inside This Keyword (kept with the keyword in the library, undoable) also places new keywords typed in the Keywords panel. Keyword tag options include on export, export containing keywords and export synonyms shape exported files (names in `dc:subject`, paths in `lr:hierarchicalSubject`), and files' `lr:hierarchicalSubject` paths come back as keywords on import and from sidecars; Person is stored only. Keywording box (`crates/ui-egui/src/panels/keywording.rs`): the selection's keywords as chips (one only some selected photos have marked with an asterisk; × only removes, from every selected photo; with no selection, the active photo's), a Keywords / & Containing / Will Export switch (Lightroom Classic's Keyword Tags views: the keywords to edit, them with their parents, what exported files carry), keyword-set buttons and suggestions that follow the selection, shared text fields for typing and painting. Settings ▸ Interface ▸ Keywords of the selection ▸ Grouped by parent (`keywordChips: grouped` in the app settings; Whole names stays the default): keywords inside the same keyword share a line naming it (`keywordGroup:<parent>`: the deepest keyword a chip shares with another) and their chips say only what is below it, side by side; a list of more than ten lines stops after eight with “+N more” (`keywordChipsMore`, then `keywordChipsFewer`), and the suggestions say the keyword's own name (its whole path when two share a name, and in the tooltip). The titles of Keywords and of the Keyword List fold their sections shut (`section:keywording`, `section:keywordList`; kept in the UI state as `foldedSections`), and a selection without keywords says “No keywords yet”. Edit Keyword Set (Keyword Set ▸ Edit Set…): a set's name and nine slots typed in place, empty slots kept so each keyword stays on its ⌥ key, a set renamed in place (`cmd:keyword.saveSet` `replace`) or saved as a new set (`new`, a taken name refused). File ▸ Import Keywords… / Export Keywords… (`cmd:keyword.import`, `cmd:keyword.export`): keyword list files in Lightroom Classic's format (tab-indented, `{synonym}`, `[left out of export]`), which Capture One, darktable, Bridge and Photo Supreme (its Formatted Vocabulary File) read and write too; import adds what is missing in one undo step, export names the keywords Capture One refuses (; , < >). Not yet: synonyms in search, person keywords tied to faces, Keyword Shortcut, IPTC keywords in exported files (Piwigo, RawTherapee), hierarchy from digiKam / ACDSee / Microsoft XMP fields || LRC-LIB-METADATA | Metadata panel & presets | P1 | ✅ | `cmd:photo.setMeta`, `cmd:metadata.savePreset`, `cmd:metadata.applyPreset`, `cmd:metadata.presets`, `cmd:metadata.deletePreset`, `cmd:dialog.captureTime` | IPTC core, accessibility, place, capture-time edit; copyright status (unknown / copyrighted / public domain), rights usage terms and copyright info URL (`photo.setMeta` `copyrightStatus`, `usageTerms`, `copyrightUrl`; XMP Rights Management fields, kept by "copyright only" exports, a smart-album rule); metadata presets (Photo → Metadata Preset, Save Metadata Preset… from the active photo; applied on import from Settings) || LRC-LIB-QUICKDEV | Quick develop | P2 | ✅ | `cmd:develop.quickAdjust`, `crates/ui-egui/src/panels/edit.rs` (`quick_develop`) | grid with several photos selected: Edit panel ▸ Quick Develop steps (exposure ⅓ / 1 stop, contrast, highlights, shadows, whites, blacks, clarity, vibrance, temperature) added to each photo's own value, one undo step || LRC-LIB-PEOPLE | People view | P2 | 🟡 | `cmd:view.people`, `cmd:view.person`, `cmd:faces.person`, `cmd:faces.unnamed`, `cmd:faces.nameFaces`, `crates/ui-egui/src/panels/people.rs`, `crates/ui-egui/src/panels/person.rs`, `crates/ui-egui/src/panels/unnamed.rs`, `crates/engine/src/face_tiles.rs` | Named People cards (face close-up, the photo count on the picture, name) for the photos the active filters let through, with the filter chips shown above them, sized by the thumbnail slider. Below them the **Unnamed faces**: every face nobody has named as a cropped picture, look-alikes next to each other once recognition has looked at them, a suggested name on a face the named ones recognise; click or Shift-click to select, type a name, Enter names the whole group in one undo step. A click on a person opens their page: only cropped faces, then **More** (unnamed faces that look like them, best first; click to confirm, × to hide). Every face is shown by the detector's box where the scan has one, so faces are equally close. Until recognition is set up a line at the top offers the next step (Settings ▸ Faces, or Turn on), as does the loupe's name box. Face pictures of unedited raws are cut from the largest embedded preview (planned read: header and JPEG only, never the sensor data) when it holds at least ¾ of the tile's pixels across the face, else developed as before; all are kept in the thumbnail disk cache at 16 px size steps, so a later launch shows them without reading the originals (#1440, `docs/faces.md`). No clusters with separators between groups, no persistent reject, no merge of two peoplediff --git a/docs/whats-new.md b/docs/whats-new.mdindex 1bf44c3f4..91363d1e7 100644--- a/docs/whats-new.md+++ b/docs/whats-new.md@@ -200,6 +200,16 @@## 2026-10-11+### Keywords panel+- The titles **Keywords** and **Keyword List** in the Keywords panel fold their sections shut and open again, so+ the list of every keyword is one click away however many keywords the selected photos have. What is folded is+ remembered.+- Settings ▸ Interface ▸ Keywords of the selection ▸ **Grouped by parent** lays the selected photos' keywords out by+ the keyword they are inside: "Places › Italy" once, on a line of its own, with Rome, Venice and the others side by+ side under it. A long list stops after eight lines with "+N more", and the suggestions say only the keyword's own+ name. Whole names, one chip per keyword, stays the default.+- A selection without keywords now says "No keywords yet" where its chips would be.+### HDR and panorama merges of CR2 keep their colour- Photo Merge of Canon CR2 (and other raws whose colour LightCraft fits from the camera's own JPEG, such as NEF andARW) gives the merged DNG the colour each photo has when opened alone (issue #965). An HDR merge of CR2s used to come