From d57e5d13b3dddf3e0978a7ef7f57c194fbf0def8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 20 Aug 2026 17:37:13 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20style(ui):=20the=20menus=20and?= =?UTF-8?q?=20the=20cards=20join=20the=20room?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The colour card and the keymap menu both broke the rules. They did, and not only those two — the whole card and menu class was still speaking the old app's language. The menus had no type at all: raw toolkit text at whatever size it defaults to, chords in the same face as the verbs. Rows are Archivo now and every chord is mono, because a chord is something the film answers to. They also opened wherever the pointer was, which meant over the picture; they clamp below it now, the way the export plate and the preview already do. The param cards were legacy sheets: a seventeen-pixel title in a language whose largest type is thirteen, labels sitting on filled pills, values in the room's voice rather than the film's, and a filled Reset box beside an r that already resets. Colour, transform, speed and mix wear the language now — heads at nine, rows at ten and a half, values in mono, the picked row marked by a rule rather than a fill, and the resets are ghosts. Silence, subtitle style and the EQ still carry the old dress; the shared pieces they need are in place for the pass that follows. --- crates/app/src/ui/cards.rs | 621 ++++++++++++++++++++++++---------- crates/app/src/ui/library.rs | 48 ++- crates/app/src/ui/overlays.rs | 90 ++++- crates/app/src/ui/stance.rs | 11 + 4 files changed, 558 insertions(+), 212 deletions(-) diff --git a/crates/app/src/ui/cards.rs b/crates/app/src/ui/cards.rs index e2b3c70..a713b7d 100644 --- a/crates/app/src/ui/cards.rs +++ b/crates/app/src/ui/cards.rs @@ -4,6 +4,133 @@ use crate::*; use crate::ui::type_scale::{self, Typeset}; use crate::ui::widgets::*; +/// DESIGN §3/§4 atoms shared by every param/setting card below (colour, +/// transform, speed, EQ, silence, mix, subtitle style): what a row's label +/// and value paint as once `self.darkroom` is on, so the seven card bodies +/// each pick tokens rather than reimplement the same font/colour swap seven +/// times (`export_card`'s own `dark`-branch technique, one level up). +/// +/// A row label is what the room says about the control -- Archivo, §3's +/// 10.5px row size, `ink2` at rest / `ink1` picked (no permanent pill: the +/// picked state is a 1px `ink1` rule, §4's focus ring, not a fill). +fn dark_row_label(text: impl Into, picked: bool) -> Div { + div() + .type_style(type_scale::label(type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM)) + .text_color(rgb(if picked { INK1() } else { INK2() })) + .child(text.into()) +} + +/// A row's value -- what the film/the setting *says*, mono per §3. +fn dark_row_value(text: impl Into) -> Div { + div() + .type_style(type_scale::mono(type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM)) + .text_color(rgb(INK1())) + .child(text.into()) +} + +/// A card's own head line: the verb in Archivo (§3 section-head casing) and, +/// where there is one, the clip it names in mono beside it -- "which clip" +/// is metadata about the footage, not the room's own voice. +fn dark_card_head(verb: &str, meta: Option) -> Div { + div() + .flex_none() + .px(px(6.)) + .flex() + .items_baseline() + .gap(px(6.)) + .child( + div() + .type_style(type_scale::head()) + .text_color(rgb(INK3())) + .child(verb.to_uppercase()), + ) + .children(meta.map(|m| { + div() + .type_style(type_scale::mono(type_scale::CHORD_METADATA_MAX_PX, gpui::FontWeight::MEDIUM)) + .text_color(rgb(INK3())) + .child(m) + })) +} + +/// The help/status line under a card's head: what the keys do, which is +/// metadata about the room's controls -- mono, §3. +fn dark_help(text: impl Into) -> Div { + div() + .flex_none() + .px(px(6.)) + .type_style(type_scale::mono(type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM)) + .text_color(rgb(INK3())) + .child(text.into()) +} + +/// A ghost action row (DESIGN §4): borderless label + its chord, never a +/// filled box -- the shape every card's Reset/Flatten/Add/Remove/toggle +/// button takes now that "boxes are commitments" and Export is the one box +/// in the room. `active` is a toggle's own held-on state (EQ's spectrum +/// switch), not hover -- it keeps the fill and brightens the ink the same +/// way a picked param row's ring does. +/// The mix/silence/subtitle-size shape's own nudge glyph: ghost, not the +/// filled pill it used to be a permanent box -- resting bare, one fill step +/// on hover/press, same grammar as [`dark_ghost_button`] at a stepper's size. +fn dark_step_glyph( + id: impl Into, + plus: bool, + on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, +) -> impl IntoElement { + div() + .id(id.into()) + .flex_none() + .w(px(HIT_MIN)) + .h(px(KEYS_ROW_H)) + .flex() + .items_center() + .justify_center() + .rounded(px(3.)) + .cursor_pointer() + .hover(|s| s.bg(rgb(DARK_RAISED()))) + .on_click(on_click) + .child(dark_row_value(if plus { "+" } else { "−" })) +} + +fn dark_ghost_button( + id: impl Into, + text: impl Into, + chord: &str, + active: bool, + on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, +) -> impl IntoElement { + div() + .id(id.into()) + .flex_1() + .flex() + .h(px(CONTROL_H)) + .items_center() + .justify_center() + .gap(px(6.)) + .rounded(px(3.)) + .when(active, |d| d.bg(rgb(DARK_RAISED()))) + .cursor_pointer() + .hover(|s| s.bg(rgb(DARK_RAISED()))) + .on_click(on_click) + .child( + div() + .type_style(type_scale::label(type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM)) + .text_color(rgb(if active { INK1() } else { INK2() })) + .child(text.into()), + ) + .when(!chord.is_empty(), |d| { + d.child( + div() + .type_style(type_scale::mono( + type_scale::CHORD_METADATA_MIN_PX, + gpui::FontWeight::MEDIUM, + )) + .text_color(rgb(INK3())) + .child(chord.to_string()), + ) + }) +} + impl Player { /// What an export is going to be, before there is one: the codec, the box /// it goes into, the bitrate, where it lands -- and, above the button, the @@ -1555,6 +1682,7 @@ impl Player { pub(crate) fn color_card(&self, cx: &mut Context) -> Option { let (lane, idx) = self.color_open?; let params = self.color_params(); + let dark = self.darkroom; let rows: Vec<_> = COLOR_BANDS .iter() .enumerate() @@ -1572,13 +1700,24 @@ impl Player { .px(px(6.)) .rounded(px(3.)) .cursor_pointer() - .when(picked, |d| d.bg(rgb(BG_SELECTED()))) - .hover(|s| s.bg(rgb(BG_HOVER()))) + // Darkroom: no permanent pill under a label -- the picked + // row is a 1px `ink1` rule (§4's focus ring), never a fill. + // Hover is the one fill step §4 allows. + .when(dark && picked, |d| d.border_l_2().border_color(rgb(INK1()))) + .when(!dark && picked, |d| d.bg(rgb(BG_SELECTED()))) + .hover(|s| s.bg(rgb(if dark { DARK_RAISED() } else { BG_HOVER() }))) .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { this.color_band = i; cx.notify(); })) - .child(div().flex_1().min_w(px(0.)).truncate().child(label)) + .child( + div() + .flex_1() + .min_w(px(0.)) + .truncate() + .when(dark, |d| d.child(dark_row_label(label, picked))) + .when(!dark, |d| d.child(label)), + ) .child( // The bar is 4 px to look at and a whole row to hit // (WCAG 2.5.8), the same split the ruler makes between @@ -1608,7 +1747,7 @@ impl Player { .w_full() .h(px(4.)) .rounded(px(2.)) - .bg(rgb(BG_PANEL())) + .bg(rgb(if dark { DARK_PANEL() } else { BG_PANEL() })) .child( div() .h_full() @@ -1621,12 +1760,18 @@ impl Player { .child( div() .w(px(44.)) - .text_size(px(11.)) - .text_color(rgb(FG_SECONDARY())) - .child(format!("{value:.2}")), + .when(dark, |d| d.child(dark_row_value(format!("{value:.2}")))) + .when(!dark, |d| { + d.text_size(px(11.)) + .text_color(rgb(FG_SECONDARY())) + .child(format!("{value:.2}")) + }), ) }) .collect(); + let head_meta: SharedString = format!("{} clip {}", lane.label(), idx + 1).into(); + let help_text = + "drag a bar, or ↑↓ picks one and ←→ moves it, r resets — a click away or esc closes"; Some( drag_scrim(cx) .flex() @@ -1652,22 +1797,27 @@ impl Player { .gap(px(2.)) .p(px(12.)) .rounded(px(6.)) - .bg(rgb(BG_RAISED())) - .child(div().flex_none().px(px(6.)).child(format!( - "Colour — {} clip {}", - lane.label(), - idx + 1 - ))) - .child( - div() - .flex_none() - .px(px(6.)) - .text_size(px(11.)) - .text_color(rgb(FG_SECONDARY())) - .child( - "drag a bar, or ↑↓ picks one and ←→ moves it, r resets — a click away or esc closes", - ), - ) + .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) + .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) + .when(dark, |d| d.child(dark_card_head("Colour", Some(head_meta.clone())))) + .when(!dark, |d| { + d.child(div().flex_none().px(px(6.)).child(format!( + "Colour — {} clip {}", + lane.label(), + idx + 1 + ))) + }) + .when(dark, |d| d.child(dark_help(help_text))) + .when(!dark, |d| { + d.child( + div() + .flex_none() + .px(px(6.)) + .text_size(px(11.)) + .text_color(rgb(FG_SECONDARY())) + .child(help_text), + ) + }) // The frame as it is being graded, over the controls // grading it: the three lines are what the picture is // made of, and every sample of a drag reseeks, so they @@ -1677,28 +1827,41 @@ impl Player { .flex_none() .h(px(HIST_H)) .rounded(px(3.)) - .bg(rgb(BG_HOVER_DIM())) + .bg(rgb(if dark { DARK_HAIRLINE() } else { BG_HOVER_DIM() })) .relative() .child(hist_curves(self.histogram)), ) .children(rows) - .child( - div() - .id("color-reset") - .mt(px(4.)) - .flex() - .h(px(CONTROL_H)) - .items_center() - .justify_center() - .rounded(px(3.)) - .bg(rgb(BG_SELECTED())) - .cursor_pointer() - .hover(|s| s.bg(rgb(BG_HOVER()))) - .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { + .when(dark, |d| { + d.child(dark_ghost_button( + "color-reset", + "Reset", + "r", + false, + cx.listener(|this, _: &ClickEvent, _, cx| { this.set_color(ColorParams::default(), cx); - })) - .child("Reset"), - ), + }), + )) + }) + .when(!dark, |d| { + d.child( + div() + .id("color-reset") + .mt(px(4.)) + .flex() + .h(px(CONTROL_H)) + .items_center() + .justify_center() + .rounded(px(3.)) + .bg(rgb(BG_SELECTED())) + .cursor_pointer() + .hover(|s| s.bg(rgb(BG_HOVER()))) + .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { + this.set_color(ColorParams::default(), cx); + })) + .child("Reset"), + ) + }), ), ) } @@ -1709,6 +1872,7 @@ impl Player { pub(crate) fn transform_card(&self, cx: &mut Context) -> Option { let (lane, idx) = self.transform_open?; let params = self.transform_params(); + let dark = self.darkroom; let rows: Vec<_> = TRANSFORM_BANDS .iter() .enumerate() @@ -1726,13 +1890,21 @@ impl Player { .px(px(6.)) .rounded(px(3.)) .cursor_pointer() - .when(picked, |d| d.bg(rgb(BG_SELECTED()))) - .hover(|s| s.bg(rgb(BG_HOVER()))) + .when(dark && picked, |d| d.border_l_2().border_color(rgb(INK1()))) + .when(!dark && picked, |d| d.bg(rgb(BG_SELECTED()))) + .hover(|s| s.bg(rgb(if dark { DARK_RAISED() } else { BG_HOVER() }))) .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { this.transform_band = i; cx.notify(); })) - .child(div().flex_1().min_w(px(0.)).truncate().child(label)) + .child( + div() + .flex_1() + .min_w(px(0.)) + .truncate() + .when(dark, |d| d.child(dark_row_label(label, picked))) + .when(!dark, |d| d.child(label)), + ) .child( div() .id(("transform-bar", i)) @@ -1757,7 +1929,7 @@ impl Player { .w_full() .h(px(4.)) .rounded(px(2.)) - .bg(rgb(BG_PANEL())) + .bg(rgb(if dark { DARK_PANEL() } else { BG_PANEL() })) .child( div() .h_full() @@ -1768,17 +1940,25 @@ impl Player { ), ) .child( - div() - .w(px(44.)) - .text_size(px(11.)) - .text_color(rgb(FG_SECONDARY())) - .child(match i == ROTATE_BAND { + div().w(px(44.)).when(dark, |d| { + d.child(dark_row_value(match i == ROTATE_BAND { true => format!("{value:.0}°"), false => format!("{value:.2}"), - }), + })) + }).when(!dark, |d| { + d.text_size(px(11.)) + .text_color(rgb(FG_SECONDARY())) + .child(match i == ROTATE_BAND { + true => format!("{value:.0}°"), + false => format!("{value:.2}"), + }) + }), ) }) .collect(); + let head_meta: SharedString = format!("{} clip {}", lane.label(), idx + 1).into(); + let help_text = "drag a bar, or ↑↓ picks one and ←→ moves it (rotation steps \ + by 90°), r resets — a click away or esc closes"; Some( drag_scrim(cx) .flex() @@ -1803,41 +1983,58 @@ impl Player { .gap(px(2.)) .p(px(12.)) .rounded(px(6.)) - .bg(rgb(BG_RAISED())) - .child(div().flex_none().px(px(6.)).child(format!( - "Transform — {} clip {}", - lane.label(), - idx + 1 - ))) - .child( - div() - .flex_none() - .px(px(6.)) - .text_size(px(11.)) - .text_color(rgb(FG_SECONDARY())) - .child( - "drag a bar, or ↑↓ picks one and ←→ moves it (rotation steps \ - by 90°), r resets — a click away or esc closes", - ), - ) + .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) + .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) + .when(dark, |d| d.child(dark_card_head("Transform", Some(head_meta.clone())))) + .when(!dark, |d| { + d.child(div().flex_none().px(px(6.)).child(format!( + "Transform — {} clip {}", + lane.label(), + idx + 1 + ))) + }) + .when(dark, |d| d.child(dark_help(help_text))) + .when(!dark, |d| { + d.child( + div() + .flex_none() + .px(px(6.)) + .text_size(px(11.)) + .text_color(rgb(FG_SECONDARY())) + .child(help_text), + ) + }) .children(rows) - .child( - div() - .id("transform-reset") - .mt(px(4.)) - .flex() - .h(px(CONTROL_H)) - .items_center() - .justify_center() - .rounded(px(3.)) - .bg(rgb(BG_SELECTED())) - .cursor_pointer() - .hover(|s| s.bg(rgb(BG_HOVER()))) - .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { + .when(dark, |d| { + d.child(dark_ghost_button( + "transform-reset", + "Reset", + "r", + false, + cx.listener(|this, _: &ClickEvent, _, cx| { this.set_transform(TransformParams::default(), cx); - })) - .child("Reset"), - ), + }), + )) + }) + .when(!dark, |d| { + d.child( + div() + .id("transform-reset") + .mt(px(4.)) + .flex() + .h(px(CONTROL_H)) + .items_center() + .justify_center() + .rounded(px(3.)) + .bg(rgb(BG_SELECTED())) + .cursor_pointer() + .hover(|s| s.bg(rgb(BG_HOVER()))) + .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { + this.set_transform(TransformParams::default(), cx); + })) + .child("Reset"), + ) + }), ), ) } @@ -1856,6 +2053,7 @@ impl Player { let speed = self.card_speed(); let session = self.session.as_ref()?; let clip = session.lane_clips(lane).get(idx).copied()?; + let dark = self.darkroom; let lo = f32::from(Speed::MIN.permille()); let hi = f32::from(Speed::MAX.permille()); let frac = ((f32::from(speed.permille()) - lo) / (hi - lo)).clamp(0., 1.); @@ -1863,6 +2061,7 @@ impl Player { .into_iter() .map(|permille| { let at = Speed::from_permille(permille); + let picked = at == speed; div() .id(("speed-preset", usize::from(permille))) .flex_1() @@ -1871,18 +2070,32 @@ impl Player { .items_center() .justify_center() .rounded(px(3.)) - .bg(rgb(match at == speed { - true => BG_SELECTED(), - false => BG_PANEL(), - })) + .when(dark && picked, |d| d.bg(rgb(DARK_RAISED()))) + .when(!dark, |d| { + d.bg(rgb(match picked { + true => BG_SELECTED(), + false => BG_PANEL(), + })) + }) .cursor_pointer() - .hover(|s| s.bg(rgb(BG_HOVER()))) + .hover(|s| s.bg(rgb(if dark { DARK_RAISED() } else { BG_HOVER() }))) .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { this.set_speed(at, cx); })) - .child(format!("{at}")) + .when(dark, |d| d.child(dark_row_value(format!("{at}")))) + .when(!dark, |d| d.child(format!("{at}"))) }) .collect(); + let head_meta: SharedString = format!("{} clip {}", lane.label(), idx + 1).into(); + let help_text = + "drag the bar or ←→ moves it, r is 1.00x — the pitch moves with the rate; a click away or esc closes"; + let tail_text: SharedString = format!( + "{speed} — {} source frames over {} on the timeline ({})", + clip.len(), + clip.frames(), + frames_timecode(clip.frames(), self.fps) + ) + .into(); Some( drag_scrim(cx) .flex() @@ -1908,22 +2121,27 @@ impl Player { .gap(px(6.)) .p(px(12.)) .rounded(px(6.)) - .bg(rgb(BG_RAISED())) - .child(div().flex_none().px(px(6.)).child(format!( - "Speed (tape) — {} clip {}", - lane.label(), - idx + 1 - ))) - .child( - div() - .flex_none() - .px(px(6.)) - .text_size(px(11.)) - .text_color(rgb(FG_SECONDARY())) - .child( - "drag the bar or ←→ moves it, r is 1.00x — the pitch moves with the rate; a click away or esc closes", - ), - ) + .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) + .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) + .when(dark, |d| d.child(dark_card_head("Speed (tape)", Some(head_meta.clone())))) + .when(!dark, |d| { + d.child(div().flex_none().px(px(6.)).child(format!( + "Speed (tape) — {} clip {}", + lane.label(), + idx + 1 + ))) + }) + .when(dark, |d| d.child(dark_help(help_text))) + .when(!dark, |d| { + d.child( + div() + .flex_none() + .px(px(6.)) + .text_size(px(11.)) + .text_color(rgb(FG_SECONDARY())) + .child(help_text), + ) + }) .child( // 4 px to look at and a whole row to hit (WCAG // 2.5.8), the split the colour sliders and the ruler @@ -1949,7 +2167,7 @@ impl Player { .w_full() .h(px(4.)) .rounded(px(2.)) - .bg(rgb(BG_PANEL())) + .bg(rgb(if dark { DARK_PANEL() } else { BG_PANEL() })) .child( div() .h_full() @@ -1960,22 +2178,20 @@ impl Player { ), ) .child(div().flex().gap(px(4.)).children(presets)) - .child( - div() - .flex_none() - .px(px(6.)) - .text_size(px(11.)) - .text_color(rgb(FG_SECONDARY())) - // What the choice *is*, in the numbers the - // timeline is measured in: the source range - // never moves, the room it takes does. - .child(format!( - "{speed} — {} source frames over {} on the timeline ({})", - clip.len(), - clip.frames(), - frames_timecode(clip.frames(), self.fps) - )), - ), + .when(dark, |d| d.child(dark_help(tail_text.clone()))) + .when(!dark, |d| { + d.child( + div() + .flex_none() + .px(px(6.)) + .text_size(px(11.)) + .text_color(rgb(FG_SECONDARY())) + // What the choice *is*, in the numbers the + // timeline is measured in: the source range + // never moves, the room it takes does. + .child(tail_text), + ) + }), ), ) } @@ -2000,6 +2216,7 @@ impl Player { if !self.mix_open { return None; } + let dark = self.darkroom; let session = self.session.as_ref(); let lanes = self.mix_lanes(); let limiter = session.map_or_else(Limiter::default, PlaybackSession::limiter); @@ -2027,6 +2244,7 @@ impl Player { .into_iter() .enumerate() .map(|(n, (label, value))| { + let picked = n == self.mix_field; div() .id(("mix-row", n)) .flex() @@ -2036,51 +2254,80 @@ impl Player { .justify_between() .px(px(6.)) .rounded(px(3.)) - .bg(rgb(match n == self.mix_field { - true => BG_SELECTED(), - false => BG_PANEL(), - })) + .when(dark && picked, |d| d.border_l_2().border_color(rgb(INK1()))) + .when(!dark, |d| { + d.bg(rgb(match picked { + true => BG_SELECTED(), + false => BG_PANEL(), + })) + }) .cursor_pointer() - .hover(|s| s.bg(rgb(BG_HOVER()))) + .hover(|s| s.bg(rgb(if dark { DARK_RAISED() } else { BG_HOVER() }))) .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { this.mix_field = n; cx.notify(); })) - .child(div().text_color(rgb(FG_SECONDARY())).child(label)) + .child( + div() + .when(dark, |d| d.child(dark_row_label(label.clone(), picked))) + .when(!dark, |d| d.text_color(rgb(FG_SECONDARY())).child(label)), + ) .child( div() .flex() .items_center() .gap(px(4.)) - .child(value) + .when(dark, |d| d.child(dark_row_value(value.clone()))) + .when(!dark, |d| d.child(value)) .children([-1, 1].map(|steps: i32| { - div() - .id(("mix-step", n * 2 + usize::from(steps > 0))) - .flex_none() - .w(px(HIT_MIN)) - .h(px(KEYS_ROW_H)) - .flex() - .items_center() - .justify_center() - .rounded(px(3.)) - .bg(rgb(BG_PANEL())) - .cursor_pointer() - .hover(|s| s.bg(rgb(BG_HOVER()))) - .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { - // Picked as well as moved, the silence - // card's rule: the row a press lands on - // is the row the arrows carry on from. - this.mix_field = n; - this.nudge_mix(steps, cx); - })) - .child(match steps > 0 { - true => "+", - false => "−", - }) + let id = ("mix-step", n * 2 + usize::from(steps > 0)); + match dark { + true => dark_step_glyph( + id, + steps > 0, + cx.listener(move |this, _: &ClickEvent, _, cx| { + this.mix_field = n; + this.nudge_mix(steps, cx); + }), + ) + .into_any_element(), + false => div() + .id(id) + .flex_none() + .w(px(HIT_MIN)) + .h(px(KEYS_ROW_H)) + .flex() + .items_center() + .justify_center() + .rounded(px(3.)) + .bg(rgb(BG_PANEL())) + .cursor_pointer() + .hover(|s| s.bg(rgb(BG_HOVER()))) + .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { + // Picked as well as moved, the silence + // card's rule: the row a press lands on + // is the row the arrows carry on from. + this.mix_field = n; + this.nudge_mix(steps, cx); + })) + .child(match steps > 0 { + true => "+", + false => "−", + }) + .into_any_element(), + } })), ) }) .collect(); + let help_text = "− and + move a setting, or ↑↓ picks one and ←→ moves it (hold to run it) — a track fader moves everything on that track; a click away or esc closes"; + let tail_text = match limiter.on { + true => format!( + "the mix is held under {:+.0} dBFS — quieter passages are untouched", + limiter.ceiling_db + ), + false => "the limiter is out of circuit — a hot mix clips at full scale".to_string(), + }; Some( scrim() .flex() @@ -2107,23 +2354,28 @@ impl Player { .gap(px(6.)) .p(px(12.)) .rounded(px(6.)) - .bg(rgb(BG_RAISED())) - .child( - div() - .flex_none() - .px(px(6.)) - .child("Mix — track volumes and the master limiter"), - ) - .child( - div() - .flex_none() - .px(px(6.)) - .text_size(px(11.)) - .text_color(rgb(FG_SECONDARY())) - .child( - "− and + move a setting, or ↑↓ picks one and ←→ moves it (hold to run it) — a track fader moves everything on that track; a click away or esc closes", - ), - ) + .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) + .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) + .when(dark, |d| d.child(dark_card_head("Mix", None))) + .when(!dark, |d| { + d.child( + div() + .flex_none() + .px(px(6.)) + .child("Mix — track volumes and the master limiter"), + ) + }) + .when(dark, |d| d.child(dark_help(help_text))) + .when(!dark, |d| { + d.child( + div() + .flex_none() + .px(px(6.)) + .text_size(px(11.)) + .text_color(rgb(FG_SECONDARY())) + .child(help_text), + ) + }) .child( div() .id("mix-rows") @@ -2133,23 +2385,20 @@ impl Player { .overflow_y_scroll() .children(rows), ) - .child( - div() - .flex_none() - .px(px(6.)) - .text_size(px(11.)) - .text_color(rgb(FG_SECONDARY())) - // What the choice *is*: the limiter's own line, - // because "on" alone says nothing about what it - // does to a mix that never reaches the ceiling. - .child(match limiter.on { - true => format!( - "the mix is held under {:+.0} dBFS — quieter passages are untouched", - limiter.ceiling_db - ), - false => "the limiter is out of circuit — a hot mix clips at full scale".to_string(), - }), - ), + .when(dark, |d| d.child(dark_help(tail_text.clone()))) + .when(!dark, |d| { + d.child( + div() + .flex_none() + .px(px(6.)) + .text_size(px(11.)) + .text_color(rgb(FG_SECONDARY())) + // What the choice *is*: the limiter's own line, + // because "on" alone says nothing about what it + // does to a mix that never reaches the ceiling. + .child(tail_text), + ) + }), ), ) } diff --git a/crates/app/src/ui/library.rs b/crates/app/src/ui/library.rs index ffaa6da..83c43fc 100644 --- a/crates/app/src/ui/library.rs +++ b/crates/app/src/ui/library.rs @@ -2,6 +2,8 @@ use crate::*; use crate::ui::widgets::*; +use crate::ui::type_scale::Typeset; +use crate::ui::stance::below_picture_floor; impl Player { /// The media library: a row per source the timeline knows, in the order @@ -551,7 +553,11 @@ impl Player { ) -> Option { let menu = self.library_menu.clone()?; let path = menu.path.clone(); - let row = |n: usize| { + // DESIGN §9: the same plate row treatment `Player::context_card` + // draws with -- one function, so a copy-paste sibling menu cannot + // drift from it (darkroom only; `OLD_GUI=1` is unchanged). + let darkroom = self.darkroom; + let row = move |n: usize| { div() .id(("library-menu", n)) .flex() @@ -561,6 +567,22 @@ impl Player { .gap(px(12.)) .px(px(6.)) .rounded(px(3.)) + .when(darkroom, |d| { + d.type_style(crate::ui::type_scale::label( + crate::ui::type_scale::LABEL_ROW_PX, + gpui::FontWeight::MEDIUM, + )) + .text_color(rgb(INK2())) + }) + }; + let chord_style = |d: Div| -> Div { + d.when(darkroom, |d| { + d.type_style(crate::ui::type_scale::mono( + crate::ui::type_scale::CHORD_METADATA_MIN_PX, + gpui::FontWeight::MEDIUM, + )) + .text_color(rgb(INK3())) + }) }; let mut rows: Vec = Vec::new(); // What every item of this menu is answered from, read once. @@ -618,14 +640,14 @@ impl Player { rows.push( row(rows.len()) .child(label) - .child( + .child(chord_style( div() .min_w(px(0.)) .truncate() .text_size(px(11.)) - .text_color(rgb(FG_SECONDARY())) - .child(value), + .text_color(rgb(FG_SECONDARY())), ) + .child(value)) .into_any_element(), ); } @@ -641,11 +663,13 @@ impl Player { row(rows.len()) .child(item.label()) .child( - div() - .min_w(px(0.)) - .truncate() - .text_color(rgb(FG_SECONDARY())) - .child(refusal.why().unwrap_or_else(|| item.hint())), + chord_style( + div() + .min_w(px(0.)) + .truncate() + .text_color(rgb(FG_SECONDARY())), + ) + .child(refusal.why().unwrap_or_else(|| item.hint())), ) .when(!enabled, |d| d.opacity(0.4).cursor_not_allowed()) .when(enabled, |d| { @@ -662,7 +686,11 @@ impl Player { // Placed by the height it is drawn to, and drawn to what the window has // room for -- the clip menu's rule, one function for all three. let list_h = menu_rows_h(rows.len(), viewport); - let (x, y) = menu_at(menu.at, viewport, MENU_PAD * 2. + list_h); + let mut at = menu.at; + if darkroom { + at.y = px(f32::from(at.y).max(below_picture_floor(f32::from(viewport.height)))); + } + let (x, y) = menu_at(at, viewport, MENU_PAD * 2. + list_h); let full: SharedString = path.display().to_string().into(); Some( scrim() diff --git a/crates/app/src/ui/overlays.rs b/crates/app/src/ui/overlays.rs index 7e2f9f2..da4d8a2 100644 --- a/crates/app/src/ui/overlays.rs +++ b/crates/app/src/ui/overlays.rs @@ -2,6 +2,8 @@ use crate::*; use crate::ui::widgets::*; +use crate::ui::stance::below_picture_floor; +use crate::ui::type_scale::{self, Typeset}; impl Player { /// The running import holds its own bar above the notice's, for the notice @@ -478,7 +480,13 @@ impl Player { let clip = session.lane_clips(menu.lane).get(menu.idx).copied(); let source = clip.and_then(|clip| session.sources().get(clip.source).cloned()); let secs = |frames: u32| timecode(f64::from(frames) / self.fps, self.fps); - let row = |n: usize| { + // DESIGN §9/§3: a menu row is a plate row, Archivo at the room's + // 10.5px row size -- `ink2`, dimmed to `ink3` on the disabled ones + // below by the same `.opacity` every row already carried. Gated on + // `self.darkroom` so `OLD_GUI=1` keeps its own unstyled rows exactly + // as they draw today. + let darkroom = self.darkroom; + let row = move |n: usize| { div() .id(("menu", n)) .flex() @@ -490,6 +498,26 @@ impl Player { .gap(px(12.)) .px(px(6.)) .rounded(px(3.)) + .when(darkroom, |d| { + d.type_style(type_scale::label( + type_scale::LABEL_ROW_PX, + gpui::FontWeight::MEDIUM, + )) + .text_color(rgb(INK2())) + }) + }; + // The chord/metadata half of a row: mono, `ink3`, DESIGN §3's + // 9.5-10px band -- every value that is data about the film rather + // than a room verb goes through this rather than the row's ambient + // Archivo. + let chord_style = |d: Div| -> Div { + d.when(darkroom, |d| { + d.type_style(type_scale::mono( + type_scale::CHORD_METADATA_MIN_PX, + gpui::FontWeight::MEDIUM, + )) + .text_color(rgb(INK3())) + }) }; let mut rows: Vec = Vec::new(); if let (true, Some((clip, source))) = (menu.details, clip.zip(source.clone())) { @@ -520,7 +548,7 @@ impl Player { rows.push( row(rows.len()) .child(label) - .child( + .child(chord_style( div() .min_w(px(0.)) .truncate() @@ -528,9 +556,9 @@ impl Player { // pair is 25 characters and has to fit beside // its label inside `MENU_W`. .text_size(px(11.)) - .text_color(rgb(FG_SECONDARY())) - .child(value), + .text_color(rgb(FG_SECONDARY())), ) + .child(value)) .into_any_element(), ); } @@ -570,15 +598,18 @@ impl Player { // One truncated line, like the details side: a // reason that wrapped would make the card taller // than the height `menu_at` placed it by. - Some(why) => div() - .min_w(px(0.)) - .truncate() - .text_size(px(11.)) - .text_color(rgb(FG_SECONDARY())) - .child(why), - None => div() - .flex_shrink_0() - .text_color(rgb(FG_SECONDARY())) + Some(why) => chord_style( + div() + .min_w(px(0.)) + .truncate() + .text_size(px(11.)) + .text_color(rgb(FG_SECONDARY())), + ) + .child(why), + // Every command wears its chord (DESIGN §4): mono, + // `ink3`, the same face the spine badges and the + // keys overlay already read theirs in. + None => chord_style(div().flex_shrink_0().text_color(rgb(FG_SECONDARY()))) .child(self.keymap.display(action)), }) .when(!enabled, |d| d.opacity(0.4).cursor_not_allowed()) @@ -624,7 +655,7 @@ impl Player { .child("Properties") // No stroke reaches this one, and a blank column would read // as one that was forgotten. - .child(div().text_color(rgb(FG_SECONDARY())).child("…")) + .child(chord_style(div().text_color(rgb(FG_SECONDARY()))).child("…")) .into_any_element() })); } @@ -632,7 +663,16 @@ impl Player { // to are one number: placed by a taller one, the card would hang off the // window's floor -- the very thing the clamp is for. let list_h = menu_rows_h(rows.len(), viewport); - let (x, y) = menu_at(menu.at, viewport, MENU_PAD * 2. + list_h); + // §5/§11 check 6: the picture is never covered. A right-click high on + // the window would otherwise hang the menu at the pointer, straight + // over the screen -- clamped below it into the bench/ledger/dock + // footprint instead, darkroom only (the legacy tree has no such + // fixed split to clamp against). + let mut at = menu.at; + if self.darkroom { + at.y = px(f32::from(at.y).max(below_picture_floor(f32::from(viewport.height)))); + } + let (x, y) = menu_at(at, viewport, MENU_PAD * 2. + list_h); let full: SharedString = source .map(|source| source.path.display().to_string()) .unwrap_or_default() @@ -716,6 +756,7 @@ impl Player { cx: &mut Context, ) -> Option { let picker = self.picker?; + let darkroom = self.darkroom; let rows: Vec = self .choices(picker.of) .into_iter() @@ -733,6 +774,13 @@ impl Player { .gap(px(12.)) .px(px(6.)) .rounded(px(3.)) + .when(darkroom, |d| { + d.type_style(type_scale::label( + type_scale::LABEL_ROW_PX, + gpui::FontWeight::MEDIUM, + )) + .text_color(rgb(INK2())) + }) .cursor_pointer() .hover(|s| s.bg(rgb(BG_HOVER()))) // The mark is a glyph as well as a highlight, like the @@ -768,6 +816,12 @@ impl Player { true => FG_PRIMARY(), false => FG_SECONDARY(), })) + .when(darkroom, |d| { + d.type_style(type_scale::mono( + type_scale::CHORD_METADATA_MIN_PX, + gpui::FontWeight::MEDIUM, + )) + }) .child(detail), ) .on_click( @@ -779,7 +833,11 @@ impl Player { // 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 list_h = menu_rows_h(rows.len(), viewport); - let (x, y) = menu_at(picker.at, viewport, MENU_PAD * 2. + list_h); + let mut at = picker.at; + if darkroom { + at.y = px(f32::from(at.y).max(below_picture_floor(f32::from(viewport.height)))); + } + let (x, y) = menu_at(at, viewport, MENU_PAD * 2. + list_h); Some( scrim() // Click away closes it, either button, swallowed so nothing diff --git a/crates/app/src/ui/stance.rs b/crates/app/src/ui/stance.rs index f036dc6..2ea0439 100644 --- a/crates/app/src/ui/stance.rs +++ b/crates/app/src/ui/stance.rs @@ -31,6 +31,17 @@ const LEDGER_H: f32 = 28.; /// Right side panel, fixed width, carrying the Src/Clip tab pair. const DOCK_W: f32 = 280.; +/// 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): +/// a right-click near the top of the window must not walk the menu up over +/// 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.) +} + thread_local! { // FAULT 3: the picture region's own laid-out box, measured each frame by // a [`bounds_probe`] the same shape `timeband_stance`'s contact strip