Home Darkroom actions
Browse files at this commitf83cf0a8e110dcd304a28d13e3b2b5fe1291c915Parent: 3e04aeb- feat
- home Darkroom actions
4 changed files +150 -25
- crates/app/src/tests/layout.rs +22 -25
- crates/app/src/ui/bench_stance.rs +39 -0
- crates/app/src/ui/spine_stance.rs +20 -0
- crates/app/src/ui/timeband_stance.rs +69 -0
crates/app/src/tests/layout.rsmodified+22 -25
| @@ -2408,30 +2408,24 @@ fn hdr_reference_rows_read_content_light_and_use_the_established_empty_state() { | ||
| 2408 | 2408 | /// spelling the action name itself, so each is matched on its own door |
| 2409 | 2409 | /// string instead. |
| 2410 | 2410 | /// |
| 2411 | -/// [`ALLOWED_CHORD_ONLY`] is the honest remainder: fine-grained playhead/edit | |
| 2412 | -/// strokes with no button in the *legacy* tree either (`toolbar.rs`, | |
| 2413 | -/// `inspector.rs`, `library.rs` were all swept for the same names and come | |
| 2414 | -/// up equally empty) -- not a regression this task closes, just an existing | |
| 2415 | -/// keyboard-only stroke this editor has never given a face. | |
| 2411 | +/// Every action gets a persistent regional control or the context-menu row for | |
| 2412 | +/// the thing it acts on. The four exemptions are independently-owned lane | |
| 2413 | +/// parity work, named with their owners so a future removal cannot silently | |
| 2414 | +/// turn any unrelated action back into keyboard-only. | |
| 2416 | 2415 | #[test] |
| 2417 | -fn every_chord_bound_action_has_a_darkroom_affordance_or_is_named_chord_only() { | |
| 2416 | +fn every_action_has_a_darkroom_widget_home_or_explicit_owner() { | |
| 2418 | 2417 | use crate::ActionId; |
| 2419 | - const ALLOWED_CHORD_ONLY: &[ActionId] = &[ | |
| 2420 | - ActionId::StepBack, | |
| 2421 | - ActionId::StepForward, | |
| 2422 | - ActionId::GoStart, | |
| 2423 | - ActionId::GoEnd, | |
| 2424 | - ActionId::PrevSyncPoint, | |
| 2425 | - ActionId::NextSyncPoint, | |
| 2426 | - ActionId::WalkCutNext10, | |
| 2427 | - ActionId::WalkCutPrev10, | |
| 2428 | - ActionId::SetIn, | |
| 2429 | - ActionId::SetOut, | |
| 2430 | - ActionId::ClearRange, | |
| 2431 | - ActionId::SelectAll, | |
| 2432 | - ActionId::RemoveVideoLane, | |
| 2433 | - ActionId::RemoveAudioLane, | |
| 2434 | - ActionId::Crossfade, | |
| 2418 | + const EXPLICITLY_OWNED_ELSEWHERE: &[(ActionId, &str)] = &[ | |
| 2419 | + ( | |
| 2420 | + ActionId::RemoveVideoLane, | |
| 2421 | + "lane-header remove parity owns video-lane controls", | |
| 2422 | + ), | |
| 2423 | + ( | |
| 2424 | + ActionId::RemoveAudioLane, | |
| 2425 | + "lane-header remove parity owns audio-lane controls", | |
| 2426 | + ), | |
| 2427 | + (ActionId::Crossfade, "fade parity owns crossfade controls"), | |
| 2428 | + (ActionId::Dissolve, "fade parity owns dissolve controls"), | |
| 2435 | 2429 | ]; |
| 2436 | 2430 | let darkroom = [ |
| 2437 | 2431 | "ui/bench_stance.rs", |
| @@ -2448,7 +2442,11 @@ fn every_chord_bound_action_has_a_darkroom_affordance_or_is_named_chord_only() { | ||
| 2448 | 2442 | .map(src_text) |
| 2449 | 2443 | .join("\n"); |
| 2450 | 2444 | for action in ActionId::ALL { |
| 2451 | - if ALLOWED_CHORD_ONLY.contains(&action) { | |
| 2445 | + if let Some((_, owner)) = EXPLICITLY_OWNED_ELSEWHERE | |
| 2446 | + .iter() | |
| 2447 | + .find(|(owned, _)| *owned == action) | |
| 2448 | + { | |
| 2449 | + assert!(!owner.is_empty(), "ActionId::{action:?} needs an owner"); | |
| 2452 | 2450 | continue; |
| 2453 | 2451 | } |
| 2454 | 2452 | let name = format!("{action:?}"); |
| @@ -2458,8 +2456,7 @@ fn every_chord_bound_action_has_a_darkroom_affordance_or_is_named_chord_only() { | ||
| 2458 | 2456 | assert!( |
| 2459 | 2457 | mentioned, |
| 2460 | 2458 | "ActionId::{name} is bound to a chord but has no visible affordance \ |
| 2461 | - anywhere in the darkroom tree -- either mount it (see Fit/Redo, this \ | |
| 2462 | - commit) or add it to ALLOWED_CHORD_ONLY with a reason" | |
| 2459 | + anywhere in the darkroom tree -- either mount it or name the owning parity lane" | |
| 2463 | 2460 | ); |
| 2464 | 2461 | } |
| 2465 | 2462 | } |
crates/app/src/ui/bench_stance.rsmodified+39 -0
| @@ -848,6 +848,16 @@ pub(crate) fn render( | ||
| 848 | 848 | .map_or_else(|| vec![Lane::V1, Lane::A1], PlaybackSession::lanes); |
| 849 | 849 | let position = player.active_session().map_or(0., PlaybackSession::now); |
| 850 | 850 | let scale = player.scale; |
| 851 | + let select_all = player.enable(ActionId::SelectAll, None); | |
| 852 | + let select_all_tip: SharedString = match select_all.why() { | |
| 853 | + Some(why) => format!("{} — {why}", player.keymap.display(ActionId::SelectAll)), | |
| 854 | + None => format!( | |
| 855 | + "{} — {}", | |
| 856 | + player.keymap.display(ActionId::SelectAll), | |
| 857 | + ActionId::SelectAll.label() | |
| 858 | + ), | |
| 859 | + } | |
| 860 | + .into(); | |
| 851 | 861 | let bed_w = f32::from(player.ruler.get().size.width).max(1.); |
| 852 | 862 | let filled = scale.px_at(position).clamp(0., bed_w); |
| 853 | 863 | let (picks, pick_links) = player.marks(); |
| @@ -964,6 +974,35 @@ pub(crate) fn render( | ||
| 964 | 974 | )) |
| 965 | 975 | .text_color(rgb(INK1())) |
| 966 | 976 | .child(playhead_tc), |
| 977 | + ) | |
| 978 | + .child( | |
| 979 | + div() | |
| 980 | + .id("bench-select-all") | |
| 981 | + .absolute() | |
| 982 | + .right(px(4.)) | |
| 983 | + .top_0() | |
| 984 | + .h_full() | |
| 985 | + .flex() | |
| 986 | + .items_center() | |
| 987 | + .gap(px(3.)) | |
| 988 | + .px(px(3.)) | |
| 989 | + .rounded(px(2.)) | |
| 990 | + .tooltip(move |_, cx| cx.new(|_| Tip(select_all_tip.clone())).into()) | |
| 991 | + .when(!select_all.yes(), |d| d.opacity(0.4).cursor_not_allowed()) | |
| 992 | + .when(select_all.yes(), |d| { | |
| 993 | + d.cursor_pointer() | |
| 994 | + .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1()))) | |
| 995 | + .on_click(cx.listener(|this, _: &ClickEvent, window, cx| { | |
| 996 | + this.act(ActionId::SelectAll, window, cx) | |
| 997 | + })) | |
| 998 | + }) | |
| 999 | + .type_style(type_scale::mono( | |
| 1000 | + type_scale::CHORD_METADATA_MIN_PX, | |
| 1001 | + gpui::FontWeight::MEDIUM, | |
| 1002 | + )) | |
| 1003 | + .text_color(rgb(INK3())) | |
| 1004 | + .child("all") | |
| 1005 | + .child(player.keymap.chord(ActionId::SelectAll)), | |
| 967 | 1006 | ), |
| 968 | 1007 | ) |
| 969 | 1008 | .child( |
crates/app/src/ui/spine_stance.rsmodified+20 -0
| @@ -278,6 +278,26 @@ pub(crate) fn render(player: &Player, cx: &mut Context<Player>) -> impl IntoElem | ||
| 278 | 278 | cx, |
| 279 | 279 | ), |
| 280 | 280 | )) |
| 281 | + .child(pair( | |
| 282 | + glyph( | |
| 283 | + "spine-cut-prev-ten", | |
| 284 | + "‹10", | |
| 285 | + ActionId::WalkCutPrev10, | |
| 286 | + false, | |
| 287 | + false, | |
| 288 | + player, | |
| 289 | + cx, | |
| 290 | + ), | |
| 291 | + glyph( | |
| 292 | + "spine-cut-next-ten", | |
| 293 | + "10›", | |
| 294 | + ActionId::WalkCutNext10, | |
| 295 | + false, | |
| 296 | + false, | |
| 297 | + player, | |
| 298 | + cx, | |
| 299 | + ), | |
| 300 | + )) | |
| 281 | 301 | .child(trim_control(player.loop_trim.is_some(), player, cx)) |
| 282 | 302 | .child(glyph( |
| 283 | 303 | "spine-loop-trim", |
crates/app/src/ui/timeband_stance.rsmodified+69 -0
| @@ -169,6 +169,26 @@ fn cut_readout(player: &Player) -> impl IntoElement { | ||
| 169 | 169 | .child("roll"), |
| 170 | 170 | ) |
| 171 | 171 | } |
| 172 | +/// Export-range marks belong beside the cut readout they constrain (DESIGN §9): | |
| 173 | +/// each is a direct mouse door to the same action its chord asks for. | |
| 174 | +fn range_marks(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | |
| 175 | + div() | |
| 176 | + .id("stance-range-marks") | |
| 177 | + .flex_none() | |
| 178 | + .flex() | |
| 179 | + .items_center() | |
| 180 | + .gap(px(4.)) | |
| 181 | + .child(ghost("stance-mark-in", player, "I", ActionId::SetIn, false, cx)) | |
| 182 | + .child(ghost("stance-mark-out", player, "O", ActionId::SetOut, false, cx)) | |
| 183 | + .child(ghost( | |
| 184 | + "stance-clear-range", | |
| 185 | + player, | |
| 186 | + "×", | |
| 187 | + ActionId::ClearRange, | |
| 188 | + false, | |
| 189 | + cx, | |
| 190 | + )) | |
| 191 | +} | |
| 172 | 192 | |
| 173 | 193 | /// The contact strip (MOCK-SPEC "Contact strip"): the whole-film minimap |
| 174 | 194 | /// filling the band's remaining width, with a 1px viewport bracket marking |
| @@ -532,6 +552,54 @@ pub(crate) fn render(player: &mut Player, position: f64, cx: &mut Context<Player | ||
| 532 | 552 | false, |
| 533 | 553 | cx, |
| 534 | 554 | )) |
| 555 | + .child(ghost( | |
| 556 | + "stance-tb-step-back", | |
| 557 | + player, | |
| 558 | + "◀", | |
| 559 | + ActionId::StepBack, | |
| 560 | + false, | |
| 561 | + cx, | |
| 562 | + )) | |
| 563 | + .child(ghost( | |
| 564 | + "stance-tb-step-forward", | |
| 565 | + player, | |
| 566 | + "▶", | |
| 567 | + ActionId::StepForward, | |
| 568 | + false, | |
| 569 | + cx, | |
| 570 | + )) | |
| 571 | + .child(ghost( | |
| 572 | + "stance-tb-start", | |
| 573 | + player, | |
| 574 | + "↤", | |
| 575 | + ActionId::GoStart, | |
| 576 | + false, | |
| 577 | + cx, | |
| 578 | + )) | |
| 579 | + .child(ghost( | |
| 580 | + "stance-tb-end", | |
| 581 | + player, | |
| 582 | + "↦", | |
| 583 | + ActionId::GoEnd, | |
| 584 | + false, | |
| 585 | + cx, | |
| 586 | + )) | |
| 587 | + .child(ghost( | |
| 588 | + "stance-tb-sync-prev", | |
| 589 | + player, | |
| 590 | + "‹|", | |
| 591 | + ActionId::PrevSyncPoint, | |
| 592 | + false, | |
| 593 | + cx, | |
| 594 | + )) | |
| 595 | + .child(ghost( | |
| 596 | + "stance-tb-sync-next", | |
| 597 | + player, | |
| 598 | + "|›", | |
| 599 | + ActionId::NextSyncPoint, | |
| 600 | + false, | |
| 601 | + cx, | |
| 602 | + )) | |
| 535 | 603 | // Loop (homeless per this task's audit): the playback-loop |
| 536 | 604 | // toggle -- burst-use during editing per the charter's own |
| 537 | 605 | // classification -- earns the transport cluster it plays |
| @@ -578,6 +646,7 @@ pub(crate) fn render(player: &mut Player, position: f64, cx: &mut Context<Player | ||
| 578 | 646 | )) |
| 579 | 647 | .child(ghost("stance-tb-vol-up", player, "+", ActionId::VolumeUp, false, cx)), |
| 580 | 648 | ) |
| 649 | + .child(range_marks(player, cx)) | |
| 581 | 650 | .child(cut_readout(player)) |
| 582 | 651 | .child(contact_strip(player, position, cx)) |
| 583 | 652 | .child(save_verb(player, cx)) |