Merge main (5ef158833b) into pr/upright-posts

Conflicts:
docs/parity-checklist.md

Docs-only conflicts (parity checklist / whats-new) after #2920; kept both sides.
This commit is contained in:
FredApps committed 2026-11-26 19:19:32 +01:00
commit fa1f2dc42f
55 files changed
+2221 -173

No files matched your search

+1 -2
View File
@@ -48,13 +48,12 @@ harfrust = { version = "0.13", default-features = false, features = ["std"] }
unicode-normalization = "0.1"
unicode-segmentation = "1.13"
lightcraft-segment = { workspace = true, optional = true }
chrono = { workspace = true }
# model downloads run natively only (the web build fetches no models)
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
lightcraft-fetch = { workspace = true }
jiff = { workspace = true }
# capture-time parsing for face recognition (native only)
chrono = { workspace = true }
# free space of the drive holding the preview cache (the low-disk alert; pure Rust: rustix / windows-sys)
fs4 = { workspace = true }
+7 -2
View File
@@ -324,7 +324,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Brush Stroke",
[],
None,
"{id?: maskId, points: [[x,y],…] normalized, size?: fraction of long edge (0.03), feather?, flow?, density?, erase?: bool, autoMask?: bool, pressure?: [p,…] pen pressure 0..1 per point (scales each dab's size and flow; omitted: full), connect?: bool — start from the last point of the mask's last stroke (⇧-click), size / feather / flow tapering from that stroke's to these} → {activeMask, connected}",
"{id?: maskId, points: [[x,y],…] normalized, size?: fraction of long edge (0.03), feather?, flow?, density?, erase?: bool, autoMask?: bool, pressure?: [p,…] pen pressure 0..1 per point (scales each dab's size and flow; omitted: full), connect?: bool — start from the last point of the mask's last stroke (⇧-click), size / feather / flow tapering from that stroke's to these, continue?: bool — the stroke being painted, sent again as it grows: it replaces the mask's last stroke, so its effect shows while painting} → {activeMask, connected}",
has_active,
|s, p| {
let pts: Vec<Point> = p
@@ -347,6 +347,7 @@ pub fn specs() -> Vec<CommandSpec> {
pressure: pressure_list(p.get("pressure"), pts_len)?,
};
let connect = bool_or(p, "connect", false);
let again = bool_or(p, "continue", false);
let mut connected = false;
let next = s.active().and_then(|id| s.develop_of(id)).map(|d| d.next_mask_id()).unwrap_or(1);
let want = optional_mask_id(p, "mask.brushStroke")?.or(s.active_mask);
@@ -384,7 +385,11 @@ pub fn specs() -> Vec<CommandSpec> {
strokes.extend(connected_strokes(from, &last, stroke));
connected = true;
}
None => strokes.push(stroke),
// the stroke being painted, sent again as it grew: it replaces itself
None => match strokes.last_mut() {
Some(last) if again => *last = stroke,
_ => strokes.push(stroke),
},
}
} else {
m.components.push(MaskComponent {
+5 -2
View File
@@ -39,7 +39,7 @@ pub use params::{
};
#[cfg(test)]
use place::Placer;
pub use place::{write_file, write_file_durable, write_file_new};
pub use place::{clean_album_name, clean_subfolder, expand_subfolder, write_file, write_file_durable, write_file_new};
pub use prepare::{
AfterExport, Destination, DngCompression, Exported, PreparedExport, export_batch, export_photo, output_size, prepare_batch, prepare_export,
};
@@ -74,7 +74,10 @@ pub struct ExportOptions {
pub start_number: u32,
/// A specific folder for the whole batch, or each photo's own folder.
pub destination_mode: DestinationMode,
/// Created inside the destination folder (empty = none).
/// Created inside the destination folder (empty = none). Supports `{album}`, `{date}`
/// (YYYYMMDD) and `{hour}` (HHMM, both in local time) variables, expanded during batch preparation
/// once per batch using the active album view (or empty outside an album view). Presets store
/// the raw template.
pub subfolder: String,
/// When a file of the same name exists in the destination folder.
pub conflict: Conflict,
+6 -5
View File
@@ -51,12 +51,13 @@ pub(super) fn run_batch_with(
if !progress(i, &item.file_name) {
break;
}
let (photo, name, guard, source_dir) = (item.photo, item.file_name.clone(), item.guard.clone(), item.source_dir.clone());
placer.place(photo, name, source_dir.as_deref(), &guard, run_gated(item))?;
let (photo, name, guard, source_dir, subfolder) =
(item.photo, item.file_name.clone(), item.guard.clone(), item.source_dir.clone(), item.subfolder.clone());
placer.place(photo, name, source_dir.as_deref(), Some(&subfolder), &guard, run_gated(item))?;
}
return Ok(std::mem::take(&mut placer.out));
}
let heads: Vec<_> = items.iter().map(|i| (i.photo, i.file_name.clone(), i.guard.clone(), i.source_dir.clone())).collect();
let heads: Vec<_> = items.iter().map(|i| (i.photo, i.file_name.clone(), i.guard.clone(), i.source_dir.clone(), i.subfolder.clone())).collect();
let queue = Queue {
lane: std::sync::Mutex::new(Lane { items: items.into_iter().map(Some).collect(), next: 0, placed: 0, stop: false, done: Default::default() }),
cv: std::sync::Condvar::new(),
@@ -74,12 +75,12 @@ pub(super) fn run_batch_with(
}
}
let placed = || {
for (i, (photo, name, guard, source_dir)) in heads.into_iter().enumerate() {
for (i, (photo, name, guard, source_dir, subfolder)) in heads.into_iter().enumerate() {
if !progress(i, &name) {
break;
}
let e = queue.result(i);
placer.place(photo, name, source_dir.as_deref(), &guard, e)?;
placer.place(photo, name, source_dir.as_deref(), Some(&subfolder), &guard, e)?;
}
Ok::<_, String>(())
};
+100 -4
View File
@@ -63,11 +63,106 @@ fn join_path(a: &str, b: &str) -> String {
/// A subfolder that stays inside the destination folder (issue #2571): `\`, `:` and NUL become `_`
/// (so no drive, root or Windows separator), and empty, `.` and `..` parts are dropped; `a/b` still
/// nests. Applied where the folder is used, so presets and the Export dialog's field are covered too.
pub(super) fn clean_subfolder(s: &str) -> String {
pub fn clean_subfolder(s: &str) -> String {
let s = s.trim().replace(['\\', ':', '\0'], "_");
s.split('/').map(str::trim).filter(|p| !p.is_empty() && *p != "." && *p != "..").collect::<Vec<_>>().join("/")
}
/// Clean an album name so it is safe to use as a directory or path component.
///
/// Characters `/ \ : * ? " < > | \0` and control characters become `_`, and surrounding
/// whitespace and dots are trimmed. Windows-reserved device names (`CON`, `PRN`, `AUX`, `NUL`,
/// `COM1`–`COM9`, `LPT1`–`LPT9`, plus superscript forms `COM¹`–`COM³`, `LPT¹`–`LPT³`, case-insensitive)
/// get `_` inserted after the base component so they remain usable directory components. The result
/// may be empty if the album name consisted entirely of dots or whitespace.
pub fn clean_album_name(album: &str) -> String {
let mut s: String = album
.chars()
.map(|c| if matches!(c, '/' | '\\' | ':' | '*' | '?' | '"' | '<' | '>' | '|' | '\0') || c.is_control() { '_' } else { c })
.collect();
loop {
let trimmed = s.trim().trim_matches('.');
if trimmed == s {
break;
}
s = trimmed.to_string();
}
let base = s.split('.').next().unwrap_or(&s);
let upper = base.to_uppercase();
if matches!(
upper.as_str(),
"CON"
| "PRN"
| "AUX"
| "NUL"
| "COM1"
| "COM2"
| "COM3"
| "COM4"
| "COM5"
| "COM6"
| "COM7"
| "COM8"
| "COM9"
| "LPT1"
| "LPT2"
| "LPT3"
| "LPT4"
| "LPT5"
| "LPT6"
| "LPT7"
| "LPT8"
| "LPT9"
| "COM¹"
| "COM²"
| "COM³"
| "LPT¹"
| "LPT²"
| "LPT³"
) {
s.insert(base.len(), '_');
}
s
}
/// Expand `{album}`, `{date}`, `{hour}` variables in a subfolder template, and clean the result
/// so it stays safely inside the destination folder.
///
/// `{date}` and `{hour}` are expanded before `{album}`, so an album name that contains token-like
/// text (such as `{date}` or `{hour}`) is never double-expanded.
///
/// - `album`: the active album name, cleaned with [`clean_album_name`]; `None` expands `{album}` to `""`.
/// - `now`: the local date and time for `{date}` (YYYYMMDD) and `{hour}` (HHMM), as the person's clock shows it
/// ([`local_now`]); `None` uses the time now.
/// - Unknown tokens are left unchanged. The result passes through [`clean_subfolder`].
///
/// E.g. `"{album}/{date}_{hour}"` with album `"Vacation"` produces `"Vacation/20261107_0230"`.
///
/// Returns immediately without timestamp formatting or album lookup if `template` is empty or has no `{`.
pub fn expand_subfolder(template: &str, album: Option<&str>, now: Option<chrono::NaiveDateTime>) -> String {
if template.is_empty() || !template.contains('{') {
return clean_subfolder(template);
}
let now = now.or_else(local_now).unwrap_or_default();
let date_str = now.format("%Y%m%d").to_string();
let hour_str = now.format("%H%M").to_string();
let album_str = album.map(clean_album_name).unwrap_or_default();
let res = template.replace("{date}", &date_str).replace("{hour}", &hour_str).replace("{album}", &album_str);
clean_subfolder(&res)
}
/// The date and time now on the person's clock, for `{date}` and `{hour}`: the host's zone, with the offset in force
/// now ([`crate::import::local_civil`]; the web build has no zone to read and uses UTC). A folder named by its
/// export date is named by the day the person exported on, not by UTC's, which is the next or the previous day
/// for part of every day away from UTC.
pub(super) fn local_now() -> Option<chrono::NaiveDateTime> {
let since = web_time::SystemTime::now().duration_since(web_time::UNIX_EPOCH).unwrap_or_default();
let secs = i64::try_from(since.as_secs()).unwrap_or(i64::MAX);
chrono::NaiveDateTime::parse_from_str(&crate::import::local_civil(secs), "%Y-%m-%dT%H:%M:%S").ok()
}
impl<'a> Placer<'a> {
pub(super) fn new(
o: &'a ExportOptions,
@@ -82,7 +177,7 @@ impl<'a> Placer<'a> {
/// The folder photo `name` (its original in `source_dir`) is written to: the batch's folder or
/// the photo's own ([`DestinationMode`]), plus the subfolder. An error for a photo with no
/// folder of its own, or whose folder is gone: never a file written somewhere else instead.
fn folder_for(&self, name: &str, source_dir: Option<&str>) -> Result<String, String> {
fn folder_for(&self, name: &str, source_dir: Option<&str>, subfolder: Option<&str>) -> Result<String, String> {
let base = match self.o.destination_mode {
DestinationMode::SpecificFolder => self.to.dir.clone(),
DestinationMode::SameAsOriginal => {
@@ -97,7 +192,7 @@ impl<'a> Placer<'a> {
d.to_string()
}
};
let sub = clean_subfolder(&self.o.subfolder);
let sub = subfolder.map(clean_subfolder).unwrap_or_else(|| expand_subfolder(&self.o.subfolder, None, None));
Ok(if sub.is_empty() { base } else { join_path(&base, &sub) })
}
@@ -108,12 +203,13 @@ impl<'a> Placer<'a> {
photo: lightcraft_catalog::PhotoId,
name: String,
source_dir: Option<&str>,
subfolder: Option<&str>,
guard: &crate::originals::OriginalGuard,
e: Result<Exported, String>,
) -> Result<(), String> {
use serde_json::json;
// an exact file path needs no folder
let dir = if self.to.exact.is_some() && self.single { Ok(String::new()) } else { self.folder_for(&name, source_dir) };
let dir = if self.to.exact.is_some() && self.single { Ok(String::new()) } else { self.folder_for(&name, source_dir, subfolder) };
let (o, exists) = (self.o, self.exists);
let (dir, e) = match dir.and_then(|dir| e.map(|e| (dir, e))) {
Ok(v) => v,
+19 -3
View File
@@ -44,6 +44,9 @@ pub struct PreparedExport {
/// The folder of the photo's original on disk ([`DestinationMode::SameAsOriginal`]); `None`
/// for a demo photo or one in the browser's storage.
pub source_dir: Option<String>,
/// The already-expanded, cleaned subfolder path for this item. Resolved once per batch at
/// preparation time; no raw variable tokens are present.
pub subfolder: String,
work: Work,
/// The library's originals, which [`run_batch`] never writes over (shared by a batch).
pub(super) guard: std::sync::Arc<crate::originals::OriginalGuard>,
@@ -88,13 +91,23 @@ pub fn prepare_export(
seq: usize,
) -> Result<PreparedExport, String> {
let guard = std::sync::Arc::new(session.original_guard());
prepare_guarded(session, id, o, seq, guard)
let album_name = match session.source {
crate::LibrarySource::Album(aid) => session.catalog.album(aid).map(|a| a.name.clone()),
_ => None,
};
prepare_guarded(session, id, o, seq, guard, None, album_name.as_deref())
}
/// [`prepare_export`] for each of `ids` in order (`{seq}` = position, from 1).
pub fn prepare_batch(session: &mut crate::Session, ids: &[lightcraft_catalog::PhotoId], o: &ExportOptions) -> Result<Vec<PreparedExport>, String> {
let guard = std::sync::Arc::new(session.original_guard());
ids.iter().enumerate().map(|(i, id)| prepare_guarded(session, *id, o, i + 1, guard.clone())).collect()
// the whole batch goes to one dated folder: the time is read once
let now = super::place::local_now();
let album_name = match session.source {
crate::LibrarySource::Album(aid) => session.catalog.album(aid).map(|a| a.name.clone()),
_ => None,
};
ids.iter().enumerate().map(|(i, id)| prepare_guarded(session, *id, o, i + 1, guard.clone(), now, album_name.as_deref())).collect()
}
fn prepare_guarded(
@@ -103,10 +116,13 @@ fn prepare_guarded(
o: &ExportOptions,
seq: usize,
guard: std::sync::Arc<crate::originals::OriginalGuard>,
now: Option<chrono::NaiveDateTime>,
album: Option<&str>,
) -> Result<PreparedExport, String> {
let p = session.catalog.photo(id).ok_or("no such photo")?;
let file_name = o.file_name_for(p, seq);
let source_dir = original_folder(&p.source);
let subfolder = super::place::expand_subfolder(&o.subfolder, album, now);
// HDR output only for photos edited in HDR; the rest of the batch exports as usual
let sdr_opts;
let o = if o.hdr && !p.develop.hdr.enabled {
@@ -162,7 +178,7 @@ fn prepare_guarded(
};
(work, weight)
};
Ok(PreparedExport { photo: id, file_name, source_dir, work, guard, weight })
Ok(PreparedExport { photo: id, file_name, source_dir, subfolder, work, guard, weight })
}
/// The folder a photo's original is in, for [`DestinationMode::SameAsOriginal`]. None for a demo
+18
View File
@@ -508,6 +508,24 @@ fn connected_brush_strokes_start_where_the_last_one_ended() {
assert_eq!(strokes(&s).len(), 2);
}
/// A stroke sent again as it grows (its effect shows while painting) replaces itself; earlier strokes stay.
#[test]
fn a_stroke_sent_again_as_it_grows_replaces_itself() {
let mut s = demo();
s.execute("mask.add", &json!({"kind": "brush"})).unwrap();
s.execute("mask.brushStroke", &json!({"points": [[0.1, 0.1]]})).unwrap();
s.execute("mask.brushStroke", &json!({"points": [[0.2, 0.2], [0.3, 0.2]]})).unwrap();
for n in [3, 4] {
let pts: Vec<[f64; 2]> = (0..n).map(|i| [0.2 + 0.1 * i as f64, 0.2]).collect();
s.execute("mask.brushStroke", &json!({"points": pts, "continue": true})).unwrap();
}
let dev = active_dev(&s);
let Some(lightcraft_develop::MaskShape::Brush { strokes }) = dev.masks.first().and_then(|m| m.components.first()).map(|c| &c.shape) else {
panic!("a brush mask")
};
assert_eq!(strokes.iter().map(|s| s.points.len()).collect::<Vec<_>>(), vec![1, 4], "the earlier stroke stays, the live one is replaced");
}
#[test]
fn a_mask_id_at_the_limit_does_not_overflow_the_next_masks() {
let mut s = demo();
+141
View File
@@ -280,6 +280,147 @@ fn a_subfolder_never_leaves_the_destination_folder() {
assert_eq!(o.subfolder, "up");
}
#[test]
fn clean_album_name_sanitizes_reserved_names_and_illegal_chars() {
use crate::export::clean_album_name;
assert_eq!(clean_album_name("Summer 2026"), "Summer 2026");
assert_eq!(clean_album_name("Trip: Tokyo / Kyoto * 2026?"), "Trip_ Tokyo _ Kyoto _ 2026_");
assert_eq!(clean_album_name("..hidden.."), "hidden");
assert_eq!(clean_album_name("..."), "");
assert_eq!(clean_album_name(" "), "");
// Windows reserved device names (bare and with extension, ASCII and superscript)
assert_eq!(clean_album_name("CON"), "CON_");
assert_eq!(clean_album_name("con"), "con_");
assert_eq!(clean_album_name("con.txt"), "con_.txt");
assert_eq!(clean_album_name("PRN"), "PRN_");
assert_eq!(clean_album_name("AUX"), "AUX_");
assert_eq!(clean_album_name("NUL"), "NUL_");
assert_eq!(clean_album_name("COM1"), "COM1_");
assert_eq!(clean_album_name("com9"), "com9_");
assert_eq!(clean_album_name("LPT1"), "LPT1_");
assert_eq!(clean_album_name("lpt9"), "lpt9_");
assert_eq!(clean_album_name("NUL.tar.gz"), "NUL_.tar.gz");
assert_eq!(clean_album_name("COM¹"), "COM¹_");
assert_eq!(clean_album_name("com²"), "com²_");
assert_eq!(clean_album_name("lpt³"), "lpt³_");
assert_eq!(clean_album_name("com¹.backup"), "com¹_.backup");
}
/// `{date}` and `{hour}` are the person's local date and time (the host's zone), not UTC's: an evening export west
/// of UTC, or a morning one east of it, goes to that day's folder.
#[test]
fn subfolder_date_and_hour_are_local_time() {
use crate::export::expand_subfolder;
let secs = i64::try_from(web_time::SystemTime::now().duration_since(web_time::UNIX_EPOCH).unwrap().as_secs()).unwrap();
let local = crate::import::local_civil(secs);
let expected = format!("{}/{}", local.get(..10).unwrap().replace('-', ""), local.get(11..16).unwrap().replace(':', ""));
let got = expand_subfolder("{date}/{hour}", None, None);
// (a minute may turn between the two readings)
let next = crate::import::local_civil(secs + 60);
let later = format!("{}/{}", next.get(..10).unwrap().replace('-', ""), next.get(11..16).unwrap().replace(':', ""));
assert!(got == expected || got == later, "{got} is not the local {expected}");
}
#[test]
fn expand_subfolder_variables_and_ordering() {
use crate::export::expand_subfolder;
let fixed_time = chrono::NaiveDate::from_ymd_opt(2026, 11, 5).unwrap().and_hms_opt(14, 30, 0);
assert_eq!(expand_subfolder("{album}", Some("Vacation"), fixed_time), "Vacation");
assert_eq!(expand_subfolder("{album}", None, fixed_time), "");
assert_eq!(expand_subfolder("{date}", None, fixed_time), "20261105");
assert_eq!(expand_subfolder("{hour}", None, fixed_time), "1430");
assert_eq!(expand_subfolder("{album}/{date}_{hour}", Some("Portraits / 2026"), fixed_time), "Portraits _ 2026/20261105_1430");
assert_eq!(expand_subfolder("Exports/{album}/{date}", None, fixed_time), "Exports/20261105");
// Token replacement order: album named literally {date} or {hour} is not double-expanded
assert_eq!(expand_subfolder("{album}", Some("{date}"), fixed_time), "{date}");
assert_eq!(expand_subfolder("{album}/{date}", Some("{date}"), fixed_time), "{date}/20261105");
assert_eq!(expand_subfolder("{album}/{hour}", Some("{hour}"), fixed_time), "{hour}/1430");
}
#[test]
fn export_presets_persist_subfolder_variables() {
let mut s = Session::with_demo();
s.execute(
"export.savePreset",
&json!({
"name": "Date & Album",
"params": {
"format": "jpeg",
"subfolder": "{album}/{date}_{hour}"
}
}),
)
.unwrap();
let loaded = s.export_params(&json!({"preset": "Date & Album"})).unwrap();
assert_eq!(loaded["subfolder"], "{album}/{date}_{hour}");
let opts = ExportOptions::from_json(&loaded);
assert_eq!(opts.subfolder, "{album}/{date}_{hour}");
}
#[test]
fn export_batch_subfolder_expansion_in_and_outside_album_view() {
use crate::export::{Destination, export_batch};
let mut s = Session::with_demo();
let opts = ExportOptions::from_json(&json!({
"format": "jpeg",
"subfolder": "{album}/{date}_{hour}"
}));
// Export batch with active album view
let id = s.active().unwrap();
let album_id = s.execute("album.create", &json!({"name": "Holiday: Spain", "addSelected": true})).unwrap()["id"].as_u64().unwrap();
s.source = crate::LibrarySource::Album(lightcraft_catalog::AlbumId(album_id));
let to = Destination { dir: "out".into(), exact: None };
let mut written = Vec::new();
let mut write = |p: &str, _: &[u8]| {
written.push(p.to_string());
Ok(())
};
export_batch(&mut s, &[id], &opts, &to, &mut write, &|_| false).unwrap();
assert_eq!(written.len(), 1);
assert!(written[0].starts_with("out/Holiday_ Spain/"), "actual: {}", written[0]);
assert!(!written[0].contains("{date}"), "date not expanded: {}", written[0]);
assert!(!written[0].contains("{hour}"), "hour not expanded: {}", written[0]);
// Multi-photo batch: verify both photos resolve date and hour, use the exact same batch timestamp
// and do not cross minute boundaries
let mut written_multi = Vec::new();
let mut write_multi = |p: &str, _: &[u8]| {
written_multi.push(p.to_string());
Ok(())
};
export_batch(&mut s, &[id, id], &opts, &to, &mut write_multi, &|_| false).unwrap();
assert_eq!(written_multi.len(), 2);
// Both items must have identical subfolder paths
let sub0 = written_multi[0].strip_prefix("out/Holiday_ Spain/").unwrap_or("");
let sub1 = written_multi[1].strip_prefix("out/Holiday_ Spain/").unwrap_or("");
let dir0 = sub0.split('/').next().unwrap_or("");
let dir1 = sub1.split('/').next().unwrap_or("");
assert_eq!(dir0, dir1, "batch items must share the exact same timestamp subfolder");
let (d, h) = dir0.split_once('_').unwrap_or(("", ""));
assert_eq!(d.len(), 8, "date segment must be YYYYMMDD (8 digits): {d}");
assert_eq!(h.len(), 4, "hour segment must be HHMM (4 digits): {h}");
assert!(d.chars().all(|c| c.is_ascii_digit()), "date must be digits: {d}");
assert!(h.chars().all(|c| c.is_ascii_digit()), "hour must be digits: {h}");
// Outside album view: {album} expands to empty string, not an arbitrary first album
s.source = crate::LibrarySource::All;
let mut written_outside = Vec::new();
let mut write_outside = |p: &str, _: &[u8]| {
written_outside.push(p.to_string());
Ok(())
};
export_batch(&mut s, &[id], &opts, &to, &mut write_outside, &|_| false).unwrap();
assert_eq!(written_outside.len(), 1);
assert!(!written_outside[0].contains("Holiday"), "outside album view should not use album name: {}", written_outside[0]);
assert!(!written_outside[0].contains("//"), "clean_subfolder prevents double slashes: {}", written_outside[0]);
}
#[test]
fn prepared_exports_run_on_another_thread() {
fn send<T: Send>(_: &T) {}
+10 -1
View File
@@ -2259,6 +2259,9 @@
"Display profile not used": "Profil displeje nebyl použit",
"Drag to set hue and saturation. Hold Shift to keep the hue, Cmd/Ctrl to keep the saturation, Alt/Option to fine-adjust. Double-click to reset.": "Tažením nastavíte odstín a sytost. Podržením Shift zachováte odstín, Cmd/Ctrl zachováte sytost, Alt/Option umožní jemné doladění. Dvojitým kliknutím obnovíte výchozí hodnoty.",
"Edit In": "Upravit v",
"Filter settings": "Filtrovat nastavení",
"No setting matches what is typed.": "Zadanému textu neodpovídá žádné nastavení.",
"Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.": "Zkuste jedno slovo nebo jeho část: prohledávají se názvy karet a sekcí, popisky i vysvětlivky.",
"Face models (ONNX)": "Modely rozpoznávání obličejů (ONNX)",
"ICC Profiles": "Profily ICC",
"Next History Step": "Další krok historie",
@@ -2544,5 +2547,11 @@
"Stack — click to collapse (S)": "Sada — kliknutím sbalíte (S)",
"Virtual copy": "Virtuální kopie",
"Right-click ▸ Locate Missing File… to find it again.": "Klikněte pravým tlačítkem → Najít chybějící soubor… a najděte jej znovu.",
"Right-click ▸ Reload from Disk to try again.": "Klikněte pravým tlačítkem → Znovu načíst z disku a zkuste to znovu."
"Right-click ▸ Reload from Disk to try again.": "Klikněte pravým tlačítkem → Znovu načíst z disku a zkuste to znovu.",
"Album name (empty outside an album view)": "Název alba (prázdné mimo zobrazení alba)",
"Export date (YYYYMMDD)": "Datum exportu (YYYYMMDD)",
"Export time (HHMM)": "Čas exportu (HHMM)",
"Insert variable": "Vložit proměnnou",
"Insert…": "Vložit…",
"none ({album}, {date}, {hour})": "žádné ({album}, {date}, {hour})"
}
+10 -1
View File
@@ -2100,6 +2100,9 @@
"Not saved": "Nicht gespeichert",
"A folder is being synchronized": "Ein Ordner wird gerade synchronisiert",
"Wait for the import to finish": "Warte, bis der Import abgeschlossen ist",
"Filter settings": "Einstellungen filtern",
"No setting matches what is typed.": "Keine Einstellung passt zur Eingabe.",
"Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.": "Versuche ein Wort oder einen Teil davon: Durchsucht werden die Namen der Tabs und Abschnitte, Beschriftungen und Erklärungen.",
"Appearance": "Erscheinungsbild",
"Appearance Mode": "Erscheinungsmodus",
"Sync with System": "Mit System synchronisieren",
@@ -3601,5 +3604,11 @@
"Stack — click to collapse (S)": "Stapel — Klicken zum Zuklappen (S)",
"Virtual copy": "Virtuelle Kopie",
"Right-click ▸ Locate Missing File… to find it again.": "Rechtsklick → Fehlende Datei suchen…, um sie wiederzufinden.",
"Right-click ▸ Reload from Disk to try again.": "Rechtsklick → Vom Datenträger neu laden, um es erneut zu versuchen."
"Right-click ▸ Reload from Disk to try again.": "Rechtsklick → Vom Datenträger neu laden, um es erneut zu versuchen.",
"Album name (empty outside an album view)": "Albumname (leer außerhalb einer Albumansicht)",
"Export date (YYYYMMDD)": "Exportdatum (YYYYMMDD)",
"Export time (HHMM)": "Exportzeit (HHMM)",
"Insert variable": "Variable einfügen",
"Insert…": "Einfügen…",
"none ({album}, {date}, {hour})": "keine ({album}, {date}, {hour})"
}
+10 -1
View File
@@ -2126,6 +2126,9 @@
"Not saved": "Sin guardar",
"A folder is being synchronized": "Se está sincronizando una carpeta",
"Wait for the import to finish": "Esperar a que termine la importación",
"Filter settings": "Filtrar ajustes",
"No setting matches what is typed.": "Ningún ajuste coincide con lo escrito.",
"Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.": "Prueba con una palabra o parte de ella: se buscan los nombres de pestañas y secciones, las etiquetas y las explicaciones.",
"Appearance": "Apariencia",
"Appearance Mode": "Modo de apariencia",
"Sync with System": "Sincronizar con el sistema",
@@ -2498,5 +2501,11 @@
"Stack — click to collapse (S)": "Pila — clic para contraer (S)",
"Virtual copy": "Copia virtual",
"Right-click ▸ Locate Missing File… to find it again.": "Clic derecho → Localizar archivo que falta… para encontrarlo de nuevo.",
"Right-click ▸ Reload from Disk to try again.": "Clic derecho → Recargar desde el disco para intentarlo de nuevo."
"Right-click ▸ Reload from Disk to try again.": "Clic derecho → Recargar desde el disco para intentarlo de nuevo.",
"Album name (empty outside an album view)": "Nombre del álbum (vacío fuera de una vista de álbum)",
"Export date (YYYYMMDD)": "Fecha de exportación (YYYYMMDD)",
"Export time (HHMM)": "Hora de exportación (HHMM)",
"Insert variable": "Insertar variable",
"Insert…": "Insertar…",
"none ({album}, {date}, {hour})": "ninguno ({album}, {date}, {hour})"
}
+10 -1
View File
@@ -2432,6 +2432,9 @@
"Folder name": "Kansion nimi",
"Its templates move to User Templates.": "Sen mallipohjat siirretään kansioon Käyttäjän mallipohjat.",
"Stopped at the scan limit: there may be more photos": "Skannauksen raja saavutettiin: valokuvia voi olla lisää",
"Filter settings": "Suodata asetuksia",
"No setting matches what is typed.": "Mikään asetus ei vastaa kirjoitettua.",
"Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.": "Kokeile yhtä sanaa tai sen osaa: haku kattaa välilehtien ja osioiden nimet, otsikot ja selitykset.",
"A smart album's rules choose its photos: change them with Edit Smart Album…": "Älyalbumin säännöt valitsevat sen kuvat: muuta niitä komennolla Muokkaa älyalbumia…",
"Add keywords in the Keyword List": "Lisää avainsanoja avainsanaluettelossa",
"Already on these photos": "Jo näissä kuvissa",
@@ -2456,5 +2459,11 @@
"Stack — click to expand (S)": "Pino — napsauta laajentaaksesi (S)",
"Stars on hover": "Tähdet osoitettaessa",
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Tähdet osoitettaessa: liput ja värimerkinnät näkyvät aina; tähdet ja muokattu-merkki näkyvät, kun kuvaa osoitetaan tai se on valittuna.",
"Virtual copy": "Virtuaalikopio"
"Virtual copy": "Virtuaalikopio",
"Album name (empty outside an album view)": "Albumin nimi (tyhjä albumnäkymän ulkopuolella)",
"Export date (YYYYMMDD)": "Vientipäivämäärä (YYYYMMDD)",
"Export time (HHMM)": "Vientiaika (HHMM)",
"Insert variable": "Lisää muuttuja",
"Insert…": "Lisää…",
"none ({album}, {date}, {hour})": "ei mitään ({album}, {date}, {hour})"
}
+10 -1
View File
@@ -2001,6 +2001,9 @@
"Appearance Settings…": "Réglages d’apparence…",
"Add to favorites": "Ajouter aux favoris",
"Remove from favorites": "Retirer des favoris",
"Filter settings": "Filtrer les réglages",
"No setting matches what is typed.": "Aucun réglage ne correspond à la saisie.",
"Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.": "Essayez un mot ou une partie de mot : la recherche porte sur les noms des onglets et des sections, les libellés et les explications.",
"Appearance": "Apparence",
"Appearance Mode": "Mode d’apparence",
"Sync with System": "Synchroniser avec le système",
@@ -3679,5 +3682,11 @@
"Stack — click to collapse (S)": "Pile — cliquer pour replier (S)",
"Virtual copy": "Copie virtuelle",
"Right-click ▸ Locate Missing File… to find it again.": "Clic droit → Localiser le fichier manquant… pour le retrouver.",
"Right-click ▸ Reload from Disk to try again.": "Clic droit → Recharger depuis le disque pour réessayer."
"Right-click ▸ Reload from Disk to try again.": "Clic droit → Recharger depuis le disque pour réessayer.",
"Album name (empty outside an album view)": "Nom de l'album (vide hors vue d'album)",
"Export date (YYYYMMDD)": "Date d'export (YYYYMMDD)",
"Export time (HHMM)": "Heure d'export (HHMM)",
"Insert variable": "Insérer une variable",
"Insert…": "Insérer…",
"none ({album}, {date}, {hour})": "aucun ({album}, {date}, {hour})"
}
+10 -1
View File
@@ -2446,6 +2446,9 @@
"Folder name": "Nama folder",
"Its templates move to User Templates.": "Templatnya dipindahkan ke Templat pengguna.",
"Stopped at the scan limit: there may be more photos": "Berhenti pada batas pemindaian: mungkin masih ada foto",
"Filter settings": "Filter pengaturan",
"No setting matches what is typed.": "Tidak ada pengaturan yang cocok dengan yang diketik.",
"Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.": "Coba satu kata atau sebagiannya: yang dicari adalah nama tab dan bagian, label, serta penjelasan.",
"A smart album's rules choose its photos: change them with Edit Smart Album…": "Aturan album pintar menentukan fotonya: ubah dengan Edit album pintar…",
"Add keywords in the Keyword List": "Tambahkan kata kunci di Daftar kata kunci",
"Already on these photos": "Sudah ada pada foto ini",
@@ -2470,5 +2473,11 @@
"Stack — click to expand (S)": "Tumpukan — klik untuk meluaskan (S)",
"Stars on hover": "Bintang saat kursor di atas",
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Bintang saat kursor di atas: bendera dan label warna selalu tampil; bintang dan tanda telah diedit muncul saat kursor berada di atas foto atau foto dipilih.",
"Virtual copy": "Salinan virtual"
"Virtual copy": "Salinan virtual",
"Album name (empty outside an album view)": "Nama album (kosong di luar tampilan album)",
"Export date (YYYYMMDD)": "Tanggal ekspor (YYYYMMDD)",
"Export time (HHMM)": "Waktu ekspor (HHMM)",
"Insert variable": "Sisipkan variabel",
"Insert…": "Sisipkan…",
"none ({album}, {date}, {hour})": "tidak ada ({album}, {date}, {hour})"
}
+10 -1
View File
@@ -1836,12 +1836,14 @@
"Edit in Other Editor (⌥⌘E) opens the copy in this application (an app name on macOS, a program path elsewhere).": "Modifica nell'altro editor (⌥⌘E) apre la copia in questa applicazione (il nome di un'app su macOS, il percorso di un programma altrove).",
"Edit in PhotoCraft": "Modifica in PhotoCraft",
"External Editing": "Modifica esterna",
"Filter settings": "Filtra impostazioni",
"Found automatically": "Trovato automaticamente",
"HDR": "HDR",
"LUT-based": "Basato su LUT",
"Left: the standard (SDR) range up to SDR white. Right: the HDR range, one band per stop above SDR white (the orange line: the HDR headroom). With Visualize HDR range on, the bands take its colours.": "A sinistra: la gamma standard (SDR) fino al bianco SDR. A destra: la gamma HDR, una fascia per ogni stop sopra il bianco SDR (la linea arancione: il margine HDR). Con Visualizza gamma HDR attivo, le fasce ne prendono i colori.",
"Matrix/TRC": "Matrice/TRC",
"Monitor profile": "Profilo monitor",
"No setting matches what is typed.": "Nessuna impostazione corrisponde al testo digitato.",
"None (the display is treated as sRGB)": "Nessuno (lo schermo viene trattato come sRGB)",
"Other editor": "Altro editor",
"Photo → Edit In → Edit in PhotoCraft (⇧⌘E, or right-click a photo) renders a copy with your edits, stacks it with the original and opens it in PhotoCraft. Save there and the copy updates here. As PSD, PhotoCraft saves straight back to it. Leave the location empty unless you use a portable copy.": "Foto → Modifica in → Modifica in PhotoCraft (⇧⌘E, o clic destro su una foto) esegue il rendering di una copia con le tue modifiche, la impila con l'originale e la apre in PhotoCraft. Salva lì e la copia si aggiorna qui. Come PSD, PhotoCraft salva direttamente su di essa. Lascia vuota la posizione a meno che tu non usi una copia portatile.",
@@ -1850,6 +1852,7 @@
"Photos stay in All Photos. Deleting a folder also deletes its albums. You can undo this.": "Le foto restano in Tutte le foto. Eliminando una cartella si eliminano anche i suoi album. Puoi annullare l'operazione.",
"Primaries (x, y)": "Primari (x, y)",
"Profiles assigned in your desktop's colour settings are usually in ~/.local/share/icc.": "I profili assegnati nelle impostazioni colore del desktop di solito sono in ~/.local/share/icc.",
"Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.": "Prova una parola, o parte di una: vengono cercati i nomi di schede e sezioni, le etichette e le spiegazioni.",
"Progressive": "Progressivo",
"SDR": "SDR",
"Use Screen Profile": "Usa profilo dello schermo",
@@ -2659,5 +2662,11 @@
"Stack — click to collapse (S)": "Pila — clic per comprimere (S)",
"Virtual copy": "Copia virtuale",
"Right-click ▸ Locate Missing File… to find it again.": "Clic destro → Trova file mancante… per ritrovarlo.",
"Right-click ▸ Reload from Disk to try again.": "Clic destro → Ricarica dal disco per riprovare."
"Right-click ▸ Reload from Disk to try again.": "Clic destro → Ricarica dal disco per riprovare.",
"Album name (empty outside an album view)": "Nome dell'album (vuoto fuori dalla vista album)",
"Export date (YYYYMMDD)": "Data di esportazione (YYYYMMDD)",
"Export time (HHMM)": "Ora di esportazione (HHMM)",
"Insert variable": "Inserisci variabile",
"Insert…": "Inserisci…",
"none ({album}, {date}, {hour})": "nessuno ({album}, {date}, {hour})"
}
+10 -1
View File
@@ -1947,6 +1947,9 @@
"Not saved": "保存されていません",
"A folder is being synchronized": "フォルダを同期中です",
"Wait for the import to finish": "読み込みが終わるまでお待ちください",
"Filter settings": "設定を絞り込む",
"No setting matches what is typed.": "入力に一致する設定はありません。",
"Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.": "単語またはその一部で試してください。タブとセクションの名前、ラベル、説明文が検索されます。",
"Appearance": "外観",
"Appearance Mode": "外観モード",
"Sync with System": "システムと同期",
@@ -2497,5 +2500,11 @@
"Stack — click to collapse (S)": "スタック — クリックして折りたたむ (S)",
"Virtual copy": "仮想コピー",
"Right-click ▸ Locate Missing File… to find it again.": "右クリック → 見つからないファイルを指定… で、ファイルをもう一度指定できます。",
"Right-click ▸ Reload from Disk to try again.": "右クリック → ディスクから再読み込み で、もう一度試せます。"
"Right-click ▸ Reload from Disk to try again.": "右クリック → ディスクから再読み込み で、もう一度試せます。",
"Album name (empty outside an album view)": "アルバム名(アルバム表示外では空)",
"Export date (YYYYMMDD)": "書き出し日 (YYYYMMDD)",
"Export time (HHMM)": "書き出し時刻 (HHMM)",
"Insert variable": "変数を挿入",
"Insert…": "挿入…",
"none ({album}, {date}, {hour})": "なし ({album}, {date}, {hour})"
}
+10 -1
View File
@@ -3742,6 +3742,9 @@
"Folder name": "საქაღალდის სახელი",
"Its templates move to User Templates.": "მისი შაბლონები გადავა „მომხმარებლის შაბლონებში“.",
"Stopped at the scan limit: there may be more photos": "სკანირების ლიმიტზე გაჩერდა: შესაძლოა სხვა ფოტოებიც არის",
"Filter settings": "პარამეტრების გაფილტვრა",
"No setting matches what is typed.": "აკრეფილს არც ერთი პარამეტრი არ ემთხვევა.",
"Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.": "სცადეთ ერთი სიტყვა ან მისი ნაწილი: იძებნება ჩანართებისა და სექციების სახელებში, წარწერებსა და განმარტებებში.",
"Can't add to an album folder": "ალბომების საქაღალდეში დამატება შეუძლებელია",
"An album folder holds albums, not photos: drop on an album inside it": "ალბომების საქაღალდეში ალბომებია, არა ფოტოები: ჩააგდეთ მასში არსებულ ალბომზე",
"Can't add to a smart album": "სმარტ-ალბომში დამატება შეუძლებელია",
@@ -3764,5 +3767,11 @@
"Stack — click to collapse (S)": "დასტა — დააწკაპუნეთ ჩასაკეცად (S)",
"Virtual copy": "ვირტუალური ასლი",
"Right-click ▸ Locate Missing File… to find it again.": "მარჯვენა დაწკაპუნება → დაკარგული ფაილის მოძებნა… ფაილის ხელახლა საპოვნელად.",
"Right-click ▸ Reload from Disk to try again.": "მარჯვენა დაწკაპუნება → დისკიდან ხელახლა ჩატვირთვა, ხელახლა საცდელად."
"Right-click ▸ Reload from Disk to try again.": "მარჯვენა დაწკაპუნება → დისკიდან ხელახლა ჩატვირთვა, ხელახლა საცდელად.",
"Album name (empty outside an album view)": "ალბომის სახელი (ცარიელია ალბომის ხედის გარეთ)",
"Export date (YYYYMMDD)": "ექსპორტის თარიღი (YYYYMMDD)",
"Export time (HHMM)": "ექსპორტის დრო (HHMM)",
"Insert variable": "ცვლადის ჩასმა",
"Insert…": "ჩასმა…",
"none ({album}, {date}, {hour})": "არცერთი ({album}, {date}, {hour})"
}
+10 -1
View File
@@ -2267,6 +2267,9 @@
"End Slideshow": "Zakończ pokaz slajdów",
"Contact Sheet PDF…": "Arkusz stykowy PDF…",
"Edit in PhotoCraft": "Edytuj w PhotoCraft",
"Filter settings": "Filtruj ustawienia",
"No setting matches what is typed.": "Żadne ustawienie nie pasuje do wpisanego tekstu.",
"Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.": "Wpisz jedno słowo lub jego część: przeszukiwane są nazwy kart i sekcji, etykiety oraz objaśnienia.",
"Edit in Other Editor": "Edytuj w innym edytorze",
"Open Original in Other Editor (RAW, no copy)": "Otwórz oryginał w innym edytorze (RAW, bez kopii)",
"Save Current Settings as New Effect Preset…": "Zapisz bieżące ustawienia jako nowe ustawienie wstępne efektu…",
@@ -2423,5 +2426,11 @@
"Stack — click to collapse (S)": "Stos — kliknij, aby zwinąć (S)",
"Virtual copy": "Kopia wirtualna",
"Right-click ▸ Locate Missing File… to find it again.": "Kliknij prawym przyciskiem → Znajdź brakujący plik…, aby go odnaleźć ponownie.",
"Right-click ▸ Reload from Disk to try again.": "Kliknij prawym przyciskiem → Wczytaj ponownie z dysku, aby spróbować jeszcze raz."
"Right-click ▸ Reload from Disk to try again.": "Kliknij prawym przyciskiem → Wczytaj ponownie z dysku, aby spróbować jeszcze raz.",
"Album name (empty outside an album view)": "Nazwa albumu (pusta poza widokiem albumu)",
"Export date (YYYYMMDD)": "Data eksportu (YYYYMMDD)",
"Export time (HHMM)": "Czas eksportu (HHMM)",
"Insert variable": "Wstaw zmienną",
"Insert…": "Wstaw…",
"none ({album}, {date}, {hour})": "brak ({album}, {date}, {hour})"
}
+10 -1
View File
@@ -1945,6 +1945,9 @@
"Not saved": "Não salvo",
"A folder is being synchronized": "Uma pasta está sendo sincronizada",
"Wait for the import to finish": "Aguarde a importação terminar",
"Filter settings": "Filtrar ajustes",
"No setting matches what is typed.": "Nenhum ajuste corresponde ao que foi digitado.",
"Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.": "Tente uma palavra ou parte dela: a busca inclui os nomes das abas e seções, os rótulos e as explicações.",
"Appearance": "Aparência",
"Appearance Mode": "Modo de aparência",
"Sync with System": "Sincronizar com o sistema",
@@ -2342,5 +2345,11 @@
"Stack — click to collapse (S)": "Pilha — clique para recolher (S)",
"Virtual copy": "Cópia virtual",
"Right-click ▸ Locate Missing File… to find it again.": "Clique com o botão direito → Localizar arquivo ausente… para encontrá-lo de novo.",
"Right-click ▸ Reload from Disk to try again.": "Clique com o botão direito → Recarregar do disco para tentar de novo."
"Right-click ▸ Reload from Disk to try again.": "Clique com o botão direito → Recarregar do disco para tentar de novo.",
"Album name (empty outside an album view)": "Nome do álbum (vazio fora de uma visualização de álbum)",
"Export date (YYYYMMDD)": "Data de exportação (YYYYMMDD)",
"Export time (HHMM)": "Hora de exportação (HHMM)",
"Insert variable": "Inserir variável",
"Insert…": "Inserir…",
"none ({album}, {date}, {hour})": "nenhum ({album}, {date}, {hour})"
}
+10 -1
View File
@@ -1874,6 +1874,9 @@
"Not saved": "Не сохранено",
"A folder is being synchronized": "Папка синхронизируется",
"Wait for the import to finish": "Дождитесь завершения импорта",
"Filter settings": "Фильтр настроек",
"No setting matches what is typed.": "Нет настроек, соответствующих введённому.",
"Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.": "Попробуйте одно слово или его часть: поиск ведётся по названиям вкладок и разделов, подписям и пояснениям.",
"Appearance": "Оформление",
"Appearance Mode": "Режим оформления",
"Sync with System": "Как в системе",
@@ -2704,5 +2707,11 @@
"Stack — click to collapse (S)": "Стопка — щёлкните, чтобы свернуть (S)",
"Virtual copy": "Виртуальная копия",
"Right-click ▸ Locate Missing File… to find it again.": "Щёлкните правой кнопкой → Указать отсутствующий файл…, чтобы найти его снова.",
"Right-click ▸ Reload from Disk to try again.": "Щёлкните правой кнопкой → Перезагрузить с диска, чтобы повторить попытку."
"Right-click ▸ Reload from Disk to try again.": "Щёлкните правой кнопкой → Перезагрузить с диска, чтобы повторить попытку.",
"Album name (empty outside an album view)": "Название альбома (пусто вне просмотра альбома)",
"Export date (YYYYMMDD)": "Дата экспорта (YYYYMMDD)",
"Export time (HHMM)": "Время экспорта (HHMM)",
"Insert variable": "Вставить переменную",
"Insert…": "Вставить…",
"none ({album}, {date}, {hour})": "нет ({album}, {date}, {hour})"
}
+10 -1
View File
@@ -3859,6 +3859,9 @@
"Folder name": "Mappnamn",
"Its templates move to User Templates.": "Dess mallar flyttas till Användarmallar.",
"Stopped at the scan limit: there may be more photos": "Stoppade vid skanningsgränsen: det kan finnas fler foton",
"Filter settings": "Filtrera inställningar",
"No setting matches what is typed.": "Ingen inställning matchar det som skrivits.",
"Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.": "Prova ett ord eller en del av ett: namnen på flikar och avsnitt, etiketter och förklaringar genomsöks.",
"name for a saved preset": "namn på en sparad förinställning",
"Saved as a preset": "Sparat som förinställning",
"Set on every photo this import adds, after its XMP sidecar and the preset above; photos the library already has are left alone. A slider left at its default changes nothing. Nothing is saved unless you save it as a preset.": "Anges på varje foto som den här importen lägger till, efter dess XMP-sidofil och förinställningen ovanför; foton som redan finns i biblioteket lämnas orörda. Ett reglage som står kvar på standardvärdet ändrar ingenting. Ingenting sparas om du inte sparar det som en förinställning.",
@@ -3886,5 +3889,11 @@
"Stack — click to expand (S)": "Stapel — klicka för att expandera (S)",
"Stars on hover": "Stjärnor vid pekaren",
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Stjärnor vid pekaren: flaggor och färgetiketter visas alltid; stjärnorna och märket för redigerad visas när pekaren är över ett foto eller när det är markerat.",
"Virtual copy": "Virtuell kopia"
"Virtual copy": "Virtuell kopia",
"Album name (empty outside an album view)": "Albumnamn (tomt utanför en albumvy)",
"Export date (YYYYMMDD)": "Exportdatum (YYYYMMDD)",
"Export time (HHMM)": "Exporttid (HHMM)",
"Insert variable": "Infoga variabel",
"Insert…": "Infoga…",
"none ({album}, {date}, {hour})": "ingen ({album}, {date}, {hour})"
}
+10 -1
View File
@@ -2195,6 +2195,9 @@
"Appearance Settings…": "Налаштування вигляду…",
"Add to favorites": "Додати до вибраного",
"Remove from favorites": "Видалити з вибраного",
"Filter settings": "Фільтр налаштувань",
"No setting matches what is typed.": "Немає налаштувань, що відповідають введеному.",
"Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.": "Спробуйте одне слово або його частину: пошук ведеться за назвами вкладок і розділів, підписами та поясненнями.",
"Appearance": "Вигляд",
"Appearance Mode": "Режим вигляду",
"Sync with System": "Як у системі",
@@ -2494,5 +2497,11 @@
"Stack — click to collapse (S)": "Стос — клацніть, щоб згорнути (S)",
"Virtual copy": "Віртуальна копія",
"Right-click ▸ Locate Missing File… to find it again.": "Клацніть правою кнопкою → Знайти відсутній файл…, щоб знайти його знову.",
"Right-click ▸ Reload from Disk to try again.": "Клацніть правою кнопкою → Перезавантажити з диска, щоб спробувати ще раз."
"Right-click ▸ Reload from Disk to try again.": "Клацніть правою кнопкою → Перезавантажити з диска, щоб спробувати ще раз.",
"Album name (empty outside an album view)": "Назва альбому (порожньо поза переглядом альбому)",
"Export date (YYYYMMDD)": "Дата експорту (YYYYMMDD)",
"Export time (HHMM)": "Час експорту (HHMM)",
"Insert variable": "Вставити змінну",
"Insert…": "Вставити…",
"none ({album}, {date}, {hour})": "немає ({album}, {date}, {hour})"
}
+10 -1
View File
@@ -2758,6 +2758,9 @@
"Folder name": "Tên thư mục",
"Its templates move to User Templates.": "Các mẫu trong đó sẽ được chuyển vào Mẫu người dùng.",
"Stopped at the scan limit: there may be more photos": "Đã dừng ở giới hạn quét: có thể còn ảnh khác",
"Filter settings": "Lọc cài đặt",
"No setting matches what is typed.": "Không có cài đặt nào khớp với nội dung đã nhập.",
"Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.": "Hãy thử một từ hoặc một phần của từ: tên các tab và mục, nhãn và phần giải thích đều được tìm.",
"A smart album's rules choose its photos: change them with Edit Smart Album…": "Quy tắc của album thông minh chọn ảnh của nó: thay đổi bằng Chỉnh sửa album thông minh…",
"Add keywords in the Keyword List": "Thêm từ khóa trong Danh sách từ khóa",
"Already on these photos": "Đã có trên các ảnh này",
@@ -2782,5 +2785,11 @@
"Stack — click to expand (S)": "Chồng — nhấp để mở rộng (S)",
"Stars on hover": "Sao khi rê chuột",
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Sao khi rê chuột: cờ và nhãn màu luôn hiển thị; sao và dấu đã chỉnh sửa xuất hiện khi ảnh được rê chuột qua hoặc được chọn.",
"Virtual copy": "Bản sao ảo"
"Virtual copy": "Bản sao ảo",
"Album name (empty outside an album view)": "Tên album (trống ngoài chế độ xem album)",
"Export date (YYYYMMDD)": "Ngày xuất (YYYYMMDD)",
"Export time (HHMM)": "Giờ xuất (HHMM)",
"Insert variable": "Chèn biến",
"Insert…": "Chèn…",
"none ({album}, {date}, {hour})": "không có ({album}, {date}, {hour})"
}
+10 -1
View File
@@ -1939,6 +1939,9 @@
"Not saved": "未保存",
"A folder is being synchronized": "正在同步文件夹",
"Wait for the import to finish": "请等待导入完成",
"Filter settings": "筛选设置",
"No setting matches what is typed.": "没有与输入内容匹配的设置。",
"Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.": "请尝试一个词或词的一部分:会搜索标签页和分区的名称、标签和说明。",
"Appearance": "外观",
"Appearance Mode": "外观模式",
"Sync with System": "与系统同步",
@@ -2497,5 +2500,11 @@
"Stack — click to collapse (S)": "堆叠 — 单击折叠 (S)",
"Virtual copy": "虚拟副本",
"Right-click ▸ Locate Missing File… to find it again.": "右键单击 → 定位缺失的文件…,即可重新找到它。",
"Right-click ▸ Reload from Disk to try again.": "右键单击 → 从磁盘重新读取,即可重试。"
"Right-click ▸ Reload from Disk to try again.": "右键单击 → 从磁盘重新读取,即可重试。",
"Album name (empty outside an album view)": "相册名称(在相册视图外为空)",
"Export date (YYYYMMDD)": "导出日期 (YYYYMMDD)",
"Export time (HHMM)": "导出时间 (HHMM)",
"Insert variable": "插入变量",
"Insert…": "插入…",
"none ({album}, {date}, {hour})": "无 ({album}, {date}, {hour})"
}
+10 -1
View File
@@ -1945,6 +1945,9 @@
"Not saved": "未儲存",
"A folder is being synchronized": "正在同步資料夾",
"Wait for the import to finish": "請等待匯入完成",
"Filter settings": "篩選設定",
"No setting matches what is typed.": "沒有符合輸入內容的設定。",
"Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.": "請嘗試一個詞或詞的一部分:會搜尋分頁和區段的名稱、標籤和說明。",
"Appearance": "外觀",
"Appearance Mode": "外觀模式",
"Sync with System": "與系統同步",
@@ -2498,5 +2501,11 @@
"Stack — click to collapse (S)": "堆疊 — 按一下以收合 (S)",
"Virtual copy": "虛擬副本",
"Right-click ▸ Locate Missing File… to find it again.": "按右鍵 → 尋找遺失的檔案…,即可重新找到它。",
"Right-click ▸ Reload from Disk to try again.": "按右鍵 → 從磁碟重新載入,即可重試。"
"Right-click ▸ Reload from Disk to try again.": "按右鍵 → 從磁碟重新載入,即可重試。",
"Album name (empty outside an album view)": "相簿名稱(在相簿檢視外為空)",
"Export date (YYYYMMDD)": "匯出日期 (YYYYMMDD)",
"Export time (HHMM)": "匯出時間 (HHMM)",
"Insert variable": "插入變數",
"Insert…": "插入…",
"none ({album}, {date}, {hour})": "無 ({album}, {date}, {hour})"
}
+46 -11
View File
@@ -201,6 +201,19 @@ impl LightcraftApp {
}
}
/// End a Brush stroke being painted, if one is: what already went to the photo stays (its undo step is
/// closed), what didn't is dropped. The pointer still held paints nothing more until it is let go.
/// Other gestures are left alone.
pub(crate) fn cancel_brush_gesture(&mut self) {
let Some(crate::panels::detail::Gesture::Brush { live, .. }) = &self.gesture else { return };
let went_live = live.is_some();
self.gesture = None;
self.brush_live = None;
if went_live {
let _ = self.session.execute("develop.endInteraction", &serde_json::json!({}));
}
}
/// Run a UI or engine command by id. The single entry point for every frontend path.
pub fn run(&mut self, id: &str, params: Value) -> Result<Value, String> {
self.run_typed(id, params).map_err(|e| e.message)
@@ -209,6 +222,13 @@ impl LightcraftApp {
/// [`LightcraftApp::run`], keeping what kind of error a refusal is: for code that decides on it
/// (offer a model's download, treat a cancel as one) instead of reading the message.
pub fn run_typed(&mut self, id: &str, params: Value) -> Result<Value, CommandError> {
// a brush stroke being painted belongs to the mask and photo it started on: picking another (also by
// stepping through the photos with the arrow keys) ends it first, so its next live update or its release
// can't land on the one picked; so does Undo, which takes the live stroke away (the next update would
// otherwise replace the stroke before it)
if brush_stroke_ends_before(id) {
self.cancel_brush_gesture();
}
// (seen before and after each command, so a selection changed and changed back between two
// UI passes still counts as changed)
self.selection_changes();
@@ -271,15 +291,12 @@ impl LightcraftApp {
{
self.ui.tool.clear();
}
if r.is_ok() && id == "mask.adjust" {
// Judge local adjustments on the photo, without the selection overlay obscuring them.
// Keep it hidden after release; O / the overlay eye can show it again.
self.ui.mask_overlay = false;
}
if r.is_ok() && matches!(id, "mask.add" | "mask.addComponent" | "mask.duplicate" | "mask.select") {
// A new or newly picked mask shows its overlay again, as in Lightroom: hidden by a slider
// drag above, it stayed hidden while the Overlay menu still named a mode (issue #1800).
self.ui.mask_overlay = true;
// (a mask's sliders don't switch the overlay off, and creating or picking a mask doesn't
// switch it on: one rule decides when it shows, see `panels::detail::overlay_mask`)
if r.is_ok() && !self.ui.mask_overlay_hidden.is_empty() {
// a mask an undo, a history step or pasted settings took away frees its id for the next new
// mask: whether O hid its overlay goes with it
crate::panels::masking::forget_missing_overlays(self);
}
if r.is_ok() {
// These commands finish synchronously, so their completion would otherwise
@@ -583,8 +600,8 @@ impl LightcraftApp {
ctx.request_repaint();
}
if let Some(mask) = polled.refine {
// a new selection from a click or a description: show it, as `run` does for new masks
self.ui.mask_overlay = true;
// (a new selection from a click or a description shows by the overlay rule while its
// mask has no settings: `panels::detail::overlay_mask`)
self.ui.detail_due = Some((now + 0.3, mask));
}
if let Some(e) = polled.messages.into_iter().last() {
@@ -781,3 +798,21 @@ pub(crate) fn sam_download_ended(download: &lightcraft_engine::segment::Download
None => None,
}
}
/// Commands that end a Brush stroke being painted before they run ([`LightcraftApp::run_typed`]): the ones that pick
/// another mask or photo, and Undo / Redo, which change the strokes under it.
pub(crate) fn brush_stroke_ends_before(id: &str) -> bool {
matches!(
id,
"mask.select"
| "library.select"
| "library.next"
| "library.previous"
| "library.up"
| "library.down"
| "slideshow.next"
| "slideshow.previous"
| "edit.undo"
| "edit.redo"
)
}
+13
View File
@@ -441,6 +441,8 @@ impl LightcraftApp {
self.ui.note_right();
// panels set it again this frame while the pointer rests on a preset or profile
self.hover_preview = None;
// (and the mask pin or component row under the pointer: the overlay shows that mask)
self.ui.mask_hover_prev = self.ui.mask_hover.take();
self.end_drags(&ctx);
if self.ui.fullscreen {
// full-screen preview: the photo alone on black
@@ -465,6 +467,7 @@ impl LightcraftApp {
// host frames, and resetting it above must only hide it from this pass's dialogs.
panels::notices::restore_prompt_pointer(self, &ctx);
}
self.repaint_on_mask_hover_change(&ctx);
(self.next_widgets, self.next_widget_hits) = widgets::take_registries(&ctx);
self.end_frame(&ctx, t0);
return;
@@ -512,10 +515,20 @@ impl LightcraftApp {
// frames, and resetting it above must only hide it from this pass's dialogs.
panels::notices::restore_prompt_pointer(self, &ctx);
}
self.repaint_on_mask_hover_change(&ctx);
(self.next_widgets, self.next_widget_hits) = widgets::take_registries(&ctx);
self.text_focus = ctx.egui_wants_keyboard_input();
self.end_frame(&ctx, t0);
}
/// The pointer moved onto another mask pin or component row, or off them, this frame: the overlay drawn earlier in the
/// frame still showed the last one (it falls back to it while panels set the new one), so one more frame shows
/// the new one at once rather than at the next input (CodeRabbit on #2920).
pub(crate) fn repaint_on_mask_hover_change(&self, ctx: &egui::Context) {
if self.ui.mask_hover != self.ui.mask_hover_prev {
ctx.request_repaint();
}
}
}
/// Import commits batches at most once per host frame. The first layout pass and a hidden
+26 -4
View File
@@ -1786,11 +1786,33 @@ fn export_destination_rows(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Token
});
});
}
let subfolder_widget = "field:exportSubfolder";
let subfolder_id = crate::text_field::id(subfolder_widget);
field(ui, "Subfolder", |ui| {
crate::widgets::named(
ui.add(egui::TextEdit::singleline(&mut opts.subfolder).hint_text(crate::i18n::tr("none")).desired_width(f32::INFINITY)),
crate::i18n::tr("Subfolder"),
)
trailing_button_row(ui, |ui| {
let mut chosen = None;
let c = crate::widgets::combo_box("exportSubfolderTags").width(90.0).selected_text(crate::i18n::tr("Insert…")).show_ui(ui, |ui| {
if ui.selectable_label(false, "{album}").on_hover_text(crate::i18n::tr("Album name (empty outside an album view)")).clicked() {
chosen = Some("{album}");
}
if ui.selectable_label(false, "{date}").on_hover_text(crate::i18n::tr("Export date (YYYYMMDD)")).clicked() {
chosen = Some("{date}");
}
if ui.selectable_label(false, "{hour}").on_hover_text(crate::i18n::tr("Export time (HHMM)")).clicked() {
chosen = Some("{hour}");
}
});
crate::widgets::name_combo(&c.response, crate::i18n::tr("Insert variable"));
crate::widgets::register(ui, "combo:exportSubfolderTags", c.response.rect);
if let Some(tag) = chosen {
crate::import::insert_at_cursor(ui.ctx(), subfolder_id, &mut opts.subfolder, tag);
}
crate::text_field::TextField::singleline(subfolder_widget, &mut opts.subfolder)
.hint(crate::i18n::tr("none ({album}, {date}, {hour})"))
.label(crate::i18n::tr("Subfolder"))
.width(ui.available_width())
.show(ui);
});
});
use lightcraft_engine::export::Conflict as K;
choices(ui, "If file exists", "exportConflict", &[(K::Unique, "Add number"), (K::Overwrite, "Overwrite"), (K::Skip, "Skip")], &mut opts.conflict);
+1 -1
View File
@@ -46,7 +46,7 @@ pub(crate) use scan::cards_seen;
#[cfg(test)]
pub(crate) use scan::{HELD_RESOLVES, ScanEnd, scan_by_hand, stall_scan, stall_scan_of};
pub use scan::{ScanTask, browse, open, poll_scan, running};
pub(crate) use tags::{tag_field_width, tag_help, tag_toggle, unknown_tags_warning};
pub(crate) use tags::{insert_at_cursor, tag_field_width, tag_help, tag_toggle, unknown_tags_warning};
pub use task::{ImportTask, start, start_paths, tick};
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
+343 -24
View File
@@ -86,13 +86,23 @@ const PAGE_SIZE: egui::Vec2 = egui::vec2(560.0, 640.0);
const PAGE_MIN_HEIGHT: f32 = 120.0;
/// The share of the page's room the pinned slide preview of the Slideshow tab takes, when the page
/// has more room than it needs to keep [`PAGE_MIN_HEIGHT`] for itself.
/// has more room than it needs to keep [`PINNED_PAGE_MIN_HEIGHT`] for itself.
const PINNED_PREVIEW_SHARE: f32 = 0.4;
/// What the preview's heading, the one-line hint under the slide, its Photo / Intro / Ending
/// choice and the rule under it take around the slide (at the default spacing, about 82 pt).
const PREVIEW_CHROME: f32 = 82.0;
/// What the same takes once the page has been drawn a second time (measured, at the default
/// spacing: 104 pt). The room a pinned preview leaves for the page is checked against this, not
/// against [`PREVIEW_CHROME`], so a window just tall enough never ends up with a page below
/// its least and a dialog that grows a point on this tab.
const PREVIEW_CHROME_DRAWN: f32 = 104.0;
/// The least room the page keeps under the pinned preview: a few rows, with the filter row above
/// them in the smallest window (900 x 560) that the preview is still pinned in.
const PINNED_PAGE_MIN_HEIGHT: f32 = 100.0;
/// The Settings window's content: the tab bar, which stays put, above the page of `tab`
/// ([`body`]), which scrolls when it is taller than the room for it, with a scroll handle that
/// shows without the pointer on it. `max_height` is the room the app window leaves for both: the
@@ -110,51 +120,90 @@ pub fn window(app: &mut LightcraftApp, ui: &mut egui::Ui, tab: &mut String, max_
// the next frame, so a text box on the page being left is drawn once more and saves what was
// typed in it (the click took the focus from it).
let shown = tab.clone();
// The filter, above the tabs it looks through. What is typed is kept from one frame of the
// window to the next only: Settings opened again starts with it empty.
let filter_id = egui::Id::unique("settings-filter");
let pass = ui.ctx().cumulative_pass_nr();
let kept: Option<Filter> = ui.data(|d| d.get_temp(filter_id));
let mut filter = kept.filter(|k| k.pass.checked_add(1) == Some(pass)).unwrap_or_default();
filter.pass = pass;
let had_text = !filter.text.is_empty();
let typed = crate::text_field::TextField::singleline("field:settingsFilter", &mut filter.text)
.hint(crate::i18n::tr("Filter settings"))
.width(ui.available_width())
.show(ui);
let filter_row = ui.cursor().top() - top;
// Esc with something typed empties the filter and is used up by that, wherever the focus is
// (in the box, or on a section that was found); the focus goes back to the box. Not while the
// dialog is disabled behind a prompt or the library window: that owns the keys (`dialogs::show`).
let owns_keys = ui.is_enabled();
let escape = owns_keys && had_text && !crate::widgets::escape_taken(ui.ctx()) && ui.input(|i| i.key_pressed(egui::Key::Escape));
if owns_keys && (typed.cancelled() || escape) {
filter.text.clear();
if had_text {
crate::widgets::take_escape(ui.ctx());
typed.response.request_focus();
}
}
// (an emptied filter forgets what it read: the pages are read afresh the next time it is
// used, so what is found is what they show then)
if filter.text.trim().is_empty() {
filter.sections = None;
}
// ↓ in the box goes to the first section found
let to_first = typed.response.has_focus() && ui.input(|i| i.key_pressed(egui::Key::ArrowDown));
let open_first = typed.ending == Some(crate::text_field::Ending::Return);
// (with something typed the page is what was found, of any tab: no tab is the open one)
let filtering = !filter.text.trim().is_empty();
ui.horizontal_wrapped(|ui| {
ui.spacing_mut().item_spacing = egui::vec2(4.0, 4.0);
for (id, label) in TABS {
if crate::widgets::text_button(ui, &format!("settingsTab-{id}"), label, shown == *id).clicked() {
if crate::widgets::text_button(ui, &format!("settingsTab-{id}"), label, shown == *id && !filtering).clicked() {
*tab = id.to_string();
ui.ctx().request_repaint();
// (a tab opened is its page asked for: the filter gives way)
filter.text.clear();
}
}
});
ui.separator();
// With something typed, the page gives way to the sections found, of whatever tab.
let words = filter.text.trim().to_lowercase();
let now = ui.input(|i| i.time);
let found = (!words.is_empty()).then(|| filter.found(app, &words, now));
let mut goto = None;
// (a point less than the room left, so rounding never makes the dialog's own scroll area scroll)
let room = max_height - (ui.cursor().top() - top) - 1.0;
if room < PAGE_MIN_HEIGHT {
body(app, ui, shown.as_str());
register(ui, "settings:page", ui.min_rect());
return;
}
let mut height = room.min(PAGE_SIZE.y);
// The slide preview stays above the page on Slideshow: hovering a template in the Template
// Browser previews it there, so it has to stay in view however far down the templates are
// scrolled to. With its heading and choice it takes [`PINNED_PREVIEW_SHARE`] of the room
// (at least the least tall slide); where that leaves less than [`PAGE_MIN_HEIGHT`] for the
// page, it scrolls with the page instead (as in the short window above).
// (at least the least tall slide); where that leaves less than [`PINNED_PAGE_MIN_HEIGHT`] for the
// page, it scrolls with the page instead (as in the short window above). What was found
// is drawn in its place while the filter has something typed.
let mut pinned = false;
if shown == "slideshow" {
let slide_h = (height * PINNED_PREVIEW_SHARE - PREVIEW_CHROME).max(crate::panels::slide_layout::PREVIEW_MIN_H);
if height - (slide_h + PREVIEW_CHROME) >= PAGE_MIN_HEIGHT {
if shown == "slideshow" && found.is_none() && room >= PAGE_MIN_HEIGHT {
// (the filter row is taken off the page, not off the preview: the slide is as large as it was)
let slide_h = ((room + filter_row).min(PAGE_SIZE.y) * PINNED_PREVIEW_SHARE - PREVIEW_CHROME).max(crate::panels::slide_layout::PREVIEW_MIN_H);
if height - (slide_h + PREVIEW_CHROME_DRAWN) >= PINNED_PAGE_MIN_HEIGHT {
let before = ui.cursor().top();
crate::panels::slide_layout::preview(app, ui, &Tokens::get(ui.ctx()), slide_h);
ui.add_space(2.0);
ui.separator();
height = (height - (ui.cursor().top() - before)).max(PAGE_MIN_HEIGHT);
height = (height - (ui.cursor().top() - before)).max(PINNED_PAGE_MIN_HEIGHT);
pinned = true;
}
}
// A page that goes on below shows its scroll handle all the time: without it, a page a line
// or two too long looks cut off, not scrollable.
ui.spacing_mut().scroll.dormant_handle_opacity = 0.6;
let page = egui::ScrollArea::vertical()
.id_salt(("settings-page", shown.as_str()))
.max_height(height)
.min_scrolled_height(height)
.auto_shrink([false, false])
.show(ui, |ui| {
ui.add_space(2.0);
let mut page = |ui: &mut egui::Ui| match &found {
Some(found) => goto = results(ui, found, &words, open_first, to_first),
None => {
// (a section chosen that starts its tab, with no heading of its own: the page goes to its top)
if ui
.data(|d| d.get_temp::<(&'static str, String)>(egui::Id::unique(GOTO)))
.is_some_and(|(to, section)| to == tab.as_str() && section.is_empty())
{
ui.scroll_to_cursor(Some(egui::Align::TOP));
}
if pinned {
slideshow_tab(app, ui, &Tokens::get(ui.ctx()), false);
} else {
@@ -162,6 +211,276 @@ pub fn window(app: &mut LightcraftApp, ui: &mut egui::Ui, tab: &mut String, max_
}
// (what the page took: wider than the room for it would mean a control is cut off)
register(ui, "settings:page", ui.min_rect());
}
};
if room < PAGE_MIN_HEIGHT {
page(ui);
} else {
// A page that goes on below shows its scroll handle all the time: without it, a page a
// line or two too long looks cut off, not scrollable.
ui.spacing_mut().scroll.dormant_handle_opacity = 0.6;
let salt = if found.is_some() { "found" } else { shown.as_str() };
let area = egui::ScrollArea::vertical()
.id_salt(("settings-page", salt))
.max_height(height)
.min_scrolled_height(height)
.auto_shrink([false, false])
.show(ui, |ui| {
ui.add_space(2.0);
page(ui);
});
register(ui, "settings:pageRoom", area.inner_rect);
}
// A section chosen from what was found: its tab opens (on the next frame, as a clicked tab
// does), the filter is emptied, and the section's heading is scrolled to when it is drawn.
let goto_id = egui::Id::unique(GOTO);
if let Some((to, section)) = goto {
*tab = to.to_string();
filter.text.clear();
ui.data_mut(|d| d.insert_temp(goto_id, (to, section)));
ui.ctx().request_repaint();
} else if ui.data(|d| d.get_temp::<(&'static str, String)>(goto_id)).is_some_and(|(to, _)| to == tab.as_str()) {
// (the page it was for has been drawn: its heading has had its chance)
ui.data_mut(|d| d.remove::<(&'static str, String)>(goto_id));
}
ui.data_mut(|d| d.insert_temp(filter_id, filter));
}
/// Where the section to scroll to is kept between the click on a result and its page being drawn.
const GOTO: &str = "settings-goto";
/// A section of Settings as the filter knows it: the tab it is on, its heading's English name
/// (empty for what a tab draws above its first heading) and every piece of text it draws.
#[derive(Clone)]
struct Section {
tab: &'static str,
name: String,
texts: Vec<String>,
}
/// The filter's state between frames: what is typed, and the sections of every tab with their
/// text, read once for the language, library and display profile they were read in. (What is
/// typed is kept only from one pass to the next: a pass in which Settings is not drawn loses it.)
#[derive(Clone, Default)]
struct Filter {
pass: u64,
text: String,
sections: Option<(String, std::sync::Arc<Vec<Section>>)>,
}
impl Filter {
/// The sections that have every word of `words` (lower case), in the order of the tabs.
fn found(&mut self, app: &mut LightcraftApp, words: &str, now: f64) -> Vec<Section> {
let of = format!(
"{}|{}|{:?}",
app.ui.language.code(),
app.session.library.as_ref().map(|l| l.dir.display().to_string()).unwrap_or_default(),
// (the Display page says which profile is in use)
app.renderer.display_id()
);
let sections = match &self.sections {
Some((read_for, sections)) if *read_for == of => sections.clone(),
_ => {
let sections = std::sync::Arc::new(sections(app, now));
self.sections = Some((of, sections.clone()));
sections
}
};
sections.iter().filter(|section| section.has(words)).cloned().collect()
}
}
impl Section {
/// The name of the section's tab, in the language shown.
fn tab_name(&self) -> &'static str {
TABS.iter().find(|(id, _)| *id == self.tab).map_or("", |(_, label)| crate::i18n::tr(label))
}
/// Whether the section, with the name of its tab, has every word of `words` (lower case).
fn has(&self, words: &str) -> bool {
let all = format!("{} {}", self.tab_name(), self.texts.join(" ")).to_lowercase();
words.split_whitespace().all(|word| all.contains(word))
}
/// What the section is called in the list of what was found: its tab, then its heading.
fn title(&self) -> String {
let tab = self.tab_name();
if self.name.is_empty() { tab.to_string() } else { format!("{tab} › {}", crate::i18n::tr(&self.name)) }
}
}
/// The key [`sections`] sets in the context it reads the pages in.
const READING_FOR_FILTER: &str = "settingsReadingForFilter";
/// Whether `ctx` is the context the filter reads the pages in ([`sections`]): a page draws as usual but starts no work
/// (a render, say) for text nobody sees.
pub(crate) fn reading_for_filter(ctx: &egui::Context) -> bool {
ctx.data(|d| d.get_temp::<bool>(egui::Id::unique(READING_FOR_FILTER))).unwrap_or(false)
}
/// Every section of every tab with the text it draws, read by drawing each tab's page once in a
/// context of its own: nothing of it reaches the screen, the list of widgets or the window's own
/// memory, and whatever a tab draws is found without a list kept by hand. Drawing a page asks
/// what opening its tab asks (the smart previews folder, the installed models): the answers the
/// app keeps (the installed denoise models) are filled as opening the tab fills them, and those a
/// page keeps in its own context (the smart previews folder, the face models) are asked again.
/// The pages know they are only being read ([`reading_for_filter`]): the slide preview of
/// Slideshow is not asked to render, as nothing of it is shown. No setting is
/// changed by it, as nothing is clicked. What a page does not draw is not found: the choices of
/// a closed list, tooltips, and rows scrolled out of a list inside a page.
fn sections(app: &mut LightcraftApp, now: f64) -> Vec<Section> {
fn texts(shape: &egui::Shape, out: &mut Vec<(f32, String)>) {
match shape {
egui::Shape::Text(text) => out.push((text.pos.y, text.galley.job.text.clone())),
egui::Shape::Vec(shapes) => shapes.iter().for_each(|shape| texts(shape, out)),
_ => {}
}
}
let scratch = egui::Context::default();
scratch.data_mut(|d| d.insert_temp(egui::Id::unique(READING_FOR_FILTER), true));
crate::theme::install_fonts(&scratch);
// (tall enough that no page is cut off: what is outside the screen is not drawn)
let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(PAGE_SIZE.x + 32.0, 20_000.0));
let mut all = Vec::new();
for (tab, _) in TABS {
// (on the window's clock: what a page remembers with the time it asked is not left stamped
// with another)
let input = egui::RawInput { screen_rect: Some(screen), time: Some(now), ..Default::default() };
let mut output = scratch.run_ui(input, |ui| {
ui.set_width(PAGE_SIZE.x);
body(app, ui, tab);
});
register(ui, "settings:pageRoom", page.inner_rect);
// (the font atlas this context made is for no screen: said so, or dropping it is an error)
output.textures_delta.clear();
// the page's headings, top to bottom, and each text under the last heading above it
let mut headings: Vec<(f32, String)> = crate::widgets::take_registry(&scratch)
.into_iter()
.filter_map(|(id, r)| Some((r.top(), id.strip_prefix("heading:")?.to_string())))
.collect();
headings.sort_by(|a, b| a.0.total_cmp(&b.0));
let mut drawn = Vec::new();
output.shapes.iter().for_each(|clipped| texts(&clipped.shape, &mut drawn));
drawn.sort_by(|a, b| a.0.total_cmp(&b.0));
let mut of_tab: Vec<Section> = std::iter::once(String::new())
.chain(headings.iter().map(|(_, name)| name.clone()))
.map(|name| Section { tab, name, texts: Vec::new() })
.collect();
for (y, text) in drawn {
// (a text counts as under a heading from a little above the heading's own top)
let under = headings.iter().take_while(|(top, _)| *top <= y + 1.0).count();
if let Some(section) = of_tab.get_mut(under)
&& !text.trim().is_empty()
{
section.texts.push(text);
}
}
all.extend(of_tab.into_iter().filter(|section| !section.texts.is_empty()));
}
all
}
/// The sections found, each a row to choose (`settingsFound:{tab}:{section}`): its tab and
/// heading, and under them the first texts of it that have a word of `words`. Gives the section
/// chosen, by a click, by Return or Space with the focus on it, or (`open_first`) by Return in
/// the filter, which chooses the first. `focus_first` gives the first row the keyboard focus.
fn results(ui: &mut egui::Ui, found: &[Section], words: &str, open_first: bool, focus_first: bool) -> Option<(&'static str, String)> {
let t = Tokens::get(ui.ctx());
if found.is_empty() {
ui.add_space(8.0);
ui.label(RichText::new(crate::i18n::tr("No setting matches what is typed.")).color(t.text_label));
hint(ui, &t, "Try one word, or part of one: the names of tabs and sections, labels and explanations are all looked through.");
return None;
}
let mut chosen = open_first.then(|| found.first().map(|first| (first.tab, first.name.clone()))).flatten();
for (place, section) in found.iter().enumerate() {
let fill = ui.painter().add(egui::Shape::Noop);
let row = ui
.scope_builder(egui::UiBuilder::new().sense(egui::Sense::click()), |ui| {
ui.set_width(ui.available_width());
ui.spacing_mut().item_spacing.y = 2.0;
ui.add_space(3.0);
ui.add(egui::Label::new(RichText::new(section.title()).font(t.semibold(13.0)).color(t.text)).selectable(false));
// (what of it has a word that was typed; its heading is in the line above already)
let heading = crate::i18n::tr(&section.name);
let with: Vec<&str> = section
.texts
.iter()
.map(String::as_str)
.filter(|text| *text != heading && words.split_whitespace().any(|word| text.to_lowercase().contains(word)))
.take(2)
.collect();
for text in with {
ui.add(egui::Label::new(RichText::new(text).size(11.0).color(t.text_dim)).selectable(false).truncate());
}
ui.add_space(3.0);
})
.response;
if focus_first && place == 0 {
row.request_focus();
}
let around = row.rect.expand2(egui::vec2(6.0, 0.0));
if row.hovered() || row.has_focus() {
ui.painter().set(fill, egui::Shape::rect_filled(around, egui::CornerRadius::same(4), t.hover));
}
if row.has_focus() {
ui.painter().rect_stroke(around, egui::CornerRadius::same(4), egui::Stroke::new(2.0, t.text), egui::StrokeKind::Inside);
}
row.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, section.title()));
register(ui, format!("settingsFound:{}:{}", section.tab, section.name), row.rect);
if row.clicked() {
chosen = Some((section.tab, section.name.clone()));
}
}
chosen
}
#[cfg(test)]
mod tests {
use super::*;
use crate::Services;
/// One pass of the Settings window with the filter holding `text` and Escape pressed, in a ui
/// that is disabled (`dialogs::show` does that while a prompt or the library window owns input)
/// or not; what the filter holds afterwards.
fn text_after_escape(enabled: bool) -> String {
let mut app = LightcraftApp::new(lightcraft_engine::Session::with_demo(), Services { png: None, ..Default::default() });
let ctx = egui::Context::default();
crate::theme::install_fonts(&ctx);
let mut tab = "general".to_string();
let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1200.0, 900.0));
let mut pass = |app: &mut LightcraftApp, events: Vec<egui::Event>, enabled: bool| {
let input = egui::RawInput { screen_rect: Some(screen), events, ..Default::default() };
let mut output = ctx.run_ui(input, |ui| {
if !enabled {
ui.disable();
}
window(app, ui, &mut tab, 800.0);
});
output.textures_delta.clear();
};
let filter_id = egui::Id::unique("settings-filter");
// (a pass draws the window, which keeps its filter for the pass after it)
pass(&mut app, Vec::new(), true);
ctx.data_mut(|d| {
let mut kept: Filter = d.get_temp(filter_id).expect("the window keeps its filter");
kept.text = "sidecar".into();
d.insert_temp(filter_id, kept);
});
let escape = egui::Event::Key {
key: egui::Key::Escape,
physical_key: Some(egui::Key::Escape),
pressed: true,
repeat: false,
modifiers: egui::Modifiers::NONE,
};
pass(&mut app, vec![escape], enabled);
let kept: Filter = ctx.data(|d| d.get_temp(filter_id)).expect("the filter is kept");
kept.text
}
#[test]
fn escape_empties_the_filter_only_while_the_dialog_owns_the_keys() {
assert_eq!(text_after_escape(true), "", "Escape empties what was typed");
assert_eq!(text_after_escape(false), "sidecar", "behind a prompt or the library window it is not the dialog's");
}
}
@@ -6,7 +6,7 @@ use super::{RichText, Tokens, register};
/// use is outlined. Applied on the next frame ([`LightcraftApp::sync_theme`]).
pub(super) fn appearance(ui: &mut egui::Ui, t: &Tokens, s: &mut crate::state::AppSettings, system: Option<egui::Theme>) {
use crate::state::{AppearanceMode as M, DarkTheme, LightTheme};
heading(ui, t, crate::i18n::tr("Appearance"));
heading(ui, t, "Appearance");
ui.label(RichText::new(crate::i18n::tr("Appearance Mode")).color(t.text_label));
ui.horizontal_wrapped(|ui| {
choices(ui, "settingsAppearance", &[(M::Auto, "Sync with System"), (M::Dark, "Dark Mode"), (M::Light, "Light Mode")], &mut s.appearance_mode);
@@ -7,7 +7,7 @@ use super::{GridBadges, LightcraftApp, RichText, Tokens, Value, json, register};
/// The monitor profile (`app.displayProfile`): previews are shown through the display's ICC
/// profile, so wide-gamut and calibrated displays show colours as they are.
pub(super) fn display_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {
heading(ui, t, crate::i18n::tr("Monitor profile"));
heading(ui, t, "Monitor profile");
let current = app.renderer.display().cloned();
let screen = current.as_ref().is_some_and(|d| d.path == crate::SCREEN_PROFILE);
row(ui, t, crate::i18n::tr("Profile"), |ui| {
@@ -98,10 +98,10 @@ pub(super) fn interface_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Toke
app.ui.settings.reduce_motion = None;
}
});
heading(ui, t, crate::i18n::tr("Filmstrip"));
heading(ui, t, "Filmstrip");
check(ui, "settings.filmNames", &mut app.ui.settings.film_names, "Show file names");
check(ui, "settings.filmBadges", &mut app.ui.settings.film_badges, "Show ratings, flags and edit badges");
heading(ui, t, crate::i18n::tr("Grid"));
heading(ui, t, "Grid");
row(ui, t, crate::i18n::tr("Ratings & flags"), |ui| {
choices(
ui,
@@ -112,7 +112,7 @@ pub(super) fn interface_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Toke
});
hint(ui, t, "Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.");
check(ui, "settings.showFilenames", &mut app.ui.show_filenames, "Square Grid: show file names and formats");
heading(ui, t, crate::i18n::tr("Keywords"));
heading(ui, t, "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);
@@ -122,7 +122,7 @@ pub(super) fn interface_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Toke
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 View"));
heading(ui, t, "Detail View");
check(ui, "settings.navigator", &mut app.ui.navigator, "Show the Navigator while zoomed in");
row(ui, t, crate::i18n::tr("Info overlay"), |ui| {
use crate::state::InfoOverlay as I;
@@ -137,7 +137,7 @@ pub(super) fn interface_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Toke
/// (`view.viewOptions`). Changes apply as they are made.
pub(in super::super) fn view_options(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {
use crate::state::{InfoOverlay as I, LoupeInfo, LoupeInfoField as F};
heading(ui, t, crate::i18n::tr("Loupe View"));
heading(ui, t, "Loupe View");
let mut show = app.ui.info_overlay != I::Off;
if check(ui, "viewOptions.showInfo", &mut show, "Show Info Overlay") {
app.ui.info_overlay = if show { I::Basic } else { I::Off };
@@ -148,7 +148,7 @@ pub(in super::super) fn view_options(app: &mut LightcraftApp, ui: &mut egui::Ui,
});
});
for (n, title, defaults) in [(1, "Loupe Info 1", LoupeInfo::INFO1), (2, "Loupe Info 2", LoupeInfo::INFO2)] {
heading(ui, t, crate::i18n::tr(title));
heading(ui, t, title);
let lines = if n == 1 { &mut app.ui.settings.loupe_info.info1 } else { &mut app.ui.settings.loupe_info.info2 };
for (i, line) in lines.iter_mut().enumerate() {
let id = format!("viewOptionsInfo{n}Line{}", i + 1);
@@ -180,7 +180,7 @@ pub(in super::super) fn view_options(app: &mut LightcraftApp, ui: &mut egui::Ui,
app.ui.settings.loupe_info.briefly = if briefly { info } else { I::Off };
}
}
heading(ui, t, crate::i18n::tr("General"));
heading(ui, t, "General");
check(ui, "viewOptions.loupeMessages", &mut app.ui.settings.loupe_messages, "Show message when loading or rendering photos");
}
@@ -12,7 +12,7 @@ pub(super) fn general_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens
});
crate::i18n::set_language(app.ui.language);
});
heading(ui, t, crate::i18n::tr("Library"));
heading(ui, t, "Library");
let location = match &app.session.library {
Some(l) => l.dir.display().to_string(),
None => crate::i18n::tr("In memory — nothing is saved").to_string(),
@@ -60,7 +60,7 @@ pub(super) fn general_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens
&mut app.ui.settings.lightroom_import,
);
});
heading(ui, t, crate::i18n::tr("Startup"));
heading(ui, t, "Startup");
row(ui, t, crate::i18n::tr("Open in"), |ui| {
choices(
ui,
@@ -69,13 +69,13 @@ pub(super) fn general_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens
&mut app.ui.settings.startup_view,
);
});
heading(ui, t, crate::i18n::tr("Culling"));
heading(ui, t, "Culling");
check(ui, "settings.autoAdvance", &mut app.ui.auto_advance, "Auto Advance: move to the next photo after rating or flagging");
check(ui, "settings.confirmDelete", &mut app.ui.settings.confirm_delete, "Confirm before moving photos to Recently Deleted");
check(ui, "settings.askBeforeMove", &mut app.ui.settings.ask_before_move, "Confirm before moving photos to another folder on disk");
heading(ui, t, crate::i18n::tr("Dialogs"));
heading(ui, t, "Dialogs");
check(ui, "settings.closeDialogsOutside", &mut app.ui.settings.close_dialogs_outside, "Close a dialog by clicking outside it");
heading(ui, t, crate::i18n::tr("External Editing"));
heading(ui, t, "External Editing");
row(ui, t, crate::i18n::tr("PhotoCraft"), |ui| {
field(
ui,
@@ -118,7 +118,7 @@ pub(super) fn general_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens
#[cfg(not(target_arch = "wasm32"))]
fn lens_profiles(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {
use lightcraft_engine::lensfun_download::{self, Offer};
heading(ui, t, crate::i18n::tr("Lens profiles"));
heading(ui, t, "Lens profiles");
let running = app.session.lensfun.running();
// (the user's own folder, LIGHTCRAFT_LENSFUN_DIR, is read instead and never replaced)
let own = std::env::var_os(lightcraft_engine::lens_profiles::ENV).is_some_and(|v| !v.is_empty());
@@ -4,7 +4,7 @@ use super::{LightcraftApp, RichText, Tokens, json, register};
pub(super) fn import_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {
let d = app.session.import_defaults.clone();
heading(ui, t, crate::i18n::tr("Raw defaults"));
heading(ui, t, "Raw defaults");
hint(ui, t, crate::i18n::tr("Settings new raw photos start from. Changing them doesn't touch photos already in the library."));
row(ui, t, crate::i18n::tr("Raw photos"), |ui| {
if let Some(v) = preset_combo(app, ui, "settingsRawPreset", crate::i18n::tr("Raw default"), d.raw_preset.as_deref(), "LightCraft Default") {
@@ -65,13 +65,13 @@ pub(super) fn import_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens)
}
});
}
heading(ui, t, crate::i18n::tr("Other images (JPEG, PNG, TIFF, HEIC…)"));
heading(ui, t, "Other images (JPEG, PNG, TIFF, HEIC…)");
row(ui, t, crate::i18n::tr("Non-raw photos"), |ui| {
if let Some(v) = preset_combo(app, ui, "settingsOtherPreset", crate::i18n::tr("Other preset"), d.other_preset.as_deref(), "None") {
let _ = app.run("library.preferences", json!({"import": {"otherPreset": v}}));
}
});
heading(ui, t, crate::i18n::tr("Metadata"));
heading(ui, t, "Metadata");
hint(ui, t, crate::i18n::tr("Added to photos you import that don't already have it."));
for (key, label, hint_text, value) in
[("copyright", "Copyright", "© 2026 Your Name", d.copyright.clone()), ("creator", "Creator", "Your Name", d.creator.clone())]
@@ -117,7 +117,7 @@ pub(super) fn import_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens)
}
});
}
heading(ui, t, crate::i18n::tr("XMP sidecars"));
heading(ui, t, "XMP sidecars");
let mut xmp = app.session.xmp;
if check(ui, "settings.autoWriteXmp", &mut xmp.auto_write, "Automatically write changes into XMP sidecars") {
let _ = app.run("library.xmpPreferences", json!({"autoWrite": xmp.auto_write}));
@@ -131,14 +131,14 @@ pub(super) fn import_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens)
}
});
if !cfg!(target_arch = "wasm32") {
heading(ui, t, crate::i18n::tr("Dropped Files"));
heading(ui, t, "Dropped Files");
check(ui, "settings.importDropped", &mut app.ui.settings.import_dropped_directly, "Import dropped files without review");
heading(ui, t, crate::i18n::tr("Cameras and Cards"));
heading(ui, t, "Cameras and Cards");
let mut on_card = d.show_on_card;
if check(ui, "settings.importOnCard", &mut on_card, "Show the import review when a camera or card is connected") {
let _ = app.run("library.preferences", json!({"import": {"showOnCard": on_card}}));
}
heading(ui, t, crate::i18n::tr("Auto Import"));
heading(ui, t, "Auto Import");
hint(ui, t, crate::i18n::tr("Photos that arrive in this folder (tethering, a scanner, a sync app) are added as soon as they're complete."));
row(ui, t, crate::i18n::tr("Watched folder"), |ui| {
match &d.auto_folder {
@@ -100,6 +100,10 @@ fn switch_library(app: &mut LightcraftApp, path: &str) -> Result<Value, String>
app.ui.reference = None;
app.ui.compare = None;
app.ui.brief_info = crate::state::BriefInfo::default();
// (masks hidden with O, and the hovered mask, are keyed by photo ID too)
app.ui.mask_overlay_hidden.clear();
app.ui.mask_hover = None;
app.ui.mask_hover_prev = None;
// a keyword picked in the Keyword List belongs to the library being left
app.ui.keyword_list_selected = None;
if app.ui.view == crate::state::ViewMode::Reference {
@@ -9,7 +9,7 @@ use super::{
pub(super) fn performance_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {
use lightcraft_engine::gpu;
heading(ui, t, crate::i18n::tr("Rendering"));
heading(ui, t, "Rendering");
#[cfg(target_os = "windows")]
check(ui, "settings.composeWindow", &mut app.ui.settings.compose_window, "Prevent G-SYNC/FreeSync flicker (applies at next launch)");
check(ui, "settings.gpu", &mut app.ui.settings.gpu, "Use the GPU for rendering");
@@ -66,7 +66,7 @@ pub(super) fn performance_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &To
"Remove Hot Pixels (Detail) leaves a raw unchanged when more than this share of its photosites would be replaced: such a photo doesn't look like hot pixels on a sensor.",
),
);
heading(ui, t, crate::i18n::tr("Preview cache"));
heading(ui, t, "Preview cache");
let cur = app.session.cache_mb;
row(ui, t, crate::i18n::tr("Size limit"), |ui| {
let gb = lightcraft_engine::media::default_disk_cache_bytes(app.session.catalog.len()).div_ceil(1 << 30);
@@ -103,7 +103,7 @@ pub(super) fn performance_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &To
}
});
background_prep(app, ui, t);
heading(ui, t, crate::i18n::tr("Local folders"));
heading(ui, t, "Local folders");
row(ui, t, crate::i18n::tr("Forget unchanged photos"), |ui| {
let opts = [(0u32, "Never"), (7, "After 7 days"), (30, "After 30 days"), (90, "After 90 days"), (365, "After a year")];
let mut v = app.session.forget_local_days;
@@ -131,7 +131,7 @@ fn ai_masks(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {
if !lightcraft_engine::segment::Segmenter::AVAILABLE {
return;
}
heading(ui, t, crate::i18n::tr("AI masks"));
heading(ui, t, "AI masks");
let current = app.session.segmenter.run_on().name();
let mut run_on = current;
if row(ui, t, "Run on", |ui| choices(ui, "settingsAiMasksRunOn", &[("auto", "Automatic (GPU when available)"), ("cpu", "CPU")], &mut run_on))
@@ -179,7 +179,7 @@ fn ai_masks(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {
/// is made ready before the user gets to it (`prefs.backgroundPrep`), app-wide or for this library.
fn background_prep(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {
use lightcraft_engine::prep::{Mode, Scope};
heading(ui, t, crate::i18n::tr("Prepare photos in the background"));
heading(ui, t, "Prepare photos in the background");
hint(
ui,
t,
@@ -279,7 +279,7 @@ fn smart_previews(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {
if loc.is_null() {
return;
}
heading(ui, t, crate::i18n::tr("Smart previews"));
heading(ui, t, "Smart previews");
let path = loc["path"].as_str().unwrap_or_default().to_string();
let available = loc["available"].as_bool().unwrap_or(true);
let custom = loc["custom"].as_bool().unwrap_or(false);
@@ -237,14 +237,16 @@ pub fn preview(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, max_h: f3
ui.ctx().data_mut(|d| d.insert_temp(mem, (key, now)));
}
let still = if last == key { now - since } else { 0.0 };
// the first preview (or another photo's) at once, a changing layout once it has settled
if current.is_none() || still >= DEBOUNCE {
// the first preview (or another photo's) at once, a changing layout once it has settled (none while the
// Settings filter only reads the page for its text: nothing of it is shown)
let reading = super::reading_for_filter(ui.ctx());
if !reading && (current.is_none() || still >= DEBOUNCE) {
let side = crate::panels::detail::texture_side(ui.ctx());
let edge = app.ui.settings.loupe_edge(pw.max(ph) as f32, usize::MAX, side);
if let Some(job) = app.session.slide_job_look(&s, &overlays, id, pw, ph, Some(edge), false) {
app.renderer.request(Slot::SlidePreview, job, 90);
}
} else {
} else if !reading {
ui.ctx().request_repaint_after(std::time::Duration::from_secs_f64((DEBOUNCE - still).clamp(0.01, DEBOUNCE)));
}
let say =
@@ -25,7 +25,7 @@ pub(super) fn slideshow_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Toke
/// Export: PDF, JPEG sequence or video of the slideshow (View ▸ Slideshow ▸ Export Slideshow…).
fn export_section(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {
heading(ui, t, crate::i18n::tr("Export"));
heading(ui, t, "Export");
let running = app.session.slideshow_export.as_ref().is_some_and(|r| r.running());
ui.horizontal_wrapped(|ui| {
for (id, label, format) in [
@@ -45,7 +45,7 @@ fn export_section(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {
fn playback_section(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {
use lightcraft_engine::slideshow::{FADE_MAX, SLIDE_MAX, SLIDE_MIN};
heading(ui, t, crate::i18n::tr("Playback"));
heading(ui, t, "Playback");
let s = app.session.slideshow.clone();
let mut v = s.manual;
if check(ui, "settings.slideshowManual", &mut v, "Manual slideshow") {
+10 -2
View File
@@ -1,4 +1,4 @@
use super::{LABEL_W, RichText, Tokens, register};
use super::{GOTO, LABEL_W, RichText, Tokens, register};
/// `path` shortened to fit `max` (as `width` measures it) by dropping leading folders, after
/// either kind of separator, so that its end stays (`…/Pictures/Library`,
@@ -61,7 +61,15 @@ pub(super) fn field(ui: &mut egui::Ui, field: crate::text_field::TextField<'_>)
pub(crate) fn heading(ui: &mut egui::Ui, t: &Tokens, text: &str) {
ui.add_space(4.0);
ui.label(RichText::new(crate::i18n::tr(text)).font(t.semibold(12.5)).color(t.text));
// `text` is the heading's English name (its message key). It is shown translated and
// registered as `heading:{text}` whatever the language, where a section starts: for the
// filter, scripts and tests that look for one.
let r = ui.label(RichText::new(crate::i18n::tr(text)).font(t.semibold(12.5)).color(t.text));
register(ui, format!("heading:{text}"), r.rect);
// (chosen from what the filter found: the section is brought to the top of the page)
if ui.data(|d| d.get_temp::<(&'static str, String)>(egui::Id::unique(GOTO))).is_some_and(|(_, section)| section == text) {
r.scroll_to_me(Some(egui::Align::TOP));
}
}
pub(crate) fn row<R>(ui: &mut egui::Ui, t: &Tokens, label: &str, add: impl FnOnce(&mut egui::Ui) -> R) -> R {
+34 -3
View File
@@ -811,8 +811,25 @@ fn ui_commands_5(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Val
Ok(Value::Null)
}
"view.maskOverlay" => {
app.ui.mask_overlay = p.get("show").and_then(Value::as_bool).unwrap_or(!app.ui.mask_overlay);
Ok(json!({"maskOverlay": app.ui.mask_overlay}))
// O shows or hides what is on screen now: an overlay that showed by itself (a mask
// without settings yet) is hidden for that mask
let selected = app.session.active().and_then(|id| app.session.develop_of(id)).and_then(|d| {
app.session
.active_mask
.and_then(|mid| d.masks.iter().find(|m| m.id == mid).map(|m| (mid, crate::panels::detail::overlay_shown(app, m))))
});
let shown = selected.is_some_and(|s| s.1) || (selected.is_none() && app.ui.mask_overlay);
let show = p.get("show").and_then(Value::as_bool).unwrap_or(!shown);
app.ui.mask_overlay = show;
let photo = app.session.active();
if let Some(key) = selected.and_then(|s| photo.map(|p| (p, s.0))) {
// each hidden mask stays hidden until O shows it again (not until another is hidden)
app.ui.mask_overlay_hidden.retain(|k| *k != key);
if !show {
app.ui.mask_overlay_hidden.push(key);
}
}
Ok(json!({"maskOverlay": show}))
}
"view.maskOverlayAll" => {
app.ui.mask_overlay_all = !app.ui.mask_overlay_all;
@@ -1106,6 +1123,21 @@ fn ui_commands_8(app: &mut LightcraftApp, _ctx: &egui::Context, id: &str, p: &Va
}),
s if s.starts_with("tool.") => {
let tool = &s["tool.".len()..];
// a Brush stroke ends before another tool takes over (its release would go unseen: the next
// stroke would carry on from it), and before a Brush request that makes a new mask or component
// (what was painted stays on the mask it was painted on); a live one closes its undo step, so a
// new mask isn't folded into the "Brush" step
let creates = p.get("new").and_then(Value::as_bool) == Some(true) || p.get("op").is_some();
if (tool != "brush" || creates)
&& let Some(crate::panels::detail::Gesture::Brush { live, .. }) = &app.gesture
{
let went_live = live.is_some();
app.gesture = None;
app.brush_live = None;
if went_live {
let _ = app.run("develop.endInteraction", json!({}));
}
}
match tool {
"none" => app.ui.tool.clear(),
"guidedUpright" => {
@@ -1135,7 +1167,6 @@ fn ui_commands_8(app: &mut LightcraftApp, _ctx: &egui::Context, id: &str, p: &Va
return Some(Err(e));
}
app.ui.brush_erase = false;
app.ui.mask_overlay = true;
}
app.ui.right = RightPanel::Masking;
app.ui.view = ViewMode::Detail;
+86 -5
View File
@@ -76,6 +76,9 @@ pub enum Gesture {
/// Pen pressure (0..1) at each point; empty when no pen pressure was reported (a mouse) or the
/// brush's Pen Pressure switch is off.
pressure: Vec<f32>,
/// A stroke whose effect shows while painting: when (app time) it last went to the photo and
/// how many points it had then; `None` until it first does (its undo step is open meanwhile).
live: Option<(f64, usize)>,
},
Spot {
points: Vec<Point>,
@@ -1167,6 +1170,81 @@ fn targeted_drag(app: &mut LightcraftApp, resp: &egui::Response, map: &CanvasMap
}
}
/// Whether a slider is adjusting the photo right now. Then the mask overlay, its lines, handles
/// and pins hide so the effect itself can be judged, even an overlay switched on with O; they come
/// back as they were when the slider is let go. Sliders that shape the mask itself (Refine,
/// Smoothness, Feather, a range's edges) keep them.
pub(crate) fn adjusting(app: &LightcraftApp) -> bool {
app.ui.dragging_control.as_deref().is_some_and(|c| !shapes_graphics(c))
}
/// Slider ids that change what the mask graphics show rather than the photo's look.
fn shapes_graphics(id: &str) -> bool {
matches!(id, "refine" | "smoothness" | "edge" | "feather")
}
/// The mask the overlay shows, if any. One rule:
/// overlay = O / Always, OR (the pointer on the mask's pin or on one of its component rows AND not
/// adjusting), OR (Auto AND the mask has no settings). The pointer on the mask's own row (name, eye,
/// menu) shows nothing: that is where its effect is judged, the eye switching it on and off. "Adjusting" is a slider at work ([`adjusting`], which hides every
/// overlay in [`view_overlay`]) or a mask gesture (a handle or the gradient dragged, a brush
/// stroke): hovering never shows the overlay while one runs, even with the pointer over the pin
/// being dragged. A mask with settings (its own, or a preset's) never shows by itself, so its effect
/// can be judged while it is placed or picked; a mask without settings shows what it selects, also
/// while it is drawn (there is no effect to see yet). This replaces showing the overlay again on
/// every new, picked or duplicated mask (#1800): that covered the photo exactly when the user
/// judges a mask's effect; hovering one of its component rows or its pin, or O, shows it on request.
pub(crate) fn overlay_mask<'a>(app: &LightcraftApp, d: &'a DevelopSettings) -> Option<&'a lightcraft_develop::Mask> {
if !mask_gesture(app)
&& let Some(photo) = app.session.active()
&& let Some(m) =
app.ui.mask_hover.or(app.ui.mask_hover_prev).filter(|(p, _)| *p == photo).and_then(|(_, id)| d.masks.iter().find(|m| m.id == id))
{
return Some(m);
}
let m = app.session.active_mask.and_then(|id| d.masks.iter().find(|m| m.id == id))?;
overlay_shown(app, m).then_some(m)
}
/// Whether the selected mask `m`'s overlay shows (without hovering): O / Always, or Auto and `m`
/// has no settings ([`overlay_mask`] has the whole rule).
pub(crate) fn overlay_shown(app: &LightcraftApp, m: &lightcraft_develop::Mask) -> bool {
// (a mask O hid stays hidden though O showed another since)
if app.session.active().is_some_and(|photo| app.ui.mask_overlay_hidden.contains(&(photo, m.id))) {
return false;
}
app.ui.mask_overlay || !mask_has_settings(m)
}
/// Whether mask `m` changes the photo by itself: any adjustment off its default. (Its shape, Refine
/// Edges included, is not a setting: it is what the overlay is for.)
pub(crate) fn mask_has_settings(m: &lightcraft_develop::Mask) -> bool {
m.adjust != lightcraft_develop::LocalAdjustments::default()
}
/// Whether a mask is being shaped on the photo right now: a handle or the gradient dragged, a brush
/// stroke.
pub(crate) fn mask_gesture(app: &LightcraftApp) -> bool {
matches!(app.gesture, Some(Gesture::MaskHandle { .. } | Gesture::Brush { .. }))
}
/// Whether the selected mask `m` has an AI selection (an Object click or a description) still
/// being computed. Meanwhile no overlay shows for it: a stand-in would look like the result.
pub(crate) fn ai_computing(app: &LightcraftApp, m: &lightcraft_develop::Mask) -> bool {
app.session.segmenter.busy() && ai_unfinished(m)
}
/// Whether mask `m` has an AI selection without its result yet.
fn ai_unfinished(m: &lightcraft_develop::Mask) -> bool {
m.components.iter().any(|c| matches!(&c.shape, MaskShape::Prompt { seg: None, .. } | MaskShape::Object { seg: None, .. }))
}
/// Whether the all-masks overlay can show: some visible mask has a shape, and none has an AI
/// selection still being computed (`busy`), whose stand-in would look like the result.
pub(crate) fn all_masks_showable(d: &DevelopSettings, busy: bool) -> bool {
d.masks.iter().any(|m| m.visible && !m.components.is_empty()) && !(busy && d.masks.iter().any(|m| m.visible && ai_unfinished(m)))
}
/// The diagnostic overlay the loupe shows (an Alt-drag preview, the selected mask, Point Color's
/// visualized range, Visualize Spots, the clipping warnings).
pub(crate) fn view_overlay(app: &LightcraftApp, d: &DevelopSettings) -> lightcraft_pipeline::Overlay {
@@ -1181,19 +1259,22 @@ pub(crate) fn view_overlay(app: &LightcraftApp, d: &DevelopSettings) -> lightcra
{
return o;
}
// a slider at work: the effect shows, not the overlay (it returns afterwards)
let shown = !adjusting(app);
// Show every visible mask's region at once (Ctrl+Shift+O / Cmd+Shift+O), ahead of the selected-mask overlay
// so the shortcut is not shadowed by the always-on single-mask overlay.
if app.ui.right == RightPanel::Masking && app.ui.mask_overlay_all && d.masks.iter().any(|m| m.visible && !m.components.is_empty()) {
// so the shortcut is not shadowed by the single-mask overlay.
if shown && app.ui.right == RightPanel::Masking && app.ui.mask_overlay_all && all_masks_showable(d, app.session.segmenter.busy()) {
return Overlay::AllMasks {
view: MaskView::parse(&app.ui.mask_overlay_mode).unwrap_or_default(),
color: app.ui.mask_overlay_color,
opacity: app.ui.mask_overlay_opacity.clamp(0.0, 100.0).round() as u8,
};
}
if app.ui.right == RightPanel::Masking
&& app.ui.mask_overlay
&& let Some(m) = app.session.active_mask.and_then(|id| d.masks.iter().find(|m| m.id == id))
if shown
&& app.ui.right == RightPanel::Masking
&& let Some(m) = overlay_mask(app, d)
&& !m.components.is_empty()
&& !ai_computing(app, m)
{
return Overlay::Mask {
id: m.id.min(u16::MAX as u32) as u16,
@@ -102,18 +102,18 @@ pub(super) fn lens_blur_brush_overlay(app: &mut LightcraftApp, ui: &mut egui::Ui
let force = if app.ui.brush_pressure { ui.input(pen_force) } else { None };
match &mut app.gesture {
Some(Gesture::Brush { points, .. }) if points.last() == Some(&n) => {}
Some(Gesture::Brush { points, pressure }) => {
Some(Gesture::Brush { points, pressure, .. }) => {
record_pressure(pressure, points.len(), force);
points.push(n);
}
_ => {
let mut pressure = Vec::new();
record_pressure(&mut pressure, 0, force);
app.gesture = Some(Gesture::Brush { points: vec![n], pressure });
app.gesture = Some(Gesture::Brush { points: vec![n], pressure, live: None });
}
}
}
if let Some(Gesture::Brush { points, pressure }) = &app.gesture {
if let Some(Gesture::Brush { points, pressure, .. }) = &app.gesture {
let screen: Vec<Pos2> = points.iter().map(|q| map.screen(*q)).collect();
let params = crate::brush_live::LiveParams {
clip,
@@ -130,7 +130,7 @@ pub(super) fn lens_blur_brush_overlay(app: &mut LightcraftApp, ui: &mut egui::Ui
app.brush_live = None;
}
if (resp.drag_stopped() || resp.clicked())
&& let Some(Gesture::Brush { points, pressure }) = app.gesture.take()
&& let Some(Gesture::Brush { points, pressure, .. }) = app.gesture.take()
{
app.brush_live = None;
let pts: Vec<[f64; 2]> = points.iter().map(|q| [q.x, q.y]).collect();
+93 -15
View File
@@ -1,7 +1,7 @@
use super::geometry::CanvasMap;
use super::{
Color32, DevelopSettings, Gesture, LightcraftApp, MaskShape, Point, Pos2, Rect, Sense, Stroke, StrokeKind, Tokens, ToolOverlay, json, pos2,
register, vec2,
Color32, DevelopSettings, Gesture, LightcraftApp, MaskShape, Point, Pos2, Rect, Sense, Stroke, StrokeKind, Tokens, ToolOverlay, adjusting, json,
overlay_shown, pos2, register, vec2,
};
/// What the user did to a face box this frame.
@@ -363,7 +363,12 @@ pub(super) fn color_range_pick(app: &mut LightcraftApp, ui: &egui::Ui, resp: &eg
pub(super) fn mask_overlay(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::Response, map: &CanvasMap, d: &DevelopSettings) {
let active = app.session.active_mask;
let clip = app.canvas_rect.unwrap_or(map.rect);
let p = &ui.painter_at(clip);
let mut painter = ui.painter_at(clip);
// a slider at work: no lines, handles or pins over the effect
if adjusting(app) {
painter.set_invisible();
}
let p = &painter;
// (mask, component, handle, screen position) of everything that can be grabbed
let mut grips: Vec<(u32, usize, u8, Pos2)> = Vec::new();
// pins follow Show Pins and the Tool Overlay mode (Shift+H); Auto hides them while brushing
@@ -396,6 +401,15 @@ pub(super) fn mask_overlay(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &eg
}
}
}
// the pointer on a pin shows that mask's overlay (as Lightroom Classic); of pins on top of each other, the
// selected mask's, then the nearest: the one a drag there would move ([`grip_gestures`])
if let Some(h) = resp.hover_pos()
&& let Some((mid, ..)) = grips.iter().filter(|(_, _, handle, q)| *handle == 0 && q.distance(h) < 9.0).min_by(|a, b| {
(Some(a.0) != active, a.3.distance(h)).partial_cmp(&(Some(b.0) != active, b.3.distance(h))).unwrap_or(std::cmp::Ordering::Equal)
})
{
app.ui.mask_hover = app.session.active().map(|photo| (photo, *mid));
}
mask_keys(app, ui, map, d, &grips);
object_marks(app, p, map, d, active);
// Colour Range "Pick": the Masking panel owns the loupe's clicks (general_interaction
@@ -664,6 +678,15 @@ fn brush_tool(
clip: Rect,
d: &DevelopSettings,
) {
// a live stroke cut short (no release seen): what went to the photo stays, in one step
if matches!(app.gesture, Some(Gesture::Brush { live: Some(_), .. }))
&& !resp.drag_stopped()
&& !resp.clicked()
&& !ui.input(|i| i.pointer.any_down())
{
app.gesture = None;
let _ = app.run("develop.endInteraction", json!({}));
}
let active = app.session.active_mask;
// the stroke goes into the selected mask (or a new one): in its coordinates
let map = &map.for_mask_id(d, active);
@@ -682,30 +705,39 @@ fn brush_tool(
match &mut app.gesture {
// a held, unmoving pointer records nothing: coverage builds by passes, not time (#518)
Some(Gesture::Brush { points, .. }) if points.last() == Some(&n) => {}
Some(Gesture::Brush { points, pressure }) => {
Some(Gesture::Brush { points, pressure, .. }) => {
record_pressure(pressure, points.len(), force);
points.push(n);
}
// a stroke starts with a press, not part-way through a drag: one ended for picking another mask
// or photo ([`LightcraftApp::cancel_brush_gesture`]) paints nothing more until the button is let go
_ if !(resp.drag_started() || resp.clicked()) => {}
_ => {
let mut pressure = Vec::new();
record_pressure(&mut pressure, 0, force);
app.gesture = Some(Gesture::Brush { points: vec![n], pressure });
app.gesture = Some(Gesture::Brush { points: vec![n], pressure, live: None });
}
}
}
// the stroke being painted (the render shows it once it's committed), with the committed
// stroke's dab spacing, feather and flow (issue #517), tinted only when the overlay will
// show it: with the overlay hidden (O, or a mask slider hid it) or a colour overlay at
// opacity 0, the photo stays untinted while painting, so dodging and burning is judged on
// the photo (issue #2549)
// the overlay rule: a mask with settings shows its effect while painted (the stroke goes to the photo live),
// never tinted; the stroke is tinted only when the overlay will show it (O, or a mask without settings yet).
// With the all-masks overlay it follows the mask's visibility, and a colour overlay at opacity 0 tints nothing,
// so dodging and burning is judged on the photo (issue #2549). The tinted stroke has the committed stroke's dab
// spacing, feather and flow (issue #517); the render shows it once it's committed.
use lightcraft_pipeline::MaskView;
let colored = matches!(MaskView::parse(&app.ui.mask_overlay_mode).unwrap_or_default(), MaskView::Color | MaskView::ColorOnBw);
// the all-masks overlay ([`view_overlay`]) shows only visible masks, and gives way to the
// selected mask's when none has anything in it (a stroke goes into the selected mask, or a new one)
let visible = active.and_then(|id| d.masks.iter().find(|m| m.id == id)).is_none_or(|m| m.visible);
let mask = active.and_then(|id| d.masks.iter().find(|m| m.id == id));
let visible = mask.is_none_or(|m| m.visible);
let all = app.ui.mask_overlay_all && (visible || d.masks.iter().any(|m| m.visible && !m.components.is_empty()));
let shown = if all { visible } else { app.ui.mask_overlay } && !(colored && app.ui.mask_overlay_opacity <= 0.0);
if shown && let Some(Gesture::Brush { points, pressure }) = &app.gesture {
let red = if all { visible } else { mask.is_none_or(|m| overlay_shown(app, m)) } && !(colored && app.ui.mask_overlay_opacity <= 0.0);
if !red {
live_stroke(app, ui);
}
if let Some(Gesture::Brush { points, pressure, live: None }) = &app.gesture
&& red
{
let screen: Vec<Pos2> = points.iter().map(|q| map.screen(*q)).collect();
// opacity 0 only gets here in the image views, which ignore it: a fixed tint there
let opacity = if app.ui.mask_overlay_opacity > 0.0 { app.ui.mask_overlay_opacity / 100.0 } else { 110.0 / 255.0 };
@@ -724,7 +756,7 @@ fn brush_tool(
app.brush_live = None;
}
if (resp.drag_stopped() || resp.clicked())
&& let Some(Gesture::Brush { points, pressure }) = app.gesture.take()
&& let Some(Gesture::Brush { points, pressure, live }) = app.gesture.take()
{
app.brush_live = None;
let pts: Vec<[f64; 2]> = points.iter().map(|q| [q.x, q.y]).collect();
@@ -736,8 +768,54 @@ fn brush_tool(
let _ = app.run(
"mask.brushStroke",
json!({"points": pts, "size": app.ui.brush_size, "feather": app.ui.brush_feather, "flow": app.ui.brush_flow,
"erase": erase, "autoMask": app.ui.brush_auto_mask, "pressure": pressure, "connect": connect}),
"erase": erase, "autoMask": app.ui.brush_auto_mask, "pressure": pressure, "connect": connect && live.is_none(),
"continue": live.is_some()}),
);
if live.is_some() {
let _ = app.run("develop.endInteraction", json!({}));
}
}
}
/// A stroke on a mask with settings goes to the photo every moment while painting, so its effect
/// shows live (one undo step for the whole stroke).
fn live_stroke(app: &mut LightcraftApp, ui: &egui::Ui) {
let now = ui.input(|i| i.time);
let Some(Gesture::Brush { points, pressure, live }) = &app.gesture else { return };
if !live_due(*live, points.len(), now) {
return;
}
let (pts, pressure, first) = (points.iter().map(|q| [q.x, q.y]).collect::<Vec<_>>(), pressure.clone(), live.is_none());
if first {
let _ = app.run("develop.beginInteraction", json!({"label": "Brush"}));
}
let erase = app.ui.brush_erase != ui.input(|i| i.modifiers.alt);
let sent = app.run(
"mask.brushStroke",
json!({"points": pts, "size": app.ui.brush_size, "feather": app.ui.brush_feather, "flow": app.ui.brush_flow,
"erase": erase, "autoMask": app.ui.brush_auto_mask, "pressure": pressure, "continue": !first}),
);
// only a stroke that reached the photo is live: else the release would replace the mask's
// previous stroke instead of adding this one
if sent.is_ok() {
if let Some(Gesture::Brush { live, .. }) = &mut app.gesture {
*live = Some((now, pts.len()));
}
} else if first {
let _ = app.run("develop.endInteraction", json!({}));
}
ui.ctx().request_repaint_after(std::time::Duration::from_secs_f64(LIVE_STROKE_EVERY));
}
/// How often (seconds) a stroke whose effect shows while painting goes to the photo.
const LIVE_STROKE_EVERY: f64 = 0.12;
/// Whether the stroke of `len` points should go to the photo now: the first time once it has two
/// points, then every [`LIVE_STROKE_EVERY`] when it grew.
fn live_due(live: Option<(f64, usize)>, len: usize, now: f64) -> bool {
match live {
None => len >= 2,
Some((at, sent)) => len > sent && (now - at >= LIVE_STROKE_EVERY || now < at || now.is_nan()),
}
}
+33 -5
View File
@@ -196,9 +196,12 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
ui.horizontal(|ui| {
ui.label(egui::RichText::new(crate::i18n::tr("Masks")).font(t.semibold(13.0)).color(t.text_label));
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
// lit while the overlay is on to stay; a click does what O does
let on = app.ui.mask_overlay;
if icon_button(ui, "maskOverlay", Icon::Eye, vec2(24.0, 24.0), on, true, "Show overlay (O)").clicked() {
app.ui.mask_overlay = !on;
if icon_button(ui, "maskOverlay", Icon::Eye, vec2(24.0, 24.0), on, true, "Show overlay (O)").clicked()
&& let Err(e) = app.run("view.maskOverlay", json!({}))
{
app.toast(ui.ctx(), e);
}
let all = app.ui.mask_overlay_all;
let all_mac = ui.ctx().os() == egui::os::OperatingSystem::Mac;
@@ -261,6 +264,8 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
register(ui, format!("maskName:{}", m.id), Rect::from_min_size(at, g.size()));
ui.painter().galley(at, g, color);
let resp = if elided { resp.on_hover_text(&m.name) } else { resp };
// the mask's own row (name, eye, menu) is where its effect is judged, the eye switching it
// on and off: the pointer on it shows no overlay (a component row under it does)
// show / hide on hover (and always while hidden)
// (the pointer test, not `hovered`: over the eye, the row itself no longer counts as hovered)
if ui.rect_contains_pointer(r) || !m.visible {
@@ -313,7 +318,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
MaskShape::Prompt { text, .. } => format!("“{text}”"),
_ => menu_label(kind).to_string(),
});
ui.horizontal(|ui| {
let row = ui.horizontal(|ui| {
let (r, _) = ui.allocate_exact_size(vec2(16.0, 16.0), Sense::hover());
paint(ui.painter(), r, icon, t.text_label);
let op = match c.op {
@@ -368,6 +373,10 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
egui::Popup::menu(&more).show(|ui| component_row_menu(app, ui, m.id, i, &label, m.components.len()));
});
});
// the pointer on a component's row shows the whole mask's overlay, to see where it is
if ui.rect_contains_pointer(row.response.rect) {
app.ui.mask_hover = app.session.active().map(|photo| (photo, m.id));
}
range_controls(app, ui, i, &c.shape);
}
ui.add_space(6.0);
@@ -384,7 +393,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
let _ = app.run("mask.invert", json!({}));
}
if icon_button(ui, "maskDelete", Icon::Trash, vec2(26.0, 24.0), false, true, "Delete mask").clicked() {
let _ = app.run("mask.delete", json!({}));
delete_mask(app, None);
}
});
});
@@ -509,7 +518,7 @@ fn mask_menu(app: &mut LightcraftApp, ui: &mut egui::Ui, id: u32, name: &str, vi
ui.close();
}
if ui.button(crate::i18n::tr("Delete Mask")).clicked() {
let _ = app.run("mask.delete", json!({"id": id}));
delete_mask(app, Some(id));
ui.close();
}
}
@@ -986,6 +995,25 @@ fn brush_settings(app: &mut LightcraftApp, ui: &mut egui::Ui) {
}
}
/// Deletes mask `id` of the active photo (`None`: the active mask). A deleted mask's id is free for the next new
/// one, so whether O hid its overlay goes with it.
pub(crate) fn delete_mask(app: &mut LightcraftApp, id: Option<u32>) {
let (photo, target) = (app.session.active(), id.or(app.session.active_mask));
let params = id.map_or_else(|| json!({}), |id| json!({"id": id}));
if app.run("mask.delete", params).is_ok()
&& let (Some(photo), Some(target)) = (photo, target)
{
app.ui.mask_overlay_hidden.retain(|k| *k != (photo, target));
}
}
/// Forgets that O hid the overlay of a mask that no longer exists (undone, stepped back in the history, replaced by
/// pasted settings): its id goes to the next new mask, which must not start hidden.
pub(crate) fn forget_missing_overlays(app: &mut LightcraftApp) {
let session = &app.session;
app.ui.mask_overlay_hidden.retain(|(photo, id)| session.develop_of(*photo).is_some_and(|d| d.masks.iter().any(|m| m.id == *id)));
}
/// The ∩ in front of an intersecting mask component: two legs joined by a half circle, as tall as
/// a lowercase letter.
fn intersect_mark(painter: &egui::Painter, rect: Rect, color: egui::Color32) {
+1 -1
View File
@@ -705,7 +705,7 @@ fn delete_key(app: &mut LightcraftApp, ctx: &egui::Context) -> bool {
match app.ui.right {
R::Masking => {
if app.session.active_mask.is_some() {
let _ = app.run("mask.delete", json!({}));
crate::panels::masking::delete_mask(app, None);
}
return true;
}
+20 -3
View File
@@ -107,9 +107,23 @@ pub struct UiState {
#[serde(skip)]
pub proof_intent: lightcraft_engine::proof::ProofIntent,
pub proof_paper_ink: bool,
/// Masking: show the selected mask as a rendered overlay (O), how (`MaskView` name, ⇧O cycles),
/// in which colour and opacity (0..100, colour views), and whether pins are drawn.
/// Masking: the selected mask's overlay switched on to stay (O, the panel's eye: "Always"),
/// how it is drawn (`MaskView` name, ⇧O cycles), in which colour and opacity (0..100, colour
/// views), and whether pins are drawn. Without it the overlay shows only by the one rule of
/// [`crate::panels::detail::overlay_mask`]: a mask without settings yet, or the mask whose pin
/// or component row the pointer is on. Not kept between sessions: the photo opens without it.
#[serde(skip)]
pub mask_overlay: bool,
/// The mask whose pin or component row the pointer is on, this frame and the last (the overlay
/// shows it), with the photo it is on: a mask of the same id on another photo is another mask.
/// Not the mask's own row: there its effect is judged.
#[serde(skip)]
pub mask_hover: Option<(lightcraft_engine::catalog::PhotoId, u32)>,
#[serde(skip)]
pub mask_hover_prev: Option<(lightcraft_engine::catalog::PhotoId, u32)>,
/// The masks (of their photos) whose automatic overlay O hid, each until O shows it again.
#[serde(skip)]
pub mask_overlay_hidden: Vec<(lightcraft_engine::catalog::PhotoId, u32)>,
pub mask_overlay_mode: String,
pub mask_overlay_color: [u8; 3],
pub mask_overlay_opacity: f32,
@@ -554,7 +568,10 @@ impl Default for UiState {
proof_profile: None,
proof_intent: lightcraft_engine::proof::ProofIntent::Perceptual,
proof_paper_ink: false,
mask_overlay: true,
mask_overlay: false,
mask_hover: None,
mask_hover_prev: None,
mask_overlay_hidden: Vec::new(),
mask_overlay_mode: "color".into(),
mask_overlay_color: [230, 30, 40],
mask_overlay_opacity: 50.0,
+1
View File
@@ -36,6 +36,7 @@ mod dialog_copy;
mod dialog_fit;
mod dialog_primary;
mod dialog_settings;
mod dialog_settings_filter;
mod dialog_settings_text;
mod dialog_tab;
mod dialogs;
@@ -0,0 +1,379 @@
//! Settings has a filter: typing in it lists the sections, on whatever tab, whose words match, and
//! choosing one opens its tab at that section.
//!
//! Before, finding a setting meant knowing or guessing its tab: eight of them, each read through.
use std::time::Duration;
use serde_json::json;
use crate::headless::Headless;
use crate::state::Dialog;
use crate::{LightcraftApp, Services};
const T: Duration = Duration::from_secs(20);
fn demo(size: [f32; 2]) -> Headless {
let mut h = Headless::new(LightcraftApp::new(lightcraft_engine::Session::with_demo(), Services::default()), size, 1.0);
// let the first renders finish (a render still running at exit can crash in GPU teardown)
h.settle(T);
h
}
fn steps(h: &mut Headless) {
for _ in 0..4 {
h.step();
}
}
fn show(h: &mut Headless, tab: &str) {
let r = h.request("engine.execute", json!({"command": "app.settings", "params": {"tab": tab}}), T);
assert_eq!(r["ok"], true, "app.settings {tab}: {r}");
h.settle(T);
steps(h);
}
fn click(h: &mut Headless, id: &str) {
let r = h.request("ui.clickWidget", json!({"id": id}), T);
assert_eq!(r["ok"], true, "click {id}: {r}");
steps(h);
}
fn key(h: &mut Headless, key: &str) {
assert_eq!(h.request("ui.key", json!({"key": key}), T)["ok"], true, "{key}");
steps(h);
}
/// Given the filter with `text` typed into it.
fn filter(h: &mut Headless, text: &str) {
click(h, "field:settingsFilter");
h.request("ui.key", json!({"key": "A", "cmd": true}), T);
h.request("ui.text", json!({"text": text}), T);
steps(h);
}
fn rect(h: &Headless, id: &str) -> Option<egui::Rect> {
h.app.widgets.iter().find(|(w, _)| w == id).map(|(_, r)| *r)
}
/// What the filter lists, top to bottom: `tab:section` of each result (`settingsFound:{tab}:{section}`).
fn found(h: &Headless) -> Vec<String> {
let mut found: Vec<(f32, String)> =
h.app.widgets.iter().filter_map(|(id, r)| Some((r.top(), id.strip_prefix("settingsFound:")?.to_string()))).collect();
found.sort_by(|a, b| a.0.total_cmp(&b.0));
found.into_iter().map(|(_, id)| id).collect()
}
fn headings(h: &Headless) -> Vec<String> {
h.app.widgets.iter().filter_map(|(id, _)| Some(id.strip_prefix("heading:")?.to_string())).collect()
}
/// Whether the keyboard focus is on something other than the filter box.
fn on_a_result(h: &Headless) -> bool {
h.view.ctx.memory(|m| m.focused()).is_some_and(|id| id != crate::text_field::id("field:settingsFilter"))
}
fn says(h: &Headless, part: &str) -> bool {
h.painted_text().iter().any(|text| text.contains(part))
}
#[test]
fn typing_lists_the_sections_that_match_on_whatever_tab() {
let mut h = demo([1200.0, 1000.0]);
// Given Settings open on General, which has nothing about sidecars (they are on Import)
show(&mut h, "general");
// When "sidecar names" is typed into the filter
filter(&mut h, "sidecar names");
// Then the section about them is listed with the tab it is on, and the page of General is not shown
assert_eq!(found(&h), ["import:XMP sidecars"]);
assert!(says(&h, "Import") && says(&h, "XMP sidecars"));
assert!(headings(&h).is_empty(), "the tab's own page gives way to what was found: {:?}", headings(&h));
// And the tab that was open is still the one open
assert_eq!(h.app.ui.dialog, Some(Dialog::Settings { tab: "general".into() }));
}
#[test]
fn a_word_from_a_row_a_hint_or_a_button_finds_its_section() {
let mut h = demo([1200.0, 1000.0]);
show(&mut h, "general");
// (a row's label)
filter(&mut h, "Forget unchanged");
assert_eq!(found(&h), ["performance:Local folders"]);
// (a button)
filter(&mut h, "Clear Cache");
assert_eq!(found(&h), ["performance:Preview cache"]);
// (a hint, in other letter case)
filter(&mut h, "CHOOSES THE LINES");
assert_eq!(found(&h), ["interface:Detail View"]);
// (a tab's own name finds everything on it)
filter(&mut h, "Interface");
let on_the_tab = found(&h);
assert!(on_the_tab.len() >= 4 && on_the_tab.iter().all(|id| id.starts_with("interface:")), "{on_the_tab:?}");
assert!(on_the_tab.contains(&"interface:Filmstrip".to_string()), "a section that does not say the word itself: {on_the_tab:?}");
}
#[test]
fn every_word_typed_has_to_be_there() {
let mut h = demo([1200.0, 1000.0]);
show(&mut h, "general");
filter(&mut h, "cache");
let cache = found(&h);
assert!(cache.len() > 1 && cache.contains(&"performance:Preview cache".to_string()), "{cache:?}");
// When a second word narrows it
filter(&mut h, "cache disk");
assert_eq!(found(&h), ["performance:Preview cache"]);
// And the words can come in any order
filter(&mut h, "disk cache");
assert_eq!(found(&h), ["performance:Preview cache"]);
}
#[test]
fn nothing_found_says_so() {
let mut h = demo([1200.0, 1000.0]);
show(&mut h, "general");
filter(&mut h, "zebra crossing");
assert!(found(&h).is_empty());
assert!(says(&h, "No setting matches"), "{:?}", h.painted_text().iter().filter(|t| t.contains("match")).collect::<Vec<_>>());
assert!(headings(&h).is_empty());
}
/// Reading every page for the filter shows nothing of it, so it must not start the slide preview's render (the Slideshow
/// page asks for it when it is open, which a filter on another tab is not).
#[test]
fn typing_in_the_filter_starts_no_slide_preview_render() {
let mut h = demo([1200.0, 1000.0]);
show(&mut h, "general");
assert!(h.app.session.active().is_some(), "a photo is active, so the preview would have one to render");
assert_eq!(h.app.renderer.wanted(crate::render::Slot::SlidePreview), None, "none before");
filter(&mut h, "sidecar names");
assert_eq!(found(&h), ["import:XMP sidecars"]);
h.settle(T);
assert_eq!(h.app.renderer.wanted(crate::render::Slot::SlidePreview), None, "the filter asked for no render of the slide preview");
}
#[test]
fn choosing_a_result_opens_its_tab_at_that_section() {
// (a window short enough that Detail View, near the foot of Interface, is below the fold)
let mut h = demo([900.0, 560.0]);
// Given Detail View below the fold of Interface
show(&mut h, "interface");
let (detail, room) = (rect(&h, "heading:Detail View").unwrap(), rect(&h, "settings:pageRoom").unwrap());
assert!(detail.bottom() > room.bottom(), "Detail View {detail:?} starts out of view in {room:?}");
show(&mut h, "general");
filter(&mut h, "info overlay");
assert_eq!(found(&h), ["interface:Detail View"]);
// When the result is clicked
click(&mut h, "settingsFound:interface:Detail View");
h.settle(T);
steps(&mut h);
// Then its tab is open, the filter is empty again, and the section is in view
assert_eq!(h.app.ui.dialog, Some(Dialog::Settings { tab: "interface".into() }));
assert!(found(&h).is_empty() && !says(&h, "info overlay"), "the filter is cleared");
let (detail, room) = (rect(&h, "heading:Detail View").unwrap(), rect(&h, "settings:pageRoom").unwrap());
assert!(detail.top() >= room.top() - 0.5 && detail.bottom() <= room.bottom() + 0.5, "Detail View {detail:?} is in view in {room:?}");
}
#[test]
fn choosing_what_starts_a_tab_shows_the_top_of_its_page() {
let mut h = demo([900.0, 560.0]);
// Given General scrolled down, so that its first heading is out of view
show(&mut h, "general");
let room = rect(&h, "settings:pageRoom").unwrap();
h.request("ui.move", json!({"x": room.center().x, "y": room.center().y}), T);
h.request("ui.scroll", json!({"dy": -300.0}), T);
for _ in 0..60 {
h.step();
}
assert!(rect(&h, "heading:Library").unwrap().top() < room.top(), "General is scrolled down");
// When what is above its first heading (the language) is found and chosen
filter(&mut h, "language");
assert!(found(&h).contains(&"general:".to_string()), "{:?}", found(&h));
click(&mut h, "settingsFound:general:");
h.settle(T);
for _ in 0..60 {
h.step();
}
// Then the page is at its top again
assert!(rect(&h, "heading:Library").unwrap().top() >= room.top() - 0.5, "the top of General is in view");
}
#[test]
fn return_opens_the_first_result() {
let mut h = demo([1200.0, 1000.0]);
show(&mut h, "general");
filter(&mut h, "sidecar names");
key(&mut h, "Enter");
h.settle(T);
steps(&mut h);
assert_eq!(h.app.ui.dialog, Some(Dialog::Settings { tab: "import".into() }));
assert!(headings(&h).contains(&"XMP sidecars".to_string()));
assert!(found(&h).is_empty());
}
#[test]
fn esc_empties_the_filter_and_a_second_esc_closes_settings() {
let mut h = demo([1200.0, 1000.0]);
show(&mut h, "import");
filter(&mut h, "sidecar names");
assert_eq!(found(&h).len(), 1);
// When Esc is pressed
key(&mut h, "Escape");
// Then the filter is empty, the tab that was open shows its page again, and Settings is open
assert!(found(&h).is_empty());
assert_eq!(h.app.ui.dialog, Some(Dialog::Settings { tab: "import".into() }));
assert!(headings(&h).contains(&"Raw defaults".to_string()));
// And a second Esc closes Settings
key(&mut h, "Escape");
assert!(h.app.ui.dialog.is_none());
}
#[test]
fn opening_a_tab_empties_the_filter() {
let mut h = demo([1200.0, 1000.0]);
show(&mut h, "general");
filter(&mut h, "sidecar names");
click(&mut h, "button:settingsTab-performance");
assert_eq!(h.app.ui.dialog, Some(Dialog::Settings { tab: "performance".into() }));
assert!(found(&h).is_empty());
assert!(headings(&h).contains(&"Rendering".to_string()), "Performance shows its page");
}
#[test]
fn looking_through_the_tabs_changes_nothing_and_leaves_no_double_names() {
let mut h = demo([1200.0, 1000.0]);
show(&mut h, "general");
// (what Settings sets: the app's own settings, the language, and what is saved with the library)
let state = |h: &mut Headless| {
(
serde_json::to_value(&h.app.ui.settings).unwrap(),
h.app.ui.language,
h.app.ui.auto_advance,
h.app.run("library.preferences", json!({})).unwrap(),
h.app.run("library.xmpPreferences", json!({})).unwrap(),
h.app.ui.dialog.clone(),
)
};
let before = state(&mut h);
h.app.ui.toast = None;
filter(&mut h, "cache");
// Then nothing changed by being looked through, and nothing was said
assert_eq!(state(&mut h), before);
assert!(h.app.ui.toast.is_none(), "{:?}", h.app.ui.toast);
// And no control of a tab that is not shown is among the widgets scripts can click
let mut ids: Vec<&String> = h.app.widgets.iter().map(|(id, _)| id).collect();
assert!(!ids.iter().any(|id| id.as_str() == "button:settingsClearCache"), "a tab looked through off screen leaves no widgets behind");
let all = ids.len();
ids.sort();
ids.dedup();
assert_eq!(ids.len(), all, "no widget is named twice");
}
#[test]
fn the_filter_is_empty_when_settings_is_opened_again() {
let mut h = demo([1200.0, 1000.0]);
show(&mut h, "general");
filter(&mut h, "sidecar names");
// (Esc once empties it; here Settings is closed from outside with the filter still set)
h.app.ui.dialog = None;
steps(&mut h);
show(&mut h, "general");
assert!(found(&h).is_empty() && !says(&h, "sidecar names"));
assert!(headings(&h).contains(&"Startup".to_string()));
}
#[test]
fn what_a_page_shows_now_is_what_is_found() {
let mut h = demo([1200.0, 1000.0]);
show(&mut h, "import");
// Given a sentence Import only shows with camera-specific defaults on, looked for and not found
filter(&mut h, "cameras appear");
assert!(found(&h).is_empty());
key(&mut h, "Escape");
// When that is turned on, with Settings still open
click(&mut h, "check:settings.perCamera");
assert!(says(&h, "cameras appear"), "the page shows the sentence now");
// Then looking for it again finds it: the pages are read afresh each time the filter is used
filter(&mut h, "cameras appear");
assert_eq!(found(&h), ["import:Raw defaults"]);
}
#[test]
fn the_arrow_goes_from_the_filter_to_what_was_found_and_return_opens_it() {
let mut h = demo([1200.0, 1000.0]);
show(&mut h, "general");
filter(&mut h, "cache disk");
assert_eq!(found(&h), ["performance:Preview cache"]);
// When ↓ is pressed in the filter (the focus goes to the first result), then Return
key(&mut h, "ArrowDown");
assert!(on_a_result(&h), "↓ leaves the filter for what was found");
key(&mut h, "Enter");
h.settle(T);
steps(&mut h);
// Then the section found is open
assert_eq!(h.app.ui.dialog, Some(Dialog::Settings { tab: "performance".into() }));
assert!(found(&h).is_empty());
}
#[test]
fn esc_on_a_result_empties_the_filter_and_leaves_settings_open() {
let mut h = demo([1200.0, 1000.0]);
show(&mut h, "import");
filter(&mut h, "cache");
assert!(!found(&h).is_empty());
// Given the focus on a result, not in the filter
key(&mut h, "ArrowDown");
assert!(on_a_result(&h));
// When Esc is pressed
key(&mut h, "Escape");
// Then the filter is emptied and Settings is still open on the tab it was on
assert_eq!(h.app.ui.dialog, Some(Dialog::Settings { tab: "import".into() }));
assert!(found(&h).is_empty() && headings(&h).contains(&"Raw defaults".to_string()));
// And the next Esc closes Settings
key(&mut h, "Escape");
assert!(h.app.ui.dialog.is_none());
}
/// A section's heading goes in by its English name and is translated once: View Options' General
/// heading used to be passed already translated, so in another language it was translated again
/// and registered under the translated name, where the filter and scripts look for the English one.
#[test]
fn the_general_heading_of_view_options_is_translated_once_and_registered_by_its_english_name() {
use crate::i18n::Locale;
struct Restore(Locale);
impl Drop for Restore {
fn drop(&mut self) {
crate::i18n::set_language(self.0);
}
}
let _restore = Restore(crate::i18n::language());
let mut h = demo([1000.0, 800.0]);
h.app.ui.language = Locale::De;
crate::i18n::set_language(Locale::De);
h.app.ui.dialog = Some(Dialog::ViewOptions);
steps(&mut h);
let shown = Locale::De.tr("General");
assert_ne!(shown, "General", "the German catalog translates the heading");
let headings: Vec<&str> = h.app.widgets.iter().filter_map(|(id, _)| id.strip_prefix("heading:")).collect();
assert!(headings.contains(&"General"), "registered by its English name: {headings:?}");
assert!(!headings.contains(&shown), "not by the translated one: {headings:?}");
assert!(h.painted_text().iter().any(|text| text == shown), "and drawn translated: {shown}");
}
/// The Display page reads the profile in use, so the sections read for the filter are read again
/// when it changes (the window moved to another screen), with the filter still set.
#[test]
fn a_changed_display_profile_is_read_again_while_the_filter_has_text() {
let mut h = demo([1200.0, 1000.0]);
show(&mut h, "general");
// Given the page's sentence about no profile, found
filter(&mut h, "treated as sRGB");
assert!(!found(&h).is_empty(), "no display profile: the page says so");
// When a profile is in use from now on, the filter still holding its text
let p3 =
lightcraft_engine::display::Display::from_bytes("p3.icc", &lightcraft_codecs::icc::write_named(lightcraft_codecs::NamedSpace::DisplayP3))
.unwrap();
h.app.renderer.set_display(Some(std::sync::Arc::new(p3)));
steps(&mut h);
// Then the old sentence is not found any more
assert!(found(&h).is_empty(), "the sections were read for the old profile: {:?}", found(&h));
}
+60
View File
@@ -150,6 +150,66 @@ fn a_click_outside_an_open_dropdown_keeps_the_dialog() {
assert!(h.app.ui.dialog.is_some(), "but not the dialog");
}
#[test]
fn export_subfolder_variable_dropdown() {
let mut h = demo([1400.0, 1000.0], json!({"view": "detail", "right": "edit"}));
h.app.run("dialog.export", json!({})).unwrap();
h.step();
h.step();
let r = h.request("ui.clickWidget", json!({"id": "combo:exportSubfolderTags"}), T);
assert_eq!(r["ok"], true, "{r}");
h.step();
assert!(egui::Popup::is_any_open(&h.view.ctx), "the subfolder tags dropdown is open");
// Inspect AccessKit nodes to verify ComboBox role and localized accessible name
let ctx = egui::Context::default();
crate::theme::install_fonts(&ctx);
ctx.enable_accesskit();
let raw = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(800.0, 600.0))), ..Default::default() };
let mut out = ctx.run_ui(raw, |ui| {
let c = crate::widgets::combo_box("exportSubfolderTags").width(90.0).selected_text(crate::i18n::tr("Insert…")).show_ui(ui, |_| {});
crate::widgets::name_combo(&c.response, crate::i18n::tr("Insert variable"));
});
out.textures_delta.clear();
let update = out.platform_output.accesskit_update.expect("AccessKit update produced");
let has_combo = update.nodes.iter().any(|(_, n)| format!("{:?}", n.role()) == "ComboBox" && n.label().unwrap_or_default() == "Insert variable");
assert!(has_combo, "ComboBox has localized accessible name 'Insert variable'");
// Test text insertion and cursor behavior for subfolder field
let subfolder_id = crate::text_field::id("field:exportSubfolder");
let mut text = String::from("prefix_suffix");
// Place cursor at index 7 (after "prefix_")
let mut state = egui::text_edit::TextEditState::default();
state.cursor.set_char_range(Some(egui::text::CCursorRange::one(egui::text::CCursor::new(7))));
state.store(&h.view.ctx, subfolder_id);
// Insert {date} at non-terminal cursor
crate::import::insert_at_cursor(&h.view.ctx, subfolder_id, &mut text, "{date}");
assert_eq!(text, "prefix_{date}suffix");
let loaded = egui::text_edit::TextEditState::load(&h.view.ctx, subfolder_id).unwrap();
assert_eq!(loaded.cursor.char_range().unwrap().primary.index.0, 7 + "{date}".chars().count());
// Replace selected range with {album}
let mut state = egui::text_edit::TextEditState::default();
state
.cursor
.set_char_range(Some(egui::text::CCursorRange::two(egui::text::CCursor::new(7), egui::text::CCursor::new(7 + "{date}".chars().count()))));
state.store(&h.view.ctx, subfolder_id);
crate::import::insert_at_cursor(&h.view.ctx, subfolder_id, &mut text, "{album}");
assert_eq!(text, "prefix_{album}suffix");
let loaded = egui::text_edit::TextEditState::load(&h.view.ctx, subfolder_id).unwrap();
assert_eq!(loaded.cursor.char_range().unwrap().primary.index.0, 7 + "{album}".chars().count());
// Replace selection with {hour}
let mut state = egui::text_edit::TextEditState::default();
state
.cursor
.set_char_range(Some(egui::text::CCursorRange::two(egui::text::CCursor::new(7), egui::text::CCursor::new(7 + "{album}".chars().count()))));
state.store(&h.view.ctx, subfolder_id);
crate::import::insert_at_cursor(&h.view.ctx, subfolder_id, &mut text, "{hour}");
assert_eq!(text, "prefix_{hour}suffix");
}
#[test]
fn modal_dialogs_close_background_menus() {
let mut h = demo([1400.0, 1000.0], json!({"view": "detail", "right": "edit"}));
+491 -24
View File
@@ -119,7 +119,9 @@ fn new_brush_starts_a_separate_mask_in_paint_mode() {
click(&mut h, "maskNew:brush");
assert_eq!(h.app.session.active_mask, Some(2));
assert!(!h.app.ui.brush_erase);
assert!(h.app.ui.mask_overlay);
// a new mask has no settings: its overlay shows by itself (O stays as it was)
assert!(!h.app.ui.mask_overlay);
assert_eq!(crate::panels::detail::overlay_mask(&h.app, &develop(&h)).map(|m| m.id), Some(2));
let r = h.request("ui.set", json!({"brushSize": 0.15, "brushFeather": 0.0, "brushFlow": 100.0}), T);
assert_eq!(r["ok"], true, "{r}");
brush_at(&mut h, 0.5, 0.5);
@@ -138,11 +140,14 @@ fn mask_adjustments_hide_overlay_without_disabling_the_mask() {
use lightcraft_pipeline::Overlay;
let mut h = detail("panel.masking");
exec(&mut h, "mask.add", json!({"kind": "linear", "start": [0.5, 0.2], "end": [0.5, 0.7]}));
assert!(h.app.ui.mask_overlay);
let shown = |h: &Headless| matches!(crate::panels::detail::view_overlay(&h.app, &develop(h)), Overlay::Mask { .. });
// a mask without settings shows what it selects, by itself (O is off)
assert!(!h.app.ui.mask_overlay);
assert!(shown(&h), "a new mask shows its overlay");
// Changing the shape needs the overlay; changing the image needs an unobscured preview.
exec(&mut h, "mask.refine", json!({"value": 10.0}));
assert!(h.app.ui.mask_overlay);
assert!(shown(&h), "Refine Edges is the mask's shape, not a setting");
// The dock header pushes this adjustment below the initial viewport. Exercise the
// actual visible slider rather than sending a synthetic click outside its clipped body.
let panel = h.app.widgets.iter().find(|(id, _)| id == "panel:right_panel").unwrap().1;
@@ -155,21 +160,28 @@ fn mask_adjustments_hide_overlay_without_disabling_the_mask() {
assert!(panel.contains_rect(slider), "exposure is visible before clicking: {slider:?} in {panel:?}");
let r = h.request("ui.clickWidget", json!({"id": "slider:exposure", "fx": 0.7}), T);
assert_eq!(r["ok"], true, "{r}");
assert!(!h.app.ui.mask_overlay, "the exposure slider hides the overlay after release");
let d = develop(&h);
assert!(d.masks[0].adjust.exposure > 0.0);
assert!(d.masks[0].visible, "hiding the overlay must not disable the mask");
assert_eq!(crate::panels::detail::view_overlay(&h.app, &d), Overlay::None);
// the pointer is off the row and the pin: a mask with settings shows its effect, not the overlay
h.app.ui.mask_hover = None;
h.app.ui.mask_hover_prev = None;
assert_eq!(crate::panels::detail::view_overlay(&h.app, &d), Overlay::None, "a mask with settings never shows by itself");
let mask = d.masks[0].clone();
let r = h.request("ui.key", json!({"key": "o"}), T);
assert_eq!(r["ok"], true, "{r}");
assert!(h.app.ui.mask_overlay, "O can restore the overlay");
assert!(h.app.ui.mask_overlay, "O shows the overlay on request");
assert_eq!(develop(&h).masks[0], mask, "toggling the overlay leaves the mask and its effect unchanged");
assert!(matches!(crate::panels::detail::view_overlay(&h.app, &develop(&h)), Overlay::Mask { .. }));
assert!(shown(&h));
// a slider at work hides even an overlay switched on with O; it comes back when let go
h.app.ui.dragging_control = Some("exposure".into());
assert_eq!(crate::panels::detail::view_overlay(&h.app, &develop(&h)), Overlay::None, "nothing shows while a slider is at work");
h.app.ui.dragging_control = None;
assert!(shown(&h));
// Ctrl+Shift+O / Cmd+Shift+O shows every visible mask's region at once (the new command), ahead of the selected
// mask overlay so it is not shadowed by the always-on single-mask overlay.
// mask overlay so it is not shadowed by the single-mask overlay.
exec(&mut h, "view.maskOverlayAll", json!({}));
assert!(h.app.ui.mask_overlay_all, "the all-masks overlay command turns it on");
assert!(matches!(crate::panels::detail::view_overlay(&h.app, &develop(&h)), Overlay::AllMasks { .. }));
@@ -177,49 +189,190 @@ fn mask_adjustments_hide_overlay_without_disabling_the_mask() {
assert!(!h.app.ui.mask_overlay_all, "the all-masks overlay command toggles it off");
assert!(!matches!(crate::panels::detail::view_overlay(&h.app, &develop(&h)), Overlay::AllMasks { .. }));
// Failed edits and global adjustments must not hide the mask overlay.
// O stays on through edits: failed ones, global adjustments and the mask's own values
assert!(h.app.run("mask.adjust", json!({"id": 999, "values": {"exposure": 1.0}})).is_err());
assert!(h.app.ui.mask_overlay);
exec(&mut h, "develop.set", json!({"control": "light.exposure", "value": 0.5}));
assert!(h.app.ui.mask_overlay);
// Numeric edits/resets and Amount use the same command path as the sliders.
for values in [json!({"exposure": 0.0}), json!({"saturation": 20.0}), json!({"amount": 50.0})] {
exec(&mut h, "view.maskOverlay", json!({"show": true}));
exec(&mut h, "mask.adjust", json!({"values": values}));
assert!(!h.app.ui.mask_overlay);
assert!(h.app.ui.mask_overlay && shown(&h), "{values}");
}
h.settle(SETTLE);
}
/// A slider hides the overlay (above); a new mask, an added part, a duplicate or picking a mask in
/// the list shows it again, so the Overlay menu's mode is what the photo shows (issue #1800).
/// One overlay rule replaces showing the overlay again on every new, picked, duplicated or extended
/// mask (issue #1800): a mask without settings shows what it selects by itself; picking a mask that
/// has settings, adding a part to it or duplicating it shows its effect, so it can be judged; the
/// pointer on one of its component rows (or its pin), or O, shows its overlay on request.
#[test]
fn a_new_or_picked_mask_shows_the_overlay_hidden_by_a_slider() {
fn a_mask_shows_its_overlay_by_itself_only_without_settings() {
use lightcraft_pipeline::Overlay;
let mut h = detail("panel.masking");
exec(&mut h, "mask.add", json!({"kind": "linear", "start": [0.5, 0.2], "end": [0.5, 0.7]}));
let first = h.app.session.active_mask.unwrap();
let hide = |h: &mut Headless| {
exec(h, "mask.adjust", json!({"values": {"exposure": 0.5}}));
assert!(!h.app.ui.mask_overlay);
let off_rows = |h: &mut Headless| {
h.app.ui.mask_hover = None;
h.app.ui.mask_hover_prev = None;
};
let shown = |h: &Headless| matches!(crate::panels::detail::view_overlay(&h.app, &develop(h)), Overlay::Mask { .. });
hide(&mut h);
assert!(shown(&h), "a new mask without settings shows its overlay");
exec(&mut h, "mask.adjust", json!({"values": {"exposure": 0.5}}));
off_rows(&mut h);
assert!(!shown(&h), "with settings it shows its effect");
exec(&mut h, "mask.add", json!({"kind": "radial", "center": [0.4, 0.5], "rx": 0.2, "ry": 0.2}));
off_rows(&mut h);
assert!(shown(&h), "a new mask shows its overlay");
hide(&mut h);
let r = h.request("ui.clickWidget", json!({"id": format!("mask:{first}")}), T);
assert_eq!(r["ok"], true, "{r}");
assert_eq!(h.app.session.active_mask, Some(first));
assert!(shown(&h), "picking a mask in the list shows its overlay");
off_rows(&mut h);
assert!(!shown(&h), "picking a mask with settings shows its effect, not the overlay");
for (cmd, params) in
[("mask.addComponent", json!({"kind": "radial", "op": "add", "center": [0.6, 0.5], "rx": 0.1, "ry": 0.1})), ("mask.duplicate", json!({}))]
{
hide(&mut h);
exec(&mut h, cmd, params);
assert!(shown(&h), "{cmd} shows the overlay");
off_rows(&mut h);
assert!(!shown(&h), "{cmd} on a mask with settings shows its effect");
}
// on request: the pointer on one of its component rows (or its pin), or O
h.app.ui.mask_hover = h.app.session.active().zip(h.app.session.active_mask);
assert!(shown(&h), "the pointer on a component row shows the overlay");
off_rows(&mut h);
h.request("ui.key", json!({"key": "o"}), T);
assert!(shown(&h), "O shows it");
h.settle(SETTLE);
}
/// O hides a mask's automatic overlay until O shows it again: hiding another mask's doesn't bring
/// the first one's back.
#[test]
fn each_mask_hidden_with_o_stays_hidden() {
use lightcraft_pipeline::Overlay;
let mut h = detail("panel.masking");
let shown = |h: &Headless| matches!(crate::panels::detail::view_overlay(&h.app, &develop(h)), Overlay::Mask { .. });
exec(&mut h, "mask.add", json!({"kind": "linear", "start": [0.5, 0.2], "end": [0.5, 0.7]}));
let a = h.app.session.active_mask.unwrap();
h.request("ui.key", json!({"key": "o"}), T);
assert!(!shown(&h), "A hidden");
exec(&mut h, "mask.add", json!({"kind": "radial", "center": [0.4, 0.5], "rx": 0.2, "ry": 0.2}));
h.app.ui.mask_hover = None;
h.app.ui.mask_hover_prev = None;
assert!(shown(&h), "B, new, shows");
h.request("ui.key", json!({"key": "o"}), T);
assert!(!shown(&h), "B hidden");
exec(&mut h, "mask.select", json!({"id": a}));
h.app.ui.mask_hover = None;
h.app.ui.mask_hover_prev = None;
assert!(!shown(&h), "A is still hidden");
h.request("ui.key", json!({"key": "o"}), T);
assert!(shown(&h), "O shows A again");
h.settle(SETTLE);
}
/// Which hover shows a mask's overlay (the user's test notes, 31 Oct): the mask's own row (name, eye, menu)
/// shows none, so its eye can judge the effect with nothing over the photo; a component row under it shows the
/// whole mask's overlay; the pin shows it; a mask without settings keeps its overlay, also over its own row; O still
/// shows and hides it; dragging the pin hides it while it moves.
#[test]
fn the_mask_row_shows_no_overlay_and_a_component_row_does() {
use lightcraft_pipeline::Overlay;
let mut h = detail("panel.masking");
let steps = |h: &mut Headless| {
h.step();
h.step();
};
let ask = |h: &mut Headless, method: &str, params: serde_json::Value| {
let r = h.request(method, params.clone(), T);
assert_eq!(r["ok"], true, "{method} {params}: {r}");
};
let shown = |h: &Headless| matches!(crate::panels::detail::view_overlay(&h.app, &develop(h)), Overlay::Mask { .. });
let visible = |h: &Headless, id: u32| develop(h).masks.iter().find(|m| m.id == id).is_some_and(|m| m.visible);
let canvas = h.app.canvas_rect.expect("the loupe");
let away = json!({"x": canvas.left() + 6.0, "y": canvas.top() + 6.0});
// a mask without settings: its overlay stays, whatever is hovered
exec(&mut h, "mask.add", json!({"kind": "radial", "center": [0.5, 0.5]}));
let mid = h.app.session.active_mask.expect("selected");
steps(&mut h);
ask(&mut h, "ui.hoverWidget", json!({"id": format!("mask:{mid}")}));
steps(&mut h);
assert!(shown(&h), "no settings yet: shown, also over its own row");
// with settings: its own row and its eye show nothing; the eye switches the effect
exec(&mut h, "mask.adjust", json!({"values": {"exposure": 1.0}}));
ask(&mut h, "ui.hoverWidget", json!({"id": format!("mask:{mid}")}));
steps(&mut h);
assert!(!shown(&h), "the pointer on the mask's own row shows no overlay");
ask(&mut h, "ui.clickWidget", json!({"id": format!("maskVisible:{mid}")}));
steps(&mut h);
assert!(!visible(&h, mid), "the eye switched the effect off");
assert!(!shown(&h), "with nothing over the photo");
ask(&mut h, "ui.clickWidget", json!({"id": format!("maskVisible:{mid}")}));
steps(&mut h);
assert!(visible(&h, mid) && !shown(&h), "and on again, still with no overlay");
// a component row: the whole mask's overlay
exec(&mut h, "mask.addComponent", json!({"op": "subtract", "kind": "linear", "start": [0.5, 0.0], "end": [0.5, 0.3]}));
steps(&mut h);
for i in 0..2 {
ask(&mut h, "ui.hoverWidget", json!({"id": format!("component:{i}")}));
steps(&mut h);
assert!(shown(&h), "the pointer on component {i} shows the mask's overlay");
assert_eq!(h.app.ui.mask_hover.or(h.app.ui.mask_hover_prev).map(|(_, m)| m), Some(mid), "the whole mask");
}
ask(&mut h, "ui.move", away.clone());
steps(&mut h);
assert!(!shown(&h), "leaving the row hides it");
// the pin
let img = h.app.image_rect.expect("the photo on screen");
ask(&mut h, "ui.move", json!({"x": img.center().x, "y": img.center().y}));
steps(&mut h);
assert!(shown(&h), "the pointer on the pin shows the overlay");
// dragging the pin: hidden while it moves
pointer(&mut h, json!([{"kind": "down", "x": 0.5, "y": 0.5}, {"kind": "drag", "x": 0.53, "y": 0.52}, {"kind": "drag", "x": 0.56, "y": 0.54}]));
steps(&mut h);
assert!(crate::panels::detail::mask_gesture(&h.app), "the pin is being dragged: {:?}", h.app.gesture);
assert!(!shown(&h), "no overlay while the pin is dragged");
pointer(&mut h, json!([{"kind": "up", "x": 0.56, "y": 0.54}]));
steps(&mut h);
ask(&mut h, "ui.move", away);
steps(&mut h);
assert!(!shown(&h));
// O over its own row
ask(&mut h, "ui.hoverWidget", json!({"id": format!("mask:{mid}")}));
exec(&mut h, "view.maskOverlay", json!({"show": true}));
steps(&mut h);
assert!(shown(&h), "O shows it, even over its own row");
exec(&mut h, "view.maskOverlay", json!({"show": false}));
steps(&mut h);
assert!(!shown(&h), "and hides it");
}
/// The pointer on a mask's row, and O hiding a mask's automatic overlay, belong to that photo: on
/// another photo a mask with the same id is another mask.
#[test]
fn a_mask_hovered_or_hidden_on_one_photo_says_nothing_about_another() {
use lightcraft_pipeline::Overlay;
let mut h = detail("panel.masking");
let first = h.app.session.active().unwrap();
exec(&mut h, "mask.add", json!({"kind": "linear", "start": [0.5, 0.2], "end": [0.5, 0.7]}));
let mask = h.app.session.active_mask.unwrap();
let shown = |h: &Headless| matches!(crate::panels::detail::view_overlay(&h.app, &develop(h)), Overlay::Mask { .. });
// O hides the fresh mask's overlay on this photo
h.request("ui.key", json!({"key": "o"}), T);
assert!(!shown(&h));
assert_eq!(h.app.ui.mask_overlay_hidden, vec![(first, mask)]);
// another photo with a fresh mask of the same id still shows it
let other = h.app.session.visible_cloned().into_iter().find(|p| *p != first).unwrap();
exec(&mut h, "library.select", json!({"ids": [other.0]}));
exec(&mut h, "mask.add", json!({"kind": "linear", "start": [0.5, 0.2], "end": [0.5, 0.7]}));
assert_eq!(h.app.session.active(), Some(other));
assert_eq!(h.app.session.active_mask, Some(mask), "the same id on the other photo");
h.app.ui.mask_hover = None;
h.app.ui.mask_hover_prev = None;
assert!(shown(&h), "hidden on the first photo only");
// a hover left over from the first photo doesn't count here
exec(&mut h, "mask.adjust", json!({"values": {"exposure": 0.5}}));
h.app.ui.mask_hover_prev = Some((first, mask));
assert!(!shown(&h), "the first photo's hover is not this photo's");
h.settle(SETTLE);
}
@@ -2156,6 +2309,320 @@ fn effect_dropdown_applies_saves_and_shows_the_matching_effect() {
assert_eq!(exec(&mut h, "mask.effects", json!({}))["current"], "Lift");
}
/// A mask O hid stays hidden after O shows another mask: selecting it again doesn't bring it back.
#[test]
fn a_mask_hidden_with_o_stays_hidden_after_o_shows_another() {
use lightcraft_pipeline::Overlay;
let mut h = detail("panel.masking");
let shown = |h: &Headless| matches!(crate::panels::detail::view_overlay(&h.app, &develop(h)), Overlay::Mask { .. });
exec(&mut h, "mask.add", json!({"kind": "linear", "start": [0.5, 0.2], "end": [0.5, 0.7]}));
let a = h.app.session.active_mask.unwrap();
h.request("ui.key", json!({"key": "o"}), T);
assert!(!shown(&h), "A hidden");
exec(&mut h, "mask.add", json!({"kind": "radial", "center": [0.4, 0.5], "rx": 0.2, "ry": 0.2}));
exec(&mut h, "mask.adjust", json!({"values": {"exposure": 0.5}}));
h.app.ui.mask_hover = None;
h.app.ui.mask_hover_prev = None;
assert!(!shown(&h), "B has settings: its effect shows");
h.request("ui.key", json!({"key": "o"}), T);
assert!(shown(&h), "O shows B's overlay");
exec(&mut h, "mask.select", json!({"id": a}));
h.app.ui.mask_hover = None;
h.app.ui.mask_hover_prev = None;
assert!(!shown(&h), "A is still hidden");
h.settle(SETTLE);
}
/// The all-masks overlay waits while an AI selection is computed: its stand-in would look like the
/// result.
#[test]
fn the_all_masks_overlay_waits_for_an_ai_selection() {
use lightcraft_develop::{Mask, MaskComponent, MaskOp, MaskShape};
use lightcraft_geom::Point;
let component = |shape| MaskComponent { name: None, op: MaskOp::Add, invert: false, shape };
let linear = component(MaskShape::Linear { start: Point::new(0.5, 0.2), end: Point::new(0.5, 0.7) });
let mut d = lightcraft_develop::DevelopSettings::default();
d.masks.push(Mask { id: 1, components: vec![linear], visible: true, ..Default::default() });
assert!(crate::panels::detail::all_masks_showable(&d, true));
let object = component(MaskShape::Object { hint: vec![Point::new(0.5, 0.5)], exclude: Vec::new(), seg: None, detail: Vec::new(), edge: 0.0 });
d.masks.push(Mask { id: 2, components: vec![object], visible: true, ..Default::default() });
assert!(!crate::panels::detail::all_masks_showable(&d, true), "an Object selection is being computed");
assert!(crate::panels::detail::all_masks_showable(&d, false), "nothing is computing");
}
/// A deleted mask's id goes to the next new mask: O having hid the deleted one's overlay says nothing about the
/// new one (CodeRabbit on #2920).
#[test]
fn a_new_mask_with_a_deleted_masks_id_shows_its_overlay() {
use lightcraft_pipeline::Overlay;
let mut h = detail("panel.masking");
exec(&mut h, "mask.add", json!({"kind": "linear", "start": [0.5, 0.2], "end": [0.5, 0.7]}));
let mask = h.app.session.active_mask.unwrap();
let shown = |h: &Headless| matches!(crate::panels::detail::view_overlay(&h.app, &develop(h)), Overlay::Mask { .. });
h.request("ui.key", json!({"key": "o"}), T);
assert!(!shown(&h));
crate::panels::masking::delete_mask(&mut h.app, None);
assert!(h.app.ui.mask_overlay_hidden.is_empty(), "forgotten with the mask");
exec(&mut h, "mask.add", json!({"kind": "radial", "center": [0.4, 0.5], "rx": 0.2, "ry": 0.2}));
assert_eq!(h.app.session.active_mask, Some(mask), "the same id again");
h.app.ui.mask_hover = None;
h.app.ui.mask_hover_prev = None;
assert!(shown(&h), "the new mask shows");
h.settle(SETTLE);
}
/// Undo taking a new mask away frees its id the same way: O having hid its overlay says nothing about the next
/// new mask (CodeRabbit on #2920).
#[test]
fn a_new_mask_after_undoing_a_hidden_one_shows_its_overlay() {
use lightcraft_pipeline::Overlay;
let mut h = detail("panel.masking");
exec(&mut h, "mask.add", json!({"kind": "linear", "start": [0.5, 0.2], "end": [0.5, 0.7]}));
let mask = h.app.session.active_mask.unwrap();
let shown = |h: &Headless| matches!(crate::panels::detail::view_overlay(&h.app, &develop(h)), Overlay::Mask { .. });
h.request("ui.key", json!({"key": "o"}), T);
assert!(!shown(&h));
exec(&mut h, "edit.undo", json!({}));
assert!(develop(&h).masks.iter().all(|m| m.id != mask), "the mask is undone");
assert!(h.app.ui.mask_overlay_hidden.is_empty(), "forgotten with the mask");
exec(&mut h, "mask.add", json!({"kind": "radial", "center": [0.4, 0.5], "rx": 0.2, "ry": 0.2}));
assert_eq!(h.app.session.active_mask, Some(mask), "the same id again");
h.app.ui.mask_hover = None;
h.app.ui.mask_hover_prev = None;
assert!(shown(&h), "the new mask shows");
h.settle(SETTLE);
}
/// Painting on a mask that has settings shows its effect as it is painted (the stroke goes to the
/// photo live, one undo step), never the red stroke; a mask without settings, or O, still shows the
/// red stroke while painting (found in an evening of real editing).
#[test]
fn painting_a_mask_with_settings_shows_its_effect_not_red() {
let mut h = detail("panel.masking");
h.settle(SETTLE);
exec(&mut h, "tool.brush", json!({"new": true}));
h.app.ui.brush_auto_mask = false;
let strokes = |h: &Headless, mid: u32| -> Vec<usize> {
develop(h)
.masks
.iter()
.find(|m| m.id == mid)
.map(|m| {
m.components.iter().filter_map(|c| if let MaskShape::Brush { strokes } = &c.shape { Some(strokes.len()) } else { None }).collect()
})
.unwrap_or_default()
};
// no settings: the red stroke while painting
pointer(&mut h, json!([{"kind": "down", "x": 0.2, "y": 0.5}, {"kind": "drag", "x": 0.25, "y": 0.5}, {"kind": "drag", "x": 0.3, "y": 0.5}]));
assert!(h.app.brush_live.is_some(), "a mask without settings shows the red stroke");
pointer(&mut h, json!([{"kind": "up", "x": 0.3, "y": 0.5}]));
let mid = h.app.session.active_mask.expect("the brush mask");
assert_eq!(strokes(&h, mid), vec![1]);
// with settings: no red; the stroke is on the photo while painted, one undo step
exec(&mut h, "mask.adjust", json!({"values": {"exposure": 1.0}}));
assert_eq!(h.app.ui.tool, "brush", "the brush stays armed on its mask");
pointer(&mut h, json!([{"kind": "down", "x": 0.2, "y": 0.7}, {"kind": "drag", "x": 0.25, "y": 0.7}, {"kind": "drag", "x": 0.3, "y": 0.7}]));
assert!(h.app.brush_live.is_none(), "no red stroke on a mask with settings");
assert_eq!(strokes(&h, mid), vec![2], "the stroke shows its effect on the photo while painted");
assert!(h.app.session.interaction.is_some(), "one undo step stays open while painting");
pointer(&mut h, json!([{"kind": "up", "x": 0.3, "y": 0.7}]));
h.step();
assert_eq!(strokes(&h, mid), vec![2]);
assert!(h.app.session.interaction.is_none());
exec(&mut h, "edit.undo", json!({}));
assert_eq!(strokes(&h, mid), vec![1], "one undo removes the whole stroke");
// O shows the overlay on purpose: the red stroke again
exec(&mut h, "view.maskOverlay", json!({"show": true}));
pointer(&mut h, json!([{"kind": "down", "x": 0.2, "y": 0.3}, {"kind": "drag", "x": 0.25, "y": 0.3}, {"kind": "drag", "x": 0.3, "y": 0.3}]));
assert!(h.app.brush_live.is_some(), "O: the overlay colour while painting");
pointer(&mut h, json!([{"kind": "up", "x": 0.3, "y": 0.3}]));
h.settle(SETTLE);
}
/// A live stroke the photo refused (here: more pressure values than points) is not live: the release
/// adds it as a new stroke instead of replacing the mask's previous one (CodeRabbit on #2920).
#[test]
fn a_refused_live_stroke_does_not_replace_the_previous_stroke() {
let mut h = detail("panel.masking");
h.settle(SETTLE);
exec(&mut h, "tool.brush", json!({"new": true}));
h.app.ui.brush_auto_mask = false;
brush_at(&mut h, 0.2, 0.5);
exec(&mut h, "mask.adjust", json!({"values": {"exposure": 1.0}}));
let before = develop(&h).masks.last().map(|m| m.components.clone());
let p = |x: f64| lightcraft_geom::Point::new(x, 0.7);
h.app.gesture = Some(crate::panels::detail::Gesture::Brush { points: vec![p(0.2), p(0.3)], pressure: vec![1.0; 3], live: None });
h.step();
assert!(matches!(h.app.gesture, Some(crate::panels::detail::Gesture::Brush { live: None, .. })), "a refused stroke must not count as live");
assert!(h.app.session.interaction.is_none(), "the refused stroke's undo step is closed");
assert_eq!(develop(&h).masks.last().map(|m| m.components.clone()), before, "the previous stroke is untouched");
h.app.gesture = None;
h.settle(SETTLE);
}
/// Another tool chosen while a live Brush stroke is open (a gradient's key mid-stroke) ends the stroke first: the
/// new mask is a step of its own, not folded into the "Brush" step (CodeRabbit on #2920).
#[test]
fn a_gradient_chosen_mid_stroke_is_its_own_undo_step() {
let mut h = detail("panel.masking");
h.settle(SETTLE);
exec(&mut h, "tool.brush", json!({"new": true}));
h.app.ui.brush_auto_mask = false;
brush_at(&mut h, 0.2, 0.5);
exec(&mut h, "mask.adjust", json!({"values": {"exposure": 1.0}}));
pointer(&mut h, json!([{"kind": "down", "x": 0.2, "y": 0.7}, {"kind": "drag", "x": 0.25, "y": 0.7}, {"kind": "drag", "x": 0.3, "y": 0.7}]));
assert!(matches!(h.app.gesture, Some(crate::panels::detail::Gesture::Brush { live: Some(_), .. })), "a live stroke");
let masks = develop(&h).masks.len();
exec(&mut h, "tool.linear", json!({}));
assert!(h.app.gesture.is_none(), "the stroke ended");
assert!(h.app.session.interaction.is_none(), "its undo step closed");
assert_eq!(develop(&h).masks.len(), masks + 1);
exec(&mut h, "edit.undo", json!({}));
assert_eq!(develop(&h).masks.len(), masks, "one undo takes the gradient alone");
pointer(&mut h, json!([{"kind": "up", "x": 0.3, "y": 0.7}]));
h.settle(SETTLE);
}
/// A stroke that never went live (its mask has no settings) still ends when another tool is chosen
/// mid-stroke: back on the brush, the next stroke starts afresh instead of carrying on from it
/// (CodeRabbit on #2920).
#[test]
fn a_tool_chosen_mid_stroke_drops_a_stroke_that_was_not_live() {
let mut h = detail("panel.masking");
h.settle(SETTLE);
exec(&mut h, "tool.brush", json!({"new": true}));
h.app.ui.brush_auto_mask = false;
pointer(&mut h, json!([{"kind": "down", "x": 0.2, "y": 0.5}, {"kind": "drag", "x": 0.25, "y": 0.5}, {"kind": "drag", "x": 0.3, "y": 0.5}]));
assert!(matches!(h.app.gesture, Some(crate::panels::detail::Gesture::Brush { live: None, .. })), "a stroke, not live");
exec(&mut h, "tool.linear", json!({}));
assert!(h.app.gesture.is_none(), "the stroke is dropped");
assert!(h.app.brush_live.is_none());
pointer(&mut h, json!([{"kind": "up", "x": 0.3, "y": 0.5}]));
exec(&mut h, "tool.brush", json!({}));
pointer(&mut h, json!([{"kind": "down", "x": 0.6, "y": 0.4}, {"kind": "drag", "x": 0.65, "y": 0.4}]));
let first = match &h.app.gesture {
Some(crate::panels::detail::Gesture::Brush { points, .. }) => points.first().map(|p| p.x),
_ => None,
};
assert!(first.is_some_and(|x| x > 0.5), "the next stroke starts where it was painted: {first:?}");
pointer(&mut h, json!([{"kind": "up", "x": 0.65, "y": 0.4}]));
h.settle(SETTLE);
}
/// The overlay falls back to the last frame's hovered mask while this frame's panels set the new one, so a frame in
/// which the hovered row or pin changed (or the pointer left them) asks for one more: the overlay follows the
/// pointer at once, not at the next input (CodeRabbit on #2920).
#[test]
fn a_frame_whose_hovered_mask_changed_asks_for_another() {
let mut h = detail("panel.masking");
let row = Some((lightcraft_catalog::PhotoId(1), 1));
let asks = |h: &mut Headless, now, before| {
h.app.ui.mask_hover = now;
h.app.ui.mask_hover_prev = before;
// (a settled context: its own first frames asked for, so only this frame's request counts)
let ctx = egui::Context::default();
for _ in 0..3 {
ctx.run_ui(egui::RawInput::default(), |_| {}).textures_delta.clear();
}
let asked = std::sync::Arc::new(std::sync::atomic::AtomicBool::new(false));
let seen = asked.clone();
ctx.set_request_repaint_callback(move |_| seen.store(true, std::sync::atomic::Ordering::Relaxed));
h.app.repaint_on_mask_hover_change(&ctx);
asked.load(std::sync::atomic::Ordering::Relaxed)
};
assert!(asks(&mut h, row, None), "onto a row");
assert!(asks(&mut h, None, row), "off it");
assert!(asks(&mut h, Some((lightcraft_catalog::PhotoId(1), 2)), row), "onto another");
assert!(!asks(&mut h, row, row), "resting on the same row");
assert!(!asks(&mut h, None, None), "nowhere near");
}
/// Picking another mask or another photo (also with the arrow keys), Undo, or a Brush request that makes a new mask
/// while a live Brush stroke is held ends the stroke first: its next live update or its release can't replace the
/// picked mask's strokes, the stroke before the undone one, or start a mask on the new photo, and the pointer
/// still held paints nothing more until it is let go (CodeRabbit on #2920).
#[test]
fn picking_another_mask_or_photo_mid_stroke_ends_the_stroke() {
let stroke_count = |h: &Headless, id: u32| -> usize {
develop(h)
.masks
.iter()
.find(|m| m.id == id)
.map(|m| m.components.iter().map(|c| if let MaskShape::Brush { strokes } = &c.shape { strokes.len() } else { 0 }).sum())
.unwrap_or(0)
};
for pick in ["mask", "photo", "next", "undo", "new"] {
let mut h = detail("panel.masking");
h.settle(SETTLE);
exec(&mut h, "tool.brush", json!({"new": true}));
h.app.ui.brush_auto_mask = false;
brush_at(&mut h, 0.2, 0.5);
exec(&mut h, "mask.adjust", json!({"values": {"exposure": 1.0}}));
let first = h.app.session.active_mask.expect("the first mask");
exec(&mut h, "tool.brush", json!({"new": true}));
brush_at(&mut h, 0.6, 0.5);
exec(&mut h, "mask.adjust", json!({"values": {"exposure": -1.0}}));
let second = h.app.session.active_mask.expect("the second mask");
assert_ne!(first, second);
let second_before = develop(&h).masks.iter().find(|m| m.id == second).cloned();
// a live stroke on the second mask (it has settings: its effect shows while painting)
pointer(&mut h, json!([{"kind": "down", "x": 0.6, "y": 0.7}, {"kind": "drag", "x": 0.65, "y": 0.7}, {"kind": "drag", "x": 0.7, "y": 0.7}]));
h.step();
assert!(matches!(h.app.gesture, Some(crate::panels::detail::Gesture::Brush { live: Some(_), .. })), "{pick}: a live stroke");
let photo = h.app.session.active().expect("a photo");
let (first_strokes, masks) = (stroke_count(&h, first), develop(&h).masks.len());
match pick {
"mask" => {
exec(&mut h, "mask.select", json!({"id": first}));
}
"photo" => {
let other = h.app.session.visible_cloned().into_iter().find(|p| *p != photo).expect("another photo");
exec(&mut h, "library.select", json!({"ids": [other.0]}));
}
"next" => {
exec(&mut h, "library.next", json!({}));
assert_ne!(h.app.session.active(), Some(photo), "stepped to the next photo");
}
"undo" => {
exec(&mut h, "edit.undo", json!({}));
}
_ => {
exec(&mut h, "tool.brush", json!({"new": true}));
}
}
let (third, second_now) = (h.app.session.active_mask, stroke_count(&h, second));
assert!(h.app.gesture.is_none(), "{pick}: the stroke ended");
assert!(h.app.session.interaction.is_none(), "{pick}: its undo step closed");
// the pointer carries on and lets go: nothing lands on what was picked
pointer(&mut h, json!([{"kind": "drag", "x": 0.75, "y": 0.7}, {"kind": "drag", "x": 0.8, "y": 0.7}, {"kind": "up", "x": 0.8, "y": 0.7}]));
h.step();
h.step();
match pick {
"mask" => {
assert_eq!(stroke_count(&h, first), first_strokes, "the picked mask's strokes are untouched");
assert_eq!(develop(&h).masks.len(), masks, "no new mask");
}
"undo" => {
let second_after = develop(&h).masks.iter().find(|m| m.id == second).cloned();
assert_eq!(second_after, second_before, "the stroke before the undone one is kept as it was");
}
"new" => {
assert_ne!(third, Some(second), "a new mask");
assert_eq!(stroke_count(&h, second), second_now, "what was painted stays on its mask, nothing more");
assert_eq!(third.map_or(0, |m| stroke_count(&h, m)), 0, "nothing of the old stroke lands on the new mask");
}
_ => assert!(develop(&h).masks.is_empty(), "{pick}: no mask started on the new photo: {:?}", develop(&h).masks.len()),
}
// and the next press paints again (the brush armed again: picking a mask or photo puts it down)
exec(&mut h, "tool.brush", json!({}));
h.step();
pointer(&mut h, json!([{"kind": "down", "x": 0.3, "y": 0.3}, {"kind": "drag", "x": 0.35, "y": 0.3}, {"kind": "up", "x": 0.35, "y": 0.3}]));
h.step();
assert!(!develop(&h).masks.is_empty(), "{pick}: a new press paints");
h.settle(SETTLE);
}
}
/// Lens Blur Brush Refinement: Focus / Blur pick a brush that paints on the photo from the Edit
/// panel (one `lensBlur.brushStroke` per drag, with the brush's settings); ⌥ erases; Reset clears.
#[test]
@@ -233,13 +233,16 @@ mod in_the_loupe {
}
h.request("engine.execute", json!({"command": "view.zoom100"}), T);
h.app.ui.pan = (0.3, 0.4);
// (a mask without settings shows its overlay by itself: O hides it for that mask)
h.app.ui.mask_overlay = false;
h.app.ui.mask_overlay_hidden = h.app.session.active().zip(h.app.session.active_mask).into_iter().collect();
h.settle(SETTLE);
let (zoom, pan) = (h.app.ui.zoom, h.app.ui.pan);
assert_eq!(zoom, crate::state::Zoom::Percent(100.0));
let plain = h.app.region_view.expect("a window render without the overlay");
h.app.ui.mask_overlay = true;
h.app.ui.mask_overlay_hidden.clear();
h.settle(SETTLE);
let id = h.app.session.active().expect("a photo");
let d = h.app.session.develop_of(id).expect("settings");
@@ -253,6 +256,7 @@ mod in_the_loupe {
assert_ne!(shown.settings, plain.settings, "the overlay is part of the window's look");
h.app.ui.mask_overlay = false;
h.app.ui.mask_overlay_hidden = h.app.session.active().zip(h.app.session.active_mask).into_iter().collect();
h.settle(SETTLE);
assert_eq!((h.app.ui.zoom, h.app.ui.pan), (zoom, pan), "hiding it keeps them too");
assert_eq!(h.app.region_view.map(|r| r.settings), Some(plain.settings), "back to the plain window");
@@ -87,6 +87,20 @@ fn switching_libraries_restarts_the_brief_info_overlay() {
let _ = std::fs::remove_dir_all(dir);
}
/// Masks hidden with O are keyed by photo and mask ID, both local to a library: a mask in the new
/// library with the same IDs is not hidden by them.
#[test]
fn switching_libraries_forgets_the_masks_hidden_with_o() {
let dir = temp("switch-hidden-masks");
let mut app = app_in(&dir);
app.ui.mask_overlay_hidden = vec![(lightcraft_catalog::PhotoId(1), 1)];
app.ui.mask_hover = Some((lightcraft_catalog::PhotoId(1), 1));
app.run("app.newLibrary", json!({"path": dir.to_string_lossy(), "name": "Second"})).unwrap();
assert!(app.ui.mask_overlay_hidden.is_empty());
assert_eq!(app.ui.mask_hover, None);
let _ = std::fs::remove_dir_all(dir);
}
fn recent_submenu(app: &LightcraftApp) -> Vec<crate::menubar::MenuNode> {
use crate::menubar::MenuNode;
let bar = crate::menubar::menu_bar(app);
+31 -1
View File
@@ -3,7 +3,10 @@
//! node with no name, a slider without its value and range, or a canvas tool no key can reach.
use egui::accesskit::Role;
use egui::vec2;
use egui_kittest::{Harness, kittest::NodeT};
use egui_kittest::{
Harness,
kittest::{NodeT, Queryable},
};
use lightcraft_ui_egui::{
LightcraftApp, Services,
state::{RightPanel, ViewMode},
@@ -336,3 +339,30 @@ fn import_button_describes_its_shortcut_as_this_platform_writes_it() {
let help = lightcraft_ui_egui::menubar::shortcut_text(sc, mac);
assert!(button_described(&h, "Import Photos…", &help), "a button named \"Import Photos…\" describing {help:?}");
}
/// Settings' filter reads every tab by drawing it in a context of its own. That reading leaves the
/// window's tree as it was: one Settings window, no interactive node left unnamed by it, and what was found
/// listed as the window's own widgets.
#[test]
fn the_settings_filter_reads_the_tabs_without_touching_the_tree() {
let mut h = harness(ViewMode::PhotoGrid, RightPanel::None);
// (the External Editor tab's text has a "▸" the fonts lack: drawn as a box here, as in the app,
// not a panic as the kittest harness has it by default)
h.ctx.set_missing_glyph_policy(egui::MissingGlyphPolicy::Tofu);
h.state_mut().run("app.settings", serde_json::json!({"tab": "general"})).unwrap();
h.run_steps(8);
let windows =
|h: &Harness<'_, LightcraftApp>| h.root().children_recursive().map(|n| n.accesskit_node()).filter(|n| n.role() == Role::Window).count();
let before = windows(&h);
// (what Settings leaves unnamed of its own is not this test's: the filter adds none to it)
let unnamed = |h: &Harness<'_, LightcraftApp>| audit(h, "settings").len();
let unnamed_before = unnamed(&h);
let filter = h.get_by_label("Filter settings");
filter.click();
h.run_steps(2);
h.get_by_label("Filter settings").type_text("cache");
h.run_steps(8);
assert!(h.state().widgets.iter().any(|(id, _)| id.starts_with("settingsFound:")), "the filter lists what it found");
assert_eq!(windows(&h), before, "reading the tabs adds no window to the tree");
assert!(unnamed(&h) <= unnamed_before, "the filter and what it found are named: {} unnamed, {unnamed_before} before", unnamed(&h));
}
+5 -2
View File
@@ -315,7 +315,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts).
| LR-MASK-FEATHER-EDGE | Refine mask edges | P2 | ✅ | `cmd:mask.refine`, `crates/pipeline/src/masks.rs` (`evaluate_one`) | Refine Edges slider per mask: guided filter on the photo's luminance snaps soft mask edges to the photo's edges (rendered on the CPU) |
| LR-MASK-SLIDERS | Local adjustment sliders | P0 | ✅ | `cmd:mask.adjust`, `crates/pipeline/src/finish.rs`, `crates/pipeline/src/lens_blur.rs` | every slider renders (CPU + GPU), incl. Noise, Moiré, Defringe (negative Defringe has no effect); no local curve. Beyond Lightroom: a Lens Blur block in every mask (`crates/ui-egui/src/panels/masking.rs`, `lens_blur_block`): blur the selection or what it leaves out, Amount, Boost, Transition (the blur grows away from what stays sharp), an eye to switch it off; disc bokeh, no halo |
| LR-MASK-EFFECTS | Local adjustment (effect / brush) presets | P1 | ✅ | `cmd:mask.effects`, `cmd:mask.applyEffect`, `cmd:mask.saveEffect`, `cmd:mask.updateEffect`, `cmd:mask.renameEffect`, `cmd:mask.duplicateEffect`, `cmd:mask.deleteEffect`, `cmd:mask.favoriteEffect`, `cmd:mask.setEffectGroup`, `cmd:mask.renameEffectGroup`, `cmd:mask.toolEffect`, `cmd:mask.importEffects`, `cmd:mask.exportEffects`, `cmd:dialog.saveMaskEffect`, `cmd:dialog.manageMaskEffects`, `cmd:file.exportMaskEffects`, `crates/engine/src/cmd/mask_effects.rs`, `crates/engine/src/cmd/mask_effect_files.rs`, `crates/ui-egui/src/panels/mask_effects.rs` | Effect menu above the mask sliders: grouped (folders, ★ Favorites first), searchable, scrolls, ↑ ↓ Return, ✓ on the matching effect (else Custom), resting on an effect previews it on the photo; right-click: apply to all masks / to the same-named mask on the selected photos (one undo step), update, rename, duplicate, star, move to group, delete (asks first); Reset Sliders; New Effect Preset dialog: which sliders (All / None / Changed Only), Amount, brush size/feather/flow; any mask type; Manage Effect Presets window (search, inline rename, update, duplicate, stars, groups, export, delete with confirmation); a new mask starts with the effect last applied to a mask of its kind (per tool, kept with the library); imports Lightroom Classic local `.lrtemplate` presets, Camera Raw local-correction `.xmp` presets, `.lceffect` and `.zip` bundles, through File ▸ Import Profiles & Presets… and drag & drop too; folders and LrC divider presets (`10 ----- DETAIL ----- 10`) become groups; settings with no local slider here (`grain`, Point Color `pointColors`, `toningLuminance`) are reported and kept with the effect for export, not applied (🟡 for those); brush size/feather/flow aren't in LrC presets (it keeps them per brush), so only `.lceffect` carries them; no built-in effects |
| LR-MASK-OVERLAY | Mask overlay | P0 | ✅ | `cmd:view.maskOverlay`, `cmd:view.maskOverlayMode`, `cmd:view.maskOverlayColor`, `crates/pipeline/src/visualize.rs` | rendered alpha of the selected mask (CPU + GPU): colour, colour on B&W, image on black/white, white on black; ⇧O cycles while masking; successful local adjustments (including Amount) hide the overlay until O / the eye shows it again or a mask is created, picked, duplicated or added to (issue #1800); shape/edge edits retain it; zoomed in, the overlay is rendered on the same sharp window as the plain view (zoom and pan unchanged; `crates/ui-egui/src/tests/preview_limit.rs`, `crates/pipeline/src/tests_window.rs`); no auto-show on hover |
| LR-MASK-OVERLAY | Mask overlay | P0 | ✅ | `cmd:view.maskOverlay`, `cmd:view.maskOverlayMode`, `cmd:view.maskOverlayColor`, `crates/pipeline/src/visualize.rs`, `crates/ui-egui/src/panels/detail.rs` (`overlay_mask`, `adjusting`) | one rule decides when the overlay shows: O / the eye by the Masks title (on to stay), or the pointer on one of a mask's component rows or its pin while nothing is being adjusted (the mask's own row shows none: its eye judges the effect with nothing over the photo), or by itself for a mask without settings yet; a mask with settings never shows by itself (picking, creating, duplicating or adding to it shows its effect, replacing #1800's re-show); nothing shows while a slider is at work, and it comes back when let go; during a mask drag or brush stroke hovering shows no overlay, while O and a mask without settings keep theirs; no stand-in overlay while an Object click or a description is still being computed; rendered alpha of the selected mask (CPU + GPU): colour, colour on B&W, image on black/white, white on black; ⇧O cycles while masking; zoomed in, the overlay is rendered on the same sharp window as the plain view (zoom and pan unchanged; `crates/ui-egui/src/tests/preview_limit.rs`, `crates/pipeline/src/tests_window.rs`) |
| LR-MASK-OVERLAYALL | Show all mask overlays | P1 | ✅ | `cmd:view.maskOverlayAll`, `crates/ui-egui/src/panels/masking.rs`, `crates/pipeline/src/visualize.rs` | one diagnostic tint over every visible mask at once (CPU + GPU): the masks still stack their adjustments as before — this only paints each mask's region together, so you can see all masked areas at a glance (⌘⇧O / Ctrl+Shift+O) |
| LR-MASK-PINS | Pins | P1 | ✅ | `cmd:view.maskPins`, `cmd:view.toolOverlay`, `crates/ui-egui/src/panels/detail.rs`, `crates/ui-egui/src/tests/tool_overlay.rs`, `crates/ui-egui/src/tests/masking.rs` | a pin per radial/linear/brush component: click selects its mask, drag moves it; Object (at its first click) and Describe (on what it found) components have pins too: click selects, drag changes nothing (issue #3049); Show Pins on follows the Tool Overlay mode (Auto: while the pointer is over the photo, hidden while brushing; Always; Selected: the selected mask's; Never; ⇧H cycles, #224); no pins for range components or Subject, Sky, Background, People and Landscape |
| LR-MASK-UPDATE | Recompute AI masks | P2 | ⬜ | | |
@@ -436,7 +436,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts).
| Id | Feature | Tier | Status | Evidence | Missing / notes |
|---|---|---|---|---|---|
| LR-PREF-GENERAL | General settings | P0 | ✅ | `cmd:app.settings`, `cmd:app.openLibrary`, `crates/ui-egui/src/dialogs/settings.rs`, `crates/ui-egui/src/panels/notices.rs` | General / Import / Performance / Display / Interface tabs; app settings in ui.json (written atomically, saved when the library changes and every few seconds), library settings in prefs.json; At launch: open the last library or ask (see LRC-LIB-CATALOG-SWITCH); Startup View: an image passed at launch honors explicit Detail; Grid and Last use Photo Grid; populated-library launches without image arguments retain their saved view; a damaged settings file is kept as `.corrupt-<time>` and reported, an unreadable one is not overwritten that session (`library.info` → `settingsWarnings`); quitting with unsaved changes retries, then asks |
| LR-PREF-GENERAL | General settings | P0 | ✅ | `cmd:app.settings`, `cmd:app.openLibrary`, `crates/ui-egui/src/dialogs/settings.rs`, `crates/ui-egui/src/panels/notices.rs` | General / Import / Performance / Display / Interface tabs; a filter above the tabs lists the sections of any tab that have every word typed (`field:settingsFilter`, `settingsFound:<tab>:<section>`); app settings in ui.json (written atomically, saved when the library changes and every few seconds), library settings in prefs.json; At launch: open the last library or ask (see LRC-LIB-CATALOG-SWITCH); Startup View: an image passed at launch honors explicit Detail; Grid and Last use Photo Grid; populated-library launches without image arguments retain their saved view; a damaged settings file is kept as `.corrupt-<time>` and reported, an unreadable one is not overwritten that session (`library.info` → `settingsWarnings`); quitting with unsaved changes retries, then asks |
| LR-PREF-LOCALSTORAGE | Storage & cache | P1 | ✅ | `cmd:library.preferences`, `cmd:library.clearPreviews`, `cmd:library.compact` | thumbnail cache size + clear in Settings → Performance; library location + Open Library… in General; the automatic size has no ceiling, so once per session (library open, then every few minutes) a notice says when the drive holding the cache has under 10 % or under 20 GB free, with its free space and the cache's size, and opens Settings → Performance (`crates/engine/src/disk_space.rs`, `library.info` → `lowDiskSpace`, `button:noticeSettings`) |
| LR-PREF-ACCOUNT | Account | OOS | 🚫 | | |
| LR-PREF-INTERFACE | Interface options | P1 | ✅ | `cmd:app.settings`, `cmd:view.appearance`, `cmd:view.theme` | Appearance Mode (Sync with System / Dark / Light; the top bar button cycles Auto, Light, Dark) with separate dark (Charcoal, Midnight) and light (Silver, Paper) themes previewed in cards; hover stars persist favorite themes, the appearance button context menu opens Interface settings and lists light favorites before dark favorites; filmstrip names/badges, grid badges (Ratings & flags: Stars on hover, the default, formerly "When rated or hovered": flags and colour labels always, stars and the edited mark on hover and selection; Always; Never), square-grid names, navigator, info overlay |
@@ -832,6 +832,8 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove
| 2026-10-26 | minor | LR-BEHAV-PANEL-RESIZE, KEY-INFO: closing a tool panel (Crop, Remove, Masking, Red Eye) puts back the panel shown before it, hidden if it was hidden, at the same width and scroll position; a panel key or button (I, M, C, H…) pressed again puts back exactly what the right column showed before it (Edit → I → I = Edit, closed → I → I = closed); status unchanged (✅) |
| 2026-10-25 | patch | LRC-LIB-KEYWORDS: a file whose keyword list is one `dc:subject` (or `lr:hierarchicalSubject`) entry with a keyword a line is read as one keyword a line; a library holding such a keyword is repaired when it opens (journaled, not an undo step); sidebar and Keyword List rows draw a name on one line; status unchanged |
| 2026-10-25 | minor | LR-BEHAV-WINDOW (new row, 🟡): on Windows a window remembered maximized is built at its size and maximized once it shows (built maximized it could cover half the screen while Windows took it for maximized), and restored and maximized again once if it only says so; a window remembered larger than the screen it opens on is fitted to it, on every platform |
| 2026-10-31 | patch | LR-MASK-OVERLAY: the pointer on a mask's own row (name, eye, menu) shows no overlay, so its eye judges the effect; a component row under it shows the whole mask's overlay; status unchanged (✅) |
| 2026-10-25 | minor | LR-MASK-OVERLAY: one overlay rule (O / the eye, or the pointer on the mask's row or pin while nothing is adjusted, or a mask without settings yet); a mask with settings never shows by itself, so picking, creating, duplicating or adding to one no longer shows the overlay (#1800's re-show replaced, its test changed to the rule); sliders, mask drags and brush strokes hide it and the mask's lines and pins while at work; no stand-in overlay while an AI selection is computed; status unchanged (✅) |
| 2026-10-25 | minor | LR-EDIT-GEOM-UPRIGHT: ✅ → 🟡 (real shots of posts among people were not corrected; tuned on synthetic scenes only): a vertical family wins over a crowd of disagreeing lines unless they gather at a rival point, Vertical follows long posts rather than decks, drapes or gown folds; a mode that finds nothing says why |
| 2026-10-30 | patch | LR-BEHAV-ACCESS: the Flatpak manifests grant `--talk-name=org.a11y.Bus`, so AccessKit can find out whether a screen reader is running and publish the window inside the sandbox; packaging lint requires it in both manifests; status unchanged (🟡), not tried with Orca |
| 2026-10-27 | patch | LR-LIB-LABEL, MENU-PHOTO-LABEL, KEY-LABELS: Clear Color Label (`photo.clearLabel`) is a command of its own, so Help → Keyboard Shortcuts can give it a key (#2980); the Photo ▸ Set Color Label ▸ None row runs it; status unchanged |
@@ -1084,6 +1086,7 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove
| 2026-10-23 | minor | LR-BEHAV-SIDEBAR-SECTIONS: a click on a tree row's triangle with Option (Alt) held opens or folds the row and all the rows inside it, for the session; status unchanged (✅) |
| 2026-10-20 | patch | LR-REM-SPOT-EDIT: a brushed Remove / Heal / Clone spot is one outline (union of its discs, dark under-stroke) instead of a ring per stored point, the paint preview is an outline too, the stroke records a point every r/4 and `spot.add` thins the same way, and a spot is grabbed anywhere along its stroke (#2359); status unchanged |
| 2026-10-24 | patch | LR-BEHAV-AUTOSAVE: a batch that fails and whose rollback fails part-way changed the catalog without a journal record or an undo step, so a restart lost the change and it could not be undone; it is now journaled, its undo step finishes the rollback, and the error says the change was only partly taken back; status unchanged (✅) |
| 2026-10-24 | minor | LR-PREF-GENERAL: Settings has a filter above its tabs that lists the sections, of any tab, that have every word typed (`field:settingsFilter`, `settingsFound:<tab>:<section>`); a section's heading is registered as `heading:<English name>`; status unchanged (✅) |
| 2026-10-20 | patch | LR-PRE-PANEL, LR-PRE-AMOUNT: a preset changes only the settings it names; each is measured from the photo's import look when one is recorded, otherwise from its current value (issue #2159). Statuses and feature counts unchanged. |
| 2026-10-19 | minor | LR-BEHAV-ACCESS: Reduce motion setting (`view.reduceMotion`) stops the click-zoom tween, egui easing, scrolling to a photo, every spinner (a busy button's too) and every indeterminate progress bar's sweep; fades stay; follows macOS Reduce Motion until changed, and "Use the system setting" hands it back; status stays 🟡 |
| 2026-10-17 | minor | LR-EXP-DIALOG: built-in export presets for the issue #2104 delivery targets — Instagram Feed (1080 px, screen sharpening), Instagram Story / Reel (1920 px), Web / Portfolio (2048 px, copyright-only metadata), Full Resolution Master (full size, Display P3, quality 95); LR-EXP-PREVIOUS drops its stale "no named export presets yet" note; status unchanged (✅) |
+20
View File
@@ -2,6 +2,8 @@
## Unreleased
### Export subfolder variables
- The Export dialog's Subfolder field now supports `{album}` (active album name sanitized for filesystem safety, empty outside an album view), `{date}` (batch export date in `YYYYMMDD`, local time), and `{hour}` (batch export time in `HHMM`, local time). An **Insert…** dropdown next to the field inserts tokens at the cursor. Tokens are stored in presets and expanded at export time, so the same preset produces dated subfolders on every use.
### Heal meets its surroundings (process 14)
- A healed spot is now pinned to the photo around its edge: on a gradient (a sky, a shaded wall, a cheek) it no
longer leaves a faint disc or ring, and a dark line a few pixels or more beyond the spot's edge no longer smudges
@@ -465,6 +467,16 @@
a keyword a line; LightCraft now reads it as one keyword a line, and repairs libraries that already hold such a
keyword when they open. A name with a line break in it is drawn on one line in the sidebar and the Keyword List.
### The mask overlay shows when it helps
- One rule now decides when a mask's overlay covers the photo: when you switch it on with **O** (or the eye by the
Masks title), while the pointer is on one of the mask's parts (the rows under its name) or its pin, or by itself for a mask that
has no settings yet, so you see what it selects. The pointer on the mask's own row shows nothing, so its eye
switches the effect on and off with nothing over the photo. A mask with settings (its own or a preset's) never shows the overlay by itself, so you can
judge its effect: picking, creating, duplicating or adding to such a mask no longer covers the photo. While a
slider is at work nothing covers the photo, not even an overlay switched on with O; it comes back when you let go.
During a mask drag or a brush stroke, hovering shows no overlay; an overlay switched on with O, or a mask without
settings, keeps showing what it selects. While an Object click or a description is still being computed, no stand-in
overlay shows.
### Import rename numbering stops safely at its limit
- Copy and Move imports can use the last representable rename number once. If more renamed files remain, each is
reported as failed with guidance to lower `renameStart` or leave `rename` blank; completed transfers stay
@@ -500,6 +512,14 @@
system setting** beside the tick box hands the choice back. On Windows, Linux and the web version it is manual for
now (off by default). Pinch and scroll zoom were never animated.
### Settings has a filter that finds a section on whatever tab it is
- Settings has a filter above its tabs. Type a word, or part of one, and the sections that have it are listed with
the tab each is on, whichever tab was open: the names of tabs and sections, labels, buttons and explanations
are all looked through, and every word typed has to be there. Click a section (or press Return for the first, or ↓
to go down to them) and its tab opens at it. Esc empties the filter; a second Esc closes Settings. The choices of a
closed list and tooltips are not looked through. Scripts: `field:settingsFilter`, `settingsFound:<tab>:<section>`
for each section found, and `heading:<its English name>` for where a section starts, whatever the interface
language.
### AI Denoise follows the photo's real noise
- The built-in denoiser used to read a photo's fine texture as noise, so it always believed a photo was at least as noisy as
about ISO 12800 and over-smoothed quiet photos while under-cleaning noisy ones. It now measures each colour channel