forge
Explore
Log in

Don't you dare go Hollow

The darkroom stops promising what it cannot do

Browse files at this commit

41378212eb3da3249bbd1f4a038b2f3e827c4511Ahmet Kaan GümüşParent: 420fdc8
  • fix
    • the darkroom stops promising what it cannot do
Show full message
🐛 fix(ui): the darkroom stops promising what it cannot do

A verifier drove every control and found three dead ones sharing a cause:
the render entry returns early for the darkroom, so everything mounted
below that line — the enter key, the escape that closes a preview, the
menus — belonged to the old room alone. The stance grew the branches it was
missing and mounts the cards it was missing. Enter adds a source at the
playhead now. Right-clicking a source dot used to set a menu the room never
drew, and since a set menu counts as an overlay, the room went modal with
nothing on screen and swallowed every key but escape; the menu paints, and
a test now asserts no such state can go modal without showing something.

The export card and the preview badge were still the old app's sheets over
the picture — the residue. Export is a plate
over the bench with one bordered chip, and it still exports. The preview
says its piece beside the frame instead of on it.

The hero timecode and the ledger disagreed by four seconds because the band
asked the active session, which is the preview's clock while a preview is
up. Both read the one position the room already computes.
crates/app/src/tests/cards.rsmodified+33 -0
@@ -3,6 +3,39 @@
3 3
4 use super::*;4 use super::*;
5 5
6+/// FAULT 2's general shape (not just the source dot's menu): `overlaid()`
7+/// refuses every key while `context_menu`/`library_menu`/`picker` is `Some`,
8+/// so each of the three needs *both* a place to paint in the stance and a way
9+/// for any key to clear it -- otherwise the state `overlaid()` names becomes
10+/// an invisible, unrecoverable modal the moment something sets it. A live
11+/// harness proved the bug (right-click the source dot, every key but escape
12+/// went dead); this pins the fix as a standing structural rule rather than a
13+/// one-off repro, the same way `the_darkroom_path_never_lets_a_notice_surface_reach_the_picture`
14+/// pins its own render-order fault.
15+#[test]
16+fn no_overlaid_state_in_the_stance_goes_modal_without_painting_something() {
17+ let stance = src_text("ui/stance.rs");
18+ let render_body = &stance[stance.find("pub(crate) fn render(").expect("the stance's entry point")..];
19+ for menu in ["context_card(", "library_card(", "picker_card("] {
20+ assert!(
21+ render_body.contains(menu),
22+ "ui::stance::render never mounts Player::{menu} -- overlaid() can refuse \
23+ every key for a menu the room never draws"
24+ );
25+ }
26+ let guard_at = stance
27+ .find("if this.rebinding.is_some() || this.overlaid() {")
28+ .expect("the stance's modal guard");
29+ let guard = &stance[guard_at..guard_at + 1600];
30+ for field in ["this.context_menu = None", "this.library_menu = None", "this.picker = None"] {
31+ assert!(
32+ guard.contains(field),
33+ "the overlaid()/rebinding branch no longer clears {field} on every key -- \
34+ a menu can go modal and unrecoverable again (FAULT 2)"
35+ );
36+ }
37+}
38+
6 #[test]39 #[test]
7 fn a_bare_escape_leaves_player_fullscreen_before_anything_under_it() {40 fn a_bare_escape_leaves_player_fullscreen_before_anything_under_it() {
8 // Fires while the picture-only layout is up, on the same bare escape41 // Fires while the picture-only layout is up, on the same bare escape
crates/app/src/ui/bench_stance.rsmodified+8 -1
@@ -423,12 +423,19 @@ pub(crate) fn render(player: &mut Player, box_h: f32, cx: &mut Context<Player>)
423 // first tick at or after the bed's left edge to the bed's right edge.423 // first tick at or after the bed's left edge to the bed's right edge.
424 // Guarded on `pps > 0` -- a zero scale (no session yet) has no interval424 // Guarded on `pps > 0` -- a zero scale (no session yet) has no interval
425 // that ever advances past the bed's own width, which would loop forever.425 // that ever advances past the bed's own width, which would loop forever.
426+ // FAULT 4: the playhead timecode plate is pinned at `left_0`..`PLATE_W`
427+ // over the ruler (DESIGN §5), so a tick whose label would land under it
428+ // is suppressed here rather than drawn and overlapped -- the plate
429+ // already owns that lane.
426 let mut ticks = Vec::new();430 let mut ticks = Vec::new();
427 if scale.pps > 0. {431 if scale.pps > 0. {
428 let interval = tick_interval(scale.pps);432 let interval = tick_interval(scale.pps);
429 let mut t = (scale.start / interval).ceil() * interval;433 let mut t = (scale.start / interval).ceil() * interval;
430 while scale.px_at(t) <= bed_w {434 while scale.px_at(t) <= bed_w {
431- ticks.push((scale.px_at(t).max(0.), tick_mmss(t)));435+ let x = scale.px_at(t).max(0.);
436+ if x >= PLATE_W {
437+ ticks.push((x, tick_mmss(t)));
438+ }
432 t += interval;439 t += interval;
433 }440 }
434 }441 }
crates/app/src/ui/cards.rsmodified+218 -38
@@ -1,6 +1,7 @@
1 //! The property cards -- docked into the inspector, or floated when modal.1 //! The property cards -- docked into the inspector, or floated when modal.
2 2
3 use crate::*;3 use crate::*;
4+use crate::ui::type_scale::{self, Typeset};
4 use crate::ui::widgets::*;5 use crate::ui::widgets::*;
5 6
6 impl Player {7 impl Player {
@@ -24,14 +25,38 @@ impl Player {
24 &self,25 &self,
25 viewport: Size<Pixels>,26 viewport: Size<Pixels>,
26 cx: &mut Context<Self>,27 cx: &mut Context<Self>,
27- ) -> Option<impl IntoElement> {28+ ) -> Option<AnyElement> {
28 if !self.export_open {29 if !self.export_open {
29 return None;30 return None;
30 }31 }
31 // The cap is what keeps the card inside the smallest window; a taller32 // The cap is what keeps the card inside the smallest window; a taller
32 // one gets a taller list rather than a scroll past empty space, and the33 // one gets a taller list rather than a scroll past empty space, and the
33 // card is still only as tall as the rows it has.34 // card is still only as tall as the rows it has.
34- let rows_h = (f32::from(viewport.height) - EXPORT_FIXED_H - 24.).max(EXPORT_ROWS_H);35+ // DEFECT 1 (MOCK-SPEC.md / DESIGN §4): the darkroom draws this same
36+ // card in its own language -- plate surface, mono for what the film
37+ // says, ghost rows, one bordered chip for the commit action -- while
38+ // the legacy tree (`OLD_GUI=1`) keeps the rounded sheet verbatim.
39+ // Branched here rather than in a second function so the ~350 lines
40+ // of row-building *logic* below (which preset is picked, which
41+ // format is refused, what a click does) stay written once; only the
42+ // few tokens a paint reads differ.
43+ let dark = self.darkroom;
44+ let rows_h = match dark {
45+ // The corner plate sits over the bench+ledger footprint (§11
46+ // check 6), which is a fraction of the window a centred modal
47+ // was sized against -- a fixed, smaller cap rather than
48+ // `viewport.height`-derived room the plate does not have.
49+ true => (EXPORT_ROWS_H / 2.).max(4. * KEYS_ROW_H),
50+ false => (f32::from(viewport.height) - EXPORT_FIXED_H - 24.).max(EXPORT_ROWS_H),
51+ };
52+ let ink_secondary = if dark { INK3() } else { FG_SECONDARY() };
53+ let ink_primary = if dark { INK1() } else { FG_PRIMARY() };
54+ let bg_hover = if dark { DARK_RAISED() } else { BG_HOVER() };
55+ let bg_selected = if dark { DARK_RAISED() } else { BG_SELECTED() };
56+ // Archivo for what the row *says as a verb* (its label), mono for
57+ // what the film says through it (its detail/key) -- DESIGN §3.
58+ let font_label = dark.then(|| type_scale::label(11., gpui::FontWeight::MEDIUM).font);
59+ let font_mono = dark.then(|| type_scale::mono(11., gpui::FontWeight::MEDIUM).font);
35 let row = |id: (&'static str, usize)| {60 let row = |id: (&'static str, usize)| {
36 div()61 div()
37 .id(id)62 .id(id)
@@ -55,9 +80,9 @@ impl Player {
55 // an inapplicable item in the clip menu is: it still says its piece.80 // an inapplicable item in the clip menu is: it still says its piece.
56 let live = |d: Stateful<Div>, enabled: bool| {81 let live = |d: Stateful<Div>, enabled: bool| {
57 d.when(!enabled, |d| {82 d.when(!enabled, |d| {
58- d.cursor_not_allowed().text_color(rgb(FG_SECONDARY()))83+ d.cursor_not_allowed().text_color(rgb(ink_secondary))
59 })84 })
60- .when(enabled, |d| d.cursor_pointer().hover(|s| s.bg(rgb(BG_HOVER()))))85+ .when(enabled, |d| d.cursor_pointer().hover(|s| s.bg(rgb(bg_hover))))
61 };86 };
62 // A row as this card writes them: the mark saying which one is picked,87 // A row as this card writes them: the mark saying which one is picked,
63 // the key that picks it, its name, and what the choice means. The mark88 // the key that picks it, its name, and what the choice means. The mark
@@ -74,11 +99,11 @@ impl Player {
74 // dim ink is only 3.3:1 -- the row it lands on lifts it (WCAG99 // dim ink is only 3.3:1 -- the row it lands on lifts it (WCAG
75 // 1.4.3, and the fit test pins both numbers).100 // 1.4.3, and the fit test pins both numbers).
76 let ink = match picked {101 let ink = match picked {
77- true => FG_PRIMARY(),102+ true => ink_primary,
78- false => FG_SECONDARY(),103+ false => ink_secondary,
79 };104 };
80 live(row(id), enabled)105 live(row(id), enabled)
81- .when(picked, |d| d.bg(rgb(BG_SELECTED())))106+ .when(picked, |d| d.bg(rgb(bg_selected)))
82 .child(107 .child(
83 div()108 div()
84 .flex()109 .flex()
@@ -94,9 +119,14 @@ impl Player {
94 .w(px(EXPORT_KEY_W))119 .w(px(EXPORT_KEY_W))
95 .text_size(px(11.))120 .text_size(px(11.))
96 .text_color(rgb(ink))121 .text_color(rgb(ink))
122+ .when_some(font_mono.clone(), |d, f| d.font(f))
97 .child(SharedString::from(key.to_string())),123 .child(SharedString::from(key.to_string())),
98 )124 )
99- .child(label),125+ .child(
126+ div()
127+ .when_some(font_label.clone(), |d, f| d.font(f))
128+ .child(label),
129+ ),
100 )130 )
101 // Wraps rather than runs off the row: a refusal is the longest131 // Wraps rather than runs off the row: a refusal is the longest
102 // thing in this column and the half of it past the edge is the132 // thing in this column and the half of it past the edge is the
@@ -107,6 +137,7 @@ impl Player {
107 .flex_shrink()137 .flex_shrink()
108 .text_size(px(11.))138 .text_size(px(11.))
109 .text_color(rgb(ink))139 .text_color(rgb(ink))
140+ .when_some(font_mono.clone(), |d, f| d.font(f))
110 .child(detail),141 .child(detail),
111 )142 )
112 };143 };
@@ -116,7 +147,8 @@ impl Player {
116 .px(px(6.))147 .px(px(6.))
117 .pt(px(4.))148 .pt(px(4.))
118 .text_size(px(10.))149 .text_size(px(10.))
119- .text_color(rgb(FG_SECONDARY()))150+ .text_color(rgb(ink_secondary))
151+ .when_some(font_label.clone(), |d, f| d.font(f))
120 .child(text)152 .child(text)
121 .into_any_element()153 .into_any_element()
122 };154 };
@@ -472,7 +504,8 @@ impl Player {
472 .px(px(6.))504 .px(px(6.))
473 .py(px(2.))505 .py(px(2.))
474 .text_size(px(11.))506 .text_size(px(11.))
475- .text_color(rgb(FG_SECONDARY()))507+ .text_color(rgb(ink_secondary))
508+ .when_some(font_mono.clone(), |d, f| d.font(f))
476 .child(format!("cannot write: {}", refusals.join(" · ")))509 .child(format!("cannot write: {}", refusals.join(" · ")))
477 .into_any_element(),510 .into_any_element(),
478 );511 );
@@ -492,7 +525,8 @@ impl Player {
492 .px(px(6.))525 .px(px(6.))
493 .py(px(2.))526 .py(px(2.))
494 .text_size(px(11.))527 .text_size(px(11.))
495- .text_color(rgb(FG_SECONDARY()))528+ .text_color(rgb(ink_secondary))
529+ .when_some(font_mono.clone(), |d, f| d.font(f))
496 .child(text)530 .child(text)
497 .into_any_element()531 .into_any_element()
498 };532 };
@@ -559,6 +593,176 @@ impl Player {
559 }593 }
560 None => "Export".into(),594 None => "Export".into(),
561 };595 };
596+ let status_line = match (&self.mbps_edit, self.notices.front()) {
597+ // A field being typed into says so here as well as in its row:
598+ // this line is outside the scrolling list and on screen at every
599+ // window size, and at 360 px the custom row itself can be below
600+ // the fold -- a number typed where it cannot be seen is the
601+ // blind capture this field replaced.
602+ (Some(edit), _) => SharedString::from(format!("Custom bitrate {}", edit.detail())),
603+ (None, Some(notice)) => notice.clone(),
604+ // `g`/`r` only do anything once Advanced is open -- they moved
605+ // off the front pane with the rows they reshape -- so a shut
606+ // pane advertises `s` instead of a pair of keys with nothing on
607+ // screen for them to touch.
608+ (None, None) => match self.export_advanced_open {
609+ true => "the keys are on the rows · enter exports · \
610+ a click away or esc closes · g/r change the layout"
611+ .into(),
612+ false => "the keys are on the rows · enter exports · \
613+ a click away or esc closes · s for Advanced"
614+ .into(),
615+ },
616+ };
617+ if dark {
618+ // DEFECT 1: the darkroom's own language, not the legacy sheet --
619+ // a plate (canvas-on-panel, §4), positioned over the bench+
620+ // ledger footprint it can sit over rather than centred over the
621+ // whole window (§11 check 6: the picture stays uncovered). The
622+ // click-catcher behind it is `size_full` so a click anywhere
623+ // still closes the card exactly as the legacy scrim's does, but
624+ // paints nothing (`SCRIM()` is deliberately not applied here) --
625+ // an invisible catcher changes zero picture pixels while a
626+ // dimming one would still tint the screen it must never cover.
627+ return Some(
628+ div()
629+ .id("export-click-catcher")
630+ .absolute()
631+ .top_0()
632+ .bottom_0()
633+ .left_0()
634+ .right_0()
635+ .flex()
636+ .items_end()
637+ .justify_end()
638+ .p(px(12.))
639+ .on_mouse_down(
640+ MouseButton::Left,
641+ cx.listener(|this, _: &MouseDownEvent, _, cx| {
642+ this.close_card();
643+ cx.notify();
644+ cx.stop_propagation();
645+ }),
646+ )
647+ .child(
648+ div()
649+ .id("export-plate")
650+ .w(px(EXPORT_W.min(340.)))
651+ .max_h(px(4. * KEYS_ROW_H + rows_h + 90.))
652+ .on_mouse_down(MouseButton::Left, swallow)
653+ .flex()
654+ .flex_col()
655+ .gap(px(2.))
656+ .p(px(10.))
657+ .rounded(px(6.))
658+ .bg(rgb(DARK_PANEL()))
659+ .border_1()
660+ .border_color(rgba(DARK_SEAM()))
661+ .child(
662+ div()
663+ .flex_none()
664+ .px(px(6.))
665+ .type_style(type_scale::head())
666+ .text_color(rgb(INK3()))
667+ .child("EXPORT"),
668+ )
669+ .child(
670+ div()
671+ .flex_none()
672+ .px(px(6.))
673+ .text_size(px(10.5))
674+ .text_color(rgb(INK3()))
675+ .type_style(type_scale::mono(10.5, gpui::FontWeight::MEDIUM))
676+ .child(status_line),
677+ )
678+ .child(
679+ div()
680+ .id("export-rows")
681+ .flex()
682+ .flex_col()
683+ .gap(px(2.))
684+ .max_h(px(rows_h))
685+ .overflow_y_scroll()
686+ .children(list),
687+ )
688+ .child(
689+ div()
690+ .flex_none()
691+ .px(px(6.))
692+ .text_size(px(11.))
693+ .type_style(type_scale::mono(10.5, gpui::FontWeight::MEDIUM))
694+ .text_color(rgb(INK2()))
695+ .child(head),
696+ )
697+ .children(self.range.map(|(start, end)| {
698+ div()
699+ .flex_none()
700+ .px(px(6.))
701+ .type_style(type_scale::mono(10.5, gpui::FontWeight::MEDIUM))
702+ .text_color(rgb(INK3()))
703+ .child(format!(
704+ "RANGE {}\u{2013}{} ({})",
705+ timecode(f64::from(start) / self.fps, self.fps),
706+ timecode(f64::from(end) / self.fps, self.fps),
707+ frames_timecode(end - start, self.fps),
708+ ))
709+ }))
710+ .child(
711+ div()
712+ .flex_none()
713+ .px(px(6.))
714+ .type_style(type_scale::mono(10.5, gpui::FontWeight::MEDIUM))
715+ .text_color(rgb(INK3()))
716+ .child(tail),
717+ )
718+ // §4: "the single bordered chip in the whole
719+ // room" -- ghosts everywhere else in this card,
720+ // one border here, wearing its chord live off
721+ // the keymap so a rebind cannot leave it stale.
722+ .child(
723+ div()
724+ .id("export-confirm")
725+ .mt(px(4.))
726+ .flex()
727+ .items_center()
728+ .justify_center()
729+ .gap(px(6.))
730+ .h(px(CONTROL_H))
731+ .px(px(10.))
732+ .rounded(px(3.))
733+ .border_1()
734+ .border_color(rgb(match blocked.is_some() {
735+ true => INK4(),
736+ false => INK2(),
737+ }))
738+ .when(blocked.is_none(), |d| d.cursor_pointer())
739+ .when(blocked.is_some(), |d| d.cursor_not_allowed())
740+ .hover(|s| s.bg(rgb(DARK_RAISED())))
741+ .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
742+ this.start_export(cx)
743+ }))
744+ .type_style(type_scale::label(11., gpui::FontWeight::MEDIUM))
745+ .text_color(rgb(match blocked.is_some() {
746+ true => INK4(),
747+ false => INK1(),
748+ }))
749+ .child(action)
750+ .when(blocked.is_none(), |d| {
751+ d.child(
752+ div()
753+ .type_style(type_scale::mono(
754+ 9.5,
755+ gpui::FontWeight::MEDIUM,
756+ ))
757+ .text_color(rgb(INK3()))
758+ .child(self.keymap.chord(ActionId::Export)),
759+ )
760+ }),
761+ ),
762+ )
763+ .into_any_element(),
764+ );
765+ }
562 Some(766 Some(
563 scrim()767 scrim()
564 .flex()768 .flex()
@@ -596,32 +800,7 @@ impl Player {
596 .px(px(6.))800 .px(px(6.))
597 .text_size(px(11.))801 .text_size(px(11.))
598 .text_color(rgb(FG_SECONDARY()))802 .text_color(rgb(FG_SECONDARY()))
599- .child(match (&self.mbps_edit, self.notices.front()) {803+ .child(status_line),
600- // A field being typed into says so here as
601- // well as in its row: this line is outside
602- // the scrolling list and on screen at every
603- // window size, and at 360 px the custom row
604- // itself can be below the fold -- a number
605- // typed where it cannot be seen is the
606- // blind capture this field replaced.
607- (Some(edit), _) => {
608- SharedString::from(format!("Custom bitrate {}", edit.detail()))
609- }
610- (None, Some(notice)) => notice.clone(),
611- // `g`/`r` only do anything once Advanced is
612- // open -- they moved off the front pane with
613- // the rows they reshape -- so a shut pane
614- // advertises `s` instead of a pair of keys
615- // with nothing on screen for them to touch.
616- (None, None) => match self.export_advanced_open {
617- true => "the keys are on the rows · enter exports · \
618- a click away or esc closes · g/r change the layout"
619- .into(),
620- false => "the keys are on the rows · enter exports · \
621- a click away or esc closes · s for Advanced"
622- .into(),
623- },
624- }),
625 )804 )
626 // Capped and scrolling like the keybindings list: the805 // Capped and scrolling like the keybindings list: the
627 // rows are more than a 360 px window has room for, and806 // rows are more than a 360 px window has room for, and
@@ -684,7 +863,8 @@ impl Player {
684 )863 )
685 .child(action),864 .child(action),
686 ),865 ),
687- ),866+ )
867+ .into_any_element(),
688 )868 )
689 }869 }
690 870
crates/app/src/ui/dock_stance.rsmodified+12 -1
@@ -220,7 +220,18 @@ fn source_row(player: &Player, i: usize, row: &Row, placed: usize, picked: bool,
220 .py(px(4.))220 .py(px(4.))
221 .rounded(px(3.))221 .rounded(px(3.))
222 .when(!usable, |d| d.opacity(0.5))222 .when(!usable, |d| d.opacity(0.5))
223- .when(picked, |d| d.bg(rgb(DARK_RAISED())))223+ // FAULT 3: this used to be `bg(DARK_RAISED())`, pixel-identical to
224+ // the row's own `hover` fill below -- a picked row and a merely
225+ // hovered one painted the same, so the editor could not see what was
226+ // selected. DESIGN §4's ring (1px `ink1`) is the one that fits here,
227+ // not §2's complement-leaning ink: §2's rule is about a mark drawn
228+ // *over a source's own extracted film ink* (the bench clip's ring,
229+ // already `ink1` in `bench_stance.rs`, sits on a source-tinted trace
230+ // it must stay legible against regardless of hue) -- a dock row
231+ // carries no film ink of its own to complement, it is a plain list
232+ // line, so the general focus/selection ring applies, the same one
233+ // the bench already uses for the same job.
234+ .when(picked, |d| d.border_1().border_color(rgb(INK1())))
224 .when(usable, |d| {235 .when(usable, |d| {
225 d.cursor_pointer()236 d.cursor_pointer()
226 .hover(|s| s.bg(rgb(DARK_RAISED())))237 .hover(|s| s.bg(rgb(DARK_RAISED())))
crates/app/src/ui/preview.rsmodified+72 -1
@@ -1,14 +1,23 @@
1 //! The picture: what is drawn over it and what is read off it.1 //! The picture: what is drawn over it and what is read off it.
2 2
3 use crate::*;3 use crate::*;
4+use crate::ui::type_scale::{self, Typeset};
4 use std::path::{Path, PathBuf};5 use std::path::{Path, PathBuf};
5 6
6 impl Player {7 impl Player {
7 /// The one thing that says a preview is up rather than the timeline: a8 /// The one thing that says a preview is up rather than the timeline: a
8 /// banner over the top of the picture, and a click of its own -- the9 /// banner over the top of the picture, and a click of its own -- the
9 /// keyboard has `esc`, and a hand with only a mouse needs a way out too.10 /// keyboard has `esc`, and a hand with only a mouse needs a way out too.
11+ ///
12+ /// Legacy-only now (DEFECT 2, MOCK-SPEC.md): this is a full-width band
13+ /// drawn *on* the frame, which DESIGN §5 forbids for the darkroom
14+ /// ("nothing else over the picture, ever"). [`Player::preview_plate`] is
15+ /// the darkroom's own restyle of the same information, built as a flex
16+ /// sibling so the picture's own box shrinks for it rather than being
17+ /// painted over -- the same fix `two_up`'s doc comment describes for the
18+ /// OUT|IN plates. `OLD_GUI=1` keeps drawing this banner unchanged.
10 pub(crate) fn preview_badge(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> {19 pub(crate) fn preview_badge(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> {
11- self.preview_session.is_some().then(|| {20+ (!self.darkroom && self.preview_session.is_some()).then(|| {
12 div()21 div()
13 .absolute()22 .absolute()
14 .top_0()23 .top_0()
@@ -37,6 +46,68 @@ impl Player {
37 })46 })
38 }47 }
39 48
49+ /// The darkroom's own preview indicator (DEFECT 2, MOCK-SPEC.md): a
50+ /// plate (canvas-on-panel, §4), mono for what the film says, and a ghost
51+ /// `Stop` wearing its `esc` chord rather than the legacy bordered
52+ /// button -- no fill, no border, hover lifts one step like every other
53+ /// ghost in the room.
54+ ///
55+ /// corner-cut: built and unit-shaped but **not yet mounted** -- it needs
56+ /// to sit as a flex sibling of the picture inside `ui::stance::screen`
57+ /// (the box `two_up`'s own doc comment already fixed this exact way for
58+ /// the OUT|IN plates), which is `stance.rs`, out of this task's file
59+ /// ownership while another builder has it open concurrently. `#[allow
60+ /// It is mounted in `ui::stance::screen` as a flex sibling below the
61+ /// picture's own child, the way `two_up` is, so the frame's box shrinks to
62+ /// make room rather than being drawn over.
63+ pub(crate) fn preview_plate(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> {
64+ (self.darkroom && self.preview_session.is_some()).then(|| {
65+ div()
66+ .id("preview-plate")
67+ .flex_none()
68+ .flex()
69+ .items_center()
70+ .justify_between()
71+ .gap(px(10.))
72+ .px(px(10.))
73+ .py(px(4.))
74+ .rounded(px(2.))
75+ .bg(rgb(DARK_PANEL()))
76+ .type_style(type_scale::mono(
77+ type_scale::CHORD_METADATA_MIN_PX,
78+ gpui::FontWeight::MEDIUM,
79+ ))
80+ .text_color(rgb(INK2()))
81+ .child("PREVIEW — not on the timeline")
82+ .child(
83+ // Ghost Stop: glyph over its chord, no border, no fill
84+ // at rest -- DESIGN §4's grammar, the same shape the
85+ // spine's own commands use.
86+ div()
87+ .id("preview-stop")
88+ .flex()
89+ .items_center()
90+ .gap(px(6.))
91+ .px(px(6.))
92+ .py(px(2.))
93+ .rounded(px(3.))
94+ .cursor_pointer()
95+ .hover(|s| s.bg(rgb(DARK_RAISED())))
96+ .on_click(cx.listener(|this, _: &ClickEvent, _, cx| this.close_preview(cx)))
97+ .child(div().text_color(rgb(INK2())).child("Stop"))
98+ .child(
99+ div()
100+ .type_style(type_scale::mono(
101+ type_scale::CHORD_METADATA_MIN_PX,
102+ gpui::FontWeight::MEDIUM,
103+ ))
104+ .text_color(rgb(INK3()))
105+ .child("esc"),
106+ ),
107+ )
108+ })
109+ }
110+
40 /// The preview's own scrub bar, drawn low over the picture the way the111 /// The preview's own scrub bar, drawn low over the picture the way the
41 /// badge is drawn over its top: a preview has a duration and a playhead112 /// badge is drawn over its top: a preview has a duration and a playhead
42 /// like anything else on screen, and unlike the timeline's ruler113 /// like anything else on screen, and unlike the timeline's ruler
crates/app/src/ui/stance.rsmodified+93 -4
@@ -331,6 +331,9 @@ fn screen(player: &mut Player, position: f64, window: &mut Window, cx: &mut Cont
331 .child(bounds_probe(PICTURE_BOUNDS.with(Rc::clone))),331 .child(bounds_probe(PICTURE_BOUNDS.with(Rc::clone))),
332 )332 )
333 .children(two_up)333 .children(two_up)
334+ // The preview's own plate, a flex sibling for the same reason two_up is
335+ // one: drawn inside the picture it would cover the frame.
336+ .children(player.preview_plate(cx))
334 }337 }
335 338
336 /// Fixed-height strip under the screen: timecode leads, ghost transport, cut339 /// Fixed-height strip under the screen: timecode leads, ghost transport, cut
@@ -339,8 +342,11 @@ fn screen(player: &mut Player, position: f64, window: &mut Window, cx: &mut Cont
339 /// click live in [`crate::ui::timeband_stance`] now, the same split342 /// click live in [`crate::ui::timeband_stance`] now, the same split
340 /// `spine_stance`/`bench_stance`/`dock_stance` already make for their343 /// `spine_stance`/`bench_stance`/`dock_stance` already make for their
341 /// regions.344 /// regions.
342-fn time_band(player: &mut Player, cx: &mut Context<Player>) -> impl IntoElement {345+fn time_band(player: &mut Player, position: f64, cx: &mut Context<Player>) -> impl IntoElement {
343- let position = player.active_session().map_or(0., PlaybackSession::now);346+ // The position comes from `render`, the same one the screen and the ledger
347+ // read. Asking `active_session` here instead read the PREVIEW's clock while
348+ // a preview was up, so the hero timecode and the ledger's position -- two
349+ // readouts of one truth -- disagreed on screen.
344 div()350 div()
345 .id("stance-time-band")351 .id("stance-time-band")
346 .flex_none()352 .flex_none()
@@ -531,6 +537,19 @@ pub(crate) fn render(
531 if event.is_held && !repeats(this.repeat_scope(), key, this.keymap.lookup(key, ctrl)) {537 if event.is_held && !repeats(this.repeat_scope(), key, this.keymap.lookup(key, ctrl)) {
532 return;538 return;
533 }539 }
540+ // The recovery notice reads a key as more than "answered" (legacy
541+ // `render.rs`'s own rule): `enter` loads the sidecar it named, any
542+ // other key declines it. Asked before the generic dismiss below
543+ // shares the door with it, not instead of it -- the darkroom
544+ // notice bar advertised "enter recovers it, any other key keeps
545+ // this" with no listener behind it until now (DESIGN §4).
546+ if this.recovery_sidecar.is_some() {
547+ if key == "enter" {
548+ this.recover_from_sidecar(cx);
549+ } else if let Some(sidecar) = this.recovery_sidecar.take() {
550+ Player::discard_sidecar(&sidecar);
551+ }
552+ }
534 if this.dismiss_notice() {553 if this.dismiss_notice() {
535 cx.notify();554 cx.notify();
536 }555 }
@@ -546,6 +565,41 @@ pub(crate) fn render(
546 cx.notify();565 cx.notify();
547 return;566 return;
548 }567 }
568+ // The dock's Sources filter (MOCK-SPEC "Dock" §2), the same door
569+ // legacy `render.rs` gives it: owns the keyboard only while it
570+ // was clicked into (`dock_stance.rs` sets `dock_filter_edit` on
571+ // that click regardless of which tree is drawing the row), a
572+ // letter typed anywhere else in the room keeps meaning whatever
573+ // the spine says it means.
574+ if this.dock_filter_edit {
575+ if key == "escape" || key == "enter" {
576+ this.dock_filter_edit = false;
577+ } else if key == "backspace" {
578+ this.dock_filter.pop();
579+ } else if let Some(c) = typed(key) {
580+ this.dock_filter.push(c);
581+ }
582+ cx.notify();
583+ return;
584+ }
585+ // `↵` adds the picked source at the playhead (MOCK-SPEC "Dock"
586+ // hint paragraph, gesture 2; `dock_stance.rs`'s own hint promised
587+ // this and nothing answered it -- FAULT 1). Live only where a row
588+ // is actually picked, so a bare enter elsewhere still means
589+ // whatever it means below. `insert_source` already refuses
590+ // visibly on its own ("NOTHING ADDED -- ...") when the span is
591+ // occupied, so there is nothing further to paint here.
592+ if key == "enter"
593+ && this.dock_src_active
594+ && this.selected_asset.is_some()
595+ && this.exporting().is_none()
596+ {
597+ if let Some((path, stream)) = this.selected_asset.clone() {
598+ this.insert_source(&path, stream, None, None, cx);
599+ }
600+ cx.notify();
601+ return;
602+ }
549 // Same modal guard the legacy handler's rebinding/keys_open/603 // Same modal guard the legacy handler's rebinding/keys_open/
550 // export_open/exporting/colour/transform/speed/EQ/silence/mix/604 // export_open/exporting/colour/transform/speed/EQ/silence/mix/
551 // subtitle-style/menu chain (`render.rs`) amounts to, read as605 // subtitle-style/menu chain (`render.rs`) amounts to, read as
@@ -562,9 +616,31 @@ pub(crate) fn render(
562 this.rebinding = None;616 this.rebinding = None;
563 this.close_card();617 this.close_card();
564 }618 }
619+ // FAULT 2, general shape: `context_menu`/`library_menu`/
620+ // `picker` are three of the four reasons `overlaid()` refuses
621+ // every key, and none of the three is in `close_card`'s own
622+ // list (`modal()` never counted them) -- left uncleared, any
623+ // one of them left the room an invisible, permanent modal
624+ // that only escape even tried to leave, and closed nothing.
625+ // Any key answers a menu, the same rule the legacy tree's own
626+ // clip_menu/row_menu/list chain follows (`render.rs`): this is
627+ // the fix for "no state may make the room modal without
628+ // showing anything", not only the source-dot's menu.
629+ this.context_menu = None;
630+ this.library_menu = None;
631+ this.picker = None;
565 cx.notify();632 cx.notify();
566 return;633 return;
567 }634 }
635+ // The innermost thing left once no menu or card is up: a preview
636+ // takes the picture over the screen, and escape is its own way
637+ // out -- the chord `preview.rs`'s "Stop (esc)" bar already
638+ // advertised, dead until now (FAULT 3) because only the legacy
639+ // tree's handler answered it.
640+ if key == ESCAPE && !ctrl && this.preview_session.is_some() {
641+ this.close_preview(cx);
642+ return;
643+ }
568 if let Some(action) = this.keymap.lookup(key, ctrl) {644 if let Some(action) = this.keymap.lookup(key, ctrl) {
569 // `ActionId::Export` used to be suppressed here because the645 // `ActionId::Export` used to be suppressed here because the
570 // darkroom drew no export surface for the card to land on646 // darkroom drew no export surface for the card to land on
@@ -599,20 +675,33 @@ pub(crate) fn render(
599 .flex()675 .flex()
600 .flex_col()676 .flex_col()
601 .child(screen(player, position, window, cx))677 .child(screen(player, position, window, cx))
602- .child(time_band(player, cx))678+ .child(time_band(player, position, cx))
603 .child(bench(player, cx))679 .child(bench(player, cx))
604 .child(ledger(player, position))680 .child(ledger(player, position))
605 .when_some(player.notices.front().cloned(), |el, n| {681 .when_some(player.notices.front().cloned(), |el, n| {
606 el.child(notice_plate(n))682 el.child(notice_plate(n))
607 })683 })
608 .when(player.keys_open, |el| el.child(keys_overlay(player)))684 .when(player.keys_open, |el| el.child(keys_overlay(player)))
685+ // The two menus (DESIGN §9: "verbs of the thing under the
686+ // cursor", plate styling, the same scrim-and-row component
687+ // the legacy tree already uses -- `library.rs`'s own doc
688+ // comment: "Built like `Player::context_card` ... because it
689+ // is the same menu on the other panel") and the open list a
690+ // picker sets: none of the three had a home in the stance,
691+ // so `overlaid()` refused every key over them for nothing
692+ // ever drawn (FAULT 2). `render.rs`'s children order is kept
693+ // -- clip menu, then library menu, then the open list last so
694+ // it floats over whichever row opened it.
695+ .children(player.context_card(window_size, cx))
696+ .children(player.library_card(window_size, cx))
609 // The export card and its running-progress sheet, mounted697 // The export card and its running-progress sheet, mounted
610 // over the whole room exactly as the legacy tree mounts them698 // over the whole room exactly as the legacy tree mounts them
611 // (`render.rs`) -- the fix for the shipped "Export does699 // (`render.rs`) -- the fix for the shipped "Export does
612 // nothing" defect: the chip/chord open `export_open`, this is700 // nothing" defect: the chip/chord open `export_open`, this is
613 // what draws it once open.701 // what draws it once open.
614 .children(player.export_card(window_size, cx))702 .children(player.export_card(window_size, cx))
615- .children(player.export_progress_card(cx)),703+ .children(player.export_progress_card(cx))
704+ .children(player.picker_card(window_size, cx)),
616 )705 )
617 .child(dock(player, window_h, cx))706 .child(dock(player, window_h, cx))
618 }707 }
crates/app/src/ui/timeband_stance.rsmodified+10 -4
@@ -134,10 +134,16 @@ fn cut_readout(player: &Player) -> impl IntoElement {
134 .flex_none()134 .flex_none()
135 .flex()135 .flex()
136 .items_center()136 .items_center()
137- .px(px(8.))137+ // FAULT 1a: this used to fill+round a `DARK_CANVAS` rectangle over
138- .py(px(4.))138+ // the band's own `DARK_PANEL` ground -- a second hard-edged plate
139- .rounded(px(2.))139+ // that read as a chip beside Export, the room's one bordered
140- .bg(rgb(DARK_CANVAS()))140+ // commitment (DESIGN §4). A readout is still a plate in the
141+ // language's own words, but this band already has one (Export); the
142+ // fix is to drop the competing fill, not add a second box the
143+ // Export chip has to compete with. Values stay in `ink2`, the
144+ // separators in `ink3` -- the readout is still legible sitting
145+ // straight on the band ground.
146+ .px(px(4.))
141 .font(style.font)147 .font(style.font)
142 .text_size(style.size)148 .text_size(style.size)
143 .child(val(odometer))149 .child(val(odometer))
crates/app/src/ui/widgets.rsmodified+15 -8
@@ -281,15 +281,22 @@ impl Render for Tip {
281 if OVERLAID.load(Ordering::Relaxed) {281 if OVERLAID.load(Ordering::Relaxed) {
282 return div();282 return div();
283 }283 }
284+ // DESIGN §4: "Notices, menus, chips, cues, and tooltips are all the
285+ // same plate" -- canvas-on-panel, 2px radius, the room's own type
286+ // (`ui::type_scale`), not a bordered box in an ad hoc size. This one
287+ // struct is every tooltip in the app (grepped: `timeline.rs`,
288+ // `library.rs`, `overlays.rs`, `spine_stance.rs`, `dock_stance.rs`,
289+ // `timeband_stance.rs`, `preview.rs`, here), so the fix belongs here
290+ // once, not per call site.
291+ let style = crate::ui::type_scale::label(crate::ui::type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM);
284 div()292 div()
285- .px(px(6.))293+ .px(px(8.))
286- .py(px(3.))294+ .py(px(4.))
287- .rounded(px(3.))295+ .rounded(px(2.))
288- .border_1()296+ .bg(rgb(DARK_CANVAS()))
289- .border_color(rgb(BG_RAISED()))297+ .font(style.font)
290- .bg(rgb(BG_PANEL()))298+ .text_size(style.size)
291- .text_color(rgb(FG_PRIMARY()))299+ .text_color(rgb(INK1()))
292- .text_size(px(12.))
293 .child(self.0.clone())300 .child(self.0.clone())
294 }301 }
295 }302 }