A drawing app built for agent/human collaboration
Rust
Nothing meant for developers in sight
Indicode BVc284e5be3828
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ded8958..a792a57 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,6 +16,7 @@ The first builds, and klad's licences.- In-betweens blend colours evenly (in OKLab), so light can follow a turning limb when the second key is coloured for it.- `klad arcs` follows the part of a foot on the ground: a heel-to-toe roll is no longer reported as a slide.- Help > Report a problem shows the report before it is copied (version, system, the last messages and lines of klad's log, with your home folder hidden) and can zip the drawing to attach; `klad report` prints the same. Errors and crashes are kept in a small log for it.+- Nothing in the editor names klad's internal ids: the status line, layer settings, selections, the in-between window, undo and the history say layers by name and drawings by frame, the timeline numbers each layer's drawings 1, 2, 3, and a new layer is called "paint 1" instead of by its id. The numbers window (timings) moves behind Settings > Layout > developer tools, off by default.- The format promise: from 1.0, a drawing saved by any release opens in every later one with nothing lost. Each release keeps copies of the samples it saved, and the tests open them all with each new build.- Help > Guides and Help > What's new open klad's guides and this changelog on klad.studio; the welcome on the start window links the guides too.- Support by email: Help > Contact support opens an email to [email protected] with the version and your system filled in; Report a problem can email its report there too, and About links klad.studio and the address. Crash messages name the address as well as the issues page.diff --git a/crates/app/src/commands.rs b/crates/app/src/commands.rsindex 66d8cff..1c53824 100644--- a/crates/app/src/commands.rs+++ b/crates/app/src/commands.rs@@ -2635,7 +2635,6 @@ pub const MENUS: [Menu; 9] = [Run(Cmd::Timeline),Line,Run(Cmd::MessageLog),- Sub("Numbers", &[Run(Cmd::Numbers), Run(Cmd::ResetNumbers), Run(Cmd::Spin)]),],},Menu {@@ -2654,6 +2653,8 @@ pub const MENUS: [Menu; 9] = [},];+pub const DEVELOPER: [Cmd; 3] = [Cmd::Numbers, Cmd::ResetNumbers, Cmd::Spin];+#[cfg(any(target_os = "macos", test))]pub const IN_APP_MENU: [Cmd; 2] = [Cmd::Settings, Cmd::Quit];@@ -2851,9 +2852,13 @@ mod tests {assert!(twice.is_empty(), "in two places: {twice:?}");let missing: Vec<Cmd> = Cmd::ALL.into_iter()- .filter(|c| !listed.contains(c) && !c.spec().is_hold())+ .filter(|c| !listed.contains(c) && !c.spec().is_hold() && !DEVELOPER.contains(c)).collect();assert!(missing.is_empty(), "not in any menu: {missing:?}");+ assert!(+ DEVELOPER.iter().all(|c| !listed.contains(c)),+ "developer tools stay out of the menus"+ );assert!(listed.iter().all(|c| !c.spec().is_hold()),"holds are gestures, not menu items"diff --git a/crates/app/src/editor.rs b/crates/app/src/editor.rsindex 84599b1..8488bae 100644--- a/crates/app/src/editor.rs+++ b/crates/app/src/editor.rs@@ -1120,9 +1120,8 @@ impl Editor {let word = if stack == Stack::Undo { "undid" } else { "redid" };match self.scene.step(stack, &self.brushes)? {Some((summary, dirty)) => {- let text = format!("{word} {summary} in {:.0} ms", ms(start));- self.measure("undo", text.clone());- self.say(Tone::Info, text);+ self.measure("undo", format!("{word} {summary} in {:.0} ms", ms(start)));+ self.say(Tone::Info, format!("{word} {}", self.plain(&summary)));self.dirty.extend(dirty);self.forget_missing_selection();}@@ -1134,6 +1133,42 @@ impl Editor {Ok(())}+ pub(super) fn plain(&self, text: &str) -> String {+ let doc = &self.scene.bundle.doc;+ let drawing = |cel: &str| match doc.locate(cel) {+ Some(Loc::Cel(path, c)) => Some(format!(+ "the drawing at frame {} on {}",+ doc.layer_at(&path).cels()[c].frame,+ doc.layer_at(&path).name+ )),+ _ => None,+ };+ let word = |w: &str| -> Option<String> {+ if let Some((cel, id)) = klad_core::markedit::parse_address(w) {+ return Some(drawing(cel).map_or(format!("mark {id}"), |d| format!("mark {id} of {d}")));+ }+ let digits = w.len() > 1 && w[1..].chars().all(|c| c.is_ascii_digit());+ match w.chars().next() {+ Some('c') if digits => drawing(w),+ Some('l') if digits => doc.layer(w).map(|l| l.name.clone()),+ Some('n') if digits => match doc.item(w) {+ Some(Item::Node(_, _, node)) => Some(format!("a {}", node.type_name())),+ _ => None,+ },+ _ => None,+ }+ };+ text.split(' ')+ .map(|w| {+ let bare = w.trim_end_matches([',', ')', ':', '.', ';']);+ let lead = bare.trim_start_matches('(');+ let (head, tail) = (&bare[..bare.len() - lead.len()], &w[bare.len()..]);+ word(lead).map_or(w.to_string(), |p| format!("{head}{p}{tail}"))+ })+ .collect::<Vec<_>>()+ .join(" ")+ }+fn refresh_box(&mut self) {let rev = self.scene.bundle.doc.rev;let Some(id) = self.selection.clone() else {@@ -3498,7 +3533,14 @@ impl Editor {};let fills = chosen.iter().filter(|(_, m)| m.as_fill().is_some()).count();let place = match picked.more.len() {- 0 => format!("in cel {}", picked.cel),+ 0 => self+ .scene+ .bundle+ .doc+ .paint_cels()+ .into_iter()+ .find(|(_, c)| c.id == picked.cel)+ .map_or_else(String::new, |(l, c)| format!("on {}, frame {}", l.name, c.frame)),n => format!("on {} layers", n + 1),};ui.label(format!(@@ -3549,7 +3591,7 @@ impl Editor {.shaped.as_ref().map_or(0, |s| s.subs.iter().map(|p| p.anchors.len()).sum());- ui.label(format!("stroke {}: {points} points fitted to it", direct.node));+ ui.label(format!("a stroke: {points} points fitted to it"));ui.small("drag a point or a handle to bend the stroke (it keeps its pressure); alt click the line adds a point; Delete removes the selected points");return Ok(());}@@ -3557,9 +3599,9 @@ impl Editor {self.direct = None;return Ok(());};- let (kind, layer_id, is_path) = (+ let (kind, layer_name, is_path) = (node.type_name(),- layer.id.clone(),+ layer.name.clone(),matches!(node.shape, Shape::Path { .. }),);let total = self@@ -3567,8 +3609,7 @@ impl Editor {.as_ref().map_or(0, |s| s.subs.iter().map(|p| p.anchors.len()).sum::<usize>());ui.label(format!(- "{kind} {}{} in {layer_id}: {total} points, {} selected",- direct.node,+ "{kind}{} on {layer_name}: {total} points, {} selected",if node.name.is_empty() {String::new()} else {@@ -3658,8 +3699,8 @@ impl Editor {self.selection = None;return Ok(());};- let (node, layer) = (node.clone(), layer.id.clone());- ui.label(format!("{} {} in {}", node.type_name(), node.id, layer));+ let (node, name) = (node.clone(), layer.name.clone());+ ui.label(format!("{} on {name}", node.type_name()));let mut props: Vec<(String, Value)> = Vec::new();ui.horizontal(|ui| {if let Some(name) = self.text(@@ -4028,12 +4069,12 @@ impl Editor {}fn mask_inspector(&mut self, ui: &mut egui::Ui) -> Result<()> {- let Some(mask) = self.scene.active_layer().cloned() else {+ if self.scene.active_layer().is_none() {return Ok(());- };+ }let owner_path = self.scene.active[..self.scene.active.len() - 1].to_vec();let owner = self.scene.bundle.doc.layer_at(&owner_path).clone();- ui.label(format!("mask {} of {} ({})", mask.id, owner.name, owner.id));+ ui.label(format!("the mask of {}", owner.name));ui.colored_label(Color32::from_rgb(255, 150, 150), self.mask_hint());ui.horizontal_wrapped(|ui| {self.command_check(ui, Cmd::ToggleMask, "mask on");@@ -4063,7 +4104,7 @@ impl Editor {return Ok(());};let id = layer.id.clone();- ui.label(format!("{} layer {}", layer.kind().name(), id));+ ui.label(format!("{} layer", layer.kind().name()));let mut props: Vec<(String, Value)> = Vec::new();ui.horizontal(|ui| {if let Some(name) = self.text(diff --git a/crates/app/src/editor/between.rs b/crates/app/src/editor/between.rsindex 6d94888..c3a46b0 100644--- a/crates/app/src/editor/between.rs+++ b/crates/app/src/editor/between.rs@@ -459,7 +459,7 @@ impl Editor {);}}- ui.label(format!("key at {f}: {}", cel.clone().unwrap_or_default()));+ ui.label(format!("key at frame {f}"));});});});@@ -508,7 +508,7 @@ impl Editor {ui.label(RichText::new(format!("parts pair first: {}", parts.join(", "))).color(theme::WEAK));}if !r.pairs.is_empty() {- let listed: Vec<String> = r.pairs.iter().map(|[a, b]| format!("s{a}=s{b}")).collect();+ let listed: Vec<String> = r.pairs.iter().map(|[a, b]| format!("stroke {a} with {b}")).collect();ui.label(RichText::new(format!("pairs you chose: {}", listed.join(", "))).color(theme::WEAK));}if ui@@ -533,6 +533,13 @@ impl Editor {self.redo_rows_ui(ui)}+ fn drawing_words(&self, cel: &str) -> String {+ match self.scene.bundle.doc.locate(cel) {+ Some(Loc::Cel(path, c)) => format!("frame {}", self.scene.bundle.doc.layer_at(&path).cels()[c].frame),+ _ => "a drawing".to_string(),+ }+ }+fn shared_parts(&self, layer: &str, cels: &[Option<String>]) -> Vec<String> {let parts = |cel: &Option<String>| -> BTreeMap<String, Vec<u32>> {match cel.as_ref().and_then(|c| self.scene.bundle.doc.locate(c)) {@@ -563,7 +570,7 @@ impl Editor {.report.iter().filter_map(|l| match l {- Line::Made { cel, frame } => Some(format!("{cel} at {frame}")),+ Line::Made { frame, .. } => Some(frame.to_string()),_ => None,}).collect();@@ -583,13 +590,15 @@ impl Editor {format!(", by part: {}", parts.join(", "))};ui.label(format!(- "{name}: {a} to {b}, {paired} pairs{by}, {touching} line ends kept touching"+ "{name}: {} to {}, {paired} pairs{by}, {touching} line ends kept touching",+ self.drawing_words(&a),+ self.drawing_words(&b)));}Line::Unpaired { cel, id, first } => {let side = if first { "first" } else { "second" };if ui- .button(format!("{cel}:s{id}, only in the {side} key: pick its partner"))+ .button(format!("stroke {id}, only in the {side} key: pick its partner")).hint("then click the stroke it should become with S; the in-betweens are made again with that pair",)@@ -616,11 +625,11 @@ impl Editor {}}Line::Clash(text) => {- ui.label(RichText::new(format!("not paired: {text}")).color(theme::WEAK));+ ui.label(RichText::new(format!("not paired: {}", self.plain(&text))).color(theme::WEAK));}Line::Left { what, frame } => {if ui- .button(format!("fill left out: {what}"))+ .button(format!("fill left out: {}", self.plain(&what))).hint("go to that frame").clicked(){@@ -628,22 +637,25 @@ impl Editor {}}Line::Kept { cel, count } => {- ui.label(format!("{cel}: {count} hand-drawn marks kept on top"));+ ui.label(format!(+ "{}: {count} hand-drawn marks kept on top",+ self.drawing_words(&cel)+ ));}Line::Made { .. } => {}Line::Note(text) => {- ui.label(RichText::new(text).color(theme::WEAK));+ ui.label(RichText::new(self.plain(&text)).color(theme::WEAK));}});if !made.is_empty() {- ui.label(RichText::new(format!("made: {}", made.join(", "))).color(theme::WEAK));+ ui.label(RichText::new(format!("made: frames {}", made.join(", "))).color(theme::WEAK));}if let Some(p) = pick {self.say(Tone::Info,format!(- "now click the partner of {}:s{} on frame {} (the stroke tool is on)",- p.cel, p.id, p.partner_frame+ "now click the partner of stroke {} on frame {} (the stroke tool is on)",+ p.id, p.partner_frame),);go = Some(p.partner_frame);@@ -653,7 +665,7 @@ impl Editor {}if let Some(p) = self.between.pick.clone() {ui.horizontal(|ui| {- ui.label(RichText::new(format!("picking the partner of {}:s{}", p.cel, p.id)).color(theme::ACCENT));+ ui.label(RichText::new(format!("picking the partner of stroke {}", p.id)).color(theme::ACCENT));if ui.button("stop").hint("stop picking a partner").clicked() {self.between.pick = None;}@@ -682,7 +694,13 @@ impl Editor {}rows.iter().for_each(|r| {ui.horizontal(|ui| {- ui.label(format!("{} at {} on {}", r.cel, r.frame, r.layer));+ let layer = self+ .scene+ .bundle+ .doc+ .layer(&r.layer)+ .map_or(r.layer.clone(), |l| l.name.clone());+ ui.label(format!("frame {} on {layer}", r.frame));match r.status {Status::Remake => {ui.label(RichText::new("remade").color(theme::WEAK));diff --git a/crates/app/src/editor/commands.rs b/crates/app/src/editor/commands.rsindex af1f078..b207598 100644--- a/crates/app/src/editor/commands.rs+++ b/crates/app/src/editor/commands.rs@@ -66,6 +66,11 @@ impl Editor {.then(|| "no clip here: click a clip's bar above the frame numbers".to_string())};let editing = self.busy().then(|| "finish the stroke or drag first".to_string());+ if crate::commands::DEVELOPER.contains(&cmd) && !self.settings.developer {+ return Some(+ "the numbers are a developer tool: turn on developer tools in Settings > Layout first".to_string(),+ );+ }match cmd {Cmd::Undo | Cmd::Redo => editing,Cmd::CloseDocument => (!self.jobs.is_empty())diff --git a/crates/app/src/editor/history.rs b/crates/app/src/editor/history.rsindex d24be15..7baf607 100644--- a/crates/app/src/editor/history.rs+++ b/crates/app/src/editor/history.rs@@ -86,13 +86,12 @@ impl Editor {(0..count).try_for_each(|_| self.step(stack))?;self.history = None;let word = if stack == Stack::Undo { "undid" } else { "redid" };- let text = format!(- "{word} {count} step{} in {:.0} ms",- if count == 1 { "" } else { "s" },- start.elapsed().as_secs_f64() * 1000.0+ let steps = format!("{word} {count} step{}", if count == 1 { "" } else { "s" });+ self.measure(+ "undo",+ format!("{steps} in {:.0} ms", start.elapsed().as_secs_f64() * 1000.0),);- self.measure("undo", text.clone());- self.say(Tone::Done, text);+ self.say(Tone::Done, steps);Ok(())}@@ -119,8 +118,8 @@ impl Editor {_ => theme::TEXT,};let text = match r.undone {- true => format!("undone {} {} {}", r.who, r.what, ago(r.at_ms, now)),- false => format!("{} {} {}", r.who, r.what, ago(r.at_ms, now)),+ true => format!("undone {} {} {}", r.who, self.plain(&r.what), ago(r.at_ms, now)),+ false => format!("{} {} {}", r.who, self.plain(&r.what), ago(r.at_ms, now)),};let hint = match steps_to(&rows, i) {Some((Stack::Undo, n)) => format!("undo {n} step{} to come back here", if n == 1 { "" } else { "s" }),diff --git a/crates/app/src/editor/make.rs b/crates/app/src/editor/make.rsindex 6de69df..6379be9 100644--- a/crates/app/src/editor/make.rs+++ b/crates/app/src/editor/make.rs@@ -174,7 +174,10 @@ impl Editor {return Ok(());};let Some([x, y, w, h]) = overlay::node_world_box(doc, &id)? else {- self.say(Tone::Refused, format!("{id} draws nothing to {kind}"));+ self.say(+ Tone::Refused,+ format!("this {} draws nothing to {kind}", node.type_name()),+ );return Ok(());};let parent = path[..path.len() - 1]@@ -200,6 +203,7 @@ impl Editor {json!({"id": made, "type": "scatter", "x": x - w * 2.0, "y": y - h, "w": w * 5.0, "h": h * 3.0, "count": 12, "children": [child]})}};+ let shape = node.type_name();let frame = self.scene.frame;self.apply(vec![Op::Remove { ids: vec![id.clone()] },@@ -216,7 +220,7 @@ impl Editor {self.selection = Some(made);self.say(Tone::Done,- format!("{id} is now inside a {kind}: layer settings set how many copies and where they go"),+ format!("the {shape} is now inside a {kind}: layer settings set how many copies and where they go"),);Ok(())}diff --git a/crates/app/src/editor/panels.rs b/crates/app/src/editor/panels.rsindex 38f413e..0ab446f 100644--- a/crates/app/src/editor/panels.rs+++ b/crates/app/src/editor/panels.rs@@ -294,9 +294,13 @@ impl Editor {self.strip_more(ui, other, icons.1);return;}- [Cmd::Settings, Cmd::Numbers, Cmd::Palette].iter().for_each(|cmd| {- self.command_sized(ui, *cmd, None, icons.1, other);- });+ let developer = self.settings.developer;+ [Cmd::Settings, Cmd::Numbers, Cmd::Palette]+ .iter()+ .filter(|cmd| developer || !commands::DEVELOPER.contains(cmd))+ .for_each(|cmd| {+ self.command_sized(ui, *cmd, None, icons.1, other);+ });self.panels_menu(ui, other, icons.1);self.document_menu(ui, other, icons.1);self.strip_measured(size, None, Some(ui.min_rect().height()), ui.ctx());@@ -323,14 +327,18 @@ impl Editor {ui.separator();self.panel_checks(ui);ui.separator();- [Cmd::Palette, Cmd::Numbers, Cmd::Settings].into_iter().for_each(|cmd| {- if self.command_button(ui, cmd, Some(cmd.menu())).clicked() {- ui.close();- }- });+ let developer = self.settings.developer;+ [Cmd::Palette, Cmd::Numbers, Cmd::Settings]+ .into_iter()+ .filter(|cmd| developer || !commands::DEVELOPER.contains(cmd))+ .for_each(|cmd| {+ if self.command_button(ui, cmd, Some(cmd.menu())).clicked() {+ ui.close();+ }+ });}).0- .hint("the drawing, the panels, find a command, numbers and settings, in one menu while the window is this short");+ .hint("the drawing, the panels, find a command and settings, in one menu while the window is this short");}fn menu_bar(&mut self, ui: &mut egui::Ui) {@@ -800,7 +808,7 @@ impl Editor {let near_timeline = egui::pos2(screen.left() + strip + 16.0, (above - 300.0).max(screen.top() + 16.0));self.palette_window(ctx);self.toasts(ctx);- if self.settings.layout.numbers {+ if self.settings.layout.numbers && self.settings.developer {let mut open = true;Self::window(ctx,@@ -1124,7 +1132,11 @@ impl Editor {return;};let recent = self.recent_commands();- let found = commands::rank(&state.query, &recent);+ let developer = self.settings.developer;+ let found: Vec<Cmd> = commands::rank(&state.query, &recent)+ .into_iter()+ .filter(|c| developer || !commands::DEVELOPER.contains(c))+ .collect();let mut run = None;let modal = egui::Modal::new(Id::unique("palette")).show(ctx, |ui| {ui.set_width(560.0);diff --git a/crates/app/src/editor/prefs.rs b/crates/app/src/editor/prefs.rsindex 1283a51..3f4910f 100644--- a/crates/app/src/editor/prefs.rs+++ b/crates/app/src/editor/prefs.rs@@ -251,7 +251,17 @@ impl Editor {row_label(ui, "Panels");ui.vertical(|ui| {self.command_check(ui, Cmd::Timeline, "timeline");- self.command_check(ui, Cmd::Numbers, "numbers");+ if ui+ .checkbox(&mut self.settings.developer, "developer tools")+ .hint("for working on klad itself: the numbers window with its timings")+ .changed()+ {+ self.settings.layout.numbers &= self.settings.developer;+ self.settings_dirty = true;+ }+ if self.settings.developer {+ self.command_check(ui, Cmd::Numbers, "numbers");+ }if ui.button("reset the layout").hint("every panel back where it starts, at its first size")@@ -318,8 +328,10 @@ impl Editor {);}let filter = self.key_filter.trim().to_lowercase();+ let developer = self.settings.developer;let shown: Vec<Cmd> = Cmd::ALL.into_iter()+ .filter(|c| developer || !crate::commands::DEVELOPER.contains(c)).filter(|c| {filter.is_empty()|| c.spec().name.contains(filter.as_str())diff --git a/crates/app/src/editor/timeline.rs b/crates/app/src/editor/timeline.rsindex ba38123..7ee1e55 100644--- a/crates/app/src/editor/timeline.rs+++ b/crates/app/src/editor/timeline.rs@@ -956,7 +956,7 @@ impl Editor {if delta < 0 && end - cel.frame <= 1 {self.say(Tone::Refused,- format!("{} already shows for one frame; delete it instead", cel.id),+ "this drawing already shows for one frame; delete it instead".to_string(),);return Ok(());}@@ -1168,14 +1168,19 @@ impl Editor {};match exposed(layer, frame) {None => format!("{name}: frame {frame} is empty, a stroke starts a drawing"),- Some((cel, _)) if cel.link.is_some() => {- let source = cel.link.clone().unwrap_or_default();+ Some((cel, end)) if cel.link.is_some() => {+ let source = cel.link.as_deref().unwrap_or_default();+ let first = layer+ .cels()+ .iter()+ .find(|c| c.id == source)+ .map_or(String::new(), |c| format!(" from frame {}", c.frame));format!(- "draws into {source} on {name} through the link {} (it changes wherever {source} shows)",- cel.id+ "draws on {name}, {}, into the drawing{first}: it shows again here, so it changes wherever it shows",+ span(cel.frame, end))}- Some((cel, end)) => format!("draws into {} on {name}, {}", cel.id, span(cel.frame, end)),+ Some((cel, end)) => format!("draws on {name}, {}", span(cel.frame, end)),}}@@ -1308,6 +1313,8 @@ impl Editor {let Some(layer) = doc.locate_path(&row.path) else {return;};+ let numbers = drawing_numbers(layer);+ let number = |cel: &str| numbers.get(cel).map_or(String::new(), u32::to_string);blocks(layer, frames).iter().for_each(|b| {let end = match &self.timeline.drag {Some(Drag::Hold { cel, to, .. }) if *cel == b.cel => *to,@@ -1320,9 +1327,9 @@ impl Editor {_ => Color32::from_rgb(76, 104, 140),};let label = match &b.link {- Some(source) => format!("->{source}"),- None if b.tween => format!("{}*", b.cel),- None => b.cel.clone(),+ Some(source) => format!("->{}", number(source)),+ None if b.tween => format!("{}*", number(&b.cel)),+ None => number(&b.cel),};let moved_to = match &self.timeline.drag {Some(Drag::Move { cel, from, to }) if *cel == b.cel && from != to => Some(*to),@@ -1591,7 +1598,7 @@ impl Editor {});ui.menu_button("show a drawing here (link)", |ui| {drawings.iter().for_each(|(id, frame)| {- if ui.button(format!("{id} (frame {frame})")).clicked() {+ if ui.button(format!("the drawing at frame {frame}")).clicked() {chosen = Some(id.clone());ui.close();}@@ -1650,6 +1657,12 @@ impl Editor {}}+fn drawing_numbers(layer: &klad_core::doc::Layer) -> std::collections::BTreeMap<String, u32> {+ let mut drawings: Vec<_> = layer.cels().iter().filter(|c| c.link.is_none()).collect();+ drawings.sort_by_key(|c| c.frame);+ drawings.iter().zip(1..).map(|(c, n)| (c.id.clone(), n)).collect()+}+fn paint_block(painter: &egui::Painter, block: Rect, cw: f32, fill: Color32, label: &str, faded: bool) {let fill = if faded { fill.gamma_multiply(0.35) } else { fill };painter.rect_filled(block, 3.0, fill);diff --git a/crates/app/src/editor/ui_tests.rs b/crates/app/src/editor/ui_tests.rsindex 836c556..98a9e43 100644--- a/crates/app/src/editor/ui_tests.rs+++ b/crates/app/src/editor/ui_tests.rs@@ -123,7 +123,45 @@ fn controls(h: &Harness<'static, Editor>) -> Vec<(Role, String, Rect)> {.collect()}+fn internal(word: &str) -> bool {+ let mut chars = word.chars();+ let first = chars.next();+ let rest: String = chars.collect();+ let digits = !rest.is_empty() && rest.chars().all(|c| c.is_ascii_digit());+ let story = |head: char| {+ word.strip_prefix(head)+ .and_then(|r| r.split_once('.'))+ .is_some_and(|(a, b)| {+ !a.is_empty() && !b.is_empty() && (a.chars().chain(b.chars())).all(|c| c.is_ascii_digit())+ })+ };+ matches!(first, Some('c' | 'l' | 'n' | 's')) && digits || first == Some('M') && digits || story('S') || story('M')+}++fn developer_words(h: &Harness<'static, Editor>) -> Vec<String> {+ h.query_all(By::new().predicate(|n| n.label().is_some() || n.value().is_some()))+ .flat_map(|n| {+ let node = n.accesskit_node();+ [node.label(), node.value()].into_iter().flatten().collect::<Vec<_>>()+ })+ .filter(|text| {+ text.split(|c: char| !(c.is_ascii_alphanumeric() || c == '.'))+ .map(|w| w.trim_end_matches('.'))+ .any(internal)+ })+ .collect()+}++fn scan(h: &Harness<'static, Editor>, what: &str) {+ let found = developer_words(h);+ assert!(+ found.is_empty(),+ "{what}: internal ids or story numbers in sight: {found:#?}"+ );+}+fn audit(h: &Harness<'static, Editor>, what: &str) -> usize {+ scan(h, what);let hinted = theme::hinted(&h.ctx);let found = controls(h);let small: Vec<String> = found@@ -496,6 +534,7 @@ fn every_control_is_pen_sized_and_has_a_hover_hint() {});h.run_steps(2);checked += audit(&h, "points selected");+ h.state_mut().settings.developer = true;h.state_mut().settings.layout.numbers = true;h.state_mut().windows.settings = true;h.state_mut().windows.onion = true;@@ -783,6 +822,7 @@ fn ui_time_per_frame() {.filter(|(_, p)| p.join("doc.json").exists()).for_each(|(name, path)| {let mut h = harness(editor(&path), vec2(1600.0, 1000.0));+ h.state_mut().settings.developer = true;h.state_mut().settings.layout.numbers = true;h.state_mut().windows.log = true;h.state_mut().tool = Tool::Strokes;@@ -839,6 +879,7 @@ fn panel_pictures() {palette_field(&h).type_text("in");shot(&mut h, "4-palette");h.key_press(Key::Escape);+ h.state_mut().settings.developer = true;h.state_mut().settings.layout.numbers = true;h.state_mut().windows.settings = true;shot(&mut h, "5-numbers-and-settings");@@ -1410,6 +1451,7 @@ fn a_layer_made_and_activated_at_once_or_mid_refill_still_draws() {fn switching_layers_keeps_the_canvas_unless_the_picture_changes() {let path = sample("switch");let mut h = harness(editor(&path), vec2(1440.0, 900.0));+ h.state_mut().settings.developer = true;settle(&mut h, |ed| ed.canvas_current() && ed.dirty.is_empty());let all = h.state().scene.all_tiles().len();let switch = |h: &mut Harness<'static, Editor>, name: &str| {@@ -1870,7 +1912,7 @@ fn an_agent_edit_while_the_editor_is_open_shows_in_the_history_and_keeps_its_aut};assert_eq!(first(&mut h), ("agent".into(), "stroke on l6".into(), false));assert!(- h.query_all(By::new().role(Role::Button).label_contains("agent stroke on l6"))+ h.query_all(By::new().role(Role::Button).label_contains("agent stroke on lines")).count()> 0);@@ -4342,3 +4384,70 @@ fn help_opens_the_guides_and_whats_new() {});let _ = std::fs::remove_dir_all(&path);}++#[test]+fn internal_words_are_recognised() {+ ["c12", "l6", "n357", "s4", "M14", "S14.5", "M4.5"]+ .into_iter()+ .for_each(|w| assert!(internal(w), "{w}"));+ ["layer", "12", "2s", "s", "c", "1.000", "klad", "S", "Esc"]+ .into_iter()+ .for_each(|w| assert!(!internal(w), "{w}"));+}++#[test]+fn no_tool_shows_internal_ids_or_story_numbers() {+ let path = sample("no-ids");+ let mut h = harness(editor(&path), vec2(1440.0, 900.0));+ activate(&mut h, "lines");+ h.run_steps(3);+ scan(&h, "the default layout");+ [+ Tool::Brush,+ Tool::Fill,+ Tool::Select,+ Tool::Strokes,+ Tool::Direct,+ Tool::Pen,+ Tool::Shape,+ Tool::Text,+ Tool::Note,+ Tool::Bone,+ ]+ .into_iter()+ .for_each(|tool| {+ h.state_mut().tool = tool;+ h.run_steps(2);+ scan(&h, &format!("{tool:?}"));+ });+ let _ = std::fs::remove_dir_all(&path);+}++#[test]+fn the_numbers_need_developer_tools_and_notes_start_folded() {+ let path = sample("developer");+ let mut h = harness(editor(&path), vec2(1440.0, 900.0));+ let fresh = crate::layout::Layout::default();+ [Pane::Notes, Pane::History].into_iter().for_each(|pane| {+ assert!(+ fresh.panes.iter().any(|p| p.pane == pane && p.collapsed),+ "{pane:?} starts folded"+ );+ });+ assert!(!h.state().settings.developer, "developer tools start off");+ h.state_mut().invoke(Cmd::Numbers).unwrap();+ h.run_steps(2);+ assert!(+ !h.state().settings.layout.numbers,+ "the numbers stay closed without developer tools"+ );+ assert!(+ h.query_by_label(theme::icon::NUMBERS).is_none(),+ "and the strip has no numbers button"+ );+ h.state_mut().settings.developer = true;+ h.state_mut().invoke(Cmd::Numbers).unwrap();+ h.run_steps(2);+ assert!(h.state().settings.layout.numbers, "with developer tools on they open");+ let _ = std::fs::remove_dir_all(&path);+}diff --git a/crates/app/src/settings.rs b/crates/app/src/settings.rsindex 739296c..26d3a68 100644--- a/crates/app/src/settings.rs+++ b/crates/app/src/settings.rs@@ -87,6 +87,8 @@ pub struct Settings {pub welcomed: bool,#[serde(default = "yes", rename = "pickAllLayers")]pub pick_all_layers: bool,+ #[serde(default, rename = "developerTools", skip_serializing_if = "std::ops::Not::not")]+ pub developer: bool,}fn yes() -> bool {@@ -110,6 +112,7 @@ impl Default for Settings {updates_checked: 0,welcomed: false,pick_all_layers: true,+ developer: false,}}}diff --git a/crates/core/src/ops.rs b/crates/core/src/ops.rsindex 2a9e4e6..c239c42 100644--- a/crates/core/src/ops.rs+++ b/crates/core/src/ops.rs@@ -2792,7 +2792,12 @@ fn assign_layer_ids(doc: &mut Document, taken: &mut BTreeSet<String>, value: &mu.to_string();let id = ensure_id(doc, taken, value, 'l')?;if value.get("name").is_none() {- value["name"] = Value::String(format!("{kind} {id}"));+ let names: BTreeSet<String> = doc.all_layers().iter().map(|l| l.name.clone()).collect();+ let name = (1..)+ .map(|n| format!("{kind} {n}"))+ .find(|n| !names.contains(n))+ .unwrap_or_default();+ value["name"] = Value::String(name);}match kind.as_str() {"paint" | "vector" => {diff --git a/docs/DESIGN.md b/docs/DESIGN.mdindex 16036bb..9ce5886 100644--- a/docs/DESIGN.md+++ b/docs/DESIGN.md@@ -435,13 +435,13 @@ Scripts are any language that prints edit ops as JSON lines into `klad apply`. G## The editor- Canvas: pan, zoom, rotate; pen pressure, tilt and eraser end; 120 Hz on Apple Silicon. The window around the canvas is a neutral grey (`theme::SURROUND`), so colours read true.-- Layout (M4 batch 1): a tool strip on the left (the tools with their key letter, undo and redo, and at its foot the document and panels menus, the command palette, numbers and settings; the strip only has the height between the menu bar and the timeline, so when both groups do not fit its buttons shrink from 36 to 28 pt, then the foot folds into one menu pinned at the bottom, and last the tools scroll, never overlapping; each size is measured as it is drawn, so the choice does not flicker); a dock on the right holding panes (colour, brush, layers, layer settings (`Pane::Inspector` in code), notes for the agent, history), each with a title row that folds it, closes it and, dragged at its top edge, resizes the pane above; the timeline along the bottom, resizable and foldable to its toolbar; a status line under everything. Panes share the dock's height: they keep the sizes the user gave them, the last open one takes what is left, and when they do not fit they shrink towards their minimums and scroll inside (`layout::Layout::bodies`). Tab hides every panel but the status line, shift Tab the dock. Which panels are open, the dock's width, the timeline's height and each pane's size are kept in the user's settings (`layout`) and restored, clamped to the window. Pen calibration lives in the settings modal (cmd ,); the performance numbers in a numbers window that can stay open over the canvas.+- Layout (M4 batch 1): a tool strip on the left (the tools with their key letter, undo and redo, and at its foot the document and panels menus, the command palette, settings and, with developer tools on, numbers; the strip only has the height between the menu bar and the timeline, so when both groups do not fit its buttons shrink from 36 to 28 pt, then the foot folds into one menu pinned at the bottom, and last the tools scroll, never overlapping; each size is measured as it is drawn, so the choice does not flicker); a dock on the right holding panes (colour, brush, layers, layer settings (`Pane::Inspector` in code), notes for the agent, history), each with a title row that folds it, closes it and, dragged at its top edge, resizes the pane above; the timeline along the bottom, resizable and foldable to its toolbar; a status line under everything. Panes share the dock's height: they keep the sizes the user gave them, the last open one takes what is left, and when they do not fit they shrink towards their minimums and scroll inside (`layout::Layout::bodies`). Tab hides every panel but the status line, shift Tab the dock. Which panels are open, the dock's width, the timeline's height and each pane's size are kept in the user's settings (`layout`) and restored, clamped to the window. Pen calibration lives in the settings modal (cmd ,); the performance numbers in a numbers window that can stay open over the canvas, shown only with developer tools on (Settings > Layout, `developerTools`, off by default; `commands::DEVELOPER` lists its commands, which are in no menu, not in the palette and refused without it).- Commands (M4 batch 1): every editor action is a `Cmd` in one list (`commands.rs`): an id (`tool.brush`, `drawing.new`, kept in settings), a name in plain words, a Phosphor icon, a group, its keys or the hold that triggers it, whether a held key repeats it, and a line on what it does. Keys, the strip, panel buttons, the timeline's buttons and context menu, and the palette all run commands through `Editor::invoke`, which first asks `can_run` (a reason when it cannot, shown as a refusal) and remembers the last twelve run. A key matches only with exactly its modifiers (shift K is not K); key repeats run commands that repeat (`=`, `[`, cmd Z) and frame steps only once the frame on screen caught up. cmd K opens the palette: type to filter (name start, then a key, a word, a substring, the letters in order, the group; hyphens ignored, so "inb" finds in-between), arrows and Return run, rows grey out with the reason, recent commands first; `?` opens it too. Every control has a hover hint after 0.35 s (from its command where there is one) and is at least 24 pt high; a test walks every control of every panel and window to keep it so.- Tool options and selections (M4 batch 2): a bar over the canvas holds the active tool's settings (brush: picker, size, opacity, flow, and a "more" menu for hardness, lightest size, curve, taper, stabiliser and smoothing; fill: reference, gap, tolerance, grow, opacity; strokes: cut at the lasso edge, select all; points: corner, smooth, simplify, make it a path). The strip shows the eraser while the eraser brush or the pen's eraser end is on, and two colours (the current one over the second; X or a click swaps them; picking a colour from a swatch, the hex field or the eyedropper makes the old one the second). cmd alt drag sideways on the canvas sizes the brush (doubling every 120 pt), the circle staying where the drag began. H flips the view left-right (the view's mappings and the GPU matrix mirror; the document does not change); the status line's zoom takes a click for 100% and a double-click to fit, its rotation a click to turn upright. A selection bar sits under (or over) the selection's box: for strokes flips, quarter turns, recolour, thinner, thicker, opacity, copy, paste, duplicate in place, delete, deselect; for a shape flips (sx or sy negated and its rotation mirrored), quarter turns, fill with the colour and outline in the colour (rectangles, ellipses, paths and text: `fill`, or `stroke.paint`, or a new `stroke` at the pen's width when it had none; Edit > Shape; `klad set <id> fill=...` is the CLI form), duplicate in place (an `add` of the node without ids, above it), delete, deselect; for points corner, smooth, nudges, delete. Arrows nudge strokes, a shape or points by 1 px, 10 px with shift. Strokes select across layers (M5 batch 2 round 1): cmd or shift click on rows in the layers panel adds paint layers to the active one (marked with a blue edge); S then lassos, clicks and selects all on all of them, and the selection (one part per layer) moves, turns, scales, flips, recolours, cuts at the lasso edge, copies and deletes as one edit, each layer's marks staying on their layer. A selection on several layers moves as one edit, each layer previewed while it is dragged; copies of several layers paste back into their own layers, a copy of one layer into the active one. The strip's panels button lists the six panels and the timeline with a tick each, so a closed panel always has a way back. U draws rectangles and ellipses on a vector layer (shift for a square or circle, alt from the centre, rounded corners for rectangles; fill, outline and width shared with the pen, the fill in the first colour and the outline in the second, as for the pen's paths) as `rect` and `ellipse` nodes. Mirror painting (the brush bar's "mirror" and its axis) paints every stroke's mirror image as it is drawn, in a second stroke buffer landed after the first, and commits both as plain marks in one history step. Handles are drawn at 12 pt and hit within 12 pt (`grab`); a press becomes a drag once it has moved 3 pt on screen, so a tap that wobbles selects and does not move; shapes whose rotation is a quarter turn get edge handles too (`lift::stretched` scales their own axis). Pen events that arrive while a point edit is being written are held and replayed in order after it. The colour pane shows the picker and the palette (swatches drag to reorder; the x in a hovered swatch's corner, or a right-click, removes it) and recent colours; the brush pane (its own since 2026-11-08, Kevin: "make brush its own palette, like colour and layers") the size presets and the brushes as tiles, each with a sample stroke drawn by `klad-brush` once per brush definition. A saved layout without a pane gets it after the pane it follows by default.- First start (S8.7, `start.rs`, `editor/first.rs`, `klad_core::samples`): until the settings say `welcomed` (set when any drawing opens, or by "Not now"), the start window opens with a welcome offering first steps. First steps make `first steps.klad` (1280 by 800 on paper, one paint layer) in the drawings folder and open it with a small window of three steps that tick as they happen: a brush stroke is saved, a fill is saved, the request for an agent is copied (a sentence with the drawing's path asking the agent to read `klad skill`, render the drawing and add a shadow; "install the klad command" sits next to it). Help > First steps opens and closes the window on any drawing. The checklist is the editor's alone: it teaches the hands on the canvas, and an agent's first steps are `klad skill`. Revisit the third step when klad is an MCP server (S8.10). Under the recent drawings the start window shows the samples: the drawings `samples/shipped.json` names (name, bundle, a line on what it shows), each a card with its thumbnail and that line; a click copies it into the drawings folder without its `.cache` (`samples::copy`, `<name>.klad` or `<name> 2.klad`) and opens the copy, so a sample is never changed. `klad samples` lists the same set and `--copy <name> [--into folder]` copies one (default the current folder). Samples are found like the fonts: `KLAD_SAMPLES`, then `samples/` next to the binary, `../Resources/samples`, `../share/klad/samples`, and a source checkout's `samples/` up to five folders above the binary (where they exist after `just samples`; a sample not built is left out). `packaging/samples.sh` puts them in every build: it builds any that are missing with that build's `klad` (through the sample's `build.sh`, `PYTHON` naming the interpreter), copies them without caches, and renders each one's `<name>.thumb.png` next to it at 336 px, so the start window never renders into the app (a thumbnail outside the bundle is used as it is; only recent drawings' `.cache/thumb.png` are remade when the drawing changes). `app.sh` puts them in `Resources/samples`, `archive.sh` in the archive's `samples/` and the AppImage's `usr/share/klad/samples`; the six weigh about 4 MB.- Messages and problem reports (S8.8, `report.rs`): a message says what happened and what to do next ("nothing to fill there: click inside closed lines, or raise the gap so small openings close"); a refusal names the step that makes the command possible. Errors that mean klad itself went wrong (an invariant broken, a picture missing that should be there) are `report::Bug`s: the editor says "something went wrong inside klad (what), everything up to your last edit is saved; Help > Report a problem sends it to [email protected] or to klad's issues" instead of the bare detail; a job whose CLI crashed reads the same, and a job that failed says "<job> did not finish: <the CLI's reason>". Every error message, job failure and crash of the editor or the CLI is appended to `klad.log` next to the settings (`KLAD_LOG` overrides it; past 512 KB the older half goes), one dated line each. Help > Report a problem opens a window with the report as it will be copied: klad's version and where it ran, the system (macOS version, the Linux distribution, Windows' version, and the processor), a place for what happened, the drawing's size, the last 40 messages and the last 40 lines of the log, with the home folder written as `~` and the drawing's folder as `<the drawing's folder>`. "include the drawing" zips the drawing without its cache next to it (`<name> for a report.zip`, stored entries, written by klad itself) and the report names the file to attach; "copy the report" copies it, "email it to support" opens an email to the support address with the report in it (the person attaches the zip), and "open klad's issues" opens GitHub. Help > Contact support opens an email with the version and the system filled in, and About links klad.studio and the address. Help > Guides and Help > What's new open the guides and the changelog on klad.studio, and the start window's welcome links the guides. The address, the site, the issues page, the guides and the changelog are constants in `klad_core::contact`; the site's sync reads the address from there. Nothing is sent by klad. `klad report [--drawing <bundle>]` prints the same report from the command line (version, system, log, the drawing zipped).-- Menus (S8.6, `commands::MENUS`, `menus.rs`): one list of menus holds every command but the holds (pan, zoom, the eyedropper, flipping, rolling, the parallax preview and sizing on the canvas, which are gestures), so the menus, the palette and the keys stay one list; a test fails when a command is in no menu or in two. The menus, in order: File (new, open, recent, close; import; export; the path and the command line tool), Edit (undo; copy, paste, duplicate, delete; selecting; Transform, Strokes and Points submenus), Tools (the tools, the brush, the colours), Layer (new, duplicate, rename, group, delete; show, lock, clip, lock alpha; Mask and Shape generators submenus, paint over; refill and gaps), Frame (stepping, drawings, holds and moves, inserting and removing frames), Animation (playback, onion skin, exposure, Selected frames and Clip submenus, the checks across frames), View (zoom, rotation, flip, the reference), Window (the panels, the message log, numbers) and Help. Each command has a short menu label (`Cmd::menu`: "Show", "Clip to layer below", "Export…"), since the menu says what it acts on, while the palette and hints keep the longer names; "…" marks a command that opens a window. Items show one key each (Backspace for delete); toggles show a tick, except commands that open a window; a command that cannot run now is greyed out (its reason is the palette's). A test keeps labels unique in each menu and under 30 characters. On macOS the list becomes the system menu bar (`menus::install`, rebuilt when the keys or the recent drawings change): an app menu with About, Settings, Services, hide and Quit, then the list, whose Window menu also gets the system's Minimize, Zoom and Bring all to front (it is the app's windows menu). Items target one Objective-C object (`KladMenuTarget`, `define_class!`) whose `kladRun:` queues the command for the next frame (the editor runs it through `Editor::invoke` as any key would) and whose `validateMenuItem:` reads a snapshot of what is off and on that the app refreshes every 0.4 s. The item keys are shown but not claimed: the object is each menu's delegate and answers no to `menuHasKeyEquivalent:forEvent:target:action:`, so a key still reaches the editor's own dispatch (which knows holds, repeats and text fields) and nothing runs twice; only the app menu's own keys (cmd , cmd Q cmd H) and Window's cmd M are AppKit's. On Windows and Linux (and in tests) the same list is an egui menu bar over the window, hidden with the panels (Tab). File > Open recent lists the last ten drawings; File > Close the drawing (cmd W, refused while a job runs) goes back to the start window, where only new, open, recent and quit run. Settings and Quit sit in the app menu on macOS and in Edit and File elsewhere; About (with the licences) is in Help everywhere and also in the macOS app menu.-- Messages and jobs (M4 batch 1): every result, refusal and error goes through `Editor::say` with a tone (info, done, refused, error). Done and refused messages show for 3.5 and 6 s as a toast in the bottom left corner of the canvas, newest lowest (2026-11-08: they used to follow the pointer, which got in the way), errors until dismissed, info only in the status line; the status line shows the latest message (a click opens the message log, the last 200 with times), the frame, where the next stroke goes ("draws into c12 on lines, frames 4 to 7"), running jobs with a cancel button, slow internal work (preparing a selection, drawing an edited path, loading a frame), zoom and rotation. Times that used to be status text (stroke, fill, edit, undo, sync, frame step, last play, last job) are kept by name for the numbers window. Background jobs (in-betweens, Godot export) run the same `klad` binary through one job list (`jobs.rs`); when the CLI exits with code 75 (the document changed while it computed) the job runs again, up to three times, so an edit made in the editor meanwhile is never overwritten.+- Menus (S8.6, `commands::MENUS`, `menus.rs`): one list of menus holds every command but the holds (pan, zoom, the eyedropper, flipping, rolling, the parallax preview and sizing on the canvas, which are gestures), so the menus, the palette and the keys stay one list; a test fails when a command is in no menu or in two (the developer tools are the exception: in none). The menus, in order: File (new, open, recent, close; import; export; the path and the command line tool), Edit (undo; copy, paste, duplicate, delete; selecting; Transform, Strokes and Points submenus), Tools (the tools, the brush, the colours), Layer (new, duplicate, rename, group, delete; show, lock, clip, lock alpha; Mask and Shape generators submenus, paint over; refill and gaps), Frame (stepping, drawings, holds and moves, inserting and removing frames), Animation (playback, onion skin, exposure, Selected frames and Clip submenus, the checks across frames), View (zoom, rotation, flip, the reference), Window (the panels, the message log) and Help. Each command has a short menu label (`Cmd::menu`: "Show", "Clip to layer below", "Export…"), since the menu says what it acts on, while the palette and hints keep the longer names; "…" marks a command that opens a window. Items show one key each (Backspace for delete); toggles show a tick, except commands that open a window; a command that cannot run now is greyed out (its reason is the palette's). A test keeps labels unique in each menu and under 30 characters. On macOS the list becomes the system menu bar (`menus::install`, rebuilt when the keys or the recent drawings change): an app menu with About, Settings, Services, hide and Quit, then the list, whose Window menu also gets the system's Minimize, Zoom and Bring all to front (it is the app's windows menu). Items target one Objective-C object (`KladMenuTarget`, `define_class!`) whose `kladRun:` queues the command for the next frame (the editor runs it through `Editor::invoke` as any key would) and whose `validateMenuItem:` reads a snapshot of what is off and on that the app refreshes every 0.4 s. The item keys are shown but not claimed: the object is each menu's delegate and answers no to `menuHasKeyEquivalent:forEvent:target:action:`, so a key still reaches the editor's own dispatch (which knows holds, repeats and text fields) and nothing runs twice; only the app menu's own keys (cmd , cmd Q cmd H) and Window's cmd M are AppKit's. On Windows and Linux (and in tests) the same list is an egui menu bar over the window, hidden with the panels (Tab). File > Open recent lists the last ten drawings; File > Close the drawing (cmd W, refused while a job runs) goes back to the start window, where only new, open, recent and quit run. Settings and Quit sit in the app menu on macOS and in Edit and File elsewhere; About (with the licences) is in Help everywhere and also in the macOS app menu.+- Messages and jobs (M4 batch 1): every result, refusal and error goes through `Editor::say` with a tone (info, done, refused, error). Done and refused messages show for 3.5 and 6 s as a toast in the bottom left corner of the canvas, newest lowest (2026-11-08: they used to follow the pointer, which got in the way), errors until dismissed, info only in the status line; the status line shows the latest message (a click opens the message log, the last 200 with times), the frame, where the next stroke goes ("draws on lines, frames 4 to 7"), running jobs with a cancel button, slow internal work (preparing a selection, drawing an edited path, loading a frame), zoom and rotation. Times that used to be status text (stroke, fill, edit, undo, sync, frame step, last play, last job) are kept by name for the numbers window. Nothing a user sees names an internal id: the status line, layer settings, the selection, the in-between window, undo messages and the history pane say layers by name and drawings by frame (`Editor::plain` rewrites history summaries and CLI reports), the timeline numbers each layer's drawings 1, 2, 3 in frame order, and new layers are named "paint 1", "vector 2" instead of by id. A kittest scan (`scan` in the control audit and over every tool) fails on an id (`c12`, `l6`, `n357`, `s4`), a milestone or a story number in any visible label. Background jobs (in-betweens, Godot export) run the same `klad` binary through one job list (`jobs.rs`); when the CLI exits with code 75 (the document changed while it computed) the job runs again, up to three times, so an edit made in the editor meanwhile is never overwritten.- Tools: brush, eraser, smudge, fill (inside lines, gap closing), lasso select and transform, move/rotate/scale handles, path point editing, eyedropper.- Stroke select (S, M2): a click picks the mark you see under the pointer. With "all layers" (the S and V options and Edit > Pick from all layers, `pickAllLayers` in the settings, on by default) that is on the topmost visible, unlocked paint layer that shows paint there, which becomes active: a layer shows paint where its raster's alpha, times its own and its groups' opacity, outside its mask and inside its clip base, passes 5%, and a layer whose pixels are not loaded counts by its marks' shapes (`Scene::seen_at`, `Scene::marks_at`); with "this layer" it is the active layer. In that layer the mark is the topmost one covering the point (inside a stroke's painted width or a fill's coverage, never an eraser stroke), and only when none covers it does one within 5 pt of the point count, so a thin line is still easy to take (`markedit::pick`); when no layer shows paint there, the topmost mark within those 5 pt on any of the layers is taken. A shift click adds or removes on the active layer, a dragged loop picks every stroke whose samples are all inside it and every fill whose pixels are, shift adds or toggles. With "a lasso cuts strokes at its edge" (on by default) the loop also takes the parts of strokes and fills crossing it: the selection shows the dashed lasso and the parts that will move, and the first edit (move, recolour, delete, ...) writes one `lasso` op that splits them, after which the selection is the moved marks. The selection shows as thin lines and a box with corner handles (uniform scale), edge handles (stretch one axis; dragging past the other edge flips) and a rotate knob; dragging moves it on the GPU (the selected marks drawn alone, over the cel replayed without them) and release writes one `transform` or `lasso` op. Layer settings recolour (the current colour), makes thinner or thicker, sets opacity, flips left-right or up-down and deletes, each as one history step. The selection is shared with the agent as addresses.- Layers (M2 batch 4): layer settings sets clip to the layer below and lock alpha, adds a mask (empty, or hiding all), turns it on and off, removes it, and "paint on the mask" makes the mask the active layer (it also has its own row under its layer). Painting on a mask hides the layer under the strokes; the eraser shows it again. While a mask is active, what it hides is tinted red ("show the mask in red", on by default), and the brush panel says whether the brush or the eraser is on. The brush and fill tools record lock alpha from the active layer.@@ -477,7 +477,7 @@ Scripts are any language that prints edit ops as JSON lines into `klad apply`. G- In-between panel (M4 batch 4, `editor/between.rs`): "in-between" (the selection toolbar, the context menu, cmd K) opens a window instead of a menu: the first selected row's two keys as thumbnails with their frames (a frame not loaded yet says so), one on every frame or a count, spacing with the chart an animator draws between keys (key ticks at the ends, a tick per in-between where the spacing puts it), pairing (id, order, nearest shape; parts both keys have are named, they pair first), marks in one key only (leave, pop, fade, draw-on), and "make the in-betweens", which runs `klad inbetween` as a job (`between::args`). When the job ends its output is parsed into rows (`between::report`): each layer's pairs, parts and touching ends; an unpaired mark is a button that goes to the other key's frame, turns on the stroke tool and waits for one stroke to be picked, then makes the in-betweens again with that pair added to `--pair` (`pair_from`); a fill left out goes to its frame. "Check what a redo would remake" lists the in-betweens of the selection (or all) with their state from their marks' hash and authors (`redo_rows`): remade, drawn on by hand (keep them on top, the default; in-between them too; leave it) or edited (in-between it again, or leave it, the default); "redo them" runs one `klad inbetween --redo --only ... --keep-cels ... --force-cels ...`, one history step.- History (M4 batch 4, `editor/history.rs`): the History pane lists the redo stack (as "undone" with who made the step, farthest first), a "the document is here" marker and the undo stack, latest first: who (you for the editor, the agent for the CLI), what, how long ago. Clicking a row undoes or redoes as many steps as it takes to stand right after it (`steps_to`), timed in the status line. The list is read again when the document's revision changes.- Notes on the canvas (M4 batch 4, `editor/pins.rs`): every open note is a pin, those of other frames dimmed with their frame, done ones on this frame checked in green. With the note tool a click on a pin opens its popover (the text to edit and save, done, remove, close); elsewhere it opens a popover for a new note at that spot ("pin it"). A right click on any pin, of this frame or a dimmed one of another, goes to its frame and selects it (an accent ring and its popover); Delete removes the selected note. The Notes pane lists the open notes (a click goes to the frame and opens the pin) and the done ones folded, each can be opened again; every note is one line, cut to the pane's width (a done note's "open again" is laid out first, at the right, so the row never runs past the pane), and "clear all" beside the done header removes the done notes (`notes::clear_done`, `klad notes --clear-done`). The editor watches `.cache/notes.json`, so the agent's `klad notes --done` shows at once.-- Settings (M4 batch 4, `settings.rs`, `editor/prefs.rs`): the settings file carries a `version` (2; files without one, the M1 to M4 ones, load with the new fields at their defaults and are stamped 2), `keys` (command id to key labels such as `shift D`, only the changed ones), `uiScale` (0.75 to 2, egui's zoom factor, so every control grows with it) and `defaults` (brush and size for new windows, the shift K exposure, onion before, after and opacity, the grey around the canvas). Settings is a modal (cmd , or klad > Settings…; Esc, the close button or a click outside closes it, except while a new key is being pressed) with a sidebar of five sections and one section in the body at a time (`editor/prefs.rs`, `prefs::Section`): Pen (the pressure bars, lightest, heaviest, curve and the response graph), Drawing (the brush and size new windows start with, how long shift K's drawings hold, onion skin, the grey around the canvas), Keys (search, change by pressing the key, no key, reset one or all; the list fills the body), Layout (interface size, the timeline and numbers, reset the layout) and Updates (this version, the daily check, check now). Each section is a two-column grid, the label in grey on the left. While the modal is open the editor's own keys do nothing except cmd , (the modal blocks the pointer, and now the keys too). `commands::Bindings` holds the keys: a changed command's keys replace its first ones, a key another command already uses is refused and that command named (`taken_by`), holds (Q, W, space) keep their keys, and every key lookup (dispatch, hints, the palette, the strip's letters) goes through it.+- Settings (M4 batch 4, `settings.rs`, `editor/prefs.rs`): the settings file carries a `version` (2; files without one, the M1 to M4 ones, load with the new fields at their defaults and are stamped 2), `keys` (command id to key labels such as `shift D`, only the changed ones), `uiScale` (0.75 to 2, egui's zoom factor, so every control grows with it) and `defaults` (brush and size for new windows, the shift K exposure, onion before, after and opacity, the grey around the canvas). Settings is a modal (cmd , or klad > Settings…; Esc, the close button or a click outside closes it, except while a new key is being pressed) with a sidebar of five sections and one section in the body at a time (`editor/prefs.rs`, `prefs::Section`): Pen (the pressure bars, lightest, heaviest, curve and the response graph), Drawing (the brush and size new windows start with, how long shift K's drawings hold, onion skin, the grey around the canvas), Keys (search, change by pressing the key, no key, reset one or all; the list fills the body), Layout (interface size, the timeline, developer tools and with them the numbers, reset the layout) and Updates (this version, the daily check, check now). Each section is a two-column grid, the label in grey on the left. While the modal is open the editor's own keys do nothing except cmd , (the modal blocks the pointer, and now the keys too). `commands::Bindings` holds the keys: a changed command's keys replace its first ones, a key another command already uses is refused and that command named (`taken_by`), holds (Q, W, space) keep their keys, and every key lookup (dispatch, hints, the palette, the strip's letters) goes through it.- Export to Godot (M3 batch 3): the clip row has a "Godot folder" field (the document's `export.godot`; a typed folder is relative to the folder holding the bundle) and an "export to Godot" button, which runs `klad export <bundle> --godot` (with the typed folder and `--store` when it differs) as a background job of the same binary, so the CLI and the editor write the same files; its summary or error is a message.- CLI forms in the editor (M5, S5.25, `editor/checks.rs`, `editor/export.rs`): refill this drawing and show gaps (the fill tool's options and the palette), fill like the first drawing (the timeline selection toolbar), a part name for the selected marks (layer settings for strokes, the `part` op), show parts and show arcs of the selected mark or part over the clip (the palette), an export window (the document menu, cmd E: this frame, a layer, numbered frames or a sprite sheet, and Godot) and add a font file (the document menu and layer settings for text, with the macOS open panel). The text tool (T, S5.26, `editor/text.rs`): a click starts a text on the active vector layer (or a new one when it is committed), typing shows on the canvas at once as a picture drawn by the same renderer while the node stays out of the document (an existing node is hidden in memory while it is edited), and Esc, a click outside or another tool commits it as one edit; a double click on text with V or T edits it in place. While typing the canvas holds egui's keyboard focus, so command keys type instead of switching tools. The font picker (the tool's options and layer settings for text) lists klad's families drawn in their own face, the drawing's own files and, for a search, open families to download as a background `klad fonts --get` job. Paint with body (S5.23): a body slider at the top of the brush window, and relief in the effects of layer settings with a light dial (click or drag towards the light). Everything but the part name runs the `klad` binary as a background job with the same arguments a person would type (`crate::start::draw_binary` finds it next to the editor, and next to the test binaries in tests), so the CLI and the editor do the same thing by construction; gaps and arcs read the command's `--json` and draw on the canvas until the next edit. The ops that draw from shapes (`ink`, `light`, `hatch`, `paint`, `scatter`) stay CLI only (principle 7).- Agent channel: the current selection and pinned notes are written to `.cache/selection.json` and `.cache/notes.json` for `klad selection` and `klad notes`; both carry the frame.