Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

Merge PR #561

Brandon Thomasc2142540fec3
diff --cc crates/ui-egui/src/panels/dialogs.rs
index 34e484852,2473996ac..e62317170
--- a/crates/ui-egui/src/panels/dialogs.rs
+++ b/crates/ui-egui/src/panels/dialogs.rs
@@@ -247,30 -242,25 +247,28 @@@ pub fn show(app: &mut LightcraftApp, ct
let r = ui.add(egui::TextEdit::singleline(name).hint_text(crate::i18n::tr("Name")).desired_width(f32::INFINITY));
crate::widgets::register(ui.ctx(), "field:smartName", r.rect);
ui.add_space(6.0);
- egui::ScrollArea::vertical().max_height(360.0).auto_shrink([false, true]).show(ui, |ui| {
- crate::panels::rules_editor::edit(ui, rules, "rules", 0);
- });
- let problems = rules.problems();
// the folder an album made from a folder view carries is not in the editor, but it counts
let folder = id.and_then(|id| app.session.catalog.album(lightcraft_catalog::AlbumId(id))).and_then(|a| a.smart.as_deref().and_then(|f| f.library_folder.clone()));
- let f = lightcraft_catalog::Filter { rule_set: Some(rules.clone()), library_folder: folder, ..Default::default() };
- let n = if problems.is_empty() { app.session.catalog.query(&f, &Default::default()).len() } else { 0 };
+ // problems, count and albums: cached until the catalog or the rules change (not per frame)
+ let now = (app.session.clock)();
+ let view = app.caches.rules_view(&app.session.catalog, rules, *id, folder, &now);
+ let env = crate::panels::rules_editor::Env { problems: view.problems.clone(), today: now, albums: view.albums.clone() };
+ egui::ScrollArea::vertical().max_height(360.0).auto_shrink([false, true]).show(ui, |ui| {
+ crate::panels::rules_editor::edit(ui, rules, "rules", 0, &[], &env);
+ });
+ let n = view.count;
ui.add_space(4.0);
- ui.label(
- egui::RichText::new(match problems.first() {
- Some(p) => p.clone(),
- None => crate::i18n::tr_format!("{n} photo{} match · updates automatically as photos change", if n == 1 { "" } else { "s" }, n = n),
- })
- .color(t.text_dim),
- );
+ if view.problems.is_empty() {
+ ui.label(
+ egui::RichText::new(crate::i18n::tr_format!("{n} photo{} match · updates automatically as photos change", if n == 1 { "" } else { "s" }, n = n))
+ .color(t.text_dim),
+ );
+ } else {
+ ui.label(egui::RichText::new(crate::i18n::tr("Fix the marked rules to save this album.")).color(t.caution));
+ }
}
Dialog::NewSmartAlbum { name, .. } => {
- let r = ui.add(egui::TextEdit::singleline(name).hint_text(crate::i18n::tr("Name")).desired_width(f32::INFINITY));
- r.request_focus();
- if r.lost_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter)) {
+ if dialog_field(ui, "field:smartAlbumName", name, "Name") {
confirm = true;
}
let rules = app.session.view_rules();
diff --cc crates/ui-egui/src/widgets.rs
index 7105fb47d,2517df108..4281c28ec
--- a/crates/ui-egui/src/widgets.rs
+++ b/crates/ui-egui/src/widgets.rs
@@@ -192,10 -180,7 +192,9 @@@ pub fn slider(ui: &mut Ui, spec: &Contr
let value_rect = Rect::from_min_max(pos2(label_rect.right() - 64.0, label_rect.top()), label_rect.max);
let value_resp = ui.interact(value_rect, id.with("value"), if enabled { Sense::click() } else { Sense::hover() });
register(ui.ctx(), format!("sliderValue:{}", spec.id), value_rect);
+ // say that an exact value can be typed here (issue #534: an exact crop angle was hard to find)
+ let value_resp = if enabled { value_resp.on_hover_text(crate::i18n::tr("Click to type a value")) } else { value_resp };
let typing_id = id.with("typing");
- let field_id = id.with("typingField");
// the text being typed and how many frames the field has been up: it takes the keyboard on its
// first frames (not on the click's own, whose release would take the focus straight back)
let mut typing: Option<(String, u8)> = ui.data(|m| m.get_temp(typing_id));
diff --cc docs/whats-new.md
index 6322f5e5d,38a48e9cb..8f0016d18
--- a/docs/whats-new.md
+++ b/docs/whats-new.md
@@@ -2,42 -2,16 +2,52 @@@
## October 2026
+### Smart album rules
+- The rule editor's field menu is grouped: Rating, Pick Flag, Color Label and Any Searchable Text at the top, then
+ submenus for Source, File, Date, Keywords & People, Description, Camera Info, Location, Size, Develop and Assisted
+ Culling.
+- New fields: Keyword Count ("2 or more", "exactly 2"…), People and People Count (named faces), Shutter Speed (written
+ as 1/250), File Extension, Video Duration, Copy Name, In a Stack, Alt Text, City, State / Province, Country, Long
+ Edge, Short Edge, Aspect Ratio (landscape / portrait / square), Cropped and Treatment (in color / black & white).
+ Size rules measure the photo as shown: Megapixels now counts the cropped photo, like Long Edge, Short Edge and
+ Aspect Ratio (a 24 MP photo cropped to a square is 16 MP).
+- Choice values read as words in every language: "Public Domain", "Picked", "Black & White" rather than ids like
+ `publicDomain` (rules and agents keep using the ids; `album.ruleFields` adds `choiceLabels`).
+- Rule values are checked: a rating of 9, a date like 2026-13 or "banana", a "between" whose dates are the wrong
+ way round, "in the last 0 days", a colour label that doesn't exist, "contains" with nothing to look for, an
+ album that is gone, or an empty group is reported with its rule ("rule 2.1: no rating 0–5 is 9")
+ instead of quietly matching nothing or everything. New date rules start at the current year.
+- A smart album can include or exclude another smart album: "Keywords contain travel" and "Album isn't Excluded Photos"
+ leaves out whatever Excluded Photos matches, as its rules change. The album picker shows your albums as in the sidebar
+ (folders open on click) or finds them as you type part of a name or folder (↑ / ↓ and Enter to pick); albums that
+ can't be picked, such as one that would make an album include itself, are greyed with the reason. Esc with a dropdown or calendar open in a dialog
+ closes just that.
+- Date rules have a calendar button: pick a day, a month or a whole year (Year / Month / Day), in your language; the
+ two dates of a "between" can't be picked out of order; Esc closes just the calendar. It picks dates, not times (a
+ time is typed, and picking a day replaces one). Typing still works, and "2026-10-01 10:00" (a space for the
+ T) now matches.
+- Rule problems are shown in your language and name the field the way the menu does ("Title: needs something to look
+ for").
+- A smart album whose rules no longer check (an album they test was deleted) is marked ⚠ in the sidebar; its tooltip
+ says what to fix, and `albums.list` reports `problems`.
+- Editing a smart album's name and rules is one step: both or neither, and one undo takes both back
+ (`album.setRules` takes `name`).
+- The rule editor marks each rule that needs fixing right under it and keeps OK disabled until they are fixed. An
+ Album rule is "is" or "isn't" an album, picked with the album picker.
+- Yes/no fields (Has Edits, Cropped, Has GPS…) read Yes / No instead of true / false. A rule sent as `"false"` now
+ means no (it used to count as yes), and a value that is neither yes nor no is refused.
+- Any Searchable Text also finds the state / province, alt text, people and a virtual copy's name.
+
+ ### Text fields
+ - Right-click Search Photos, a slider's typed value, the Info panel's fields, the name field of New Album, Rename
+ Album, New Smart Album, Rename Keyword, Merge Keywords and similar dialogs, or the name field under unnamed faces for
+ Cut, Copy, Paste and Select All. Esc in them gives back the text from before you started typing (in the Info panel it
+ no longer saves it). Return in those dialogs now confirms them, and their name opens selected. More fields will
+ follow.
+ - On Windows and Linux, Ctrl+C outside a text field copies edit settings and Ctrl+V pastes them (⇧Ctrl+V: Paste
+ Selected Settings). Ctrl+V only reaches LightCraft while the system clipboard holds text; otherwise use Edit ▸ Paste Edit
+ Settings.
+
### Masking
- Drag anywhere inside the selected radial gradient's ellipse to move it, including rotated
ellipses and radial components in compound masks. Edge and rotation handles keep their existing