Fit and redo find their own buttons
Browse files at this commit7b04d8867d68d76162f4c12995c0b60f24cd26e1Parent: bdb07d9- feat
- fit and redo find their own buttons
3 changed files +99 -1
- crates/app/src/tests/layout.rs +74 -0
- crates/app/src/ui/dock_stance.rs +17 -0
- crates/app/src/ui/spine_stance.rs +8 -1
crates/app/src/tests/layout.rsmodified+74 -0
| @@ -2272,3 +2272,77 @@ fn settings_project_rows_have_no_bare_noun_placeholder() { | |||
| 2272 | ); | 2272 | ); |
| 2273 | } | 2273 | } |
| 2274 | } | 2274 | } |
| 2275 | + | ||
| 2276 | +/// The parity class this user has reported four separate times: "some | ||
| 2277 | +/// options are only reachable via keyboard shortcut". A source scan (this | ||
| 2278 | +/// binary has no `TestAppContext` to click through) over every darkroom | ||
| 2279 | +/// surface -- the spine, the dock, the bench/timeband transport, the | ||
| 2280 | +/// settings page, the maximized cards and the clip context menu | ||
| 2281 | +/// (`menus.rs`'s `MENU_ITEMS`, rendered mouse-and-chord-visible by | ||
| 2282 | +/// `overlays.rs`) -- for a literal `ActionId::<variant>` mention. An | ||
| 2283 | +/// [`ActionId`] reachable by chord ([`Keymap::defaults`]) but absent from | ||
| 2284 | +/// every one of those texts has no mouse door into the darkroom at all, | ||
| 2285 | +/// which is exactly this bug's shape (`Fit` and `Redo` shipped that way | ||
| 2286 | +/// until this commit). | ||
| 2287 | +/// | ||
| 2288 | +/// [`ActionId::Resolution`] and [`ActionId::SubtitleStyle`] are the two | ||
| 2289 | +/// deliberate exceptions: their settings-page rows open them through | ||
| 2290 | +/// `Pick::Resolution` and `open_subtitle_style(cx)` respectively, never | ||
| 2291 | +/// spelling the action name itself, so each is matched on its own door | ||
| 2292 | +/// string instead. | ||
| 2293 | +/// | ||
| 2294 | +/// [`ALLOWED_CHORD_ONLY`] is the honest remainder: fine-grained playhead/edit | ||
| 2295 | +/// strokes with no button in the *legacy* tree either (`toolbar.rs`, | ||
| 2296 | +/// `inspector.rs`, `library.rs` were all swept for the same names and come | ||
| 2297 | +/// up equally empty) -- not a regression this task closes, just an existing | ||
| 2298 | +/// keyboard-only stroke this editor has never given a face. | ||
| 2299 | +#[test] | ||
| 2300 | +fn every_chord_bound_action_has_a_darkroom_affordance_or_is_named_chord_only() { | ||
| 2301 | + use crate::ActionId; | ||
| 2302 | + const ALLOWED_CHORD_ONLY: &[ActionId] = &[ | ||
| 2303 | + ActionId::StepBack, | ||
| 2304 | + ActionId::StepForward, | ||
| 2305 | + ActionId::GoStart, | ||
| 2306 | + ActionId::GoEnd, | ||
| 2307 | + ActionId::PrevSyncPoint, | ||
| 2308 | + ActionId::NextSyncPoint, | ||
| 2309 | + ActionId::WalkCutNext10, | ||
| 2310 | + ActionId::WalkCutPrev10, | ||
| 2311 | + ActionId::SetIn, | ||
| 2312 | + ActionId::SetOut, | ||
| 2313 | + ActionId::ClearRange, | ||
| 2314 | + ActionId::SelectAll, | ||
| 2315 | + ActionId::RemoveVideoLane, | ||
| 2316 | + ActionId::RemoveAudioLane, | ||
| 2317 | + ActionId::Crossfade, | ||
| 2318 | + ]; | ||
| 2319 | + let darkroom = [ | ||
| 2320 | + "ui/bench_stance.rs", | ||
| 2321 | + "ui/cards.rs", | ||
| 2322 | + "ui/dock_stance.rs", | ||
| 2323 | + "ui/overlays.rs", | ||
| 2324 | + "ui/settings_stance.rs", | ||
| 2325 | + "ui/spine_stance.rs", | ||
| 2326 | + "ui/stance.rs", | ||
| 2327 | + "ui/timeband_stance.rs", | ||
| 2328 | + "ui/timeline.rs", | ||
| 2329 | + "menus.rs", | ||
| 2330 | + ] | ||
| 2331 | + .map(src_text) | ||
| 2332 | + .join("\n"); | ||
| 2333 | + for action in ActionId::ALL { | ||
| 2334 | + if ALLOWED_CHORD_ONLY.contains(&action) { | ||
| 2335 | + continue; | ||
| 2336 | + } | ||
| 2337 | + let name = format!("{action:?}"); | ||
| 2338 | + let mentioned = darkroom.contains(&format!("ActionId::{name}")) | ||
| 2339 | + || (action == ActionId::Resolution && darkroom.contains("Pick::Resolution")) | ||
| 2340 | + || (action == ActionId::SubtitleStyle && darkroom.contains("open_subtitle_style(cx)")); | ||
| 2341 | + assert!( | ||
| 2342 | + mentioned, | ||
| 2343 | + "ActionId::{name} is bound to a chord but has no visible affordance \ | ||
| 2344 | + anywhere in the darkroom tree -- either mount it (see Fit/Redo, this \ | ||
| 2345 | + commit) or add it to ALLOWED_CHORD_ONLY with a reason" | ||
| 2346 | + ); | ||
| 2347 | + } | ||
| 2348 | +} | ||
crates/app/src/ui/dock_stance.rsmodified+17 -0
| @@ -587,6 +587,23 @@ fn clip_tab(player: &Player, width: f32, window_h: Pixels, cx: &mut Context<Play | |||
| 587 | "track volumes and the limiter", | 587 | "track volumes and the limiter", |
| 588 | player, | 588 | player, |
| 589 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_mix(None, cx)), | 589 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_mix(None, cx)), |
| 590 | + )) | ||
| 591 | + // Fit: a cycle, not a card, so `active` is always false -- | ||
| 592 | + // there is no open state to hold it down for, only the click | ||
| 593 | + // itself (same anatomy as `cycle_fit`'s own inspector.rs row, | ||
| 594 | + // legacy's `crates/app/src/ui/inspector.rs:244-253`). It was | ||
| 595 | + // reachable only by its chord or buried in the clip's | ||
| 596 | + // right-click menu (`overlays.rs`'s `Pick::Fit`); this is its | ||
| 597 | + // direct button, beside the other per-clip verbs it keeps | ||
| 598 | + // company with. | ||
| 599 | + .child(ghost_verb( | ||
| 600 | + "dock-verb-fit", | ||
| 601 | + "Fit", | ||
| 602 | + ActionId::Fit, | ||
| 603 | + false, | ||
| 604 | + "how this picture is placed on the project canvas", | ||
| 605 | + player, | ||
| 606 | + cx.listener(|this, _: &ClickEvent, _, cx| this.cycle_fit(cx)), | ||
| 590 | )), | 607 | )), |
| 591 | ) | 608 | ) |
| 592 | .child( | 609 | .child( |
crates/app/src/ui/spine_stance.rsmodified+8 -1
| @@ -224,7 +224,14 @@ pub(crate) fn render(player: &Player, cx: &mut Context<Player>) -> impl IntoElem | |||
| 224 | .child(group_head("edit")) | 224 | .child(group_head("edit")) |
| 225 | .child(glyph("spine-split", "||", ActionId::Cut, false, false, player, cx)) | 225 | .child(glyph("spine-split", "||", ActionId::Cut, false, false, player, cx)) |
| 226 | .child(glyph("spine-delete", "⊂⊃", ActionId::Delete, false, false, player, cx)) | 226 | .child(glyph("spine-delete", "⊂⊃", ActionId::Delete, false, false, player, cx)) |
| 227 | - .child(glyph("spine-undo", "↺", ActionId::Undo, false, false, player, cx)) | 227 | + .child(pair( |
| 228 | + glyph("spine-undo", "↺", ActionId::Undo, false, false, player, cx), | ||
| 229 | + // Redo had a legacy toolbar button (`toolbar.rs:347`) but no | ||
| 230 | + // darkroom home -- Undo got a glyph here and Redo did not. | ||
| 231 | + // Same row, same door (`this.act`), the pair anatomy the | ||
| 232 | + // cut-prev/cut-next row below already uses. | ||
| 233 | + glyph("spine-redo", "⟳", ActionId::Redo, false, false, player, cx), | ||
| 234 | + )) | ||
| 228 | .child(group_head("cut")) | 235 | .child(group_head("cut")) |
| 229 | .child(pair( | 236 | .child(pair( |
| 230 | glyph("spine-cut-prev", "‹", ActionId::WalkCutPrev, false, false, player, cx), | 237 | glyph("spine-cut-prev", "‹", ActionId::WalkCutPrev, false, false, player, cx), |