From 41378212eb3da3249bbd1f4a038b2f3e827c4511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 20 Aug 2026 16:07:45 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(ui):=20the=20darkroom=20stop?= =?UTF-8?q?s=20promising=20what=20it=20cannot=20do?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.rs | 33 ++++ crates/app/src/ui/bench_stance.rs | 9 +- crates/app/src/ui/cards.rs | 256 +++++++++++++++++++++++---- crates/app/src/ui/dock_stance.rs | 13 +- crates/app/src/ui/preview.rs | 73 +++++++- crates/app/src/ui/stance.rs | 97 +++++++++- crates/app/src/ui/timeband_stance.rs | 14 +- crates/app/src/ui/widgets.rs | 23 ++- 8 files changed, 461 insertions(+), 57 deletions(-) diff --git a/crates/app/src/tests/cards.rs b/crates/app/src/tests/cards.rs index bd839e1..61c782d 100644 --- a/crates/app/src/tests/cards.rs +++ b/crates/app/src/tests/cards.rs @@ -3,6 +3,39 @@ use super::*; +/// FAULT 2's general shape (not just the source dot's menu): `overlaid()` +/// refuses every key while `context_menu`/`library_menu`/`picker` is `Some`, +/// so each of the three needs *both* a place to paint in the stance and a way +/// for any key to clear it -- otherwise the state `overlaid()` names becomes +/// an invisible, unrecoverable modal the moment something sets it. A live +/// harness proved the bug (right-click the source dot, every key but escape +/// went dead); this pins the fix as a standing structural rule rather than a +/// one-off repro, the same way `the_darkroom_path_never_lets_a_notice_surface_reach_the_picture` +/// pins its own render-order fault. +#[test] +fn no_overlaid_state_in_the_stance_goes_modal_without_painting_something() { + let stance = src_text("ui/stance.rs"); + let render_body = &stance[stance.find("pub(crate) fn render(").expect("the stance's entry point")..]; + for menu in ["context_card(", "library_card(", "picker_card("] { + assert!( + render_body.contains(menu), + "ui::stance::render never mounts Player::{menu} -- overlaid() can refuse \ + every key for a menu the room never draws" + ); + } + let guard_at = stance + .find("if this.rebinding.is_some() || this.overlaid() {") + .expect("the stance's modal guard"); + let guard = &stance[guard_at..guard_at + 1600]; + for field in ["this.context_menu = None", "this.library_menu = None", "this.picker = None"] { + assert!( + guard.contains(field), + "the overlaid()/rebinding branch no longer clears {field} on every key -- \ + a menu can go modal and unrecoverable again (FAULT 2)" + ); + } +} + #[test] fn a_bare_escape_leaves_player_fullscreen_before_anything_under_it() { // Fires while the picture-only layout is up, on the same bare escape diff --git a/crates/app/src/ui/bench_stance.rs b/crates/app/src/ui/bench_stance.rs index 42cf8df..9da68b3 100644 --- a/crates/app/src/ui/bench_stance.rs +++ b/crates/app/src/ui/bench_stance.rs @@ -423,12 +423,19 @@ pub(crate) fn render(player: &mut Player, box_h: f32, cx: &mut Context) // first tick at or after the bed's left edge to the bed's right edge. // Guarded on `pps > 0` -- a zero scale (no session yet) has no interval // that ever advances past the bed's own width, which would loop forever. + // FAULT 4: the playhead timecode plate is pinned at `left_0`..`PLATE_W` + // over the ruler (DESIGN §5), so a tick whose label would land under it + // is suppressed here rather than drawn and overlapped -- the plate + // already owns that lane. let mut ticks = Vec::new(); if scale.pps > 0. { let interval = tick_interval(scale.pps); let mut t = (scale.start / interval).ceil() * interval; while scale.px_at(t) <= bed_w { - ticks.push((scale.px_at(t).max(0.), tick_mmss(t))); + let x = scale.px_at(t).max(0.); + if x >= PLATE_W { + ticks.push((x, tick_mmss(t))); + } t += interval; } } diff --git a/crates/app/src/ui/cards.rs b/crates/app/src/ui/cards.rs index a979b32..e2b3c70 100644 --- a/crates/app/src/ui/cards.rs +++ b/crates/app/src/ui/cards.rs @@ -1,6 +1,7 @@ //! The property cards -- docked into the inspector, or floated when modal. use crate::*; +use crate::ui::type_scale::{self, Typeset}; use crate::ui::widgets::*; impl Player { @@ -24,14 +25,38 @@ impl Player { &self, viewport: Size, cx: &mut Context, - ) -> Option { + ) -> Option { if !self.export_open { return None; } // The cap is what keeps the card inside the smallest window; a taller // one gets a taller list rather than a scroll past empty space, and the // card is still only as tall as the rows it has. - let rows_h = (f32::from(viewport.height) - EXPORT_FIXED_H - 24.).max(EXPORT_ROWS_H); + // DEFECT 1 (MOCK-SPEC.md / DESIGN §4): the darkroom draws this same + // card in its own language -- plate surface, mono for what the film + // says, ghost rows, one bordered chip for the commit action -- while + // the legacy tree (`OLD_GUI=1`) keeps the rounded sheet verbatim. + // Branched here rather than in a second function so the ~350 lines + // of row-building *logic* below (which preset is picked, which + // format is refused, what a click does) stay written once; only the + // few tokens a paint reads differ. + let dark = self.darkroom; + let rows_h = match dark { + // The corner plate sits over the bench+ledger footprint (§11 + // check 6), which is a fraction of the window a centred modal + // was sized against -- a fixed, smaller cap rather than + // `viewport.height`-derived room the plate does not have. + true => (EXPORT_ROWS_H / 2.).max(4. * KEYS_ROW_H), + false => (f32::from(viewport.height) - EXPORT_FIXED_H - 24.).max(EXPORT_ROWS_H), + }; + let ink_secondary = if dark { INK3() } else { FG_SECONDARY() }; + let ink_primary = if dark { INK1() } else { FG_PRIMARY() }; + let bg_hover = if dark { DARK_RAISED() } else { BG_HOVER() }; + let bg_selected = if dark { DARK_RAISED() } else { BG_SELECTED() }; + // Archivo for what the row *says as a verb* (its label), mono for + // what the film says through it (its detail/key) -- DESIGN §3. + let font_label = dark.then(|| type_scale::label(11., gpui::FontWeight::MEDIUM).font); + let font_mono = dark.then(|| type_scale::mono(11., gpui::FontWeight::MEDIUM).font); let row = |id: (&'static str, usize)| { div() .id(id) @@ -55,9 +80,9 @@ impl Player { // an inapplicable item in the clip menu is: it still says its piece. let live = |d: Stateful
, enabled: bool| { d.when(!enabled, |d| { - d.cursor_not_allowed().text_color(rgb(FG_SECONDARY())) + d.cursor_not_allowed().text_color(rgb(ink_secondary)) }) - .when(enabled, |d| d.cursor_pointer().hover(|s| s.bg(rgb(BG_HOVER())))) + .when(enabled, |d| d.cursor_pointer().hover(|s| s.bg(rgb(bg_hover)))) }; // A row as this card writes them: the mark saying which one is picked, // the key that picks it, its name, and what the choice means. The mark @@ -74,11 +99,11 @@ impl Player { // dim ink is only 3.3:1 -- the row it lands on lifts it (WCAG // 1.4.3, and the fit test pins both numbers). let ink = match picked { - true => FG_PRIMARY(), - false => FG_SECONDARY(), + true => ink_primary, + false => ink_secondary, }; live(row(id), enabled) - .when(picked, |d| d.bg(rgb(BG_SELECTED()))) + .when(picked, |d| d.bg(rgb(bg_selected))) .child( div() .flex() @@ -94,9 +119,14 @@ impl Player { .w(px(EXPORT_KEY_W)) .text_size(px(11.)) .text_color(rgb(ink)) + .when_some(font_mono.clone(), |d, f| d.font(f)) .child(SharedString::from(key.to_string())), ) - .child(label), + .child( + div() + .when_some(font_label.clone(), |d, f| d.font(f)) + .child(label), + ), ) // Wraps rather than runs off the row: a refusal is the longest // thing in this column and the half of it past the edge is the @@ -107,6 +137,7 @@ impl Player { .flex_shrink() .text_size(px(11.)) .text_color(rgb(ink)) + .when_some(font_mono.clone(), |d, f| d.font(f)) .child(detail), ) }; @@ -116,7 +147,8 @@ impl Player { .px(px(6.)) .pt(px(4.)) .text_size(px(10.)) - .text_color(rgb(FG_SECONDARY())) + .text_color(rgb(ink_secondary)) + .when_some(font_label.clone(), |d, f| d.font(f)) .child(text) .into_any_element() }; @@ -472,7 +504,8 @@ impl Player { .px(px(6.)) .py(px(2.)) .text_size(px(11.)) - .text_color(rgb(FG_SECONDARY())) + .text_color(rgb(ink_secondary)) + .when_some(font_mono.clone(), |d, f| d.font(f)) .child(format!("cannot write: {}", refusals.join(" · "))) .into_any_element(), ); @@ -492,7 +525,8 @@ impl Player { .px(px(6.)) .py(px(2.)) .text_size(px(11.)) - .text_color(rgb(FG_SECONDARY())) + .text_color(rgb(ink_secondary)) + .when_some(font_mono.clone(), |d, f| d.font(f)) .child(text) .into_any_element() }; @@ -559,6 +593,176 @@ impl Player { } None => "Export".into(), }; + let status_line = match (&self.mbps_edit, self.notices.front()) { + // A field being typed into says so here as well as in its row: + // this line is outside the scrolling list and on screen at every + // window size, and at 360 px the custom row itself can be below + // the fold -- a number typed where it cannot be seen is the + // blind capture this field replaced. + (Some(edit), _) => SharedString::from(format!("Custom bitrate {}", edit.detail())), + (None, Some(notice)) => notice.clone(), + // `g`/`r` only do anything once Advanced is open -- they moved + // off the front pane with the rows they reshape -- so a shut + // pane advertises `s` instead of a pair of keys with nothing on + // screen for them to touch. + (None, None) => match self.export_advanced_open { + true => "the keys are on the rows · enter exports · \ + a click away or esc closes · g/r change the layout" + .into(), + false => "the keys are on the rows · enter exports · \ + a click away or esc closes · s for Advanced" + .into(), + }, + }; + if dark { + // DEFECT 1: the darkroom's own language, not the legacy sheet -- + // a plate (canvas-on-panel, §4), positioned over the bench+ + // ledger footprint it can sit over rather than centred over the + // whole window (§11 check 6: the picture stays uncovered). The + // click-catcher behind it is `size_full` so a click anywhere + // still closes the card exactly as the legacy scrim's does, but + // paints nothing (`SCRIM()` is deliberately not applied here) -- + // an invisible catcher changes zero picture pixels while a + // dimming one would still tint the screen it must never cover. + return Some( + div() + .id("export-click-catcher") + .absolute() + .top_0() + .bottom_0() + .left_0() + .right_0() + .flex() + .items_end() + .justify_end() + .p(px(12.)) + .on_mouse_down( + MouseButton::Left, + cx.listener(|this, _: &MouseDownEvent, _, cx| { + this.close_card(); + cx.notify(); + cx.stop_propagation(); + }), + ) + .child( + div() + .id("export-plate") + .w(px(EXPORT_W.min(340.))) + .max_h(px(4. * KEYS_ROW_H + rows_h + 90.)) + .on_mouse_down(MouseButton::Left, swallow) + .flex() + .flex_col() + .gap(px(2.)) + .p(px(10.)) + .rounded(px(6.)) + .bg(rgb(DARK_PANEL())) + .border_1() + .border_color(rgba(DARK_SEAM())) + .child( + div() + .flex_none() + .px(px(6.)) + .type_style(type_scale::head()) + .text_color(rgb(INK3())) + .child("EXPORT"), + ) + .child( + div() + .flex_none() + .px(px(6.)) + .text_size(px(10.5)) + .text_color(rgb(INK3())) + .type_style(type_scale::mono(10.5, gpui::FontWeight::MEDIUM)) + .child(status_line), + ) + .child( + div() + .id("export-rows") + .flex() + .flex_col() + .gap(px(2.)) + .max_h(px(rows_h)) + .overflow_y_scroll() + .children(list), + ) + .child( + div() + .flex_none() + .px(px(6.)) + .text_size(px(11.)) + .type_style(type_scale::mono(10.5, gpui::FontWeight::MEDIUM)) + .text_color(rgb(INK2())) + .child(head), + ) + .children(self.range.map(|(start, end)| { + div() + .flex_none() + .px(px(6.)) + .type_style(type_scale::mono(10.5, gpui::FontWeight::MEDIUM)) + .text_color(rgb(INK3())) + .child(format!( + "RANGE {}\u{2013}{} ({})", + timecode(f64::from(start) / self.fps, self.fps), + timecode(f64::from(end) / self.fps, self.fps), + frames_timecode(end - start, self.fps), + )) + })) + .child( + div() + .flex_none() + .px(px(6.)) + .type_style(type_scale::mono(10.5, gpui::FontWeight::MEDIUM)) + .text_color(rgb(INK3())) + .child(tail), + ) + // §4: "the single bordered chip in the whole + // room" -- ghosts everywhere else in this card, + // one border here, wearing its chord live off + // the keymap so a rebind cannot leave it stale. + .child( + div() + .id("export-confirm") + .mt(px(4.)) + .flex() + .items_center() + .justify_center() + .gap(px(6.)) + .h(px(CONTROL_H)) + .px(px(10.)) + .rounded(px(3.)) + .border_1() + .border_color(rgb(match blocked.is_some() { + true => INK4(), + false => INK2(), + })) + .when(blocked.is_none(), |d| d.cursor_pointer()) + .when(blocked.is_some(), |d| d.cursor_not_allowed()) + .hover(|s| s.bg(rgb(DARK_RAISED()))) + .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { + this.start_export(cx) + })) + .type_style(type_scale::label(11., gpui::FontWeight::MEDIUM)) + .text_color(rgb(match blocked.is_some() { + true => INK4(), + false => INK1(), + })) + .child(action) + .when(blocked.is_none(), |d| { + d.child( + div() + .type_style(type_scale::mono( + 9.5, + gpui::FontWeight::MEDIUM, + )) + .text_color(rgb(INK3())) + .child(self.keymap.chord(ActionId::Export)), + ) + }), + ), + ) + .into_any_element(), + ); + } Some( scrim() .flex() @@ -596,32 +800,7 @@ impl Player { .px(px(6.)) .text_size(px(11.)) .text_color(rgb(FG_SECONDARY())) - .child(match (&self.mbps_edit, self.notices.front()) { - // A field being typed into says so here as - // well as in its row: this line is outside - // the scrolling list and on screen at every - // window size, and at 360 px the custom row - // itself can be below the fold -- a number - // typed where it cannot be seen is the - // blind capture this field replaced. - (Some(edit), _) => { - SharedString::from(format!("Custom bitrate {}", edit.detail())) - } - (None, Some(notice)) => notice.clone(), - // `g`/`r` only do anything once Advanced is - // open -- they moved off the front pane with - // the rows they reshape -- so a shut pane - // advertises `s` instead of a pair of keys - // with nothing on screen for them to touch. - (None, None) => match self.export_advanced_open { - true => "the keys are on the rows · enter exports · \ - a click away or esc closes · g/r change the layout" - .into(), - false => "the keys are on the rows · enter exports · \ - a click away or esc closes · s for Advanced" - .into(), - }, - }), + .child(status_line), ) // Capped and scrolling like the keybindings list: the // rows are more than a 360 px window has room for, and @@ -684,7 +863,8 @@ impl Player { ) .child(action), ), - ), + ) + .into_any_element(), ) } diff --git a/crates/app/src/ui/dock_stance.rs b/crates/app/src/ui/dock_stance.rs index 013adc8..fa1691b 100644 --- a/crates/app/src/ui/dock_stance.rs +++ b/crates/app/src/ui/dock_stance.rs @@ -220,7 +220,18 @@ fn source_row(player: &Player, i: usize, row: &Row, placed: usize, picked: bool, .py(px(4.)) .rounded(px(3.)) .when(!usable, |d| d.opacity(0.5)) - .when(picked, |d| d.bg(rgb(DARK_RAISED()))) + // FAULT 3: this used to be `bg(DARK_RAISED())`, pixel-identical to + // the row's own `hover` fill below -- a picked row and a merely + // hovered one painted the same, so the editor could not see what was + // selected. DESIGN §4's ring (1px `ink1`) is the one that fits here, + // not §2's complement-leaning ink: §2's rule is about a mark drawn + // *over a source's own extracted film ink* (the bench clip's ring, + // already `ink1` in `bench_stance.rs`, sits on a source-tinted trace + // it must stay legible against regardless of hue) -- a dock row + // carries no film ink of its own to complement, it is a plain list + // line, so the general focus/selection ring applies, the same one + // the bench already uses for the same job. + .when(picked, |d| d.border_1().border_color(rgb(INK1()))) .when(usable, |d| { d.cursor_pointer() .hover(|s| s.bg(rgb(DARK_RAISED()))) diff --git a/crates/app/src/ui/preview.rs b/crates/app/src/ui/preview.rs index 78ee9e9..6c5234e 100644 --- a/crates/app/src/ui/preview.rs +++ b/crates/app/src/ui/preview.rs @@ -1,14 +1,23 @@ //! The picture: what is drawn over it and what is read off it. use crate::*; +use crate::ui::type_scale::{self, Typeset}; use std::path::{Path, PathBuf}; impl Player { /// The one thing that says a preview is up rather than the timeline: a /// banner over the top of the picture, and a click of its own -- the /// keyboard has `esc`, and a hand with only a mouse needs a way out too. + /// + /// Legacy-only now (DEFECT 2, MOCK-SPEC.md): this is a full-width band + /// drawn *on* the frame, which DESIGN §5 forbids for the darkroom + /// ("nothing else over the picture, ever"). [`Player::preview_plate`] is + /// the darkroom's own restyle of the same information, built as a flex + /// sibling so the picture's own box shrinks for it rather than being + /// painted over -- the same fix `two_up`'s doc comment describes for the + /// OUT|IN plates. `OLD_GUI=1` keeps drawing this banner unchanged. pub(crate) fn preview_badge(&self, cx: &mut Context) -> Option { - self.preview_session.is_some().then(|| { + (!self.darkroom && self.preview_session.is_some()).then(|| { div() .absolute() .top_0() @@ -37,6 +46,68 @@ impl Player { }) } + /// The darkroom's own preview indicator (DEFECT 2, MOCK-SPEC.md): a + /// plate (canvas-on-panel, §4), mono for what the film says, and a ghost + /// `Stop` wearing its `esc` chord rather than the legacy bordered + /// button -- no fill, no border, hover lifts one step like every other + /// ghost in the room. + /// + /// corner-cut: built and unit-shaped but **not yet mounted** -- it needs + /// to sit as a flex sibling of the picture inside `ui::stance::screen` + /// (the box `two_up`'s own doc comment already fixed this exact way for + /// the OUT|IN plates), which is `stance.rs`, out of this task's file + /// ownership while another builder has it open concurrently. `#[allow + /// It is mounted in `ui::stance::screen` as a flex sibling below the + /// picture's own child, the way `two_up` is, so the frame's box shrinks to + /// make room rather than being drawn over. + pub(crate) fn preview_plate(&self, cx: &mut Context) -> Option { + (self.darkroom && self.preview_session.is_some()).then(|| { + div() + .id("preview-plate") + .flex_none() + .flex() + .items_center() + .justify_between() + .gap(px(10.)) + .px(px(10.)) + .py(px(4.)) + .rounded(px(2.)) + .bg(rgb(DARK_PANEL())) + .type_style(type_scale::mono( + type_scale::CHORD_METADATA_MIN_PX, + gpui::FontWeight::MEDIUM, + )) + .text_color(rgb(INK2())) + .child("PREVIEW — not on the timeline") + .child( + // Ghost Stop: glyph over its chord, no border, no fill + // at rest -- DESIGN §4's grammar, the same shape the + // spine's own commands use. + div() + .id("preview-stop") + .flex() + .items_center() + .gap(px(6.)) + .px(px(6.)) + .py(px(2.)) + .rounded(px(3.)) + .cursor_pointer() + .hover(|s| s.bg(rgb(DARK_RAISED()))) + .on_click(cx.listener(|this, _: &ClickEvent, _, cx| this.close_preview(cx))) + .child(div().text_color(rgb(INK2())).child("Stop")) + .child( + div() + .type_style(type_scale::mono( + type_scale::CHORD_METADATA_MIN_PX, + gpui::FontWeight::MEDIUM, + )) + .text_color(rgb(INK3())) + .child("esc"), + ), + ) + }) + } + /// The preview's own scrub bar, drawn low over the picture the way the /// badge is drawn over its top: a preview has a duration and a playhead /// like anything else on screen, and unlike the timeline's ruler diff --git a/crates/app/src/ui/stance.rs b/crates/app/src/ui/stance.rs index e922af8..6d6d650 100644 --- a/crates/app/src/ui/stance.rs +++ b/crates/app/src/ui/stance.rs @@ -331,6 +331,9 @@ fn screen(player: &mut Player, position: f64, window: &mut Window, cx: &mut Cont .child(bounds_probe(PICTURE_BOUNDS.with(Rc::clone))), ) .children(two_up) + // The preview's own plate, a flex sibling for the same reason two_up is + // one: drawn inside the picture it would cover the frame. + .children(player.preview_plate(cx)) } /// 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 /// click live in [`crate::ui::timeband_stance`] now, the same split /// `spine_stance`/`bench_stance`/`dock_stance` already make for their /// regions. -fn time_band(player: &mut Player, cx: &mut Context) -> impl IntoElement { - let position = player.active_session().map_or(0., PlaybackSession::now); +fn time_band(player: &mut Player, position: f64, cx: &mut Context) -> impl IntoElement { + // The position comes from `render`, the same one the screen and the ledger + // read. Asking `active_session` here instead read the PREVIEW's clock while + // a preview was up, so the hero timecode and the ledger's position -- two + // readouts of one truth -- disagreed on screen. div() .id("stance-time-band") .flex_none() @@ -531,6 +537,19 @@ pub(crate) fn render( if event.is_held && !repeats(this.repeat_scope(), key, this.keymap.lookup(key, ctrl)) { return; } + // The recovery notice reads a key as more than "answered" (legacy + // `render.rs`'s own rule): `enter` loads the sidecar it named, any + // other key declines it. Asked before the generic dismiss below + // shares the door with it, not instead of it -- the darkroom + // notice bar advertised "enter recovers it, any other key keeps + // this" with no listener behind it until now (DESIGN §4). + if this.recovery_sidecar.is_some() { + if key == "enter" { + this.recover_from_sidecar(cx); + } else if let Some(sidecar) = this.recovery_sidecar.take() { + Player::discard_sidecar(&sidecar); + } + } if this.dismiss_notice() { cx.notify(); } @@ -546,6 +565,41 @@ pub(crate) fn render( cx.notify(); return; } + // The dock's Sources filter (MOCK-SPEC "Dock" §2), the same door + // legacy `render.rs` gives it: owns the keyboard only while it + // was clicked into (`dock_stance.rs` sets `dock_filter_edit` on + // that click regardless of which tree is drawing the row), a + // letter typed anywhere else in the room keeps meaning whatever + // the spine says it means. + if this.dock_filter_edit { + if key == "escape" || key == "enter" { + this.dock_filter_edit = false; + } else if key == "backspace" { + this.dock_filter.pop(); + } else if let Some(c) = typed(key) { + this.dock_filter.push(c); + } + cx.notify(); + return; + } + // `↵` adds the picked source at the playhead (MOCK-SPEC "Dock" + // hint paragraph, gesture 2; `dock_stance.rs`'s own hint promised + // this and nothing answered it -- FAULT 1). Live only where a row + // is actually picked, so a bare enter elsewhere still means + // whatever it means below. `insert_source` already refuses + // visibly on its own ("NOTHING ADDED -- ...") when the span is + // occupied, so there is nothing further to paint here. + if key == "enter" + && this.dock_src_active + && this.selected_asset.is_some() + && this.exporting().is_none() + { + if let Some((path, stream)) = this.selected_asset.clone() { + this.insert_source(&path, stream, None, None, cx); + } + cx.notify(); + return; + } // Same modal guard the legacy handler's rebinding/keys_open/ // export_open/exporting/colour/transform/speed/EQ/silence/mix/ // subtitle-style/menu chain (`render.rs`) amounts to, read as @@ -562,9 +616,31 @@ pub(crate) fn render( this.rebinding = None; this.close_card(); } + // FAULT 2, general shape: `context_menu`/`library_menu`/ + // `picker` are three of the four reasons `overlaid()` refuses + // every key, and none of the three is in `close_card`'s own + // list (`modal()` never counted them) -- left uncleared, any + // one of them left the room an invisible, permanent modal + // that only escape even tried to leave, and closed nothing. + // Any key answers a menu, the same rule the legacy tree's own + // clip_menu/row_menu/list chain follows (`render.rs`): this is + // the fix for "no state may make the room modal without + // showing anything", not only the source-dot's menu. + this.context_menu = None; + this.library_menu = None; + this.picker = None; cx.notify(); return; } + // The innermost thing left once no menu or card is up: a preview + // takes the picture over the screen, and escape is its own way + // out -- the chord `preview.rs`'s "Stop (esc)" bar already + // advertised, dead until now (FAULT 3) because only the legacy + // tree's handler answered it. + if key == ESCAPE && !ctrl && this.preview_session.is_some() { + this.close_preview(cx); + return; + } if let Some(action) = this.keymap.lookup(key, ctrl) { // `ActionId::Export` used to be suppressed here because the // darkroom drew no export surface for the card to land on @@ -599,20 +675,33 @@ pub(crate) fn render( .flex() .flex_col() .child(screen(player, position, window, cx)) - .child(time_band(player, cx)) + .child(time_band(player, position, cx)) .child(bench(player, cx)) .child(ledger(player, position)) .when_some(player.notices.front().cloned(), |el, n| { el.child(notice_plate(n)) }) .when(player.keys_open, |el| el.child(keys_overlay(player))) + // The two menus (DESIGN §9: "verbs of the thing under the + // cursor", plate styling, the same scrim-and-row component + // the legacy tree already uses -- `library.rs`'s own doc + // comment: "Built like `Player::context_card` ... because it + // is the same menu on the other panel") and the open list a + // picker sets: none of the three had a home in the stance, + // so `overlaid()` refused every key over them for nothing + // ever drawn (FAULT 2). `render.rs`'s children order is kept + // -- clip menu, then library menu, then the open list last so + // it floats over whichever row opened it. + .children(player.context_card(window_size, cx)) + .children(player.library_card(window_size, cx)) // The export card and its running-progress sheet, mounted // over the whole room exactly as the legacy tree mounts them // (`render.rs`) -- the fix for the shipped "Export does // nothing" defect: the chip/chord open `export_open`, this is // what draws it once open. .children(player.export_card(window_size, cx)) - .children(player.export_progress_card(cx)), + .children(player.export_progress_card(cx)) + .children(player.picker_card(window_size, cx)), ) .child(dock(player, window_h, cx)) } diff --git a/crates/app/src/ui/timeband_stance.rs b/crates/app/src/ui/timeband_stance.rs index 1a6c8e1..fbe917a 100644 --- a/crates/app/src/ui/timeband_stance.rs +++ b/crates/app/src/ui/timeband_stance.rs @@ -134,10 +134,16 @@ fn cut_readout(player: &Player) -> impl IntoElement { .flex_none() .flex() .items_center() - .px(px(8.)) - .py(px(4.)) - .rounded(px(2.)) - .bg(rgb(DARK_CANVAS())) + // FAULT 1a: this used to fill+round a `DARK_CANVAS` rectangle over + // the band's own `DARK_PANEL` ground -- a second hard-edged plate + // that read as a chip beside Export, the room's one bordered + // commitment (DESIGN §4). A readout is still a plate in the + // language's own words, but this band already has one (Export); the + // fix is to drop the competing fill, not add a second box the + // Export chip has to compete with. Values stay in `ink2`, the + // separators in `ink3` -- the readout is still legible sitting + // straight on the band ground. + .px(px(4.)) .font(style.font) .text_size(style.size) .child(val(odometer)) diff --git a/crates/app/src/ui/widgets.rs b/crates/app/src/ui/widgets.rs index 72caa10..32b08c7 100644 --- a/crates/app/src/ui/widgets.rs +++ b/crates/app/src/ui/widgets.rs @@ -281,15 +281,22 @@ impl Render for Tip { if OVERLAID.load(Ordering::Relaxed) { return div(); } + // DESIGN §4: "Notices, menus, chips, cues, and tooltips are all the + // same plate" -- canvas-on-panel, 2px radius, the room's own type + // (`ui::type_scale`), not a bordered box in an ad hoc size. This one + // struct is every tooltip in the app (grepped: `timeline.rs`, + // `library.rs`, `overlays.rs`, `spine_stance.rs`, `dock_stance.rs`, + // `timeband_stance.rs`, `preview.rs`, here), so the fix belongs here + // once, not per call site. + let style = crate::ui::type_scale::label(crate::ui::type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM); div() - .px(px(6.)) - .py(px(3.)) - .rounded(px(3.)) - .border_1() - .border_color(rgb(BG_RAISED())) - .bg(rgb(BG_PANEL())) - .text_color(rgb(FG_PRIMARY())) - .text_size(px(12.)) + .px(px(8.)) + .py(px(4.)) + .rounded(px(2.)) + .bg(rgb(DARK_CANVAS())) + .font(style.font) + .text_size(style.size) + .text_color(rgb(INK1())) .child(self.0.clone()) } }