A label names the verb — every action in four words
Browse files at this commit488076afd24645bbf5fba6ae055650209ee9d374Parent: 4710509- style
- a label names the verb — every action in four words
5 changed files +103 -87
- crates/app/src/keymap.rs +77 -55
- crates/app/src/layout.rs +2 -2
- crates/app/src/tests/layout.rs +2 -2
- crates/app/src/ui/dock_stance.rs +8 -5
- crates/app/src/ui/overlays.rs +14 -23
crates/app/src/keymap.rsmodified+77 -55
| @@ -244,22 +244,22 @@ impl ActionId { | |||
| 244 | pub fn label(self) -> &'static str { | 244 | pub fn label(self) -> &'static str { |
| 245 | match self { | 245 | match self { |
| 246 | ActionId::Play => "Play / Pause", | 246 | ActionId::Play => "Play / Pause", |
| 247 | - ActionId::Loop => "Loop the playhead's end", | 247 | + ActionId::Loop => "Loop playback", |
| 248 | ActionId::StepBack => "One frame back", | 248 | ActionId::StepBack => "One frame back", |
| 249 | ActionId::StepForward => "One frame forward", | 249 | ActionId::StepForward => "One frame forward", |
| 250 | ActionId::JumpBack => "One second back", | 250 | ActionId::JumpBack => "One second back", |
| 251 | ActionId::JumpForward => "One second forward", | 251 | ActionId::JumpForward => "One second forward", |
| 252 | - ActionId::GoStart => "Go to the start", | 252 | + ActionId::GoStart => "Go to start", |
| 253 | - ActionId::GoEnd => "Go to the last frame", | 253 | + ActionId::GoEnd => "Go to end", |
| 254 | - ActionId::PrevSyncPoint => "Previous sync point (a cut here is copied, not re-encoded)", | 254 | + ActionId::PrevSyncPoint => "Previous sync point", |
| 255 | - ActionId::NextSyncPoint => "Next sync point (a cut here is copied, not re-encoded)", | 255 | + ActionId::NextSyncPoint => "Next sync point", |
| 256 | - ActionId::WalkCutNext => "Walk to the next cut", | 256 | + ActionId::WalkCutNext => "Next cut", |
| 257 | - ActionId::WalkCutPrev => "Walk to the previous cut", | 257 | + ActionId::WalkCutPrev => "Previous cut", |
| 258 | - ActionId::WalkCutNext10 => "Walk ten cuts forward", | 258 | + ActionId::WalkCutNext10 => "Forward ten cuts", |
| 259 | - ActionId::WalkCutPrev10 => "Walk ten cuts back", | 259 | + ActionId::WalkCutPrev10 => "Back ten cuts", |
| 260 | - ActionId::SetIn => "Mark in (export range)", | 260 | + ActionId::SetIn => "Mark in", |
| 261 | - ActionId::SetOut => "Mark out (export range)", | 261 | + ActionId::SetOut => "Mark out", |
| 262 | - ActionId::ClearRange => "Clear the export range", | 262 | + ActionId::ClearRange => "Clear range", |
| 263 | ActionId::Export => "Export", | 263 | ActionId::Export => "Export", |
| 264 | ActionId::Save => "Save", | 264 | ActionId::Save => "Save", |
| 265 | ActionId::Copy => "Copy", | 265 | ActionId::Copy => "Copy", |
| @@ -269,59 +269,59 @@ impl ActionId { | |||
| 269 | // Neither half's action: it takes the *pair* apart, and the menu | 269 | // Neither half's action: it takes the *pair* apart, and the menu |
| 270 | // that offers it hangs on whichever half was right-clicked -- worded | 270 | // that offers it hangs on whichever half was right-clicked -- worded |
| 271 | // from the picture's side it read as a video item on an audio clip. | 271 | // from the picture's side it read as a video item on an audio clip. |
| 272 | - ActionId::Detach => "Ungroup the selection (clips and captions)", | 272 | + ActionId::Detach => "Ungroup", |
| 273 | - ActionId::Group => "Group the selection (ctrl-click the clips first)", | 273 | + ActionId::Group => "Group", |
| 274 | - ActionId::Select => "Select the clip under the playhead (again for the next lane)", | 274 | + ActionId::Select => "Select clip at playhead", |
| 275 | - ActionId::SelectNext => "Select the next clip in the lane", | 275 | + ActionId::SelectNext => "Select next clip", |
| 276 | - ActionId::SelectPrev => "Select the previous clip in the lane", | 276 | + ActionId::SelectPrev => "Select previous clip", |
| 277 | - ActionId::SelectAll => "Select everything (every clip and caption)", | 277 | + ActionId::SelectAll => "Select all", |
| 278 | - ActionId::Deselect => "Clear the selection", | 278 | + ActionId::Deselect => "Deselect", |
| 279 | ActionId::Delete => "Delete", | 279 | ActionId::Delete => "Delete", |
| 280 | - ActionId::Lift => "Lift (leave a gap)", | 280 | + ActionId::Lift => "Lift", |
| 281 | ActionId::Color => "Colour…", | 281 | ActionId::Color => "Colour…", |
| 282 | - ActionId::Transform => "Transform — position, scale, rotation, crop", | 282 | + ActionId::Transform => "Transform…", |
| 283 | - ActionId::Fit => "Fit policy: fit → fill → stretch → centre", | 283 | + ActionId::Fit => "Fit policy", |
| 284 | - ActionId::Resolution => "Project resolution: source → 2160p → 1080p → 720p → 480p", | 284 | + ActionId::Resolution => "Project resolution", |
| 285 | - ActionId::ZoomIn => "Zoom in on the timeline (around the playhead)", | 285 | + ActionId::ZoomIn => "Zoom in", |
| 286 | - ActionId::ZoomOut => "Zoom out of the timeline", | 286 | + ActionId::ZoomOut => "Zoom out", |
| 287 | - ActionId::ZoomFit => "Fit the whole timeline on screen", | 287 | + ActionId::ZoomFit => "Fit timeline", |
| 288 | ActionId::Undo => "Undo", | 288 | ActionId::Undo => "Undo", |
| 289 | ActionId::Redo => "Redo", | 289 | ActionId::Redo => "Redo", |
| 290 | - ActionId::AddVideoLane => "Add a video track", | 290 | + ActionId::AddVideoLane => "Add video track", |
| 291 | - ActionId::AddAudioLane => "Add an audio track", | 291 | + ActionId::AddAudioLane => "Add audio track", |
| 292 | - ActionId::RemoveVideoLane => "Remove the last video track (it must be empty)", | 292 | + ActionId::RemoveVideoLane => "Remove video track", |
| 293 | - ActionId::RemoveAudioLane => "Remove the last audio track (it must be empty)", | 293 | + ActionId::RemoveAudioLane => "Remove audio track", |
| 294 | - ActionId::AddSubtitleLane => "Add a subtitle track", | 294 | + ActionId::AddSubtitleLane => "Add subtitle track", |
| 295 | - ActionId::RemoveSubtitleLane => "Remove the last subtitle track (it must be empty)", | 295 | + ActionId::RemoveSubtitleLane => "Remove subtitle track", |
| 296 | - ActionId::ImportSubtitles => "Add subtitles from a file…", | 296 | + ActionId::ImportSubtitles => "Add subtitles…", |
| 297 | ActionId::AddFiles => "Add files…", | 297 | ActionId::AddFiles => "Add files…", |
| 298 | - ActionId::PasteFilePath => "Paste path (import the file it names)", | 298 | + ActionId::PasteFilePath => "Paste path", |
| 299 | ActionId::ToggleMute => "Mute / Unmute", | 299 | ActionId::ToggleMute => "Mute / Unmute", |
| 300 | ActionId::VolumeUp => "Volume up", | 300 | ActionId::VolumeUp => "Volume up", |
| 301 | ActionId::VolumeDown => "Volume down", | 301 | ActionId::VolumeDown => "Volume down", |
| 302 | ActionId::Equalizer => "Equalizer", | 302 | ActionId::Equalizer => "Equalizer", |
| 303 | - ActionId::Speed => "Speed (tape)…", | 303 | + ActionId::Speed => "Speed…", |
| 304 | - ActionId::Silence => "Silences: cut or speed up…", | 304 | + ActionId::Silence => "Silences…", |
| 305 | - ActionId::Crossfade => "Crossfade into the next clip", | 305 | + ActionId::Crossfade => "Crossfade to next", |
| 306 | - ActionId::TrimIn => "Trim the subject cut's in point", | 306 | + ActionId::TrimIn => "Trim in", |
| 307 | - ActionId::TrimOut => "Trim the subject cut's out point", | 307 | + ActionId::TrimOut => "Trim out", |
| 308 | - ActionId::LoopTrim => "Loop-trim the subject cut", | 308 | + ActionId::LoopTrim => "Loop-trim", |
| 309 | - ActionId::TrimInToPlayhead => "Trim the subject cut's in point to the playhead", | 309 | + ActionId::TrimInToPlayhead => "Trim in to playhead", |
| 310 | - ActionId::TrimOutToPlayhead => "Trim the subject cut's out point to the playhead", | 310 | + ActionId::TrimOutToPlayhead => "Trim out to playhead", |
| 311 | - ActionId::Dissolve => "Dissolve into the next clip", | 311 | + ActionId::Dissolve => "Dissolve to next", |
| 312 | - ActionId::Mix => "Mix: track volumes and the limiter…", | 312 | + ActionId::Mix => "Mix…", |
| 313 | - ActionId::ToggleSnap => "Snap on / off (edges, the playhead, the start)", | 313 | + ActionId::ToggleSnap => "Snap", |
| 314 | - ActionId::ToggleSubtitles => "Subtitles on / off over the picture", | 314 | + ActionId::ToggleSubtitles => "Subtitles", |
| 315 | - ActionId::ToggleProxies => "Proxies on / off for the picture", | 315 | + ActionId::ToggleProxies => "Proxies", |
| 316 | - ActionId::ToggleAutoProxies => "Make proxies on import: on / off", | 316 | + ActionId::ToggleAutoProxies => "Proxies on import", |
| 317 | - ActionId::Theme => "Theme: the window's colours…", | 317 | + ActionId::Theme => "Theme…", |
| 318 | - ActionId::Fullscreen => "Fullscreen on / off", | 318 | + ActionId::Fullscreen => "Fullscreen", |
| 319 | ActionId::CancelExport => "Cancel export", | 319 | ActionId::CancelExport => "Cancel export", |
| 320 | - ActionId::ShowActions => "All actions and their keys…", | 320 | + ActionId::ShowActions => "All actions…", |
| 321 | - ActionId::Screenshot => "Save the frame on screen as a PNG", | 321 | + ActionId::Screenshot => "Save frame as PNG", |
| 322 | - ActionId::SubtitleStyle => "Subtitle style: font and size…", | 322 | + ActionId::SubtitleStyle => "Subtitle style…", |
| 323 | - ActionId::Settings => "Settings: project and editor…", | 323 | + ActionId::Settings => "Settings…", |
| 324 | - ActionId::FocusPanels => "Move keyboard focus between panels", | 324 | + ActionId::FocusPanels => "Focus panels", |
| 325 | } | 325 | } |
| 326 | } | 326 | } |
| 327 | 327 | ||
| @@ -1681,6 +1681,28 @@ mod tests { | |||
| 1681 | assert_eq!(k.display(ActionId::ZoomIn), "ctrl+="); | 1681 | assert_eq!(k.display(ActionId::ZoomIn), "ctrl+="); |
| 1682 | } | 1682 | } |
| 1683 | 1683 | ||
| 1684 | + /// DESIGN §8: a label names the verb. Prose truncates -- the KEYS list | ||
| 1685 | + /// ellipsises it, a menu row's fixed plate cuts it mid-word, a hover plate | ||
| 1686 | + /// the same -- so four words is the whole budget, and what a parenthesis | ||
| 1687 | + /// used to carry (why an action refuses) lives in the refusal string the | ||
| 1688 | + /// oracle and the engine already word. | ||
| 1689 | + #[test] | ||
| 1690 | + fn a_label_names_the_verb_in_four_words() { | ||
| 1691 | + let mut seen: Vec<&'static str> = Vec::new(); | ||
| 1692 | + for action in ActionId::ALL { | ||
| 1693 | + let label = action.label(); | ||
| 1694 | + let words = label.split_whitespace().count(); | ||
| 1695 | + assert!(words <= 4, "{action:?}: {words} words -- {label:?}"); | ||
| 1696 | + assert!(!label.contains('('), "{action:?}: a parenthesis -- {label:?}"); | ||
| 1697 | + assert!( | ||
| 1698 | + !label.to_lowercase().starts_with("the "), | ||
| 1699 | + "{action:?}: leads with an article -- {label:?}" | ||
| 1700 | + ); | ||
| 1701 | + assert!(!seen.contains(&label), "two actions both named {label:?}"); | ||
| 1702 | + seen.push(label); | ||
| 1703 | + } | ||
| 1704 | + } | ||
| 1705 | + | ||
| 1684 | /// [`Keymap::chord`] is the badge's one token, not [`Keymap::display`]'s | 1706 | /// [`Keymap::chord`] is the badge's one token, not [`Keymap::display`]'s |
| 1685 | /// sentence: the primary (first-bound) stroke only, `^` for ctrl, and the | 1707 | /// sentence: the primary (first-bound) stroke only, `^` for ctrl, and the |
| 1686 | /// short names a glyph badge actually has room for. | 1708 | /// short names a glyph badge actually has room for. |
crates/app/src/layout.rsmodified+2 -2
| @@ -71,8 +71,8 @@ pub(crate) const RULER_HIT_H: f32 = HIT_MIN; | |||
| 71 | /// 360 px tall window. The rows are click targets, so `HIT_MIN` binds them too. | 71 | /// 360 px tall window. The rows are click targets, so `HIT_MIN` binds them too. |
| 72 | /// Wider than the export card, and for the same reason that one is wider than | 72 | /// Wider than the export card, and for the same reason that one is wider than |
| 73 | /// this used to be: at 320 the longest labels ("Remove the last video track (it | 73 | /// this used to be: at 320 the longest labels ("Remove the last video track (it |
| 74 | -/// must be empty)") ran straight over the stroke printed at the other end of | 74 | +/// must be empty)", before cleanse round 2 cut every label to its verb) ran |
| 75 | -/// their row. Every label in the registry fits beside its stroke here, and the | 75 | +/// straight over the stroke printed at the other end of their row. Every label in the registry fits beside its stroke here, and the |
| 76 | /// one that cannot -- a row waiting for a key to be pressed -- truncates rather | 76 | /// one that cannot -- a row waiting for a key to be pressed -- truncates rather |
| 77 | /// than overprinting. Still inside the 640 px floor. | 77 | /// than overprinting. Still inside the 640 px floor. |
| 78 | pub(crate) const KEYS_W: f32 = 480.; | 78 | pub(crate) const KEYS_W: f32 = 480.; |
crates/app/src/tests/layout.rsmodified+2 -2
| @@ -2591,11 +2591,11 @@ fn every_action_has_a_darkroom_widget_home_or_explicit_owner() { | |||
| 2591 | ]; | 2591 | ]; |
| 2592 | /// `ActionId::Loop` is a prefix of `ActionId::LoopTrim`, and the keys | 2592 | /// `ActionId::Loop` is a prefix of `ActionId::LoopTrim`, and the keys |
| 2593 | /// menu's own label arm (`ActionId::ToggleMute | ActionId::Paste => | 2593 | /// menu's own label arm (`ActionId::ToggleMute | ActionId::Paste => |
| 2594 | - /// format!("{verb} (global)")`) shapes a string rather than opening a | 2594 | + /// format!("{full} (global)")`) shapes a string rather than opening a |
| 2595 | /// door -- neither is a widget home, so neither counts as a mention. | 2595 | /// door -- neither is a widget home, so neither counts as a mention. |
| 2596 | fn mentions(text: &str, name: &str) -> bool { | 2596 | fn mentions(text: &str, name: &str) -> bool { |
| 2597 | text.lines() | 2597 | text.lines() |
| 2598 | - .filter(|l| !l.contains("=> format!(\"{verb} (global)\")")) | 2598 | + .filter(|l| !l.contains("=> format!(\"{full} (global)\")")) |
| 2599 | .any(|line| { | 2599 | .any(|line| { |
| 2600 | line.match_indices(&format!("ActionId::{name}")).any(|(i, m)| { | 2600 | line.match_indices(&format!("ActionId::{name}")).any(|(i, m)| { |
| 2601 | !line[i + m.len()..] | 2601 | !line[i + m.len()..] |
crates/app/src/ui/dock_stance.rsmodified+8 -5
| @@ -1265,11 +1265,14 @@ fn keys_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | |||
| 1265 | .gap(px(12.)) | 1265 | .gap(px(12.)) |
| 1266 | .child( | 1266 | .child( |
| 1267 | div() | 1267 | div() |
| 1268 | - // The label gives way, never the chord: a long parenthetical | 1268 | + // The label gives way, never the chord: a long |
| 1269 | - // ("Previous sync point (a cut here is copied...)") pushed | 1269 | + // parenthetical ("Previous sync point (a cut here is |
| 1270 | - // the chord column clean off the dock's right edge until | 1270 | + // copied...)") pushed the chord column clean off the |
| 1271 | - // this row took `min_w(0)` + ellipsis, the same shape a | 1271 | + // dock's right edge until this row took `min_w(0)` + |
| 1272 | - // source row's name already uses. | 1272 | + // ellipsis, the same shape a source row's name already |
| 1273 | + // uses. The labels are four words at most since cleanse | ||
| 1274 | + // round 2, so nothing reaches the ellipsis; it stays for | ||
| 1275 | + // the row that is waiting for a key. | ||
| 1273 | .flex_1() | 1276 | .flex_1() |
| 1274 | .min_w(px(0.)) | 1277 | .min_w(px(0.)) |
| 1275 | .truncate() | 1278 | .truncate() |
crates/app/src/ui/overlays.rsmodified+14 -23
| @@ -298,24 +298,15 @@ impl Player { | |||
| 298 | // The one item that is not about this clip says so, and says it | 298 | // The one item that is not about this clip says so, and says it |
| 299 | // here rather than in the registry: the stroke is global too, | 299 | // here rather than in the registry: the stroke is global too, |
| 300 | // but its row in the keys menu is not sitting on a clip. | 300 | // but its row in the keys menu is not sitting on a clip. |
| 301 | - // The registry's label is a sentence -- it has to be, the keys | 301 | + // The registry's label is the verb itself now (cleanse round |
| 302 | - // overlay reads the same string -- and a sentence in a 260px | 302 | + // 2, `a_label_names_the_verb_in_four_words`): four words at |
| 303 | - // plate row is cut mid-word by the chord column beside it | 303 | + // most, so it fits a 260px plate beside its chord instead of |
| 304 | - // ("Ungroup the selection (clips anc", "Group the selection | 304 | + // being cut mid-word ("Ungroup the selection (clips anc"). |
| 305 | - // (ctrl-c"). DESIGN §7's rule for the bench applies to a menu | 305 | + // Nothing is trimmed here any more -- what a parenthesis used |
| 306 | - // too: labels never truncate into soup. The verb is the head | 306 | + // to carry is the refusal string in the column beside it. |
| 307 | - // of the sentence, up to its first parenthesis or em-dash; | ||
| 308 | - // the tail is what the row's tooltip carries, so nothing is | ||
| 309 | - // lost, it just stops being drawn over the chord. | ||
| 310 | let full = action.label(); | 307 | let full = action.label(); |
| 311 | - let verb = full | ||
| 312 | - .split_once(" (") | ||
| 313 | - .map(|(head, _)| head) | ||
| 314 | - .or_else(|| full.split_once(" — ").map(|(head, _)| head)) | ||
| 315 | - .or_else(|| full.split_once(": ").map(|(head, _)| head)) | ||
| 316 | - .unwrap_or(full); | ||
| 317 | let label = match action { | 308 | let label = match action { |
| 318 | - ActionId::ToggleMute | ActionId::Paste => format!("{verb} (global)"), | 309 | + ActionId::ToggleMute | ActionId::Paste => format!("{full} (global)"), |
| 319 | // A switch says which way it is set: a row reading "Snap on | 310 | // A switch says which way it is set: a row reading "Snap on |
| 320 | // / off" beside a chord tells nobody whether snapping is on | 311 | // / off" beside a chord tells nobody whether snapping is on |
| 321 | // right now, which is the one thing the spine's badge did | 312 | // right now, which is the one thing the spine's badge did |
| @@ -323,17 +314,17 @@ impl Player { | |||
| 323 | ActionId::ToggleSnap => { | 314 | ActionId::ToggleSnap => { |
| 324 | format!("Snap — {}", if self.snap { "on" } else { "off" }) | 315 | format!("Snap — {}", if self.snap { "on" } else { "off" }) |
| 325 | } | 316 | } |
| 326 | - _ => verb.to_string(), | 317 | + _ => full.to_string(), |
| 327 | }; | 318 | }; |
| 328 | let say: SharedString = full.to_string().into(); | 319 | let say: SharedString = full.to_string().into(); |
| 329 | rows.push( | 320 | rows.push( |
| 330 | row(rows.len()) | 321 | row(rows.len()) |
| 331 | - // Truncated and shrinkable: a long label ("Transform — | 322 | + // Truncated and shrinkable even so: a long label |
| 332 | - // position, scale, rotation, crop") used to run the | 323 | + // ("Transform — position, scale, rotation, crop") |
| 333 | - // hint column clean off the fixed-width menu instead | 324 | + // used to run the hint column clean off the |
| 334 | - // of sharing the row with it, which is why Transform | 325 | + // fixed-width menu instead of sharing the row with |
| 335 | - // showed no stroke while a short label like Colour's | 326 | + // it, which is why Transform showed no stroke while a |
| 336 | - // did. | 327 | + // short label like Colour's did. |
| 337 | .tooltip(move |_, cx| cx.new(|_| Tip(say.clone())).into()) | 328 | .tooltip(move |_, cx| cx.new(|_| Tip(say.clone())).into()) |
| 338 | .child(div().min_w(px(0.)).flex_shrink().truncate().child(label)) | 329 | .child(div().min_w(px(0.)).flex_shrink().truncate().child(label)) |
| 339 | .child(match refusal.why() { | 330 | .child(match refusal.why() { |