forge
Explore
Log in

Don't you dare go Hollow

merge oldui-glyphs

Browse files at this commit

30984fa5229439425b4abd9a9a8246c20e4bc094Ahmet Kaan GümüşParent: a0d9dac6536ed7
crates/app/src/tests/layout.rsmodified+36 -0
@@ -2538,3 +2538,39 @@ fn every_chord_bound_action_has_a_darkroom_affordance_or_is_named_chord_only() {
2538 );2538 );
2539 }2539 }
2540 }2540 }
2541+
2542+/// Transition affordances must be painted and use the existing edit state:
2543+/// fades own their drag handles, an active dissolve remains a mouse toggle,
2544+/// and a carried lane names the exact slot `reorder_lane` will use.
2545+#[test]
2546+fn darkroom_bench_wires_transition_controls_and_lane_drop_cue() {
2547+ let bench = src_text("ui/bench_stance.rs");
2548+ let clip = &bench[bench.find("fn clip_box(").expect("the clip renderer")
2549+ ..bench.find("fn sub_box(").expect("the subtitle renderer")];
2550+ for needle in [
2551+ "fade_wedge(true)",
2552+ "fade_wedge(false)",
2553+ "dissolve_glyph()",
2554+ "this.start_fade_drag(lane, idx, is_in, event.position.x, cx)",
2555+ "this.dissolve_selected(cx)",
2556+ ] {
2557+ assert!(
2558+ clip.contains(needle),
2559+ "the Darkroom clip lost its transition affordance: {needle}"
2560+ );
2561+ }
2562+
2563+ let lane = &bench[bench.find("fn lane_row(").expect("the lane renderer")
2564+ ..bench.find("pub(crate) fn render(").expect("the bench renderer")];
2565+ for needle in [
2566+ "this.preview_lane_drop(event.drag(cx).0, lane, cx)",
2567+ "this.forget_lane_drop(lane, cx)",
2568+ ".lane_drop",
2569+ "if drop.above",
2570+ ] {
2571+ assert!(
2572+ lane.contains(needle),
2573+ "the Darkroom lane lost its reorder feedback: {needle}"
2574+ );
2575+ }
2576+}
crates/app/src/ui/bench_stance.rsmodified+133 -7
@@ -30,10 +30,10 @@
30 //! started it, for the darkroom tree exactly as for the legacy one -- no30 //! started it, for the darkroom tree exactly as for the legacy one -- no
31 //! root wiring lives here.31 //! root wiring lives here.
32 //!32 //!
33-//! Still deferred: fades/dissolve glyphs, and the lane header's own33+//! Fade wedges, dissolve joins, and the lane header's drop-line cue reuse the
34-//! drop-line cue (the legacy `LaneDrop` preview) -- a plain drag_over34+//! legacy interaction state: `FadeDrag` previews the ramp until release,
35-//! highlight stands in for it here, since the cue itself is display-only and35+//! `dissolve_selected` still owns the toggle, and `LaneDrop` answers the same
36-//! `reorder_lane` at the release does not need it.36+//! slot that `reorder_lane` commits.
37 //!37 //!
38 //! `nudge_cut` and friends still act on `Player::selected` directly, with no38 //! `nudge_cut` and friends still act on `Player::selected` directly, with no
39 //! element under the pointer required, and stay untouched by any of this.39 //! element under the pointer required, and stay untouched by any of this.
@@ -179,6 +179,7 @@ fn clip_box(
179 lane: Lane,179 lane: Lane,
180 idx: usize,180 idx: usize,
181 clip: &Clip,181 clip: &Clip,
182+ next: Option<Clip>,
182 scale: Scale,183 scale: Scale,
183 picks: &[(Lane, usize)],184 picks: &[(Lane, usize)],
184 pick_links: &[Option<u32>],185 pick_links: &[Option<u32>],
@@ -201,6 +202,16 @@ fn clip_box(
201 let source = player.sources().get(clip.source);202 let source = player.sources().get(clip.source);
202 let label = source.map(|s| file_name(&s.path));203 let label = source.map(|s| file_name(&s.path));
203 let audio = lane.kind == LaneKind::Audio;204 let audio = lane.kind == LaneKind::Audio;
205+ let fade_in = player.shown_fade_in(lane, idx, clip);
206+ let fade_out = player.shown_fade_out(lane, idx, clip);
207+ let dissolves = lane.kind == LaneKind::Video
208+ && clip.transition_out > 0
209+ && next.is_some_and(|next| next.start == clip.end());
210+ let dissolve_tip: SharedString = format!(
211+ "Remove dissolve — {}",
212+ player.keymap.display(ActionId::Dissolve)
213+ )
214+ .into();
204 let wave = source215 let wave = source
205 .and_then(|s| player.waves.get(&(s.path.clone(), s.audio_stream)))216 .and_then(|s| player.waves.get(&(s.path.clone(), s.audio_stream)))
206 .cloned();217 .cloned();
@@ -382,6 +393,38 @@ fn clip_box(
382 }),393 }),
383 )394 )
384 })395 })
396+ // Fades shade their own ramps over the waveform, including the live
397+ // `FadeDrag` value, so the ramp follows the hand before release.
398+ .when(audio, |d| {
399+ d.children(
400+ [
401+ (fade_in > 0).then(|| {
402+ div()
403+ .absolute()
404+ .left_0()
405+ .top_0()
406+ .h_full()
407+ .w(px(scale
408+ .width_px(f64::from(fade_in) / player.fps)
409+ .min(width)))
410+ .child(fade_wedge(true))
411+ }),
412+ (fade_out > 0).then(|| {
413+ div()
414+ .absolute()
415+ .right_0()
416+ .top_0()
417+ .h_full()
418+ .w(px(scale
419+ .width_px(f64::from(fade_out) / player.fps)
420+ .min(width)))
421+ .child(fade_wedge(false))
422+ }),
423+ ]
424+ .into_iter()
425+ .flatten(),
426+ )
427+ })
385 // Name plate + trim/duration readout: one strip, DESIGN §4's plate428 // Name plate + trim/duration readout: one strip, DESIGN §4's plate
386 // (canvas-on-panel), sat at the clip's top-left/top-right per the mock429 // (canvas-on-panel), sat at the clip's top-left/top-right per the mock
387 // rather than the name alone hanging below the box. Its 21px height is430 // rather than the name alone hanging below the box. Its 21px height is
@@ -443,6 +486,56 @@ fn clip_box(
443 .child(format!("{speed}")),486 .child(format!("{speed}")),
444 )487 )
445 })488 })
489+ // The dissolve is the join's click target: it remains visible only
490+ // where the engine says two video clips really abut, and a click
491+ // selects that leading clip then takes the same toggle as Ctrl+X.
492+ .when(dissolves, |d| {
493+ d.child(
494+ div()
495+ .id(("bench-dissolve", lane.ord * 1000 + idx))
496+ .absolute()
497+ .right_0()
498+ .top_0()
499+ .h_full()
500+ .w(px(scale
501+ .width_px(f64::from(clip.transition_out) / player.fps)
502+ .min(width)))
503+ .occlude()
504+ .cursor_pointer()
505+ .tooltip(move |_, cx| cx.new(|_| Tip(dissolve_tip.clone())).into())
506+ .on_click(cx.listener(move |this, _, _, cx| {
507+ this.pick((lane, idx), false, cx);
508+ this.dissolve_selected(cx);
509+ }))
510+ .child(dissolve_glyph()),
511+ )
512+ })
513+ // The fade handles sit inside the trim strips, so their small top
514+ // corners change a ramp while the outer full-height strips still trim.
515+ .when(audio && trims(span), |d| {
516+ d.children([Edge::Start, Edge::End].into_iter().map(|edge| {
517+ let is_in = edge == Edge::Start;
518+ let mut handle = div()
519+ .absolute()
520+ .top_0()
521+ .w(px(FADE_HANDLE_W))
522+ .h(px(FADE_HANDLE_H))
523+ .occlude()
524+ .cursor(CursorStyle::ResizeLeftRight)
525+ .hover(|s| s.bg(rgb(INK2())))
526+ .on_mouse_down(
527+ MouseButton::Left,
528+ cx.listener(move |this, event: &MouseDownEvent, _, cx| {
529+ this.start_fade_drag(lane, idx, is_in, event.position.x, cx);
530+ }),
531+ );
532+ handle = match edge {
533+ Edge::Start => handle.left(px(EDGE_W)),
534+ Edge::End => handle.right(px(EDGE_W)),
535+ };
536+ handle
537+ }))
538+ })
446 // Splice gap: the lamp-white sliver at every clip's trailing edge --539 // Splice gap: the lamp-white sliver at every clip's trailing edge --
447 // DESIGN §1 law 3's other legal white, present at every tier (a540 // DESIGN §1 law 3's other legal white, present at every tier (a
448 // sliver at film scale is spine gone too, so the splice is what is541 // sliver at film scale is spine gone too, so the splice is what is
@@ -610,7 +703,19 @@ fn lane_row(
610 let boxes: Vec<_> = clips703 let boxes: Vec<_> = clips
611 .iter()704 .iter()
612 .enumerate()705 .enumerate()
613- .map(|(idx, clip)| clip_box(player, lane, idx, clip, scale, picks, pick_links, cx))706+ .map(|(idx, clip)| {
707+ clip_box(
708+ player,
709+ lane,
710+ idx,
711+ clip,
712+ clips.get(idx + 1).copied(),
713+ scale,
714+ picks,
715+ pick_links,
716+ cx,
717+ )
718+ })
614 .collect();719 .collect();
615 // The bed's other kind of box: a subtitle lane holds no `Clip` at all720 // The bed's other kind of box: a subtitle lane holds no `Clip` at all
616 // (`LaneKind::Subtitle`'s own doc), so this is empty everywhere but S1..721 // (`LaneKind::Subtitle`'s own doc), so this is empty everywhere but S1..
@@ -642,20 +747,30 @@ fn lane_row(
642 type_scale::CHORD_METADATA_MIN_PX,747 type_scale::CHORD_METADATA_MIN_PX,
643 gpui::FontWeight::MEDIUM,748 gpui::FontWeight::MEDIUM,
644 );749 );
750+ let drop = player
751+ .lane_drop
752+ .filter(|drop| drop.lane == lane && cx.has_active_drag());
645 div()753 div()
646 .id(("bench-lane", lane.ord * 10 + lane.kind as usize))754 .id(("bench-lane", lane.ord * 10 + lane.kind as usize))
647 .flex_none()755 .flex_none()
648 .h(px(h))756 .h(px(h))
649 .flex()757 .flex()
758+ .relative()
650 // Dragged, the whole track moves in the stack (`LaneDrag`,759 // Dragged, the whole track moves in the stack (`LaneDrag`,
651 // `Player::reorder_lane`) -- let go anywhere along the row, not just760 // `Player::reorder_lane`) -- let go anywhere along the row, not just
652 // over the head column, since a slot is what is being aimed at.761 // over the head column, since a slot is what is being aimed at.
653- // corner-cut: no drop-line cue (module doc) -- a plain highlight
654- // while the pointer is over the row stands in for it.
655 .drag_over::<LaneDrag>(|d, _, _, _| d.bg(rgb(DARK_RAISED())))762 .drag_over::<LaneDrag>(|d, _, _, _| d.bg(rgb(DARK_RAISED())))
656 .on_drop(cx.listener(move |this, drag: &LaneDrag, _, cx| {763 .on_drop(cx.listener(move |this, drag: &LaneDrag, _, cx| {
657 this.reorder_lane(drag.0, lane, cx);764 this.reorder_lane(drag.0, lane, cx);
658 }))765 }))
766+ .on_drag_move(
767+ cx.listener(move |this, event: &DragMoveEvent<LaneDrag>, _, cx| {
768+ if !event.bounds.contains(&event.event.position) {
769+ return this.forget_lane_drop(lane, cx);
770+ }
771+ this.preview_lane_drop(event.drag(cx).0, lane, cx);
772+ }),
773+ )
659 .child(774 .child(
660 // Pinned track head: its drag handle remains the lane label; verbs775 // Pinned track head: its drag handle remains the lane label; verbs
661 // stay separate pointer targets so a mix/remove click never starts776 // stay separate pointer targets so a mix/remove click never starts
@@ -952,6 +1067,17 @@ fn lane_row(
952 }),1067 }),
953 ),1068 ),
954 )1069 )
1070+ // The drop-line is inside its target row so it survives the lane
1071+ // column's clipping at the first row; it marks exactly the slot the
1072+ // release will reorder into, rather than a generic drag highlight.
1073+ .children(drop.map(|drop| {
1074+ let line = div().absolute().left_0().w_full().h(px(2.)).bg(rgb(INK1()));
1075+ if drop.above {
1076+ line.top_0()
1077+ } else {
1078+ line.bottom_0()
1079+ }
1080+ }))
955 }1081 }
956 1082
957 /// The bench's content: pinned ruler, pinned heads, lane stack -- compressed1083 /// The bench's content: pinned ruler, pinned heads, lane stack -- compressed