forge
Explore
Log in

Don't you dare go Hollow

A clip card can be made big enough to work in

Browse files at this commit

c41d066f50f460cb8e8e671fcd1e3f6215baca4bAhmet Kaan GümüşParent: c2943bba333a46
  • feat
    • a clip card can be made big enough to work in
Show full message
✨ feat(ui): a clip card can be made big enough to work in

Maximizing mounts the card against the window instead of the dock column —
an absolute child is sized by its immediate parent, so a window-space offset
applied inside the dock put the card in a sliver off the bottom. Toggled by
m, by the glyph on the card head, and by a double-click on it; esc gives the
size back before it closes the card; the pick survives a restart.

The extra room buys resolution, not scale: the EQ's tick gaps go 124.5px to
264.5px with the glyph height unchanged at 8px. Height is floored at the
default bench so a small bench cannot shrink the maximized card, and the
graph now flexes so the band controls stay visible instead of overflowing.

Also fixes clip_tab discarding its own width parameter, which had been
handing every card the whole window instead of the dock it lives in.
crates/app/src/audio_cards.rsmodified+74 -0
@@ -119,6 +119,21 @@ pub(crate) const EQ_FREQ_HIGH: f32 = 20_000.;
119 /// and short enough that the card still fits a 360 px window.119 /// and short enough that the card still fits a 360 px window.
120 pub(crate) const EQ_GRAPH_H: f32 = 132.;120 pub(crate) const EQ_GRAPH_H: f32 = 132.;
121 121
122+/// The curve box maximized: 1 dB and a semitone-ish band of frequency both
123+/// read as more pixels than the docked floor spends on them -- the same
124+/// curve, the same ±12 dB axis and the same 20 Hz-20 kHz sweep, just spread
125+/// over more of the vertical resolution a maximized card borrows from the
126+/// bench/ledger rows below the picture ([`crate::ui::stance::below_picture_floor`]).
127+pub(crate) const EQ_GRAPH_MAX_H: f32 = 320.;
128+
129+/// The graph's own height for the card's current size: the docked floor, or
130+/// the maximized card's own taller box -- never a CSS scale of the same
131+/// pixels, an actually taller curve with more room per decibel and per
132+/// decade.
133+pub(crate) fn eq_graph_h(maximized: bool) -> f32 {
134+ if maximized { EQ_GRAPH_MAX_H } else { EQ_GRAPH_H }
135+}
136+
122 /// How wide the equalizer card is allowed to get. It is the one card that is a137 /// How wide the equalizer card is allowed to get. It is the one card that is a
123 /// *graph*: every pixel across is frequency resolution, and at the 320 px the138 /// *graph*: every pixel across is frequency resolution, and at the 320 px the
124 /// other cards use, a third of an octave was a couple of pixels. Past this the139 /// other cards use, a third of an octave was a couple of pixels. Past this the
@@ -173,6 +188,65 @@ pub(crate) const EQ_TICKS: [(f32, &str); 5] = [
173 /// named at the corners instead.188 /// named at the corners instead.
174 pub(crate) const EQ_DB_GRID: [f32; 2] = [6., -6.];189 pub(crate) const EQ_DB_GRID: [f32; 2] = [6., -6.];
175 190
191+/// How wide an end tick's own label box has to be so "20 Hz" reads as one
192+/// line rather than wrapping onto two ("20" over "Hz") -- driven live and
193+/// found doing exactly that at a fixed 24 px box once the end ticks were
194+/// anchored to the graph's edge instead of centred on it (the anchor alone
195+/// was not the whole fix). Sized off the label's own character count at the
196+/// size it is actually drawn, using the list-truncation ladder's already
197+/// -calibrated characters-to-pixels ratio ([`crate::layout::LIST_CHAR_W`] at
198+/// [`crate::ui::type_scale::CHORD_METADATA_MIN_PX`]) rather than a second
199+/// magic pixel count -- so a future type-scale bump (this one already moved
200+/// once this session) widens the box along with the text instead of
201+/// re-wrapping it.
202+pub(crate) fn eq_tick_end_w(label: &str, text_px: f32) -> f32 {
203+ label.chars().count() as f32 * crate::layout::LIST_CHAR_W
204+ / crate::ui::type_scale::CHORD_METADATA_MIN_PX
205+ * text_px
206+}
207+
208+#[cfg(test)]
209+mod eq_graph_maximize_tests {
210+ use super::*;
211+
212+ /// D2's regression class: the maximized card revealed LESS than docked
213+ /// at the same bench, because the graph claimed a fixed slice (a flat
214+ /// `EQ_GRAPH_MAX_H`) that left nothing for the rows below it, forcing a
215+ /// scroll docked never needed at the same bench. This binary has no
216+ /// `TestAppContext`, so it cannot read the flex layout gpui actually
217+ /// paints back -- this is a value-level pin on the two numbers the fix
218+ /// (`crates/app/src/ui/cards.rs`'s `graph_maximized` branch, `flex_1()`
219+ /// between a floor and a ceiling rather than a fixed height) depends on,
220+ /// not a substitute for driving a maximize at a small bench: the
221+ /// maximized graph's floor must be the *same* constant docked draws its
222+ /// fixed height at (so maximized can never show less graph than docked,
223+ /// whatever room is left over for the graph to grow into), and that
224+ /// floor must not exceed its own ceiling (an inverted `min_h`/`max_h`
225+ /// clamp is a layout-time panic, not a compile-time one).
226+ #[test]
227+ fn maximized_graph_floor_matches_docked_and_never_exceeds_its_own_ceiling() {
228+ assert_eq!(eq_graph_h(false), EQ_GRAPH_H, "docked height must be the floor maximized also uses");
229+ assert!(EQ_GRAPH_H <= EQ_GRAPH_MAX_H);
230+ }
231+}
232+
233+#[cfg(test)]
234+mod eq_tick_end_w_tests {
235+ use super::*;
236+
237+ /// The defect measured live: a fixed 24 px box wrapped "20 Hz" (5 chars)
238+ /// at the dark theme's 11 px end-tick size. The derived width must clear
239+ /// that box, and must grow, not shrink, if a future scale bump raises
240+ /// the size fed in.
241+ #[test]
242+ fn wide_enough_for_the_widest_end_label_and_grows_with_the_type_scale() {
243+ let dark_w = eq_tick_end_w("20 Hz", crate::ui::type_scale::CHORD_METADATA_MIN_PX);
244+ assert!(dark_w > 24., "{dark_w} must clear the old fixed box");
245+ let bumped_w = eq_tick_end_w("20 Hz", crate::ui::type_scale::CHORD_METADATA_MIN_PX + 4.);
246+ assert!(bumped_w > dark_w);
247+ }
248+}
249+
176 250
177 /// How many played samples one spectrum frame is transformed from. A power of251 /// How many played samples one spectrum frame is transformed from. A power of
178 /// two ([`fft`] is radix-2) and the whole of the engine's tap: 1024 at 48 kHz252 /// two ([`fft`] is radix-2) and the whole of the engine's tap: 1024 at 48 kHz
crates/app/src/library_meta.rsmodified+22 -2
@@ -320,8 +320,28 @@ pub(crate) fn unusable(info: &StreamInfo, timeline_audio: Option<(u32, u16)>) ->
320 /// thousand hertz on 320 px spends four pixels on the octave below middle C --320 /// thousand hertz on 320 px spends four pixels on the octave below middle C --
321 /// so it takes the room a big window has and stays inside a small one. Floored321 /// so it takes the room a big window has and stays inside a small one. Floored
322 /// at the other cards' width, which is the last size the rows still read at.322 /// at the other cards' width, which is the last size the rows still read at.
323-pub(crate) fn eq_card_w(window_w: f32) -> f32 {323+pub(crate) fn eq_card_w(window_w: f32, maximized: bool) -> f32 {
324- (window_w - EQ_W_MARGIN).clamp(KEYS_W, EQ_W_MAX)324+ let raw = window_w - EQ_W_MARGIN;
325+ if maximized {
326+ // Maximized drops the [`EQ_W_MAX`] ceiling: every pixel across is
327+ // frequency resolution (the doc comment above), and a maximized card
328+ // is asking for exactly the room a big window has to give it.
329+ raw.max(KEYS_W)
330+ } else {
331+ raw.clamp(KEYS_W, EQ_W_MAX)
332+ }
333+}
334+
335+/// How wide a non-EQ param card is drawn: its usual fixed width, or (when
336+/// maximized) all of the window bar the same margin the EQ card gives
337+/// itself -- never narrower than its own floor, so a small window's
338+/// maximize is a no-op rather than a shrink.
339+pub(crate) fn card_max_w(base_w: f32, maximized: bool, window_w: f32) -> f32 {
340+ if maximized {
341+ (window_w - EQ_W_MARGIN).max(base_w)
342+ } else {
343+ base_w
344+ }
325 }345 }
326 346
327 /// What the media list is given of the window. A share of it, so a narrow347 /// What the media list is given of the window. A share of it, so a narrow
crates/app/src/main.rsmodified+8 -0
@@ -576,6 +576,13 @@ struct Player {
576 /// the card is modal: while it is up nothing else can move an index, and576 /// the card is modal: while it is up nothing else can move an index, and
577 /// the one edit it makes (`set_eq`) moves none.577 /// the one edit it makes (`set_eq`) moves none.
578 eq_open: Option<(Lane, usize)>,578 eq_open: Option<(Lane, usize)>,
579+ /// Whichever of the seven param cards is open, filling the room in place
580+ /// of the bench/ledger rows instead of its usual capped, floating size
581+ /// (`Player::toggle_maximize`). One flag, not one per card, because only
582+ /// one of them is ever open at a time (`close_card`'s own rule) and it
583+ /// outlives any one card's close/reopen, persisted like the dock tab pick
584+ /// (`ui::dock_stance::load_maximized`/`save_maximized`).
585+ card_maximized: bool,
579 /// The curve the card is showing, which is the clip's own or the flat586 /// The curve the card is showing, which is the clip's own or the flat
580 /// five-band default. Edited live and written at the clip once per gesture587 /// five-band default. Edited live and written at the clip once per gesture
581 /// ([`Player::commit_eq`]): the project's equalizer table is append-only, so588 /// ([`Player::commit_eq`]): the project's equalizer table is append-only, so
@@ -967,6 +974,7 @@ fn main() {
967 export_refusals_inline: false,974 export_refusals_inline: false,
968 export_advanced_open: false,975 export_advanced_open: false,
969 eq_open: None,976 eq_open: None,
977+ card_maximized: ui::dock_stance::load_maximized(),
970 // Replaced by the clip's own curve the moment the card978 // Replaced by the clip's own curve the moment the card
971 // opens; nothing reads it before that.979 // opens; nothing reads it before that.
972 eq_params: EqParams::default(),980 eq_params: EqParams::default(),
crates/app/src/player/cards.rsmodified+49 -4
@@ -1313,6 +1313,17 @@ impl Player {
1313 self.subtitle_style_open = false;1313 self.subtitle_style_open = false;
1314 }1314 }
1315 1315
1316+ /// The one switch every param card's expand affordance and its `m`
1317+ /// chord both flip (`dark_card_head`, [`Player::param_card_key`]):
1318+ /// whichever card is open trades its usual capped, floating size for the
1319+ /// bench/ledger rows' own room, in place -- layout only, no value on the
1320+ /// card changes. Persisted like the dock tab pick so a maximized EQ is
1321+ /// still maximized after the room closes and reopens.
1322+ pub(crate) fn toggle_maximize(&mut self) {
1323+ self.card_maximized = !self.card_maximized;
1324+ ui::dock_stance::save_maximized(self.card_maximized);
1325+ }
1326+
1316 /// Opens the equalizer on the selected clip. Audio only, and it says so1327 /// Opens the equalizer on the selected clip. Audio only, and it says so
1317 /// rather than opening a card of bands that would reach nothing: a video1328 /// rather than opening a card of bands that would reach nothing: a video
1318 /// clip carries no sound of its own here (the sound is the audio lane's),1329 /// clip carries no sound of its own here (the sound is the audio lane's),
@@ -1489,8 +1500,32 @@ impl Player {
1489 /// and ate the key, the caller's cue to `cx.notify()` and stop exactly1500 /// and ate the key, the caller's cue to `cx.notify()` and stop exactly
1490 /// where each of these branches used to `return` inline.1501 /// where each of these branches used to `return` inline.
1491 pub(crate) fn param_card_key(&mut self, key: &str, shift: bool, cx: &mut Context<Self>) -> bool {1502 pub(crate) fn param_card_key(&mut self, key: &str, shift: bool, cx: &mut Context<Self>) -> bool {
1503+ // The one chord every param card answers to, wherever the pointer
1504+ // toggle sits in `dark_card_head` -- mouse and key reach the same
1505+ // switch (DESIGN's repeated "some options are only reachable via
1506+ // keyboard shortcut" complaint). Checked once, ahead of the seven
1507+ // card-local branches below, because it means the same thing in all
1508+ // of them: none of the seven uses bare "m" for anything else.
1509+ if key == "m"
1510+ && (self.eq_open.is_some()
1511+ || self.color_open.is_some()
1512+ || self.transform_open.is_some()
1513+ || self.speed_open.is_some()
1514+ || self.silence_open.is_some()
1515+ || self.mix_open
1516+ || self.subtitle_style_open)
1517+ {
1518+ self.toggle_maximize();
1519+ return true;
1520+ }
1492 if self.eq_open.is_some() {1521 if self.eq_open.is_some() {
1493 if key == ESCAPE {1522 if key == ESCAPE {
1523+ // Maximized comes off before the card does -- "esc always
1524+ // retreats" one step at a time (DESIGN.md:146).
1525+ if self.card_maximized {
1526+ self.toggle_maximize();
1527+ return true;
1528+ }
1494 // Nothing to undo: every change is already at the clip, and1529 // Nothing to undo: every change is already at the clip, and
1495 // undo is undo's own key.1530 // undo is undo's own key.
1496 self.eq_open = None;1531 self.eq_open = None;
@@ -1546,6 +1581,7 @@ impl Player {
1546 // menu still lists them.1581 // menu still lists them.
1547 if self.color_open.is_some() {1582 if self.color_open.is_some() {
1548 match color_key(key) {1583 match color_key(key) {
1584+ Some(ColorKey::Close) if self.card_maximized => self.toggle_maximize(),
1549 Some(ColorKey::Close) => {1585 Some(ColorKey::Close) => {
1550 self.color_open = None;1586 self.color_open = None;
1551 self.color_dragging = false;1587 self.color_dragging = false;
@@ -1567,7 +1603,9 @@ impl Player {
1567 // the keys menu still lists them).1603 // the keys menu still lists them).
1568 if self.transform_open.is_some() {1604 if self.transform_open.is_some() {
1569 let n = TRANSFORM_BANDS.len();1605 let n = TRANSFORM_BANDS.len();
1570- if key == ESCAPE {1606+ if key == ESCAPE && self.card_maximized {
1607+ self.toggle_maximize();
1608+ } else if key == ESCAPE {
1571 self.transform_open = None;1609 self.transform_open = None;
1572 self.transform_dragging = false;1610 self.transform_dragging = false;
1573 } else if key == "down" {1611 } else if key == "down" {
@@ -1589,6 +1627,7 @@ impl Player {
1589 // menu still lists them).1627 // menu still lists them).
1590 if self.speed_open.is_some() {1628 if self.speed_open.is_some() {
1591 match color_key(key) {1629 match color_key(key) {
1630+ Some(ColorKey::Close) if self.card_maximized => self.toggle_maximize(),
1592 Some(ColorKey::Close) => {1631 Some(ColorKey::Close) => {
1593 self.speed_open = None;1632 self.speed_open = None;
1594 self.speed_dragging = false;1633 self.speed_dragging = false;
@@ -1609,7 +1648,9 @@ impl Player {
1609 // the keys menu (keymap.rs `FIXED`), because a key that cuts forty1648 // the keys menu (keymap.rs `FIXED`), because a key that cuts forty
1610 // places at once is not a secret.1649 // places at once is not a secret.
1611 if self.silence_open.is_some() {1650 if self.silence_open.is_some() {
1612- if key == ESCAPE {1651+ if key == ESCAPE && self.card_maximized {
1652+ self.toggle_maximize();
1653+ } else if key == ESCAPE {
1613 // Nothing to undo: a preview is not an edit.1654 // Nothing to undo: a preview is not an edit.
1614 self.close_silence();1655 self.close_silence();
1615 } else if key == "down" {1656 } else if key == "down" {
@@ -1632,7 +1673,9 @@ impl Player {
1632 // it, held or pressed. Card-local like the four above it.1673 // it, held or pressed. Card-local like the four above it.
1633 if self.mix_open {1674 if self.mix_open {
1634 let rows = self.mix_lanes().len() + MIX_MASTER_ROWS;1675 let rows = self.mix_lanes().len() + MIX_MASTER_ROWS;
1635- if key == ESCAPE {1676+ if key == ESCAPE && self.card_maximized {
1677+ self.toggle_maximize();
1678+ } else if key == ESCAPE {
1636 self.mix_open = false;1679 self.mix_open = false;
1637 } else if key == "down" {1680 } else if key == "down" {
1638 self.mix_field = (self.mix_field + 1) % rows;1681 self.mix_field = (self.mix_field + 1) % rows;
@@ -1655,7 +1698,9 @@ impl Player {
1655 // Row 0 is the size stepper, row 1 the platform default, and1698 // Row 0 is the size stepper, row 1 the platform default, and
1656 // every row after it a family in `subtitle_fonts`.1699 // every row after it a family in `subtitle_fonts`.
1657 let rows = 2 + self.subtitle_fonts.len();1700 let rows = 2 + self.subtitle_fonts.len();
1658- if key == ESCAPE {1701+ if key == ESCAPE && self.card_maximized {
1702+ self.toggle_maximize();
1703+ } else if key == ESCAPE {
1659 self.subtitle_style_open = false;1704 self.subtitle_style_open = false;
1660 } else if key == "down" {1705 } else if key == "down" {
1661 self.subtitle_style_field = (self.subtitle_style_field + 1) % rows;1706 self.subtitle_style_field = (self.subtitle_style_field + 1) % rows;
crates/app/src/tests/cards.rsmodified+180 -6
@@ -458,14 +458,14 @@ fn the_equalizer_graph_puts_a_band_where_a_drag_reads_it_and_fits_the_smallest_w
458 458
459 // The card fits the smallest window and takes the room a bigger one has459 // The card fits the smallest window and takes the room a bigger one has
460 // -- it is a graph, and the width *is* the frequency resolution.460 // -- it is a graph, and the width *is* the frequency resolution.
461- assert!(eq_card_w(640.) <= 640. - 24., "card too wide for 640");461+ assert!(eq_card_w(640., false) <= 640. - 24., "card too wide for 640");
462- assert!(eq_card_w(1280.) > eq_card_w(640.), "card ignores the window");462+ assert!(eq_card_w(1280., false) > eq_card_w(640., false), "card ignores the window");
463- assert_eq!(eq_card_w(1920.), EQ_W_MAX, "card grows without end");463+ assert_eq!(eq_card_w(1920., false), EQ_W_MAX, "card grows without end");
464- assert!(eq_card_w(320.) >= KEYS_W, "card narrower than a row of text");464+ assert!(eq_card_w(320., false) >= KEYS_W, "card narrower than a row of text");
465 // At the smallest window the graph is still a graph: three across for465 // At the smallest window the graph is still a graph: three across for
466 // one down, so an octave is wide enough to put a handle in.466 // one down, so an octave is wide enough to put a handle in.
467 assert!(467 assert!(
468- eq_card_w(640.) - 24. >= 3. * EQ_GRAPH_H,468+ eq_card_w(640., false) - 24. >= 3. * EQ_GRAPH_H,
469 "graph too square to aim at"469 "graph too square to aim at"
470 );470 );
471 471
@@ -1759,10 +1759,184 @@ fn a_cards_own_help_paints_while_the_card_is_open_but_the_ui_under_it_stays_quie
1759 // plain `Tip`, or this whole fix is undone by construction.1759 // plain `Tip`, or this whole fix is undone by construction.
1760 let cards_src = src_text("ui/cards.rs");1760 let cards_src = src_text("ui/cards.rs");
1761 let head_fn_at = cards_src.find("fn dark_card_head(").expect("dark_card_head");1761 let head_fn_at = cards_src.find("fn dark_card_head(").expect("dark_card_head");
1762- let head_fn = &cards_src[head_fn_at..head_fn_at + 1200];1762+ // 1200 was wide enough before this session's maximize glyph/tooltip
1763+ // (`.when(maximize.is_some(), ...)` + its own `OverlayTip`) grew the
1764+ // function ahead of the help tooltip this test is actually pinning.
1765+ let head_fn = &cards_src[head_fn_at..head_fn_at + 2400];
1763 assert!(1766 assert!(
1764 head_fn.contains("OverlayTip(h.clone())"),1767 head_fn.contains("OverlayTip(h.clone())"),
1765 "dark_card_head's own `?` tooltip no longer builds an OverlayTip -- the \1768 "dark_card_head's own `?` tooltip no longer builds an OverlayTip -- the \
1766 card-head help is unreadable again while its card is open"1769 card-head help is unreadable again while its card is open"
1767 );1770 );
1768 }1771 }
1772+
1773+/// "Maximize a card in place" changes size only, never the relative
1774+/// semantics a value is drawn against: `eq_x`/`eq_y` map into `0..1` of
1775+/// whatever box they are given, so a wider/taller EQ card is genuinely more
1776+/// dB/Hz resolution, not the same graph stretched. This is the layout half
1777+/// of that claim -- `eq_x`/`eq_y` themselves take no size argument at all
1778+/// (they answer in `0..1`), so there is nothing about them a maximize could
1779+/// have broken; what a maximize is allowed to touch is `eq_card_w`/
1780+/// `eq_graph_h`'s own ceiling.
1781+#[test]
1782+fn maximizing_a_card_grows_its_box_without_moving_where_a_value_sits_in_it() {
1783+ // Below the old EQ_W_MAX ceiling, maximized and not agree -- there is
1784+ // room for both without the ceiling mattering yet.
1785+ assert_eq!(eq_card_w(600., false), eq_card_w(600., true));
1786+ // Past it, only the maximized card keeps growing: the ceiling this
1787+ // session's fix drops.
1788+ assert!(
1789+ eq_card_w(1920., true) > eq_card_w(1920., false),
1790+ "maximized EQ card no longer drops the EQ_W_MAX ceiling"
1791+ );
1792+ assert_eq!(
1793+ eq_graph_h(true),
1794+ EQ_GRAPH_MAX_H,
1795+ "maximized EQ graph no longer grows to EQ_GRAPH_MAX_H"
1796+ );
1797+ assert!(
1798+ eq_graph_h(true) > eq_graph_h(false),
1799+ "maximized EQ graph is not actually taller than the resting one"
1800+ );
1801+ // The mapping itself never sees "maximized" -- a bigger box is more
1802+ // resolution because the same 0..1 fraction now spans more pixels, not
1803+ // because the fraction itself moved.
1804+ assert_eq!(eq_x(1000.), eq_x(1000.));
1805+ assert_eq!(eq_y(0.), eq_y(0.));
1806+}
1807+
1808+/// The regression the previous test could not see: `eq_card_w`/`eq_graph_h`
1809+/// growing with `maximized` proved nothing about where the box that receives
1810+/// those numbers actually sits. It sat inside `dock_stance.rs`'s
1811+/// "dock-clip-rows" -- a ~280-390px, less-than-window-tall strip -- and an
1812+/// absolutely-positioned child is sized against its own *immediate* parent
1813+/// regardless of any `.relative()` marker upstream, so `below_picture_floor`
1814+/// (a window-space y) landed inside that short box and shoved the card to a
1815+/// ~120px sliver at the bottom. Every one of `eq_card_w`/`card_max_w`'s own
1816+/// unit tests stayed green throughout, because none of them knew a
1817+/// containing box existed at all -- the same class of gap as `canvas()`
1818+/// silently rendering black under a `Block` parent.
1819+///
1820+/// This binary has no `TestAppContext` to mount `dock_stance::clip_tab` /
1821+/// `ui::stance::render` for real and read painted rects back, so it cannot
1822+/// see the div nesting itself -- only driving the app and screenshotting it
1823+/// proves the fix actually lands on screen (this is that admission, not a
1824+/// substitute for it). What this test *can* pin down in pure values is the
1825+/// room each mount site is fed after the fix: [`dock_stance`]'s un-maximized
1826+/// mount is handed the dock's own real width (not the window's, the "480 in
1827+/// 280" shape of the width-clip bug), and a maximized card is handed
1828+/// `stance-centre`'s width -- the window minus the spine and the dock it
1829+/// escaped -- which must come out *larger*, not smaller, than the docked
1830+/// room it replaces. A future change that re-nests the maximize mount back
1831+/// inside the dock, or hands it the dock's width again, fails this.
1832+#[test]
1833+fn a_maximized_cards_room_is_bigger_than_the_docked_rooms_not_smaller() {
1834+ use crate::layout::{Split, split_size};
1835+ use crate::SPLIT_W;
1836+
1837+ // Mirrors `ui/stance.rs`'s private `SPINE_W` (56.) and `layout::SPLIT_W`
1838+ // (the one divider between `stance-centre` and the dock): recomputed
1839+ // rather than imported, same as this test file's other private-constant
1840+ // checks, so a change to either number is felt here too.
1841+ const SPINE_W: f32 = 56.;
1842+
1843+ for window_w in [960., 1280., 1920.] {
1844+ let window = size(px(window_w), px(720.));
1845+ // `split_size`'s own default/floor/ceiling for the dock, with no
1846+ // hand having dragged the seam -- the exact width `dock_stance.rs`
1847+ // now feeds its un-maximized cards as their "room".
1848+ let dock_w = split_size(Split::Dock, None, 2, window, false);
1849+ let docked_room_w = dock_w;
1850+ let maximized_room_w = window_w - SPINE_W - SPLIT_W - dock_w;
1851+
1852+ assert!(
1853+ maximized_room_w > docked_room_w,
1854+ "at a {window_w}px window a maximized card's room ({maximized_room_w}px, \
1855+ stance-centre) is not wider than the docked room it escaped \
1856+ ({docked_room_w}px, dock-clip-rows) -- maximize would be making \
1857+ the card smaller again"
1858+ );
1859+ assert!(
1860+ maximized_room_w <= window_w,
1861+ "a maximized card's room ({maximized_room_w}px) exceeds the whole \
1862+ window ({window_w}px) -- it is being measured in the wrong space"
1863+ );
1864+ // The concrete pixel gain a driving agent should actually see: the
1865+ // EQ graph's own width formula, fed each mount's real room.
1866+ assert!(
1867+ eq_card_w(maximized_room_w, true) > eq_card_w(docked_room_w, false),
1868+ "maximizing the EQ card at a {window_w}px window does not grow \
1869+ eq_card_w's output"
1870+ );
1871+ }
1872+}
1873+
1874+/// DESIGN's "a maximized scrim covers only the bench/ledger/time-band band,
1875+/// never the picture": the floor a maximized card's `.top()` is pinned to
1876+/// must leave exactly the picture's own height above it, for any bench
1877+/// height a hand has dragged the seam to -- not just the untouched
1878+/// `BENCH_H` default. `below_picture_floor` takes the live bench height as
1879+/// its own second argument (the seam feature merged onto this branch), so
1880+/// this checks the real two-argument signature rather than a stale one-arg
1881+/// assumption.
1882+#[test]
1883+fn a_maximized_card_can_never_rise_above_the_picture_no_matter_the_bench_height() {
1884+ use crate::ui::stance::{LEDGER_H, TIME_BAND_H, below_picture_floor};
1885+ let viewport_h = 1080.;
1886+ for bench_h in [140., 200., 400.] {
1887+ assert_eq!(
1888+ below_picture_floor(viewport_h, bench_h) + TIME_BAND_H + bench_h + LEDGER_H,
1889+ viewport_h,
1890+ "below_picture_floor's floor plus the band below the picture no \
1891+ longer adds back up to the window -- a maximized scrim could rise \
1892+ into the picture"
1893+ );
1894+ }
1895+ // A bench dragged tall enough to eat the whole window still clamps at
1896+ // zero rather than going negative and reporting free room that is not
1897+ // there.
1898+ assert_eq!(below_picture_floor(300., 5000.), 0.);
1899+}
1900+
1901+/// The maximize flag's own small round trip (`dock_stance.rs`'s own doc
1902+/// comment: "the same small-file round trip as the dock tab pick", "a room
1903+/// reopens exactly as left"): saved, read back, and silently defaulted to
1904+/// `false` on a corrupt or absent file -- never a startup crash or notice
1905+/// over the user's own work, the same rule `load_subtitle_style`'s own test
1906+/// (`tests/media.rs`) already pins for its sibling config file. `XDG_CONFIG_HOME`
1907+/// is the existing scratch-path override every config-round-trip test in
1908+/// this crate already uses; there is no maximize-specific override to
1909+/// invent.
1910+#[test]
1911+fn a_maximized_card_reopens_exactly_as_left_across_a_restart() {
1912+ let dir = std::env::temp_dir().join(format!(
1913+ "edith-test-maximized-{}-{}",
1914+ std::process::id(),
1915+ std::time::SystemTime::now()
1916+ .duration_since(std::time::UNIX_EPOCH)
1917+ .unwrap()
1918+ .as_nanos()
1919+ ));
1920+ std::fs::create_dir_all(&dir).unwrap();
1921+ // Scoped to this test alone, the same reasoning `tests/media.rs`'s own
1922+ // XDG_CONFIG_HOME mutation gives: nothing else reads this file.
1923+ unsafe { std::env::set_var("XDG_CONFIG_HOME", &dir) };
1924+
1925+ // Nothing written yet: the default (not maximized), not a crash on a
1926+ // missing file.
1927+ assert_eq!(crate::ui::dock_stance::load_maximized(), false);
1928+
1929+ crate::ui::dock_stance::save_maximized(true);
1930+ assert_eq!(crate::ui::dock_stance::load_maximized(), true);
1931+
1932+ crate::ui::dock_stance::save_maximized(false);
1933+ assert_eq!(crate::ui::dock_stance::load_maximized(), false);
1934+
1935+ // A file from a future/corrupt version leaves the default in force
1936+ // rather than failing the room that opens over it.
1937+ std::fs::write(crate::ui::dock_stance::maximized_config_path(), "not a bool\n").unwrap();
1938+ assert_eq!(crate::ui::dock_stance::load_maximized(), false);
1939+
1940+ unsafe { std::env::remove_var("XDG_CONFIG_HOME") };
1941+ std::fs::remove_dir_all(&dir).ok();
1942+}
crates/app/src/tests/mod.rsmodified+2 -1
@@ -24,7 +24,8 @@ use super::{
24 Transport, VOLUME_W, Volume, WAVE_BPS, WAVE_COL, WAVE_COLS_MAX, Wave, band_label,24 Transport, VOLUME_W, Volume, WAVE_BPS, WAVE_COL, WAVE_COLS_MAX, Wave, band_label,
25 bitrate_detail, bitrate_refusal, can_add, cancels_export, clipboard_after_remove, color_snap, commit_mbps,25 bitrate_detail, bitrate_refusal, can_add, cancels_export, clipboard_after_remove, color_snap, commit_mbps,
26 containers,26 containers,
27- enable, envelope, eq_card_w, eq_freq, eq_freq_label, eq_spectrum, eq_x, eq_y,27+ enable, envelope, eq_card_w, eq_freq, eq_freq_label, eq_graph_h, eq_spectrum, eq_x, eq_y,
28+ EQ_GRAPH_MAX_H,
28 escape_leaves_player_fullscreen,29 escape_leaves_player_fullscreen,
29 estimated_bytes, export_path, export_settings, format_key,30 estimated_bytes, export_path, export_settings, format_key,
30 format_line, format_refusal, fps_choices, fps_label, frac_along, frac_down, frame_at,31 format_line, format_refusal, fps_choices, fps_label, frac_along, frac_down, frame_at,
crates/app/src/ui/cards.rsmodified+134 -42
@@ -51,13 +51,62 @@ fn dark_row_value(text: impl Into<SharedString>) -> Div {
51 /// directly); now it rides a `?` glyph beside the head and only shows on51 /// directly); now it rides a `?` glyph beside the head and only shows on
52 /// hover, the same hover-only convention [`dock_stance::ghost_verb`]52 /// hover, the same hover-only convention [`dock_stance::ghost_verb`]
53 /// already uses for a verb's own description.53 /// already uses for a verb's own description.
54-fn dark_card_head(verb: &str, meta: Option<SharedString>, help: Option<SharedString>) -> Div {54+/// `maximize` is `None` for the one card this head builds that is not one of
55+/// the seven param cards (the export progress sheet): everything else passes
56+/// `Some(self.card_maximized)` and gets the affordance this session's
57+/// complaint asked for -- worn on the head (DESIGN.md:91's "chord is worn"),
58+/// so it never was a keyboard-only option (the repeated "some options are
59+/// only reachable via keyboard shortcut" complaint). A double-click anywhere
60+/// on the head does the same thing the glyph's click and the `m` chord do
61+/// ([`Player::toggle_maximize`]) -- mouse and key reach the same switch.
62+// `+ use<>` (edition 2024 precise capturing): without it, the elided
63+// lifetime on `cx` would be captured into the returned opaque type by
64+// default, so a hoisted `let head = dark.then(|| dark_card_head(..., cx));`
65+// would keep `cx` borrowed until `head` is finally consumed -- fighting
66+// every other `cx.listener(...)` call built in between, which is exactly
67+// the E0500/E0501 chain this card's own hoist is here to avoid.
68+fn dark_card_head(
69+ verb: &str,
70+ meta: Option<SharedString>,
71+ help: Option<SharedString>,
72+ maximize: Option<bool>,
73+ cx: &mut Context<Player>,
74+) -> impl IntoElement + use<> {
55 div()75 div()
76+ .id("card-head")
56 .flex_none()77 .flex_none()
57 .px(px(6.))78 .px(px(6.))
58 .flex()79 .flex()
59 .items_baseline()80 .items_baseline()
60 .gap(px(6.))81 .gap(px(6.))
82+ .when(maximize.is_some(), |d| {
83+ d.on_mouse_down(
84+ MouseButton::Left,
85+ cx.listener(|this, event: &MouseDownEvent, _, cx| {
86+ if event.click_count >= 2 {
87+ this.toggle_maximize();
88+ cx.notify();
89+ }
90+ }),
91+ )
92+ })
93+ .children(maximize.map(|max| {
94+ div()
95+ .id("card-head-maximize")
96+ .flex_none()
97+ .cursor_pointer()
98+ .type_style(type_scale::mono(type_scale::CHORD_METADATA_MAX_PX, gpui::FontWeight::MEDIUM))
99+ .text_color(rgb(INK3()))
100+ .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
101+ this.toggle_maximize();
102+ cx.notify();
103+ }))
104+ .tooltip(move |_, cx| {
105+ cx.new(|_| OverlayTip(if max { "m -- back to the room".into() } else { "m -- fills the room".into() }))
106+ .into()
107+ })
108+ .child(if max { "▣ m" } else { "⤢ m" })
109+ }))
61 .child(110 .child(
62 div()111 div()
63 .type_style(type_scale::head())112 .type_style(type_scale::head())
@@ -1094,7 +1143,7 @@ impl Player {
1094 .rounded(px(6.))1143 .rounded(px(6.))
1095 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))1144 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))
1096 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))1145 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))
1097- .when(dark, |d| d.child(dark_card_head("Exporting", None, None)))1146+ .when(dark, |d| d.child(dark_card_head("Exporting", None, None, None, cx)))
1098 .when(!dark, |d| d.child(div().flex_none().px(px(6.)).child("Exporting")))1147 .when(!dark, |d| d.child(div().flex_none().px(px(6.)).child("Exporting")))
1099 // The bar itself: the same number as the percentage1148 // The bar itself: the same number as the percentage
1100 // below it, and it only ever moves forward -- the1149 // below it, and it only ever moves forward -- the
@@ -1328,14 +1377,24 @@ impl Player {
1328 }))1377 }))
1329 })1378 })
1330 .collect();1379 .collect();
1380+ // Maximized used to claim a fixed 320 px slice for the graph
1381+ // regardless of how much room a small bench actually left the card,
1382+ // so the numbers/buttons rows below it were the ones squeezed into a
1383+ // scroll -- docked, at the same bench, showed all of them with no
1384+ // scroll at all. `flex_1` between the docked floor and the maximized
1385+ // ceiling lets the graph take whatever is *actually* left after the
1386+ // rows below it claim their own natural height first, the same
1387+ // leftover-space idiom `dock_stance::dock_sources` already uses for
1388+ // its own scroll region.
1389+ let graph_maximized = dark && self.card_maximized;
1331 let graph = div()1390 let graph = div()
1332 // Ided like the band rows it replaces: what the pointer presses on1391 // Ided like the band rows it replaces: what the pointer presses on
1333 // is one element with its own hitbox, which is what a drag is1392 // is one element with its own hitbox, which is what a drag is
1334 // tracked from.1393 // tracked from.
1335 .id("eq-graph")1394 .id("eq-graph")
1336 .relative()1395 .relative()
1337- .flex_none()1396+ .when(graph_maximized, |d| d.flex_1().min_h(px(EQ_GRAPH_H)).max_h(px(EQ_GRAPH_MAX_H)))
1338- .h(px(EQ_GRAPH_H))1397+ .when(!graph_maximized, |d| d.flex_none().h(px(eq_graph_h(false))))
1339 .rounded(px(3.))1398 .rounded(px(3.))
1340 .bg(rgb(if dark { DARK_HAIRLINE() } else { BG_HOVER_DIM() }))1399 .bg(rgb(if dark { DARK_HAIRLINE() } else { BG_HOVER_DIM() }))
1341 .cursor_pointer()1400 .cursor_pointer()
@@ -1414,16 +1473,31 @@ impl Player {
1414 )1473 )
1415 .child(eq_curve(self.eq_params.clone(), sample_rate))1474 .child(eq_curve(self.eq_params.clone(), sample_rate))
1416 .children(handles)1475 .children(handles)
1417- .children(EQ_TICKS.map(|(freq, label)| {1476+ .children(EQ_TICKS.iter().enumerate().map(|(i, (freq, label))| {
1418- div()1477+ // Centred on its own frequency for the three inner ticks --
1419- .absolute()1478+ // pulled back by half its own width, as the comment above
1420- .left(relative(eq_x(freq)))1479+ // used to say for all five. The two ends used the same
1421- // Pulled back so the mark reads as sitting *at* its1480+ // centring and, sitting at 0%/100% of the axis, hung half
1422- // frequency; the two ends then hug the corners.1481+ // their own label off the graph's edge: "20 Hz" clipped to a
1423- .ml(px(-12.))1482+ // bare "z", "20k" lost its "k" and half its trailing "0".
1424- .bottom(px(1.))1483+ // Anchored to the graph's own edge instead and read inward,
1425- .w(px(24.))1484+ // both now sit wholly inside the plot they label.
1426- .text_align(TextAlign::Center)1485+ // The end boxes are widened to their own label at the size
1486+ // they draw at (`eq_tick_end_w`), not just anchored -- an
1487+ // anchor alone still let "20 Hz" wrap onto two lines inside
1488+ // a box narrower than the text. `.whitespace_nowrap()` is
1489+ // the platform's own backstop, so a mis-measured box clips
1490+ // or overhangs instead of silently wrapping again.
1491+ let end_px = if dark { type_scale::CHORD_METADATA_MIN_PX } else { 9. };
1492+ let div = div().absolute().bottom(px(1.)).whitespace_nowrap();
1493+ let div = if i == 0 {
1494+ div.w(px(eq_tick_end_w(label, end_px))).left(px(0.)).text_align(TextAlign::Left)
1495+ } else if i == EQ_TICKS.len() - 1 {
1496+ div.w(px(eq_tick_end_w(label, end_px))).right(px(0.)).text_align(TextAlign::Right)
1497+ } else {
1498+ div.w(px(24.)).left(relative(eq_x(*freq))).ml(px(-12.)).text_align(TextAlign::Center)
1499+ };
1500+ div
1427 .when(dark, |d| {1501 .when(dark, |d| {
1428 d.type_style(type_scale::mono(1502 d.type_style(type_scale::mono(
1429 type_scale::CHORD_METADATA_MIN_PX,1503 type_scale::CHORD_METADATA_MIN_PX,
@@ -1432,7 +1506,7 @@ impl Player {
1432 .text_color(rgb(INK3()))1506 .text_color(rgb(INK3()))
1433 })1507 })
1434 .when(!dark, |d| d.text_size(px(9.)).text_color(rgb(FG_SECONDARY())))1508 .when(!dark, |d| d.text_size(px(9.)).text_color(rgb(FG_SECONDARY())))
1435- .child(label)1509+ .child(*label)
1436 }))1510 }))
1437 .child(1511 .child(
1438 div()1512 div()
@@ -1468,6 +1542,7 @@ impl Player {
1468 .justify_center()1542 .justify_center()
1469 .items_center()1543 .items_center()
1470 .bg(rgba(SCRIM()))1544 .bg(rgba(SCRIM()))
1545+ .when(self.card_maximized, |d| d.top(px(crate::ui::stance::maximized_card_top(f32::from(viewport.height), self.split_px(Split::Bench, viewport)))))
1471 // Click away closes it, as on every card here.1546 // Click away closes it, as on every card here.
1472 .on_mouse_down(1547 .on_mouse_down(
1473 MouseButton::Left,1548 MouseButton::Left,
@@ -1486,13 +1561,18 @@ impl Player {
1486 // of the window. The two cards beside it are built this1561 // of the window. The two cards beside it are built this
1487 // way for the same reason.1562 // way for the same reason.
1488 .w_full()1563 .w_full()
1489- .max_w(px(eq_card_w(f32::from(viewport.width))))1564+ .max_w(px(eq_card_w(f32::from(viewport.width), self.card_maximized)))
1490 // And a cap the other way, for the same reason the width1565 // And a cap the other way, for the same reason the width
1491 // has one: the card is docked in a column now, and at the1566 // has one: the card is docked in a column now, and at the
1492 // 360 px floor it is taller than that column -- its title1567 // 360 px floor it is taller than that column -- its title
1493 // ran off the top and its buttons off the bottom, with1568 // ran off the top and its buttons off the bottom, with
1494 // neither reachable. Capped here, scrolled below.1569 // neither reachable. Capped here, scrolled below.
1495 .max_h(relative(1.))1570 .max_h(relative(1.))
1571+ // Maximized also *claims* the room the cap above
1572+ // only allows: `flex_1()`/`max_h` on the graph below
1573+ // has nothing to grow into if the card itself still
1574+ // hugs its own content height.
1575+ .when(graph_maximized, |d| d.h(relative(1.)))
1496 .on_mouse_down(MouseButton::Left, swallow)1576 .on_mouse_down(MouseButton::Left, swallow)
1497 .flex()1577 .flex()
1498 .flex_col()1578 .flex_col()
@@ -1508,6 +1588,12 @@ impl Player {
1508 // makes the cap above a scroll rather than a1588 // makes the cap above a scroll rather than a
1509 // clip; the rows themselves keep their heights.1589 // clip; the rows themselves keep their heights.
1510 .min_h(px(0.))1590 .min_h(px(0.))
1591+ // Maximized: stretch to the room the card
1592+ // above now claims, so the graph's own
1593+ // `flex_1` (above) has the leftover space to
1594+ // grow into instead of the card just hugging
1595+ // its content and leaving none.
1596+ .when(graph_maximized, |d| d.flex_1())
1511 .overflow_y_scroll()1597 .overflow_y_scroll()
1512 .track_scroll(&self.eq_scroll)1598 .track_scroll(&self.eq_scroll)
1513 .flex()1599 .flex()
@@ -1519,7 +1605,9 @@ impl Player {
1519 d.child(dark_card_head(1605 d.child(dark_card_head(
1520 "Equalizer",1606 "Equalizer",
1521 Some(format!("{} clip {}", lane.label(), idx + 1).into()),1607 Some(format!("{} clip {}", lane.label(), idx + 1).into()),
1522- Some("drag a handle, or a digit picks a band — ←→ moves it, ↑↓ its gain, shift+←→ its width; a adds, x removes, f flattens it, r all, s spectrum; a click away or esc closes".into()),1608+ Some("drag a handle, or a digit picks a band — ←→ moves it, ↑↓ its gain, shift+←→ its width; a adds, x removes, f flattens it, r all, s spectrum, m fills the room; a click away or esc closes".into()),
1609+ Some(self.card_maximized),
1610+ cx,
1523 ))1611 ))
1524 })1612 })
1525 .when(!dark, |d| {1613 .when(!dark, |d| {
@@ -1871,7 +1959,7 @@ impl Player {
1871 /// the decoder is grading with, never a copy that could drift from it. The1959 /// the decoder is grading with, never a copy that could drift from it. The
1872 /// graph above them is counted off the frame that came *back* through that1960 /// graph above them is counted off the frame that came *back* through that
1873 /// grade ([`histogram`]), so pulling exposure tilts it while the hand moves.1961 /// grade ([`histogram`]), so pulling exposure tilts it while the hand moves.
1874- pub(crate) fn color_card(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> {1962+ pub(crate) fn color_card(&self, viewport: Size<Pixels>, cx: &mut Context<Self>) -> Option<impl IntoElement> {
1875 let (lane, idx) = self.color_open?;1963 let (lane, idx) = self.color_open?;
1876 let params = self.color_params();1964 let params = self.color_params();
1877 let dark = self.darkroom;1965 let dark = self.darkroom;
@@ -1970,6 +2058,7 @@ impl Player {
1970 .justify_center()2058 .justify_center()
1971 .items_center()2059 .items_center()
1972 .bg(rgba(SCRIM()))2060 .bg(rgba(SCRIM()))
2061+ .when(self.card_maximized, |d| d.top(px(crate::ui::stance::maximized_card_top(f32::from(viewport.height), self.split_px(Split::Bench, viewport)))))
1973 // Click away closes it, as on every card here.2062 // Click away closes it, as on every card here.
1974 .on_mouse_down(2063 .on_mouse_down(
1975 MouseButton::Left,2064 MouseButton::Left,
@@ -1982,7 +2071,7 @@ impl Player {
1982 .child(2071 .child(
1983 div()2072 div()
1984 .w_full()2073 .w_full()
1985- .max_w(px(COLOR_W))2074+ .max_w(px(card_max_w(COLOR_W, self.card_maximized, f32::from(viewport.width))))
1986 .on_mouse_down(MouseButton::Left, swallow)2075 .on_mouse_down(MouseButton::Left, swallow)
1987 .flex()2076 .flex()
1988 .flex_col()2077 .flex_col()
@@ -1992,7 +2081,7 @@ impl Player {
1992 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))2081 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))
1993 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))2082 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))
1994 .when(dark, |d| {2083 .when(dark, |d| {
1995- d.child(dark_card_head("Colour", Some(head_meta.clone()), Some(help_text.into())))2084+ d.child(dark_card_head("Colour", Some(head_meta.clone()), Some(help_text.into()), Some(self.card_maximized), cx))
1996 })2085 })
1997 .when(!dark, |d| {2086 .when(!dark, |d| {
1998 d.child(div().flex_none().px(px(6.)).child(format!(2087 d.child(div().flex_none().px(px(6.)).child(format!(
@@ -2062,7 +2151,7 @@ impl Player {
2062 /// The transform card: [`color_card`](Self::color_card)'s own shape, one2151 /// The transform card: [`color_card`](Self::color_card)'s own shape, one
2063 /// row per [`TRANSFORM_BANDS`] entry instead of four, and no histogram --2152 /// row per [`TRANSFORM_BANDS`] entry instead of four, and no histogram --
2064 /// there is nothing here a graded frame would tilt.2153 /// there is nothing here a graded frame would tilt.
2065- pub(crate) fn transform_card(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> {2154+ pub(crate) fn transform_card(&self, viewport: Size<Pixels>, cx: &mut Context<Self>) -> Option<impl IntoElement> {
2066 let (lane, idx) = self.transform_open?;2155 let (lane, idx) = self.transform_open?;
2067 let params = self.transform_params();2156 let params = self.transform_params();
2068 let dark = self.darkroom;2157 let dark = self.darkroom;
@@ -2152,6 +2241,7 @@ impl Player {
2152 .justify_center()2241 .justify_center()
2153 .items_center()2242 .items_center()
2154 .bg(rgba(SCRIM()))2243 .bg(rgba(SCRIM()))
2244+ .when(self.card_maximized, |d| d.top(px(crate::ui::stance::maximized_card_top(f32::from(viewport.height), self.split_px(Split::Bench, viewport)))))
2155 .on_mouse_down(2245 .on_mouse_down(
2156 MouseButton::Left,2246 MouseButton::Left,
2157 cx.listener(|this, _: &MouseDownEvent, _, cx| {2247 cx.listener(|this, _: &MouseDownEvent, _, cx| {
@@ -2163,7 +2253,7 @@ impl Player {
2163 .child(2253 .child(
2164 div()2254 div()
2165 .w_full()2255 .w_full()
2166- .max_w(px(TRANSFORM_W))2256+ .max_w(px(card_max_w(TRANSFORM_W, self.card_maximized, f32::from(viewport.width))))
2167 .on_mouse_down(MouseButton::Left, swallow)2257 .on_mouse_down(MouseButton::Left, swallow)
2168 .flex()2258 .flex()
2169 .flex_col()2259 .flex_col()
@@ -2173,7 +2263,7 @@ impl Player {
2173 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))2263 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))
2174 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))2264 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))
2175 .when(dark, |d| {2265 .when(dark, |d| {
2176- d.child(dark_card_head("Transform", Some(head_meta.clone()), Some(help_text.into())))2266+ d.child(dark_card_head("Transform", Some(head_meta.clone()), Some(help_text.into()), Some(self.card_maximized), cx))
2177 })2267 })
2178 .when(!dark, |d| {2268 .when(!dark, |d| {
2179 d.child(div().flex_none().px(px(6.)).child(format!(2269 d.child(div().flex_none().px(px(6.)).child(format!(
@@ -2236,7 +2326,7 @@ impl Player {
2236 ///2326 ///
2237 /// Honest about what it does: the sound is *resampled*, so the pitch goes up2327 /// Honest about what it does: the sound is *resampled*, so the pitch goes up
2238 /// with the rate, which is what the tape in the title means.2328 /// with the rate, which is what the tape in the title means.
2239- pub(crate) fn speed_card(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> {2329+ pub(crate) fn speed_card(&self, viewport: Size<Pixels>, cx: &mut Context<Self>) -> Option<impl IntoElement> {
2240 let (lane, idx) = self.speed_open?;2330 let (lane, idx) = self.speed_open?;
2241 let speed = self.card_speed();2331 let speed = self.card_speed();
2242 let session = self.session.as_ref()?;2332 let session = self.session.as_ref()?;
@@ -2290,6 +2380,7 @@ impl Player {
2290 .justify_center()2380 .justify_center()
2291 .items_center()2381 .items_center()
2292 .bg(rgba(SCRIM()))2382 .bg(rgba(SCRIM()))
2383+ .when(self.card_maximized, |d| d.top(px(crate::ui::stance::maximized_card_top(f32::from(viewport.height), self.split_px(Split::Bench, viewport)))))
2293 // Click away closes it, as on every card here.2384 // Click away closes it, as on every card here.
2294 .on_mouse_down(2385 .on_mouse_down(
2295 MouseButton::Left,2386 MouseButton::Left,
@@ -2302,7 +2393,7 @@ impl Player {
2302 .child(2393 .child(
2303 div()2394 div()
2304 .w_full()2395 .w_full()
2305- .max_w(px(COLOR_W))2396+ .max_w(px(card_max_w(COLOR_W, self.card_maximized, f32::from(viewport.width))))
2306 .on_mouse_down(MouseButton::Left, swallow)2397 .on_mouse_down(MouseButton::Left, swallow)
2307 .flex()2398 .flex()
2308 .flex_col()2399 .flex_col()
@@ -2312,7 +2403,7 @@ impl Player {
2312 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))2403 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))
2313 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))2404 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))
2314 .when(dark, |d| {2405 .when(dark, |d| {
2315- d.child(dark_card_head("Speed (tape)", Some(head_meta.clone()), Some(help_text.into())))2406+ d.child(dark_card_head("Speed (tape)", Some(head_meta.clone()), Some(help_text.into()), Some(self.card_maximized), cx))
2316 })2407 })
2317 .when(!dark, |d| {2408 .when(!dark, |d| {
2318 d.child(div().flex_none().px(px(6.)).child(format!(2409 d.child(div().flex_none().px(px(6.)).child(format!(
@@ -2401,7 +2492,7 @@ impl Player {
2401 /// move it too. The rows scroll rather than the card growing past the2492 /// move it too. The rows scroll rather than the card growing past the
2402 /// window -- a timeline may hold more tracks than a 360 px window has room2493 /// window -- a timeline may hold more tracks than a 360 px window has room
2403 /// for faders.2494 /// for faders.
2404- pub(crate) fn mix_card(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> {2495+ pub(crate) fn mix_card(&self, viewport: Size<Pixels>, cx: &mut Context<Self>) -> Option<impl IntoElement> {
2405 if !self.mix_open {2496 if !self.mix_open {
2406 return None;2497 return None;
2407 }2498 }
@@ -2523,6 +2614,7 @@ impl Player {
2523 .justify_center()2614 .justify_center()
2524 .items_center()2615 .items_center()
2525 .bg(rgba(SCRIM()))2616 .bg(rgba(SCRIM()))
2617+ .when(self.card_maximized, |d| d.top(px(crate::ui::stance::maximized_card_top(f32::from(viewport.height), self.split_px(Split::Bench, viewport)))))
2526 // Click away closes it, as on every card here.2618 // Click away closes it, as on every card here.
2527 .on_mouse_down(2619 .on_mouse_down(
2528 MouseButton::Left,2620 MouseButton::Left,
@@ -2535,7 +2627,7 @@ impl Player {
2535 .child(2627 .child(
2536 div()2628 div()
2537 .w_full()2629 .w_full()
2538- .max_w(px(COLOR_W))2630+ .max_w(px(card_max_w(COLOR_W, self.card_maximized, f32::from(viewport.width))))
2539 .on_mouse_down(MouseButton::Left, swallow)2631 .on_mouse_down(MouseButton::Left, swallow)
2540 .max_h(px(360. - 24.))2632 .max_h(px(360. - 24.))
2541 .flex()2633 .flex()
@@ -2545,7 +2637,7 @@ impl Player {
2545 .rounded(px(6.))2637 .rounded(px(6.))
2546 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))2638 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))
2547 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))2639 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))
2548- .when(dark, |d| d.child(dark_card_head("Mix", None, Some(help_text.into()))))2640+ .when(dark, |d| d.child(dark_card_head("Mix", None, Some(help_text.into()), Some(self.card_maximized), cx)))
2549 .when(!dark, |d| {2641 .when(!dark, |d| {
2550 d.child(2642 d.child(
2551 div()2643 div()
@@ -2598,11 +2690,13 @@ impl Player {
2598 /// card's shape for the same reason: app-global, kept in a file beside2690 /// card's shape for the same reason: app-global, kept in a file beside
2599 /// the theme, and drawn straight off `self.sub_text` / `self.sub_family`2691 /// the theme, and drawn straight off `self.sub_text` / `self.sub_family`
2600 /// so a change is on the cue underneath before the card is closed.2692 /// so a change is on the cue underneath before the card is closed.
2601- pub(crate) fn subtitle_style_card(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> {2693+ pub(crate) fn subtitle_style_card(&self, viewport: Size<Pixels>, cx: &mut Context<Self>) -> Option<impl IntoElement> {
2602 if !self.subtitle_style_open {2694 if !self.subtitle_style_open {
2603 return None;2695 return None;
2604 }2696 }
2605 let dark = self.darkroom;2697 let dark = self.darkroom;
2698+ let help_text = "− and + move the size, or ↑↓ picks a row and ←→ moves it (held or pressed); a family row picks it outright — a click away or esc closes";
2699+ let head = dark.then(|| dark_card_head("Subtitle style", None, Some(help_text.into()), Some(self.card_maximized), cx));
2606 let size_picked = self.subtitle_style_field == 0;2700 let size_picked = self.subtitle_style_field == 0;
2607 let size_row = div()2701 let size_row = div()
2608 .id("subtitle-size-row")2702 .id("subtitle-size-row")
@@ -2720,13 +2814,13 @@ impl Player {
2720 .when(dark, |d| d.child(dark_row_label(name.clone(), picked)))2814 .when(dark, |d| d.child(dark_row_label(name.clone(), picked)))
2721 .when(!dark, |d| d.child(name.clone()))2815 .when(!dark, |d| d.child(name.clone()))
2722 });2816 });
2723- let help_text = "− and + move the size, or ↑↓ picks a row and ←→ moves it (held or pressed); a family row picks it outright — a click away or esc closes";
2724 Some(2817 Some(
2725 scrim()2818 scrim()
2726 .flex()2819 .flex()
2727 .justify_center()2820 .justify_center()
2728 .items_center()2821 .items_center()
2729 .bg(rgba(SCRIM()))2822 .bg(rgba(SCRIM()))
2823+ .when(self.card_maximized, |d| d.top(px(crate::ui::stance::maximized_card_top(f32::from(viewport.height), self.split_px(Split::Bench, viewport)))))
2730 .on_mouse_down(2824 .on_mouse_down(
2731 MouseButton::Left,2825 MouseButton::Left,
2732 cx.listener(|this, _: &MouseDownEvent, _, cx| {2826 cx.listener(|this, _: &MouseDownEvent, _, cx| {
@@ -2738,7 +2832,7 @@ impl Player {
2738 .child(2832 .child(
2739 div()2833 div()
2740 .w_full()2834 .w_full()
2741- .max_w(px(COLOR_W))2835+ .max_w(px(card_max_w(COLOR_W, self.card_maximized, f32::from(viewport.width))))
2742 .on_mouse_down(MouseButton::Left, swallow)2836 .on_mouse_down(MouseButton::Left, swallow)
2743 .max_h(px(360. - 24.))2837 .max_h(px(360. - 24.))
2744 .flex()2838 .flex()
@@ -2748,9 +2842,7 @@ impl Player {
2748 .rounded(px(6.))2842 .rounded(px(6.))
2749 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))2843 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))
2750 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))2844 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))
2751- .when(dark, |d| {2845+ .when(dark, move |d| d.child(head.unwrap()))
2752- d.child(dark_card_head("Subtitle style", None, Some(help_text.into())))
2753- })
2754 .when(!dark, |d| {2846 .when(!dark, |d| {
2755 d.child(2847 d.child(
2756 div()2848 div()
@@ -2791,9 +2883,12 @@ impl Player {
2791 /// *about* the timeline -- the marks under it are the whole preview -- so2883 /// *about* the timeline -- the marks under it are the whole preview -- so
2792 /// the bed stays readable and the card sits up in the picture area rather2884 /// the bed stays readable and the card sits up in the picture area rather
2793 /// than over the lanes.2885 /// than over the lanes.
2794- pub(crate) fn silence_card(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> {2886+ pub(crate) fn silence_card(&self, viewport: Size<Pixels>, cx: &mut Context<Self>) -> Option<impl IntoElement> {
2795 let (lane, idx) = self.silence_open?;2887 let (lane, idx) = self.silence_open?;
2796 let dark = self.darkroom;2888 let dark = self.darkroom;
2889+ let head_meta: SharedString = format!("{} clip {}", lane.label(), idx + 1).into();
2890+ let help_text = "− and + move a setting, or ↑↓ picks one and ←→ moves it (hold to run it) — the marks on the lane are what would go; a click away or esc closes";
2891+ let head = dark.then(|| dark_card_head("Silences", Some(head_meta.clone()), Some(help_text.into()), Some(self.card_maximized), cx));
2797 let cfg = self.silence;2892 let cfg = self.silence;
2798 // The unit is a label, never a conversion: the threshold is a level2893 // The unit is a label, never a conversion: the threshold is a level
2799 // below full scale whichever of the two the row says (`silence_dbfs`).2894 // below full scale whichever of the two the row says (`silence_dbfs`).
@@ -2960,8 +3055,6 @@ impl Player {
2960 .into_any_element(),3055 .into_any_element(),
2961 }3056 }
2962 };3057 };
2963- let head_meta: SharedString = format!("{} clip {}", lane.label(), idx + 1).into();
2964- let help_text = "− and + move a setting, or ↑↓ picks one and ←→ moves it (hold to run it) — the marks on the lane are what would go; a click away or esc closes";
2965 Some(3058 Some(
2966 scrim()3059 scrim()
2967 .flex()3060 .flex()
@@ -2971,6 +3064,7 @@ impl Player {
2971 // Light enough to read the lanes and the marks on them through:3064 // Light enough to read the lanes and the marks on them through:
2972 // the preview is the point of this card.3065 // the preview is the point of this card.
2973 .bg(rgba(SCRIM_LIGHT()))3066 .bg(rgba(SCRIM_LIGHT()))
3067+ .when(self.card_maximized, |d| d.top(px(crate::ui::stance::maximized_card_top(f32::from(viewport.height), self.split_px(Split::Bench, viewport)))))
2974 // Click away closes it, as on every card here -- and the marks3068 // Click away closes it, as on every card here -- and the marks
2975 // go with it, which is what makes this one a call and not a flag.3069 // go with it, which is what makes this one a call and not a flag.
2976 .on_mouse_down(3070 .on_mouse_down(
@@ -2984,7 +3078,7 @@ impl Player {
2984 .child(3078 .child(
2985 div()3079 div()
2986 .w_full()3080 .w_full()
2987- .max_w(px(COLOR_W))3081+ .max_w(px(card_max_w(COLOR_W, self.card_maximized, f32::from(viewport.width))))
2988 .on_mouse_down(MouseButton::Left, swallow)3082 .on_mouse_down(MouseButton::Left, swallow)
2989 .flex()3083 .flex()
2990 .flex_col()3084 .flex_col()
@@ -2993,9 +3087,7 @@ impl Player {
2993 .rounded(px(6.))3087 .rounded(px(6.))
2994 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))3088 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))
2995 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))3089 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))
2996- .when(dark, |d| {3090+ .when(dark, move |d| d.child(head.unwrap()))
2997- d.child(dark_card_head("Silences", Some(head_meta.clone()), Some(help_text.into())))
2998- })
2999 .when(!dark, |d| {3091 .when(!dark, |d| {
3000 d.child(div().flex_none().px(px(6.)).child(format!(3092 d.child(div().flex_none().px(px(6.)).child(format!(
3001 "Silences — {} clip {}",3093 "Silences — {} clip {}",
crates/app/src/ui/dock_stance.rsmodified+61 -17
@@ -44,6 +44,28 @@ fn save(src_active: bool) {
44 let _ = std::fs::write(path, if src_active { "Src\n" } else { "Clip\n" });44 let _ = std::fs::write(path, if src_active { "Src\n" } else { "Clip\n" });
45 }45 }
46 46
47+/// Whether the room's one open param card is maximized -- the same
48+/// small-file round trip as the dock tab pick above, its own word beside it
49+/// ("a room reopens exactly as left", DESIGN.md:135), so a maximized EQ stays
50+/// maximized across a close and reopen of the whole room, not just the card.
51+pub(crate) fn maximized_config_path() -> std::path::PathBuf {
52+ crate::keymap::Keymap::config_path().with_file_name("card-maximized")
53+}
54+
55+pub(crate) fn load_maximized() -> bool {
56+ std::fs::read_to_string(maximized_config_path())
57+ .map(|text| text.trim() == "1")
58+ .unwrap_or(false)
59+}
60+
61+pub(crate) fn save_maximized(maximized: bool) {
62+ let path = maximized_config_path();
63+ if let Some(dir) = path.parent() {
64+ let _ = std::fs::create_dir_all(dir);
65+ }
66+ let _ = std::fs::write(path, if maximized { "1\n" } else { "0\n" });
67+}
68+
47 /// The Sources tab's four sort chips (MOCK-SPEC "Dock" §3). `Recent` is the69 /// The Sources tab's four sort chips (MOCK-SPEC "Dock" §3). `Recent` is the
48 /// library's own arrival order -- the only order this editor tracks without70 /// library's own arrival order -- the only order this editor tracks without
49 /// a fourth field to keep it in.71 /// a fourth field to keep it in.
@@ -502,8 +524,18 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
502 /// these onto. Drag-while-playing and every other gesture on a row is524 /// these onto. Drag-while-playing and every other gesture on a row is
503 /// whatever that card already does; nothing about the gesture is reimplemented525 /// whatever that card already does; nothing about the gesture is reimplemented
504 /// here.526 /// here.
505-fn clip_tab(player: &Player, width: f32, window_h: Pixels, cx: &mut Context<Player>) -> impl IntoElement {527+fn clip_tab(player: &Player, width: f32, window_size: Size<Pixels>, cx: &mut Context<Player>) -> impl IntoElement {
506- let room = size(px(width), window_h);528+ // The room actually given here, not the window's: `eq_card_w`/
529+ // `card_max_w` are asked "how wide may I draw" and answered with the
530+ // *whole viewport's* width when handed `window_size` verbatim -- but this
531+ // tab is a ~280-390px strip inside the dock, not the window, so a card
532+ // capped at up to 720px overflowed past the window's own right edge
533+ // (`20k` rendered as `20`, the `Spectrum on s` button cut mid-glyph).
534+ // Height stays the window's: none of the un-maximized cards' own
535+ // arithmetic uses it (`below_picture_floor` only fires once maximized,
536+ // and a maximized card is mounted at `ui::stance::render` instead, never
537+ // through this `room`).
538+ let room = Size::new(px(width), window_size.height);
507 let none_open = player.eq_open.is_none()539 let none_open = player.eq_open.is_none()
508 && player.color_open.is_none()540 && player.color_open.is_none()
509 && player.transform_open.is_none()541 && player.transform_open.is_none()
@@ -596,19 +628,31 @@ fn clip_tab(player: &Player, width: f32, window_h: Pixels, cx: &mut Context<Play
596 .min_h(px(0.))628 .min_h(px(0.))
597 .px(px(8.))629 .px(px(8.))
598 .pb(px(8.))630 .pb(px(8.))
599- .children(player.eq_card(room, cx))631+ // Maximized is mounted at the window root instead
600- .children(player.color_card(cx))632+ // (`ui::stance::render`'s `stance-centre`), not here: this
601- .children(player.transform_card(cx))633+ // column is a ~280-390px strip, and an absolutely-positioned
602- .children(player.speed_card(cx))634+ // child is sized against its *immediate* parent regardless of
603- .children(player.silence_card(cx))635+ // any `.relative()` marker -- so a maximized card asking for
604- .children(player.mix_card(cx))636+ // window-sized room while still parented here cannot get it,
605- // Subtitle style has no verb row of its own here (see the637+ // it only gets pushed around inside this narrow, short box
606- // comment above the ghost verbs) but its card still has to638+ // (the "maximize shrinks the card" defect). Un-maximized, the
607- // be mounted somewhere in the darkroom or its chord (`y`)639+ // seven cards below stay docked here exactly as before.
608- // opens an invisible modal (GAP 2) -- this is that mount,640+ .when(!player.card_maximized, |d| {
609- // painted in the Clip tab like the six cards beside it until641+ d.children(player.eq_card(room, cx))
610- // the subtitle lane grows the header that is its real home.642+ .children(player.color_card(room, cx))
611- .children(player.subtitle_style_card(cx))643+ .children(player.transform_card(room, cx))
644+ .children(player.speed_card(room, cx))
645+ .children(player.silence_card(room, cx))
646+ .children(player.mix_card(room, cx))
647+ // Subtitle style has no verb row of its own here (see
648+ // the comment above the ghost verbs) but its card
649+ // still has to be mounted somewhere in the darkroom
650+ // or its chord (`y`) opens an invisible modal (GAP
651+ // 2) -- this is that mount, painted in the Clip tab
652+ // like the six cards beside it until the subtitle
653+ // lane grows the header that is its real home.
654+ .children(player.subtitle_style_card(room, cx))
655+ })
612 // A plate, not bare space: DESIGN §11's "states" checklist --656 // A plate, not bare space: DESIGN §11's "states" checklist --
613 // nothing picked reads as a hint, not as a hole in the panel.657 // nothing picked reads as a hint, not as a hole in the panel.
614 .when(none_open, |d| {658 .when(none_open, |d| {
@@ -638,7 +682,7 @@ fn clip_tab(player: &Player, width: f32, window_h: Pixels, cx: &mut Context<Play
638 /// pair). What degrades *inside* fixed width is the two tabs' own content:682 /// pair). What degrades *inside* fixed width is the two tabs' own content:
639 /// Sources scrolls its own row list; Clip's param rows are whatever their683 /// Sources scrolls its own row list; Clip's param rows are whatever their
640 /// card already draws at this width.684 /// card already draws at this width.
641-pub(crate) fn render(player: &Player, width: f32, window_h: Pixels, cx: &mut Context<Player>) -> impl IntoElement {685+pub(crate) fn render(player: &Player, width: f32, window_size: Size<Pixels>, cx: &mut Context<Player>) -> impl IntoElement {
642 let src_active = player.dock_src_active;686 let src_active = player.dock_src_active;
643 div()687 div()
644 .id("stance-dock-body")688 .id("stance-dock-body")
@@ -660,6 +704,6 @@ pub(crate) fn render(player: &Player, width: f32, window_h: Pixels, cx: &mut Con
660 )704 )
661 .child(match src_active {705 .child(match src_active {
662 true => sources_tab(player, cx).into_any_element(),706 true => sources_tab(player, cx).into_any_element(),
663- false => clip_tab(player, width, window_h, cx).into_any_element(),707+ false => clip_tab(player, width, window_size, cx).into_any_element(),
664 })708 })
665 }709 }
crates/app/src/ui/inspector.rsmodified+6 -6
@@ -80,12 +80,12 @@ impl Player {
80 )80 )
81 })81 })
82 .children(self.eq_card(room, cx))82 .children(self.eq_card(room, cx))
83- .children(self.color_card(cx))83+ .children(self.color_card(room, cx))
84- .children(self.transform_card(cx))84+ .children(self.transform_card(room, cx))
85- .children(self.speed_card(cx))85+ .children(self.speed_card(room, cx))
86- .children(self.silence_card(cx))86+ .children(self.silence_card(room, cx))
87- .children(self.mix_card(cx))87+ .children(self.mix_card(room, cx))
88- .children(self.subtitle_style_card(cx))88+ .children(self.subtitle_style_card(room, cx))
89 }89 }
90 90
91 /// What is marked, and the settings that belong to *it*. A dump of every91 /// What is marked, and the settings that belong to *it*. A dump of every
crates/app/src/ui/stance.rsmodified+91 -6
@@ -64,6 +64,27 @@ pub(crate) fn below_picture_floor(viewport_h: f32, bench_h: f32) -> f32 {
64 (viewport_h - TIME_BAND_H - bench_h - LEDGER_H).max(0.)64 (viewport_h - TIME_BAND_H - bench_h - LEDGER_H).max(0.)
65 }65 }
66 66
67+/// The maximized inspector card's own top -- deliberately *not*
68+/// [`below_picture_floor`] fed the live bench straight through, the way
69+/// `menu_floor` above correctly does for a menu. A maximized card is anchored
70+/// to the same floor and grows downward to the window's own bottom edge, so
71+/// its height is `viewport_h - floor` -- exactly the bench/ledger footprint,
72+/// `TIME_BAND_H + bench_h + LEDGER_H`. Feeding the *live* bench in there means
73+/// a hand-dragged bench smaller than [`BENCH_H`] starves the maximized card of
74+/// room: driven at `bench=BENCH_MIN_H` the card shrank to 210px and its curve
75+/// and band handles stopped rendering at all, while the same card *docked*
76+/// (whose height was never bench-shaped to begin with) still drew everything
77+/// -- maximize made the card strictly worse, backwards from what the feature
78+/// promises. Floored at [`BENCH_H`], the bench's own untouched default, the
79+/// maximized card is never smaller than it is at the bench nobody has
80+/// dragged; a bench pulled *larger* than that still grows the card further,
81+/// same as before, and the case actually verified good (card top exactly on
82+/// the picture floor, picture unobstructed) is untouched because it ran at a
83+/// bench already at or above this floor.
84+pub(crate) fn maximized_card_top(viewport_h: f32, bench_h: f32) -> f32 {
85+ below_picture_floor(viewport_h, bench_h.max(BENCH_H))
86+}
87+
67 /// The floor-clamped placement for every scrolling menu (clip context menu,88 /// The floor-clamped placement for every scrolling menu (clip context menu,
68 /// picker, library menu): the anchor pulled down to [`below_picture_floor`]89 /// picker, library menu): the anchor pulled down to [`below_picture_floor`]
69 /// *and* the room its list may fill capped to what is actually left between90 /// *and* the room its list may fill capped to what is actually left between
@@ -119,6 +140,48 @@ mod menu_floor_tests {
119 }140 }
120 }141 }
121 142
143+#[cfg(test)]
144+mod maximized_card_top_tests {
145+ use super::*;
146+
147+ /// The regression D1 shipped as: the old call site fed the *live* bench
148+ /// straight into `below_picture_floor`, so a bench dragged down to
149+ /// `crate::BENCH_MIN_H` (a legal value -- `layout::split_size` clamps
150+ /// anything smaller up to it) gave the maximized card *less* room than
151+ /// docked, not more. This binary has no `TestAppContext`, so it cannot
152+ /// read back a painted rect the way a driven screenshot can -- this is a
153+ /// value-level check of the two formulas the maximize feature is built
154+ /// on, not a substitute for driving the app at the smallest bench. Swept
155+ /// across the *whole* legal bench range (the earlier guard this replaces
156+ /// checked only the untouched default, which is exactly why a small,
157+ /// legal bench slipped through), maximized room must never fall below the
158+ /// room at the bench nobody has dragged, and must never be smaller than
159+ /// what the same live bench leaves for `below_picture_floor`'s own live
160+ /// use (menu placement) -- the two must not tangle back together.
161+ #[test]
162+ fn maximized_room_never_shrinks_below_the_default_bench_across_every_legal_bench_height() {
163+ let viewport = size(px(1280.), px(720.));
164+ let v = f32::from(viewport.height);
165+ let default_room = v - below_picture_floor(v, BENCH_H);
166+ let mut bench_h = crate::BENCH_MIN_H;
167+ while bench_h <= 600. {
168+ let room = v - maximized_card_top(v, bench_h);
169+ assert!(
170+ room >= default_room,
171+ "bench={bench_h}: maximized room {room} fell below the default-bench \
172+ room {default_room}"
173+ );
174+ // Still strictly bigger than a bare `below_picture_floor` room
175+ // would ever have given it below `BENCH_H` -- the coupling this
176+ // fix breaks.
177+ if bench_h < BENCH_H {
178+ assert!(room > v - below_picture_floor(v, bench_h));
179+ }
180+ bench_h += 25.;
181+ }
182+ }
183+}
184+
122 thread_local! {185 thread_local! {
123 // FAULT 3: the picture region's own laid-out box, measured each frame by186 // FAULT 3: the picture region's own laid-out box, measured each frame by
124 // a [`bounds_probe`] the same shape `timeband_stance`'s contact strip187 // a [`bounds_probe`] the same shape `timeband_stance`'s contact strip
@@ -613,8 +676,10 @@ fn ledger(player: &Player, position: f64) -> impl IntoElement {
613 /// tab row and both tabs' content (DESIGN §12 step 4).676 /// tab row and both tabs' content (DESIGN §12 step 4).
614 /// Width comes from [`Player::split_px`] now, not the fixed [`DOCK_W`]: the677 /// Width comes from [`Player::split_px`] now, not the fixed [`DOCK_W`]: the
615 /// seam [`crate::ui::stance::render`] mounts to its left is what answers678 /// seam [`crate::ui::stance::render`] mounts to its left is what answers
616-/// "ui fields are not stretchable" for the dock.679+/// "ui fields are not stretchable" for the dock. `window_size` is threaded
617-fn dock(player: &Player, dock_w: f32, window_h: Pixels, cx: &mut Context<Player>) -> impl IntoElement {680+/// through so the maximize-in-place cards inside the dock (`dock_stance.rs`)
681+/// see the real viewport rather than a fabricated `size(px(DOCK_W), h)`.
682+fn dock(player: &Player, dock_w: f32, window_size: Size<Pixels>, cx: &mut Context<Player>) -> impl IntoElement {
618 div()683 div()
619 .id("stance-dock")684 .id("stance-dock")
620 .flex_none()685 .flex_none()
@@ -625,7 +690,7 @@ fn dock(player: &Player, dock_w: f32, window_h: Pixels, cx: &mut Context<Player>
625 .border_color(rgba(DARK_SEAM()))690 .border_color(rgba(DARK_SEAM()))
626 .flex()691 .flex()
627 .flex_col()692 .flex_col()
628- .child(dock_stance::render(player, dock_w, window_h, cx))693+ .child(dock_stance::render(player, dock_w, window_size, cx))
629 }694 }
630 695
631 /// A zero-size element whose only job is `window.on_mouse_event`'s door:696 /// A zero-size element whose only job is `window.on_mouse_event`'s door:
@@ -662,7 +727,6 @@ pub(crate) fn render(
662 cx: &mut Context<Player>,727 cx: &mut Context<Player>,
663 ) -> impl IntoElement {728 ) -> impl IntoElement {
664 let window_size = window.viewport_size();729 let window_size = window.viewport_size();
665- let window_h = window_size.height;
666 let position = player.playhead(player.drawn_duration());730 let position = player.playhead(player.drawn_duration());
667 // The two seams a hand may drag (`Split::Dock`, `Split::Bench`): read731 // The two seams a hand may drag (`Split::Dock`, `Split::Bench`): read
668 // through the same door every legacy region measures itself by732 // through the same door every legacy region measures itself by
@@ -882,8 +946,29 @@ pub(crate) fn render(
882 // what draws it once open.946 // what draws it once open.
883 .children(player.export_card(window_size, cx))947 .children(player.export_card(window_size, cx))
884 .children(player.export_progress_card(cx))948 .children(player.export_progress_card(cx))
885- .children(player.picker_card(window_size, cx)),949+ .children(player.picker_card(window_size, cx))
950+ // A maximized clip param card (EQ/Colour/Transform/Speed/
951+ // Silence/Mix/Subtitle style) escapes the dock to mount here
952+ // instead, the same window-space `stance-centre` context
953+ // every card above already renders in -- `below_picture_floor`
954+ // is a window coordinate, and `dock_stance.rs`'s
955+ // "dock-clip-rows" is a ~280-390px strip whose own box is the
956+ // containing block for anything absolutely positioned inside
957+ // it, `.relative()` or not, so a card asking for the room
958+ // below the picture cannot get it there. Un-maximized, the
959+ // same seven functions stay mounted in the dock
960+ // (`dock_stance::clip_tab`'s own `.when(!card_maximized, ...)`
961+ // guard keeps this from ever double-mounting one).
962+ .when(player.card_maximized, |el| {
963+ el.children(player.eq_card(window_size, cx))
964+ .children(player.color_card(window_size, cx))
965+ .children(player.transform_card(window_size, cx))
966+ .children(player.speed_card(window_size, cx))
967+ .children(player.silence_card(window_size, cx))
968+ .children(player.mix_card(window_size, cx))
969+ .children(player.subtitle_style_card(window_size, cx))
970+ }),
886 )971 )
887 .child(divider(Split::Dock, cx))972 .child(divider(Split::Dock, cx))
888- .child(dock(player, dock_w, window_h, cx))973+ .child(dock(player, dock_w, window_size, cx))
889 }974 }