S cuts, the loop arms cold, and no command hides
Browse files at this commitb999ecfddcb5a50b1c6980edf554b6c5b6bf5bbeParent: de91645- fix
- s cuts, the loop arms cold, and no command hides
8 changed files +212 -55
- crates/app/src/keymap.rs +18 -11
- crates/app/src/main.rs +7 -0
- crates/app/src/player/actions.rs +7 -5
- crates/app/src/tests/editing.rs +20 -0
- crates/app/src/ui/dock_stance.rs +32 -12
- crates/app/src/ui/preview.rs +19 -10
- crates/app/src/ui/stance.rs +108 -16
- crates/app/src/ui/toolbar.rs +1 -1
crates/app/src/keymap.rsmodified+18 -11
| @@ -973,7 +973,12 @@ impl Keymap { | |||
| 973 | b(ActionId::Save, "s", true), | 973 | b(ActionId::Save, "s", true), |
| 974 | b(ActionId::Copy, "c", true), | 974 | b(ActionId::Copy, "c", true), |
| 975 | b(ActionId::Paste, "v", true), | 975 | b(ActionId::Paste, "v", true), |
| 976 | - b(ActionId::Cut, "c", false), | 976 | + // Split, on the bare letter DESIGN.md §6 names for it: the |
| 977 | + // burst-use command owns the cheap key (§11's frequency | ||
| 978 | + // argument). Bare "c" moves to AddSubtitleLane below, which | ||
| 979 | + // frees up cleanly since a subtitle track also opens on its | ||
| 980 | + // own initial: captions. | ||
| 981 | + b(ActionId::Cut, "s", false), | ||
| 977 | // The two lane keys, on the letters they are named after: both | 982 | // The two lane keys, on the letters they are named after: both |
| 978 | // were free, and neither is next to a key that edits. | 983 | // were free, and neither is next to a key that edits. |
| 979 | b(ActionId::Regroup, "g", false), | 984 | b(ActionId::Regroup, "g", false), |
| @@ -1005,8 +1010,9 @@ impl Keymap { | |||
| 1005 | b(ActionId::Delete, "x", false), | 1010 | b(ActionId::Delete, "x", false), |
| 1006 | b(ActionId::Delete, "delete", false), | 1011 | b(ActionId::Delete, "delete", false), |
| 1007 | b(ActionId::Lift, "l", false), | 1012 | b(ActionId::Lift, "l", false), |
| 1008 | - // The c of colour is Cut and ctrl+c is Copy, so the grade takes | 1013 | + // The c of colour is now AddSubtitleLane's (captions) and |
| 1009 | - // k: free, next to nothing that edits, and one press like the | 1014 | + // ctrl+c is Copy, so the grade takes k: free, next to nothing |
| 1015 | + // that edits, and one press like the | ||
| 1010 | // rest of the clip keys. | 1016 | // rest of the clip keys. |
| 1011 | b(ActionId::Color, "k", false), | 1017 | b(ActionId::Color, "k", false), |
| 1012 | // The placement card takes the ctrl chord of the grade's own | 1018 | // The placement card takes the ctrl chord of the grade's own |
| @@ -1048,12 +1054,13 @@ impl Keymap { | |||
| 1048 | // takes the free key beside its own letter: "a" neighbours | 1054 | // takes the free key beside its own letter: "a" neighbours |
| 1049 | // "q" on the row, and ctrl+q was taken by nothing. | 1055 | // "q" on the row, and ctrl+q was taken by nothing. |
| 1050 | b(ActionId::RemoveAudioLane, "q", true), | 1056 | b(ActionId::RemoveAudioLane, "q", true), |
| 1051 | - // The subtitle pair reads the same way: the unshifted initial | 1057 | + // The subtitle pair reads the same way, on a different letter |
| 1052 | - // adds one -- "s" is free, the save is the *ctrl* chord -- and a | 1058 | + // now that bare "s" is split's (DESIGN.md §6): "c" is free |
| 1053 | - // ctrl chord takes it back. Ctrl+s is that save, so the removal | 1059 | + // once split moves off it, and it is still an initial the |
| 1054 | - // takes the other letter subtitles already answer to here: "t" | 1060 | + // track answers to -- captions. The removal takes the other |
| 1055 | - // shows and hides them, and ctrl+t takes one off the timeline. | 1061 | + // letter subtitles already answer to here: "t" shows and |
| 1056 | - b(ActionId::AddSubtitleLane, "s", false), | 1062 | + // hides them, and ctrl+t takes one off the timeline. |
| 1063 | + b(ActionId::AddSubtitleLane, "c", false), | ||
| 1057 | b(ActionId::RemoveSubtitleLane, "t", true), | 1064 | b(ActionId::RemoveSubtitleLane, "t", true), |
| 1058 | // Reading a file's tracks into the palette is not adding a | 1065 | // Reading a file's tracks into the palette is not adding a |
| 1059 | // track to the timeline, so it is not the bare "s": ctrl+i, the | 1066 | // track to the timeline, so it is not the bare "s": ctrl+i, the |
| @@ -1453,7 +1460,7 @@ mod tests { | |||
| 1453 | assert_eq!(k.lookup("s", true), Some(ActionId::Save)); | 1460 | assert_eq!(k.lookup("s", true), Some(ActionId::Save)); |
| 1454 | assert_eq!(k.lookup("c", true), Some(ActionId::Copy)); | 1461 | assert_eq!(k.lookup("c", true), Some(ActionId::Copy)); |
| 1455 | assert_eq!(k.lookup("v", true), Some(ActionId::Paste)); | 1462 | assert_eq!(k.lookup("v", true), Some(ActionId::Paste)); |
| 1456 | - assert_eq!(k.lookup("c", false), Some(ActionId::Cut)); | 1463 | + assert_eq!(k.lookup("s", false), Some(ActionId::Cut)); |
| 1457 | assert_eq!(k.lookup("g", false), Some(ActionId::Regroup)); | 1464 | assert_eq!(k.lookup("g", false), Some(ActionId::Regroup)); |
| 1458 | // The take apart / put back pair beside it. | 1465 | // The take apart / put back pair beside it. |
| 1459 | assert_eq!(k.lookup("d", false), Some(ActionId::Detach)); | 1466 | assert_eq!(k.lookup("d", false), Some(ActionId::Detach)); |
| @@ -1483,7 +1490,7 @@ mod tests { | |||
| 1483 | assert_eq!(k.lookup("a", true), Some(ActionId::SelectAll)); | 1490 | assert_eq!(k.lookup("a", true), Some(ActionId::SelectAll)); |
| 1484 | // The subtitle pair, the third kind of track: the initial adds and the | 1491 | // The subtitle pair, the third kind of track: the initial adds and the |
| 1485 | // subtitle letter's chord takes it back. | 1492 | // subtitle letter's chord takes it back. |
| 1486 | - assert_eq!(k.lookup("s", false), Some(ActionId::AddSubtitleLane)); | 1493 | + assert_eq!(k.lookup("c", false), Some(ActionId::AddSubtitleLane)); |
| 1487 | assert_eq!(k.lookup("t", true), Some(ActionId::RemoveSubtitleLane)); | 1494 | assert_eq!(k.lookup("t", true), Some(ActionId::RemoveSubtitleLane)); |
| 1488 | // ...and the palette's own door, which adds no track to the timeline. | 1495 | // ...and the palette's own door, which adds no track to the timeline. |
| 1489 | assert_eq!(k.lookup("i", true), Some(ActionId::ImportSubtitles)); | 1496 | assert_eq!(k.lookup("i", true), Some(ActionId::ImportSubtitles)); |
crates/app/src/main.rsmodified+7 -0
| @@ -213,6 +213,12 @@ struct Player { | |||
| 213 | /// filter box: the categories are what the media *is*, and every editor | 213 | /// filter box: the categories are what the media *is*, and every editor |
| 214 | /// this one is measured against splits its pool the same way. | 214 | /// this one is measured against splits its pool the same way. |
| 215 | library_tab: LibraryTab, | 215 | library_tab: LibraryTab, |
| 216 | + /// Which of the darkroom dock's Src/Clip tabs is showing (DESIGN §5). | ||
| 217 | + /// `Player`-owned rather than the process-global static it used to be | ||
| 218 | + /// (VIOLATION 3), and persisted the way `ui::theme`'s pick is | ||
| 219 | + /// (`ui::dock_stance::load`/`save`) so "a room reopens exactly as left" | ||
| 220 | + /// survives a quit and relaunch, not just this window. | ||
| 221 | + pub(crate) dock_src_active: bool, | ||
| 216 | /// What is known about each source's audio, taken once and kept. Keyed on | 222 | /// What is known about each source's audio, taken once and kept. Keyed on |
| 217 | /// the path *and stream* -- two streams of one file are two envelopes -- and | 223 | /// the path *and stream* -- two streams of one file are two envelopes -- and |
| 218 | /// the key is inserted the moment the decode is *started*: presence means | 224 | /// the key is inserted the moment the decode is *started*: presence means |
| @@ -860,6 +866,7 @@ fn main() { | |||
| 860 | library_menu: None, | 866 | library_menu: None, |
| 861 | selected_asset: None, | 867 | selected_asset: None, |
| 862 | library_tab: LibraryTab::Media, | 868 | library_tab: LibraryTab::Media, |
| 869 | + dock_src_active: ui::dock_stance::load(), | ||
| 863 | waves: HashMap::new(), | 870 | waves: HashMap::new(), |
| 864 | proxies: HashMap::new(), | 871 | proxies: HashMap::new(), |
| 865 | streams: HashMap::new(), | 872 | streams: HashMap::new(), |
crates/app/src/player/actions.rsmodified+7 -5
| @@ -540,8 +540,13 @@ impl Player { | |||
| 540 | 540 | ||
| 541 | /// Loop-trim (DESIGN.md §6, `/`): loops the transport around the subject | 541 | /// Loop-trim (DESIGN.md §6, `/`): loops the transport around the subject |
| 542 | /// cut's own span while `[`/`]` move its edges -- the modernized Avid | 542 | /// cut's own span while `[`/`]` move its edges -- the modernized Avid |
| 543 | - /// trim mode. Off again drops the window and leaves playback running, | 543 | + /// trim mode. Neither direction touches play/pause: off drops the window |
| 544 | - /// exactly as it was found. | 544 | + /// and leaves playback exactly as it was found, and on arms the window |
| 545 | + /// without forcing a play -- a forced `session.play()` here used to start | ||
| 546 | + /// the clock as a side effect of arming, which left a paused transport | ||
| 547 | + /// already playing when the user's own `space` arrived next; that press | ||
| 548 | + /// then read as a toggle and paused it right back, pinned at the loop's | ||
| 549 | + /// start frame. Space is what starts it, playing or not. | ||
| 545 | pub(crate) fn toggle_loop_trim(&mut self, cx: &mut Context<Self>) { | 550 | pub(crate) fn toggle_loop_trim(&mut self, cx: &mut Context<Self>) { |
| 546 | if self.loop_trim.take().is_some() { | 551 | if self.loop_trim.take().is_some() { |
| 547 | self.notify_user("LOOP-TRIM OFF".into()); | 552 | self.notify_user("LOOP-TRIM OFF".into()); |
| @@ -554,9 +559,6 @@ impl Player { | |||
| 554 | self.loop_trim = self.cut_span(lane, idx); | 559 | self.loop_trim = self.cut_span(lane, idx); |
| 555 | if self.loop_trim.is_some() { | 560 | if self.loop_trim.is_some() { |
| 556 | self.notify_user("LOOP-TRIM ON — looping the subject cut while you trim".into()); | 561 | self.notify_user("LOOP-TRIM ON — looping the subject cut while you trim".into()); |
| 557 | - if let Some(session) = self.active_session_mut() { | ||
| 558 | - session.play(); | ||
| 559 | - } | ||
| 560 | } | 562 | } |
| 561 | cx.notify(); | 563 | cx.notify(); |
| 562 | } | 564 | } |
crates/app/src/tests/editing.rsmodified+20 -0
| @@ -2102,3 +2102,23 @@ fn should_loop_restart_only_at_the_windows_far_edge() { | |||
| 2102 | assert!(should_loop_restart(61, Some((30, 60))), "past it restarts too"); | 2102 | assert!(should_loop_restart(61, Some((30, 60))), "past it restarts too"); |
| 2103 | assert!(!should_loop_restart(60, None), "loop-trim off restarts nothing"); | 2103 | assert!(!should_loop_restart(60, None), "loop-trim off restarts nothing"); |
| 2104 | } | 2104 | } |
| 2105 | + | ||
| 2106 | +/// The paused-then-started repro this predicate was blamed for and cleared | ||
| 2107 | +/// of: `should_loop_restart` takes no play/pause state at all, so resting | ||
| 2108 | +/// exactly at the window's far edge -- as a transport paused after playing | ||
| 2109 | +/// through the cut once, or paused right on arrival by a scrub -- reads | ||
| 2110 | +/// "restart" from the predicate alone regardless. The bug that froze a | ||
| 2111 | +/// paused-then-`space`d transport at the loop's start frame was not this: it | ||
| 2112 | +/// was `Player::toggle_loop_trim` forcing `session.play()` on arm, so the | ||
| 2113 | +/// user's own next `space` toggled straight back to paused. It is | ||
| 2114 | +/// `Player::pump`'s `session.is_playing()` guard around this call that must | ||
| 2115 | +/// hold a paused transport off the seek until playback actually starts. | ||
| 2116 | +#[test] | ||
| 2117 | +fn should_loop_restart_is_play_state_blind_the_pump_gates_it() { | ||
| 2118 | + use crate::timeline_math::should_loop_restart; | ||
| 2119 | + assert!( | ||
| 2120 | + should_loop_restart(60, Some((30, 60))), | ||
| 2121 | + "the predicate alone can't tell paused-at-the-edge from playing-\ | ||
| 2122 | + into-it -- that distinction is pump's is_playing() guard, not this" | ||
| 2123 | + ); | ||
| 2124 | +} | ||
crates/app/src/ui/dock_stance.rsmodified+32 -12
| @@ -4,15 +4,34 @@ | |||
| 4 | 4 | ||
| 5 | use crate::*; | 5 | use crate::*; |
| 6 | 6 | ||
| 7 | -/// corner-cut: which dock tab is showing lives in a module-level flag rather | 7 | +/// Where the dock tab pick lives: one word beside the theme and the |
| 8 | -/// than a `Player` field, because the stance's other regions (spine, screen, | 8 | +/// keybindings (`ui::theme::config_path`/`save`/`load` is the exact pattern |
| 9 | -/// time band) are being threaded onto `Player` by a second builder in this | 9 | +/// this follows -- a small, silent, config-file round trip is the mechanism |
| 10 | -/// same pass and a shared struct is not a safe place for two agents to land | 10 | +/// this editor already uses for a preference that outlives the window, and |
| 11 | -/// fields at once. Ceiling: fold into a `Player::dock_tab` field once that | 11 | +/// the playhead's own continuity lives in the *project* file, which a dock |
| 12 | -/// pass lands, so DESIGN §5's "a room reopens exactly as left ... dock tab" | 12 | +/// tab pick is not: it is not part of the timeline, so it does not belong in |
| 13 | -/// continuity (session save/load) can reach it -- today the flag resets with | 13 | +/// a `.edith`). |
| 14 | -/// the process. | 14 | +pub(crate) fn config_path() -> std::path::PathBuf { |
| 15 | -static DOCK_SRC_ACTIVE: AtomicBool = AtomicBool::new(true); | 15 | + crate::keymap::Keymap::config_path().with_file_name("dock-tab") |
| 16 | +} | ||
| 17 | + | ||
| 18 | +/// The pick from the last session, if there was one. Anything unreadable or | ||
| 19 | +/// unknown leaves the default (`Src`) in force, exactly as a bad theme file | ||
| 20 | +/// does -- neither is the user's work, so neither is worth a startup notice. | ||
| 21 | +pub(crate) fn load() -> bool { | ||
| 22 | + std::fs::read_to_string(config_path()) | ||
| 23 | + .map(|text| text.trim() != "Clip") | ||
| 24 | + .unwrap_or(true) | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +/// Writes the pick. One word, written whole. | ||
| 28 | +fn save(src_active: bool) { | ||
| 29 | + let path = config_path(); | ||
| 30 | + if let Some(dir) = path.parent() { | ||
| 31 | + let _ = std::fs::create_dir_all(dir); | ||
| 32 | + } | ||
| 33 | + let _ = std::fs::write(path, if src_active { "Src\n" } else { "Clip\n" }); | ||
| 34 | +} | ||
| 16 | 35 | ||
| 17 | /// A ghost verb (DESIGN §4): borderless glyph/label in `ink2`, its chord in | 36 | /// A ghost verb (DESIGN §4): borderless glyph/label in `ink2`, its chord in |
| 18 | /// `ink3` beside it, read live off the keymap so it can never drift from the | 37 | /// `ink3` beside it, read live off the keymap so it can never drift from the |
| @@ -80,8 +99,9 @@ fn dock_tab(id: &'static str, label: &'static str, active: bool, cx: &mut Contex | |||
| 80 | .when(active, |d| d.bg(rgb(DARK_RAISED()))) | 99 | .when(active, |d| d.bg(rgb(DARK_RAISED()))) |
| 81 | .cursor_pointer() | 100 | .cursor_pointer() |
| 82 | .hover(|s| s.bg(rgb(DARK_RAISED()))) | 101 | .hover(|s| s.bg(rgb(DARK_RAISED()))) |
| 83 | - .on_click(cx.listener(move |_this, _: &ClickEvent, _, cx| { | 102 | + .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 84 | - DOCK_SRC_ACTIVE.store(label == "Src", Ordering::Relaxed); | 103 | + this.dock_src_active = label == "Src"; |
| 104 | + save(this.dock_src_active); | ||
| 85 | cx.notify(); | 105 | cx.notify(); |
| 86 | })) | 106 | })) |
| 87 | .child(label) | 107 | .child(label) |
| @@ -202,7 +222,7 @@ fn clip_tab(player: &Player, width: f32, window_h: Pixels, cx: &mut Context<Play | |||
| 202 | /// Sources hands off to `library.rs`'s own row anatomy and ladder; Clip's | 222 | /// Sources hands off to `library.rs`'s own row anatomy and ladder; Clip's |
| 203 | /// param rows are whatever their card already draws at this width. | 223 | /// param rows are whatever their card already draws at this width. |
| 204 | pub(crate) fn render(player: &Player, width: f32, window_h: Pixels, cx: &mut Context<Player>) -> impl IntoElement { | 224 | pub(crate) fn render(player: &Player, width: f32, window_h: Pixels, cx: &mut Context<Player>) -> impl IntoElement { |
| 205 | - let src_active = DOCK_SRC_ACTIVE.load(Ordering::Relaxed); | 225 | + let src_active = player.dock_src_active; |
| 206 | div() | 226 | div() |
| 207 | .id("stance-dock-body") | 227 | .id("stance-dock-body") |
| 208 | .flex_1() | 228 | .flex_1() |
crates/app/src/ui/preview.rsmodified+19 -10
| @@ -310,12 +310,19 @@ impl Player { | |||
| 310 | } | 310 | } |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | - /// Two-up OUT|IN judging (DESIGN.md §6): drawn over the screen only when | 313 | + /// Two-up OUT|IN judging (DESIGN.md §6): drawn *in* the screen, below the |
| 314 | - /// the playhead rests exactly on one edge of the subject cut -- the | 314 | + /// picture, only when the playhead rests exactly on one edge of the |
| 315 | - /// outgoing clip's tail beside the incoming one's head, whichever edge | 315 | + /// subject cut -- the outgoing clip's tail beside the incoming one's |
| 316 | - /// the playhead is on. `None` off a cut, off the darkroom path, or with | 316 | + /// head, whichever edge the playhead is on. `None` off a cut, off the |
| 317 | - /// nothing marked, so the legacy picture and a mid-clip darkroom picture | 317 | + /// darkroom path, or with nothing marked, so the legacy picture and a |
| 318 | - /// both draw untouched. | 318 | + /// mid-clip darkroom picture both draw untouched. |
| 319 | + /// | ||
| 320 | + /// DESIGN §5 "never covered" / §11 check 6: this used to be an | ||
| 321 | + /// `absolute()` plate pair over the bottom of the screen, blacking out | ||
| 322 | + /// real picture pixels. The caller (`ui::stance::screen`) now lays this | ||
| 323 | + /// out as a flex sibling *below* the picture instead of layering it on | ||
| 324 | + /// top, so the picture's own `flex_1` shrinks to make room -- a | ||
| 325 | + /// letterbox band, not an occlusion. | ||
| 319 | /// | 326 | /// |
| 320 | /// corner-cut: each side names its neighbour (source, timecode) on a | 327 | /// corner-cut: each side names its neighbour (source, timecode) on a |
| 321 | /// plate rather than decoding its edge frame into a second picture -- | 328 | /// plate rather than decoding its edge frame into a second picture -- |
| @@ -384,10 +391,12 @@ impl Player { | |||
| 384 | }; | 391 | }; |
| 385 | Some( | 392 | Some( |
| 386 | div() | 393 | div() |
| 387 | - .absolute() | 394 | + .id("two-up") |
| 388 | - .bottom_0() | 395 | + .flex_none() |
| 389 | - .left_0() | 396 | + .w_full() |
| 390 | - .right_0() | 397 | + .bg(rgb(DARK_PANEL())) |
| 398 | + .border_t_1() | ||
| 399 | + .border_color(rgba(DARK_SEAM())) | ||
| 391 | .flex() | 400 | .flex() |
| 392 | .gap(px(1.)) | 401 | .gap(px(1.)) |
| 393 | .p(px(8.)) | 402 | .p(px(8.)) |
crates/app/src/ui/stance.rsmodified+108 -16
| @@ -60,6 +60,82 @@ fn ghost(player: &Player, glyph: &str, action: ActionId) -> impl IntoElement { | |||
| 60 | ) | 60 | ) |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | +/// A ghost command whose stride-10 sibling is the same command at a | ||
| 64 | +/// different scale (DESIGN §4): one glyph, both chords shown beside each | ||
| 65 | +/// other rather than a second glyph -- the cheap fix VIOLATION 1 asked for, | ||
| 66 | +/// reusing the ghost grammar instead of a new widget. | ||
| 67 | +fn ghost_dual(player: &Player, glyph: &str, action: ActionId, stride: ActionId) -> impl IntoElement { | ||
| 68 | + div() | ||
| 69 | + .flex_none() | ||
| 70 | + .flex() | ||
| 71 | + .flex_col() | ||
| 72 | + .items_center() | ||
| 73 | + .gap(px(2.)) | ||
| 74 | + .py(px(6.)) | ||
| 75 | + .rounded(px(3.)) | ||
| 76 | + .text_size(px(13.)) | ||
| 77 | + .text_color(rgb(INK2())) | ||
| 78 | + .child(glyph.to_string()) | ||
| 79 | + .child( | ||
| 80 | + div() | ||
| 81 | + .flex() | ||
| 82 | + .gap(px(4.)) | ||
| 83 | + .text_size(px(9.5)) | ||
| 84 | + .text_color(rgb(INK3())) | ||
| 85 | + .child(player.keymap.display(action)) | ||
| 86 | + .child(player.keymap.display(stride)), | ||
| 87 | + ) | ||
| 88 | +} | ||
| 89 | + | ||
| 90 | +/// The keys overlay (DESIGN §9, §12 step 7): every bound command as one | ||
| 91 | +/// chord-and-label row, plate-styled per §4 ("readouts are plates"), shown | ||
| 92 | +/// while [`Player::keys_open`] is set (the same field/guard the legacy | ||
| 93 | +/// modal already used -- `Player::show_actions` sets it, `Player::close_card` | ||
| 94 | +/// clears it on `esc`, both already wired through the darkroom's key | ||
| 95 | +/// handler below). | ||
| 96 | +/// | ||
| 97 | +/// corner-cut: DESIGN §9 wants chords surfaced *in place beside their | ||
| 98 | +/// controls* across every region, dimming the room one fill step; this is | ||
| 99 | +/// one list plate instead, anchored over the bench/ledger footprint so it | ||
| 100 | +/// never reaches the screen. Ceiling: DESIGN §12 step 7's full geographic | ||
| 101 | +/// pass (each region draws its own rows when `keys_open`). | ||
| 102 | +fn keys_overlay(player: &Player) -> impl IntoElement { | ||
| 103 | + div() | ||
| 104 | + .id("stance-keys-overlay") | ||
| 105 | + .absolute() | ||
| 106 | + .bottom_0() | ||
| 107 | + .left_0() | ||
| 108 | + .right_0() | ||
| 109 | + .h(px(BENCH_H + LEDGER_H)) | ||
| 110 | + .bg(rgba(SCRIM())) | ||
| 111 | + .flex() | ||
| 112 | + .child( | ||
| 113 | + div() | ||
| 114 | + .m_auto() | ||
| 115 | + .max_h(px(BENCH_H + LEDGER_H - 16.)) | ||
| 116 | + .max_w(px(420.)) | ||
| 117 | + .overflow_hidden() | ||
| 118 | + .p(px(10.)) | ||
| 119 | + .rounded(px(4.)) | ||
| 120 | + .bg(rgb(DARK_PANEL())) | ||
| 121 | + .border_1() | ||
| 122 | + .border_color(rgba(DARK_SEAM())) | ||
| 123 | + .flex() | ||
| 124 | + .flex_col() | ||
| 125 | + .gap(px(3.)) | ||
| 126 | + .child(section_head("all commands · esc to close")) | ||
| 127 | + .children(player.keymap.entries().iter().map(|b| { | ||
| 128 | + div() | ||
| 129 | + .flex() | ||
| 130 | + .justify_between() | ||
| 131 | + .gap(px(12.)) | ||
| 132 | + .text_size(px(9.5)) | ||
| 133 | + .child(div().text_color(rgb(INK2())).child(b.action.label())) | ||
| 134 | + .child(div().text_color(rgb(INK3())).child(b.chord.pretty())) | ||
| 135 | + })), | ||
| 136 | + ) | ||
| 137 | +} | ||
| 138 | + | ||
| 63 | /// The spine: 56px, left, full height. Every command as ghost glyph + chord, | 139 | /// The spine: 56px, left, full height. Every command as ghost glyph + chord, |
| 64 | /// grouped by task frequency (DESIGN §5) -- transport first (every second), | 140 | /// grouped by task frequency (DESIGN §5) -- transport first (every second), |
| 65 | /// then the cut machinery (DESIGN §6, every cut), then the split and the one | 141 | /// then the cut machinery (DESIGN §6, every cut), then the split and the one |
| @@ -80,30 +156,44 @@ fn spine(player: &Player) -> impl IntoElement { | |||
| 80 | .gap(px(4.)) | 156 | .gap(px(4.)) |
| 81 | .child(section_head("spine")) | 157 | .child(section_head("spine")) |
| 82 | .child(ghost(player, "▶", ActionId::Play)) | 158 | .child(ghost(player, "▶", ActionId::Play)) |
| 83 | - .child(ghost(player, "‹", ActionId::WalkCutPrev)) | 159 | + .child(ghost_dual(player, "‹", ActionId::WalkCutPrev, ActionId::WalkCutPrev10)) |
| 84 | - .child(ghost(player, "›", ActionId::WalkCutNext)) | 160 | + .child(ghost_dual(player, "›", ActionId::WalkCutNext, ActionId::WalkCutNext10)) |
| 161 | + .child(ghost(player, "{", ActionId::SelectPrev)) | ||
| 162 | + .child(ghost(player, "}", ActionId::SelectNext)) | ||
| 85 | .child(ghost(player, "[", ActionId::TrimIn)) | 163 | .child(ghost(player, "[", ActionId::TrimIn)) |
| 86 | .child(ghost(player, "]", ActionId::TrimOut)) | 164 | .child(ghost(player, "]", ActionId::TrimOut)) |
| 87 | .child(ghost(player, "↻", ActionId::LoopTrim)) | 165 | .child(ghost(player, "↻", ActionId::LoopTrim)) |
| 88 | .child(ghost(player, "✂", ActionId::Cut)) | 166 | .child(ghost(player, "✂", ActionId::Cut)) |
| 167 | + .child(ghost(player, "?", ActionId::ShowActions)) | ||
| 89 | } | 168 | } |
| 90 | 169 | ||
| 91 | /// The picture region: top of the centre column, takes the remaining space, | 170 | /// The picture region: top of the centre column, takes the remaining space, |
| 92 | -/// never occluded (DESIGN §5). Reuses [`Player::picture_area`] rather than a | 171 | +/// never occluded (DESIGN §5, §11 check 6). Reuses [`Player::picture_area`] |
| 93 | -/// second image element -- the darkroom draws the same picture the legacy | 172 | +/// rather than a second image element -- the darkroom draws the same picture |
| 94 | -/// tree does -- and layers the two-up OUT|IN judging over it at rest on a | 173 | +/// the legacy tree does -- and, at rest on a cut, letterboxes it by stacking |
| 95 | -/// cut (DESIGN §6). | 174 | +/// the two-up OUT|IN judging *below* it as a flex sibling (DESIGN §6) rather |
| 175 | +/// than layering plates over it: the picture's own `flex_1` shrinks to make | ||
| 176 | +/// room, so every picture pixel that is drawn stays visible. | ||
| 96 | fn screen(player: &mut Player, position: f64, window: &mut Window, cx: &mut Context<Player>) -> impl IntoElement { | 177 | fn screen(player: &mut Player, position: f64, window: &mut Window, cx: &mut Context<Player>) -> impl IntoElement { |
| 178 | + let two_up = player.two_up().map(IntoElement::into_any_element); | ||
| 97 | div() | 179 | div() |
| 98 | .id("stance-screen") | 180 | .id("stance-screen") |
| 99 | .flex_1() | 181 | .flex_1() |
| 100 | .min_h(px(0.)) | 182 | .min_h(px(0.)) |
| 101 | - .relative() | 183 | + .flex() |
| 184 | + .flex_col() | ||
| 102 | // §4: room chrome takes 0 radius. | 185 | // §4: room chrome takes 0 radius. |
| 103 | .rounded(px(0.)) | 186 | .rounded(px(0.)) |
| 104 | .bg(rgb(DARK_CANVAS())) | 187 | .bg(rgb(DARK_CANVAS())) |
| 105 | - .child(player.picture_area(position, window, cx)) | 188 | + .child( |
| 106 | - .children(player.two_up()) | 189 | + div() |
| 190 | + .id("stance-picture") | ||
| 191 | + .flex_1() | ||
| 192 | + .min_h(px(0.)) | ||
| 193 | + .relative() | ||
| 194 | + .child(player.picture_area(position, window, cx)), | ||
| 195 | + ) | ||
| 196 | + .children(two_up) | ||
| 107 | } | 197 | } |
| 108 | 198 | ||
| 109 | /// Fixed-height strip under the screen: timecode leads, ghost transport, cut | 199 | /// Fixed-height strip under the screen: timecode leads, ghost transport, cut |
| @@ -272,12 +362,12 @@ pub(crate) fn render( | |||
| 272 | return; | 362 | return; |
| 273 | } | 363 | } |
| 274 | if let Some(action) = this.keymap.lookup(key, ctrl) { | 364 | if let Some(action) = this.keymap.lookup(key, ctrl) { |
| 275 | - // hook: §12 step 7 -- the keys overlay and the export card | 365 | + // hook: §12 step 7 -- the export card (and the notice plates |
| 276 | - // (and the notice plates that would announce an export's | 366 | + // that would announce an export's progress) has no stance |
| 277 | - // progress) have no stance surface yet, so the two actions | 367 | + // surface yet, so it is suppressed here rather than left to |
| 278 | - // that only ever show up there are suppressed here rather | 368 | + // open a card nothing on screen can draw. `ShowActions` now |
| 279 | - // than left to open a card nothing on screen can draw. | 369 | + // has one ([`keys_overlay`]) so it is no longer on this list. |
| 280 | - if matches!(action, ActionId::ShowActions | ActionId::Export) { | 370 | + if action == ActionId::Export { |
| 281 | return; | 371 | return; |
| 282 | } | 372 | } |
| 283 | this.act(action, window, cx); | 373 | this.act(action, window, cx); |
| @@ -290,6 +380,7 @@ pub(crate) fn render( | |||
| 290 | .child( | 380 | .child( |
| 291 | div() | 381 | div() |
| 292 | .id("stance-centre") | 382 | .id("stance-centre") |
| 383 | + .relative() | ||
| 293 | .flex_1() | 384 | .flex_1() |
| 294 | .min_w(px(0.)) | 385 | .min_w(px(0.)) |
| 295 | .flex() | 386 | .flex() |
| @@ -297,7 +388,8 @@ pub(crate) fn render( | |||
| 297 | .child(screen(player, position, window, cx)) | 388 | .child(screen(player, position, window, cx)) |
| 298 | .child(time_band(player)) | 389 | .child(time_band(player)) |
| 299 | .child(bench(player, cx)) | 390 | .child(bench(player, cx)) |
| 300 | - .child(ledger()), | 391 | + .child(ledger()) |
| 392 | + .when(player.keys_open, |el| el.child(keys_overlay(player))), | ||
| 301 | ) | 393 | ) |
| 302 | .child(dock(player, window_h, cx)) | 394 | .child(dock(player, window_h, cx)) |
| 303 | } | 395 | } |
crates/app/src/ui/toolbar.rsmodified+1 -1
| @@ -378,7 +378,7 @@ impl Player { | |||
| 378 | 0., | 378 | 0., |
| 379 | BG_RAISED(), | 379 | BG_RAISED(), |
| 380 | None, | 380 | None, |
| 381 | - "+ S", | 381 | + "+ C", |
| 382 | "adds a subtitle track under the ones there", | 382 | "adds a subtitle track under the ones there", |
| 383 | ActionId::AddSubtitleLane, | 383 | ActionId::AddSubtitleLane, |
| 384 | cx.listener(|this, _: &ClickEvent, _, cx| { | 384 | cx.listener(|this, _: &ClickEvent, _, cx| { |