Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Document the Export Preferences, Image Assets and preference-label helpers

IbrahimOezhanc0492f2303c3
diff --git a/crates/engine/src/web_cmds.rs b/crates/engine/src/web_cmds.rs
index d2734d5d2..ff0a29df9 100644
--- a/crates/engine/src/web_cmds.rs
+++ b/crates/engine/src/web_cmds.rs
@@ -1035,6 +1035,8 @@ fn save_for_web_impl(s: &mut Session, p: &Value, write: &mut dyn FnMut(&str, &[u
// ---------- Export Preferences / Quick Export ----------
+/// File › Export › Export Preferences…: sets the given `export.*` preferences through `prefs.set`
+/// (validated like any other preference) and returns the whole section.
fn export_preferences(s: &mut Session, p: &Value) -> Result<Value> {
let cmd = "file.export.exportPreferences";
let mut values = serde_json::Map::new();
@@ -1496,6 +1498,8 @@ pub fn assets_dir(doc_path: &str) -> String {
join(&dir, &format!("{}-assets", stem(doc_path)))
}
+/// File › Generate › Image Assets: toggles generation for the active document (or sets it with
+/// `on`) and, when it is on and the output folder is known, writes the assets now.
fn image_assets(s: &mut Session, p: &Value) -> Result<Value> {
let d = s.active().ok_or(EngineError::NoDocument)?;
let id: DocId = d.doc.id;
diff --git a/crates/ui-egui/src/prefs_ui.rs b/crates/ui-egui/src/prefs_ui.rs
index 8388210bc..3c3f6307a 100644
--- a/crates/ui-egui/src/prefs_ui.rs
+++ b/crates/ui-egui/src/prefs_ui.rs
@@ -1126,6 +1126,8 @@ fn gpu_memory_lines(app: &PhotocraftApp) -> Vec<String> {
v
}
+/// The label a preference key shows in the dialog: a few keys have their own wording, the rest
+/// split camelCase into words (`convertToSrgb` → "Convert to srgb").
fn humanize(key: &str) -> String {
match key {
"appearanceMode" => return "Appearance Mode".into(),