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):
76 - **Spline Sans Mono** — everything the film says: timecode, chords, readouts, metadata,76 - **Spline Sans Mono** — everything the film says: timecode, chords, readouts, metadata,
77 cue text, the ledger. Mono = data; if a string is *about the footage or a key*, it is mono.77 cue text, the ledger. Mono = data; if a string is *about the footage or a key*, it is mono.
78 78
79-Scale: 15px hero timecode (700, colons in `ink3`) · 13px labels/rows (500) · 11–12px chords79+Scale: 18px hero timecode (700, colons in `ink3`) · 15px labels/rows (500) · 13–14px chords
80-and metadata (500) · 10px section heads (Archivo 700, uppercase, +0.14em letter-spacing, `ink3`).80+and metadata (500) · 12px 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 baselines81+Nothing below 10px. Every size is a whole pixel (no half-pixel sizes -- they put glyph baselines
82 off the pixel grid and blurred cosmic-text's AA). No italics. Tabular figures wherever digits82 off the pixel grid and blurred cosmic-text's AA). No italics. Tabular figures wherever digits
83 align.83 align.
84 84
crates/app/src/audio_cards.rsmodified+1 -1
@@ -235,7 +235,7 @@ mod eq_tick_end_w_tests {
235 use super::*;235 use super::*;
236 236
237 /// The defect measured live: a fixed 24 px box wrapped "20 Hz" (5 chars)237 /// The defect measured live: a fixed 24 px box wrapped "20 Hz" (5 chars)
238- /// at the dark theme's 11 px end-tick size. The derived width must clear238+ /// at the dark theme's 13 px end-tick size. The derived width must clear
239 /// that box, and must grow, not shrink, if a future scale bump raises239 /// that box, and must grow, not shrink, if a future scale bump raises
240 /// the size fed in.240 /// the size fed in.
241 #[test]241 #[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.;
322 /// hand it to the lane column as a bonus at exactly the zoom where the hand is322 /// hand it to the lane column as a bonus at exactly the zoom where the hand is
323 /// least expecting the bed to move.323 /// least expecting the bed to move.
324 pub(crate) fn timeline_fixed_h(scroll: bool) -> f32 {324 pub(crate) fn timeline_fixed_h(scroll: bool) -> f32 {
325- TIMELINE_FIXED_H + match scroll {325+ TIMELINE_FIXED_H
326- true => 8. + SCROLL_HIT,326+ + match scroll {
327- false => 0.,327+ true => 8. + SCROLL_HIT,
328- }328+ false => 0.,
329+ }
329 }330 }
330 331
331 /// The most of a short window the timeline may take, sized so the seam's own332 /// 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.;
471 /// lane, which has no next row to spill into and clipped straight into the472 /// lane, which has no next row to spill into and clipped straight into the
472 /// ledger instead.473 /// ledger instead.
473 ///474 ///
474-/// A third driven pass at the next floor (`94.`, `BENCH_CHROME_H` still475+/// With the 18/15/14-13/12/10px type scale, the same derivation uses a 24px
475-/// undercounted at `20.`) clipped A1's dot again, by one row -- two 1px476+/// chrome block and two 27px lane floors:
476-/// causes stacked, not one 2px guess: `BENCH_CHROME_H`'s own undercount477+/// `24 + 22 + 2 + 54 + 2 + 1` = `105.`.
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.`.
479 pub(crate) const BENCH_MIN_H: f32 = crate::ui::stance::BENCH_CHROME_H478 pub(crate) const BENCH_MIN_H: f32 = crate::ui::stance::BENCH_CHROME_H
480 + crate::ui::bench_stance::RULER_H479 + crate::ui::bench_stance::RULER_H
481 + crate::ui::bench_stance::ROW_GAP480 + crate::ui::bench_stance::ROW_GAP
@@ -539,8 +538,12 @@ pub(crate) fn load_stance_splits_from(path: &std::path::Path) -> Splits {
539 let mut splits = Splits::default();538 let mut splits = Splits::default();
540 if let Ok(text) = std::fs::read_to_string(path) {539 if let Ok(text) = std::fs::read_to_string(path) {
541 for line in text.lines() {540 for line in text.lines() {
542- let Some((key, value)) = line.split_once('=') else { continue };541+ let Some((key, value)) = line.split_once('=') else {
543- let Ok(px) = value.trim().parse::<f32>() else { continue };542+ continue;
543+ };
544+ let Ok(px) = value.trim().parse::<f32>() else {
545+ continue;
546+ };
544 let Some(split) = Split::PERSISTED.into_iter().find(|s| s.key() == key) else {547 let Some(split) = Split::PERSISTED.into_iter().find(|s| s.key() == key) else {
545 continue;548 continue;
546 };549 };
@@ -561,7 +564,11 @@ pub(crate) fn save_stance_splits(splits: &Splits) {
561 pub(crate) fn save_stance_splits_to(splits: &Splits, path: &std::path::Path) {564 pub(crate) fn save_stance_splits_to(splits: &Splits, path: &std::path::Path) {
562 let text: String = Split::PERSISTED565 let text: String = Split::PERSISTED
563 .into_iter()566 .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+ })
565 .collect();572 .collect();
566 if let Some(dir) = path.parent() {573 if let Some(dir) = path.parent() {
567 let _ = std::fs::create_dir_all(dir);574 let _ = std::fs::create_dir_all(dir);
crates/app/src/tests/cards.rsmodified+108 -38
@@ -16,7 +16,9 @@ use std::sync::atomic::Ordering;
16 #[test]16 #[test]
17 fn no_overlaid_state_in_the_stance_goes_modal_without_painting_something() {17 fn no_overlaid_state_in_the_stance_goes_modal_without_painting_something() {
18 let stance = src_text("ui/stance.rs");18 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")..];
20 for menu in ["context_card(", "library_card(", "picker_card("] {22 for menu in ["context_card(", "library_card(", "picker_card("] {
21 assert!(23 assert!(
22 render_body.contains(menu),24 render_body.contains(menu),
@@ -28,7 +30,11 @@ fn no_overlaid_state_in_the_stance_goes_modal_without_painting_something() {
28 .find("if this.rebinding.is_some()\n || this.card_open()")30 .find("if this.rebinding.is_some()\n || this.card_open()")
29 .expect("the stance's modal guard");31 .expect("the stance's modal guard");
30 let guard = &stance[guard_at..guard_at + 1600];32 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+ ] {
32 assert!(38 assert!(
33 guard.contains(field),39 guard.contains(field),
34 "the overlaid()/rebinding branch no longer clears {field} on every key -- \40 "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() {
61 fields.push(name);67 fields.push(name);
62 }68 }
63 }69 }
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+ );
65 // The mounted-surface function each field's own card draws, by the74 // The mounted-surface function each field's own card draws, by the
66 // convention the param cards already follow (`x_open` -> `x_card(` --75 // convention the param cards already follow (`x_open` -> `x_card(` --
67 // `Player::eq_card`/`color_card`/... in `ui/cards.rs`). `keys_open` and76 // `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() {
91 ),100 ),
92 }101 }
93 };102 };
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+ );
95 for field in &fields {108 for field in &fields {
96 let mount = mount_for(field);109 let mount = mount_for(field);
97 assert!(110 assert!(
@@ -249,7 +262,10 @@ fn every_action_is_on_the_actions_card() {
249 }262 }
250 // The list scrolls inside a card the smallest window holds, so a263 // The list scrolls inside a card the smallest window holds, so a
251 // thirty-fourth action costs no height at all.264 // 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+ );
253 // Both halves of a row are click targets, so WCAG 2.5.8 binds them.269 // Both halves of a row are click targets, so WCAG 2.5.8 binds them.
254 assert!(KEYS_ROW_H >= HIT_MIN);270 assert!(KEYS_ROW_H >= HIT_MIN);
255 }271 }
@@ -458,10 +474,19 @@ fn the_equalizer_graph_puts_a_band_where_a_drag_reads_it_and_fits_the_smallest_w
458 474
459 // The card fits the smallest window and takes the room a bigger one has475 // The card fits the smallest window and takes the room a bigger one has
460 // -- it is a graph, and the width *is* the frequency resolution.476 // -- 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");477+ assert!(
462- assert!(eq_card_w(1280., false) > eq_card_w(640., false), "card ignores the window");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+ );
463 assert_eq!(eq_card_w(1920., false), EQ_W_MAX, "card grows without end");485 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+ );
465 // At the smallest window the graph is still a graph: three across for490 // At the smallest window the graph is still a graph: three across for
466 // one down, so an octave is wide enough to put a handle in.491 // one down, so an octave is wide enough to put a handle in.
467 assert!(492 assert!(
@@ -905,7 +930,10 @@ fn the_clock_stops_where_the_timeline_does_and_the_end_still_restarts() {
905 let deadline = Instant::now() + Duration::from_secs(20);930 let deadline = Instant::now() + Duration::from_secs(20);
906 let mut state = transport(session.is_playing(), session.is_eos());931 let mut state = transport(session.is_playing(), session.is_eos());
907 while state != Transport::Ended {932 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+ );
909 session.tick();937 session.tick();
910 while session.try_frame().is_some() {}938 while session.try_frame().is_some() {}
911 state = transport(session.is_playing(), session.is_eos());939 state = transport(session.is_playing(), session.is_eos());
@@ -982,7 +1010,14 @@ fn a_quality_row_is_the_bitrate_it_promises() {
982 Some(2_000_000)1010 Some(2_000_000)
983 );1011 );
984 assert_eq!(1012 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,
986 Some(6_000_000)1021 Some(6_000_000)
987 );1022 );
988 assert_eq!(1023 assert_eq!(
@@ -991,7 +1026,14 @@ fn a_quality_row_is_the_bitrate_it_promises() {
991 );1026 );
992 // Megabits as typed, and as the row says it back.1027 // Megabits as typed, and as the row says it back.
993 assert_eq!(1028 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,
995 Some(7_000_000)1037 Some(7_000_000)
996 );1038 );
997 assert_eq!(Quality::Low.detail(0), "2 Mbps");1039 assert_eq!(Quality::Low.detail(0), "2 Mbps");
@@ -999,7 +1041,14 @@ fn a_quality_row_is_the_bitrate_it_promises() {
999 // choice the engine never hears about.1041 // choice the engine never hears about.
1000 for format in [Format::Mp4, Format::Wav, Format::Flac] {1042 for format in [Format::Mp4, Format::Wav, Format::Flac] {
1001 assert_eq!(1043 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,
1003 format1052 format
1004 );1053 );
1005 }1054 }
@@ -1008,7 +1057,13 @@ fn a_quality_row_is_the_bitrate_it_promises() {
1008 // silently changes -- the ceiling row included, which is the one a1057 // silently changes -- the ceiling row included, which is the one a
1009 // raised cap could have walked out past.1058 // raised cap could have walked out past.
1010 for quality in Quality::ALL {1059 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+ );
1012 if let Some(bitrate) = settings.bitrate {1067 if let Some(bitrate) = settings.bitrate {
1013 assert!(1068 assert!(
1014 (u64::from(MBPS_MIN) * 1_000_000..=u64::from(MBPS_MAX) * 1_000_000)1069 (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() {
1144 // The hint the field shows when there is nothing to refuse names both1199 // The hint the field shows when there is nothing to refuse names both
1145 // ways out of it.1200 // ways out of it.
1146 let detail = NumberEdit::new(6).detail();1201 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+ );
1148 assert!(detail.starts_with("6▏"), "{detail}");1206 assert!(detail.starts_with("6▏"), "{detail}");
1149 }1207 }
1150 1208
@@ -1198,10 +1256,7 @@ fn a_held_key_moves_a_value_and_nothing_else() {
1198 held,1256 held,
1199 matches!(1257 matches!(
1200 action,1258 action,
1201- ActionId::VolumeUp1259+ ActionId::VolumeUp | ActionId::VolumeDown | ActionId::ZoomIn | ActionId::ZoomOut
1202- | ActionId::VolumeDown
1203- | ActionId::ZoomIn
1204- | ActionId::ZoomOut
1205 ),1260 ),
1206 "{action:?} on a hold"1261 "{action:?} on a hold"
1207 );1262 );
@@ -1292,10 +1347,7 @@ fn a_choice_list_offers_every_value_and_fits_the_smallest_window() {
1292 // The media's own size says so: it is the one rung a person cannot read1347 // The media's own size says so: it is the one rung a person cannot read
1293 // off a number they chose.1348 // off a number they chose.
1294 let (.., native_detail, _) = &rows[3];1349 let (.., native_detail, _) = &rows[3];
1295- assert!(1350+ assert!(native_detail.contains("the media's own"), "{native_detail}");
1296- native_detail.contains("the media's own"),
1297- "{native_detail}"
1298- );
1299 // A project at a size nobody listed still gets the whole list, with1351 // A project at a size nobody listed still gets the whole list, with
1300 // nothing marked rather than a wrong row marked.1352 // nothing marked rather than a wrong row marked.
1301 assert!(1353 assert!(
@@ -1375,7 +1427,11 @@ fn a_choice_list_offers_every_value_and_fits_the_smallest_window() {
1375 for format in [Format::Av1, Format::Av1Mp4] {1427 for format in [Format::Av1, Format::Av1Mp4] {
1376 assert!(av1_hw_warning(format, EncoderSeat::Hardware).is_some());1428 assert!(av1_hw_warning(format, EncoderSeat::Hardware).is_some());
1377 for seat in [EncoderSeat::Auto, EncoderSeat::Software] {1429 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+ );
1379 }1435 }
1380 }1436 }
1381 for format in [Format::Mp4, Format::Hevc, Format::HevcMp4, Format::Wav] {1437 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() {
1411 fn the_resolution_and_rate_lists_work_before_any_file_is_open() {1467 fn the_resolution_and_rate_lists_work_before_any_file_is_open() {
1412 let none = pending_resolution_choices(None);1468 let none = pending_resolution_choices(None);
1413 assert_eq!(none.len(), RESOLUTIONS.len());1469 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+ );
1415 for ((choice, label, detail, _), size) in none.iter().zip(RESOLUTIONS) {1474 for ((choice, label, detail, _), size) in none.iter().zip(RESOLUTIONS) {
1416 assert_eq!(*choice, Choice::Size(size.0, size.1));1475 assert_eq!(*choice, Choice::Size(size.0, size.1));
1417 assert_eq!(label.as_ref(), format!("{}p", size.1));1476 assert_eq!(label.as_ref(), format!("{}p", size.1));
@@ -1510,10 +1569,10 @@ fn the_export_card_fits_the_smallest_window() {
1510 "{id:?}: refusal ink {:.2}",1569 "{id:?}: refusal ink {:.2}",
1511 contrast(p.FG_SECONDARY, p.BG_RAISED)1570 contrast(p.FG_SECONDARY, p.BG_RAISED)
1512 );1571 );
1513- // ...and on the picked row, where the highlight is the accent at1572+ // ...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 still1573+ // 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 as1574+ // lifts its key and detail to `FG_PRIMARY`, as emphasis rather than as
1516- // the rescue it used to be.1575+ // the rescue it used to be.
1517 assert!(contrast(p.FG_PRIMARY, p.BG_SELECTED) >= 4.5, "{id:?}");1576 assert!(contrast(p.FG_PRIMARY, p.BG_SELECTED) >= 4.5, "{id:?}");
1518 assert!(1577 assert!(
1519 contrast(p.FG_SECONDARY, p.BG_SELECTED) >= 4.5,1578 contrast(p.FG_SECONDARY, p.BG_SELECTED) >= 4.5,
@@ -1662,8 +1721,7 @@ fn every_preset_bundle_round_trips_through_from_state() {
1662 /// dimmed row is ignored.1721 /// dimmed row is ignored.
1663 #[test]1722 #[test]
1664 fn a_preset_over_a_picture_this_timeline_has_none_of_carries_the_codec_refusal() {1723 fn a_preset_over_a_picture_this_timeline_has_none_of_carries_the_codec_refusal() {
1665- let mut session =1724+ let mut session = PlaybackSession::open(asset("test_tone.mp3")).expect("a song is a timeline");
1666- PlaybackSession::open(asset("test_tone.mp3")).expect("a song is a timeline");
1667 session.set_gain(0.0);1725 session.set_gain(0.0);
1668 let path = session.sources()[0].path.clone();1726 let path = session.sources()[0].path.clone();
1669 session.seek(1.0);1727 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
1751 exemption must not weaken"1809 exemption must not weaken"
1752 );1810 );
1753 OVERLAID.store(false, Ordering::Relaxed);1811 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+ );
1755 1816
1756 // Structural half: every card routes its head through `dark_card_head`,1817 // Structural half: every card routes its head through `dark_card_head`,
1757 // so checking its one help-tooltip call site covers all seven cards (and1818 // so checking its one help-tooltip call site covers all seven cards (and
1758 // any future eighth) at once -- it must build an `OverlayTip`, not a1819 // any future eighth) at once -- it must build an `OverlayTip`, not a
1759 // plain `Tip`, or this whole fix is undone by construction.1820 // plain `Tip`, or this whole fix is undone by construction.
1760 let cards_src = src_text("ui/cards.rs");1821 let cards_src = src_text("ui/cards.rs");
1761- let head_fn_at = cards_src.find("fn dark_card_head(").expect("dark_card_head");1822+ let head_fn_at = cards_src
1762- // 1200 was wide enough before this session's maximize glyph/tooltip1823+ .find("fn dark_card_head(")
1763- // (`.when(maximize.is_some(), ...)` + its own `OverlayTip`) grew the1824+ .expect("dark_card_head");
1764- // function ahead of the help tooltip this test is actually pinning.1825+ // Bound the inspected source by the next item, not a byte count: rustfmt
1765- let head_fn = &cards_src[head_fn_at..head_fn_at + 2400];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];
1766 assert!(1832 assert!(
1767 head_fn.contains("OverlayTip(h.clone())"),1833 head_fn.contains("OverlayTip(h.clone())"),
1768 "dark_card_head's own `?` tooltip no longer builds an OverlayTip -- the \1834 "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() {
1831 /// inside the dock, or hands it the dock's width again, fails this.1897 /// inside the dock, or hands it the dock's width again, fails this.
1832 #[test]1898 #[test]
1833 fn a_maximized_cards_room_is_bigger_than_the_docked_rooms_not_smaller() {1899 fn a_maximized_cards_room_is_bigger_than_the_docked_rooms_not_smaller() {
1834- use crate::layout::{Split, split_size};
1835 use crate::SPLIT_W;1900 use crate::SPLIT_W;
1901+ use crate::layout::{Split, split_size};
1836 1902
1837 // Mirrors `ui/stance.rs`'s private `SPINE_W` (56.) and `layout::SPLIT_W`1903 // Mirrors `ui/stance.rs`'s private `SPINE_W` (56.) and `layout::SPLIT_W`
1838 // (the one divider between `stance-centre` and the dock): recomputed1904 // (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() {
1934 2000
1935 // A file from a future/corrupt version leaves the default in force2001 // A file from a future/corrupt version leaves the default in force
1936 // rather than failing the room that opens over it.2002 // 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();
1938 assert_eq!(crate::ui::dock_stance::load_maximized(), false);2008 assert_eq!(crate::ui::dock_stance::load_maximized(), false);
1939 2009
1940 unsafe { std::env::remove_var("XDG_CONFIG_HOME") };2010 unsafe { std::env::remove_var("XDG_CONFIG_HOME") };
crates/app/src/ui/bench_stance.rsmodified+115 -74
@@ -38,9 +38,9 @@
38 //! `nudge_cut` and friends still act on `Player::selected` directly, with no38 //! `nudge_cut` and friends still act on `Player::selected` directly, with no
39 //! element under the pointer required, and stay untouched by any of this.39 //! element under the pointer required, and stay untouched by any of this.
40 40
41-use crate::*;
42 use crate::ui::type_scale::{self, Typeset};41 use crate::ui::type_scale::{self, Typeset};
43 use crate::ui::widgets::*;42 use crate::ui::widgets::*;
43+use crate::*;
44 44
45 /// The pinned ruler's own height, above the lane stack -- tall enough for a45 /// The pinned ruler's own height, above the lane stack -- tall enough for a
46 /// tick line plus a mono `MM:SS` label under it (DESIGN §5's "tick marks with46 /// 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] = [
53 0.5, 1., 2., 5., 10., 15., 30., 60., 120., 300., 600., 1800., 3600.,53 0.5, 1., 2., 5., 10., 15., 30., 60., 120., 300., 600., 1800., 3600.,
54 ];54 ];
55 /// The floor a tick's pixel spacing must clear before its label is legible55 /// The floor a tick's pixel spacing must clear before its label is legible
56-/// mono text at 8px.56+/// mono text at 10px.
57 const TICK_MIN_PX: f64 = 64.;57 const TICK_MIN_PX: f64 = 64.;
58-/// The playhead timecode plate's own width, wide enough for `HH:MM:SS:FF`58+/// The playhead timecode plate's own width: eleven mono characters at the
59-/// mono at 10px plus the plate's padding.59+/// 14px readout role plus its horizontal padding and a 1px rounding guard,
60-const PLATE_W: f32 = 74.;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.;
61 /// The pinned track-head column, DESIGN §5's "track heads" -- narrower than65 /// The pinned track-head column, DESIGN §5's "track heads" -- narrower than
62 /// the legacy timeline's `HEADER_W` since a darkroom lane carries no mix/eye66 /// the legacy timeline's `HEADER_W` since a darkroom lane carries no mix/eye
63 /// button yet (deferred with the rest of the header's verbs).67 /// button yet (deferred with the rest of the header's verbs).
@@ -79,10 +83,8 @@ pub(crate) const LANE_DOT_D: f32 = 4.;
79 /// golden ratio (`gpui::phi()` == `relative(1.618034)`), and `lane_row`83 /// golden ratio (`gpui::phi()` == `relative(1.618034)`), and `lane_row`
80 /// never calls `.line_height()` on the head label to override it -- so this84 /// never calls `.line_height()` on the head label to override it -- so this
81 /// is what the label really occupies, not its glyph height.85 /// is what the label really occupies, not its glyph height.
82-/// round(12. * 1.618034) would be wrong here: the head uses86+/// `round(13. * 1.618034) = 21`.
83-/// `CHORD_METADATA_MIN_PX` (11.), so round(11. * 1.618034) = round(17.798)87+const LANE_LABEL_LINE_H: f32 = 21.;
84-/// = 18.
85-const LANE_LABEL_LINE_H: f32 = 18.;
86 /// The least a lane row may be: what its own head actually draws, not a88 /// The least a lane row may be: what its own head actually draws, not a
87 /// number copied from nowhere. The old `18.` fit only the label's line box89 /// number copied from nowhere. The old `18.` fit only the label's line box
88 /// and let every lane's status dot overflow into the row beneath it --90 /// and let every lane's status dot overflow into the row beneath it --
@@ -200,7 +202,9 @@ fn clip_box(
200 let source = player.sources().get(clip.source);202 let source = player.sources().get(clip.source);
201 let label = source.map(|s| file_name(&s.path));203 let label = source.map(|s| file_name(&s.path));
202 let audio = lane.kind == LaneKind::Audio;204 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();
204 // hook: §12 step 5 -- per-source film ink attaches here, replacing208 // hook: §12 step 5 -- per-source film ink attaches here, replacing
205 // `source_tint` (library_meta.rs's own placeholder wheel, index-keyed and209 // `source_tint` (library_meta.rs's own placeholder wheel, index-keyed and
206 // already different per source) with the source's own quantized hue.210 // already different per source) with the source's own quantized hue.
@@ -213,7 +217,10 @@ fn clip_box(
213 let has_spine = t != Tier::Sliver;217 let has_spine = t != Tier::Sliver;
214 let has_label = matches!(t, Tier::Full | Tier::NoChip);218 let has_label = matches!(t, Tier::Full | Tier::NoChip);
215 let has_chip = t == Tier::Full && !clip.speed.is_normal();219 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+ );
217 let speed = clip.speed;224 let speed = clip.speed;
218 // Right-aligned readout: the trim delta off the source's full length when225 // Right-aligned readout: the trim delta off the source's full length when
219 // this clip is shorter than the file it was cut from, else the plain226 // this clip is shorter than the file it was cut from, else the plain
@@ -222,7 +229,12 @@ fn clip_box(
222 // means (§12's cut object has no per-edge history at this layer) --229 // means (§12's cut object has no per-edge history at this layer) --
223 // ceiling is wiring this to the same cut state once the time band exposes230 // ceiling is wiring this to the same cut state once the time band exposes
224 // it, rather than a second reading of "trim" here.231 // 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+ });
226 let readout = match full_frames {238 let readout = match full_frames {
227 Some(full) if full > clip.frames() => {239 Some(full) if full > clip.frames() => {
228 let delta = f64::from(full - clip.frames()) / player.fps;240 let delta = f64::from(full - clip.frames()) / player.fps;
@@ -234,7 +246,10 @@ fn clip_box(
234 // is consumed by the name plate below.246 // is consumed by the name plate below.
235 let ghost: SharedString = label.clone().unwrap_or_else(|| lane.label()).into();247 let ghost: SharedString = label.clone().unwrap_or_else(|| lane.label()).into();
236 div()248 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+ ))
238 .absolute()253 .absolute()
239 .top_0()254 .top_0()
240 .h_full()255 .h_full()
@@ -270,10 +285,17 @@ fn clip_box(
270 // Dragged, it moves: to the frame and the lane it is let go over285 // Dragged, it moves: to the frame and the lane it is let go over
271 // (`Player::move_clip`, `ClipDrag`) -- the same payload and the same286 // (`Player::move_clip`, `ClipDrag`) -- the same payload and the same
272 // ghost tooltip `ui/timeline.rs`'s own clip box drags.287 // ghost tooltip `ui/timeline.rs`'s own clip box drags.
273- .on_drag(ClipDrag { lane, idx, clip: placed }, {288+ .on_drag(
274- let ghost = ghost.clone();289+ ClipDrag {
275- move |_, _, _, cx| cx.new(|_| Tip(ghost.clone()))290+ lane,
276- })291+ idx,
292+ clip: placed,
293+ },
294+ {
295+ let ghost = ghost.clone();
296+ move |_, _, _, cx| cx.new(|_| Tip(ghost.clone()))
297+ },
298+ )
277 // The two edge strips a drag lengthens or shortens the clip by299 // The two edge strips a drag lengthens or shortens the clip by
278 // (`Player::start_trim`), gated on the same `trims(span)` floor the300 // (`Player::start_trim`), gated on the same `trims(span)` floor the
279 // legacy strips use -- a clip too narrow to aim at keeps its whole301 // legacy strips use -- a clip too narrow to aim at keeps its whole
@@ -330,17 +352,19 @@ fn clip_box(
330 // (falling back to a flat placeholder body while it loads or if the352 // (falling back to a flat placeholder body while it loads or if the
331 // file never yields one).353 // file never yields one).
332 .when(has_trace && audio, |d| {354 .when(has_trace && audio, |d| {
333- d.children(wave.and_then(|w| match w {355+ d.children(wave.and_then(|w| {
334- Wave::Peaks(peaks) => Some(356+ match w {
335- div()357+ Wave::Peaks(peaks) => Some(
336- .absolute()358+ div()
337- .left(px(3.))359+ .absolute()
338- .right_0()360+ .left(px(3.))
339- .top_0()361+ .right_0()
340- .bottom_0()362+ .top_0()
341- .child(waveform_ink(peaks, in_frame, out_frame, ink)),363+ .bottom_0()
342- ),364+ .child(waveform_ink(peaks, in_frame, out_frame, ink)),
343- _ => None,365+ ),
366+ _ => None,
367+ }
344 }))368 }))
345 })369 })
346 .when(has_trace && !audio, |d| {370 .when(has_trace && !audio, |d| {
@@ -361,7 +385,8 @@ fn clip_box(
361 })385 })
362 // Name plate + trim/duration readout: one strip, DESIGN §4's plate386 // Name plate + trim/duration readout: one strip, DESIGN §4's plate
363 // (canvas-on-panel), sat at the clip's top-left/top-right per the mock387 // (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.
365 .when(has_label, |d| {390 .when(has_label, |d| {
366 d.child(391 d.child(
367 div()392 div()
@@ -369,7 +394,7 @@ fn clip_box(
369 .left(px(3.))394 .left(px(3.))
370 .right_0()395 .right_0()
371 .top_0()396 .top_0()
372- .h(px(13.))397+ .h(px(LANE_LABEL_LINE_H))
373 .px(px(3.))398 .px(px(3.))
374 .flex()399 .flex()
375 .items_center()400 .items_center()
@@ -392,7 +417,10 @@ fn clip_box(
392 .child(417 .child(
393 div()418 div()
394 .flex_none()419 .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+ ))
396 .text_color(rgb(INK3()))424 .text_color(rgb(INK3()))
397 .child(readout),425 .child(readout),
398 ),426 ),
@@ -408,7 +436,10 @@ fn clip_box(
408 .right_0()436 .right_0()
409 .px(px(3.))437 .px(px(3.))
410 .bg(rgb(DARK_RAISED()))438 .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+ ))
412 .text_color(rgb(INK2()))443 .text_color(rgb(INK2()))
413 .child(format!("{speed}")),444 .child(format!("{speed}")),
414 )445 )
@@ -458,7 +489,10 @@ fn sub_box(
458 // (`PlaybackSession::sub_lane_cues`, the same map the export and the489 // (`PlaybackSession::sub_lane_cues`, the same map the export and the
459 // picture's own plate go through).490 // picture's own plate go through).
460 let cues: Vec<(f32, f32)> = player.session.as_ref().map_or_else(Vec::new, |s| {491 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()
462 });496 });
463 let label = player497 let label = player
464 .session498 .session
@@ -490,10 +524,17 @@ fn sub_box(
490 this.open_menu(lane, idx, event.position, cx);524 this.open_menu(lane, idx, event.position, cx);
491 }),525 }),
492 )526 )
493- .on_drag(SubDrag { lane, idx, sub: placed }, {527+ .on_drag(
494- let ghost = ghost.clone();528+ SubDrag {
495- move |_, _, _, cx| cx.new(|_| Tip(ghost.clone()))529+ lane,
496- })530+ idx,
531+ sub: placed,
532+ },
533+ {
534+ let ghost = ghost.clone();
535+ move |_, _, _, cx| cx.new(|_| Tip(ghost.clone()))
536+ },
537+ )
497 // The same edge-trim strips a clip gets, on the same [`trims`] floor.538 // The same edge-trim strips a clip gets, on the same [`trims`] floor.
498 .children(539 .children(
499 [Edge::Start, Edge::End]540 [Edge::Start, Edge::End]
@@ -681,15 +722,15 @@ fn lane_row(
681 // pointer actually being inside this bed's own bounds, since722 // pointer actually being inside this bed's own bounds, since
682 // `on_drag_move` fires on every painted element of the drag's723 // `on_drag_move` fires on every painted element of the drag's
683 // type, not just the one under the pointer.724 // type, not just the one under the pointer.
684- .on_drag_move(cx.listener(725+ .on_drag_move(
685- move |this, event: &DragMoveEvent<AssetDrag>, _, cx| {726+ cx.listener(move |this, event: &DragMoveEvent<AssetDrag>, _, cx| {
686 if !event.bounds.contains(&event.event.position) {727 if !event.bounds.contains(&event.event.position) {
687 return;728 return;
688 }729 }
689 let path = event.drag(cx).0.clone();730 let path = event.drag(cx).0.clone();
690 this.preview_ghost_asset(&path, lane, event.event.position.x, cx);731 this.preview_ghost_asset(&path, lane, event.event.position.x, cx);
691- },732+ }),
692- ))733+ )
693 .drag_over::<ClipDrag>(|d, _, _, _| d.bg(rgb(DARK_RAISED())))734 .drag_over::<ClipDrag>(|d, _, _, _| d.bg(rgb(DARK_RAISED())))
694 .on_drop(cx.listener(move |this, drag: &ClipDrag, window, cx| {735 .on_drop(cx.listener(move |this, drag: &ClipDrag, window, cx| {
695 let Some(idx) = this.dragged(drag) else {736 let Some(idx) = this.dragged(drag) else {
@@ -697,15 +738,15 @@ fn lane_row(
697 };738 };
698 this.move_clip(drag.lane, idx, lane, window.mouse_position().x, cx)739 this.move_clip(drag.lane, idx, lane, window.mouse_position().x, cx)
699 }))740 }))
700- .on_drag_move(cx.listener(741+ .on_drag_move(
701- move |this, event: &DragMoveEvent<ClipDrag>, _, cx| {742+ cx.listener(move |this, event: &DragMoveEvent<ClipDrag>, _, cx| {
702 if !event.bounds.contains(&event.event.position) {743 if !event.bounds.contains(&event.event.position) {
703 return;744 return;
704 }745 }
705 let drag = *event.drag(cx);746 let drag = *event.drag(cx);
706 this.preview_ghost(&drag, lane, event.event.position.x, cx);747 this.preview_ghost(&drag, lane, event.event.position.x, cx);
707- },748+ }),
708- ))749+ )
709 // A caption already on a lane moves along it, or onto another750 // A caption already on a lane moves along it, or onto another
710 // subtitle track, exactly as a clip does (`Player::move_sub`,751 // subtitle track, exactly as a clip does (`Player::move_sub`,
711 // the same call `ui/timeline.rs`'s own bed makes).752 // the same call `ui/timeline.rs`'s own bed makes).
@@ -713,25 +754,25 @@ fn lane_row(
713 .on_drop(cx.listener(move |this, drag: &SubDrag, window, cx| {754 .on_drop(cx.listener(move |this, drag: &SubDrag, window, cx| {
714 this.move_sub(drag, lane, window.mouse_position().x, cx);755 this.move_sub(drag, lane, window.mouse_position().x, cx);
715 }))756 }))
716- .on_drag_move(cx.listener(757+ .on_drag_move(
717- move |this, event: &DragMoveEvent<SubDrag>, _, cx| {758+ cx.listener(move |this, event: &DragMoveEvent<SubDrag>, _, cx| {
718 if !event.bounds.contains(&event.event.position) {759 if !event.bounds.contains(&event.event.position) {
719 return;760 return;
720 }761 }
721 let drag = *event.drag(cx);762 let drag = *event.drag(cx);
722 this.preview_ghost_sub(&drag, lane, event.event.position.x, cx);763 this.preview_ghost_sub(&drag, lane, event.event.position.x, cx);
723- },764+ }),
724- ))765+ )
725 .drag_over::<SubPick>(|d, _, _, _| d.bg(rgb(DARK_RAISED())))766 .drag_over::<SubPick>(|d, _, _, _| d.bg(rgb(DARK_RAISED())))
726- .on_drag_move(cx.listener(767+ .on_drag_move(
727- move |this, event: &DragMoveEvent<SubPick>, _, cx| {768+ cx.listener(move |this, event: &DragMoveEvent<SubPick>, _, cx| {
728 if !event.bounds.contains(&event.event.position) {769 if !event.bounds.contains(&event.event.position) {
729 return;770 return;
730 }771 }
731 let track = event.drag(cx).0;772 let track = event.drag(cx).0;
732 this.preview_ghost_pick(track, lane, event.event.position.x, cx);773 this.preview_ghost_pick(track, lane, event.event.position.x, cx);
733- },774+ }),
734- ))775+ )
735 // The wheel, matched to the legacy timeline's own mapping:776 // The wheel, matched to the legacy timeline's own mapping:
736 // ctrl+wheel zooms about the pointer, a bare wheel scrolls777 // ctrl+wheel zooms about the pointer, a bare wheel scrolls
737 // the bed along the film (`Player::timeline_wheel`). Stopped778 // the bed along the film (`Player::timeline_wheel`). Stopped
@@ -793,7 +834,11 @@ fn lane_row(
793 834
794 /// The bench's content: pinned ruler, pinned heads, lane stack -- compressed835 /// The bench's content: pinned ruler, pinned heads, lane stack -- compressed
795 /// evenly to [`LANES_COMPRESS`] rows and then scrolling (DESIGN §7).836 /// 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 {
797 let lanes = player842 let lanes = player
798 .session843 .session
799 .as_ref()844 .as_ref()
@@ -869,26 +914,22 @@ pub(crate) fn render(player: &mut Player, box_h: f32, cx: &mut Context<Player>)
869 this.timeline_wheel(event, cx);914 this.timeline_wheel(event, cx);
870 }))915 }))
871 .children(ticks.into_iter().map(|(x, label)| {916 .children(ticks.into_iter().map(|(x, label)| {
872- div()917+ div().absolute().top_0().left(px(x)).child(
873- .absolute()918+ div()
874- .top_0()919+ .flex()
875- .left(px(x))920+ .flex_col()
876- .child(921+ .items_start()
877- div()922+ .child(div().w(px(1.)).h(px(4.)).bg(rgb(INK3())))
878- .flex()923+ .child(
879- .flex_col()924+ div()
880- .items_start()925+ .type_style(type_scale::mono(
881- .child(div().w(px(1.)).h(px(4.)).bg(rgb(INK3())))926+ type_scale::FLOOR_PX,
882- .child(927+ gpui::FontWeight::MEDIUM,
883- div()928+ ))
884- .type_style(type_scale::mono(929+ .text_color(rgb(INK3()))
885- type_scale::FLOOR_PX,930+ .child(label),
886- gpui::FontWeight::MEDIUM,931+ ),
887- ))932+ )
888- .text_color(rgb(INK3()))
889- .child(label),
890- ),
891- )
892 }))933 }))
893 .child(934 .child(
894 div()935 div()
crates/app/src/ui/cards.rsmodified+640 -399
@@ -1,8 +1,8 @@
1 //! The property cards -- docked into the inspector, or floated when modal.1 //! The property cards -- docked into the inspector, or floated when modal.
2 2
3-use crate::*;
4 use crate::ui::type_scale::{self, Typeset};3 use crate::ui::type_scale::{self, Typeset};
5 use crate::ui::widgets::*;4 use crate::ui::widgets::*;
5+use crate::*;
6 6
7 /// DESIGN §3/§4 atoms shared by every param/setting card below (colour,7 /// DESIGN §3/§4 atoms shared by every param/setting card below (colour,
8 /// transform, speed, EQ, silence, mix, subtitle style): what a row's label8 /// transform, speed, EQ, silence, mix, subtitle style): what a row's label
@@ -11,11 +11,14 @@ use crate::ui::widgets::*;
11 /// times (`export_card`'s own `dark`-branch technique, one level up).11 /// times (`export_card`'s own `dark`-branch technique, one level up).
12 ///12 ///
13 /// A row label is what the room says about the control -- Archivo, §3's13 /// 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: the14+/// label-row size, `ink2` at rest / `ink1` picked (no permanent pill: the
15 /// picked state is a 1px `ink1` rule, §4's focus ring, not a fill).15 /// picked state is a 1px `ink1` rule, §4's focus ring, not a fill).
16 fn dark_row_label(text: impl Into<SharedString>, picked: bool) -> Div {16 fn dark_row_label(text: impl Into<SharedString>, picked: bool) -> Div {
17 div()17 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+ ))
19 .text_color(rgb(if picked { INK1() } else { INK2() }))22 .text_color(rgb(if picked { INK1() } else { INK2() }))
20 .child(text.into())23 .child(text.into())
21 }24 }
@@ -38,7 +41,10 @@ fn transform_row_value(band: usize, value: f32) -> String {
38 /// A row's value -- what the film/the setting *says*, mono per §3.41 /// A row's value -- what the film/the setting *says*, mono per §3.
39 fn dark_row_value(text: impl Into<SharedString>) -> Div {42 fn dark_row_value(text: impl Into<SharedString>) -> Div {
40 div()43 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+ ))
42 .text_color(rgb(INK1()))48 .text_color(rgb(INK1()))
43 .child(text.into())49 .child(text.into())
44 }50 }
@@ -95,15 +101,24 @@ fn dark_card_head(
95 .id("card-head-maximize")101 .id("card-head-maximize")
96 .flex_none()102 .flex_none()
97 .cursor_pointer()103 .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+ ))
99 .text_color(rgb(INK3()))108 .text_color(rgb(INK3()))
100 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {109 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
101 this.toggle_maximize();110 this.toggle_maximize();
102 cx.notify();111 cx.notify();
103 }))112 }))
104 .tooltip(move |_, cx| {113 .tooltip(move |_, cx| {
105- cx.new(|_| OverlayTip(if max { "m -- back to the room".into() } else { "m -- fills the room".into() }))114+ cx.new(|_| {
106- .into()115+ OverlayTip(if max {
116+ "m -- back to the room".into()
117+ } else {
118+ "m -- fills the room".into()
119+ })
120+ })
121+ .into()
107 })122 })
108 .child(if max { "▣ m" } else { "⤢ m" })123 .child(if max { "▣ m" } else { "⤢ m" })
109 }))124 }))
@@ -115,7 +130,10 @@ fn dark_card_head(
115 )130 )
116 .children(meta.map(|m| {131 .children(meta.map(|m| {
117 div()132 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+ ))
119 .text_color(rgb(INK3()))137 .text_color(rgb(INK3()))
120 .child(m)138 .child(m)
121 }))139 }))
@@ -123,7 +141,10 @@ fn dark_card_head(
123 div()141 div()
124 .id("card-head-help")142 .id("card-head-help")
125 .flex_none()143 .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+ ))
127 .text_color(rgb(INK3()))148 .text_color(rgb(INK3()))
128 .tooltip(move |_, cx| cx.new(|_| OverlayTip(h.clone())).into())149 .tooltip(move |_, cx| cx.new(|_| OverlayTip(h.clone())).into())
129 .child("?")150 .child("?")
@@ -136,7 +157,10 @@ fn dark_help(text: impl Into<SharedString>) -> Div {
136 div()157 div()
137 .flex_none()158 .flex_none()
138 .px(px(6.))159 .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+ ))
140 .text_color(rgb(INK3()))164 .text_color(rgb(INK3()))
141 .child(text.into())165 .child(text.into())
142 }166 }
@@ -192,7 +216,10 @@ fn dark_ghost_button(
192 .on_click(on_click)216 .on_click(on_click)
193 .child(217 .child(
194 div()218 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+ ))
196 .text_color(rgb(if active { INK1() } else { INK2() }))223 .text_color(rgb(if active { INK1() } else { INK2() }))
197 .child(text.into()),224 .child(text.into()),
198 )225 )
@@ -260,8 +287,11 @@ impl Player {
260 let bg_selected = if dark { DARK_RAISED() } else { BG_SELECTED() };287 let bg_selected = if dark { DARK_RAISED() } else { BG_SELECTED() };
261 // Archivo for what the row *says as a verb* (its label), mono for288 // Archivo for what the row *says as a verb* (its label), mono for
262 // what the film says through it (its detail/key) -- DESIGN §3.289 // 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);290+ let label_style =
264- let font_mono = dark.then(|| type_scale::mono(11., gpui::FontWeight::MEDIUM).font);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);
265 let row = |id: (&'static str, usize)| {295 let row = |id: (&'static str, usize)| {
266 div()296 div()
267 .id(id)297 .id(id)
@@ -287,7 +317,9 @@ impl Player {
287 d.when(!enabled, |d| {317 d.when(!enabled, |d| {
288 d.cursor_not_allowed().text_color(rgb(ink_secondary))318 d.cursor_not_allowed().text_color(rgb(ink_secondary))
289 })319 })
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+ })
291 };323 };
292 // A row as this card writes them: the mark saying which one is picked,324 // A row as this card writes them: the mark saying which one is picked,
293 // the key that picks it, its name, and what the choice means. The mark325 // the key that picks it, its name, and what the choice means. The mark
@@ -324,12 +356,16 @@ impl Player {
324 .w(px(EXPORT_KEY_W))356 .w(px(EXPORT_KEY_W))
325 .text_size(px(11.))357 .text_size(px(11.))
326 .text_color(rgb(ink))358 .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+ })
328 .child(SharedString::from(key.to_string())),362 .child(SharedString::from(key.to_string())),
329 )363 )
330 .child(364 .child(
331 div()365 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+ })
333 .child(label),369 .child(label),
334 ),370 ),
335 )371 )
@@ -342,7 +378,9 @@ impl Player {
342 .flex_shrink()378 .flex_shrink()
343 .text_size(px(11.))379 .text_size(px(11.))
344 .text_color(rgb(ink))380 .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+ })
346 .child(detail),384 .child(detail),
347 )385 )
348 };386 };
@@ -353,7 +391,9 @@ impl Player {
353 .pt(px(4.))391 .pt(px(4.))
354 .text_size(px(10.))392 .text_size(px(10.))
355 .text_color(rgb(ink_secondary))393 .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+ })
357 .child(text)397 .child(text)
358 .into_any_element()398 .into_any_element()
359 };399 };
@@ -383,9 +423,11 @@ impl Player {
383 // rows already carry: dimmed, unclickable, its reason in place of423 // rows already carry: dimmed, unclickable, its reason in place of
384 // the detail -- not bright and pickable over a click that would424 // the detail -- not bright and pickable over a click that would
385 // only bounce off `set_format`'s own guard.425 // only bounce off `set_format`'s own guard.
386- let refusal = preset426+ let refusal = preset.bundle().and_then(|(format, _)| {
387- .bundle()427+ self.session
388- .and_then(|(format, _)| self.session.as_ref().and_then(|s| format_refusal(s, format)));428+ .as_ref()
429+ .and_then(|s| format_refusal(s, format))
430+ });
389 let detail: SharedString = match &refusal {431 let detail: SharedString = match &refusal {
390 Some(why) => why.clone().into(),432 Some(why) => why.clone().into(),
391 None => preset.detail().into(),433 None => preset.detail().into(),
@@ -409,8 +451,9 @@ impl Player {
409 let advanced_detail = match self.export_advanced_open {451 let advanced_detail = match self.export_advanced_open {
410 true => "codec, container, quality, sound, encoder, subtitles — s collapses them"452 true => "codec, container, quality, sound, encoder, subtitles — s collapses them"
411 .to_string(),453 .to_string(),
412- false => "codec, container, quality, sound, encoder, subtitles — s for the rows"454+ false => {
413- .to_string(),455+ "codec, container, quality, sound, encoder, subtitles — s for the rows".to_string()
456+ }
414 };457 };
415 list.push(458 list.push(
416 entry(459 entry(
@@ -433,313 +476,327 @@ impl Player {
433 // it built exactly as the flat card built it, only not pushed at all476 // it built exactly as the flat card built it, only not pushed at all
434 // while the pane is shut.477 // while the pane is shut.
435 if self.export_advanced_open {478 if self.export_advanced_open {
436- if self.export_grouped {479+ if self.export_grouped {
437- list.push(header("FORMAT"));480+ list.push(header("FORMAT"));
438- }481+ }
439- // The codecs first: which one is being written decides whether every482+ // The codecs first: which one is being written decides whether every
440- // row under it means anything. One a *this* timeline cannot be written483+ // 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 one484+ // as (an audio-only edit, for a picture codec) reads exactly like one
442- // there is no encoder for -- dimmed, unclickable, and carrying its own485+ // 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.486+ // reason where its detail was, with nothing to click to find that out.
444- let mut refusals: Vec<String> = Vec::new();487+ let mut refusals: Vec<String> = Vec::new();
445- for (i, (boxes, key, label, detail)) in FORMATS.into_iter().enumerate() {488+ for (i, (boxes, key, label, detail)) in FORMATS.into_iter().enumerate() {
446- let format = same_box(boxes, self.format);489+ let format = same_box(boxes, self.format);
447- let refused = format490+ let refused = format
448- .zip(self.session.as_ref())491+ .zip(self.session.as_ref())
449- .and_then(|(f, s)| format_refusal(s, f));492+ .and_then(|(f, s)| format_refusal(s, f));
450- // A codec with no encoder here at all is the other kind of refusal,493+ // 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, so494+ // and the one the footer collects: it can never become pickable, so
452- // a row each is dead rows above the fold.495+ // a row each is dead rows above the fold.
453- if format.is_none() {496+ if format.is_none() {
454- refusals.push(format!("{label} — {detail}"));497+ refusals.push(format!("{label} — {detail}"));
455- if !self.export_refusals_inline {498+ if !self.export_refusals_inline {
456- continue;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+ }));
457 }520 }
521+ list.push(r.into_any_element());
458 }522 }
459- let detail: SharedString = match &refused {523+ if self.export_grouped {
460- Some(why) => why.clone().into(),524+ list.push(header("DETAILS"));
461- None => detail.into(),525+ }
462- };526+ // The container, and only where the picked codec has more than one box:
463- let format = format.filter(|_| refused.is_none());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();
464 let mut r = entry(630 let mut r = entry(
465- ("format", i),631+ ("sound", 0),
466- key,632+ "b",
467- label.into(),633+ "Sound".into(),
468- detail,634+ match sound {
469- boxes.contains(&self.format),635+ Some(why) => why.into(),
470- format.is_some(),636+ None => format!("{} kbps — b steps", self.audio_kbps).into(),
637+ },
638+ false,
639+ sound.is_none(),
471 );640 );
472- if let Some(format) = format {641+ if sound.is_none() {
473- r = r.on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {642+ r = r.on_click(cx.listener(|this, event: &ClickEvent, _, cx| {
474- this.set_format(format);643+ this.open_picker(Pick::AudioRate, event.position(), cx)
475- cx.notify();
476 }));644 }));
477 }645 }
478 list.push(r.into_any_element());646 list.push(r.into_any_element());
479- }647+ // Which encoder writes the picture, which was an env pin and therefore
480- if self.export_grouped {648+ // no choice at all. Three seats, so the pointer gets the *list* of them
481- list.push(header("DETAILS"));649+ // ([`Pick::Encoder`]) and never a button clicked round -- the Sound
482- }650+ // row's rule, one row above. Only where there is a picture to encode:
483- // The container, and only where the picked codec has more than one box:651+ // a WAV has no seat to pick and the row would be a question about
484- // a row offering a single choice reads as a choice.652+ // nothing.
485- let boxes = containers(self.format);653+ if self.format.has_video() {
486- if boxes.len() > 1 {654+ let seat = self.encoder_seat();
487- let next = next_container(self.format);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.
488 list.push(704 list.push(
489 entry(705 entry(
490- ("container", 0),706+ ("subtitles", 0),
491- "c",707+ "",
492- "Container".into(),708+ "Subtitles".into(),
493- format!(709+ plan.into(),
494- "{} — c for {}",710+ false,
495- self.format.ext().to_uppercase(),
496- next.ext().to_uppercase()
497- )
498- .into(),
499 false,711 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,
500 true,728 true,
501 )729 )
502 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {730 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
503- this.cycle_container();731+ this.export_grouped = !this.export_grouped;
504 cx.notify();732 cx.notify();
505 }))733 }))
506 .into_any_element(),734 .into_any_element(),
507 );735 );
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();
609 list.push(736 list.push(
610 entry(737 entry(
611- ("encoder", 0),738+ ("export-refusals", 0),
612- "e",739+ "r",
613- "Encoder".into(),740+ "Codecs with no encoder".into(),
614- format!("{} — e steps", encoder_label(seat)).into(),741+ match self.export_refusals_inline {
615- false,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,
616 true,746 true,
617 )747 )
618- .on_click(cx.listener(|this, event: &ClickEvent, _, cx| {748+ .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
619- this.open_picker(Pick::Encoder, event.position(), cx)749+ this.export_refusals_inline = !this.export_refusals_inline;
750+ cx.notify();
620 }))751 }))
621 .into_any_element(),752 .into_any_element(),
622 );753 );
623- // ...and, under it, the one thing about that pick a person cannot754+ if !self.export_refusals_inline && !refusals.is_empty() {
624- // know from the words in the list: this box's driver reset itself755+ // Last, and one line: the reason travels with the name (a footer
625- // on the vendored AV1 encoder. A dimmed row and not a modal -- the756+ // that only listed them would be the "why not?" the rows exist to
626- // pick is theirs, and the export runs.757+ // answer), but nothing here can ever be picked, so it sits under
627- if let Some(warning) = av1_hw_warning(self.format, seat) {758+ // every row that can rather than above them.
628 list.push(759 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(" · ")))
630 .into_any_element(),770 .into_any_element(),
631 );771 );
632 }772 }
633- }773+ // What is doing the work, on this machine and in this build: the GPU
634- // What happens to the subtitles on this timeline, in one line: how many774+ // half is asked of the driver through the plugin (a different answer on
635- // are written into the file and under what names, or the reason each one775+ // every machine, and "none" where there is no plugin at all), the build
636- // is not. Which tracks travel is not a pick -- everything with a cue on776+ // half is the crates that were compiled in. Last in the list, because it
637- // the timeline goes ([`Player::export_subs`]) -- so the row says rather777+ // is what a user checks rather than what they pick -- and a listing
638- // than offers, like the machine lines below.778+ // rather than rows, since none of it can be clicked.
639- // ...and the ones that do not travel are named here too, which they were779+ if self.export_grouped {
640- // not: `export_subs` had already filtered a track with no cue on *this*780+ list.push(header("THIS MACHINE"));
641- // timeline out of the engine's sight, so the card said nothing about a781+ }
642- // row the list was still showing ([`subtitle_plan`]).782+ let note = |text: String| {
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(
707 div()783 div()
708 .flex_none()784 .flex_none()
709 .px(px(6.))785 .px(px(6.))
710 .py(px(2.))786 .py(px(2.))
711 .text_size(px(11.))787 .text_size(px(11.))
712 .text_color(rgb(ink_secondary))788 .text_color(rgb(ink_secondary))
713- .when_some(font_mono.clone(), |d, f| d.font(f))789+ .when_some(mono_style.clone(), |d, style| {
714- .child(format!("cannot write: {}", refusals.join(" · ")))790+ d.font(style.font).text_size(style.size)
715- .into_any_element(),791+ })
716- );792+ .child(text)
717- }793+ .into_any_element()
718- // What is doing the work, on this machine and in this build: the GPU794+ };
719- // half is asked of the driver through the plugin (a different answer on795+ list.push(note(format!(
720- // every machine, and "none" where there is no plugin at all), the build796+ "GPU: {}",
721- // half is the crates that were compiled in. Last in the list, because it797+ self.hw_caps.clone().unwrap_or_else(|| "asking…".into())
722- // is what a user checks rather than what they pick -- and a listing798+ )));
723- // rather than rows, since none of it can be clicked.799+ list.push(note(format!("Built in: {}", engine::caps::software())));
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())));
743 } // self.export_advanced_open800 } // self.export_advanced_open
744 // What the rows add up to, which is the one thing that has to be right:801 // What the rows add up to, which is the one thing that has to be right:
745 // codec, box, size, rate, sound, where it goes and about how big. Two802 // codec, box, size, rate, sound, where it goes and about how big. Two
@@ -762,8 +819,7 @@ impl Player {
762 },819 },
763 |(_, audio)| audio,820 |(_, audio)| audio,
764 );821 );
765- let settings =822+ let settings = export_settings(
766- export_settings(
767 self.quality,823 self.quality,
768 self.custom_mbps,824 self.custom_mbps,
769 self.format,825 self.format,
@@ -875,9 +931,11 @@ impl Player {
875 div()931 div()
876 .flex_none()932 .flex_none()
877 .px(px(6.))933 .px(px(6.))
878- .text_size(px(10.5))
879 .text_color(rgb(INK3()))934 .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+ ))
881 .child(status_line),939 .child(status_line),
882 )940 )
883 .child(941 .child(
@@ -894,8 +952,10 @@ impl Player {
894 div()952 div()
895 .flex_none()953 .flex_none()
896 .px(px(6.))954 .px(px(6.))
897- .text_size(px(11.))955+ .type_style(type_scale::mono(
898- .type_style(type_scale::mono(10.5, gpui::FontWeight::MEDIUM))956+ type_scale::CHORD_METADATA_MAX_PX,
957+ gpui::FontWeight::MEDIUM,
958+ ))
899 .text_color(rgb(INK2()))959 .text_color(rgb(INK2()))
900 .child(head),960 .child(head),
901 )961 )
@@ -903,7 +963,10 @@ impl Player {
903 div()963 div()
904 .flex_none()964 .flex_none()
905 .px(px(6.))965 .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+ ))
907 .text_color(rgb(INK3()))970 .text_color(rgb(INK3()))
908 .child(format!(971 .child(format!(
909 "RANGE {}\u{2013}{} ({})",972 "RANGE {}\u{2013}{} ({})",
@@ -916,7 +979,10 @@ impl Player {
916 div()979 div()
917 .flex_none()980 .flex_none()
918 .px(px(6.))981 .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+ ))
920 .text_color(rgb(INK3()))986 .text_color(rgb(INK3()))
921 .child(tail),987 .child(tail),
922 )988 )
@@ -946,7 +1012,10 @@ impl Player {
946 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {1012 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
947 this.start_export(cx)1013 this.start_export(cx)
948 }))1014 }))
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+ ))
950 .text_color(rgb(match blocked.is_some() {1019 .text_color(rgb(match blocked.is_some() {
951 true => INK4(),1020 true => INK4(),
952 false => INK1(),1021 false => INK1(),
@@ -956,7 +1025,7 @@ impl Player {
956 d.child(1025 d.child(
957 div()1026 div()
958 .type_style(type_scale::mono(1027 .type_style(type_scale::mono(
959- 9.5,1028+ type_scale::CHORD_METADATA_MIN_PX,
960 gpui::FontWeight::MEDIUM,1029 gpui::FontWeight::MEDIUM,
961 ))1030 ))
962 .text_color(rgb(INK3()))1031 .text_color(rgb(INK3()))
@@ -1143,8 +1212,12 @@ impl Player {
1143 .rounded(px(6.))1212 .rounded(px(6.))
1144 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))1213 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))
1145 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))1214 .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)))1215+ .when(dark, |d| {
1147- .when(!dark, |d| d.child(div().flex_none().px(px(6.)).child("Exporting")))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+ })
1148 // The bar itself: the same number as the percentage1221 // The bar itself: the same number as the percentage
1149 // below it, and it only ever moves forward -- the1222 // below it, and it only ever moves forward -- the
1150 // worker's progress is a monotone `fetch_max`.1223 // worker's progress is a monotone `fetch_max`.
@@ -1191,8 +1264,9 @@ impl Player {
1191 ))1264 ))
1192 .child(note(1265 .child(note(
1193 match armed {1266 match armed {
1194- true => "cancelling deletes what has been written so far"1267+ true => {
1195- .to_string(),1268+ "cancelling deletes what has been written so far".to_string()
1269+ }
1196 false => format!(1270 false => format!(
1197 "{} cancels · esc alone does nothing while this runs · the \1271 "{} cancels · esc alone does nothing while this runs · the \
1198 timeline is read-only until it finishes",1272 timeline is read-only until it finishes",
@@ -1262,8 +1336,10 @@ impl Player {
1262 match armed {1336 match armed {
1263 true => "stops the worker and deletes the part file"1337 true => "stops the worker and deletes the part file"
1264 .to_string(),1338 .to_string(),
1265- false => "asks first -- one press only offers the choice"1339+ false => {
1266- .to_string(),1340+ "asks first -- one press only offers the choice"
1341+ .to_string()
1342+ }
1267 },1343 },
1268 true,1344 true,
1269 cx.listener(move |this, _: &ClickEvent, _, cx| {1345 cx.listener(move |this, _: &ClickEvent, _, cx| {
@@ -1393,10 +1469,16 @@ impl Player {
1393 // tracked from.1469 // tracked from.
1394 .id("eq-graph")1470 .id("eq-graph")
1395 .relative()1471 .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+ })
1397 .when(!graph_maximized, |d| d.flex_none().h(px(eq_graph_h(false))))1475 .when(!graph_maximized, |d| d.flex_none().h(px(eq_graph_h(false))))
1398 .rounded(px(3.))1476 .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+ }))
1400 .cursor_pointer()1482 .cursor_pointer()
1401 // The press picks the band under it *and* is already the first1483 // The press picks the band under it *and* is already the first
1402 // sample of the drag, so a plain click sets a value. A second click1484 // sample of the drag, so a plain click sets a value. A second click
@@ -1488,25 +1570,37 @@ impl Player {
1488 // a box narrower than the text. `.whitespace_nowrap()` is1570 // a box narrower than the text. `.whitespace_nowrap()` is
1489 // the platform's own backstop, so a mis-measured box clips1571 // the platform's own backstop, so a mis-measured box clips
1490 // or overhangs instead of silently wrapping again.1572 // 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+ };
1492 let div = div().absolute().bottom(px(1.)).whitespace_nowrap();1578 let div = div().absolute().bottom(px(1.)).whitespace_nowrap();
1493 let div = if i == 0 {1579 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)
1495 } else if i == EQ_TICKS.len() - 1 {1583 } 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)
1497 } else {1587 } 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)
1499 };1592 };
1500- div1593+ div.when(dark, |d| {
1501- .when(dark, |d| {1594+ d.type_style(type_scale::mono(
1502- d.type_style(type_scale::mono(1595+ type_scale::CHORD_METADATA_MIN_PX,
1503- type_scale::CHORD_METADATA_MIN_PX,1596+ gpui::FontWeight::MEDIUM,
1504- gpui::FontWeight::MEDIUM,1597+ ))
1505- ))1598+ .text_color(rgb(INK3()))
1506- .text_color(rgb(INK3()))1599+ })
1507- })1600+ .when(!dark, |d| {
1508- .when(!dark, |d| d.text_size(px(9.)).text_color(rgb(FG_SECONDARY())))1601+ d.text_size(px(9.)).text_color(rgb(FG_SECONDARY()))
1509- .child(*label)1602+ })
1603+ .child(*label)
1510 }))1604 }))
1511 .child(1605 .child(
1512 div()1606 div()
@@ -1520,7 +1614,9 @@ impl Player {
1520 ))1614 ))
1521 .text_color(rgb(INK3()))1615 .text_color(rgb(INK3()))
1522 })1616 })
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+ })
1524 .child(format!("+{EQ_GAIN_LIMIT:.0} dB")),1620 .child(format!("+{EQ_GAIN_LIMIT:.0} dB")),
1525 );1621 );
1526 // The bottom of the axis is not named: -12 dB would land in the same1622 // The bottom of the axis is not named: -12 dB would land in the same
@@ -1835,7 +1931,11 @@ impl Player {
1835 /// arrows do the same three things, but a value only a key can change is a1931 /// arrows do the same three things, but a value only a key can change is a
1836 /// value a hand on the pointer cannot reach at all, which is the same reason1932 /// value a hand on the pointer cannot reach at all, which is the same reason
1837 /// [`Player::mbps_steppers`] exists.1933 /// [`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 {
1839 let dark = self.darkroom;1939 let dark = self.darkroom;
1840 let row = div()1940 let row = div()
1841 .flex_none()1941 .flex_none()
@@ -1858,9 +1958,8 @@ impl Player {
1858 label: &'static str,1958 label: &'static str,
1859 change: fn(&mut Band),1959 change: fn(&mut Band),
1860 cx: &mut Context<Self>| {1960 cx: &mut Context<Self>| {
1861- let on_click = cx.listener(move |this, _: &ClickEvent, _, cx| {1961+ let on_click =
1862- this.nudge_band(change, cx)1962+ cx.listener(move |this, _: &ClickEvent, _, cx| this.nudge_band(change, cx));
1863- });
1864 match dark {1963 match dark {
1865 true => dark_step_glyph(id, label == "+", on_click).into_any_element(),1964 true => dark_step_glyph(id, label == "+", on_click).into_any_element(),
1866 false => div()1965 false => div()
@@ -1901,16 +2000,17 @@ impl Player {
1901 self.eq_params.bands.len()2000 self.eq_params.bands.len()
1902 ))2001 ))
1903 .into_any_element(),2002 .into_any_element(),
1904- false => format!("Band {} of {}", self.eq_band + 1, self.eq_params.bands.len())2003+ false => format!(
1905- .into_any_element(),2004+ "Band {} of {}",
2005+ self.eq_band + 1,
2006+ self.eq_params.bands.len()
2007+ )
2008+ .into_any_element(),
1906 })2009 })
1907 .child(number(2010 .child(number(
1908 band_label(&band),2011 band_label(&band),
1909 ("eq-freq-down", "eq-freq-up"),2012 ("eq-freq-down", "eq-freq-up"),
1910- (2013+ (|b| b.freq_hz /= EQ_FREQ_STEP, |b| b.freq_hz *= EQ_FREQ_STEP),
1911- |b| b.freq_hz /= EQ_FREQ_STEP,
1912- |b| b.freq_hz *= EQ_FREQ_STEP,
1913- ),
1914 cx,2014 cx,
1915 ))2015 ))
1916 .child(number(2016 .child(number(
@@ -1939,11 +2039,9 @@ impl Player {
1939 .bg(rgb(BG_PANEL()))2039 .bg(rgb(BG_PANEL()))
1940 .cursor_pointer()2040 .cursor_pointer()
1941 .hover(|s| s.bg(rgb(BG_HOVER())))2041 .hover(|s| s.bg(rgb(BG_HOVER())))
1942- .on_click(2042+ .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
1943- cx.listener(|this, _: &ClickEvent, _, cx| {2043+ this.nudge_band(|b| b.gain_db = 0., cx)
1944- this.nudge_band(|b| b.gain_db = 0., cx)2044+ }))
1945- }),
1946- )
1947 .child("Flatten this"),2045 .child("Flatten this"),
1948 )2046 )
1949 }2047 }
@@ -1959,7 +2057,11 @@ impl Player {
1959 /// the decoder is grading with, never a copy that could drift from it. The2057 /// the decoder is grading with, never a copy that could drift from it. The
1960 /// graph above them is counted off the frame that came *back* through that2058 /// graph above them is counted off the frame that came *back* through that
1961 /// grade ([`histogram`]), so pulling exposure tilts it while the hand moves.2059 /// 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> {
1963 let (lane, idx) = self.color_open?;2065 let (lane, idx) = self.color_open?;
1964 let params = self.color_params();2066 let params = self.color_params();
1965 let dark = self.darkroom;2067 let dark = self.darkroom;
@@ -2040,7 +2142,9 @@ impl Player {
2040 .child(2142 .child(
2041 div()2143 div()
2042 .w(px(44.))2144 .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+ })
2044 .when(!dark, |d| {2148 .when(!dark, |d| {
2045 d.text_size(px(11.))2149 d.text_size(px(11.))
2046 .text_color(rgb(FG_SECONDARY()))2150 .text_color(rgb(FG_SECONDARY()))
@@ -2058,7 +2162,12 @@ impl Player {
2058 .justify_center()2162 .justify_center()
2059 .items_center()2163 .items_center()
2060 .bg(rgba(SCRIM()))2164 .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+ })
2062 // Click away closes it, as on every card here.2171 // Click away closes it, as on every card here.
2063 .on_mouse_down(2172 .on_mouse_down(
2064 MouseButton::Left,2173 MouseButton::Left,
@@ -2071,7 +2180,11 @@ impl Player {
2071 .child(2180 .child(
2072 div()2181 div()
2073 .w_full()2182 .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+ )))
2075 .on_mouse_down(MouseButton::Left, swallow)2188 .on_mouse_down(MouseButton::Left, swallow)
2076 .flex()2189 .flex()
2077 .flex_col()2190 .flex_col()
@@ -2081,7 +2194,13 @@ impl Player {
2081 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))2194 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))
2082 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))2195 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))
2083 .when(dark, |d| {2196 .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+ ))
2085 })2204 })
2086 .when(!dark, |d| {2205 .when(!dark, |d| {
2087 d.child(div().flex_none().px(px(6.)).child(format!(2206 d.child(div().flex_none().px(px(6.)).child(format!(
@@ -2109,7 +2228,11 @@ impl Player {
2109 .flex_none()2228 .flex_none()
2110 .h(px(HIST_H))2229 .h(px(HIST_H))
2111 .rounded(px(3.))2230 .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+ }))
2113 .relative()2236 .relative()
2114 .child(hist_curves(self.histogram)),2237 .child(hist_curves(self.histogram)),
2115 )2238 )
@@ -2151,7 +2274,11 @@ impl Player {
2151 /// The transform card: [`color_card`](Self::color_card)'s own shape, one2274 /// The transform card: [`color_card`](Self::color_card)'s own shape, one
2152 /// row per [`TRANSFORM_BANDS`] entry instead of four, and no histogram --2275 /// row per [`TRANSFORM_BANDS`] entry instead of four, and no histogram --
2153 /// there is nothing here a graded frame would tilt.2276 /// 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> {
2155 let (lane, idx) = self.transform_open?;2282 let (lane, idx) = self.transform_open?;
2156 let params = self.transform_params();2283 let params = self.transform_params();
2157 let dark = self.darkroom;2284 let dark = self.darkroom;
@@ -2222,13 +2349,16 @@ impl Player {
2222 ),2349 ),
2223 )2350 )
2224 .child(2351 .child(
2225- div().w(px(44.)).when(dark, |d| {2352+ div()
2226- d.child(dark_row_value(transform_row_value(i, value)))2353+ .w(px(44.))
2227- }).when(!dark, |d| {2354+ .when(dark, |d| {
2228- d.text_size(px(11.))2355+ d.child(dark_row_value(transform_row_value(i, value)))
2229- .text_color(rgb(FG_SECONDARY()))2356+ })
2230- .child(transform_row_value(i, value))2357+ .when(!dark, |d| {
2231- }),2358+ d.text_size(px(11.))
2359+ .text_color(rgb(FG_SECONDARY()))
2360+ .child(transform_row_value(i, value))
2361+ }),
2232 )2362 )
2233 })2363 })
2234 .collect();2364 .collect();
@@ -2241,7 +2371,12 @@ impl Player {
2241 .justify_center()2371 .justify_center()
2242 .items_center()2372 .items_center()
2243 .bg(rgba(SCRIM()))2373 .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+ })
2245 .on_mouse_down(2380 .on_mouse_down(
2246 MouseButton::Left,2381 MouseButton::Left,
2247 cx.listener(|this, _: &MouseDownEvent, _, cx| {2382 cx.listener(|this, _: &MouseDownEvent, _, cx| {
@@ -2253,7 +2388,11 @@ impl Player {
2253 .child(2388 .child(
2254 div()2389 div()
2255 .w_full()2390 .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+ )))
2257 .on_mouse_down(MouseButton::Left, swallow)2396 .on_mouse_down(MouseButton::Left, swallow)
2258 .flex()2397 .flex()
2259 .flex_col()2398 .flex_col()
@@ -2263,7 +2402,13 @@ impl Player {
2263 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))2402 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))
2264 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))2403 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))
2265 .when(dark, |d| {2404 .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+ ))
2267 })2412 })
2268 .when(!dark, |d| {2413 .when(!dark, |d| {
2269 d.child(div().flex_none().px(px(6.)).child(format!(2414 d.child(div().flex_none().px(px(6.)).child(format!(
@@ -2326,7 +2471,11 @@ impl Player {
2326 ///2471 ///
2327 /// Honest about what it does: the sound is *resampled*, so the pitch goes up2472 /// Honest about what it does: the sound is *resampled*, so the pitch goes up
2328 /// with the rate, which is what the tape in the title means.2473 /// 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> {
2330 let (lane, idx) = self.speed_open?;2479 let (lane, idx) = self.speed_open?;
2331 let speed = self.card_speed();2480 let speed = self.card_speed();
2332 let session = self.session.as_ref()?;2481 let session = self.session.as_ref()?;
@@ -2365,8 +2514,7 @@ impl Player {
2365 })2514 })
2366 .collect();2515 .collect();
2367 let head_meta: SharedString = format!("{} clip {}", lane.label(), idx + 1).into();2516 let head_meta: SharedString = format!("{} clip {}", lane.label(), idx + 1).into();
2368- let help_text =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";
2369- "drag the bar or ←→ moves it, r is 1.00x — the pitch moves with the rate; a click away or esc closes";
2370 let tail_text: SharedString = format!(2518 let tail_text: SharedString = format!(
2371 "{speed} — {} source frames over {} on the timeline ({})",2519 "{speed} — {} source frames over {} on the timeline ({})",
2372 clip.len(),2520 clip.len(),
@@ -2380,7 +2528,12 @@ impl Player {
2380 .justify_center()2528 .justify_center()
2381 .items_center()2529 .items_center()
2382 .bg(rgba(SCRIM()))2530 .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+ })
2384 // Click away closes it, as on every card here.2537 // Click away closes it, as on every card here.
2385 .on_mouse_down(2538 .on_mouse_down(
2386 MouseButton::Left,2539 MouseButton::Left,
@@ -2393,7 +2546,11 @@ impl Player {
2393 .child(2546 .child(
2394 div()2547 div()
2395 .w_full()2548 .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+ )))
2397 .on_mouse_down(MouseButton::Left, swallow)2554 .on_mouse_down(MouseButton::Left, swallow)
2398 .flex()2555 .flex()
2399 .flex_col()2556 .flex_col()
@@ -2403,7 +2560,13 @@ impl Player {
2403 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))2560 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))
2404 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))2561 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))
2405 .when(dark, |d| {2562 .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+ ))
2407 })2570 })
2408 .when(!dark, |d| {2571 .when(!dark, |d| {
2409 d.child(div().flex_none().px(px(6.)).child(format!(2572 d.child(div().flex_none().px(px(6.)).child(format!(
@@ -2492,7 +2655,11 @@ impl Player {
2492 /// move it too. The rows scroll rather than the card growing past the2655 /// move it too. The rows scroll rather than the card growing past the
2493 /// window -- a timeline may hold more tracks than a 360 px window has room2656 /// window -- a timeline may hold more tracks than a 360 px window has room
2494 /// for faders.2657 /// 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> {
2496 if !self.mix_open {2663 if !self.mix_open {
2497 return None;2664 return None;
2498 }2665 }
@@ -2583,13 +2750,15 @@ impl Player {
2583 .bg(rgb(BG_PANEL()))2750 .bg(rgb(BG_PANEL()))
2584 .cursor_pointer()2751 .cursor_pointer()
2585 .hover(|s| s.bg(rgb(BG_HOVER())))2752 .hover(|s| s.bg(rgb(BG_HOVER())))
2586- .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {2753+ .on_click(cx.listener(
2587- // Picked as well as moved, the silence2754+ move |this, _: &ClickEvent, _, cx| {
2588- // card's rule: the row a press lands on2755+ // Picked as well as moved, the silence
2589- // is the row the arrows carry on from.2756+ // card's rule: the row a press lands on
2590- this.mix_field = n;2757+ // is the row the arrows carry on from.
2591- this.nudge_mix(steps, cx);2758+ this.mix_field = n;
2592- }))2759+ this.nudge_mix(steps, cx);
2760+ },
2761+ ))
2593 .child(match steps > 0 {2762 .child(match steps > 0 {
2594 true => "+",2763 true => "+",
2595 false => "−",2764 false => "−",
@@ -2614,7 +2783,12 @@ impl Player {
2614 .justify_center()2783 .justify_center()
2615 .items_center()2784 .items_center()
2616 .bg(rgba(SCRIM()))2785 .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+ })
2618 // Click away closes it, as on every card here.2792 // Click away closes it, as on every card here.
2619 .on_mouse_down(2793 .on_mouse_down(
2620 MouseButton::Left,2794 MouseButton::Left,
@@ -2627,7 +2801,11 @@ impl Player {
2627 .child(2801 .child(
2628 div()2802 div()
2629 .w_full()2803 .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+ )))
2631 .on_mouse_down(MouseButton::Left, swallow)2809 .on_mouse_down(MouseButton::Left, swallow)
2632 .max_h(px(360. - 24.))2810 .max_h(px(360. - 24.))
2633 .flex()2811 .flex()
@@ -2637,7 +2815,15 @@ impl Player {
2637 .rounded(px(6.))2815 .rounded(px(6.))
2638 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))2816 .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() }))
2639 .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM())))2817 .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+ })
2641 .when(!dark, |d| {2827 .when(!dark, |d| {
2642 d.child(2828 d.child(
2643 div()2829 div()
@@ -2690,13 +2876,25 @@ impl Player {
2690 /// card's shape for the same reason: app-global, kept in a file beside2876 /// card's shape for the same reason: app-global, kept in a file beside
2691 /// the theme, and drawn straight off `self.sub_text` / `self.sub_family`2877 /// the theme, and drawn straight off `self.sub_text` / `self.sub_family`
2692 /// so a change is on the cue underneath before the card is closed.2878 /// 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> {
2694 if !self.subtitle_style_open {2884 if !self.subtitle_style_open {
2695 return None;2885 return None;
2696 }2886 }
2697 let dark = self.darkroom;2887 let dark = self.darkroom;
2698 let help_text = "− and + move the size, or ↑↓ picks a row and ←→ moves it (held or pressed); a family row picks it outright — a click away or esc closes";2888 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+ });
2700 let size_picked = self.subtitle_style_field == 0;2898 let size_picked = self.subtitle_style_field == 0;
2701 let size_row = div()2899 let size_row = div()
2702 .id("subtitle-size-row")2900 .id("subtitle-size-row")
@@ -2707,7 +2905,9 @@ impl Player {
2707 .justify_between()2905 .justify_between()
2708 .px(px(6.))2906 .px(px(6.))
2709 .rounded(px(3.))2907 .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+ })
2711 .when(!dark, |d| {2911 .when(!dark, |d| {
2712 d.bg(rgb(match size_picked {2912 d.bg(rgb(match size_picked {
2713 true => BG_SELECTED(),2913 true => BG_SELECTED(),
@@ -2724,7 +2924,9 @@ impl Player {
2724 .flex()2924 .flex()
2725 .items_center()2925 .items_center()
2726 .gap(px(4.))2926 .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+ })
2728 .when(!dark, |d| d.child(format!("{:.0}px", self.sub_text)))2930 .when(!dark, |d| d.child(format!("{:.0}px", self.sub_text)))
2729 .children([-1, 1].map(|steps: i32| {2931 .children([-1, 1].map(|steps: i32| {
2730 let id = ("subtitle-size-step", usize::from(steps > 0));2932 let id = ("subtitle-size-step", usize::from(steps > 0));
@@ -2771,7 +2973,9 @@ impl Player {
2771 .items_center()2973 .items_center()
2772 .px(px(6.))2974 .px(px(6.))
2773 .rounded(px(3.))2975 .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+ })
2775 .when(!dark, |d| {2979 .when(!dark, |d| {
2776 d.bg(rgb(match default_picked {2980 d.bg(rgb(match default_picked {
2777 true => BG_SELECTED(),2981 true => BG_SELECTED(),
@@ -2783,7 +2987,9 @@ impl Player {
2783 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {2987 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
2784 this.set_sub_family(None, cx);2988 this.set_sub_family(None, cx);
2785 }))2989 }))
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+ })
2787 .when(!dark, |d| d.child("System default"));2993 .when(!dark, |d| d.child("System default"));
2788 let family_rows = self.subtitle_fonts.iter().enumerate().map(|(n, name)| {2994 let family_rows = self.subtitle_fonts.iter().enumerate().map(|(n, name)| {
2789 let picked = self.subtitle_style_field == n + 22995 let picked = self.subtitle_style_field == n + 2
@@ -2820,7 +3026,12 @@ impl Player {
2820 .justify_center()3026 .justify_center()
2821 .items_center()3027 .items_center()
2822 .bg(rgba(SCRIM()))3028 .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+ })
2824 .on_mouse_down(3035 .on_mouse_down(
2825 MouseButton::Left,3036 MouseButton::Left,
2826 cx.listener(|this, _: &MouseDownEvent, _, cx| {3037 cx.listener(|this, _: &MouseDownEvent, _, cx| {
@@ -2832,7 +3043,11 @@ impl Player {
2832 .child(3043 .child(
2833 div()3044 div()
2834 .w_full()3045 .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+ )))
2836 .on_mouse_down(MouseButton::Left, swallow)3051 .on_mouse_down(MouseButton::Left, swallow)
2837 .max_h(px(360. - 24.))3052 .max_h(px(360. - 24.))
2838 .flex()3053 .flex()
@@ -2883,12 +3098,24 @@ impl Player {
2883 /// *about* the timeline -- the marks under it are the whole preview -- so3098 /// *about* the timeline -- the marks under it are the whole preview -- so
2884 /// the bed stays readable and the card sits up in the picture area rather3099 /// the bed stays readable and the card sits up in the picture area rather
2885 /// than over the lanes.3100 /// 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> {
2887 let (lane, idx) = self.silence_open?;3106 let (lane, idx) = self.silence_open?;
2888 let dark = self.darkroom;3107 let dark = self.darkroom;
2889 let head_meta: SharedString = format!("{} clip {}", lane.label(), idx + 1).into();3108 let head_meta: SharedString = format!("{} clip {}", lane.label(), idx + 1).into();
2890 let help_text = "− and + move a setting, or ↑↓ picks one and ←→ moves it (hold to run it) — the marks on the lane are what would go; a click away or esc closes";3109 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+ });
2892 let cfg = self.silence;3119 let cfg = self.silence;
2893 // The unit is a label, never a conversion: the threshold is a level3120 // The unit is a label, never a conversion: the threshold is a level
2894 // below full scale whichever of the two the row says (`silence_dbfs`).3121 // below full scale whichever of the two the row says (`silence_dbfs`).
@@ -2926,7 +3153,10 @@ impl Player {
2926 let status = match &self.silence_scan {3153 let status = match &self.silence_scan {
2927 Some(scan) => silence_line(3154 Some(scan) => silence_line(
2928 scan.seen as f32 / 10.,3155 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.,
2930 scan.started.elapsed().as_secs_f32(),3160 scan.started.elapsed().as_secs_f32(),
2931 scan.since.elapsed().as_secs_f32(),3161 scan.since.elapsed().as_secs_f32(),
2932 ),3162 ),
@@ -3005,14 +3235,16 @@ impl Player {
3005 .bg(rgb(BG_PANEL()))3235 .bg(rgb(BG_PANEL()))
3006 .cursor_pointer()3236 .cursor_pointer()
3007 .hover(|s| s.bg(rgb(BG_HOVER())))3237 .hover(|s| s.bg(rgb(BG_HOVER())))
3008- .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {3238+ .on_click(cx.listener(
3009- // Picked as well as moved: the row a3239+ move |this, _: &ClickEvent, _, cx| {
3010- // press lands on is the row the arrows3240+ // Picked as well as moved: the row a
3011- // carry on from.3241+ // press lands on is the row the arrows
3012- this.silence_field = n;3242+ // carry on from.
3013- this.nudge_silence(steps);3243+ this.silence_field = n;
3014- cx.notify();3244+ this.nudge_silence(steps);
3015- }))3245+ cx.notify();
3246+ },
3247+ ))
3016 .child(match steps > 0 {3248 .child(match steps > 0 {
3017 true => "+",3249 true => "+",
3018 false => "−",3250 false => "−",
@@ -3064,7 +3296,12 @@ impl Player {
3064 // Light enough to read the lanes and the marks on them through:3296 // Light enough to read the lanes and the marks on them through:
3065 // the preview is the point of this card.3297 // the preview is the point of this card.
3066 .bg(rgba(SCRIM_LIGHT()))3298 .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+ })
3068 // Click away closes it, as on every card here -- and the marks3305 // Click away closes it, as on every card here -- and the marks
3069 // go with it, which is what makes this one a call and not a flag.3306 // go with it, which is what makes this one a call and not a flag.
3070 .on_mouse_down(3307 .on_mouse_down(
@@ -3078,7 +3315,11 @@ impl Player {
3078 .child(3315 .child(
3079 div()3316 div()
3080 .w_full()3317 .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+ )))
3082 .on_mouse_down(MouseButton::Left, swallow)3323 .on_mouse_down(MouseButton::Left, swallow)
3083 .flex()3324 .flex()
3084 .flex_col()3325 .flex_col()
crates/app/src/ui/dock_stance.rsmodified+86 -25
@@ -11,8 +11,8 @@
11 //! still supply the row facts ([`library_rows`], [`source_tint`],11 //! still supply the row facts ([`library_rows`], [`source_tint`],
12 //! [`clip_middle`]...), only the anatomy around them is new.12 //! [`clip_middle`]...), only the anatomy around them is new.
13 13
14-use crate::*;
15 use crate::ui::type_scale::{self, head, label, mono};14 use crate::ui::type_scale::{self, head, label, mono};
15+use crate::*;
16 use gpui::FontWeight;16 use gpui::FontWeight;
17 17
18 /// Where the dock tab pick lives: one word beside the theme and the18 /// Where the dock tab pick lives: one word beside the theme and the
@@ -79,7 +79,12 @@ pub(crate) enum DockSort {
79 }79 }
80 80
81 impl DockSort {81 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+ ];
83 fn label(self) -> &'static str {88 fn label(self) -> &'static str {
84 match self {89 match self {
85 DockSort::Recent => "Recent",90 DockSort::Recent => "Recent",
@@ -156,7 +161,12 @@ fn ghost_verb(
156 /// DESIGN §11's frequency check puts a lift and a mark far ahead of a tab161 /// DESIGN §11's frequency check puts a lift and a mark far ahead of a tab
157 /// switch -- wearing a chord this room does not answer to would be exactly162 /// switch -- wearing a chord this room does not answer to would be exactly
158 /// the lie DESIGN §4 forbids, so the letters go instead.163 /// 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 {
160 let style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM);170 let style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM);
161 div()171 div()
162 .id(id)172 .id(id)
@@ -183,7 +193,7 @@ fn dock_tab(id: &'static str, label_text: &'static str, active: bool, cx: &mut C
183 )193 )
184 }194 }
185 195
186-/// A 9px uppercase Archivo section head, `ink3` (DESIGN §3).196+/// A 12px uppercase Archivo section head, `ink3` (DESIGN §3).
187 fn section_head(text: impl Into<SharedString>) -> impl IntoElement {197 fn section_head(text: impl Into<SharedString>) -> impl IntoElement {
188 let style = head();198 let style = head();
189 div()199 div()
@@ -206,11 +216,20 @@ fn usage_line(player: &Player, source_idx: usize, placed: usize) -> String {
206 session216 session
207 .lanes()217 .lanes()
208 .into_iter()218 .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+ })
210 .map(Lane::label)225 .map(Lane::label)
211 .collect()226 .collect()
212 });227 });
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+ )
214 }233 }
215 234
216 /// One source row, two lines (MOCK-SPEC "Dock" §4): an ink dot, the name in235 /// 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 {
220 /// 2, wired in `render.rs`'s key handler since a row takes no keyboard focus239 /// 2, wired in `render.rs`'s key handler since a row takes no keyboard focus
221 /// of its own), double-click (gesture 3) and right-click the dot (gesture 4)240 /// of its own), double-click (gesture 3) and right-click the dot (gesture 4)
222 /// all live here.241 /// 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 {
224 let usable = row.unusable.is_none();250 let usable = row.unusable.is_none();
225 let name: SharedString = row.name.clone().into();251 let name: SharedString = row.name.clone().into();
226 let under: String = match &row.unusable {252 let under: String = match &row.unusable {
227 Some(why) => why.clone(),253 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+ ),
229 };258 };
230 let usage = usage_line(player, row.tint, placed);259 let usage = usage_line(player, row.tint, placed);
231 let (path, stream) = (row.path.clone(), row.stream);260 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,
354 /// Media/Audio/Text panel `library.rs` draws. That panel's row facts383 /// Media/Audio/Text panel `library.rs` draws. That panel's row facts
355 /// ([`library_rows`]) are still what every row here is built from.384 /// ([`library_rows`]) are still what every row here is built from.
356 fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {385 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);
358 let meta = player.session.as_ref().map(PlaybackSession::meta);390 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| {391+ let all_rows: Vec<Row> = library_rows(
360- player.session.as_ref().map_or(0, |session| session.file_frames(path))392+ sources,
361- });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+ );
362 let _ = meta;403 let _ = meta;
363 let unused_count = all_rows404 let unused_count = all_rows
364 .iter()405 .iter()
@@ -380,7 +421,9 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
380 .collect();421 .collect();
381 match player.dock_sort {422 match player.dock_sort {
382 DockSort::Recent => {}423 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+ }
384 DockSort::Usage => rows.sort_by(|(_, a), (_, b)| b.cmp(a)),427 DockSort::Usage => rows.sort_by(|(_, a), (_, b)| b.cmp(a)),
385 DockSort::Unused => rows.sort_by_key(|(_, placed)| *placed > 0),428 DockSort::Unused => rows.sort_by_key(|(_, placed)| *placed > 0),
386 }429 }
@@ -395,7 +438,9 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
395 .gap(px(6.))438 .gap(px(6.))
396 .p(px(8.))439 .p(px(8.))
397 .overflow_y_scroll()440 .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+ )))
399 .child({444 .child({
400 let style = mono(type_scale::CHORD_METADATA_MAX_PX, FontWeight::MEDIUM);445 let style = mono(type_scale::CHORD_METADATA_MAX_PX, FontWeight::MEDIUM);
401 div()446 div()
@@ -404,7 +449,11 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
404 .cursor_text()449 .cursor_text()
405 .font(style.font)450 .font(style.font)
406 .text_size(style.size)451 .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+ }))
408 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {457 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
409 this.dock_filter_edit = true;458 this.dock_filter_edit = true;
410 cx.notify();459 cx.notify();
@@ -421,7 +470,7 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
421 .gap(px(4.))470 .gap(px(4.))
422 .children(DockSort::ALL.map(|sort| {471 .children(DockSort::ALL.map(|sort| {
423 let on = sort == player.dock_sort;472 let on = sort == player.dock_sort;
424- let style = label(9.5, FontWeight::MEDIUM);473+ let style = label(type_scale::FLOOR_PX, FontWeight::MEDIUM);
425 div()474 div()
426 .id(("dock-sort", sort as usize))475 .id(("dock-sort", sort as usize))
427 .flex_none()476 .flex_none()
@@ -458,7 +507,8 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
458 .text_size(style.size)507 .text_size(style.size)
459 .text_color(rgb(INK3()))508 .text_color(rgb(INK3()))
460 .child(match player.dock_filter.is_empty() {509 .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(),
462 false => "nothing matches the filter".to_string(),512 false => "nothing matches the filter".to_string(),
463 }),513 }),
464 )514 )
@@ -468,7 +518,10 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
468 .iter()518 .iter()
469 .enumerate()519 .enumerate()
470 .map(|(i, (row, placed))| {520 .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));
472 source_row(player, i, row, *placed, picked, cx).into_any_element()525 source_row(player, i, row, *placed, picked, cx).into_any_element()
473 })526 })
474 .collect();527 .collect();
@@ -501,11 +554,9 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
501 )),554 )),
502 )555 )
503 .child({556 .child({
504- // FAULT 2: metadata, not a row -- DESIGN §3's 9.5-10px band via557+ // Metadata, not a row: DESIGN §3's metadata role, and the quietest
505- // the named constant (a bespoke 9px literal was neither the558+ // text in the dock: ink3, tight leading so it never competes with
506- // metadata size nor any other named role), and the quietest text559+ // the source rows above it.
507- // in the dock: ink3, tight leading so it never competes with the
508- // 10.5px source rows above it.
509 let style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM);560 let style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM);
510 div()561 div()
511 .flex_none()562 .flex_none()
@@ -524,7 +575,12 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
524 /// these onto. Drag-while-playing and every other gesture on a row is575 /// these onto. Drag-while-playing and every other gesture on a row is
525 /// whatever that card already does; nothing about the gesture is reimplemented576 /// whatever that card already does; nothing about the gesture is reimplemented
526 /// here.577 /// 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 {
528 // The room actually given here, not the window's: `eq_card_w`/584 // The room actually given here, not the window's: `eq_card_w`/
529 // `card_max_w` are asked "how wide may I draw" and answered with the585 // `card_max_w` are asked "how wide may I draw" and answered with the
530 // *whole viewport's* width when handed `window_size` verbatim -- but this586 // *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
699 /// pair). What degrades *inside* fixed width is the two tabs' own content:755 /// pair). What degrades *inside* fixed width is the two tabs' own content:
700 /// Sources scrolls its own row list; Clip's param rows are whatever their756 /// Sources scrolls its own row list; Clip's param rows are whatever their
701 /// card already draws at this width.757 /// 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 {
703 let src_active = player.dock_src_active;764 let src_active = player.dock_src_active;
704 div()765 div()
705 .id("stance-dock-body")766 .id("stance-dock-body")
crates/app/src/ui/spine_stance.rsmodified+179 -31
@@ -4,17 +4,13 @@
4 //! drew. `stance.rs::spine()` keeps the panel frame (width, surface,4 //! drew. `stance.rs::spine()` keeps the panel frame (width, surface,
5 //! border); this module owns the rows inside it.5 //! border); this module owns the rows inside it.
6 6
7-use crate::*;
8 use crate::ui::type_scale::{self, Typeset};7 use crate::ui::type_scale::{self, Typeset};
8+use crate::*;
9 9
10-/// The glyph icon itself: DESIGN §3 names no separate role for it, so this10+/// The glyph icon is a room verb, so it uses the label role rather than a
11-/// keeps the size the module has always drawn it at (13px, the same number11+/// bespoke size: Archivo at `LABEL_ROW_PX`.
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.;
16 12
17-/// A group head: 9px uppercase Archivo 700 in `ink3`, +0.14em tracking13+/// A group head: uppercase Archivo 700 in `ink3`, +0.14em tracking
18 /// (DESIGN §3) -- reused as its own small fn rather than `stance::section_head`14 /// (DESIGN §3) -- reused as its own small fn rather than `stance::section_head`
19 /// because that one is private to its module and carries a different15 /// because that one is private to its module and carries a different
20 /// vertical rhythm (a region label, not a spine group head).16 /// vertical rhythm (a region label, not a spine group head).
@@ -79,16 +75,21 @@ fn glyph(
79 .when(on, |d| {75 .when(on, |d| {
80 d.cursor_pointer()76 d.cursor_pointer()
81 .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1())))77 .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1())))
82- .on_click(cx.listener(move |this, _: &ClickEvent, window, cx| {78+ .on_click(
83- this.act(action, window, cx)79+ cx.listener(move |this, _: &ClickEvent, window, cx| {
84- }))80+ this.act(action, window, cx)
81+ }),
82+ )
85 })83 })
86 .child(84 .child(
87 div()85 div()
88 .line_height(relative(1.05))86 .line_height(relative(1.05))
89 // FAULT 1: the glyph is the loudest thing in its row -- BOLD,87 // FAULT 1: the glyph is the loudest thing in its row -- BOLD,
90 // not the MEDIUM weight the chord beneath it also wears.88 // 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+ ))
92 .text_color(rgb(if active {93 .text_color(rgb(if active {
93 INK1()94 INK1()
94 } else if quiet {95 } else if quiet {
@@ -143,7 +144,10 @@ fn trim_control(active: bool, player: &Player, cx: &mut Context<Player>) -> impl
143 .child(144 .child(
144 div()145 div()
145 .line_height(relative(1.05))146 .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+ ))
147 .text_color(rgb(if active { INK1() } else { INK2() }))151 .text_color(rgb(if active { INK1() } else { INK2() }))
148 .child(txt),152 .child(txt),
149 )153 )
@@ -222,8 +226,24 @@ pub(crate) fn render(player: &Player, cx: &mut Context<Player>) -> impl IntoElem
222 .gap(px(1.))226 .gap(px(1.))
223 .overflow_y_scroll()227 .overflow_y_scroll()
224 .child(group_head("edit"))228 .child(group_head("edit"))
225- .child(glyph("spine-split", "||", ActionId::Cut, false, false, player, cx))229+ .child(glyph(
226- .child(glyph("spine-delete", "⊂⊃", ActionId::Delete, false, false, player, cx))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+ ))
227 .child(pair(247 .child(pair(
228 glyph("spine-undo", "↺", ActionId::Undo, false, false, player, cx),248 glyph("spine-undo", "↺", ActionId::Undo, false, false, player, cx),
229 // Redo had a legacy toolbar button (`toolbar.rs:347`) but no249 // 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
234 ))254 ))
235 .child(group_head("cut"))255 .child(group_head("cut"))
236 .child(pair(256 .child(pair(
237- glyph("spine-cut-prev", "‹", ActionId::WalkCutPrev, false, false, player, cx),257+ glyph(
238- glyph("spine-cut-next", "›", ActionId::WalkCutNext, false, false, player, cx),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+ ),
239 ))275 ))
240 .child(trim_control(player.loop_trim.is_some(), player, cx))276 .child(trim_control(player.loop_trim.is_some(), player, cx))
241 .child(glyph(277 .child(glyph(
@@ -271,13 +307,53 @@ pub(crate) fn render(player: &Player, cx: &mut Context<Player>) -> impl IntoElem
271 // less than walking/trimming cuts above it.307 // less than walking/trimming cuts above it.
272 .child(group_head("view"))308 .child(group_head("view"))
273 .child(pair(309 .child(pair(
274- glyph("spine-zoom-out", "−", ActionId::ZoomOut, false, false, player, cx),310+ glyph(
275- glyph("spine-zoom-in", "+", ActionId::ZoomIn, false, false, player, cx),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,
276 ))337 ))
277- .child(glyph("spine-zoom-fit", "⊡", ActionId::ZoomFit, false, false, player, cx))
278 .child(group_head("track"))338 .child(group_head("track"))
279- .child(glyph("spine-add-video", "+V", ActionId::AddVideoLane, false, false, player, cx))339+ .child(glyph(
280- .child(glyph("spine-add-audio", "+A", ActionId::AddAudioLane, false, false, player, cx))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+ ))
281 // The subtitle trio (homeless per this task's audit): AddSubtitleLane357 // The subtitle trio (homeless per this task's audit): AddSubtitleLane
282 // joins +V/+A on the same "+letter" grammar per this task's own358 // joins +V/+A on the same "+letter" grammar per this task's own
283 // instruction ("+S joins +V/+A in TRACK"); remove/import are "the359 // 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
291 // ROOM cluster below: cue visibility is judged shot to shot, closer367 // ROOM cluster below: cue visibility is judged shot to shot, closer
292 // in frequency to a view toggle used often than to a once-a-session368 // in frequency to a view toggle used often than to a once-a-session
293 // preference.369 // 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+ ))
295 .child(pair(379 .child(pair(
296- glyph("spine-remove-subtitle", "−S", ActionId::RemoveSubtitleLane, false, false, player, cx),380+ glyph(
297- glyph("spine-import-subtitles", "↓S", ActionId::ImportSubtitles, false, false, player, cx),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,
298 ))407 ))
299- .child(glyph("spine-toggle-subtitles", "CC", ActionId::ToggleSubtitles, player.subs_on, false, player, cx))
300 // ROOM: the once-a-session/once-a-project acts this task's charter408 // ROOM: the once-a-session/once-a-project acts this task's charter
301 // names explicitly (theme, proxies, screenshot, fullscreen) -- ink-409 // names explicitly (theme, proxies, screenshot, fullscreen) -- ink-
302 // demoted (`quiet: true`) and paired two-to-a-row to keep the group410 // 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
312 .child(group_head("room"))420 .child(group_head("room"))
313 .child(pair(421 .child(pair(
314 glyph("spine-theme", "H", ActionId::Theme, false, true, player, cx),422 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+ ),
316 ))432 ))
317 .child(pair(433 .child(pair(
318- glyph("spine-auto-proxies", "AP", ActionId::ToggleAutoProxies, player.auto_proxies_on, true, player, cx),434+ glyph(
319- glyph("spine-fullscreen", "FS", ActionId::Fullscreen, false, true, player, cx),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,
320 ))461 ))
321- .child(glyph("spine-screenshot", "Sh", ActionId::Screenshot, false, true, player, cx))
322 // The settings page's own visible door (user complaint: "some462 // The settings page's own visible door (user complaint: "some
323 // options are only reachable via keyboard shortcut") -- a chord463 // options are only reachable via keyboard shortcut") -- a chord
324 // alone is a defect class this room has hit repeatedly, so this464 // alone is a defect class this room has hit repeatedly, so this
325 // glyph sits beside the other once-a-session ROOM acts even though465 // glyph sits beside the other once-a-session ROOM acts even though
326 // its chord (`^,`) is a preference, not a mnemonic.466 // 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+ ))
328 .child(div().flex_1())476 .child(div().flex_1())
329 }477 }
crates/app/src/ui/stance.rsmodified+90 -59
@@ -8,13 +8,13 @@
8 //! interaction, no cut machinery -- `// hook:` comments below mark where the8 //! interaction, no cut machinery -- `// hook:` comments below mark where the
9 //! later steps in DESIGN §12's package attach.9 //! later steps in DESIGN §12's package attach.
10 10
11-use crate::*;
12 use crate::ui::bench_stance;11 use crate::ui::bench_stance;
13 use crate::ui::dock_stance;12 use crate::ui::dock_stance;
14 use crate::ui::settings_stance;13 use crate::ui::settings_stance;
15-use crate::ui::timeband_stance;
16 use crate::ui::spine_stance;14 use crate::ui::spine_stance;
15+use crate::ui::timeband_stance;
17 use crate::ui::type_scale::{self, Typeset};16 use crate::ui::type_scale::{self, Typeset};
17+use crate::*;
18 18
19 /// Left rail, full height (DESIGN §5).19 /// Left rail, full height (DESIGN §5).
20 const SPINE_W: f32 = 56.;20 const SPINE_W: f32 = 56.;
@@ -39,16 +39,13 @@ pub(crate) const DOCK_W: f32 = 280.;
39 /// What [`bench`] spends above `bench_stance::render`'s own content: the39 /// What [`bench`] spends above `bench_stance::render`'s own content: the
40 /// `bench` div's own `.border_t_1()` (1px) + its `py(4.)` top padding +40 /// `bench` div's own `.border_t_1()` (1px) + its `py(4.)` top padding +
41 /// the section head's real line box -- `type_scale::head()` sizes text at41 /// 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's42+/// `SECTION_HEAD_PX` (12) but never calls `.line_height()`, so gpui's
43 /// default `TextStyle::line_height` (the golden ratio, `gpui::phi()` ==43 /// default `TextStyle::line_height` (the golden ratio, `gpui::phi()` ==
44 /// `1.618034`, not 1x the font size) is what it actually draws:44 /// `1.618034`, not 1x the font size) is what it actually draws:
45-/// `round(10. * 1.618034)` = `round(16.18034)` = `16`. A driven pass found45+/// `round(12. * 1.618034)` = `round(19.416408)` = `19`.
46-/// this constant undercounting that line box as a bare `10`, one of the two46+/// `1 + 4 + 19` = `24`. Named and `pub(crate)` rather than an inline
47-/// causes of `layout::BENCH_MIN_H`'s third clip (see its own doc comment for47+/// subtraction, so `layout::BENCH_MIN_H` can derive from the real chrome.
48-/// the other). `1 + 4 + 16` = `21`. Named and `pub(crate)` rather than the48+pub(crate) const BENCH_CHROME_H: f32 = 24.;
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.;
52 49
53 /// The lowest a menu's top edge may sit and still land inside the50 /// The lowest a menu's top edge may sit and still land inside the
54 /// bench/ledger/dock footprint below the screen (DESIGN §5, §9, §11 check 6):51 /// bench/ledger/dock footprint below the screen (DESIGN §5, §9, §11 check 6):
@@ -136,7 +133,10 @@ mod menu_floor_tests {
136 let list_h = (396f32).min(f32::from(room.height));133 let list_h = (396f32).min(f32::from(room.height));
137 assert!(list_h <= f32::from(room.height));134 assert!(list_h <= f32::from(room.height));
138 let (_, y) = crate::oracle::menu_at(at, viewport, list_h);135 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+ );
140 }140 }
141 }141 }
142 142
@@ -196,7 +196,11 @@ thread_local! {
196 /// reimplemented here. Split out from `picture_scale` so this arithmetic has196 /// reimplemented here. Split out from `picture_scale` so this arithmetic has
197 /// a runnable check with no `Player`/window to stand up.197 /// a runnable check with no `Player`/window to stand up.
198 fn fit_scale(bounds: Bounds<Pixels>, native: gpui::Size<gpui::DevicePixels>) -> Option<f32> {198 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+ {
200 return None;204 return None;
201 }205 }
202 let fitted = gpui::ObjectFit::Contain.get_bounds(bounds, native);206 let fitted = gpui::ObjectFit::Contain.get_bounds(bounds, native);
@@ -269,7 +273,7 @@ fn scale_plate(player: &Player) -> impl IntoElement {
269 .child(div().text_color(rgb(INK1())).child(value))273 .child(div().text_color(rgb(INK1())).child(value))
270 }274 }
271 275
272-/// A section head: 9px, uppercase, `ink3` -- DESIGN §3's scale for the label276+/// A section head, uppercase, `ink3` -- DESIGN §3's scale for the label
273 /// that names a region before anything else lives in it.277 /// that names a region before anything else lives in it.
274 fn section_head(label: &str) -> impl IntoElement {278 fn section_head(label: &str) -> impl IntoElement {
275 div()279 div()
@@ -291,7 +295,10 @@ fn ghost(player: &Player, glyph: &str, action: ActionId) -> impl IntoElement {
291 .gap(px(2.))295 .gap(px(2.))
292 .py(px(6.))296 .py(px(6.))
293 .rounded(px(3.))297 .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+ ))
295 .text_color(rgb(INK2()))302 .text_color(rgb(INK2()))
296 .child(glyph.to_string())303 .child(glyph.to_string())
297 .child(304 .child(
@@ -352,43 +359,16 @@ fn keys_overlay(player: &Player) -> impl IntoElement {
352 .flex_col()359 .flex_col()
353 .gap(px(3.))360 .gap(px(3.))
354 .child(section_head("all commands · hold ? · release to close"))361 .child(section_head("all commands · hold ? · release to close"))
355- .children(keys_rows().into_iter().map(|row| match row {362+ .children(keys_rows().into_iter().map(|row| {
356- KeyRow::Head(category) => div()363+ match row {
357- .flex_none()364+ KeyRow::Head(category) => div()
358- .pt(px(4.))365+ .flex_none()
359- .type_style(type_scale::head())366+ .pt(px(4.))
360- .text_color(rgb(INK3()))367+ .type_style(type_scale::head())
361- .child(category.label().to_uppercase())368+ .text_color(rgb(INK3()))
362- .into_any_element(),369+ .child(category.label().to_uppercase())
363- KeyRow::Act(action) => div()370+ .into_any_element(),
364- .flex()371+ KeyRow::Act(action) => div()
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()
392 .flex()372 .flex()
393 .justify_between()373 .justify_between()
394 .gap(px(12.))374 .gap(px(12.))
@@ -399,7 +379,7 @@ fn keys_overlay(player: &Player) -> impl IntoElement {
399 gpui::FontWeight::MEDIUM,379 gpui::FontWeight::MEDIUM,
400 ))380 ))
401 .text_color(rgb(INK2()))381 .text_color(rgb(INK2()))
402- .child(f.label),382+ .child(action.label()),
403 )383 )
404 .child(384 .child(
405 div()385 div()
@@ -408,9 +388,38 @@ fn keys_overlay(player: &Player) -> impl IntoElement {
408 gpui::FontWeight::MEDIUM,388 gpui::FontWeight::MEDIUM,
409 ))389 ))
410 .text_color(rgb(INK3()))390 .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)),
412 )395 )
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+ }
414 }423 }
415 })),424 })),
416 )425 )
@@ -447,7 +456,12 @@ fn spine(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
447 /// the two-up OUT|IN judging *below* it as a flex sibling (DESIGN §6) rather456 /// the two-up OUT|IN judging *below* it as a flex sibling (DESIGN §6) rather
448 /// than layering plates over it: the picture's own `flex_1` shrinks to make457 /// than layering plates over it: the picture's own `flex_1` shrinks to make
449 /// room, so every picture pixel that is drawn stays visible.458 /// 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 {
451 let two_up = player.two_up().map(IntoElement::into_any_element);465 let two_up = player.two_up().map(IntoElement::into_any_element);
452 div()466 div()
453 .id("stance-screen")467 .id("stance-screen")
@@ -615,7 +629,10 @@ fn notice_plate(message: SharedString, bench_h: f32) -> impl IntoElement {
615 // shape as the legacy notice bar's own tone stripe (`notice_bar`).629 // shape as the legacy notice bar's own tone stripe (`notice_bar`).
616 .border_l(px(3.))630 .border_l(px(3.))
617 .border_color(rgb(notice_severity(&message)))631 .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+ ))
619 .text_color(rgb(INK1()))636 .text_color(rgb(INK1()))
620 .child(message)637 .child(message)
621 }638 }
@@ -627,7 +644,14 @@ fn ledger(player: &Player, position: f64) -> impl IntoElement {
627 true => "untitled".to_string(),644 true => "untitled".to_string(),
628 false => file_name(&player.project_path),645 false => file_name(&player.project_path),
629 };646 };
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+ );
631 let last_action = player.notices.back().cloned().unwrap_or_else(|| "—".into());655 let last_action = player.notices.back().cloned().unwrap_or_else(|| "—".into());
632 let export = player656 let export = player
633 .exporting()657 .exporting()
@@ -698,7 +722,12 @@ fn ledger(player: &Player, position: f64) -> impl IntoElement {
698 /// "ui fields are not stretchable" for the dock. `window_size` is threaded722 /// "ui fields are not stretchable" for the dock. `window_size` is threaded
699 /// through so the maximize-in-place cards inside the dock (`dock_stance.rs`)723 /// through so the maximize-in-place cards inside the dock (`dock_stance.rs`)
700 /// see the real viewport rather than a fabricated `size(px(DOCK_W), h)`.724 /// 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 {
702 div()731 div()
703 .id("stance-dock")732 .id("stance-dock")
704 .flex_none()733 .flex_none()
@@ -945,7 +974,9 @@ pub(crate) fn render(
945 el.child(notice_plate(n, bench_h))974 el.child(notice_plate(n, bench_h))
946 })975 })
947 .when(player.keys_open, |el| el.child(keys_overlay(player)))976 .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+ })
949 // The two menus (DESIGN §9: "verbs of the thing under the980 // The two menus (DESIGN §9: "verbs of the thing under the
950 // cursor", plate styling, the same scrim-and-row component981 // cursor", plate styling, the same scrim-and-row component
951 // the legacy tree already uses -- `library.rs`'s own doc982 // the legacy tree already uses -- `library.rs`'s own doc
crates/app/src/ui/timeband_stance.rsmodified+4 -7
@@ -4,12 +4,9 @@
4 //! the strip; this module owns what fills it, the same split4 //! the strip; this module owns what fills it, the same split
5 //! `dock_stance.rs`/`bench_stance.rs` already make for their regions.5 //! `dock_stance.rs`/`bench_stance.rs` already make for their regions.
6 //!6 //!
7-//! Type note: DESIGN.md §3 says the hero timecode is 13px; the approved mock7+//! Type note: DESIGN.md §3's approved scale gives the hero timecode 18px,
8-//! (MOCK-SPEC.md) reads closer to ~20px. Kept at 13px here -- the binding8+//! close to the mock's ~20px reading. Every size in this module comes from
9-//! contract's own number, already what `stance.rs::time_band()` shipped --9+//! `ui::type_scale` (role, not a bare `px()` literal).
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).
13 10
14 use crate::*;11 use crate::*;
15 use crate::ui::type_scale::{self, label, mono};12 use crate::ui::type_scale::{self, label, mono};
@@ -28,7 +25,7 @@ thread_local! {
28 }25 }
29 26
30 /// A stacked ghost command (DESIGN §4, MOCK-SPEC "Ghost transport"/"spine"):27 /// 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 keymap28+/// glyph 18px `ink2` over its chord 13px `ink3`, read live off the keymap
32 /// so a rebind can never leave the band showing a stroke that no longer29 /// so a rebind can never leave the band showing a stroke that no longer
33 /// fires it -- the same shape `stance::ghost` draws for the spine, kept local30 /// fires it -- the same shape `stance::ghost` draws for the spine, kept local
34 /// here so this module owns its own region end to end.31 /// 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";
37 37
38 /// DESIGN §3's scale, named so a call site reads the role, not a number.38 /// DESIGN §3's scale, named so a call site reads the role, not a number.
39 ///39 ///
40-/// Landed at a conservative +2px bump over the original half-pixel scale40+/// The approved readable-at-arm's-length scale. Each role is a whole pixel:
41-/// (13/10.5/10-9.5/9/8 -> 15/13/12-11/10/9), chosen over a fuller41+/// fractional baselines blur cosmic-text's greyscale AA.
42-/// "readable at arm's length" candidate (18/15/14-13/12/10) to keep the42+pub const HERO_TIMECODE_PX: f32 = 18.;
43-/// fixed-width dock/bench card labels clear of the truncation ladder43+pub const LABEL_ROW_PX: f32 = 15.;
44-/// (DESIGN §7). To try the fuller scale, swap these six values for44+pub const CHORD_METADATA_MAX_PX: f32 = 14.;
45-/// 18./15./14./13./12./10. and update `the_scale_matches_design_3` (and45+pub const CHORD_METADATA_MIN_PX: f32 = 13.;
46-/// DESIGN.md §3) to match.46+pub const SECTION_HEAD_PX: f32 = 12.;
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.;
52 /// The floor DESIGN §3 sets: nothing in the room reads smaller than this.47 /// 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.;
54 49
55 /// A family, weight and size together -- what a call site needs to paint50 /// A family, weight and size together -- what a call site needs to paint
56 /// text with `.font(style.font).text_size(style.size)`, and nothing it has51 /// text with `.font(style.font).text_size(style.size)`, and nothing it has
@@ -90,7 +85,10 @@ impl WithWeight for Font {
90 /// Archivo, at the given size and weight -- labels, verbs, section heads.85 /// Archivo, at the given size and weight -- labels, verbs, section heads.
91 /// No italics anywhere in the room (DESIGN §3), so this never offers one.86 /// No italics anywhere in the room (DESIGN §3), so this never offers one.
92 pub fn label(size_px: f32, weight: FontWeight) -> TypeStyle {87 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+ );
94 TypeStyle {92 TypeStyle {
95 font: family_font(ARCHIVO, weight, false),93 font: family_font(ARCHIVO, weight, false),
96 size: px(size_px),94 size: px(size_px),
@@ -100,14 +98,17 @@ pub fn label(size_px: f32, weight: FontWeight) -> TypeStyle {
100 /// Spline Sans Mono, at the given size and weight, tabular figures on --98 /// Spline Sans Mono, at the given size and weight, tabular figures on --
101 /// everything the film says.99 /// everything the film says.
102 pub fn mono(size_px: f32, weight: FontWeight) -> TypeStyle {100 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+ );
104 TypeStyle {105 TypeStyle {
105 font: family_font(SPLINE_SANS_MONO, weight, true),106 font: family_font(SPLINE_SANS_MONO, weight, true),
106 size: px(size_px),107 size: px(size_px),
107 }108 }
108 }109 }
109 110
110-/// A 9px Archivo 700 section head, `ink3`. The caller still has to uppercase111+/// A 12px Archivo 700 section head, `ink3`. The caller still has to uppercase
111 /// its own text (`.to_uppercase()`) and paint `ink3` -- this module only112 /// its own text (`.to_uppercase()`) and paint `ink3` -- this module only
112 /// owns type, not colour, and stays out of `ui::theme`'s door.113 /// owns type, not colour, and stays out of `ui::theme`'s door.
113 ///114 ///
@@ -122,7 +123,7 @@ pub fn head() -> TypeStyle {
122 }123 }
123 124
124 /// Applies a [`TypeStyle`] to any styled element in one call --125 /// Applies a [`TypeStyle`] to any styled element in one call --
125-/// `div().type_style(mono(9.5, FontWeight::MEDIUM))` instead of the126+/// `div().type_style(mono(CHORD_METADATA_MIN_PX, FontWeight::MEDIUM))` instead of the
126 /// `.font(style.font).text_size(style.size)` pair spelled out at every call127 /// `.font(style.font).text_size(style.size)` pair spelled out at every call
127 /// site. Blanket-implemented over `Styled` so every element in the room gets128 /// site. Blanket-implemented over `Styled` so every element in the room gets
128 /// it for free.129 /// it for free.
@@ -168,8 +169,10 @@ const EMBEDDED: &[(&[u8], &str)] = &[
168 /// runtime one -- these bytes are fixed at compile time -- so it panics169 /// runtime one -- these bytes are fixed at compile time -- so it panics
169 /// rather than falling silently back to a system face DESIGN §3 forbids.170 /// rather than falling silently back to a system face DESIGN §3 forbids.
170 pub fn register(cx: &App) {171 pub fn register(cx: &App) {
171- let fonts: Vec<Cow<'static, [u8]>> =172+ let fonts: Vec<Cow<'static, [u8]>> = EMBEDDED
172- EMBEDDED.iter().map(|(bytes, _)| Cow::Borrowed(*bytes)).collect();173+ .iter()
174+ .map(|(bytes, _)| Cow::Borrowed(*bytes))
175+ .collect();
173 cx.text_system()176 cx.text_system()
174 .add_fonts(fonts)177 .add_fonts(fonts)
175 .expect("bundled Archivo / Spline Sans Mono TTFs failed to register");178 .expect("bundled Archivo / Spline Sans Mono TTFs failed to register");
@@ -181,7 +184,7 @@ mod tests {
181 use gpui::FontStyle;184 use gpui::FontStyle;
182 185
183 /// The scale never drifts below DESIGN §3's floor, and role sizes match186 /// 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 the187+ /// the numbers §3 names -- a call site changing `18.` to `17.` for the
185 /// hero timecode is the design contract silently moving.188 /// hero timecode is the design contract silently moving.
186 ///189 ///
187 /// Sizes are all whole pixels (raised from the original 13/10.5/9.5-10/9/8190 /// Sizes are all whole pixels (raised from the original 13/10.5/9.5-10/9/8
@@ -192,11 +195,12 @@ mod tests {
192 /// back into this scale.195 /// back into this scale.
193 #[test]196 #[test]
194 fn the_scale_matches_design_3() {197 fn the_scale_matches_design_3() {
195- assert_eq!(HERO_TIMECODE_PX, 15.);198+ assert_eq!(HERO_TIMECODE_PX, 18.);
196- assert_eq!(LABEL_ROW_PX, 13.);199+ assert_eq!(LABEL_ROW_PX, 15.);
197- assert!((11. ..=12.).contains(&CHORD_METADATA_MIN_PX));200+ assert_eq!(CHORD_METADATA_MAX_PX, 14.);
198- assert_eq!(SECTION_HEAD_PX, 10.);201+ assert_eq!(CHORD_METADATA_MIN_PX, 13.);
199- assert_eq!(FLOOR_PX, 9.);202+ assert_eq!(SECTION_HEAD_PX, 12.);
203+ assert_eq!(FLOOR_PX, 10.);
200 for size in [204 for size in [
201 HERO_TIMECODE_PX,205 HERO_TIMECODE_PX,
202 LABEL_ROW_PX,206 LABEL_ROW_PX,