LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Merge main into #2755
Brandon Thomas50874ad2f660
diff --cc crates/engine/src/cmd/library.rsindex fb8f52a62,b019e21fd..809803062--- a/crates/engine/src/cmd/library.rs+++ b/crates/engine/src/cmd/library.rs@@@ -764,27 -792,51 +792,51 @@@ pub fn specs() -> Vec<CommandSpec>|s, p| { step(s, -row_step(p)) }),// ---- rating / flags / labels- cmd!("photo.rate", "Set Rating", ["Photo", "Set Rating"], None, "{rating: 0..5, ids?, advance?: bool}", has_selection, |s, p| {- let r = super::index_req(p, "rating", "photo.rate")- .ok()- .filter(|r| *r <= 5)- .ok_or_else(|| bad("photo.rate", "rating must be a whole number 0..5"))?;- let v = for_targets(s, p, "Set Rating", |id| Some(Op::SetRating { id, rating: r as u8 }))?;- advance_if(s, p);- Ok(v)- }),- cmd!("photo.decreaseRating", "Decrease Rating", [], None, "{ids?, advance?: bool}", has_selection, |s, p| {- change_rating(s, p, -1, "Decrease Rating")- }),- cmd!("photo.increaseRating", "Increase Rating", [], None, "{ids?, advance?: bool}", has_selection, |s, p| {- change_rating(s, p, 1, "Increase Rating")- }),- cmd!("photo.flag", "Set Flag", ["Photo", "Set Flag"], None, "{flag: pick|reject|none, ids?, advance?: bool}", has_selection, |s, p| {- let f = str_param(p, "flag").and_then(Flag::parse).ok_or_else(|| bad("photo.flag", "flag must be pick|reject|none"))?;- let v = for_targets(s, p, "Set Flag", |id| Some(Op::SetFlag { id, flag: f }))?;- advance_if(s, p);- Ok(v)- }),+ cmd!(+ "photo.rate",+ "Set Rating",+ ["Photo", "Set Rating"],+ None,+ "{rating: 0..5, ids?, advance?: bool} — without `ids`, the selection moves on when this takes the active photo out of the view",+ has_selection,+ |s, p| {- let r = super::f64_req(p, "rating", "photo.rate")? as i64;- if !(0..=5).contains(&r) {- return Err(bad("photo.rate", "rating must be 0..5"));- }++ let r = super::index_req(p, "rating", "photo.rate")++ .ok()++ .filter(|r| *r <= 5)++ .ok_or_else(|| bad("photo.rate", "rating must be a whole number 0..5"))?;+ cull(s, p, |s| for_targets(s, p, "Set Rating", |id| Some(Op::SetRating { id, rating: r as u8 })))+ }+ ),+ cmd!(+ "photo.decreaseRating",+ "Decrease Rating",+ [],+ None,+ "{ids?, advance?: bool} — without `ids`, the selection moves on when this takes the active photo out of the view",+ has_selection,+ |s, p| { cull(s, p, |s| change_rating(s, p, -1, "Decrease Rating")) }+ ),+ cmd!(+ "photo.increaseRating",+ "Increase Rating",+ [],+ None,+ "{ids?, advance?: bool} — without `ids`, the selection moves on when this takes the active photo out of the view",+ has_selection,+ |s, p| { cull(s, p, |s| change_rating(s, p, 1, "Increase Rating")) }+ ),+ cmd!(+ "photo.flag",+ "Set Flag",+ ["Photo", "Set Flag"],+ None,+ "{flag: pick|reject|none, ids?, advance?: bool} — without `ids`, the selection moves on when this takes the active photo out of the view",+ has_selection,+ |s, p| {+ let f = str_param(p, "flag").and_then(Flag::parse).ok_or_else(|| bad("photo.flag", "flag must be pick|reject|none"))?;+ cull(s, p, |s| for_targets(s, p, "Set Flag", |id| Some(Op::SetFlag { id, flag: f })))+ }+ ),// Classic: ` cycles the flag; Cmd+Up / Cmd+Down raise / lower it (Ctrl on Windows and Linux)cmd!("photo.cycleFlag",