forge
Explore
Log in

Don't you dare go Hollow

cba4c8217c3f59b509c9bd528e77fe9f19e3595fAhmet Kaan GümüşParent: e78c74173fc646

11 changed files +1274 -674

DESIGN.mdmodified+3 -3
@@ -76,9 +76,9 @@ Two faces, fixed roles (bundled, no runtime deps):
7676 - **Spline Sans Mono** — everything the film says: timecode, chords, readouts, metadata,
7777 cue text, the ledger. Mono = data; if a string is *about the footage or a key*, it is mono.
7878
79-Scale: 15px hero timecode (700, colons in `ink3`) · 13px labels/rows (500) · 11–12px chords
80-and metadata (500) · 10px section heads (Archivo 700, uppercase, +0.14em letter-spacing, `ink3`).
81-Nothing below 9px. Every size is a whole pixel (no half-pixel sizes -- they put glyph baselines
79+Scale: 18px hero timecode (700, colons in `ink3`) · 15px labels/rows (500) · 13–14px chords
80+and metadata (500) · 12px section heads (Archivo 700, uppercase, +0.14em letter-spacing, `ink3`).
81+Nothing below 10px. Every size is a whole pixel (no half-pixel sizes -- they put glyph baselines
8282 off the pixel grid and blurred cosmic-text's AA). No italics. Tabular figures wherever digits
8383 align.
8484
crates/app/src/audio_cards.rsmodified+1 -1
@@ -235,7 +235,7 @@ mod eq_tick_end_w_tests {
235235 use super::*;
236236
237237 /// 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
238+ /// at the dark theme's 13 px end-tick size. The derived width must clear
239239 /// that box, and must grow, not shrink, if a future scale bump raises
240240 /// the size fed in.
241241 #[test]
crates/app/src/layout.rsmodified+19 -12
@@ -322,10 +322,11 @@ pub(crate) const TIMELINE_FIXED_H: f32 = 16. + 18. + 8. + RULER_HIT_H + 8. + 4.;
322322 /// hand it to the lane column as a bonus at exactly the zoom where the hand is
323323 /// least expecting the bed to move.
324324 pub(crate) fn timeline_fixed_h(scroll: bool) -> f32 {
325- TIMELINE_FIXED_H + match scroll {
326- true => 8. + SCROLL_HIT,
327- false => 0.,
328- }
325+ TIMELINE_FIXED_H
326+ + match scroll {
327+ true => 8. + SCROLL_HIT,
328+ false => 0.,
329+ }
329330 }
330331
331332 /// The most of a short window the timeline may take, sized so the seam's own
@@ -471,11 +472,9 @@ const LEDGER_SEAM_CLEARANCE: f32 = 1.;
471472 /// lane, which has no next row to spill into and clipped straight into the
472473 /// ledger instead.
473474 ///
474-/// A third driven pass at the next floor (`94.`, `BENCH_CHROME_H` still
475-/// undercounted at `20.`) clipped A1's dot again, by one row -- two 1px
476-/// causes stacked, not one 2px guess: `BENCH_CHROME_H`'s own undercount
477-/// (`20.` vs its real `21.`) and this term, `LEDGER_SEAM_CLEARANCE`, which
478-/// the formula never carried at all. `21 + 22 + 2 + 48 + 2 + 1` = `96.`.
475+/// With the 18/15/14-13/12/10px type scale, the same derivation uses a 24px
476+/// chrome block and two 27px lane floors:
477+/// `24 + 22 + 2 + 54 + 2 + 1` = `105.`.
479478 pub(crate) const BENCH_MIN_H: f32 = crate::ui::stance::BENCH_CHROME_H
480479 + crate::ui::bench_stance::RULER_H
481480 + crate::ui::bench_stance::ROW_GAP
@@ -539,8 +538,12 @@ pub(crate) fn load_stance_splits_from(path: &std::path::Path) -> Splits {
539538 let mut splits = Splits::default();
540539 if let Ok(text) = std::fs::read_to_string(path) {
541540 for line in text.lines() {
542- let Some((key, value)) = line.split_once('=') else { continue };
543- let Ok(px) = value.trim().parse::<f32>() else { continue };
541+ let Some((key, value)) = line.split_once('=') else {
542+ continue;
543+ };
544+ let Ok(px) = value.trim().parse::<f32>() else {
545+ continue;
546+ };
544547 let Some(split) = Split::PERSISTED.into_iter().find(|s| s.key() == key) else {
545548 continue;
546549 };
@@ -561,7 +564,11 @@ pub(crate) fn save_stance_splits(splits: &Splits) {
561564 pub(crate) fn save_stance_splits_to(splits: &Splits, path: &std::path::Path) {
562565 let text: String = Split::PERSISTED
563566 .into_iter()
564- .filter_map(|split| splits.get(split).map(|px| format!("{}={px}\n", split.key())))
567+ .filter_map(|split| {
568+ splits
569+ .get(split)
570+ .map(|px| format!("{}={px}\n", split.key()))
571+ })
565572 .collect();
566573 if let Some(dir) = path.parent() {
567574 let _ = std::fs::create_dir_all(dir);
crates/app/src/tests/cards.rsmodified+108 -38
@@ -16,7 +16,9 @@ use std::sync::atomic::Ordering;
1616 #[test]
1717 fn no_overlaid_state_in_the_stance_goes_modal_without_painting_something() {
1818 let stance = src_text("ui/stance.rs");
19- let render_body = &stance[stance.find("pub(crate) fn render(").expect("the stance's entry point")..];
19+ let render_body = &stance[stance
20+ .find("pub(crate) fn render(")
21+ .expect("the stance's entry point")..];
2022 for menu in ["context_card(", "library_card(", "picker_card("] {
2123 assert!(
2224 render_body.contains(menu),
@@ -28,7 +30,11 @@ fn no_overlaid_state_in_the_stance_goes_modal_without_painting_something() {
2830 .find("if this.rebinding.is_some()\n || this.card_open()")
2931 .expect("the stance's modal guard");
3032 let guard = &stance[guard_at..guard_at + 1600];
31- for field in ["this.context_menu = None", "this.library_menu = None", "this.picker = None"] {
33+ for field in [
34+ "this.context_menu = None",
35+ "this.library_menu = None",
36+ "this.picker = None",
37+ ] {
3238 assert!(
3339 guard.contains(field),
3440 "the overlaid()/rebinding branch no longer clears {field} on every key -- \
@@ -61,7 +67,10 @@ fn every_modal_field_has_a_mounted_surface_somewhere_in_the_darkroom() {
6167 fields.push(name);
6268 }
6369 }
64- assert!(fields.len() >= 9, "modal()'s own field list looks too short to have been parsed: {fields:?}");
70+ assert!(
71+ fields.len() >= 9,
72+ "modal()'s own field list looks too short to have been parsed: {fields:?}"
73+ );
6574 // The mounted-surface function each field's own card draws, by the
6675 // convention the param cards already follow (`x_open` -> `x_card(` --
6776 // `Player::eq_card`/`color_card`/... in `ui/cards.rs`). `keys_open` and
@@ -91,7 +100,11 @@ fn every_modal_field_has_a_mounted_surface_somewhere_in_the_darkroom() {
91100 ),
92101 }
93102 };
94- let haystack = format!("{}\n{}", src_text("ui/stance.rs"), src_text("ui/dock_stance.rs"));
103+ let haystack = format!(
104+ "{}\n{}",
105+ src_text("ui/stance.rs"),
106+ src_text("ui/dock_stance.rs")
107+ );
95108 for field in &fields {
96109 let mount = mount_for(field);
97110 assert!(
@@ -249,7 +262,10 @@ fn every_action_is_on_the_actions_card() {
249262 }
250263 // The list scrolls inside a card the smallest window holds, so a
251264 // thirty-fourth action costs no height at all.
252- assert!(rows.len() as f32 * KEYS_ROW_H > KEYS_ROWS_H, "no cap needed?");
265+ assert!(
266+ rows.len() as f32 * KEYS_ROW_H > KEYS_ROWS_H,
267+ "no cap needed?"
268+ );
253269 // Both halves of a row are click targets, so WCAG 2.5.8 binds them.
254270 assert!(KEYS_ROW_H >= HIT_MIN);
255271 }
@@ -458,10 +474,19 @@ fn the_equalizer_graph_puts_a_band_where_a_drag_reads_it_and_fits_the_smallest_w
458474
459475 // The card fits the smallest window and takes the room a bigger one has
460476 // -- it is a graph, and the width *is* the frequency resolution.
461- assert!(eq_card_w(640., false) <= 640. - 24., "card too wide for 640");
462- assert!(eq_card_w(1280., false) > eq_card_w(640., false), "card ignores the window");
477+ assert!(
478+ eq_card_w(640., false) <= 640. - 24.,
479+ "card too wide for 640"
480+ );
481+ assert!(
482+ eq_card_w(1280., false) > eq_card_w(640., false),
483+ "card ignores the window"
484+ );
463485 assert_eq!(eq_card_w(1920., false), EQ_W_MAX, "card grows without end");
464- assert!(eq_card_w(320., false) >= KEYS_W, "card narrower than a row of text");
486+ assert!(
487+ eq_card_w(320., false) >= KEYS_W,
488+ "card narrower than a row of text"
489+ );
465490 // At the smallest window the graph is still a graph: three across for
466491 // one down, so an octave is wide enough to put a handle in.
467492 assert!(
@@ -905,7 +930,10 @@ fn the_clock_stops_where_the_timeline_does_and_the_end_still_restarts() {
905930 let deadline = Instant::now() + Duration::from_secs(20);
906931 let mut state = transport(session.is_playing(), session.is_eos());
907932 while state != Transport::Ended {
908- assert!(Instant::now() < deadline, "never reached the end of a 5s file");
933+ assert!(
934+ Instant::now() < deadline,
935+ "never reached the end of a 5s file"
936+ );
909937 session.tick();
910938 while session.try_frame().is_some() {}
911939 state = transport(session.is_playing(), session.is_eos());
@@ -982,7 +1010,14 @@ fn a_quality_row_is_the_bitrate_it_promises() {
9821010 Some(2_000_000)
9831011 );
9841012 assert_eq!(
985- export_settings(Quality::Medium, 0, mp4, DEFAULT_AUDIO_KBPS, EncoderSeat::Auto).bitrate,
1013+ export_settings(
1014+ Quality::Medium,
1015+ 0,
1016+ mp4,
1017+ DEFAULT_AUDIO_KBPS,
1018+ EncoderSeat::Auto
1019+ )
1020+ .bitrate,
9861021 Some(6_000_000)
9871022 );
9881023 assert_eq!(
@@ -991,7 +1026,14 @@ fn a_quality_row_is_the_bitrate_it_promises() {
9911026 );
9921027 // Megabits as typed, and as the row says it back.
9931028 assert_eq!(
994- export_settings(Quality::Custom, 7, mp4, DEFAULT_AUDIO_KBPS, EncoderSeat::Auto).bitrate,
1029+ export_settings(
1030+ Quality::Custom,
1031+ 7,
1032+ mp4,
1033+ DEFAULT_AUDIO_KBPS,
1034+ EncoderSeat::Auto
1035+ )
1036+ .bitrate,
9951037 Some(7_000_000)
9961038 );
9971039 assert_eq!(Quality::Low.detail(0), "2 Mbps");
@@ -999,7 +1041,14 @@ fn a_quality_row_is_the_bitrate_it_promises() {
9991041 // choice the engine never hears about.
10001042 for format in [Format::Mp4, Format::Wav, Format::Flac] {
10011043 assert_eq!(
1002- export_settings(Quality::Auto, 0, format, DEFAULT_AUDIO_KBPS, EncoderSeat::Auto).format,
1044+ export_settings(
1045+ Quality::Auto,
1046+ 0,
1047+ format,
1048+ DEFAULT_AUDIO_KBPS,
1049+ EncoderSeat::Auto
1050+ )
1051+ .format,
10031052 format
10041053 );
10051054 }
@@ -1008,7 +1057,13 @@ fn a_quality_row_is_the_bitrate_it_promises() {
10081057 // silently changes -- the ceiling row included, which is the one a
10091058 // raised cap could have walked out past.
10101059 for quality in Quality::ALL {
1011- let settings = export_settings(quality, MBPS_MAX, mp4, DEFAULT_AUDIO_KBPS, EncoderSeat::Auto);
1060+ let settings = export_settings(
1061+ quality,
1062+ MBPS_MAX,
1063+ mp4,
1064+ DEFAULT_AUDIO_KBPS,
1065+ EncoderSeat::Auto,
1066+ );
10121067 if let Some(bitrate) = settings.bitrate {
10131068 assert!(
10141069 (u64::from(MBPS_MIN) * 1_000_000..=u64::from(MBPS_MAX) * 1_000_000)
@@ -1144,7 +1199,10 @@ fn a_typed_bitrate_is_a_field_and_not_a_key_capture() {
11441199 // The hint the field shows when there is nothing to refuse names both
11451200 // ways out of it.
11461201 let detail = NumberEdit::new(6).detail();
1147- assert!(detail.contains("enter") && detail.contains("esc"), "{detail}");
1202+ assert!(
1203+ detail.contains("enter") && detail.contains("esc"),
1204+ "{detail}"
1205+ );
11481206 assert!(detail.starts_with("6▏"), "{detail}");
11491207 }
11501208
@@ -1198,10 +1256,7 @@ fn a_held_key_moves_a_value_and_nothing_else() {
11981256 held,
11991257 matches!(
12001258 action,
1201- ActionId::VolumeUp
1202- | ActionId::VolumeDown
1203- | ActionId::ZoomIn
1204- | ActionId::ZoomOut
1259+ ActionId::VolumeUp | ActionId::VolumeDown | ActionId::ZoomIn | ActionId::ZoomOut
12051260 ),
12061261 "{action:?} on a hold"
12071262 );
@@ -1292,10 +1347,7 @@ fn a_choice_list_offers_every_value_and_fits_the_smallest_window() {
12921347 // The media's own size says so: it is the one rung a person cannot read
12931348 // off a number they chose.
12941349 let (.., native_detail, _) = &rows[3];
1295- assert!(
1296- native_detail.contains("the media's own"),
1297- "{native_detail}"
1298- );
1350+ assert!(native_detail.contains("the media's own"), "{native_detail}");
12991351 // A project at a size nobody listed still gets the whole list, with
13001352 // nothing marked rather than a wrong row marked.
13011353 assert!(
@@ -1375,7 +1427,11 @@ fn a_choice_list_offers_every_value_and_fits_the_smallest_window() {
13751427 for format in [Format::Av1, Format::Av1Mp4] {
13761428 assert!(av1_hw_warning(format, EncoderSeat::Hardware).is_some());
13771429 for seat in [EncoderSeat::Auto, EncoderSeat::Software] {
1378- assert_eq!(av1_hw_warning(format, seat), None, "{seat:?} is the safe seat");
1430+ assert_eq!(
1431+ av1_hw_warning(format, seat),
1432+ None,
1433+ "{seat:?} is the safe seat"
1434+ );
13791435 }
13801436 }
13811437 for format in [Format::Mp4, Format::Hevc, Format::HevcMp4, Format::Wav] {
@@ -1411,7 +1467,10 @@ fn a_choice_list_offers_every_value_and_fits_the_smallest_window() {
14111467 fn the_resolution_and_rate_lists_work_before_any_file_is_open() {
14121468 let none = pending_resolution_choices(None);
14131469 assert_eq!(none.len(), RESOLUTIONS.len());
1414- assert!(none.iter().all(|(.., picked)| !picked), "nothing picked yet");
1470+ assert!(
1471+ none.iter().all(|(.., picked)| !picked),
1472+ "nothing picked yet"
1473+ );
14151474 for ((choice, label, detail, _), size) in none.iter().zip(RESOLUTIONS) {
14161475 assert_eq!(*choice, Choice::Size(size.0, size.1));
14171476 assert_eq!(label.as_ref(), format!("{}p", size.1));
@@ -1510,10 +1569,10 @@ fn the_export_card_fits_the_smallest_window() {
15101569 "{id:?}: refusal ink {:.2}",
15111570 contrast(p.FG_SECONDARY, p.BG_RAISED)
15121571 );
1513- // ...and on the picked row, where the highlight is the accent at
1514- // surface brightness. Both inks clear 4.5:1 on it now -- the row still
1515- // lifts its key and detail to `FG_PRIMARY`, as emphasis rather than as
1516- // the rescue it used to be.
1572+ // ...and on the picked row, where the highlight is the accent at
1573+ // surface brightness. Both inks clear 4.5:1 on it now -- the row still
1574+ // lifts its key and detail to `FG_PRIMARY`, as emphasis rather than as
1575+ // the rescue it used to be.
15171576 assert!(contrast(p.FG_PRIMARY, p.BG_SELECTED) >= 4.5, "{id:?}");
15181577 assert!(
15191578 contrast(p.FG_SECONDARY, p.BG_SELECTED) >= 4.5,
@@ -1662,8 +1721,7 @@ fn every_preset_bundle_round_trips_through_from_state() {
16621721 /// dimmed row is ignored.
16631722 #[test]
16641723 fn a_preset_over_a_picture_this_timeline_has_none_of_carries_the_codec_refusal() {
1665- let mut session =
1666- PlaybackSession::open(asset("test_tone.mp3")).expect("a song is a timeline");
1724+ let mut session = PlaybackSession::open(asset("test_tone.mp3")).expect("a song is a timeline");
16671725 session.set_gain(0.0);
16681726 let path = session.sources()[0].path.clone();
16691727 session.seek(1.0);
@@ -1751,18 +1809,26 @@ fn a_cards_own_help_paints_while_the_card_is_open_but_the_ui_under_it_stays_quie
17511809 exemption must not weaken"
17521810 );
17531811 OVERLAID.store(false, Ordering::Relaxed);
1754- assert!(tip_may_paint(false), "with nothing overlaid, an ordinary tip paints too");
1812+ assert!(
1813+ tip_may_paint(false),
1814+ "with nothing overlaid, an ordinary tip paints too"
1815+ );
17551816
17561817 // Structural half: every card routes its head through `dark_card_head`,
17571818 // so checking its one help-tooltip call site covers all seven cards (and
17581819 // any future eighth) at once -- it must build an `OverlayTip`, not a
17591820 // plain `Tip`, or this whole fix is undone by construction.
17601821 let cards_src = src_text("ui/cards.rs");
1761- let head_fn_at = cards_src.find("fn dark_card_head(").expect("dark_card_head");
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];
1822+ let head_fn_at = cards_src
1823+ .find("fn dark_card_head(")
1824+ .expect("dark_card_head");
1825+ // Bound the inspected source by the next item, not a byte count: rustfmt
1826+ // may legitimately reflow this function without moving its tooltip out of
1827+ // scope.
1828+ let head_fn_end = cards_src[head_fn_at..]
1829+ .find("\n/// A ghost action row")
1830+ .expect("dark_card_head's following item");
1831+ let head_fn = &cards_src[head_fn_at..head_fn_at + head_fn_end];
17661832 assert!(
17671833 head_fn.contains("OverlayTip(h.clone())"),
17681834 "dark_card_head's own `?` tooltip no longer builds an OverlayTip -- the \
@@ -1831,8 +1897,8 @@ fn maximizing_a_card_grows_its_box_without_moving_where_a_value_sits_in_it() {
18311897 /// inside the dock, or hands it the dock's width again, fails this.
18321898 #[test]
18331899 fn a_maximized_cards_room_is_bigger_than_the_docked_rooms_not_smaller() {
1834- use crate::layout::{Split, split_size};
18351900 use crate::SPLIT_W;
1901+ use crate::layout::{Split, split_size};
18361902
18371903 // Mirrors `ui/stance.rs`'s private `SPINE_W` (56.) and `layout::SPLIT_W`
18381904 // (the one divider between `stance-centre` and the dock): recomputed
@@ -1934,7 +2000,11 @@ fn a_maximized_card_reopens_exactly_as_left_across_a_restart() {
19342000
19352001 // A file from a future/corrupt version leaves the default in force
19362002 // 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();
2003+ std::fs::write(
2004+ crate::ui::dock_stance::maximized_config_path(),
2005+ "not a bool\n",
2006+ )
2007+ .unwrap();
19382008 assert_eq!(crate::ui::dock_stance::load_maximized(), false);
19392009
19402010 unsafe { std::env::remove_var("XDG_CONFIG_HOME") };
crates/app/src/ui/bench_stance.rsmodified+115 -74
@@ -38,9 +38,9 @@
3838 //! `nudge_cut` and friends still act on `Player::selected` directly, with no
3939 //! element under the pointer required, and stay untouched by any of this.
4040
41-use crate::*;
4241 use crate::ui::type_scale::{self, Typeset};
4342 use crate::ui::widgets::*;
43+use crate::*;
4444
4545 /// The pinned ruler's own height, above the lane stack -- tall enough for a
4646 /// tick line plus a mono `MM:SS` label under it (DESIGN §5's "tick marks with
@@ -53,11 +53,15 @@ const TICK_STOPS: [f64; 13] = [
5353 0.5, 1., 2., 5., 10., 15., 30., 60., 120., 300., 600., 1800., 3600.,
5454 ];
5555 /// The floor a tick's pixel spacing must clear before its label is legible
56-/// mono text at 8px.
56+/// mono text at 10px.
5757 const TICK_MIN_PX: f64 = 64.;
58-/// The playhead timecode plate's own width, wide enough for `HH:MM:SS:FF`
59-/// mono at 10px plus the plate's padding.
60-const PLATE_W: f32 = 74.;
58+/// The playhead timecode plate's own width: eleven mono characters at the
59+/// 14px readout role plus its horizontal padding and a 1px rounding guard,
60+/// derived from the shared list-character calibration so the plate grows with
61+/// its type scale.
62+const PLATE_W: f32 = 11. * crate::layout::LIST_CHAR_W / type_scale::CHORD_METADATA_MIN_PX
63+ * type_scale::CHORD_METADATA_MAX_PX
64+ + 9.;
6165 /// The pinned track-head column, DESIGN §5's "track heads" -- narrower than
6266 /// the legacy timeline's `HEADER_W` since a darkroom lane carries no mix/eye
6367 /// button yet (deferred with the rest of the header's verbs).
@@ -79,10 +83,8 @@ pub(crate) const LANE_DOT_D: f32 = 4.;
7983 /// golden ratio (`gpui::phi()` == `relative(1.618034)`), and `lane_row`
8084 /// never calls `.line_height()` on the head label to override it -- so this
8185 /// is what the label really occupies, not its glyph height.
82-/// round(12. * 1.618034) would be wrong here: the head uses
83-/// `CHORD_METADATA_MIN_PX` (11.), so round(11. * 1.618034) = round(17.798)
84-/// = 18.
85-const LANE_LABEL_LINE_H: f32 = 18.;
86+/// `round(13. * 1.618034) = 21`.
87+const LANE_LABEL_LINE_H: f32 = 21.;
8688 /// The least a lane row may be: what its own head actually draws, not a
8789 /// number copied from nowhere. The old `18.` fit only the label's line box
8890 /// and let every lane's status dot overflow into the row beneath it --
@@ -200,7 +202,9 @@ fn clip_box(
200202 let source = player.sources().get(clip.source);
201203 let label = source.map(|s| file_name(&s.path));
202204 let audio = lane.kind == LaneKind::Audio;
203- let wave = source.and_then(|s| player.waves.get(&(s.path.clone(), s.audio_stream))).cloned();
205+ let wave = source
206+ .and_then(|s| player.waves.get(&(s.path.clone(), s.audio_stream)))
207+ .cloned();
204208 // hook: §12 step 5 -- per-source film ink attaches here, replacing
205209 // `source_tint` (library_meta.rs's own placeholder wheel, index-keyed and
206210 // already different per source) with the source's own quantized hue.
@@ -213,7 +217,10 @@ fn clip_box(
213217 let has_spine = t != Tier::Sliver;
214218 let has_label = matches!(t, Tier::Full | Tier::NoChip);
215219 let has_chip = t == Tier::Full && !clip.speed.is_normal();
216- let (in_frame, out_frame) = (f64::from(clip.in_frame) / player.fps, f64::from(clip.out_frame) / player.fps);
220+ let (in_frame, out_frame) = (
221+ f64::from(clip.in_frame) / player.fps,
222+ f64::from(clip.out_frame) / player.fps,
223+ );
217224 let speed = clip.speed;
218225 // Right-aligned readout: the trim delta off the source's full length when
219226 // this clip is shorter than the file it was cut from, else the plain
@@ -222,7 +229,12 @@ fn clip_box(
222229 // means (§12's cut object has no per-edge history at this layer) --
223230 // ceiling is wiring this to the same cut state once the time band exposes
224231 // it, rather than a second reading of "trim" here.
225- let full_frames = source.map(|s| player.session.as_ref().map_or(0, |sess| sess.file_frames(&s.path)));
232+ let full_frames = source.map(|s| {
233+ player
234+ .session
235+ .as_ref()
236+ .map_or(0, |sess| sess.file_frames(&s.path))
237+ });
226238 let readout = match full_frames {
227239 Some(full) if full > clip.frames() => {
228240 let delta = f64::from(full - clip.frames()) / player.fps;
@@ -234,7 +246,10 @@ fn clip_box(
234246 // is consumed by the name plate below.
235247 let ghost: SharedString = label.clone().unwrap_or_else(|| lane.label()).into();
236248 div()
237- .id(("bench-clip", lane.ord * 1000 + lane.kind as usize * 100 + idx))
249+ .id((
250+ "bench-clip",
251+ lane.ord * 1000 + lane.kind as usize * 100 + idx,
252+ ))
238253 .absolute()
239254 .top_0()
240255 .h_full()
@@ -270,10 +285,17 @@ fn clip_box(
270285 // Dragged, it moves: to the frame and the lane it is let go over
271286 // (`Player::move_clip`, `ClipDrag`) -- the same payload and the same
272287 // ghost tooltip `ui/timeline.rs`'s own clip box drags.
273- .on_drag(ClipDrag { lane, idx, clip: placed }, {
274- let ghost = ghost.clone();
275- move |_, _, _, cx| cx.new(|_| Tip(ghost.clone()))
276- })
288+ .on_drag(
289+ ClipDrag {
290+ lane,
291+ idx,
292+ clip: placed,
293+ },
294+ {
295+ let ghost = ghost.clone();
296+ move |_, _, _, cx| cx.new(|_| Tip(ghost.clone()))
297+ },
298+ )
277299 // The two edge strips a drag lengthens or shortens the clip by
278300 // (`Player::start_trim`), gated on the same `trims(span)` floor the
279301 // legacy strips use -- a clip too narrow to aim at keeps its whole
@@ -330,17 +352,19 @@ fn clip_box(
330352 // (falling back to a flat placeholder body while it loads or if the
331353 // file never yields one).
332354 .when(has_trace && audio, |d| {
333- d.children(wave.and_then(|w| match w {
334- Wave::Peaks(peaks) => Some(
335- div()
336- .absolute()
337- .left(px(3.))
338- .right_0()
339- .top_0()
340- .bottom_0()
341- .child(waveform_ink(peaks, in_frame, out_frame, ink)),
342- ),
343- _ => None,
355+ d.children(wave.and_then(|w| {
356+ match w {
357+ Wave::Peaks(peaks) => Some(
358+ div()
359+ .absolute()
360+ .left(px(3.))
361+ .right_0()
362+ .top_0()
363+ .bottom_0()
364+ .child(waveform_ink(peaks, in_frame, out_frame, ink)),
365+ ),
366+ _ => None,
367+ }
344368 }))
345369 })
346370 .when(has_trace && !audio, |d| {
@@ -361,7 +385,8 @@ fn clip_box(
361385 })
362386 // Name plate + trim/duration readout: one strip, DESIGN §4's plate
363387 // (canvas-on-panel), sat at the clip's top-left/top-right per the mock
364- // rather than the name alone hanging below the box.
388+ // rather than the name alone hanging below the box. Its 21px height is
389+ // the metadata role's default phi() line box, not its 13px glyph size.
365390 .when(has_label, |d| {
366391 d.child(
367392 div()
@@ -369,7 +394,7 @@ fn clip_box(
369394 .left(px(3.))
370395 .right_0()
371396 .top_0()
372- .h(px(13.))
397+ .h(px(LANE_LABEL_LINE_H))
373398 .px(px(3.))
374399 .flex()
375400 .items_center()
@@ -392,7 +417,10 @@ fn clip_box(
392417 .child(
393418 div()
394419 .flex_none()
395- .type_style(type_scale::mono(9., gpui::FontWeight::MEDIUM))
420+ .type_style(type_scale::mono(
421+ type_scale::FLOOR_PX,
422+ gpui::FontWeight::MEDIUM,
423+ ))
396424 .text_color(rgb(INK3()))
397425 .child(readout),
398426 ),
@@ -408,7 +436,10 @@ fn clip_box(
408436 .right_0()
409437 .px(px(3.))
410438 .bg(rgb(DARK_RAISED()))
411- .type_style(type_scale::mono(9., gpui::FontWeight::MEDIUM))
439+ .type_style(type_scale::mono(
440+ type_scale::FLOOR_PX,
441+ gpui::FontWeight::MEDIUM,
442+ ))
412443 .text_color(rgb(INK2()))
413444 .child(format!("{speed}")),
414445 )
@@ -458,7 +489,10 @@ fn sub_box(
458489 // (`PlaybackSession::sub_lane_cues`, the same map the export and the
459490 // picture's own plate go through).
460491 let cues: Vec<(f32, f32)> = player.session.as_ref().map_or_else(Vec::new, |s| {
461- s.sub_lane_cues(lane).iter().map(|cue| cue_box(scale, cue)).collect()
492+ s.sub_lane_cues(lane)
493+ .iter()
494+ .map(|cue| cue_box(scale, cue))
495+ .collect()
462496 });
463497 let label = player
464498 .session
@@ -490,10 +524,17 @@ fn sub_box(
490524 this.open_menu(lane, idx, event.position, cx);
491525 }),
492526 )
493- .on_drag(SubDrag { lane, idx, sub: placed }, {
494- let ghost = ghost.clone();
495- move |_, _, _, cx| cx.new(|_| Tip(ghost.clone()))
496- })
527+ .on_drag(
528+ SubDrag {
529+ lane,
530+ idx,
531+ sub: placed,
532+ },
533+ {
534+ let ghost = ghost.clone();
535+ move |_, _, _, cx| cx.new(|_| Tip(ghost.clone()))
536+ },
537+ )
497538 // The same edge-trim strips a clip gets, on the same [`trims`] floor.
498539 .children(
499540 [Edge::Start, Edge::End]
@@ -681,15 +722,15 @@ fn lane_row(
681722 // pointer actually being inside this bed's own bounds, since
682723 // `on_drag_move` fires on every painted element of the drag's
683724 // type, not just the one under the pointer.
684- .on_drag_move(cx.listener(
685- move |this, event: &DragMoveEvent<AssetDrag>, _, cx| {
725+ .on_drag_move(
726+ cx.listener(move |this, event: &DragMoveEvent<AssetDrag>, _, cx| {
686727 if !event.bounds.contains(&event.event.position) {
687728 return;
688729 }
689730 let path = event.drag(cx).0.clone();
690731 this.preview_ghost_asset(&path, lane, event.event.position.x, cx);
691- },
692- ))
732+ }),
733+ )
693734 .drag_over::<ClipDrag>(|d, _, _, _| d.bg(rgb(DARK_RAISED())))
694735 .on_drop(cx.listener(move |this, drag: &ClipDrag, window, cx| {
695736 let Some(idx) = this.dragged(drag) else {
@@ -697,15 +738,15 @@ fn lane_row(
697738 };
698739 this.move_clip(drag.lane, idx, lane, window.mouse_position().x, cx)
699740 }))
700- .on_drag_move(cx.listener(
701- move |this, event: &DragMoveEvent<ClipDrag>, _, cx| {
741+ .on_drag_move(
742+ cx.listener(move |this, event: &DragMoveEvent<ClipDrag>, _, cx| {
702743 if !event.bounds.contains(&event.event.position) {
703744 return;
704745 }
705746 let drag = *event.drag(cx);
706747 this.preview_ghost(&drag, lane, event.event.position.x, cx);
707- },
708- ))
748+ }),
749+ )
709750 // A caption already on a lane moves along it, or onto another
710751 // subtitle track, exactly as a clip does (`Player::move_sub`,
711752 // the same call `ui/timeline.rs`'s own bed makes).
@@ -713,25 +754,25 @@ fn lane_row(
713754 .on_drop(cx.listener(move |this, drag: &SubDrag, window, cx| {
714755 this.move_sub(drag, lane, window.mouse_position().x, cx);
715756 }))
716- .on_drag_move(cx.listener(
717- move |this, event: &DragMoveEvent<SubDrag>, _, cx| {
757+ .on_drag_move(
758+ cx.listener(move |this, event: &DragMoveEvent<SubDrag>, _, cx| {
718759 if !event.bounds.contains(&event.event.position) {
719760 return;
720761 }
721762 let drag = *event.drag(cx);
722763 this.preview_ghost_sub(&drag, lane, event.event.position.x, cx);
723- },
724- ))
764+ }),
765+ )
725766 .drag_over::<SubPick>(|d, _, _, _| d.bg(rgb(DARK_RAISED())))
726- .on_drag_move(cx.listener(
727- move |this, event: &DragMoveEvent<SubPick>, _, cx| {
767+ .on_drag_move(
768+ cx.listener(move |this, event: &DragMoveEvent<SubPick>, _, cx| {
728769 if !event.bounds.contains(&event.event.position) {
729770 return;
730771 }
731772 let track = event.drag(cx).0;
732773 this.preview_ghost_pick(track, lane, event.event.position.x, cx);
733- },
734- ))
774+ }),
775+ )
735776 // The wheel, matched to the legacy timeline's own mapping:
736777 // ctrl+wheel zooms about the pointer, a bare wheel scrolls
737778 // the bed along the film (`Player::timeline_wheel`). Stopped
@@ -793,7 +834,11 @@ fn lane_row(
793834
794835 /// The bench's content: pinned ruler, pinned heads, lane stack -- compressed
795836 /// evenly to [`LANES_COMPRESS`] rows and then scrolling (DESIGN §7).
796-pub(crate) fn render(player: &mut Player, box_h: f32, cx: &mut Context<Player>) -> impl IntoElement {
837+pub(crate) fn render(
838+ player: &mut Player,
839+ box_h: f32,
840+ cx: &mut Context<Player>,
841+) -> impl IntoElement {
797842 let lanes = player
798843 .session
799844 .as_ref()
@@ -869,26 +914,22 @@ pub(crate) fn render(player: &mut Player, box_h: f32, cx: &mut Context<Player>)
869914 this.timeline_wheel(event, cx);
870915 }))
871916 .children(ticks.into_iter().map(|(x, label)| {
872- div()
873- .absolute()
874- .top_0()
875- .left(px(x))
876- .child(
877- div()
878- .flex()
879- .flex_col()
880- .items_start()
881- .child(div().w(px(1.)).h(px(4.)).bg(rgb(INK3())))
882- .child(
883- div()
884- .type_style(type_scale::mono(
885- type_scale::FLOOR_PX,
886- gpui::FontWeight::MEDIUM,
887- ))
888- .text_color(rgb(INK3()))
889- .child(label),
890- ),
891- )
917+ div().absolute().top_0().left(px(x)).child(
918+ div()
919+ .flex()
920+ .flex_col()
921+ .items_start()
922+ .child(div().w(px(1.)).h(px(4.)).bg(rgb(INK3())))
923+ .child(
924+ div()
925+ .type_style(type_scale::mono(
926+ type_scale::FLOOR_PX,
927+ gpui::FontWeight::MEDIUM,
928+ ))
929+ .text_color(rgb(INK3()))
930+ .child(label),
931+ ),
932+ )
892933 }))
893934 .child(
894935 div()
crates/app/src/ui/cards.rsmodified+640 -399
@@ -1,8 +1,8 @@
11 //! The property cards -- docked into the inspector, or floated when modal.
22
3-use crate::*;
43 use crate::ui::type_scale::{self, Typeset};
54 use crate::ui::widgets::*;
5+use crate::*;
66
77 /// DESIGN §3/§4 atoms shared by every param/setting card below (colour,
88 /// transform, speed, EQ, silence, mix, subtitle style): what a row's label
@@ -11,11 +11,14 @@ use crate::ui::widgets::*;
1111 /// times (`export_card`'s own `dark`-branch technique, one level up).
1212 ///
1313 /// A row label is what the room says about the control -- Archivo, §3's
14-/// 10.5px row size, `ink2` at rest / `ink1` picked (no permanent pill: the
14+/// label-row size, `ink2` at rest / `ink1` picked (no permanent pill: the
1515 /// picked state is a 1px `ink1` rule, §4's focus ring, not a fill).
1616 fn dark_row_label(text: impl Into<SharedString>, picked: bool) -> Div {
1717 div()
18- .type_style(type_scale::label(type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM))
18+ .type_style(type_scale::label(
19+ type_scale::LABEL_ROW_PX,
20+ gpui::FontWeight::MEDIUM,
21+ ))
1922 .text_color(rgb(if picked { INK1() } else { INK2() }))
2023 .child(text.into())
2124 }
@@ -38,7 +41,10 @@ fn transform_row_value(band: usize, value: f32) -> String {
3841 /// A row's value -- what the film/the setting *says*, mono per §3.
3942 fn dark_row_value(text: impl Into<SharedString>) -> Div {
4043 div()
41- .type_style(type_scale::mono(type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM))
44+ .type_style(type_scale::mono(
45+ type_scale::LABEL_ROW_PX,
46+ gpui::FontWeight::MEDIUM,
47+ ))
4248 .text_color(rgb(INK1()))
4349 .child(text.into())
4450 }
@@ -95,15 +101,24 @@ fn dark_card_head(
95101 .id("card-head-maximize")
96102 .flex_none()
97103 .cursor_pointer()
98- .type_style(type_scale::mono(type_scale::CHORD_METADATA_MAX_PX, gpui::FontWeight::MEDIUM))
104+ .type_style(type_scale::mono(
105+ type_scale::CHORD_METADATA_MAX_PX,
106+ gpui::FontWeight::MEDIUM,
107+ ))
99108 .text_color(rgb(INK3()))
100109 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
101110 this.toggle_maximize();
102111 cx.notify();
103112 }))
104113 .tooltip(move |_, cx| {
105- cx.new(|_| OverlayTip(if max { "m -- back to the room".into() } else { "m -- fills the room".into() }))
106- .into()
114+ cx.new(|_| {
115+ OverlayTip(if max {
116+ "m -- back to the room".into()
117+ } else {
118+ "m -- fills the room".into()
119+ })
120+ })
121+ .into()
107122 })
108123 .child(if max { "▣ m" } else { "⤢ m" })
109124 }))
@@ -115,7 +130,10 @@ fn dark_card_head(
115130 )
116131 .children(meta.map(|m| {
117132 div()
118- .type_style(type_scale::mono(type_scale::CHORD_METADATA_MAX_PX, gpui::FontWeight::MEDIUM))
133+ .type_style(type_scale::mono(
134+ type_scale::CHORD_METADATA_MAX_PX,
135+ gpui::FontWeight::MEDIUM,
136+ ))
119137 .text_color(rgb(INK3()))
120138 .child(m)
121139 }))
@@ -123,7 +141,10 @@ fn dark_card_head(
123141 div()
124142 .id("card-head-help")
125143 .flex_none()
126- .type_style(type_scale::mono(type_scale::CHORD_METADATA_MAX_PX, gpui::FontWeight::MEDIUM))
144+ .type_style(type_scale::mono(
145+ type_scale::CHORD_METADATA_MAX_PX,
146+ gpui::FontWeight::MEDIUM,
147+ ))
127148 .text_color(rgb(INK3()))
128149 .tooltip(move |_, cx| cx.new(|_| OverlayTip(h.clone())).into())
129150 .child("?")
@@ -136,7 +157,10 @@ fn dark_help(text: impl Into<SharedString>) -> Div {
136157 div()
137158 .flex_none()
138159 .px(px(6.))
139- .type_style(type_scale::mono(type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM))
160+ .type_style(type_scale::mono(
161+ type_scale::LABEL_ROW_PX,
162+ gpui::FontWeight::MEDIUM,
163+ ))
140164 .text_color(rgb(INK3()))
141165 .child(text.into())
142166 }
@@ -192,7 +216,10 @@ fn dark_ghost_button(
192216 .on_click(on_click)
193217 .child(
194218 div()
195- .type_style(type_scale::label(type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM))
219+ .type_style(type_scale::label(
220+ type_scale::LABEL_ROW_PX,
221+ gpui::FontWeight::MEDIUM,
222+ ))
196223 .text_color(rgb(if active { INK1() } else { INK2() }))
197224 .child(text.into()),
198225 )
@@ -260,8 +287,11 @@ impl Player {
260287 let bg_selected = if dark { DARK_RAISED() } else { BG_SELECTED() };
261288 // Archivo for what the row *says as a verb* (its label), mono for
262289 // what the film says through it (its detail/key) -- DESIGN §3.
263- let font_label = dark.then(|| type_scale::label(11., gpui::FontWeight::MEDIUM).font);
264- let font_mono = dark.then(|| type_scale::mono(11., gpui::FontWeight::MEDIUM).font);
290+ let label_style =
291+ dark.then(|| type_scale::label(type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM));
292+ let mono_style = dark
293+ .then(|| type_scale::mono(type_scale::CHORD_METADATA_MAX_PX, gpui::FontWeight::MEDIUM));
294+ let head_style = dark.then(type_scale::head);
265295 let row = |id: (&'static str, usize)| {
266296 div()
267297 .id(id)
@@ -287,7 +317,9 @@ impl Player {
287317 d.when(!enabled, |d| {
288318 d.cursor_not_allowed().text_color(rgb(ink_secondary))
289319 })
290- .when(enabled, |d| d.cursor_pointer().hover(|s| s.bg(rgb(bg_hover))))
320+ .when(enabled, |d| {
321+ d.cursor_pointer().hover(|s| s.bg(rgb(bg_hover)))
322+ })
291323 };
292324 // A row as this card writes them: the mark saying which one is picked,
293325 // the key that picks it, its name, and what the choice means. The mark
@@ -324,12 +356,16 @@ impl Player {
324356 .w(px(EXPORT_KEY_W))
325357 .text_size(px(11.))
326358 .text_color(rgb(ink))
327- .when_some(font_mono.clone(), |d, f| d.font(f))
359+ .when_some(mono_style.clone(), |d, style| {
360+ d.font(style.font).text_size(style.size)
361+ })
328362 .child(SharedString::from(key.to_string())),
329363 )
330364 .child(
331365 div()
332- .when_some(font_label.clone(), |d, f| d.font(f))
366+ .when_some(label_style.clone(), |d, style| {
367+ d.font(style.font).text_size(style.size)
368+ })
333369 .child(label),
334370 ),
335371 )
@@ -342,7 +378,9 @@ impl Player {
342378 .flex_shrink()
343379 .text_size(px(11.))
344380 .text_color(rgb(ink))
345- .when_some(font_mono.clone(), |d, f| d.font(f))
381+ .when_some(mono_style.clone(), |d, style| {
382+ d.font(style.font).text_size(style.size)
383+ })
346384 .child(detail),
347385 )
348386 };
@@ -353,7 +391,9 @@ impl Player {
353391 .pt(px(4.))
354392 .text_size(px(10.))
355393 .text_color(rgb(ink_secondary))
356- .when_some(font_label.clone(), |d, f| d.font(f))
394+ .when_some(head_style.clone(), |d, style| {
395+ d.font(style.font).text_size(style.size)
396+ })
357397 .child(text)
358398 .into_any_element()
359399 };
@@ -383,9 +423,11 @@ impl Player {
383423 // rows already carry: dimmed, unclickable, its reason in place of
384424 // the detail -- not bright and pickable over a click that would
385425 // only bounce off `set_format`'s own guard.
386- let refusal = preset
387- .bundle()
388- .and_then(|(format, _)| self.session.as_ref().and_then(|s| format_refusal(s, format)));
426+ let refusal = preset.bundle().and_then(|(format, _)| {
427+ self.session
428+ .as_ref()
429+ .and_then(|s| format_refusal(s, format))
430+ });
389431 let detail: SharedString = match &refusal {
390432 Some(why) => why.clone().into(),
391433 None => preset.detail().into(),
@@ -409,8 +451,9 @@ impl Player {
409451 let advanced_detail = match self.export_advanced_open {
410452 true => "codec, container, quality, sound, encoder, subtitles — s collapses them"
411453 .to_string(),
412- false => "codec, container, quality, sound, encoder, subtitles — s for the rows"
413- .to_string(),
454+ false => {
455+ "codec, container, quality, sound, encoder, subtitles — s for the rows".to_string()
456+ }
414457 };
415458 list.push(
416459 entry(
@@ -433,313 +476,327 @@ impl Player {
433476 // it built exactly as the flat card built it, only not pushed at all
434477 // while the pane is shut.
435478 if self.export_advanced_open {
436- if self.export_grouped {
437- list.push(header("FORMAT"));
438- }
439- // The codecs first: which one is being written decides whether every
440- // row under it means anything. One a *this* timeline cannot be written
441- // as (an audio-only edit, for a picture codec) reads exactly like one
442- // there is no encoder for -- dimmed, unclickable, and carrying its own
443- // reason where its detail was, with nothing to click to find that out.
444- let mut refusals: Vec<String> = Vec::new();
445- for (i, (boxes, key, label, detail)) in FORMATS.into_iter().enumerate() {
446- let format = same_box(boxes, self.format);
447- let refused = format
448- .zip(self.session.as_ref())
449- .and_then(|(f, s)| format_refusal(s, f));
450- // A codec with no encoder here at all is the other kind of refusal,
451- // and the one the footer collects: it can never become pickable, so
452- // a row each is dead rows above the fold.
453- if format.is_none() {
454- refusals.push(format!("{label} — {detail}"));
455- if !self.export_refusals_inline {
456- continue;
479+ if self.export_grouped {
480+ list.push(header("FORMAT"));
481+ }
482+ // The codecs first: which one is being written decides whether every
483+ // row under it means anything. One a *this* timeline cannot be written
484+ // as (an audio-only edit, for a picture codec) reads exactly like one
485+ // there is no encoder for -- dimmed, unclickable, and carrying its own
486+ // reason where its detail was, with nothing to click to find that out.
487+ let mut refusals: Vec<String> = Vec::new();
488+ for (i, (boxes, key, label, detail)) in FORMATS.into_iter().enumerate() {
489+ let format = same_box(boxes, self.format);
490+ let refused = format
491+ .zip(self.session.as_ref())
492+ .and_then(|(f, s)| format_refusal(s, f));
493+ // A codec with no encoder here at all is the other kind of refusal,
494+ // and the one the footer collects: it can never become pickable, so
495+ // a row each is dead rows above the fold.
496+ if format.is_none() {
497+ refusals.push(format!("{label} — {detail}"));
498+ if !self.export_refusals_inline {
499+ continue;
500+ }
501+ }
502+ let detail: SharedString = match &refused {
503+ Some(why) => why.clone().into(),
504+ None => detail.into(),
505+ };
506+ let format = format.filter(|_| refused.is_none());
507+ let mut r = entry(
508+ ("format", i),
509+ key,
510+ label.into(),
511+ detail,
512+ boxes.contains(&self.format),
513+ format.is_some(),
514+ );
515+ if let Some(format) = format {
516+ r = r.on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
517+ this.set_format(format);
518+ cx.notify();
519+ }));
457520 }
521+ list.push(r.into_any_element());
458522 }
459- let detail: SharedString = match &refused {
460- Some(why) => why.clone().into(),
461- None => detail.into(),
462- };
463- let format = format.filter(|_| refused.is_none());
523+ if self.export_grouped {
524+ list.push(header("DETAILS"));
525+ }
526+ // The container, and only where the picked codec has more than one box:
527+ // a row offering a single choice reads as a choice.
528+ let boxes = containers(self.format);
529+ if boxes.len() > 1 {
530+ let next = next_container(self.format);
531+ list.push(
532+ entry(
533+ ("container", 0),
534+ "c",
535+ "Container".into(),
536+ format!(
537+ "{} — c for {}",
538+ self.format.ext().to_uppercase(),
539+ next.ext().to_uppercase()
540+ )
541+ .into(),
542+ false,
543+ true,
544+ )
545+ .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
546+ this.cycle_container();
547+ cx.notify();
548+ }))
549+ .into_any_element(),
550+ );
551+ }
552+ match bitrate_refusal(self.format) {
553+ // One dimmed row carrying the reason, rather than five rows of a
554+ // figure that will not be written: the quality rows are the
555+ // *picture's* bitrate, and this file has no picture in it.
556+ Some(why) => list.push(
557+ entry(
558+ ("quality", 0),
559+ "q",
560+ "Quality".into(),
561+ why.into(),
562+ false,
563+ false,
564+ )
565+ .into_any_element(),
566+ ),
567+ None => {
568+ for (i, quality) in Quality::ALL.into_iter().enumerate() {
569+ // The custom row is a field: `n` opens it, a click in it
570+ // opens it too, and while it is open the row shows what is
571+ // being typed with a caret in it rather than the number in
572+ // force. The other four are picked whole.
573+ let field = self
574+ .mbps_edit
575+ .as_ref()
576+ .filter(|_| quality == Quality::Custom);
577+ let mut r = entry(
578+ ("quality", i),
579+ match quality {
580+ Quality::Custom => "n",
581+ _ => "q",
582+ },
583+ quality.label().into(),
584+ match field {
585+ Some(edit) => edit.detail().into(),
586+ None => quality.detail(self.custom_mbps).into(),
587+ },
588+ self.quality == quality,
589+ true,
590+ )
591+ .on_click(cx.listener(
592+ move |this, _: &ClickEvent, _, cx| {
593+ match quality {
594+ Quality::Custom => this.edit_mbps(),
595+ _ => this.quality = quality,
596+ }
597+ cx.notify();
598+ },
599+ ));
600+ if quality == Quality::Custom {
601+ // The wheel anywhere over the row moves the number, the
602+ // buttons being one step each: the range is fifty wide
603+ // now, and a number only a repeated press can walk to is
604+ // a number nobody walks to. Swallowed, so the notch that
605+ // moved the bitrate does not scroll the list under it as
606+ // well -- one gesture, one thing changed.
607+ r = r
608+ .on_scroll_wheel(cx.listener(
609+ |this, event: &ScrollWheelEvent, _, cx| {
610+ this.wheel_mbps(event);
611+ cx.stop_propagation();
612+ cx.notify();
613+ },
614+ ))
615+ .child(self.mbps_steppers(cx));
616+ }
617+ list.push(r.into_any_element());
618+ }
619+ }
620+ }
621+ // The other half of the file, and the one this card used to write at a
622+ // fixed rate without saying so: what the *sound* is coded at, for every
623+ // format that codes it -- the AAC inside a video export as much as an
624+ // MP3. Four rates, so the pointer gets the *list* of them
625+ // ([`Pick::AudioRate`]) rather than a button clicked round -- the
626+ // resolution row's rule, and the key still steps as `ctrl+r` still
627+ // does. Dimmed with the reason where this timeline has no rate to pick,
628+ // like the quality rows are.
629+ let sound = self.audio_rate_refusal();
464630 let mut r = entry(
465- ("format", i),
466- key,
467- label.into(),
468- detail,
469- boxes.contains(&self.format),
470- format.is_some(),
631+ ("sound", 0),
632+ "b",
633+ "Sound".into(),
634+ match sound {
635+ Some(why) => why.into(),
636+ None => format!("{} kbps — b steps", self.audio_kbps).into(),
637+ },
638+ false,
639+ sound.is_none(),
471640 );
472- if let Some(format) = format {
473- r = r.on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
474- this.set_format(format);
475- cx.notify();
641+ if sound.is_none() {
642+ r = r.on_click(cx.listener(|this, event: &ClickEvent, _, cx| {
643+ this.open_picker(Pick::AudioRate, event.position(), cx)
476644 }));
477645 }
478646 list.push(r.into_any_element());
479- }
480- if self.export_grouped {
481- list.push(header("DETAILS"));
482- }
483- // The container, and only where the picked codec has more than one box:
484- // a row offering a single choice reads as a choice.
485- let boxes = containers(self.format);
486- if boxes.len() > 1 {
487- let next = next_container(self.format);
647+ // Which encoder writes the picture, which was an env pin and therefore
648+ // no choice at all. Three seats, so the pointer gets the *list* of them
649+ // ([`Pick::Encoder`]) and never a button clicked round -- the Sound
650+ // row's rule, one row above. Only where there is a picture to encode:
651+ // a WAV has no seat to pick and the row would be a question about
652+ // nothing.
653+ if self.format.has_video() {
654+ let seat = self.encoder_seat();
655+ list.push(
656+ entry(
657+ ("encoder", 0),
658+ "e",
659+ "Encoder".into(),
660+ format!("{} — e steps", encoder_label(seat)).into(),
661+ false,
662+ true,
663+ )
664+ .on_click(cx.listener(|this, event: &ClickEvent, _, cx| {
665+ this.open_picker(Pick::Encoder, event.position(), cx)
666+ }))
667+ .into_any_element(),
668+ );
669+ // ...and, under it, the one thing about that pick a person cannot
670+ // know from the words in the list: this box's driver reset itself
671+ // on the vendored AV1 encoder. A dimmed row and not a modal -- the
672+ // pick is theirs, and the export runs.
673+ if let Some(warning) = av1_hw_warning(self.format, seat) {
674+ list.push(
675+ entry(
676+ ("encoder-av1", 0),
677+ "",
678+ "".into(),
679+ warning.into(),
680+ false,
681+ false,
682+ )
683+ .into_any_element(),
684+ );
685+ }
686+ }
687+ // What happens to the subtitles on this timeline, in one line: how many
688+ // are written into the file and under what names, or the reason each one
689+ // is not. Which tracks travel is not a pick -- everything with a cue on
690+ // the timeline goes ([`Player::export_subs`]) -- so the row says rather
691+ // than offers, like the machine lines below.
692+ // ...and the ones that do not travel are named here too, which they were
693+ // not: `export_subs` had already filtered a track with no cue on *this*
694+ // timeline out of the engine's sight, so the card said nothing about a
695+ // row the list was still showing ([`subtitle_plan`]).
696+ let plan = self.subtitle_line();
697+ // The row used to end in "click for <fmt> in MKV" whenever the picture
698+ // was going into an mp4, on the grounds that only Matroska carries a
699+ // text track. An mp4 carries one now (`Mp4Muxer::write_subtitles` writes
700+ // `tx3g`), so that was a refusal offering a way out of nothing: the
701+ // container the card is already set to embeds them. The refusals left in
702+ // `planned_subtitles` are the true ones -- a sound-only format has
703+ // nowhere to put a track, and a PGS track is pictures whatever the box.
488704 list.push(
489705 entry(
490- ("container", 0),
491- "c",
492- "Container".into(),
493- format!(
494- "{} — c for {}",
495- self.format.ext().to_uppercase(),
496- next.ext().to_uppercase()
497- )
498- .into(),
706+ ("subtitles", 0),
707+ "",
708+ "Subtitles".into(),
709+ plan.into(),
710+ false,
499711 false,
712+ )
713+ .into_any_element(),
714+ );
715+ // The card's own two layout switches. They were `g` and `r` and nothing
716+ // else, while the status line under the title advertised both of them:
717+ // a hand on the mouse read what they do and had nothing to press.
718+ list.push(
719+ entry(
720+ ("export-layout", 0),
721+ "g",
722+ "Layout".into(),
723+ match self.export_grouped {
724+ true => "sections — g for one flat list".into(),
725+ false => "one flat list — g for sections".into(),
726+ },
727+ self.export_grouped,
500728 true,
501729 )
502730 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
503- this.cycle_container();
731+ this.export_grouped = !this.export_grouped;
504732 cx.notify();
505733 }))
506734 .into_any_element(),
507735 );
508- }
509- match bitrate_refusal(self.format) {
510- // One dimmed row carrying the reason, rather than five rows of a
511- // figure that will not be written: the quality rows are the
512- // *picture's* bitrate, and this file has no picture in it.
513- Some(why) => list.push(
514- entry(
515- ("quality", 0),
516- "q",
517- "Quality".into(),
518- why.into(),
519- false,
520- false,
521- )
522- .into_any_element(),
523- ),
524- None => {
525- for (i, quality) in Quality::ALL.into_iter().enumerate() {
526- // The custom row is a field: `n` opens it, a click in it
527- // opens it too, and while it is open the row shows what is
528- // being typed with a caret in it rather than the number in
529- // force. The other four are picked whole.
530- let field = self.mbps_edit.as_ref().filter(|_| quality == Quality::Custom);
531- let mut r = entry(
532- ("quality", i),
533- match quality {
534- Quality::Custom => "n",
535- _ => "q",
536- },
537- quality.label().into(),
538- match field {
539- Some(edit) => edit.detail().into(),
540- None => quality.detail(self.custom_mbps).into(),
541- },
542- self.quality == quality,
543- true,
544- )
545- .on_click(cx.listener(
546- move |this, _: &ClickEvent, _, cx| {
547- match quality {
548- Quality::Custom => this.edit_mbps(),
549- _ => this.quality = quality,
550- }
551- cx.notify();
552- },
553- ));
554- if quality == Quality::Custom {
555- // The wheel anywhere over the row moves the number, the
556- // buttons being one step each: the range is fifty wide
557- // now, and a number only a repeated press can walk to is
558- // a number nobody walks to. Swallowed, so the notch that
559- // moved the bitrate does not scroll the list under it as
560- // well -- one gesture, one thing changed.
561- r = r
562- .on_scroll_wheel(cx.listener(
563- |this, event: &ScrollWheelEvent, _, cx| {
564- this.wheel_mbps(event);
565- cx.stop_propagation();
566- cx.notify();
567- },
568- ))
569- .child(self.mbps_steppers(cx));
570- }
571- list.push(r.into_any_element());
572- }
573- }
574- }
575- // The other half of the file, and the one this card used to write at a
576- // fixed rate without saying so: what the *sound* is coded at, for every
577- // format that codes it -- the AAC inside a video export as much as an
578- // MP3. Four rates, so the pointer gets the *list* of them
579- // ([`Pick::AudioRate`]) rather than a button clicked round -- the
580- // resolution row's rule, and the key still steps as `ctrl+r` still
581- // does. Dimmed with the reason where this timeline has no rate to pick,
582- // like the quality rows are.
583- let sound = self.audio_rate_refusal();
584- let mut r = entry(
585- ("sound", 0),
586- "b",
587- "Sound".into(),
588- match sound {
589- Some(why) => why.into(),
590- None => format!("{} kbps — b steps", self.audio_kbps).into(),
591- },
592- false,
593- sound.is_none(),
594- );
595- if sound.is_none() {
596- r = r.on_click(cx.listener(|this, event: &ClickEvent, _, cx| {
597- this.open_picker(Pick::AudioRate, event.position(), cx)
598- }));
599- }
600- list.push(r.into_any_element());
601- // Which encoder writes the picture, which was an env pin and therefore
602- // no choice at all. Three seats, so the pointer gets the *list* of them
603- // ([`Pick::Encoder`]) and never a button clicked round -- the Sound
604- // row's rule, one row above. Only where there is a picture to encode:
605- // a WAV has no seat to pick and the row would be a question about
606- // nothing.
607- if self.format.has_video() {
608- let seat = self.encoder_seat();
609736 list.push(
610737 entry(
611- ("encoder", 0),
612- "e",
613- "Encoder".into(),
614- format!("{} — e steps", encoder_label(seat)).into(),
615- false,
738+ ("export-refusals", 0),
739+ "r",
740+ "Codecs with no encoder".into(),
741+ match self.export_refusals_inline {
742+ true => "a dimmed row each — r collapses them".into(),
743+ false => "one line at the foot — r shows a row each".into(),
744+ },
745+ self.export_refusals_inline,
616746 true,
617747 )
618- .on_click(cx.listener(|this, event: &ClickEvent, _, cx| {
619- this.open_picker(Pick::Encoder, event.position(), cx)
748+ .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
749+ this.export_refusals_inline = !this.export_refusals_inline;
750+ cx.notify();
620751 }))
621752 .into_any_element(),
622753 );
623- // ...and, under it, the one thing about that pick a person cannot
624- // know from the words in the list: this box's driver reset itself
625- // on the vendored AV1 encoder. A dimmed row and not a modal -- the
626- // pick is theirs, and the export runs.
627- if let Some(warning) = av1_hw_warning(self.format, seat) {
754+ if !self.export_refusals_inline && !refusals.is_empty() {
755+ // Last, and one line: the reason travels with the name (a footer
756+ // that only listed them would be the "why not?" the rows exist to
757+ // answer), but nothing here can ever be picked, so it sits under
758+ // every row that can rather than above them.
628759 list.push(
629- entry(("encoder-av1", 0), "", "".into(), warning.into(), false, false)
760+ div()
761+ .flex_none()
762+ .px(px(6.))
763+ .py(px(2.))
764+ .text_size(px(11.))
765+ .text_color(rgb(ink_secondary))
766+ .when_some(mono_style.clone(), |d, style| {
767+ d.font(style.font).text_size(style.size)
768+ })
769+ .child(format!("cannot write: {}", refusals.join(" · ")))
630770 .into_any_element(),
631771 );
632772 }
633- }
634- // What happens to the subtitles on this timeline, in one line: how many
635- // are written into the file and under what names, or the reason each one
636- // is not. Which tracks travel is not a pick -- everything with a cue on
637- // the timeline goes ([`Player::export_subs`]) -- so the row says rather
638- // than offers, like the machine lines below.
639- // ...and the ones that do not travel are named here too, which they were
640- // not: `export_subs` had already filtered a track with no cue on *this*
641- // timeline out of the engine's sight, so the card said nothing about a
642- // row the list was still showing ([`subtitle_plan`]).
643- let plan = self.subtitle_line();
644- // The row used to end in "click for <fmt> in MKV" whenever the picture
645- // was going into an mp4, on the grounds that only Matroska carries a
646- // text track. An mp4 carries one now (`Mp4Muxer::write_subtitles` writes
647- // `tx3g`), so that was a refusal offering a way out of nothing: the
648- // container the card is already set to embeds them. The refusals left in
649- // `planned_subtitles` are the true ones -- a sound-only format has
650- // nowhere to put a track, and a PGS track is pictures whatever the box.
651- list.push(
652- entry(
653- ("subtitles", 0),
654- "",
655- "Subtitles".into(),
656- plan.into(),
657- false,
658- false,
659- )
660- .into_any_element(),
661- );
662- // The card's own two layout switches. They were `g` and `r` and nothing
663- // else, while the status line under the title advertised both of them:
664- // a hand on the mouse read what they do and had nothing to press.
665- list.push(
666- entry(
667- ("export-layout", 0),
668- "g",
669- "Layout".into(),
670- match self.export_grouped {
671- true => "sections — g for one flat list".into(),
672- false => "one flat list — g for sections".into(),
673- },
674- self.export_grouped,
675- true,
676- )
677- .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
678- this.export_grouped = !this.export_grouped;
679- cx.notify();
680- }))
681- .into_any_element(),
682- );
683- list.push(
684- entry(
685- ("export-refusals", 0),
686- "r",
687- "Codecs with no encoder".into(),
688- match self.export_refusals_inline {
689- true => "a dimmed row each — r collapses them".into(),
690- false => "one line at the foot — r shows a row each".into(),
691- },
692- self.export_refusals_inline,
693- true,
694- )
695- .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
696- this.export_refusals_inline = !this.export_refusals_inline;
697- cx.notify();
698- }))
699- .into_any_element(),
700- );
701- if !self.export_refusals_inline && !refusals.is_empty() {
702- // Last, and one line: the reason travels with the name (a footer
703- // that only listed them would be the "why not?" the rows exist to
704- // answer), but nothing here can ever be picked, so it sits under
705- // every row that can rather than above them.
706- list.push(
773+ // What is doing the work, on this machine and in this build: the GPU
774+ // half is asked of the driver through the plugin (a different answer on
775+ // every machine, and "none" where there is no plugin at all), the build
776+ // half is the crates that were compiled in. Last in the list, because it
777+ // is what a user checks rather than what they pick -- and a listing
778+ // rather than rows, since none of it can be clicked.
779+ if self.export_grouped {
780+ list.push(header("THIS MACHINE"));
781+ }
782+ let note = |text: String| {
707783 div()
708784 .flex_none()
709785 .px(px(6.))
710786 .py(px(2.))
711787 .text_size(px(11.))
712788 .text_color(rgb(ink_secondary))
713- .when_some(font_mono.clone(), |d, f| d.font(f))
714- .child(format!("cannot write: {}", refusals.join(" · ")))
715- .into_any_element(),
716- );
717- }
718- // What is doing the work, on this machine and in this build: the GPU
719- // half is asked of the driver through the plugin (a different answer on
720- // every machine, and "none" where there is no plugin at all), the build
721- // half is the crates that were compiled in. Last in the list, because it
722- // is what a user checks rather than what they pick -- and a listing
723- // rather than rows, since none of it can be clicked.
724- if self.export_grouped {
725- list.push(header("THIS MACHINE"));
726- }
727- let note = |text: String| {
728- div()
729- .flex_none()
730- .px(px(6.))
731- .py(px(2.))
732- .text_size(px(11.))
733- .text_color(rgb(ink_secondary))
734- .when_some(font_mono.clone(), |d, f| d.font(f))
735- .child(text)
736- .into_any_element()
737- };
738- list.push(note(format!(
739- "GPU: {}",
740- self.hw_caps.clone().unwrap_or_else(|| "asking…".into())
741- )));
742- list.push(note(format!("Built in: {}", engine::caps::software())));
789+ .when_some(mono_style.clone(), |d, style| {
790+ d.font(style.font).text_size(style.size)
791+ })
792+ .child(text)
793+ .into_any_element()
794+ };
795+ list.push(note(format!(
796+ "GPU: {}",
797+ self.hw_caps.clone().unwrap_or_else(|| "asking…".into())
798+ )));
799+ list.push(note(format!("Built in: {}", engine::caps::software())));
743800 } // self.export_advanced_open
744801 // What the rows add up to, which is the one thing that has to be right:
745802 // codec, box, size, rate, sound, where it goes and about how big. Two
@@ -762,8 +819,7 @@ impl Player {
762819 },
763820 |(_, audio)| audio,
764821 );
765- let settings =
766- export_settings(
822+ let settings = export_settings(
767823 self.quality,
768824 self.custom_mbps,
769825 self.format,
@@ -875,9 +931,11 @@ impl Player {
875931 div()
876932 .flex_none()
877933 .px(px(6.))
878- .text_size(px(10.5))
879934 .text_color(rgb(INK3()))
880- .type_style(type_scale::mono(10.5, gpui::FontWeight::MEDIUM))
935+ .type_style(type_scale::mono(
936+ type_scale::CHORD_METADATA_MAX_PX,
937+ gpui::FontWeight::MEDIUM,
938+ ))
881939 .child(status_line),
882940 )
883941 .child(
@@ -894,8 +952,10 @@ impl Player {
894952 div()
895953 .flex_none()
896954 .px(px(6.))
897- .text_size(px(11.))
898- .type_style(type_scale::mono(10.5, gpui::FontWeight::MEDIUM))
955+ .type_style(type_scale::mono(
956+ type_scale::CHORD_METADATA_MAX_PX,
957+ gpui::FontWeight::MEDIUM,
958+ ))
899959 .text_color(rgb(INK2()))
900960 .child(head),
901961 )
@@ -903,7 +963,10 @@ impl Player {
903963 div()
904964 .flex_none()
905965 .px(px(6.))
906- .type_style(type_scale::mono(10.5, gpui::FontWeight::MEDIUM))
966+ .type_style(type_scale::mono(
967+ type_scale::CHORD_METADATA_MAX_PX,
968+ gpui::FontWeight::MEDIUM,
969+ ))
907970 .text_color(rgb(INK3()))
908971 .child(format!(
909972 "RANGE {}\u{2013}{} ({})",
@@ -916,7 +979,10 @@ impl Player {
916979 div()
917980 .flex_none()
918981 .px(px(6.))
919- .type_style(type_scale::mono(10.5, gpui::FontWeight::MEDIUM))
982+ .type_style(type_scale::mono(
983+ type_scale::CHORD_METADATA_MAX_PX,
984+ gpui::FontWeight::MEDIUM,
985+ ))
920986 .text_color(rgb(INK3()))
921987 .child(tail),
922988 )
@@ -946,7 +1012,10 @@ impl Player {
9461012 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
9471013 this.start_export(cx)
9481014 }))
949- .type_style(type_scale::label(11., gpui::FontWeight::MEDIUM))
1015+ .type_style(type_scale::label(
1016+ type_scale::LABEL_ROW_PX,
1017+ gpui::FontWeight::MEDIUM,
1018+ ))
9501019 .text_color(rgb(match blocked.is_some() {
9511020 true => INK4(),
9521021 false => INK1(),
@@ -956,7 +1025,7 @@ impl Player {
9561025 d.child(
9571026 div()
9581027 .type_style(type_scale::mono(
959- 9.5,
1028+ type_scale::CHORD_METADATA_MIN_PX,
9601029 gpui::FontWeight::MEDIUM,
9611030 ))
9621031 .text_color(rgb(INK3()))
@@ -1143,8 +1212,12 @@ impl Player {
11431212 .rounded(px(6.))
11441213 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))
11451214 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))
1146- .when(dark, |d| d.child(dark_card_head("Exporting", None, None, None, cx)))
1147- .when(!dark, |d| d.child(div().flex_none().px(px(6.)).child("Exporting")))
1215+ .when(dark, |d| {
1216+ d.child(dark_card_head("Exporting", None, None, None, cx))
1217+ })
1218+ .when(!dark, |d| {
1219+ d.child(div().flex_none().px(px(6.)).child("Exporting"))
1220+ })
11481221 // The bar itself: the same number as the percentage
11491222 // below it, and it only ever moves forward -- the
11501223 // worker's progress is a monotone `fetch_max`.
@@ -1191,8 +1264,9 @@ impl Player {
11911264 ))
11921265 .child(note(
11931266 match armed {
1194- true => "cancelling deletes what has been written so far"
1195- .to_string(),
1267+ true => {
1268+ "cancelling deletes what has been written so far".to_string()
1269+ }
11961270 false => format!(
11971271 "{} cancels · esc alone does nothing while this runs · the \
11981272 timeline is read-only until it finishes",
@@ -1262,8 +1336,10 @@ impl Player {
12621336 match armed {
12631337 true => "stops the worker and deletes the part file"
12641338 .to_string(),
1265- false => "asks first -- one press only offers the choice"
1266- .to_string(),
1339+ false => {
1340+ "asks first -- one press only offers the choice"
1341+ .to_string()
1342+ }
12671343 },
12681344 true,
12691345 cx.listener(move |this, _: &ClickEvent, _, cx| {
@@ -1393,10 +1469,16 @@ impl Player {
13931469 // tracked from.
13941470 .id("eq-graph")
13951471 .relative()
1396- .when(graph_maximized, |d| d.flex_1().min_h(px(EQ_GRAPH_H)).max_h(px(EQ_GRAPH_MAX_H)))
1472+ .when(graph_maximized, |d| {
1473+ d.flex_1().min_h(px(EQ_GRAPH_H)).max_h(px(EQ_GRAPH_MAX_H))
1474+ })
13971475 .when(!graph_maximized, |d| d.flex_none().h(px(eq_graph_h(false))))
13981476 .rounded(px(3.))
1399- .bg(rgb(if dark { DARK_HAIRLINE() } else { BG_HOVER_DIM() }))
1477+ .bg(rgb(if dark {
1478+ DARK_HAIRLINE()
1479+ } else {
1480+ BG_HOVER_DIM()
1481+ }))
14001482 .cursor_pointer()
14011483 // The press picks the band under it *and* is already the first
14021484 // sample of the drag, so a plain click sets a value. A second click
@@ -1488,25 +1570,37 @@ impl Player {
14881570 // a box narrower than the text. `.whitespace_nowrap()` is
14891571 // the platform's own backstop, so a mis-measured box clips
14901572 // or overhangs instead of silently wrapping again.
1491- let end_px = if dark { type_scale::CHORD_METADATA_MIN_PX } else { 9. };
1573+ let end_px = if dark {
1574+ type_scale::CHORD_METADATA_MIN_PX
1575+ } else {
1576+ 9.
1577+ };
14921578 let div = div().absolute().bottom(px(1.)).whitespace_nowrap();
14931579 let div = if i == 0 {
1494- div.w(px(eq_tick_end_w(label, end_px))).left(px(0.)).text_align(TextAlign::Left)
1580+ div.w(px(eq_tick_end_w(label, end_px)))
1581+ .left(px(0.))
1582+ .text_align(TextAlign::Left)
14951583 } 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)
1584+ div.w(px(eq_tick_end_w(label, end_px)))
1585+ .right(px(0.))
1586+ .text_align(TextAlign::Right)
14971587 } else {
1498- div.w(px(24.)).left(relative(eq_x(*freq))).ml(px(-12.)).text_align(TextAlign::Center)
1588+ div.w(px(24.))
1589+ .left(relative(eq_x(*freq)))
1590+ .ml(px(-12.))
1591+ .text_align(TextAlign::Center)
14991592 };
1500- div
1501- .when(dark, |d| {
1502- d.type_style(type_scale::mono(
1503- type_scale::CHORD_METADATA_MIN_PX,
1504- gpui::FontWeight::MEDIUM,
1505- ))
1506- .text_color(rgb(INK3()))
1507- })
1508- .when(!dark, |d| d.text_size(px(9.)).text_color(rgb(FG_SECONDARY())))
1509- .child(*label)
1593+ div.when(dark, |d| {
1594+ d.type_style(type_scale::mono(
1595+ type_scale::CHORD_METADATA_MIN_PX,
1596+ gpui::FontWeight::MEDIUM,
1597+ ))
1598+ .text_color(rgb(INK3()))
1599+ })
1600+ .when(!dark, |d| {
1601+ d.text_size(px(9.)).text_color(rgb(FG_SECONDARY()))
1602+ })
1603+ .child(*label)
15101604 }))
15111605 .child(
15121606 div()
@@ -1520,7 +1614,9 @@ impl Player {
15201614 ))
15211615 .text_color(rgb(INK3()))
15221616 })
1523- .when(!dark, |d| d.text_size(px(9.)).text_color(rgb(FG_SECONDARY())))
1617+ .when(!dark, |d| {
1618+ d.text_size(px(9.)).text_color(rgb(FG_SECONDARY()))
1619+ })
15241620 .child(format!("+{EQ_GAIN_LIMIT:.0} dB")),
15251621 );
15261622 // The bottom of the axis is not named: -12 dB would land in the same
@@ -1835,7 +1931,11 @@ impl Player {
18351931 /// arrows do the same three things, but a value only a key can change is a
18361932 /// value a hand on the pointer cannot reach at all, which is the same reason
18371933 /// [`Player::mbps_steppers`] exists.
1838- pub(crate) fn eq_numbers(&self, picked: Option<&Band>, cx: &mut Context<Self>) -> impl IntoElement {
1934+ pub(crate) fn eq_numbers(
1935+ &self,
1936+ picked: Option<&Band>,
1937+ cx: &mut Context<Self>,
1938+ ) -> impl IntoElement {
18391939 let dark = self.darkroom;
18401940 let row = div()
18411941 .flex_none()
@@ -1858,9 +1958,8 @@ impl Player {
18581958 label: &'static str,
18591959 change: fn(&mut Band),
18601960 cx: &mut Context<Self>| {
1861- let on_click = cx.listener(move |this, _: &ClickEvent, _, cx| {
1862- this.nudge_band(change, cx)
1863- });
1961+ let on_click =
1962+ cx.listener(move |this, _: &ClickEvent, _, cx| this.nudge_band(change, cx));
18641963 match dark {
18651964 true => dark_step_glyph(id, label == "+", on_click).into_any_element(),
18661965 false => div()
@@ -1901,16 +2000,17 @@ impl Player {
19012000 self.eq_params.bands.len()
19022001 ))
19032002 .into_any_element(),
1904- false => format!("Band {} of {}", self.eq_band + 1, self.eq_params.bands.len())
1905- .into_any_element(),
2003+ false => format!(
2004+ "Band {} of {}",
2005+ self.eq_band + 1,
2006+ self.eq_params.bands.len()
2007+ )
2008+ .into_any_element(),
19062009 })
19072010 .child(number(
19082011 band_label(&band),
19092012 ("eq-freq-down", "eq-freq-up"),
1910- (
1911- |b| b.freq_hz /= EQ_FREQ_STEP,
1912- |b| b.freq_hz *= EQ_FREQ_STEP,
1913- ),
2013+ (|b| b.freq_hz /= EQ_FREQ_STEP, |b| b.freq_hz *= EQ_FREQ_STEP),
19142014 cx,
19152015 ))
19162016 .child(number(
@@ -1939,11 +2039,9 @@ impl Player {
19392039 .bg(rgb(BG_PANEL()))
19402040 .cursor_pointer()
19412041 .hover(|s| s.bg(rgb(BG_HOVER())))
1942- .on_click(
1943- cx.listener(|this, _: &ClickEvent, _, cx| {
1944- this.nudge_band(|b| b.gain_db = 0., cx)
1945- }),
1946- )
2042+ .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
2043+ this.nudge_band(|b| b.gain_db = 0., cx)
2044+ }))
19472045 .child("Flatten this"),
19482046 )
19492047 }
@@ -1959,7 +2057,11 @@ impl Player {
19592057 /// the decoder is grading with, never a copy that could drift from it. The
19602058 /// graph above them is counted off the frame that came *back* through that
19612059 /// grade ([`histogram`]), so pulling exposure tilts it while the hand moves.
1962- pub(crate) fn color_card(&self, viewport: Size<Pixels>, cx: &mut Context<Self>) -> Option<impl IntoElement> {
2060+ pub(crate) fn color_card(
2061+ &self,
2062+ viewport: Size<Pixels>,
2063+ cx: &mut Context<Self>,
2064+ ) -> Option<impl IntoElement> {
19632065 let (lane, idx) = self.color_open?;
19642066 let params = self.color_params();
19652067 let dark = self.darkroom;
@@ -2040,7 +2142,9 @@ impl Player {
20402142 .child(
20412143 div()
20422144 .w(px(44.))
2043- .when(dark, |d| d.child(dark_row_value(format!("{:.0}%", value * 100.))))
2145+ .when(dark, |d| {
2146+ d.child(dark_row_value(format!("{:.0}%", value * 100.)))
2147+ })
20442148 .when(!dark, |d| {
20452149 d.text_size(px(11.))
20462150 .text_color(rgb(FG_SECONDARY()))
@@ -2058,7 +2162,12 @@ impl Player {
20582162 .justify_center()
20592163 .items_center()
20602164 .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)))))
2165+ .when(self.card_maximized, |d| {
2166+ d.top(px(crate::ui::stance::maximized_card_top(
2167+ f32::from(viewport.height),
2168+ self.split_px(Split::Bench, viewport),
2169+ )))
2170+ })
20622171 // Click away closes it, as on every card here.
20632172 .on_mouse_down(
20642173 MouseButton::Left,
@@ -2071,7 +2180,11 @@ impl Player {
20712180 .child(
20722181 div()
20732182 .w_full()
2074- .max_w(px(card_max_w(COLOR_W, self.card_maximized, f32::from(viewport.width))))
2183+ .max_w(px(card_max_w(
2184+ COLOR_W,
2185+ self.card_maximized,
2186+ f32::from(viewport.width),
2187+ )))
20752188 .on_mouse_down(MouseButton::Left, swallow)
20762189 .flex()
20772190 .flex_col()
@@ -2081,7 +2194,13 @@ impl Player {
20812194 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))
20822195 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))
20832196 .when(dark, |d| {
2084- d.child(dark_card_head("Colour", Some(head_meta.clone()), Some(help_text.into()), Some(self.card_maximized), cx))
2197+ d.child(dark_card_head(
2198+ "Colour",
2199+ Some(head_meta.clone()),
2200+ Some(help_text.into()),
2201+ Some(self.card_maximized),
2202+ cx,
2203+ ))
20852204 })
20862205 .when(!dark, |d| {
20872206 d.child(div().flex_none().px(px(6.)).child(format!(
@@ -2109,7 +2228,11 @@ impl Player {
21092228 .flex_none()
21102229 .h(px(HIST_H))
21112230 .rounded(px(3.))
2112- .bg(rgb(if dark { DARK_HAIRLINE() } else { BG_HOVER_DIM() }))
2231+ .bg(rgb(if dark {
2232+ DARK_HAIRLINE()
2233+ } else {
2234+ BG_HOVER_DIM()
2235+ }))
21132236 .relative()
21142237 .child(hist_curves(self.histogram)),
21152238 )
@@ -2151,7 +2274,11 @@ impl Player {
21512274 /// The transform card: [`color_card`](Self::color_card)'s own shape, one
21522275 /// row per [`TRANSFORM_BANDS`] entry instead of four, and no histogram --
21532276 /// there is nothing here a graded frame would tilt.
2154- pub(crate) fn transform_card(&self, viewport: Size<Pixels>, cx: &mut Context<Self>) -> Option<impl IntoElement> {
2277+ pub(crate) fn transform_card(
2278+ &self,
2279+ viewport: Size<Pixels>,
2280+ cx: &mut Context<Self>,
2281+ ) -> Option<impl IntoElement> {
21552282 let (lane, idx) = self.transform_open?;
21562283 let params = self.transform_params();
21572284 let dark = self.darkroom;
@@ -2222,13 +2349,16 @@ impl Player {
22222349 ),
22232350 )
22242351 .child(
2225- div().w(px(44.)).when(dark, |d| {
2226- d.child(dark_row_value(transform_row_value(i, value)))
2227- }).when(!dark, |d| {
2228- d.text_size(px(11.))
2229- .text_color(rgb(FG_SECONDARY()))
2230- .child(transform_row_value(i, value))
2231- }),
2352+ div()
2353+ .w(px(44.))
2354+ .when(dark, |d| {
2355+ d.child(dark_row_value(transform_row_value(i, value)))
2356+ })
2357+ .when(!dark, |d| {
2358+ d.text_size(px(11.))
2359+ .text_color(rgb(FG_SECONDARY()))
2360+ .child(transform_row_value(i, value))
2361+ }),
22322362 )
22332363 })
22342364 .collect();
@@ -2241,7 +2371,12 @@ impl Player {
22412371 .justify_center()
22422372 .items_center()
22432373 .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)))))
2374+ .when(self.card_maximized, |d| {
2375+ d.top(px(crate::ui::stance::maximized_card_top(
2376+ f32::from(viewport.height),
2377+ self.split_px(Split::Bench, viewport),
2378+ )))
2379+ })
22452380 .on_mouse_down(
22462381 MouseButton::Left,
22472382 cx.listener(|this, _: &MouseDownEvent, _, cx| {
@@ -2253,7 +2388,11 @@ impl Player {
22532388 .child(
22542389 div()
22552390 .w_full()
2256- .max_w(px(card_max_w(TRANSFORM_W, self.card_maximized, f32::from(viewport.width))))
2391+ .max_w(px(card_max_w(
2392+ TRANSFORM_W,
2393+ self.card_maximized,
2394+ f32::from(viewport.width),
2395+ )))
22572396 .on_mouse_down(MouseButton::Left, swallow)
22582397 .flex()
22592398 .flex_col()
@@ -2263,7 +2402,13 @@ impl Player {
22632402 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))
22642403 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))
22652404 .when(dark, |d| {
2266- d.child(dark_card_head("Transform", Some(head_meta.clone()), Some(help_text.into()), Some(self.card_maximized), cx))
2405+ d.child(dark_card_head(
2406+ "Transform",
2407+ Some(head_meta.clone()),
2408+ Some(help_text.into()),
2409+ Some(self.card_maximized),
2410+ cx,
2411+ ))
22672412 })
22682413 .when(!dark, |d| {
22692414 d.child(div().flex_none().px(px(6.)).child(format!(
@@ -2326,7 +2471,11 @@ impl Player {
23262471 ///
23272472 /// Honest about what it does: the sound is *resampled*, so the pitch goes up
23282473 /// with the rate, which is what the tape in the title means.
2329- pub(crate) fn speed_card(&self, viewport: Size<Pixels>, cx: &mut Context<Self>) -> Option<impl IntoElement> {
2474+ pub(crate) fn speed_card(
2475+ &self,
2476+ viewport: Size<Pixels>,
2477+ cx: &mut Context<Self>,
2478+ ) -> Option<impl IntoElement> {
23302479 let (lane, idx) = self.speed_open?;
23312480 let speed = self.card_speed();
23322481 let session = self.session.as_ref()?;
@@ -2365,8 +2514,7 @@ impl Player {
23652514 })
23662515 .collect();
23672516 let head_meta: SharedString = format!("{} clip {}", lane.label(), idx + 1).into();
2368- let help_text =
2369- "drag the bar or ←→ moves it, r is 1.00x — the pitch moves with the rate; a click away or esc closes";
2517+ 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";
23702518 let tail_text: SharedString = format!(
23712519 "{speed} — {} source frames over {} on the timeline ({})",
23722520 clip.len(),
@@ -2380,7 +2528,12 @@ impl Player {
23802528 .justify_center()
23812529 .items_center()
23822530 .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)))))
2531+ .when(self.card_maximized, |d| {
2532+ d.top(px(crate::ui::stance::maximized_card_top(
2533+ f32::from(viewport.height),
2534+ self.split_px(Split::Bench, viewport),
2535+ )))
2536+ })
23842537 // Click away closes it, as on every card here.
23852538 .on_mouse_down(
23862539 MouseButton::Left,
@@ -2393,7 +2546,11 @@ impl Player {
23932546 .child(
23942547 div()
23952548 .w_full()
2396- .max_w(px(card_max_w(COLOR_W, self.card_maximized, f32::from(viewport.width))))
2549+ .max_w(px(card_max_w(
2550+ COLOR_W,
2551+ self.card_maximized,
2552+ f32::from(viewport.width),
2553+ )))
23972554 .on_mouse_down(MouseButton::Left, swallow)
23982555 .flex()
23992556 .flex_col()
@@ -2403,7 +2560,13 @@ impl Player {
24032560 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))
24042561 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))
24052562 .when(dark, |d| {
2406- d.child(dark_card_head("Speed (tape)", Some(head_meta.clone()), Some(help_text.into()), Some(self.card_maximized), cx))
2563+ d.child(dark_card_head(
2564+ "Speed (tape)",
2565+ Some(head_meta.clone()),
2566+ Some(help_text.into()),
2567+ Some(self.card_maximized),
2568+ cx,
2569+ ))
24072570 })
24082571 .when(!dark, |d| {
24092572 d.child(div().flex_none().px(px(6.)).child(format!(
@@ -2492,7 +2655,11 @@ impl Player {
24922655 /// move it too. The rows scroll rather than the card growing past the
24932656 /// window -- a timeline may hold more tracks than a 360 px window has room
24942657 /// for faders.
2495- pub(crate) fn mix_card(&self, viewport: Size<Pixels>, cx: &mut Context<Self>) -> Option<impl IntoElement> {
2658+ pub(crate) fn mix_card(
2659+ &self,
2660+ viewport: Size<Pixels>,
2661+ cx: &mut Context<Self>,
2662+ ) -> Option<impl IntoElement> {
24962663 if !self.mix_open {
24972664 return None;
24982665 }
@@ -2583,13 +2750,15 @@ impl Player {
25832750 .bg(rgb(BG_PANEL()))
25842751 .cursor_pointer()
25852752 .hover(|s| s.bg(rgb(BG_HOVER())))
2586- .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
2587- // Picked as well as moved, the silence
2588- // card's rule: the row a press lands on
2589- // is the row the arrows carry on from.
2590- this.mix_field = n;
2591- this.nudge_mix(steps, cx);
2592- }))
2753+ .on_click(cx.listener(
2754+ move |this, _: &ClickEvent, _, cx| {
2755+ // Picked as well as moved, the silence
2756+ // card's rule: the row a press lands on
2757+ // is the row the arrows carry on from.
2758+ this.mix_field = n;
2759+ this.nudge_mix(steps, cx);
2760+ },
2761+ ))
25932762 .child(match steps > 0 {
25942763 true => "+",
25952764 false => "−",
@@ -2614,7 +2783,12 @@ impl Player {
26142783 .justify_center()
26152784 .items_center()
26162785 .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)))))
2786+ .when(self.card_maximized, |d| {
2787+ d.top(px(crate::ui::stance::maximized_card_top(
2788+ f32::from(viewport.height),
2789+ self.split_px(Split::Bench, viewport),
2790+ )))
2791+ })
26182792 // Click away closes it, as on every card here.
26192793 .on_mouse_down(
26202794 MouseButton::Left,
@@ -2627,7 +2801,11 @@ impl Player {
26272801 .child(
26282802 div()
26292803 .w_full()
2630- .max_w(px(card_max_w(COLOR_W, self.card_maximized, f32::from(viewport.width))))
2804+ .max_w(px(card_max_w(
2805+ COLOR_W,
2806+ self.card_maximized,
2807+ f32::from(viewport.width),
2808+ )))
26312809 .on_mouse_down(MouseButton::Left, swallow)
26322810 .max_h(px(360. - 24.))
26332811 .flex()
@@ -2637,7 +2815,15 @@ impl Player {
26372815 .rounded(px(6.))
26382816 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))
26392817 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))
2640- .when(dark, |d| d.child(dark_card_head("Mix", None, Some(help_text.into()), Some(self.card_maximized), cx)))
2818+ .when(dark, |d| {
2819+ d.child(dark_card_head(
2820+ "Mix",
2821+ None,
2822+ Some(help_text.into()),
2823+ Some(self.card_maximized),
2824+ cx,
2825+ ))
2826+ })
26412827 .when(!dark, |d| {
26422828 d.child(
26432829 div()
@@ -2690,13 +2876,25 @@ impl Player {
26902876 /// card's shape for the same reason: app-global, kept in a file beside
26912877 /// the theme, and drawn straight off `self.sub_text` / `self.sub_family`
26922878 /// so a change is on the cue underneath before the card is closed.
2693- pub(crate) fn subtitle_style_card(&self, viewport: Size<Pixels>, cx: &mut Context<Self>) -> Option<impl IntoElement> {
2879+ pub(crate) fn subtitle_style_card(
2880+ &self,
2881+ viewport: Size<Pixels>,
2882+ cx: &mut Context<Self>,
2883+ ) -> Option<impl IntoElement> {
26942884 if !self.subtitle_style_open {
26952885 return None;
26962886 }
26972887 let dark = self.darkroom;
26982888 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));
2889+ let head = dark.then(|| {
2890+ dark_card_head(
2891+ "Subtitle style",
2892+ None,
2893+ Some(help_text.into()),
2894+ Some(self.card_maximized),
2895+ cx,
2896+ )
2897+ });
27002898 let size_picked = self.subtitle_style_field == 0;
27012899 let size_row = div()
27022900 .id("subtitle-size-row")
@@ -2707,7 +2905,9 @@ impl Player {
27072905 .justify_between()
27082906 .px(px(6.))
27092907 .rounded(px(3.))
2710- .when(dark && size_picked, |d| d.border_l_2().border_color(rgb(INK1())))
2908+ .when(dark && size_picked, |d| {
2909+ d.border_l_2().border_color(rgb(INK1()))
2910+ })
27112911 .when(!dark, |d| {
27122912 d.bg(rgb(match size_picked {
27132913 true => BG_SELECTED(),
@@ -2724,7 +2924,9 @@ impl Player {
27242924 .flex()
27252925 .items_center()
27262926 .gap(px(4.))
2727- .when(dark, |d| d.child(dark_row_value(format!("{:.0}px", self.sub_text))))
2927+ .when(dark, |d| {
2928+ d.child(dark_row_value(format!("{:.0}px", self.sub_text)))
2929+ })
27282930 .when(!dark, |d| d.child(format!("{:.0}px", self.sub_text)))
27292931 .children([-1, 1].map(|steps: i32| {
27302932 let id = ("subtitle-size-step", usize::from(steps > 0));
@@ -2771,7 +2973,9 @@ impl Player {
27712973 .items_center()
27722974 .px(px(6.))
27732975 .rounded(px(3.))
2774- .when(dark && default_picked, |d| d.border_l_2().border_color(rgb(INK1())))
2976+ .when(dark && default_picked, |d| {
2977+ d.border_l_2().border_color(rgb(INK1()))
2978+ })
27752979 .when(!dark, |d| {
27762980 d.bg(rgb(match default_picked {
27772981 true => BG_SELECTED(),
@@ -2783,7 +2987,9 @@ impl Player {
27832987 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
27842988 this.set_sub_family(None, cx);
27852989 }))
2786- .when(dark, |d| d.child(dark_row_label("System default", default_picked)))
2990+ .when(dark, |d| {
2991+ d.child(dark_row_label("System default", default_picked))
2992+ })
27872993 .when(!dark, |d| d.child("System default"));
27882994 let family_rows = self.subtitle_fonts.iter().enumerate().map(|(n, name)| {
27892995 let picked = self.subtitle_style_field == n + 2
@@ -2820,7 +3026,12 @@ impl Player {
28203026 .justify_center()
28213027 .items_center()
28223028 .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)))))
3029+ .when(self.card_maximized, |d| {
3030+ d.top(px(crate::ui::stance::maximized_card_top(
3031+ f32::from(viewport.height),
3032+ self.split_px(Split::Bench, viewport),
3033+ )))
3034+ })
28243035 .on_mouse_down(
28253036 MouseButton::Left,
28263037 cx.listener(|this, _: &MouseDownEvent, _, cx| {
@@ -2832,7 +3043,11 @@ impl Player {
28323043 .child(
28333044 div()
28343045 .w_full()
2835- .max_w(px(card_max_w(COLOR_W, self.card_maximized, f32::from(viewport.width))))
3046+ .max_w(px(card_max_w(
3047+ COLOR_W,
3048+ self.card_maximized,
3049+ f32::from(viewport.width),
3050+ )))
28363051 .on_mouse_down(MouseButton::Left, swallow)
28373052 .max_h(px(360. - 24.))
28383053 .flex()
@@ -2883,12 +3098,24 @@ impl Player {
28833098 /// *about* the timeline -- the marks under it are the whole preview -- so
28843099 /// the bed stays readable and the card sits up in the picture area rather
28853100 /// than over the lanes.
2886- pub(crate) fn silence_card(&self, viewport: Size<Pixels>, cx: &mut Context<Self>) -> Option<impl IntoElement> {
3101+ pub(crate) fn silence_card(
3102+ &self,
3103+ viewport: Size<Pixels>,
3104+ cx: &mut Context<Self>,
3105+ ) -> Option<impl IntoElement> {
28873106 let (lane, idx) = self.silence_open?;
28883107 let dark = self.darkroom;
28893108 let head_meta: SharedString = format!("{} clip {}", lane.label(), idx + 1).into();
28903109 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));
3110+ let head = dark.then(|| {
3111+ dark_card_head(
3112+ "Silences",
3113+ Some(head_meta.clone()),
3114+ Some(help_text.into()),
3115+ Some(self.card_maximized),
3116+ cx,
3117+ )
3118+ });
28923119 let cfg = self.silence;
28933120 // The unit is a label, never a conversion: the threshold is a level
28943121 // below full scale whichever of the two the row says (`silence_dbfs`).
@@ -2926,7 +3153,10 @@ impl Player {
29263153 let status = match &self.silence_scan {
29273154 Some(scan) => silence_line(
29283155 scan.seen as f32 / 10.,
2929- scan.progress.total.load(std::sync::atomic::Ordering::Relaxed) as f32 / 10.,
3156+ scan.progress
3157+ .total
3158+ .load(std::sync::atomic::Ordering::Relaxed) as f32
3159+ / 10.,
29303160 scan.started.elapsed().as_secs_f32(),
29313161 scan.since.elapsed().as_secs_f32(),
29323162 ),
@@ -3005,14 +3235,16 @@ impl Player {
30053235 .bg(rgb(BG_PANEL()))
30063236 .cursor_pointer()
30073237 .hover(|s| s.bg(rgb(BG_HOVER())))
3008- .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
3009- // Picked as well as moved: the row a
3010- // press lands on is the row the arrows
3011- // carry on from.
3012- this.silence_field = n;
3013- this.nudge_silence(steps);
3014- cx.notify();
3015- }))
3238+ .on_click(cx.listener(
3239+ move |this, _: &ClickEvent, _, cx| {
3240+ // Picked as well as moved: the row a
3241+ // press lands on is the row the arrows
3242+ // carry on from.
3243+ this.silence_field = n;
3244+ this.nudge_silence(steps);
3245+ cx.notify();
3246+ },
3247+ ))
30163248 .child(match steps > 0 {
30173249 true => "+",
30183250 false => "−",
@@ -3064,7 +3296,12 @@ impl Player {
30643296 // Light enough to read the lanes and the marks on them through:
30653297 // the preview is the point of this card.
30663298 .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)))))
3299+ .when(self.card_maximized, |d| {
3300+ d.top(px(crate::ui::stance::maximized_card_top(
3301+ f32::from(viewport.height),
3302+ self.split_px(Split::Bench, viewport),
3303+ )))
3304+ })
30683305 // Click away closes it, as on every card here -- and the marks
30693306 // go with it, which is what makes this one a call and not a flag.
30703307 .on_mouse_down(
@@ -3078,7 +3315,11 @@ impl Player {
30783315 .child(
30793316 div()
30803317 .w_full()
3081- .max_w(px(card_max_w(COLOR_W, self.card_maximized, f32::from(viewport.width))))
3318+ .max_w(px(card_max_w(
3319+ COLOR_W,
3320+ self.card_maximized,
3321+ f32::from(viewport.width),
3322+ )))
30823323 .on_mouse_down(MouseButton::Left, swallow)
30833324 .flex()
30843325 .flex_col()
crates/app/src/ui/dock_stance.rsmodified+86 -25
@@ -11,8 +11,8 @@
1111 //! still supply the row facts ([`library_rows`], [`source_tint`],
1212 //! [`clip_middle`]...), only the anatomy around them is new.
1313
14-use crate::*;
1514 use crate::ui::type_scale::{self, head, label, mono};
15+use crate::*;
1616 use gpui::FontWeight;
1717
1818 /// Where the dock tab pick lives: one word beside the theme and the
@@ -79,7 +79,12 @@ pub(crate) enum DockSort {
7979 }
8080
8181 impl DockSort {
82- const ALL: [DockSort; 4] = [DockSort::Recent, DockSort::Name, DockSort::Usage, DockSort::Unused];
82+ const ALL: [DockSort; 4] = [
83+ DockSort::Recent,
84+ DockSort::Name,
85+ DockSort::Usage,
86+ DockSort::Unused,
87+ ];
8388 fn label(self) -> &'static str {
8489 match self {
8590 DockSort::Recent => "Recent",
@@ -156,7 +161,12 @@ fn ghost_verb(
156161 /// DESIGN §11's frequency check puts a lift and a mark far ahead of a tab
157162 /// switch -- wearing a chord this room does not answer to would be exactly
158163 /// the lie DESIGN §4 forbids, so the letters go instead.
159-fn dock_tab(id: &'static str, label_text: &'static str, active: bool, cx: &mut Context<Player>) -> impl IntoElement {
164+fn dock_tab(
165+ id: &'static str,
166+ label_text: &'static str,
167+ active: bool,
168+ cx: &mut Context<Player>,
169+) -> impl IntoElement {
160170 let style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM);
161171 div()
162172 .id(id)
@@ -183,7 +193,7 @@ fn dock_tab(id: &'static str, label_text: &'static str, active: bool, cx: &mut C
183193 )
184194 }
185195
186-/// A 9px uppercase Archivo section head, `ink3` (DESIGN §3).
196+/// A 12px uppercase Archivo section head, `ink3` (DESIGN §3).
187197 fn section_head(text: impl Into<SharedString>) -> impl IntoElement {
188198 let style = head();
189199 div()
@@ -206,11 +216,20 @@ fn usage_line(player: &Player, source_idx: usize, placed: usize) -> String {
206216 session
207217 .lanes()
208218 .into_iter()
209- .filter(|lane| session.lane_clips(*lane).iter().any(|c| c.source == source_idx))
219+ .filter(|lane| {
220+ session
221+ .lane_clips(*lane)
222+ .iter()
223+ .any(|c| c.source == source_idx)
224+ })
210225 .map(Lane::label)
211226 .collect()
212227 });
213- format!("{} · {placed} use{}", lanes.join(" "), if placed == 1 { "" } else { "s" })
228+ format!(
229+ "{} · {placed} use{}",
230+ lanes.join(" "),
231+ if placed == 1 { "" } else { "s" }
232+ )
214233 }
215234
216235 /// One source row, two lines (MOCK-SPEC "Dock" §4): an ink dot, the name in
@@ -220,12 +239,22 @@ fn usage_line(player: &Player, source_idx: usize, placed: usize) -> String {
220239 /// 2, wired in `render.rs`'s key handler since a row takes no keyboard focus
221240 /// of its own), double-click (gesture 3) and right-click the dot (gesture 4)
222241 /// all live here.
223-fn source_row(player: &Player, i: usize, row: &Row, placed: usize, picked: bool, cx: &mut Context<Player>) -> impl IntoElement {
242+fn source_row(
243+ player: &Player,
244+ i: usize,
245+ row: &Row,
246+ placed: usize,
247+ picked: bool,
248+ cx: &mut Context<Player>,
249+) -> impl IntoElement {
224250 let usable = row.unusable.is_none();
225251 let name: SharedString = row.name.clone().into();
226252 let under: String = match &row.unusable {
227253 Some(why) => why.clone(),
228- None => join_detail(&row.detail, &timecode(f64::from(row.frames) / player.fps, player.fps)),
254+ None => join_detail(
255+ &row.detail,
256+ &timecode(f64::from(row.frames) / player.fps, player.fps),
257+ ),
229258 };
230259 let usage = usage_line(player, row.tint, placed);
231260 let (path, stream) = (row.path.clone(), row.stream);
@@ -354,11 +383,23 @@ fn source_row(player: &Player, i: usize, row: &Row, placed: usize, picked: bool,
354383 /// Media/Audio/Text panel `library.rs` draws. That panel's row facts
355384 /// ([`library_rows`]) are still what every row here is built from.
356385 fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
357- let sources = player.session.as_ref().map_or(&[][..], PlaybackSession::sources);
386+ let sources = player
387+ .session
388+ .as_ref()
389+ .map_or(&[][..], PlaybackSession::sources);
358390 let meta = player.session.as_ref().map(PlaybackSession::meta);
359- let all_rows: Vec<Row> = library_rows(sources, &player.streams, &player.decoders, player.timeline_audio(), |path| {
360- player.session.as_ref().map_or(0, |session| session.file_frames(path))
361- });
391+ let all_rows: Vec<Row> = library_rows(
392+ sources,
393+ &player.streams,
394+ &player.decoders,
395+ player.timeline_audio(),
396+ |path| {
397+ player
398+ .session
399+ .as_ref()
400+ .map_or(0, |session| session.file_frames(path))
401+ },
402+ );
362403 let _ = meta;
363404 let unused_count = all_rows
364405 .iter()
@@ -380,7 +421,9 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
380421 .collect();
381422 match player.dock_sort {
382423 DockSort::Recent => {}
383- DockSort::Name => rows.sort_by(|(a, _), (b, _)| a.name.to_lowercase().cmp(&b.name.to_lowercase())),
424+ DockSort::Name => {
425+ rows.sort_by(|(a, _), (b, _)| a.name.to_lowercase().cmp(&b.name.to_lowercase()))
426+ }
384427 DockSort::Usage => rows.sort_by(|(_, a), (_, b)| b.cmp(a)),
385428 DockSort::Unused => rows.sort_by_key(|(_, placed)| *placed > 0),
386429 }
@@ -395,7 +438,9 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
395438 .gap(px(6.))
396439 .p(px(8.))
397440 .overflow_y_scroll()
398- .child(section_head(format!("SOURCES · {total} · {unused_count} UNUSED")))
441+ .child(section_head(format!(
442+ "SOURCES · {total} · {unused_count} UNUSED"
443+ )))
399444 .child({
400445 let style = mono(type_scale::CHORD_METADATA_MAX_PX, FontWeight::MEDIUM);
401446 div()
@@ -404,7 +449,11 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
404449 .cursor_text()
405450 .font(style.font)
406451 .text_size(style.size)
407- .text_color(rgb(if player.dock_filter_edit { INK1() } else { INK3() }))
452+ .text_color(rgb(if player.dock_filter_edit {
453+ INK1()
454+ } else {
455+ INK3()
456+ }))
408457 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
409458 this.dock_filter_edit = true;
410459 cx.notify();
@@ -421,7 +470,7 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
421470 .gap(px(4.))
422471 .children(DockSort::ALL.map(|sort| {
423472 let on = sort == player.dock_sort;
424- let style = label(9.5, FontWeight::MEDIUM);
473+ let style = label(type_scale::FLOOR_PX, FontWeight::MEDIUM);
425474 div()
426475 .id(("dock-sort", sort as usize))
427476 .flex_none()
@@ -458,7 +507,8 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
458507 .text_size(style.size)
459508 .text_color(rgb(INK3()))
460509 .child(match player.dock_filter.is_empty() {
461- true => "No sources yet — Add files, or drop one on the window".to_string(),
510+ true => "No sources yet — Add files, or drop one on the window"
511+ .to_string(),
462512 false => "nothing matches the filter".to_string(),
463513 }),
464514 )
@@ -468,7 +518,10 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
468518 .iter()
469519 .enumerate()
470520 .map(|(i, (row, placed))| {
471- let picked = player.selected_asset.as_ref().is_some_and(|p| *p == (row.path.clone(), row.stream));
521+ let picked = player
522+ .selected_asset
523+ .as_ref()
524+ .is_some_and(|p| *p == (row.path.clone(), row.stream));
472525 source_row(player, i, row, *placed, picked, cx).into_any_element()
473526 })
474527 .collect();
@@ -501,11 +554,9 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
501554 )),
502555 )
503556 .child({
504- // FAULT 2: metadata, not a row -- DESIGN §3's 9.5-10px band via
505- // the named constant (a bespoke 9px literal was neither the
506- // metadata size nor any other named role), and the quietest text
507- // in the dock: ink3, tight leading so it never competes with the
508- // 10.5px source rows above it.
557+ // Metadata, not a row: DESIGN §3's metadata role, and the quietest
558+ // text in the dock: ink3, tight leading so it never competes with
559+ // the source rows above it.
509560 let style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM);
510561 div()
511562 .flex_none()
@@ -524,7 +575,12 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
524575 /// these onto. Drag-while-playing and every other gesture on a row is
525576 /// whatever that card already does; nothing about the gesture is reimplemented
526577 /// here.
527-fn clip_tab(player: &Player, width: f32, window_size: Size<Pixels>, cx: &mut Context<Player>) -> impl IntoElement {
578+fn clip_tab(
579+ player: &Player,
580+ width: f32,
581+ window_size: Size<Pixels>,
582+ cx: &mut Context<Player>,
583+) -> impl IntoElement {
528584 // The room actually given here, not the window's: `eq_card_w`/
529585 // `card_max_w` are asked "how wide may I draw" and answered with the
530586 // *whole viewport's* width when handed `window_size` verbatim -- but this
@@ -699,7 +755,12 @@ fn clip_tab(player: &Player, width: f32, window_size: Size<Pixels>, cx: &mut Con
699755 /// pair). What degrades *inside* fixed width is the two tabs' own content:
700756 /// Sources scrolls its own row list; Clip's param rows are whatever their
701757 /// card already draws at this width.
702-pub(crate) fn render(player: &Player, width: f32, window_size: Size<Pixels>, cx: &mut Context<Player>) -> impl IntoElement {
758+pub(crate) fn render(
759+ player: &Player,
760+ width: f32,
761+ window_size: Size<Pixels>,
762+ cx: &mut Context<Player>,
763+) -> impl IntoElement {
703764 let src_active = player.dock_src_active;
704765 div()
705766 .id("stance-dock-body")
crates/app/src/ui/spine_stance.rsmodified+179 -31
@@ -4,17 +4,13 @@
44 //! drew. `stance.rs::spine()` keeps the panel frame (width, surface,
55 //! border); this module owns the rows inside it.
66
7-use crate::*;
87 use crate::ui::type_scale::{self, Typeset};
8+use crate::*;
99
10-/// The glyph icon itself: DESIGN §3 names no separate role for it, so this
11-/// keeps the size the module has always drawn it at (13px, the same number
12-/// as the hero timecode by coincidence, not by role) and routes only the
13-/// font family through [`type_scale`] (Archivo -- the glyph is a verb, the
14-/// room's voice, not something the film says).
15-const GLYPH_SIZE: f32 = 13.;
10+/// The glyph icon is a room verb, so it uses the label role rather than a
11+/// bespoke size: Archivo at `LABEL_ROW_PX`.
1612
17-/// A group head: 9px uppercase Archivo 700 in `ink3`, +0.14em tracking
13+/// A group head: uppercase Archivo 700 in `ink3`, +0.14em tracking
1814 /// (DESIGN §3) -- reused as its own small fn rather than `stance::section_head`
1915 /// because that one is private to its module and carries a different
2016 /// vertical rhythm (a region label, not a spine group head).
@@ -79,16 +75,21 @@ fn glyph(
7975 .when(on, |d| {
8076 d.cursor_pointer()
8177 .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1())))
82- .on_click(cx.listener(move |this, _: &ClickEvent, window, cx| {
83- this.act(action, window, cx)
84- }))
78+ .on_click(
79+ cx.listener(move |this, _: &ClickEvent, window, cx| {
80+ this.act(action, window, cx)
81+ }),
82+ )
8583 })
8684 .child(
8785 div()
8886 .line_height(relative(1.05))
8987 // FAULT 1: the glyph is the loudest thing in its row -- BOLD,
9088 // not the MEDIUM weight the chord beneath it also wears.
91- .type_style(type_scale::label(GLYPH_SIZE, gpui::FontWeight::BOLD))
89+ .type_style(type_scale::label(
90+ type_scale::LABEL_ROW_PX,
91+ gpui::FontWeight::BOLD,
92+ ))
9293 .text_color(rgb(if active {
9394 INK1()
9495 } else if quiet {
@@ -143,7 +144,10 @@ fn trim_control(active: bool, player: &Player, cx: &mut Context<Player>) -> impl
143144 .child(
144145 div()
145146 .line_height(relative(1.05))
146- .type_style(type_scale::label(GLYPH_SIZE, gpui::FontWeight::BOLD))
147+ .type_style(type_scale::label(
148+ type_scale::LABEL_ROW_PX,
149+ gpui::FontWeight::BOLD,
150+ ))
147151 .text_color(rgb(if active { INK1() } else { INK2() }))
148152 .child(txt),
149153 )
@@ -222,8 +226,24 @@ pub(crate) fn render(player: &Player, cx: &mut Context<Player>) -> impl IntoElem
222226 .gap(px(1.))
223227 .overflow_y_scroll()
224228 .child(group_head("edit"))
225- .child(glyph("spine-split", "||", ActionId::Cut, false, false, player, cx))
226- .child(glyph("spine-delete", "⊂⊃", ActionId::Delete, false, false, player, cx))
229+ .child(glyph(
230+ "spine-split",
231+ "||",
232+ ActionId::Cut,
233+ false,
234+ false,
235+ player,
236+ cx,
237+ ))
238+ .child(glyph(
239+ "spine-delete",
240+ "⊂⊃",
241+ ActionId::Delete,
242+ false,
243+ false,
244+ player,
245+ cx,
246+ ))
227247 .child(pair(
228248 glyph("spine-undo", "↺", ActionId::Undo, false, false, player, cx),
229249 // Redo had a legacy toolbar button (`toolbar.rs:347`) but no
@@ -234,8 +254,24 @@ pub(crate) fn render(player: &Player, cx: &mut Context<Player>) -> impl IntoElem
234254 ))
235255 .child(group_head("cut"))
236256 .child(pair(
237- glyph("spine-cut-prev", "‹", ActionId::WalkCutPrev, false, false, player, cx),
238- glyph("spine-cut-next", "›", ActionId::WalkCutNext, false, false, player, cx),
257+ glyph(
258+ "spine-cut-prev",
259+ "‹",
260+ ActionId::WalkCutPrev,
261+ false,
262+ false,
263+ player,
264+ cx,
265+ ),
266+ glyph(
267+ "spine-cut-next",
268+ "›",
269+ ActionId::WalkCutNext,
270+ false,
271+ false,
272+ player,
273+ cx,
274+ ),
239275 ))
240276 .child(trim_control(player.loop_trim.is_some(), player, cx))
241277 .child(glyph(
@@ -271,13 +307,53 @@ pub(crate) fn render(player: &Player, cx: &mut Context<Player>) -> impl IntoElem
271307 // less than walking/trimming cuts above it.
272308 .child(group_head("view"))
273309 .child(pair(
274- glyph("spine-zoom-out", "−", ActionId::ZoomOut, false, false, player, cx),
275- glyph("spine-zoom-in", "+", ActionId::ZoomIn, false, false, player, cx),
310+ glyph(
311+ "spine-zoom-out",
312+ "−",
313+ ActionId::ZoomOut,
314+ false,
315+ false,
316+ player,
317+ cx,
318+ ),
319+ glyph(
320+ "spine-zoom-in",
321+ "+",
322+ ActionId::ZoomIn,
323+ false,
324+ false,
325+ player,
326+ cx,
327+ ),
328+ ))
329+ .child(glyph(
330+ "spine-zoom-fit",
331+ "⊡",
332+ ActionId::ZoomFit,
333+ false,
334+ false,
335+ player,
336+ cx,
276337 ))
277- .child(glyph("spine-zoom-fit", "⊡", ActionId::ZoomFit, false, false, player, cx))
278338 .child(group_head("track"))
279- .child(glyph("spine-add-video", "+V", ActionId::AddVideoLane, false, false, player, cx))
280- .child(glyph("spine-add-audio", "+A", ActionId::AddAudioLane, false, false, player, cx))
339+ .child(glyph(
340+ "spine-add-video",
341+ "+V",
342+ ActionId::AddVideoLane,
343+ false,
344+ false,
345+ player,
346+ cx,
347+ ))
348+ .child(glyph(
349+ "spine-add-audio",
350+ "+A",
351+ ActionId::AddAudioLane,
352+ false,
353+ false,
354+ player,
355+ cx,
356+ ))
281357 // The subtitle trio (homeless per this task's audit): AddSubtitleLane
282358 // joins +V/+A on the same "+letter" grammar per this task's own
283359 // instruction ("+S joins +V/+A in TRACK"); remove/import are "the
@@ -291,12 +367,44 @@ pub(crate) fn render(player: &Player, cx: &mut Context<Player>) -> impl IntoElem
291367 // ROOM cluster below: cue visibility is judged shot to shot, closer
292368 // in frequency to a view toggle used often than to a once-a-session
293369 // preference.
294- .child(glyph("spine-add-subtitle", "+S", ActionId::AddSubtitleLane, false, false, player, cx))
370+ .child(glyph(
371+ "spine-add-subtitle",
372+ "+S",
373+ ActionId::AddSubtitleLane,
374+ false,
375+ false,
376+ player,
377+ cx,
378+ ))
295379 .child(pair(
296- glyph("spine-remove-subtitle", "−S", ActionId::RemoveSubtitleLane, false, false, player, cx),
297- glyph("spine-import-subtitles", "↓S", ActionId::ImportSubtitles, false, false, player, cx),
380+ glyph(
381+ "spine-remove-subtitle",
382+ "−S",
383+ ActionId::RemoveSubtitleLane,
384+ false,
385+ false,
386+ player,
387+ cx,
388+ ),
389+ glyph(
390+ "spine-import-subtitles",
391+ "↓S",
392+ ActionId::ImportSubtitles,
393+ false,
394+ false,
395+ player,
396+ cx,
397+ ),
398+ ))
399+ .child(glyph(
400+ "spine-toggle-subtitles",
401+ "CC",
402+ ActionId::ToggleSubtitles,
403+ player.subs_on,
404+ false,
405+ player,
406+ cx,
298407 ))
299- .child(glyph("spine-toggle-subtitles", "CC", ActionId::ToggleSubtitles, player.subs_on, false, player, cx))
300408 // ROOM: the once-a-session/once-a-project acts this task's charter
301409 // names explicitly (theme, proxies, screenshot, fullscreen) -- ink-
302410 // demoted (`quiet: true`) and paired two-to-a-row to keep the group
@@ -312,18 +420,58 @@ pub(crate) fn render(player: &Player, cx: &mut Context<Player>) -> impl IntoElem
312420 .child(group_head("room"))
313421 .child(pair(
314422 glyph("spine-theme", "H", ActionId::Theme, false, true, player, cx),
315- glyph("spine-proxies", "P", ActionId::ToggleProxies, player.proxies_on, true, player, cx),
423+ glyph(
424+ "spine-proxies",
425+ "P",
426+ ActionId::ToggleProxies,
427+ player.proxies_on,
428+ true,
429+ player,
430+ cx,
431+ ),
316432 ))
317433 .child(pair(
318- glyph("spine-auto-proxies", "AP", ActionId::ToggleAutoProxies, player.auto_proxies_on, true, player, cx),
319- glyph("spine-fullscreen", "FS", ActionId::Fullscreen, false, true, player, cx),
434+ glyph(
435+ "spine-auto-proxies",
436+ "AP",
437+ ActionId::ToggleAutoProxies,
438+ player.auto_proxies_on,
439+ true,
440+ player,
441+ cx,
442+ ),
443+ glyph(
444+ "spine-fullscreen",
445+ "FS",
446+ ActionId::Fullscreen,
447+ false,
448+ true,
449+ player,
450+ cx,
451+ ),
452+ ))
453+ .child(glyph(
454+ "spine-screenshot",
455+ "Sh",
456+ ActionId::Screenshot,
457+ false,
458+ true,
459+ player,
460+ cx,
320461 ))
321- .child(glyph("spine-screenshot", "Sh", ActionId::Screenshot, false, true, player, cx))
322462 // The settings page's own visible door (user complaint: "some
323463 // options are only reachable via keyboard shortcut") -- a chord
324464 // alone is a defect class this room has hit repeatedly, so this
325465 // glyph sits beside the other once-a-session ROOM acts even though
326466 // its chord (`^,`) is a preference, not a mnemonic.
327- .child(glyph("spine-settings", "St", ActionId::Settings, player.settings_open, true, player, cx))
467+ .child(glyph(
468+ "spine-settings",
469+ "St",
470+ ActionId::Settings,
471+ player.settings_open,
472+ true,
473+ player,
474+ cx,
475+ ))
328476 .child(div().flex_1())
329477 }
crates/app/src/ui/stance.rsmodified+90 -59
@@ -8,13 +8,13 @@
88 //! interaction, no cut machinery -- `// hook:` comments below mark where the
99 //! later steps in DESIGN §12's package attach.
1010
11-use crate::*;
1211 use crate::ui::bench_stance;
1312 use crate::ui::dock_stance;
1413 use crate::ui::settings_stance;
15-use crate::ui::timeband_stance;
1614 use crate::ui::spine_stance;
15+use crate::ui::timeband_stance;
1716 use crate::ui::type_scale::{self, Typeset};
17+use crate::*;
1818
1919 /// Left rail, full height (DESIGN §5).
2020 const SPINE_W: f32 = 56.;
@@ -39,16 +39,13 @@ pub(crate) const DOCK_W: f32 = 280.;
3939 /// What [`bench`] spends above `bench_stance::render`'s own content: the
4040 /// `bench` div's own `.border_t_1()` (1px) + its `py(4.)` top padding +
4141 /// the section head's real line box -- `type_scale::head()` sizes text at
42-/// `SECTION_HEAD_PX` (10) but never calls `.line_height()`, so gpui's
42+/// `SECTION_HEAD_PX` (12) but never calls `.line_height()`, so gpui's
4343 /// default `TextStyle::line_height` (the golden ratio, `gpui::phi()` ==
4444 /// `1.618034`, not 1x the font size) is what it actually draws:
45-/// `round(10. * 1.618034)` = `round(16.18034)` = `16`. A driven pass found
46-/// this constant undercounting that line box as a bare `10`, one of the two
47-/// causes of `layout::BENCH_MIN_H`'s third clip (see its own doc comment for
48-/// the other). `1 + 4 + 16` = `21`. Named and `pub(crate)` rather than the
49-/// `- 20.` it used to be inlined as, so `layout::BENCH_MIN_H` can add it
50-/// into its own derivation instead of guessing it back out.
51-pub(crate) const BENCH_CHROME_H: f32 = 21.;
45+/// `round(12. * 1.618034)` = `round(19.416408)` = `19`.
46+/// `1 + 4 + 19` = `24`. Named and `pub(crate)` rather than an inline
47+/// subtraction, so `layout::BENCH_MIN_H` can derive from the real chrome.
48+pub(crate) const BENCH_CHROME_H: f32 = 24.;
5249
5350 /// The lowest a menu's top edge may sit and still land inside the
5451 /// bench/ledger/dock footprint below the screen (DESIGN §5, §9, §11 check 6):
@@ -136,7 +133,10 @@ mod menu_floor_tests {
136133 let list_h = (396f32).min(f32::from(room.height));
137134 assert!(list_h <= f32::from(room.height));
138135 let (_, y) = crate::oracle::menu_at(at, viewport, list_h);
139- assert_eq!(y, floor, "the top edge must not be walked back above the floor");
136+ assert_eq!(
137+ y, floor,
138+ "the top edge must not be walked back above the floor"
139+ );
140140 }
141141 }
142142
@@ -196,7 +196,11 @@ thread_local! {
196196 /// reimplemented here. Split out from `picture_scale` so this arithmetic has
197197 /// a runnable check with no `Player`/window to stand up.
198198 fn fit_scale(bounds: Bounds<Pixels>, native: gpui::Size<gpui::DevicePixels>) -> Option<f32> {
199- if bounds.size.width <= px(0.) || bounds.size.height <= px(0.) || native.width.0 <= 0 || native.height.0 <= 0 {
199+ if bounds.size.width <= px(0.)
200+ || bounds.size.height <= px(0.)
201+ || native.width.0 <= 0
202+ || native.height.0 <= 0
203+ {
200204 return None;
201205 }
202206 let fitted = gpui::ObjectFit::Contain.get_bounds(bounds, native);
@@ -269,7 +273,7 @@ fn scale_plate(player: &Player) -> impl IntoElement {
269273 .child(div().text_color(rgb(INK1())).child(value))
270274 }
271275
272-/// A section head: 9px, uppercase, `ink3` -- DESIGN §3's scale for the label
276+/// A section head, uppercase, `ink3` -- DESIGN §3's scale for the label
273277 /// that names a region before anything else lives in it.
274278 fn section_head(label: &str) -> impl IntoElement {
275279 div()
@@ -291,7 +295,10 @@ fn ghost(player: &Player, glyph: &str, action: ActionId) -> impl IntoElement {
291295 .gap(px(2.))
292296 .py(px(6.))
293297 .rounded(px(3.))
294- .type_style(type_scale::label(13., gpui::FontWeight::MEDIUM))
298+ .type_style(type_scale::label(
299+ type_scale::LABEL_ROW_PX,
300+ gpui::FontWeight::MEDIUM,
301+ ))
295302 .text_color(rgb(INK2()))
296303 .child(glyph.to_string())
297304 .child(
@@ -352,43 +359,16 @@ fn keys_overlay(player: &Player) -> impl IntoElement {
352359 .flex_col()
353360 .gap(px(3.))
354361 .child(section_head("all commands · hold ? · release to close"))
355- .children(keys_rows().into_iter().map(|row| match row {
356- KeyRow::Head(category) => div()
357- .flex_none()
358- .pt(px(4.))
359- .type_style(type_scale::head())
360- .text_color(rgb(INK3()))
361- .child(category.label().to_uppercase())
362- .into_any_element(),
363- KeyRow::Act(action) => div()
364- .flex()
365- .justify_between()
366- .gap(px(12.))
367- .child(
368- div()
369- .type_style(type_scale::label(
370- type_scale::CHORD_METADATA_MIN_PX,
371- gpui::FontWeight::MEDIUM,
372- ))
373- .text_color(rgb(INK2()))
374- .child(action.label()),
375- )
376- .child(
377- div()
378- .type_style(type_scale::mono(
379- type_scale::CHORD_METADATA_MIN_PX,
380- gpui::FontWeight::MEDIUM,
381- ))
382- .text_color(rgb(INK3()))
383- // The keys overlay is the full-truth surface
384- // (FAULT 1): every chord an action answers to,
385- // not the badge's primary-only compact form.
386- .child(player.keymap.display(action)),
387- )
388- .into_any_element(),
389- KeyRow::Fixed(i) => {
390- let f = &keymap::FIXED[i];
391- div()
362+ .children(keys_rows().into_iter().map(|row| {
363+ match row {
364+ KeyRow::Head(category) => div()
365+ .flex_none()
366+ .pt(px(4.))
367+ .type_style(type_scale::head())
368+ .text_color(rgb(INK3()))
369+ .child(category.label().to_uppercase())
370+ .into_any_element(),
371+ KeyRow::Act(action) => div()
392372 .flex()
393373 .justify_between()
394374 .gap(px(12.))
@@ -399,7 +379,7 @@ fn keys_overlay(player: &Player) -> impl IntoElement {
399379 gpui::FontWeight::MEDIUM,
400380 ))
401381 .text_color(rgb(INK2()))
402- .child(f.label),
382+ .child(action.label()),
403383 )
404384 .child(
405385 div()
@@ -408,9 +388,38 @@ fn keys_overlay(player: &Player) -> impl IntoElement {
408388 gpui::FontWeight::MEDIUM,
409389 ))
410390 .text_color(rgb(INK3()))
411- .child(f.chord.clone()),
391+ // The keys overlay is the full-truth surface
392+ // (FAULT 1): every chord an action answers to,
393+ // not the badge's primary-only compact form.
394+ .child(player.keymap.display(action)),
412395 )
413- .into_any_element()
396+ .into_any_element(),
397+ KeyRow::Fixed(i) => {
398+ let f = &keymap::FIXED[i];
399+ div()
400+ .flex()
401+ .justify_between()
402+ .gap(px(12.))
403+ .child(
404+ div()
405+ .type_style(type_scale::label(
406+ type_scale::CHORD_METADATA_MIN_PX,
407+ gpui::FontWeight::MEDIUM,
408+ ))
409+ .text_color(rgb(INK2()))
410+ .child(f.label),
411+ )
412+ .child(
413+ div()
414+ .type_style(type_scale::mono(
415+ type_scale::CHORD_METADATA_MIN_PX,
416+ gpui::FontWeight::MEDIUM,
417+ ))
418+ .text_color(rgb(INK3()))
419+ .child(f.chord.clone()),
420+ )
421+ .into_any_element()
422+ }
414423 }
415424 })),
416425 )
@@ -447,7 +456,12 @@ fn spine(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
447456 /// the two-up OUT|IN judging *below* it as a flex sibling (DESIGN §6) rather
448457 /// than layering plates over it: the picture's own `flex_1` shrinks to make
449458 /// room, so every picture pixel that is drawn stays visible.
450-fn screen(player: &mut Player, position: f64, window: &mut Window, cx: &mut Context<Player>) -> impl IntoElement {
459+fn screen(
460+ player: &mut Player,
461+ position: f64,
462+ window: &mut Window,
463+ cx: &mut Context<Player>,
464+) -> impl IntoElement {
451465 let two_up = player.two_up().map(IntoElement::into_any_element);
452466 div()
453467 .id("stance-screen")
@@ -615,7 +629,10 @@ fn notice_plate(message: SharedString, bench_h: f32) -> impl IntoElement {
615629 // shape as the legacy notice bar's own tone stripe (`notice_bar`).
616630 .border_l(px(3.))
617631 .border_color(rgb(notice_severity(&message)))
618- .type_style(type_scale::label(10., gpui::FontWeight::MEDIUM))
632+ .type_style(type_scale::label(
633+ type_scale::LABEL_ROW_PX,
634+ gpui::FontWeight::MEDIUM,
635+ ))
619636 .text_color(rgb(INK1()))
620637 .child(message)
621638 }
@@ -627,7 +644,14 @@ fn ledger(player: &Player, position: f64) -> impl IntoElement {
627644 true => "untitled".to_string(),
628645 false => file_name(&player.project_path),
629646 };
630- let identity = format!("{name} · {}", if player.autosave_dirty { "unsaved" } else { "saved" });
647+ let identity = format!(
648+ "{name} · {}",
649+ if player.autosave_dirty {
650+ "unsaved"
651+ } else {
652+ "saved"
653+ }
654+ );
631655 let last_action = player.notices.back().cloned().unwrap_or_else(|| "—".into());
632656 let export = player
633657 .exporting()
@@ -698,7 +722,12 @@ fn ledger(player: &Player, position: f64) -> impl IntoElement {
698722 /// "ui fields are not stretchable" for the dock. `window_size` is threaded
699723 /// through so the maximize-in-place cards inside the dock (`dock_stance.rs`)
700724 /// see the real viewport rather than a fabricated `size(px(DOCK_W), h)`.
701-fn dock(player: &Player, dock_w: f32, window_size: Size<Pixels>, cx: &mut Context<Player>) -> impl IntoElement {
725+fn dock(
726+ player: &Player,
727+ dock_w: f32,
728+ window_size: Size<Pixels>,
729+ cx: &mut Context<Player>,
730+) -> impl IntoElement {
702731 div()
703732 .id("stance-dock")
704733 .flex_none()
@@ -945,7 +974,9 @@ pub(crate) fn render(
945974 el.child(notice_plate(n, bench_h))
946975 })
947976 .when(player.keys_open, |el| el.child(keys_overlay(player)))
948- .when(player.settings_open, |el| el.child(settings_stance::render(player, cx)))
977+ .when(player.settings_open, |el| {
978+ el.child(settings_stance::render(player, cx))
979+ })
949980 // The two menus (DESIGN §9: "verbs of the thing under the
950981 // cursor", plate styling, the same scrim-and-row component
951982 // the legacy tree already uses -- `library.rs`'s own doc
crates/app/src/ui/timeband_stance.rsmodified+4 -7
@@ -4,12 +4,9 @@
44 //! the strip; this module owns what fills it, the same split
55 //! `dock_stance.rs`/`bench_stance.rs` already make for their regions.
66 //!
7-//! Type note: DESIGN.md §3 says the hero timecode is 13px; the approved mock
8-//! (MOCK-SPEC.md) reads closer to ~20px. Kept at 13px here -- the binding
9-//! contract's own number, already what `stance.rs::time_band()` shipped --
10-//! rather than silently picking the mock's, and named here per this task's
11-//! own instruction to say so when the two disagree. Every size in this
12-//! module now comes from `ui::type_scale` (role, not a bare `px()` literal).
7+//! Type note: DESIGN.md §3's approved scale gives the hero timecode 18px,
8+//! close to the mock's ~20px reading. Every size in this module comes from
9+//! `ui::type_scale` (role, not a bare `px()` literal).
1310
1411 use crate::*;
1512 use crate::ui::type_scale::{self, label, mono};
@@ -28,7 +25,7 @@ thread_local! {
2825 }
2926
3027 /// A stacked ghost command (DESIGN §4, MOCK-SPEC "Ghost transport"/"spine"):
31-/// glyph ~13px `ink2` over its chord ~9.5px `ink3`, read live off the keymap
28+/// glyph 18px `ink2` over its chord 13px `ink3`, read live off the keymap
3229 /// so a rebind can never leave the band showing a stroke that no longer
3330 /// fires it -- the same shape `stance::ghost` draws for the spine, kept local
3431 /// here so this module owns its own region end to end.
crates/app/src/ui/type_scale.rsmodified+29 -25
@@ -37,20 +37,15 @@ pub const SPLINE_SANS_MONO: &str = "Spline Sans Mono";
3737
3838 /// DESIGN §3's scale, named so a call site reads the role, not a number.
3939 ///
40-/// Landed at a conservative +2px bump over the original half-pixel scale
41-/// (13/10.5/10-9.5/9/8 -> 15/13/12-11/10/9), chosen over a fuller
42-/// "readable at arm's length" candidate (18/15/14-13/12/10) to keep the
43-/// fixed-width dock/bench card labels clear of the truncation ladder
44-/// (DESIGN §7). To try the fuller scale, swap these six values for
45-/// 18./15./14./13./12./10. and update `the_scale_matches_design_3` (and
46-/// DESIGN.md §3) to match.
47-pub const HERO_TIMECODE_PX: f32 = 15.;
48-pub const LABEL_ROW_PX: f32 = 13.;
49-pub const CHORD_METADATA_MAX_PX: f32 = 12.;
50-pub const CHORD_METADATA_MIN_PX: f32 = 11.;
51-pub const SECTION_HEAD_PX: f32 = 10.;
40+/// The approved readable-at-arm's-length scale. Each role is a whole pixel:
41+/// fractional baselines blur cosmic-text's greyscale AA.
42+pub const HERO_TIMECODE_PX: f32 = 18.;
43+pub const LABEL_ROW_PX: f32 = 15.;
44+pub const CHORD_METADATA_MAX_PX: f32 = 14.;
45+pub const CHORD_METADATA_MIN_PX: f32 = 13.;
46+pub const SECTION_HEAD_PX: f32 = 12.;
5247 /// The floor DESIGN §3 sets: nothing in the room reads smaller than this.
53-pub const FLOOR_PX: f32 = 9.;
48+pub const FLOOR_PX: f32 = 10.;
5449
5550 /// A family, weight and size together -- what a call site needs to paint
5651 /// text with `.font(style.font).text_size(style.size)`, and nothing it has
@@ -90,7 +85,10 @@ impl WithWeight for Font {
9085 /// Archivo, at the given size and weight -- labels, verbs, section heads.
9186 /// No italics anywhere in the room (DESIGN §3), so this never offers one.
9287 pub fn label(size_px: f32, weight: FontWeight) -> TypeStyle {
93- debug_assert!(size_px >= FLOOR_PX, "below DESIGN §3's 8px floor: {size_px}");
88+ debug_assert!(
89+ size_px >= FLOOR_PX,
90+ "below DESIGN §3's 10px floor: {size_px}"
91+ );
9492 TypeStyle {
9593 font: family_font(ARCHIVO, weight, false),
9694 size: px(size_px),
@@ -100,14 +98,17 @@ pub fn label(size_px: f32, weight: FontWeight) -> TypeStyle {
10098 /// Spline Sans Mono, at the given size and weight, tabular figures on --
10199 /// everything the film says.
102100 pub fn mono(size_px: f32, weight: FontWeight) -> TypeStyle {
103- debug_assert!(size_px >= FLOOR_PX, "below DESIGN §3's 8px floor: {size_px}");
101+ debug_assert!(
102+ size_px >= FLOOR_PX,
103+ "below DESIGN §3's 10px floor: {size_px}"
104+ );
104105 TypeStyle {
105106 font: family_font(SPLINE_SANS_MONO, weight, true),
106107 size: px(size_px),
107108 }
108109 }
109110
110-/// A 9px Archivo 700 section head, `ink3`. The caller still has to uppercase
111+/// A 12px Archivo 700 section head, `ink3`. The caller still has to uppercase
111112 /// its own text (`.to_uppercase()`) and paint `ink3` -- this module only
112113 /// owns type, not colour, and stays out of `ui::theme`'s door.
113114 ///
@@ -122,7 +123,7 @@ pub fn head() -> TypeStyle {
122123 }
123124
124125 /// Applies a [`TypeStyle`] to any styled element in one call --
125-/// `div().type_style(mono(9.5, FontWeight::MEDIUM))` instead of the
126+/// `div().type_style(mono(CHORD_METADATA_MIN_PX, FontWeight::MEDIUM))` instead of the
126127 /// `.font(style.font).text_size(style.size)` pair spelled out at every call
127128 /// site. Blanket-implemented over `Styled` so every element in the room gets
128129 /// it for free.
@@ -168,8 +169,10 @@ const EMBEDDED: &[(&[u8], &str)] = &[
168169 /// runtime one -- these bytes are fixed at compile time -- so it panics
169170 /// rather than falling silently back to a system face DESIGN §3 forbids.
170171 pub fn register(cx: &App) {
171- let fonts: Vec<Cow<'static, [u8]>> =
172- EMBEDDED.iter().map(|(bytes, _)| Cow::Borrowed(*bytes)).collect();
172+ let fonts: Vec<Cow<'static, [u8]>> = EMBEDDED
173+ .iter()
174+ .map(|(bytes, _)| Cow::Borrowed(*bytes))
175+ .collect();
173176 cx.text_system()
174177 .add_fonts(fonts)
175178 .expect("bundled Archivo / Spline Sans Mono TTFs failed to register");
@@ -181,7 +184,7 @@ mod tests {
181184 use gpui::FontStyle;
182185
183186 /// The scale never drifts below DESIGN §3's floor, and role sizes match
184- /// the numbers §3 names -- a call site changing `15.` to `14.` for the
187+ /// the numbers §3 names -- a call site changing `18.` to `17.` for the
185188 /// hero timecode is the design contract silently moving.
186189 ///
187190 /// Sizes are all whole pixels (raised from the original 13/10.5/9.5-10/9/8
@@ -192,11 +195,12 @@ mod tests {
192195 /// back into this scale.
193196 #[test]
194197 fn the_scale_matches_design_3() {
195- assert_eq!(HERO_TIMECODE_PX, 15.);
196- assert_eq!(LABEL_ROW_PX, 13.);
197- assert!((11. ..=12.).contains(&CHORD_METADATA_MIN_PX));
198- assert_eq!(SECTION_HEAD_PX, 10.);
199- assert_eq!(FLOOR_PX, 9.);
198+ assert_eq!(HERO_TIMECODE_PX, 18.);
199+ assert_eq!(LABEL_ROW_PX, 15.);
200+ assert_eq!(CHORD_METADATA_MAX_PX, 14.);
201+ assert_eq!(CHORD_METADATA_MIN_PX, 13.);
202+ assert_eq!(SECTION_HEAD_PX, 12.);
203+ assert_eq!(FLOOR_PX, 10.);
200204 for size in [
201205 HERO_TIMECODE_PX,
202206 LABEL_ROW_PX,