diff --git a/crates/app/src/interact.rs b/crates/app/src/interact.rs index ebfeb6a..9cd92e3 100644 --- a/crates/app/src/interact.rs +++ b/crates/app/src/interact.rs @@ -214,7 +214,7 @@ pub(crate) fn drag_scrim(cx: &mut Context) -> Div { /// stop following the hand on the first move. `stop_propagation` so the press /// never reaches the region under it -- a seam over the timeline must not scrub. pub(crate) fn divider(split: Split, cx: &mut Context) -> Div { - let across = matches!(split, Split::Timeline); + let across = matches!(split, Split::Timeline | Split::Bench); div() .flex_none() .when(across, |d| d.h(px(SPLIT_W)).w_full().cursor_row_resize()) diff --git a/crates/app/src/layout.rs b/crates/app/src/layout.rs index 41d7641..86be643 100644 --- a/crates/app/src/layout.rs +++ b/crates/app/src/layout.rs @@ -382,14 +382,37 @@ pub(crate) const PPS_DEFAULT: f64 = 40.; // -- the seams between the regions, and where a hand has dragged them --------- -/// Which divider a hand has hold of. The three seams the main layout has -- -/// library|picture, picture|inspector and the timeline's top edge -- and so the -/// only three sizes in this window a person sets rather than is given. +/// Which divider a hand has hold of. The legacy tree's three seams -- +/// library|picture, picture|inspector and the timeline's top edge -- plus the +/// darkroom's own two, dock|centre and time-band|bench: `stance.rs`'s own +/// `BENCH_H`/`DOCK_W` doc comments named this exact fold as the fix for +/// "fields are not stretchable" before this diff existed. #[derive(Clone, Copy, PartialEq, Eq, Debug)] pub(crate) enum Split { Library, Inspector, Timeline, + Dock, + Bench, +} + +impl Split { + /// The two persisted seams -- library/inspector/timeline stay + /// unpersisted, out of this diff's scope, same as before it. Read by + /// [`load_stance_splits`] and [`save_stance_splits`] together so the + /// two can never learn a different set of keys from each other, the + /// gap a sixth region would otherwise fall through silently. + const PERSISTED: [Split; 2] = [Split::Dock, Split::Bench]; + + fn key(self) -> &'static str { + match self { + Split::Library => "library", + Split::Inspector => "inspector", + Split::Timeline => "timeline", + Split::Dock => "dock", + Split::Bench => "bench", + } + } } /// How wide a divider is drawn *and* hit. Wider than the 1 px stroke it stands @@ -409,6 +432,57 @@ pub(crate) const SIDE_MAX_FRAC: f32 = 1. / 3.; /// timeline is asking on purpose, and the picture still keeps most of a third. pub(crate) const TIMELINE_MAX_SHARE: f32 = 0.7; +/// The room the ledger's own top border (`ui::stance::ledger`'s +/// `.border_t_1()`) needs kept clear below the bench's own last content +/// pixel. The ledger sits at a *fixed* distance from the window's own foot +/// (`ui::stance::LEDGER_H`), not from wherever the bench's content happens +/// to end, so if the bench's last lane row reaches exactly as far as the +/// ledger's own top row, the ledger's border -- later in the same flex +/// column, so it paints over whatever is already there -- wins the shared +/// pixel rather than sitting cleanly below it. Driven, at [`BENCH_MIN_H`]'s +/// own third clip: `bench=95` (the stack's exact content need, no spare row) +/// still lost A1's status dot's last row to the rule; `bench=96` (one row of +/// clearance) drew it whole. The 95-vs-96 tension is this term, not a +/// rounding accident -- a bench exactly as tall as its content still shares +/// its last row with the ledger's border. +const LEDGER_SEAM_CLEARANCE: f32 = 1.; + +/// The least the darkroom's bench may be dragged to: derived, not measured, +/// from the same stack `ui::stance::bench` and `ui::bench_stance::render` +/// actually build, top to bottom -- +/// [`crate::ui::stance::BENCH_CHROME_H`] (the "bench" section head's real +/// line box, plus the bench div's own top border and top padding -- see its +/// own doc comment) + [`crate::ui::bench_stance::RULER_H`] (the pinned +/// ruler) + [`crate::ui::bench_stance::ROW_GAP`] (the gap `bench-content`'s +/// flex column puts between the ruler and the lane column) + two lane rows +/// at [`crate::ui::bench_stance::LANE_MIN_H`] each (the darkroom's own floor +/// of two lanes -- V1, A1, `bench_stance::render`'s own no-session +/// fallback) + one more `ROW_GAP` between those two rows (`bench-lanes`'s +/// own flex gap) + [`LEDGER_SEAM_CLEARANCE`] (the row the ledger's own +/// border needs kept clear, see its own doc comment). Below this the +/// `bench-lanes` column asks for more height than `bench-content`'s flex_1 +/// gives it, and since that column scrolls rather than clips visibly, the +/// shortfall comes off the bottom row's own pixels unscrolled -- A1's +/// clip-bar border and status dot, first. `LANE_MIN_H` itself is derived +/// from what a lane head actually draws (its own doc comment), not a number +/// copied from nowhere: an earlier floor of `82.` used a `LANE_MIN_H` of +/// `18.` that fit only the lane label and let every lane's status dot +/// overflow into the row beneath it, invisible everywhere but the last +/// lane, which has no next row to spill into and clipped straight into the +/// ledger instead. +/// +/// A third driven pass at the next floor (`94.`, `BENCH_CHROME_H` still +/// undercounted at `20.`) clipped A1's dot again, by one row -- two 1px +/// causes stacked, not one 2px guess: `BENCH_CHROME_H`'s own undercount +/// (`20.` vs its real `21.`) and this term, `LEDGER_SEAM_CLEARANCE`, which +/// the formula never carried at all. `21 + 22 + 2 + 48 + 2 + 1` = `96.`. +pub(crate) const BENCH_MIN_H: f32 = crate::ui::stance::BENCH_CHROME_H + + crate::ui::bench_stance::RULER_H + + crate::ui::bench_stance::ROW_GAP + + 2. * crate::ui::bench_stance::LANE_MIN_H + + crate::ui::bench_stance::ROW_GAP + + LEDGER_SEAM_CLEARANCE; + /// What a hand has done to the three seams: the size it dragged each panel to, /// or `None` where nobody has touched one and the window's own share still /// answers. Held in the model and not recomputed, so a size outlives the @@ -419,6 +493,8 @@ pub(crate) struct Splits { library: Option, inspector: Option, timeline: Option, + dock: Option, + bench: Option, } impl Splits { @@ -427,6 +503,8 @@ impl Splits { Split::Library => self.library, Split::Inspector => self.inspector, Split::Timeline => self.timeline, + Split::Dock => self.dock, + Split::Bench => self.bench, } } @@ -435,10 +513,62 @@ impl Splits { Split::Library => &mut self.library, Split::Inspector => &mut self.inspector, Split::Timeline => &mut self.timeline, + Split::Dock => &mut self.dock, + Split::Bench => &mut self.bench, } = Some(size); } } +/// Where the darkroom's own two dragged sizes live -- dock and bench, the +/// only pair with a hand on them so far. Same small, silent round trip as +/// [`crate::ui::dock_stance`]'s tab pick: unreadable or absent leaves both +/// `None`, which [`split_size`] already reads as "give it the window's own +/// share". +pub(crate) fn stance_splits_config_path() -> std::path::PathBuf { + crate::keymap::Keymap::config_path().with_file_name("stance-splits") +} + +pub(crate) fn load_stance_splits() -> Splits { + load_stance_splits_from(&stance_splits_config_path()) +} + +/// One `split=pixels` line per touched seam, read from `path` -- factored out +/// of [`load_stance_splits`] so a test can round-trip a scratch file instead +/// of the real config. +pub(crate) fn load_stance_splits_from(path: &std::path::Path) -> Splits { + let mut splits = Splits::default(); + if let Ok(text) = std::fs::read_to_string(path) { + for line in text.lines() { + let Some((key, value)) = line.split_once('=') else { continue }; + let Ok(px) = value.trim().parse::() else { continue }; + let Some(split) = Split::PERSISTED.into_iter().find(|s| s.key() == key) else { + continue; + }; + splits.set(split, px); + } + } + splits +} + +/// Writes the sizes a hand has actually dragged -- the legacy three stay +/// unpersisted, as they already were before this diff (out of its scope). +/// Walks [`Split::PERSISTED`] rather than a hand-written `if let` per field, +/// so a region added there needs no second, separately-maintained list here. +pub(crate) fn save_stance_splits(splits: &Splits) { + save_stance_splits_to(splits, &stance_splits_config_path()); +} + +pub(crate) fn save_stance_splits_to(splits: &Splits, path: &std::path::Path) { + let text: String = Split::PERSISTED + .into_iter() + .filter_map(|split| splits.get(split).map(|px| format!("{}={px}\n", split.key()))) + .collect(); + if let Some(dir) = path.parent() { + let _ = std::fs::create_dir_all(dir); + } + let _ = std::fs::write(path, text); +} + /// How small a panel may be dragged and how large: the floor is the size it /// still shows something at, the ceiling is what its neighbour needs to stay a /// region rather than a sliver. Neither end is passable -- a panel dragged to @@ -454,6 +584,23 @@ pub(crate) fn split_bounds( match split { Split::Library => (LIBRARY_MIN_W, w * SIDE_MAX_FRAC), Split::Inspector => (INSPECTOR_MIN_W, w * SIDE_MAX_FRAC), + // The dock is the darkroom's one side column -- same shape as the + // legacy inspector's, so it takes the legacy inspector's own floor + // and ceiling rather than a second pair that would only ever agree. + Split::Dock => (INSPECTOR_MIN_W, w * SIDE_MAX_FRAC), + // The bench is the darkroom's own timeline, but its ceiling is not + // [`Split::Timeline`]'s window-share one: a bench that swallows + // `TIMELINE_MAX_SHARE` of a 720p window leaves the screen and its + // scale plate only 100px, which is not a picture any more. The + // ceiling instead leaves the screen and time band their own fixed + // 160px -- room for the scale plate, the picture and a sliver of + // letterbox -- and `BENCH_MIN_H` still wins the clamp on anything + // shorter than that. + Split::Bench => ( + BENCH_MIN_H, + (h - crate::ui::stance::TIME_BAND_H - crate::ui::stance::LEDGER_H - 160.) + .max(BENCH_MIN_H), + ), // One whole lane under the chrome, the scrollbar strip's row included // while there is one to draw ([`timeline_fixed_h`]): a timeline // shorter than that is a ruler with nothing beneath it. A second @@ -497,6 +644,8 @@ pub(crate) fn split_size( Split::Library => library_w(w), Split::Inspector => inspector_w(w), Split::Timeline => timeline_h(lanes, scroll).min(h * TIMELINE_SHARE), + Split::Dock => crate::ui::stance::DOCK_W, + Split::Bench => crate::ui::stance::BENCH_H, }; // The floor wins a window too small to honour both ends: a panel at its // floor is still a panel, and `clamp` panics outright on a ceiling under @@ -517,6 +666,11 @@ pub(crate) fn split_drag_size(split: Split, at: Point, window: Size h - y - TOOLBAR_H - SPLIT_W / 2., + // The dock sits on the same right edge the inspector does. + Split::Dock => w - x - SPLIT_W / 2., + // The bench sits above the fixed ledger strip, the bench's own + // reason the timeline's formula reads the toolbar. + Split::Bench => h - y - crate::ui::stance::LEDGER_H - SPLIT_W / 2., } } diff --git a/crates/app/src/main.rs b/crates/app/src/main.rs index 0b1536c..31dd73a 100644 --- a/crates/app/src/main.rs +++ b/crates/app/src/main.rs @@ -72,7 +72,7 @@ use engine::{Clip, Codec, ExportHandle, Frame, MediaBitrate, PlaybackSession}; use gpui::{ AnyElement, App, Application, Bounds, ClickEvent, Context, Corners, CursorStyle, Div, DragMoveEvent, FocusHandle, KeyDownEvent, KeyUpEvent, MouseButton, MouseDownEvent, - MouseMoveEvent, MouseUpEvent, PathBuilder, Pixels, Point, RenderImage, ScrollDelta, + MouseExitEvent, MouseMoveEvent, MouseUpEvent, PathBuilder, Pixels, Point, RenderImage, ScrollDelta, ScrollHandle, ScrollWheelEvent, SharedString, Size, Stateful, TextAlign, TitlebarOptions, Window, WindowBounds, WindowOptions, canvas, div, point, prelude::*, px, relative, rgb, rgba, size, @@ -919,7 +919,7 @@ fn main() { hw_caps: None, clipboard: None, scrubbing: false, - splits: Splits::default(), + splits: load_stance_splits(), split_drag: None, trim: None, fade_drag: None, diff --git a/crates/app/src/player/timeline_edit.rs b/crates/app/src/player/timeline_edit.rs index 3d2f2c2..6a8f8f8 100644 --- a/crates/app/src/player/timeline_edit.rs +++ b/crates/app/src/player/timeline_edit.rs @@ -3,6 +3,18 @@ use crate::*; +/// Whether a seam that just lost its drag owes a disk write -- exactly the +/// two persisted seams ([`Split::PERSISTED`]), same rule `drag_release`'s own +/// `matches!` already lived by. Pulled out to its own free function, taking +/// no `Context`, so [`Player::drag_left_window`]'s save-on-leave guard is +/// checkable without a `TestAppContext` this test binary has none of (see +/// `tests/media.rs`'s own note on the same limit) -- the wiring that calls it +/// from a live `MouseExitEvent` still cannot be, and is proven by driving +/// instead. +pub(crate) fn split_drag_owes_save(split: Option) -> bool { + matches!(split, Some(Split::Dock) | Some(Split::Bench)) +} + impl Player { /// Splits the clip under the playhead. Metadata only: the timeline->source /// mapping is unchanged, so nothing reseeks and no flag is touched. @@ -1479,6 +1491,32 @@ impl Player { /// where it sits (`Hitbox::is_hovered`, window.rs:788), so while a card is /// up the root is not hovered anywhere under it and hears none of this: the /// press set a value and the drag then froze on it. + /// The one event a release outside the window's own surface is + /// guaranteed to raise: Wayland (and X11) tell a client its pointer has + /// left, unconditionally, whether or not a button is down + /// (`wl_pointer::Event::Leave`, gpui's `platform/linux/wayland/client.rs`) + /// -- but a `Button::Released` that lands *after* that Leave is never + /// forwarded at all, because gpui only dispatches it to the window that + /// is still `mouse_focused_window`, and Leave just cleared that. So the + /// seam's own release handler (`drag_release`, bound to `on_mouse_up`) + /// can be skipped entirely by a drag that ends outside the frame, and + /// `drag_move`'s "next incidental motion" fallback above only fires once + /// the pointer comes back -- which a restart before that motion, or a + /// release the user never revisits, may never do. This is the one + /// dependable earlier moment: the size a `Split::Dock`/`Split::Bench` + /// drag is holding right now is exactly what a release beyond this + /// instant would have kept, since no further sample can arrive from + /// outside the surface, so it is saved here rather than left to chance. + /// Wired at the root via [`Player::mount_mouse_exit_listener`]'s + /// `window.on_mouse_event`, the low-level door `Interactivity`'s fluent + /// `on_mouse_*` builders do not expose for `MouseExitEvent`. + pub(crate) fn drag_left_window(&mut self, cx: &mut Context) { + if split_drag_owes_save(self.split_drag) { + save_stance_splits(&self.splits); + } + cx.notify(); + } + pub(crate) fn drag_move( &mut self, event: &MouseMoveEvent, @@ -1518,9 +1556,16 @@ impl Player { match event.pressed_button { Some(MouseButton::Left) => self.drag_split(split, event.position, window, cx), // Released outside the window: the up below never came, so this - // is where the gesture ends. Nothing is owed -- every move has - // already been written. - _ => self.split_drag = None, + // is where the gesture ends. The size is already written to + // `self.splits`, but the darkroom's two persisted seams still + // owe the save `drag_release` would have paid -- without it + // the drag holds for the session and reverts on restart. + _ => { + self.split_drag = None; + if split_drag_owes_save(Some(split)) { + save_stance_splits(&self.splits); + } + } } return; } @@ -1651,6 +1696,13 @@ impl Player { } if let Some(split) = self.split_drag.take() { self.drag_split(split, event.position, window, cx); + // The darkroom's own two seams outlive the window: written once, + // on the release that ends the gesture, the same small-file + // round trip `ui::dock_stance`'s tab pick uses -- not on every + // sample in between, which `drag_move` above never owed a write. + if split_drag_owes_save(Some(split)) { + save_stance_splits(&self.splits); + } return; } if std::mem::take(&mut self.eq_dragging) { @@ -1718,8 +1770,21 @@ impl Player { window: &mut Window, cx: &mut Context, ) { + let viewport = window.viewport_size(); + let raw = split_drag_size(split, at, viewport); + // Clamped here, through the same door [`Player::split_px`] draws + // through, at the one place a hand's pick ever reaches + // `self.splits` -- so what a later save writes to disk is never a + // number the seam itself would have refused to draw at. A floor + // enforced only on read still leaves a `bench=-1` line in the file. + let lanes = self + .session + .as_ref() + .map_or(2, |session| session.lanes().len()); + let view = self.view(); + let scroll = view.duration > view.span(); self.splits - .set(split, split_drag_size(split, at, window.viewport_size())); + .set(split, split_size(split, Some(raw), lanes, viewport, scroll)); cx.notify(); } } diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index 28640da..4b2b2d8 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -1736,6 +1736,252 @@ fn a_dragged_divider_stops_before_either_panel_disappears() { ); } +/// The darkroom's own two seams (`Split::Dock`, `Split::Bench`): a hand may +/// not drag either past its floor or its ceiling, the same promise +/// [`a_dragged_divider_stops_before_either_panel_disappears`] makes for the +/// legacy three. +#[test] +fn the_darkroom_seams_stop_before_either_side_disappears() { + use crate::ui::theme::INSPECTOR_MIN_W; + use crate::{BENCH_MIN_H, SIDE_MAX_FRAC, SPLIT_W, Split, split_bounds, split_drag_size, split_size}; + use gpui::{point, px, size}; + + let window = size(px(1280.), px(720.)); + // Untouched, each answers its own stance default. + assert_eq!( + split_size(Split::Dock, None, 2, window, false), + crate::ui::stance::DOCK_W + ); + assert_eq!( + split_size(Split::Bench, None, 2, window, false), + crate::ui::stance::BENCH_H + ); + // Dragged, it is what the hand asked for... + assert_eq!(split_size(Split::Dock, Some(400.), 2, window, false), 400.); + assert_eq!(split_size(Split::Bench, Some(300.), 2, window, false), 300.); + // ...and never past the floor... + assert_eq!( + split_size(Split::Dock, Some(0.), 2, window, false), + INSPECTOR_MIN_W + ); + assert_eq!( + split_size(Split::Bench, Some(0.), 2, window, false), + BENCH_MIN_H + ); + // ...nor the ceiling. The bench's is not a window-share one -- it leaves + // the screen and time band a fixed 160px, [`split_bounds`]'s own reason. + assert_eq!( + split_size(Split::Dock, Some(9000.), 2, window, false), + 1280. * SIDE_MAX_FRAC + ); + let (_, bench_max) = split_bounds(Split::Bench, 2, window, false); + assert_eq!( + split_size(Split::Bench, Some(9000.), 2, window, false), + bench_max + ); + assert!(bench_max < 720.); + // The pointer turned into a size, half a strip off for the same reason + // the legacy seams read it that way. + assert_eq!( + split_drag_size(Split::Dock, point(px(1000.), px(400.)), window), + 280. - SPLIT_W / 2. + ); + assert_eq!( + split_drag_size(Split::Bench, point(px(300.), px(500.)), window), + 220. - crate::ui::stance::LEDGER_H - SPLIT_W / 2. + ); +} + +/// At the bench's floor, both default lanes' rows actually fit inside the +/// `bench-lanes` column `bench_stance::render` gives them -- not just each +/// row's own clamped height, but their *sum plus the gap between them*, +/// since `bench-lanes` scrolls rather than clipping visibly and a sum that +/// overruns the column loses its bottom row's pixels off-screen, unscrolled +/// (this session's F1: the A1 lane's clip-bar border and status dot, cut by +/// ~2px at the old `BENCH_MIN_H = 80.`). +#[test] +fn both_default_lanes_fit_the_bench_at_its_floor() { + use crate::BENCH_MIN_H; + use crate::ui::bench_stance::{LANE_MIN_H, ROW_GAP, RULER_H, row_h}; + use crate::ui::stance::BENCH_CHROME_H; + + let box_h = BENCH_MIN_H - BENCH_CHROME_H; + let avail = box_h - RULER_H - ROW_GAP; + let h = row_h(2, avail); + // Not an exact `LANE_MIN_H` any more: `BENCH_MIN_H` now carries one spare + // row (`layout::LEDGER_SEAM_CLEARANCE`) so the last lane's own last pixel + // never shares a row with the ledger's border, which lands here as + // `avail` being a touch over the two-rows-plus-gap tight fit. + assert!(h >= LANE_MIN_H, "the floor should give both lanes at least their own minimum ({h} < {LANE_MIN_H})"); + let content = 2. * h + ROW_GAP; + assert!( + content <= avail + 1e-4, + "the two lane rows ({content}px) overrun the column ({avail}px) -- \ + the bottom lane's pixels get cut, unscrolled" + ); +} + +/// `BENCH_CHROME_H` on its own: the previous test's `box_h = BENCH_MIN_H - +/// BENCH_CHROME_H` line trusts `BENCH_CHROME_H` to already be correct, so it +/// cannot catch `BENCH_CHROME_H` itself drifting -- which is exactly how the +/// third clip (this session's) survived it: the constant undercounted the +/// section head's real line box by 1px and this test's predecessor never +/// looked. Recomputes what `ui::stance::bench` actually draws above +/// `bench_stance::render`'s content -- the div's own `.border_t_1()` (1px) +/// + its `py(4.)` top padding + the section head's real line box at gpui's +/// golden-ratio line-height, not the label's bare font size (the same trap +/// `a_lane_row_fits_what_its_own_head_draws` already checks for the lane +/// heads) -- and then checks the *whole* stack -- chrome, ruler, both gaps, +/// both lanes, and the clear row the ledger's own fixed-position border +/// needs (`LEDGER_SEAM_CLEARANCE`, not exported, so this recomputes it as +/// `BENCH_MIN_H` minus every other named term) -- fits inside `BENCH_MIN_H` +/// with nothing left over uncounted. This binary carries no `TestAppContext` +/// to mount `ui::stance::bench` and `ui::stance::ledger` for real and read +/// painted bounds back, so it stays geometry-only, same as its neighbours. +#[test] +fn the_whole_bench_stack_fits_its_own_floor_with_the_ledger_seam_clear() { + use crate::BENCH_MIN_H; + use crate::ui::bench_stance::{LANE_MIN_H, ROW_GAP, RULER_H}; + use crate::ui::stance::BENCH_CHROME_H; + use crate::ui::type_scale::SECTION_HEAD_PX; + + const BENCH_BORDER_T: f32 = 1.; + const BENCH_PY_TOP: f32 = 4.; + let section_head_line_h = (SECTION_HEAD_PX * 1.618_034).round(); + let real_chrome = BENCH_BORDER_T + BENCH_PY_TOP + section_head_line_h; + assert_eq!( + BENCH_CHROME_H, real_chrome, + "BENCH_CHROME_H ({BENCH_CHROME_H}) does not match what `stance::bench` \ + actually draws above the content ({real_chrome}px: {BENCH_BORDER_T}px \ + border + {BENCH_PY_TOP}px padding + {section_head_line_h}px label line \ + box) -- bench_stance::render gets handed the wrong box_h and lays its \ + rows out past its own real space" + ); + + // The ledger's own fixed-position border needs one more clear row below + // the last lane, on top of chrome + ruler + both gaps + both lanes -- + // recomputed here rather than importing the private + // `layout::LEDGER_SEAM_CLEARANCE`, so this test fails if that term is + // ever silently dropped from `BENCH_MIN_H`'s own sum. + let content_need = real_chrome + RULER_H + ROW_GAP + 2. * LANE_MIN_H + ROW_GAP; + let ledger_seam_clearance = BENCH_MIN_H - content_need; + assert!( + ledger_seam_clearance >= 1. - 1e-4, + "BENCH_MIN_H ({BENCH_MIN_H}) leaves only {ledger_seam_clearance}px \ + between the last lane row and the ledger's own top border -- driven \ + at exactly the content's need (0px clearance) the border still won \ + the shared pixel and clipped the last lane's status dot" + ); +} + +/// The previous test asserted lane ROWS fit the bench column -- not that a +/// lane's own CONTENT fits its row, which is how the defect it fixed +/// survived it: at the old `LANE_MIN_H` of `18.` both lanes fit the bench +/// exactly while V1's status dot silently overflowed into A1's row (masked) +/// and A1's overflowed into the ledger (visible, since A1 has no next row). +/// This binary carries no `TestAppContext` to mount a real `lane_row` and +/// read its painted bounds back, so this recomputes the label's own line +/// box from the constants `lane_row` actually draws with (gpui's default +/// `TextStyle::line_height` is the golden ratio, not 1x the font size -- +/// see `LANE_MIN_H`'s own doc comment) rather than a literal, so a future +/// shrink of `LANE_MIN_H` or growth of the label size fails this instead of +/// silently clipping the last lane again. +#[test] +fn a_lane_row_fits_what_its_own_head_draws() { + use crate::ui::bench_stance::{LANE_DOT_D, LANE_HEAD_GAP, LANE_MIN_H}; + use crate::ui::type_scale::CHORD_METADATA_MIN_PX; + + let label_line_h = (CHORD_METADATA_MIN_PX * 1.618_034).round(); + let content = label_line_h + LANE_HEAD_GAP + LANE_DOT_D; + assert!( + LANE_MIN_H >= content, + "LANE_MIN_H ({LANE_MIN_H}) is shorter than what a lane head actually \ + draws ({content}px: {label_line_h}px label line box + \ + {LANE_HEAD_GAP}px gap + {LANE_DOT_D}px dot) -- the status dot \ + would spill past the row, invisible until it is the last lane \ + with no next row to spill into" + ); +} + +/// The notice plate's own anchor ([`crate::ui::stance::notice_bottom_offset`]) +/// keeps it off the bench, at *any* bench height -- not merely the floor -- +/// because its bottom offset always lands at or above the bench's own top +/// edge. `Player`'s live tree has no `TestAppContext` in this binary to mount +/// a real `notice_plate` in and read its painted bounds back, so this checks +/// the pure geometry the anchor is built from instead (F2: previously the +/// plate sat at a fixed `LEDGER_H + 6.` off the ledger and covered the +/// V1/A1 lane chips whenever the bench was short enough for the plate's own +/// height to reach past it). +#[test] +fn the_notice_plate_cannot_reach_the_bench_at_any_height() { + use crate::BENCH_MIN_H; + use crate::ui::stance::{BENCH_H, LEDGER_H, notice_bottom_offset}; + + for bench_h in [BENCH_MIN_H, BENCH_H, 400.] { + let notice_bottom = notice_bottom_offset(bench_h); + // The bench sits directly above the ledger in the centre column, so + // its own top edge (measured the same way, from the column's foot) + // is exactly `LEDGER_H + bench_h`. + let bench_top = LEDGER_H + bench_h; + assert!( + notice_bottom >= bench_top, + "notice bottom {notice_bottom} sits below the bench's top {bench_top} \ + at bench_h={bench_h} -- the plate can cover a lane row" + ); + } +} + +/// A round trip through the file: what is saved is what the next load reads +/// back, one seam touched and the other left at its default -- a scratch +/// path, not the real config, the same isolation `keymap::tests`' own +/// `load_from`/`save_to` already takes. +#[test] +fn a_saved_seam_survives_a_reload() { + use crate::{Split, Splits, load_stance_splits_from, save_stance_splits_to}; + + let dir = engine::scratch::Scratch::dir("edith-stance-splits"); + let path = dir.join("stance-splits"); + + let mut splits = Splits::default(); + splits.set(Split::Dock, 333.); + save_stance_splits_to(&splits, &path); + let loaded = load_stance_splits_from(&path); + assert_eq!(loaded.get(Split::Dock), Some(333.)); + assert_eq!(loaded.get(Split::Bench), None); +} + +/// The guard [`crate::split_drag_owes_save`] runs at the moment a drag ends +/// with no further pointer event ever coming (`Player::drag_left_window`, +/// wired to a live `MouseExitEvent` a `TestAppContext`-less test binary +/// cannot raise -- see `tests/media.rs`'s own note on the same limit, and +/// the harness drive `D2` in this session's report for the wiring itself). +/// What *is* checkable here without a window: exactly the two persisted +/// seams owe that save, the same set `Split::PERSISTED` already names, and a +/// drag that never started (`None`) owes nothing. +#[test] +fn only_the_two_persisted_seams_owe_a_save_when_a_drag_loses_the_window() { + use crate::{Split, player::timeline_edit::split_drag_owes_save}; + + assert!(split_drag_owes_save(Some(Split::Dock))); + assert!(split_drag_owes_save(Some(Split::Bench))); + assert!(!split_drag_owes_save(Some(Split::Library))); + assert!(!split_drag_owes_save(Some(Split::Inspector))); + assert!(!split_drag_owes_save(Some(Split::Timeline))); + assert!(!split_drag_owes_save(None)); +} + +/// A missing file leaves every region at its default -- the silent fallback +/// `load_stance_splits`'s doc comment promises. +#[test] +fn a_missing_stance_splits_file_leaves_every_region_at_its_default() { + use crate::{Split, load_stance_splits_from}; + + let dir = engine::scratch::Scratch::dir("edith-stance-splits-missing"); + let splits = load_stance_splits_from(&dir.join("nothing-here")); + assert_eq!(splits.get(Split::Dock), None); + assert_eq!(splits.get(Split::Bench), None); +} + /// Every seam in the main layout has a handle on it, and every region draws /// itself at the size that handle sets: a region still measuring itself off the /// window's own share is a panel whose divider moves nothing. @@ -1748,6 +1994,13 @@ fn every_seam_in_the_layout_has_a_divider_on_it() { "{split} has no divider to drag" ); } + let stance = src_text("ui/stance.rs"); + for split in ["Split::Dock", "Split::Bench"] { + assert!( + stance.contains(&format!("divider({split}")), + "{split} has no divider to drag" + ); + } // The strip is drawn wide enough to hit and says which way it moves -- // an invisible hairline is a feature nobody finds. let interact = src_text("interact.rs"); diff --git a/crates/app/src/ui/bench_stance.rs b/crates/app/src/ui/bench_stance.rs index 0adc56d..fa951f1 100644 --- a/crates/app/src/ui/bench_stance.rs +++ b/crates/app/src/ui/bench_stance.rs @@ -45,7 +45,7 @@ use crate::ui::widgets::*; /// The pinned ruler's own height, above the lane stack -- tall enough for a /// tick line plus a mono `MM:SS` label under it (DESIGN §5's "tick marks with /// mono ink3 timecodes"). -const RULER_H: f32 = 22.; +pub(crate) const RULER_H: f32 = 22.; /// The stops a tick interval is picked from (DESIGN §5, the previous /// builder's own note): the smallest one whose pixel width at the current /// zoom still clears [`TICK_MIN_PX`]. @@ -62,12 +62,34 @@ const PLATE_W: f32 = 74.; /// the legacy timeline's `HEADER_W` since a darkroom lane carries no mix/eye /// button yet (deferred with the rest of the header's verbs). const HEAD_W: f32 = 28.; -const ROW_GAP: f32 = 2.; +pub(crate) const ROW_GAP: f32 = 2.; /// DESIGN §7: lanes compress evenly up to this many rows before the column /// scrolls behind the pinned ruler and heads instead of compressing further. const LANES_COMPRESS: usize = 5; const LANE_FULL_H: f32 = 40.; -const LANE_MIN_H: f32 = 18.; +/// The gap `lane_row`'s pinned head column puts between the lane label and +/// its status dot (its own `.gap(px(...))`), named so [`LANE_MIN_H`]'s +/// derivation below doesn't repeat the literal blind. +pub(crate) const LANE_HEAD_GAP: f32 = 2.; +/// The status dot's own diameter (`lane_row`'s "Pinned track head" child, +/// its own `.w(px(...)).h(px(...))`). +pub(crate) const LANE_DOT_D: f32 = 4.; +/// The lane label's own line box at [`type_scale::CHORD_METADATA_MIN_PX`]: +/// gpui's default `TextStyle::line_height` is not 1x the font size but the +/// golden ratio (`gpui::phi()` == `relative(1.618034)`), and `lane_row` +/// never calls `.line_height()` on the head label to override it -- so this +/// is what the label really occupies, not its glyph height. +/// round(12. * 1.618034) would be wrong here: the head uses +/// `CHORD_METADATA_MIN_PX` (11.), so round(11. * 1.618034) = round(17.798) +/// = 18. +const LANE_LABEL_LINE_H: f32 = 18.; +/// The least a lane row may be: what its own head actually draws, not a +/// number copied from nowhere. The old `18.` fit only the label's line box +/// and let every lane's status dot overflow into the row beneath it -- +/// invisible everywhere but the last lane, which has no next row to spill +/// into and clipped straight into the ledger instead (adversarial pass on +/// the `BENCH_MIN_H = 82` floor). +pub(crate) const LANE_MIN_H: f32 = LANE_LABEL_LINE_H + LANE_HEAD_GAP + LANE_DOT_D; /// One clip's degradation tier (DESIGN §7), picked off the clip's own worth /// in pixels (`span`, unclamped) rather than its drawn floor @@ -141,7 +163,7 @@ fn tier(span: f32) -> Tier { /// The lane stack's own height budget, split evenly across up to /// [`LANES_COMPRESS`] rows before the column scrolls instead (DESIGN §7). -fn row_h(lanes: usize, box_h: f32) -> f32 { +pub(crate) fn row_h(lanes: usize, box_h: f32) -> f32 { let n = lanes.clamp(1, LANES_COMPRESS) as f32; ((box_h - (n - 1.) * ROW_GAP) / n).clamp(LANE_MIN_H, LANE_FULL_H) } @@ -596,7 +618,7 @@ fn lane_row( .flex_col() .items_center() .justify_center() - .gap(px(2.)) + .gap(px(LANE_HEAD_GAP)) .bg(rgb(DARK_PANEL())) .cursor(CursorStyle::OpenHand) .on_drag(LaneDrag(lane), move |_, _, _, cx| { @@ -609,7 +631,14 @@ fn lane_row( )) .text_color(rgb(INK2())) .child(lane.label()) - .child(div().flex_none().w(px(4.)).h(px(4.)).rounded(px(2.)).bg(rgb(dot))), + .child( + div() + .flex_none() + .w(px(LANE_DOT_D)) + .h(px(LANE_DOT_D)) + .rounded(px(LANE_DOT_D / 2.)) + .bg(rgb(dot)), + ), ) .child( // The bed: a drop target for the Sources tab (`AssetDrag`, diff --git a/crates/app/src/ui/library.rs b/crates/app/src/ui/library.rs index 8c51a2b..9858e13 100644 --- a/crates/app/src/ui/library.rs +++ b/crates/app/src/ui/library.rs @@ -688,7 +688,7 @@ impl Player { // floor clamp and the room the list sizes against are `menu_floor`'s, // so a menu taller than the footprint scrolls instead of climbing // back over the picture. - let (at, room) = menu_floor(menu.at, viewport, darkroom); + let (at, room) = menu_floor(menu.at, viewport, darkroom, self.split_px(Split::Bench, viewport)); let list_h = menu_rows_h(rows.len(), room); let (x, y) = menu_at(at, viewport, MENU_PAD * 2. + list_h); let full: SharedString = path.display().to_string().into(); diff --git a/crates/app/src/ui/overlays.rs b/crates/app/src/ui/overlays.rs index 63ce4f3..1205d89 100644 --- a/crates/app/src/ui/overlays.rs +++ b/crates/app/src/ui/overlays.rs @@ -670,7 +670,7 @@ impl Player { // footprint (`room`), not the whole window, so a menu taller than // the footprint scrolls inside its own plate instead of walking its // clamped top edge back up over the picture ([`menu_floor`]). - let (at, room) = menu_floor(menu.at, viewport, self.darkroom); + let (at, room) = menu_floor(menu.at, viewport, self.darkroom, self.split_px(Split::Bench, viewport)); let list_h = menu_rows_h(rows.len(), room); let (x, y) = menu_at(at, viewport, MENU_PAD * 2. + list_h); let full: SharedString = source @@ -832,7 +832,7 @@ impl Player { .collect(); // The window's own room, and the list scrolls only where the window has // none -- the clip menu's rule, one function for both. - let (at, room) = menu_floor(picker.at, viewport, darkroom); + let (at, room) = menu_floor(picker.at, viewport, darkroom, self.split_px(Split::Bench, viewport)); let list_h = menu_rows_h(rows.len(), room); let (x, y) = menu_at(at, viewport, MENU_PAD * 2. + list_h); Some( diff --git a/crates/app/src/ui/stance.rs b/crates/app/src/ui/stance.rs index 8a9208a..69b1955 100644 --- a/crates/app/src/ui/stance.rs +++ b/crates/app/src/ui/stance.rs @@ -18,18 +18,36 @@ use crate::ui::type_scale::{self, Typeset}; /// Left rail, full height (DESIGN §5). const SPINE_W: f32 = 56.; /// Fixed strip under the screen: timecode, transport, cut readout, contact -/// strip, Export -- all placeholder at this step. -const TIME_BAND_H: f32 = 88.; -/// corner-cut: a fixed share of the window rather than one measured against -/// the picture's own room, matching the placeholder every other stance -/// region still carries at this step. Ceiling: fold into the same split the -/// legacy timeline's `Split::Timeline` answers once the stance grows a -/// resizable seam of its own. -const BENCH_H: f32 = 200.; -/// Thin strip at the foot of the centre column. -const LEDGER_H: f32 = 28.; -/// Right side panel, fixed width, carrying the Src/Clip tab pair. -const DOCK_W: f32 = 280.; +/// strip, Export -- all placeholder at this step. Kept `pub(crate)` for +/// `layout::split_bounds`'s bench ceiling, the same one-door reason +/// [`LEDGER_H`] already is. +pub(crate) const TIME_BAND_H: f32 = 88.; +/// The bench's untouched height -- [`Split::Bench`]'s own default, read by +/// `layout::split_size` the same way the legacy tree's `library_w`/ +/// `inspector_w` feed `Split::Library`/`Split::Inspector`. A hand on the +/// seam above it overrides this; nothing else does. +pub(crate) const BENCH_H: f32 = 200.; +/// Thin strip at the foot of the centre column. Read by `layout`'s +/// `Split::Bench` drag formula (the seam sits above the fixed ledger, so a +/// drag has to leave room for it) -- kept `pub(crate)` for that one door +/// rather than a second copy of the number. +pub(crate) const LEDGER_H: f32 = 28.; +/// The dock's untouched width -- [`Split::Dock`]'s own default, the same +/// role [`BENCH_H`] plays for the bench. +pub(crate) const DOCK_W: f32 = 280.; +/// What [`bench`] spends above `bench_stance::render`'s own content: the +/// `bench` div's own `.border_t_1()` (1px) + its `py(4.)` top padding + +/// the section head's real line box -- `type_scale::head()` sizes text at +/// `SECTION_HEAD_PX` (10) but never calls `.line_height()`, so gpui's +/// default `TextStyle::line_height` (the golden ratio, `gpui::phi()` == +/// `1.618034`, not 1x the font size) is what it actually draws: +/// `round(10. * 1.618034)` = `round(16.18034)` = `16`. A driven pass found +/// this constant undercounting that line box as a bare `10`, one of the two +/// causes of `layout::BENCH_MIN_H`'s third clip (see its own doc comment for +/// the other). `1 + 4 + 16` = `21`. Named and `pub(crate)` rather than the +/// `- 20.` it used to be inlined as, so `layout::BENCH_MIN_H` can add it +/// into its own derivation instead of guessing it back out. +pub(crate) const BENCH_CHROME_H: f32 = 21.; /// The lowest a menu's top edge may sit and still land inside the /// bench/ledger/dock footprint below the screen (DESIGN §5, §9, §11 check 6): @@ -37,9 +55,12 @@ const DOCK_W: f32 = 280.; /// the picture just because the pointer is there. `overlays.rs`/`library.rs` /// clamp their `menu.at.y` against this before handing it to `menu_at`, only /// in the darkroom stance -- the legacy tree has no fixed screen/time-band -/// split for this to mean anything against, and must not move. -pub(crate) fn below_picture_floor(viewport_h: f32) -> f32 { - (viewport_h - TIME_BAND_H - BENCH_H - LEDGER_H).max(0.) +/// split for this to mean anything against, and must not move. `bench_h` is +/// the live, possibly hand-dragged `Split::Bench` height (`Player::split_px`) +/// rather than the fixed [`BENCH_H`] default, so a widened bench clamps the +/// menu against the room actually left, not the room it started with. +pub(crate) fn below_picture_floor(viewport_h: f32, bench_h: f32) -> f32 { + (viewport_h - TIME_BAND_H - bench_h - LEDGER_H).max(0.) } /// The floor-clamped placement for every scrolling menu (clip context menu, @@ -59,11 +80,12 @@ pub(crate) fn menu_floor( at: Point, viewport: Size, darkroom: bool, + bench_h: f32, ) -> (Point, Size) { if !darkroom { return (at, viewport); } - let floor = below_picture_floor(f32::from(viewport.height)); + let floor = below_picture_floor(f32::from(viewport.height), bench_h); let at = point(at.x, px(f32::from(at.y).max(floor))); let room = size(viewport.width, px(f32::from(viewport.height) - floor)); (at, room) @@ -83,8 +105,8 @@ mod menu_floor_tests { #[test] fn a_menu_taller_than_the_footprint_stays_pinned_to_the_floor_not_walked_back_over_it() { let viewport = size(px(1280.), px(720.)); - let floor = below_picture_floor(f32::from(viewport.height)); - let (at, room) = menu_floor(point(px(300.), px(20.)), viewport, true); + let floor = below_picture_floor(f32::from(viewport.height), BENCH_H); + let (at, room) = menu_floor(point(px(300.), px(20.)), viewport, true, BENCH_H); assert_eq!(f32::from(at.y), floor); // 396px of rows (the charter's measured menu height) does not fit in // the 316px footprint room, so it must be capped to it, not the @@ -425,11 +447,14 @@ fn time_band(player: &mut Player, position: f64, cx: &mut Context) -> im /// Lanes, under the time band. `canvas` is the bench background too (DESIGN /// §2's token table), so it shares its surface with the screen above it. -fn bench(player: &mut Player, cx: &mut Context) -> impl IntoElement { +/// Height comes from [`Player::split_px`] now, not the fixed [`BENCH_H`]: +/// the seam [`crate::ui::stance::render`] mounts above this region is what +/// answers "ui fields are not stretchable" for the bench. +fn bench(player: &mut Player, bench_h: f32, cx: &mut Context) -> impl IntoElement { div() .id("stance-bench") .flex_none() - .h(px(BENCH_H)) + .h(px(bench_h)) // §4: lanes take 0 radius. .rounded(px(0.)) .bg(rgb(DARK_CANVAS())) @@ -440,7 +465,7 @@ fn bench(player: &mut Player, cx: &mut Context) -> impl IntoElement { .px(px(12.)) .py(px(4.)) .child(section_head("bench")) - .child(bench_stance::render(player, BENCH_H - 20., cx)) + .child(bench_stance::render(player, bench_h - BENCH_CHROME_H, cx)) } /// Which of the three §8 severities a notice's own words carry. Reuses @@ -461,22 +486,40 @@ fn notice_severity(message: &str) -> u32 { } } -/// A notice plate (DESIGN §8): one at a time, rising above the ledger, its +/// [`notice_plate`]'s own `bottom` offset, pulled out as a pure function so +/// a `TestAppContext`-less test binary (this crate's own, no live `Context` +/// to mount a real `notice_plate` in) can still check the plate never lands +/// over the bench, for any `bench_h` -- without duplicating the arithmetic +/// by hand and risking the two drifting apart. +pub(crate) fn notice_bottom_offset(bench_h: f32) -> f32 { + LEDGER_H + bench_h + 6. +} + +/// A notice plate (DESIGN §8): one at a time, rising above the *bench*, its /// severity a 3px left spine rather than a colour flood. Fed by the same /// [`Player::notify_user`]/`notices` queue the legacy bar reads /// ([`Player::notice_bar`]) -- no second notice channel. Dismissal is /// already wired: [`render`]'s `on_key_down` calls `dismiss_notice()` on /// every stroke, the same door the legacy handler uses. /// +/// Anchored off `bench_h` rather than a fixed offset off the ledger: at the +/// bench's floor a fixed `LEDGER_H + 6.` bottom offset put the plate right +/// over the V1/A1 lane chips -- a transient message hiding the lanes for as +/// long as it sat there. Floating it `bench_h` further up puts its bottom +/// edge at the bench's own *top* edge for any bench height, so it always +/// sits in the divider/time-band's slack above the bench rather than over +/// the lanes, and never has to reserve room in the bench itself for a +/// message that is not always there. +/// /// corner-cut: amber's "carries a jump action" is not wired -- the queue /// only ever held plain text, no structured jump target, in either the /// legacy bar or here. Ceiling: give `notify_user` an optional jump payload /// once a call site actually has one to carry. -fn notice_plate(message: SharedString) -> impl IntoElement { +fn notice_plate(message: SharedString, bench_h: f32) -> impl IntoElement { div() .id("stance-notice") .absolute() - .bottom(px(LEDGER_H + 6.)) + .bottom(px(notice_bottom_offset(bench_h))) .left(px(12.)) .max_w(px(360.)) .flex() @@ -567,18 +610,47 @@ fn ledger(player: &Player, position: f64) -> impl IntoElement { /// The dock: the only side panel, right, fixed width, carrying the Src/Clip /// tab pair (DESIGN §5). The frame is drawn here; `dock_stance.rs` owns the /// tab row and both tabs' content (DESIGN §12 step 4). -fn dock(player: &Player, window_size: Size, cx: &mut Context) -> impl IntoElement { +/// Width comes from [`Player::split_px`] now, not the fixed [`DOCK_W`]: the +/// seam [`crate::ui::stance::render`] mounts to its left is what answers +/// "ui fields are not stretchable" for the dock. `window_size` is threaded +/// through so the maximize-in-place cards inside the dock (`dock_stance.rs`) +/// see the real viewport rather than a fabricated `size(px(DOCK_W), h)`. +fn dock(player: &Player, dock_w: f32, window_size: Size, cx: &mut Context) -> impl IntoElement { div() .id("stance-dock") .flex_none() - .w(px(DOCK_W)) + .w(px(dock_w)) .h_full() .bg(rgb(DARK_PANEL())) .border_l_1() .border_color(rgba(DARK_SEAM())) .flex() .flex_col() - .child(dock_stance::render(player, DOCK_W, window_size, cx)) + .child(dock_stance::render(player, dock_w, window_size, cx)) +} + +/// A zero-size element whose only job is `window.on_mouse_event`'s door: +/// `Interactivity`'s fluent `on_mouse_*` builders (the ones `render`'s root +/// div uses for the drag itself, just below) have no `MouseExitEvent` case, +/// so this is the lowest rung that reaches it -- registered fresh every +/// frame, the same way `canvas()` is already used elsewhere in this crate +/// for paint-time access `div()` does not expose. See +/// [`Player::drag_left_window`] for why this event, and not a release, is +/// what a seam drag ending outside the window is saved on. +fn mouse_exit_listener(cx: &mut Context) -> impl IntoElement { + let player = cx.entity(); + canvas( + |_, _, _| (), + move |_, _, window, _| { + window.on_mouse_event(move |_: &MouseExitEvent, phase, _window, cx| { + if phase == gpui::DispatchPhase::Bubble { + player.update(cx, |this, cx| this.drag_left_window(cx)); + } + }); + }, + ) + .absolute() + .size(px(0.)) } /// The whole stance: spine, screen, time band, bench, ledger, dock, in the @@ -591,8 +663,13 @@ pub(crate) fn render( cx: &mut Context, ) -> impl IntoElement { let window_size = window.viewport_size(); - let window_h = window_size.height; let position = player.playhead(player.drawn_duration()); + // The two seams a hand may drag (`Split::Dock`, `Split::Bench`): read + // through the same door every legacy region measures itself by + // ([`Player::split_px`]), so a dragged size and a drawn one cannot + // disagree here either. + let dock_w = player.split_px(Split::Dock, window_size); + let bench_h = player.split_px(Split::Bench, window_size); div() .id("stance-room") .track_focus(&player.focus) @@ -739,9 +816,16 @@ pub(crate) fn render( cx.notify(); } })) + // The seam drag is tracked on the root, same reason the legacy + // ruler-scrub is (render.rs): the pointer outruns the 6px divider + // hitbox on the first move, so only the whole-window root keeps + // hearing it once a `Split::Dock`/`Split::Bench` drag has started. + .on_mouse_move(cx.listener(Player::drag_move)) + .on_mouse_up(MouseButton::Left, cx.listener(Player::drag_release)) .size_full() .flex() .bg(rgb(DARK_CANVAS())) + .child(mouse_exit_listener(cx)) .child(spine(player, cx)) .child( div() @@ -753,10 +837,11 @@ pub(crate) fn render( .flex_col() .child(screen(player, position, window, cx)) .child(time_band(player, position, cx)) - .child(bench(player, cx)) + .child(divider(Split::Bench, cx)) + .child(bench(player, bench_h, cx)) .child(ledger(player, position)) .when_some(player.notices.front().cloned(), |el, n| { - el.child(notice_plate(n)) + el.child(notice_plate(n, bench_h)) }) .when(player.keys_open, |el| el.child(keys_overlay(player))) // The two menus (DESIGN §9: "verbs of the thing under the @@ -780,5 +865,6 @@ pub(crate) fn render( .children(player.export_progress_card(cx)) .children(player.picker_card(window_size, cx)), ) - .child(dock(player, window_size, cx)) + .child(divider(Split::Dock, cx)) + .child(dock(player, dock_w, window_size, cx)) }