The clip card stops lecturing and starts labelling
Browse files at this commit978e6857d64772912559c8d8a4e6ee7cd309bdccParent: 2d435c2- style
- the clip card stops lecturing and starts labelling
4 changed files +61 -34
- crates/app/src/color_ui.rs +1 -1
- crates/app/src/transform_ui.rs +4 -0
- crates/app/src/ui/cards.rs +55 -29
- crates/app/src/ui/dock_stance.rs +1 -4
crates/app/src/color_ui.rsmodified+1 -1
| @@ -9,7 +9,7 @@ pub(crate) const COLOR_BANDS: [(&str, f32, f32); 4] = [ | ||
| 9 | 9 | ("Brightness", -1., 1.), |
| 10 | 10 | ("Contrast", 0., 2.), |
| 11 | 11 | ("Saturation", 0., 2.), |
| 12 | - ("Tint (cool–warm)", -1., 1.), | |
| 12 | + ("Tint", -1., 1.), | |
| 13 | 13 | ]; |
| 14 | 14 | |
| 15 | 15 | /// A press of a nudge key: a fortieth of a band's range, so a slider crosses it |
crates/app/src/transform_ui.rsmodified+4 -0
| @@ -27,6 +27,10 @@ pub(crate) const TRANSFORM_BANDS: [(&str, f32, f32); 8] = [ | ||
| 27 | 27 | /// one row would be numbers nothing on screen answers to. |
| 28 | 28 | pub(crate) const ROTATE_BAND: usize = 3; |
| 29 | 29 | |
| 30 | +/// Which band is scale: the one control on the card whose unit is a | |
| 31 | +/// multiplier (`×`) rather than a percent of frame or a degree. | |
| 32 | +pub(crate) const SCALE_BAND: usize = 2; | |
| 33 | + | |
| 30 | 34 | /// A press of a nudge key on every band but rotation: a fortieth-ish of a |
| 31 | 35 | /// band's range, [`crate::color_ui::COLOR_STEP`]'s own reason. A drag lands on |
| 32 | 36 | /// the same grid ([`Player::drag_transform`]). |
crates/app/src/ui/cards.rsmodified+55 -29
| @@ -20,6 +20,21 @@ fn dark_row_label(text: impl Into<SharedString>, picked: bool) -> Div { | ||
| 20 | 20 | .child(text.into()) |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | +/// A transform row's value with its unit: degrees for rotation, `×` for | |
| 24 | +/// scale (a multiplier, not a fraction of the frame), percent for | |
| 25 | +/// position/crop (both are a fraction of the frame's own size) -- the bare | |
| 26 | +/// `{value:.2}` this used to print could not tell a percent from a | |
| 27 | +/// multiplier apart. | |
| 28 | +fn transform_row_value(band: usize, value: f32) -> String { | |
| 29 | + if band == ROTATE_BAND { | |
| 30 | + format!("{value:.0}°") | |
| 31 | + } else if band == SCALE_BAND { | |
| 32 | + format!("{value:.2}×") | |
| 33 | + } else { | |
| 34 | + format!("{:.0}%", value * 100.) | |
| 35 | + } | |
| 36 | +} | |
| 37 | + | |
| 23 | 38 | /// A row's value -- what the film/the setting *says*, mono per §3. |
| 24 | 39 | fn dark_row_value(text: impl Into<SharedString>) -> Div { |
| 25 | 40 | div() |
| @@ -30,8 +45,13 @@ fn dark_row_value(text: impl Into<SharedString>) -> Div { | ||
| 30 | 45 | |
| 31 | 46 | /// A card's own head line: the verb in Archivo (§3 section-head casing) and, |
| 32 | 47 | /// where there is one, the clip it names in mono beside it -- "which clip" |
| 33 | -/// is metadata about the footage, not the room's own voice. | |
| 34 | -fn dark_card_head(verb: &str, meta: Option<SharedString>) -> Div { | |
| 48 | +/// is metadata about the footage, not the room's own voice. `help`, when | |
| 49 | +/// given, is the card's own how-to sentence -- it used to sit under the | |
| 50 | +/// head as a permanent line (a terminal-screen row of prose the user named | |
| 51 | +/// directly); now it rides a `?` glyph beside the head and only shows on | |
| 52 | +/// hover, the same hover-only convention [`dock_stance::ghost_verb`] | |
| 53 | +/// already uses for a verb's own description. | |
| 54 | +fn dark_card_head(verb: &str, meta: Option<SharedString>, help: Option<SharedString>) -> Div { | |
| 35 | 55 | div() |
| 36 | 56 | .flex_none() |
| 37 | 57 | .px(px(6.)) |
| @@ -50,6 +70,15 @@ fn dark_card_head(verb: &str, meta: Option<SharedString>) -> Div { | ||
| 50 | 70 | .text_color(rgb(INK3())) |
| 51 | 71 | .child(m) |
| 52 | 72 | })) |
| 73 | + .children(help.map(|h| { | |
| 74 | + div() | |
| 75 | + .id("card-head-help") | |
| 76 | + .flex_none() | |
| 77 | + .type_style(type_scale::mono(type_scale::CHORD_METADATA_MAX_PX, gpui::FontWeight::MEDIUM)) | |
| 78 | + .text_color(rgb(INK3())) | |
| 79 | + .tooltip(move |_, cx| cx.new(|_| Tip(h.clone())).into()) | |
| 80 | + .child("?") | |
| 81 | + })) | |
| 53 | 82 | } |
| 54 | 83 | |
| 55 | 84 | /// The help/status line under a card's head: what the keys do, which is |
| @@ -1065,7 +1094,7 @@ impl Player { | ||
| 1065 | 1094 | .rounded(px(6.)) |
| 1066 | 1095 | .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) |
| 1067 | 1096 | .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) |
| 1068 | - .when(dark, |d| d.child(dark_card_head("Exporting", None))) | |
| 1097 | + .when(dark, |d| d.child(dark_card_head("Exporting", None, None))) | |
| 1069 | 1098 | .when(!dark, |d| d.child(div().flex_none().px(px(6.)).child("Exporting"))) |
| 1070 | 1099 | // The bar itself: the same number as the percentage |
| 1071 | 1100 | // below it, and it only ever moves forward -- the |
| @@ -1490,6 +1519,7 @@ impl Player { | ||
| 1490 | 1519 | d.child(dark_card_head( |
| 1491 | 1520 | "Equalizer", |
| 1492 | 1521 | Some(format!("{} clip {}", lane.label(), idx + 1).into()), |
| 1522 | + Some("drag a handle, or a digit picks a band — ←→ moves it, ↑↓ its gain, shift+←→ its width; a adds, x removes, f flattens it, r all, s spectrum; a click away or esc closes".into()), | |
| 1493 | 1523 | )) |
| 1494 | 1524 | }) |
| 1495 | 1525 | .when(!dark, |d| { |
| @@ -1499,10 +1529,8 @@ impl Player { | ||
| 1499 | 1529 | idx + 1 |
| 1500 | 1530 | ))) |
| 1501 | 1531 | }) |
| 1502 | - .when(dark, |d| { | |
| 1503 | - d.child(dark_help(self.notices.front().cloned().unwrap_or_else(|| { | |
| 1504 | - "drag a handle, or a digit picks a band — ←→ moves it, ↑↓ its gain, shift+←→ its width; a adds, x removes, f flattens it, r all, s spectrum; a click away or esc closes".into() | |
| 1505 | - }))) | |
| 1532 | + .when(dark && self.notices.front().is_some(), |d| { | |
| 1533 | + d.child(dark_help(self.notices.front().cloned().unwrap_or_default())) | |
| 1506 | 1534 | }) |
| 1507 | 1535 | .when(!dark, |d| { |
| 1508 | 1536 | d.child( |
| @@ -1924,11 +1952,11 @@ impl Player { | ||
| 1924 | 1952 | .child( |
| 1925 | 1953 | div() |
| 1926 | 1954 | .w(px(44.)) |
| 1927 | - .when(dark, |d| d.child(dark_row_value(format!("{value:.2}")))) | |
| 1955 | + .when(dark, |d| d.child(dark_row_value(format!("{:.0}%", value * 100.)))) | |
| 1928 | 1956 | .when(!dark, |d| { |
| 1929 | 1957 | d.text_size(px(11.)) |
| 1930 | 1958 | .text_color(rgb(FG_SECONDARY())) |
| 1931 | - .child(format!("{value:.2}")) | |
| 1959 | + .child(format!("{:.0}%", value * 100.)) | |
| 1932 | 1960 | }), |
| 1933 | 1961 | ) |
| 1934 | 1962 | }) |
| @@ -1963,7 +1991,9 @@ impl Player { | ||
| 1963 | 1991 | .rounded(px(6.)) |
| 1964 | 1992 | .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) |
| 1965 | 1993 | .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) |
| 1966 | - .when(dark, |d| d.child(dark_card_head("Colour", Some(head_meta.clone())))) | |
| 1994 | + .when(dark, |d| { | |
| 1995 | + d.child(dark_card_head("Colour", Some(head_meta.clone()), Some(help_text.into()))) | |
| 1996 | + }) | |
| 1967 | 1997 | .when(!dark, |d| { |
| 1968 | 1998 | d.child(div().flex_none().px(px(6.)).child(format!( |
| 1969 | 1999 | "Colour — {} clip {}", |
| @@ -1971,7 +2001,6 @@ impl Player { | ||
| 1971 | 2001 | idx + 1 |
| 1972 | 2002 | ))) |
| 1973 | 2003 | }) |
| 1974 | - .when(dark, |d| d.child(dark_help(help_text))) | |
| 1975 | 2004 | .when(!dark, |d| { |
| 1976 | 2005 | d.child( |
| 1977 | 2006 | div() |
| @@ -2105,17 +2134,11 @@ impl Player { | ||
| 2105 | 2134 | ) |
| 2106 | 2135 | .child( |
| 2107 | 2136 | div().w(px(44.)).when(dark, |d| { |
| 2108 | - d.child(dark_row_value(match i == ROTATE_BAND { | |
| 2109 | - true => format!("{value:.0}°"), | |
| 2110 | - false => format!("{value:.2}"), | |
| 2111 | - })) | |
| 2137 | + d.child(dark_row_value(transform_row_value(i, value))) | |
| 2112 | 2138 | }).when(!dark, |d| { |
| 2113 | 2139 | d.text_size(px(11.)) |
| 2114 | 2140 | .text_color(rgb(FG_SECONDARY())) |
| 2115 | - .child(match i == ROTATE_BAND { | |
| 2116 | - true => format!("{value:.0}°"), | |
| 2117 | - false => format!("{value:.2}"), | |
| 2118 | - }) | |
| 2141 | + .child(transform_row_value(i, value)) | |
| 2119 | 2142 | }), |
| 2120 | 2143 | ) |
| 2121 | 2144 | }) |
| @@ -2149,7 +2172,9 @@ impl Player { | ||
| 2149 | 2172 | .rounded(px(6.)) |
| 2150 | 2173 | .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) |
| 2151 | 2174 | .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) |
| 2152 | - .when(dark, |d| d.child(dark_card_head("Transform", Some(head_meta.clone())))) | |
| 2175 | + .when(dark, |d| { | |
| 2176 | + d.child(dark_card_head("Transform", Some(head_meta.clone()), Some(help_text.into()))) | |
| 2177 | + }) | |
| 2153 | 2178 | .when(!dark, |d| { |
| 2154 | 2179 | d.child(div().flex_none().px(px(6.)).child(format!( |
| 2155 | 2180 | "Transform — {} clip {}", |
| @@ -2157,7 +2182,6 @@ impl Player { | ||
| 2157 | 2182 | idx + 1 |
| 2158 | 2183 | ))) |
| 2159 | 2184 | }) |
| 2160 | - .when(dark, |d| d.child(dark_help(help_text))) | |
| 2161 | 2185 | .when(!dark, |d| { |
| 2162 | 2186 | d.child( |
| 2163 | 2187 | div() |
| @@ -2287,7 +2311,9 @@ impl Player { | ||
| 2287 | 2311 | .rounded(px(6.)) |
| 2288 | 2312 | .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) |
| 2289 | 2313 | .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) |
| 2290 | - .when(dark, |d| d.child(dark_card_head("Speed (tape)", Some(head_meta.clone())))) | |
| 2314 | + .when(dark, |d| { | |
| 2315 | + d.child(dark_card_head("Speed (tape)", Some(head_meta.clone()), Some(help_text.into()))) | |
| 2316 | + }) | |
| 2291 | 2317 | .when(!dark, |d| { |
| 2292 | 2318 | d.child(div().flex_none().px(px(6.)).child(format!( |
| 2293 | 2319 | "Speed (tape) — {} clip {}", |
| @@ -2295,7 +2321,6 @@ impl Player { | ||
| 2295 | 2321 | idx + 1 |
| 2296 | 2322 | ))) |
| 2297 | 2323 | }) |
| 2298 | - .when(dark, |d| d.child(dark_help(help_text))) | |
| 2299 | 2324 | .when(!dark, |d| { |
| 2300 | 2325 | d.child( |
| 2301 | 2326 | div() |
| @@ -2520,7 +2545,7 @@ impl Player { | ||
| 2520 | 2545 | .rounded(px(6.)) |
| 2521 | 2546 | .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) |
| 2522 | 2547 | .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) |
| 2523 | - .when(dark, |d| d.child(dark_card_head("Mix", None))) | |
| 2548 | + .when(dark, |d| d.child(dark_card_head("Mix", None, Some(help_text.into())))) | |
| 2524 | 2549 | .when(!dark, |d| { |
| 2525 | 2550 | d.child( |
| 2526 | 2551 | div() |
| @@ -2529,7 +2554,6 @@ impl Player { | ||
| 2529 | 2554 | .child("Mix — track volumes and the master limiter"), |
| 2530 | 2555 | ) |
| 2531 | 2556 | }) |
| 2532 | - .when(dark, |d| d.child(dark_help(help_text))) | |
| 2533 | 2557 | .when(!dark, |d| { |
| 2534 | 2558 | d.child( |
| 2535 | 2559 | div() |
| @@ -2724,7 +2748,9 @@ impl Player { | ||
| 2724 | 2748 | .rounded(px(6.)) |
| 2725 | 2749 | .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) |
| 2726 | 2750 | .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) |
| 2727 | - .when(dark, |d| d.child(dark_card_head("Subtitle style", None))) | |
| 2751 | + .when(dark, |d| { | |
| 2752 | + d.child(dark_card_head("Subtitle style", None, Some(help_text.into()))) | |
| 2753 | + }) | |
| 2728 | 2754 | .when(!dark, |d| { |
| 2729 | 2755 | d.child( |
| 2730 | 2756 | div() |
| @@ -2733,7 +2759,6 @@ impl Player { | ||
| 2733 | 2759 | .child("Subtitle style — font and size of the cue plate"), |
| 2734 | 2760 | ) |
| 2735 | 2761 | }) |
| 2736 | - .when(dark, |d| d.child(dark_help(help_text))) | |
| 2737 | 2762 | .when(!dark, |d| { |
| 2738 | 2763 | d.child( |
| 2739 | 2764 | div() |
| @@ -2968,7 +2993,9 @@ impl Player { | ||
| 2968 | 2993 | .rounded(px(6.)) |
| 2969 | 2994 | .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) |
| 2970 | 2995 | .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) |
| 2971 | - .when(dark, |d| d.child(dark_card_head("Silences", Some(head_meta.clone())))) | |
| 2996 | + .when(dark, |d| { | |
| 2997 | + d.child(dark_card_head("Silences", Some(head_meta.clone()), Some(help_text.into()))) | |
| 2998 | + }) | |
| 2972 | 2999 | .when(!dark, |d| { |
| 2973 | 3000 | d.child(div().flex_none().px(px(6.)).child(format!( |
| 2974 | 3001 | "Silences — {} clip {}", |
| @@ -2976,7 +3003,6 @@ impl Player { | ||
| 2976 | 3003 | idx + 1 |
| 2977 | 3004 | ))) |
| 2978 | 3005 | }) |
| 2979 | - .when(dark, |d| d.child(dark_help(help_text))) | |
| 2980 | 3006 | .when(!dark, |d| { |
| 2981 | 3007 | d.child( |
| 2982 | 3008 | div() |
crates/app/src/ui/dock_stance.rsmodified+1 -4
| @@ -491,10 +491,7 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | ||
| 491 | 491 | .font(style.font) |
| 492 | 492 | .text_size(style.size) |
| 493 | 493 | .text_color(rgb(INK3())) |
| 494 | - .child( | |
| 495 | - "drag a row to a lane · ↵ add at playhead · double-click plays in screen · \ | |
| 496 | - right-click the dot to re-ink a source (rare — lives out of the way)", | |
| 497 | - ) | |
| 494 | + .child("drag · ↵ add · double-click plays") | |
| 498 | 495 | }) |
| 499 | 496 | } |
| 500 | 497 |