The menus and the cards join the room
Browse files at this commitd57e5d13b3dddf3e0978a7ef7f57c194fbf0def8Parent: b97144e- style
- the menus and the cards join the room
4 changed files +558 -212
- crates/app/src/ui/cards.rs +435 -186
- crates/app/src/ui/library.rs +38 -10
- crates/app/src/ui/overlays.rs +74 -16
- crates/app/src/ui/stance.rs +11 -0
crates/app/src/ui/cards.rsmodified+435 -186
| @@ -4,6 +4,133 @@ use crate::*; | ||
| 4 | 4 | use crate::ui::type_scale::{self, Typeset}; |
| 5 | 5 | use crate::ui::widgets::*; |
| 6 | 6 | |
| 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 label | |
| 9 | +/// and value paint as once `self.darkroom` is on, so the seven card bodies | |
| 10 | +/// each pick tokens rather than reimplement the same font/colour swap seven | |
| 11 | +/// times (`export_card`'s own `dark`-branch technique, one level up). | |
| 12 | +/// | |
| 13 | +/// A row label is what the room says about the control -- Archivo, §3's | |
| 14 | +/// 10.5px row size, `ink2` at rest / `ink1` picked (no permanent pill: the | |
| 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 { | |
| 17 | + div() | |
| 18 | + .type_style(type_scale::label(type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM)) | |
| 19 | + .text_color(rgb(if picked { INK1() } else { INK2() })) | |
| 20 | + .child(text.into()) | |
| 21 | +} | |
| 22 | + | |
| 23 | +/// A row's value -- what the film/the setting *says*, mono per §3. | |
| 24 | +fn dark_row_value(text: impl Into<SharedString>) -> Div { | |
| 25 | + div() | |
| 26 | + .type_style(type_scale::mono(type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM)) | |
| 27 | + .text_color(rgb(INK1())) | |
| 28 | + .child(text.into()) | |
| 29 | +} | |
| 30 | + | |
| 31 | +/// A card's own head line: the verb in Archivo (§3 section-head casing) and, | |
| 32 | +/// 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 { | |
| 35 | + div() | |
| 36 | + .flex_none() | |
| 37 | + .px(px(6.)) | |
| 38 | + .flex() | |
| 39 | + .items_baseline() | |
| 40 | + .gap(px(6.)) | |
| 41 | + .child( | |
| 42 | + div() | |
| 43 | + .type_style(type_scale::head()) | |
| 44 | + .text_color(rgb(INK3())) | |
| 45 | + .child(verb.to_uppercase()), | |
| 46 | + ) | |
| 47 | + .children(meta.map(|m| { | |
| 48 | + div() | |
| 49 | + .type_style(type_scale::mono(type_scale::CHORD_METADATA_MAX_PX, gpui::FontWeight::MEDIUM)) | |
| 50 | + .text_color(rgb(INK3())) | |
| 51 | + .child(m) | |
| 52 | + })) | |
| 53 | +} | |
| 54 | + | |
| 55 | +/// The help/status line under a card's head: what the keys do, which is | |
| 56 | +/// metadata about the room's controls -- mono, §3. | |
| 57 | +fn dark_help(text: impl Into<SharedString>) -> Div { | |
| 58 | + div() | |
| 59 | + .flex_none() | |
| 60 | + .px(px(6.)) | |
| 61 | + .type_style(type_scale::mono(type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM)) | |
| 62 | + .text_color(rgb(INK3())) | |
| 63 | + .child(text.into()) | |
| 64 | +} | |
| 65 | + | |
| 66 | +/// A ghost action row (DESIGN §4): borderless label + its chord, never a | |
| 67 | +/// filled box -- the shape every card's Reset/Flatten/Add/Remove/toggle | |
| 68 | +/// button takes now that "boxes are commitments" and Export is the one box | |
| 69 | +/// in the room. `active` is a toggle's own held-on state (EQ's spectrum | |
| 70 | +/// switch), not hover -- it keeps the fill and brightens the ink the same | |
| 71 | +/// way a picked param row's ring does. | |
| 72 | +/// The mix/silence/subtitle-size shape's own nudge glyph: ghost, not the | |
| 73 | +/// filled pill it used to be a permanent box -- resting bare, one fill step | |
| 74 | +/// on hover/press, same grammar as [`dark_ghost_button`] at a stepper's size. | |
| 75 | +fn dark_step_glyph( | |
| 76 | + id: impl Into<gpui::ElementId>, | |
| 77 | + plus: bool, | |
| 78 | + on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, | |
| 79 | +) -> impl IntoElement { | |
| 80 | + div() | |
| 81 | + .id(id.into()) | |
| 82 | + .flex_none() | |
| 83 | + .w(px(HIT_MIN)) | |
| 84 | + .h(px(KEYS_ROW_H)) | |
| 85 | + .flex() | |
| 86 | + .items_center() | |
| 87 | + .justify_center() | |
| 88 | + .rounded(px(3.)) | |
| 89 | + .cursor_pointer() | |
| 90 | + .hover(|s| s.bg(rgb(DARK_RAISED()))) | |
| 91 | + .on_click(on_click) | |
| 92 | + .child(dark_row_value(if plus { "+" } else { "−" })) | |
| 93 | +} | |
| 94 | + | |
| 95 | +fn dark_ghost_button( | |
| 96 | + id: impl Into<gpui::ElementId>, | |
| 97 | + text: impl Into<SharedString>, | |
| 98 | + chord: &str, | |
| 99 | + active: bool, | |
| 100 | + on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, | |
| 101 | +) -> impl IntoElement { | |
| 102 | + div() | |
| 103 | + .id(id.into()) | |
| 104 | + .flex_1() | |
| 105 | + .flex() | |
| 106 | + .h(px(CONTROL_H)) | |
| 107 | + .items_center() | |
| 108 | + .justify_center() | |
| 109 | + .gap(px(6.)) | |
| 110 | + .rounded(px(3.)) | |
| 111 | + .when(active, |d| d.bg(rgb(DARK_RAISED()))) | |
| 112 | + .cursor_pointer() | |
| 113 | + .hover(|s| s.bg(rgb(DARK_RAISED()))) | |
| 114 | + .on_click(on_click) | |
| 115 | + .child( | |
| 116 | + div() | |
| 117 | + .type_style(type_scale::label(type_scale::LABEL_ROW_PX, gpui::FontWeight::MEDIUM)) | |
| 118 | + .text_color(rgb(if active { INK1() } else { INK2() })) | |
| 119 | + .child(text.into()), | |
| 120 | + ) | |
| 121 | + .when(!chord.is_empty(), |d| { | |
| 122 | + d.child( | |
| 123 | + div() | |
| 124 | + .type_style(type_scale::mono( | |
| 125 | + type_scale::CHORD_METADATA_MIN_PX, | |
| 126 | + gpui::FontWeight::MEDIUM, | |
| 127 | + )) | |
| 128 | + .text_color(rgb(INK3())) | |
| 129 | + .child(chord.to_string()), | |
| 130 | + ) | |
| 131 | + }) | |
| 132 | +} | |
| 133 | + | |
| 7 | 134 | impl Player { |
| 8 | 135 | /// What an export is going to be, before there is one: the codec, the box |
| 9 | 136 | /// it goes into, the bitrate, where it lands -- and, above the button, the |
| @@ -1555,6 +1682,7 @@ impl Player { | ||
| 1555 | 1682 | pub(crate) fn color_card(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> { |
| 1556 | 1683 | let (lane, idx) = self.color_open?; |
| 1557 | 1684 | let params = self.color_params(); |
| 1685 | + let dark = self.darkroom; | |
| 1558 | 1686 | let rows: Vec<_> = COLOR_BANDS |
| 1559 | 1687 | .iter() |
| 1560 | 1688 | .enumerate() |
| @@ -1572,13 +1700,24 @@ impl Player { | ||
| 1572 | 1700 | .px(px(6.)) |
| 1573 | 1701 | .rounded(px(3.)) |
| 1574 | 1702 | .cursor_pointer() |
| 1575 | - .when(picked, |d| d.bg(rgb(BG_SELECTED()))) | |
| 1576 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | |
| 1703 | + // Darkroom: no permanent pill under a label -- the picked | |
| 1704 | + // row is a 1px `ink1` rule (§4's focus ring), never a fill. | |
| 1705 | + // Hover is the one fill step §4 allows. | |
| 1706 | + .when(dark && picked, |d| d.border_l_2().border_color(rgb(INK1()))) | |
| 1707 | + .when(!dark && picked, |d| d.bg(rgb(BG_SELECTED()))) | |
| 1708 | + .hover(|s| s.bg(rgb(if dark { DARK_RAISED() } else { BG_HOVER() }))) | |
| 1577 | 1709 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 1578 | 1710 | this.color_band = i; |
| 1579 | 1711 | cx.notify(); |
| 1580 | 1712 | })) |
| 1581 | - .child(div().flex_1().min_w(px(0.)).truncate().child(label)) | |
| 1713 | + .child( | |
| 1714 | + div() | |
| 1715 | + .flex_1() | |
| 1716 | + .min_w(px(0.)) | |
| 1717 | + .truncate() | |
| 1718 | + .when(dark, |d| d.child(dark_row_label(label, picked))) | |
| 1719 | + .when(!dark, |d| d.child(label)), | |
| 1720 | + ) | |
| 1582 | 1721 | .child( |
| 1583 | 1722 | // The bar is 4 px to look at and a whole row to hit |
| 1584 | 1723 | // (WCAG 2.5.8), the same split the ruler makes between |
| @@ -1608,7 +1747,7 @@ impl Player { | ||
| 1608 | 1747 | .w_full() |
| 1609 | 1748 | .h(px(4.)) |
| 1610 | 1749 | .rounded(px(2.)) |
| 1611 | - .bg(rgb(BG_PANEL())) | |
| 1750 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_PANEL() })) | |
| 1612 | 1751 | .child( |
| 1613 | 1752 | div() |
| 1614 | 1753 | .h_full() |
| @@ -1621,12 +1760,18 @@ impl Player { | ||
| 1621 | 1760 | .child( |
| 1622 | 1761 | div() |
| 1623 | 1762 | .w(px(44.)) |
| 1624 | - .text_size(px(11.)) | |
| 1625 | - .text_color(rgb(FG_SECONDARY())) | |
| 1626 | - .child(format!("{value:.2}")), | |
| 1763 | + .when(dark, |d| d.child(dark_row_value(format!("{value:.2}")))) | |
| 1764 | + .when(!dark, |d| { | |
| 1765 | + d.text_size(px(11.)) | |
| 1766 | + .text_color(rgb(FG_SECONDARY())) | |
| 1767 | + .child(format!("{value:.2}")) | |
| 1768 | + }), | |
| 1627 | 1769 | ) |
| 1628 | 1770 | }) |
| 1629 | 1771 | .collect(); |
| 1772 | + let head_meta: SharedString = format!("{} clip {}", lane.label(), idx + 1).into(); | |
| 1773 | + let help_text = | |
| 1774 | + "drag a bar, or ↑↓ picks one and ←→ moves it, r resets — a click away or esc closes"; | |
| 1630 | 1775 | Some( |
| 1631 | 1776 | drag_scrim(cx) |
| 1632 | 1777 | .flex() |
| @@ -1652,22 +1797,27 @@ impl Player { | ||
| 1652 | 1797 | .gap(px(2.)) |
| 1653 | 1798 | .p(px(12.)) |
| 1654 | 1799 | .rounded(px(6.)) |
| 1655 | - .bg(rgb(BG_RAISED())) | |
| 1656 | - .child(div().flex_none().px(px(6.)).child(format!( | |
| 1657 | - "Colour — {} clip {}", | |
| 1658 | - lane.label(), | |
| 1659 | - idx + 1 | |
| 1660 | - ))) | |
| 1661 | - .child( | |
| 1662 | - div() | |
| 1663 | - .flex_none() | |
| 1664 | - .px(px(6.)) | |
| 1665 | - .text_size(px(11.)) | |
| 1666 | - .text_color(rgb(FG_SECONDARY())) | |
| 1667 | - .child( | |
| 1668 | - "drag a bar, or ↑↓ picks one and ←→ moves it, r resets — a click away or esc closes", | |
| 1669 | - ), | |
| 1670 | - ) | |
| 1800 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) | |
| 1801 | + .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) | |
| 1802 | + .when(dark, |d| d.child(dark_card_head("Colour", Some(head_meta.clone())))) | |
| 1803 | + .when(!dark, |d| { | |
| 1804 | + d.child(div().flex_none().px(px(6.)).child(format!( | |
| 1805 | + "Colour — {} clip {}", | |
| 1806 | + lane.label(), | |
| 1807 | + idx + 1 | |
| 1808 | + ))) | |
| 1809 | + }) | |
| 1810 | + .when(dark, |d| d.child(dark_help(help_text))) | |
| 1811 | + .when(!dark, |d| { | |
| 1812 | + d.child( | |
| 1813 | + div() | |
| 1814 | + .flex_none() | |
| 1815 | + .px(px(6.)) | |
| 1816 | + .text_size(px(11.)) | |
| 1817 | + .text_color(rgb(FG_SECONDARY())) | |
| 1818 | + .child(help_text), | |
| 1819 | + ) | |
| 1820 | + }) | |
| 1671 | 1821 | // The frame as it is being graded, over the controls |
| 1672 | 1822 | // grading it: the three lines are what the picture is |
| 1673 | 1823 | // made of, and every sample of a drag reseeks, so they |
| @@ -1677,28 +1827,41 @@ impl Player { | ||
| 1677 | 1827 | .flex_none() |
| 1678 | 1828 | .h(px(HIST_H)) |
| 1679 | 1829 | .rounded(px(3.)) |
| 1680 | - .bg(rgb(BG_HOVER_DIM())) | |
| 1830 | + .bg(rgb(if dark { DARK_HAIRLINE() } else { BG_HOVER_DIM() })) | |
| 1681 | 1831 | .relative() |
| 1682 | 1832 | .child(hist_curves(self.histogram)), |
| 1683 | 1833 | ) |
| 1684 | 1834 | .children(rows) |
| 1685 | - .child( | |
| 1686 | - div() | |
| 1687 | - .id("color-reset") | |
| 1688 | - .mt(px(4.)) | |
| 1689 | - .flex() | |
| 1690 | - .h(px(CONTROL_H)) | |
| 1691 | - .items_center() | |
| 1692 | - .justify_center() | |
| 1693 | - .rounded(px(3.)) | |
| 1694 | - .bg(rgb(BG_SELECTED())) | |
| 1695 | - .cursor_pointer() | |
| 1696 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | |
| 1697 | - .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { | |
| 1835 | + .when(dark, |d| { | |
| 1836 | + d.child(dark_ghost_button( | |
| 1837 | + "color-reset", | |
| 1838 | + "Reset", | |
| 1839 | + "r", | |
| 1840 | + false, | |
| 1841 | + cx.listener(|this, _: &ClickEvent, _, cx| { | |
| 1698 | 1842 | this.set_color(ColorParams::default(), cx); |
| 1699 | - })) | |
| 1700 | - .child("Reset"), | |
| 1701 | - ), | |
| 1843 | + }), | |
| 1844 | + )) | |
| 1845 | + }) | |
| 1846 | + .when(!dark, |d| { | |
| 1847 | + d.child( | |
| 1848 | + div() | |
| 1849 | + .id("color-reset") | |
| 1850 | + .mt(px(4.)) | |
| 1851 | + .flex() | |
| 1852 | + .h(px(CONTROL_H)) | |
| 1853 | + .items_center() | |
| 1854 | + .justify_center() | |
| 1855 | + .rounded(px(3.)) | |
| 1856 | + .bg(rgb(BG_SELECTED())) | |
| 1857 | + .cursor_pointer() | |
| 1858 | + .hover(|s| s.bg(rgb(BG_HOVER()))) | |
| 1859 | + .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { | |
| 1860 | + this.set_color(ColorParams::default(), cx); | |
| 1861 | + })) | |
| 1862 | + .child("Reset"), | |
| 1863 | + ) | |
| 1864 | + }), | |
| 1702 | 1865 | ), |
| 1703 | 1866 | ) |
| 1704 | 1867 | } |
| @@ -1709,6 +1872,7 @@ impl Player { | ||
| 1709 | 1872 | pub(crate) fn transform_card(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> { |
| 1710 | 1873 | let (lane, idx) = self.transform_open?; |
| 1711 | 1874 | let params = self.transform_params(); |
| 1875 | + let dark = self.darkroom; | |
| 1712 | 1876 | let rows: Vec<_> = TRANSFORM_BANDS |
| 1713 | 1877 | .iter() |
| 1714 | 1878 | .enumerate() |
| @@ -1726,13 +1890,21 @@ impl Player { | ||
| 1726 | 1890 | .px(px(6.)) |
| 1727 | 1891 | .rounded(px(3.)) |
| 1728 | 1892 | .cursor_pointer() |
| 1729 | - .when(picked, |d| d.bg(rgb(BG_SELECTED()))) | |
| 1730 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | |
| 1893 | + .when(dark && picked, |d| d.border_l_2().border_color(rgb(INK1()))) | |
| 1894 | + .when(!dark && picked, |d| d.bg(rgb(BG_SELECTED()))) | |
| 1895 | + .hover(|s| s.bg(rgb(if dark { DARK_RAISED() } else { BG_HOVER() }))) | |
| 1731 | 1896 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 1732 | 1897 | this.transform_band = i; |
| 1733 | 1898 | cx.notify(); |
| 1734 | 1899 | })) |
| 1735 | - .child(div().flex_1().min_w(px(0.)).truncate().child(label)) | |
| 1900 | + .child( | |
| 1901 | + div() | |
| 1902 | + .flex_1() | |
| 1903 | + .min_w(px(0.)) | |
| 1904 | + .truncate() | |
| 1905 | + .when(dark, |d| d.child(dark_row_label(label, picked))) | |
| 1906 | + .when(!dark, |d| d.child(label)), | |
| 1907 | + ) | |
| 1736 | 1908 | .child( |
| 1737 | 1909 | div() |
| 1738 | 1910 | .id(("transform-bar", i)) |
| @@ -1757,7 +1929,7 @@ impl Player { | ||
| 1757 | 1929 | .w_full() |
| 1758 | 1930 | .h(px(4.)) |
| 1759 | 1931 | .rounded(px(2.)) |
| 1760 | - .bg(rgb(BG_PANEL())) | |
| 1932 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_PANEL() })) | |
| 1761 | 1933 | .child( |
| 1762 | 1934 | div() |
| 1763 | 1935 | .h_full() |
| @@ -1768,17 +1940,25 @@ impl Player { | ||
| 1768 | 1940 | ), |
| 1769 | 1941 | ) |
| 1770 | 1942 | .child( |
| 1771 | - div() | |
| 1772 | - .w(px(44.)) | |
| 1773 | - .text_size(px(11.)) | |
| 1774 | - .text_color(rgb(FG_SECONDARY())) | |
| 1775 | - .child(match i == ROTATE_BAND { | |
| 1943 | + div().w(px(44.)).when(dark, |d| { | |
| 1944 | + d.child(dark_row_value(match i == ROTATE_BAND { | |
| 1776 | 1945 | true => format!("{value:.0}°"), |
| 1777 | 1946 | false => format!("{value:.2}"), |
| 1778 | - }), | |
| 1947 | + })) | |
| 1948 | + }).when(!dark, |d| { | |
| 1949 | + d.text_size(px(11.)) | |
| 1950 | + .text_color(rgb(FG_SECONDARY())) | |
| 1951 | + .child(match i == ROTATE_BAND { | |
| 1952 | + true => format!("{value:.0}°"), | |
| 1953 | + false => format!("{value:.2}"), | |
| 1954 | + }) | |
| 1955 | + }), | |
| 1779 | 1956 | ) |
| 1780 | 1957 | }) |
| 1781 | 1958 | .collect(); |
| 1959 | + let head_meta: SharedString = format!("{} clip {}", lane.label(), idx + 1).into(); | |
| 1960 | + let help_text = "drag a bar, or ↑↓ picks one and ←→ moves it (rotation steps \ | |
| 1961 | + by 90°), r resets — a click away or esc closes"; | |
| 1782 | 1962 | Some( |
| 1783 | 1963 | drag_scrim(cx) |
| 1784 | 1964 | .flex() |
| @@ -1803,41 +1983,58 @@ impl Player { | ||
| 1803 | 1983 | .gap(px(2.)) |
| 1804 | 1984 | .p(px(12.)) |
| 1805 | 1985 | .rounded(px(6.)) |
| 1806 | - .bg(rgb(BG_RAISED())) | |
| 1807 | - .child(div().flex_none().px(px(6.)).child(format!( | |
| 1808 | - "Transform — {} clip {}", | |
| 1809 | - lane.label(), | |
| 1810 | - idx + 1 | |
| 1811 | - ))) | |
| 1812 | - .child( | |
| 1813 | - div() | |
| 1814 | - .flex_none() | |
| 1815 | - .px(px(6.)) | |
| 1816 | - .text_size(px(11.)) | |
| 1817 | - .text_color(rgb(FG_SECONDARY())) | |
| 1818 | - .child( | |
| 1819 | - "drag a bar, or ↑↓ picks one and ←→ moves it (rotation steps \ | |
| 1820 | - by 90°), r resets — a click away or esc closes", | |
| 1821 | - ), | |
| 1822 | - ) | |
| 1986 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) | |
| 1987 | + .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) | |
| 1988 | + .when(dark, |d| d.child(dark_card_head("Transform", Some(head_meta.clone())))) | |
| 1989 | + .when(!dark, |d| { | |
| 1990 | + d.child(div().flex_none().px(px(6.)).child(format!( | |
| 1991 | + "Transform — {} clip {}", | |
| 1992 | + lane.label(), | |
| 1993 | + idx + 1 | |
| 1994 | + ))) | |
| 1995 | + }) | |
| 1996 | + .when(dark, |d| d.child(dark_help(help_text))) | |
| 1997 | + .when(!dark, |d| { | |
| 1998 | + d.child( | |
| 1999 | + div() | |
| 2000 | + .flex_none() | |
| 2001 | + .px(px(6.)) | |
| 2002 | + .text_size(px(11.)) | |
| 2003 | + .text_color(rgb(FG_SECONDARY())) | |
| 2004 | + .child(help_text), | |
| 2005 | + ) | |
| 2006 | + }) | |
| 1823 | 2007 | .children(rows) |
| 1824 | - .child( | |
| 1825 | - div() | |
| 1826 | - .id("transform-reset") | |
| 1827 | - .mt(px(4.)) | |
| 1828 | - .flex() | |
| 1829 | - .h(px(CONTROL_H)) | |
| 1830 | - .items_center() | |
| 1831 | - .justify_center() | |
| 1832 | - .rounded(px(3.)) | |
| 1833 | - .bg(rgb(BG_SELECTED())) | |
| 1834 | - .cursor_pointer() | |
| 1835 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | |
| 1836 | - .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { | |
| 2008 | + .when(dark, |d| { | |
| 2009 | + d.child(dark_ghost_button( | |
| 2010 | + "transform-reset", | |
| 2011 | + "Reset", | |
| 2012 | + "r", | |
| 2013 | + false, | |
| 2014 | + cx.listener(|this, _: &ClickEvent, _, cx| { | |
| 1837 | 2015 | this.set_transform(TransformParams::default(), cx); |
| 1838 | - })) | |
| 1839 | - .child("Reset"), | |
| 1840 | - ), | |
| 2016 | + }), | |
| 2017 | + )) | |
| 2018 | + }) | |
| 2019 | + .when(!dark, |d| { | |
| 2020 | + d.child( | |
| 2021 | + div() | |
| 2022 | + .id("transform-reset") | |
| 2023 | + .mt(px(4.)) | |
| 2024 | + .flex() | |
| 2025 | + .h(px(CONTROL_H)) | |
| 2026 | + .items_center() | |
| 2027 | + .justify_center() | |
| 2028 | + .rounded(px(3.)) | |
| 2029 | + .bg(rgb(BG_SELECTED())) | |
| 2030 | + .cursor_pointer() | |
| 2031 | + .hover(|s| s.bg(rgb(BG_HOVER()))) | |
| 2032 | + .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { | |
| 2033 | + this.set_transform(TransformParams::default(), cx); | |
| 2034 | + })) | |
| 2035 | + .child("Reset"), | |
| 2036 | + ) | |
| 2037 | + }), | |
| 1841 | 2038 | ), |
| 1842 | 2039 | ) |
| 1843 | 2040 | } |
| @@ -1856,6 +2053,7 @@ impl Player { | ||
| 1856 | 2053 | let speed = self.card_speed(); |
| 1857 | 2054 | let session = self.session.as_ref()?; |
| 1858 | 2055 | let clip = session.lane_clips(lane).get(idx).copied()?; |
| 2056 | + let dark = self.darkroom; | |
| 1859 | 2057 | let lo = f32::from(Speed::MIN.permille()); |
| 1860 | 2058 | let hi = f32::from(Speed::MAX.permille()); |
| 1861 | 2059 | let frac = ((f32::from(speed.permille()) - lo) / (hi - lo)).clamp(0., 1.); |
| @@ -1863,6 +2061,7 @@ impl Player { | ||
| 1863 | 2061 | .into_iter() |
| 1864 | 2062 | .map(|permille| { |
| 1865 | 2063 | let at = Speed::from_permille(permille); |
| 2064 | + let picked = at == speed; | |
| 1866 | 2065 | div() |
| 1867 | 2066 | .id(("speed-preset", usize::from(permille))) |
| 1868 | 2067 | .flex_1() |
| @@ -1871,18 +2070,32 @@ impl Player { | ||
| 1871 | 2070 | .items_center() |
| 1872 | 2071 | .justify_center() |
| 1873 | 2072 | .rounded(px(3.)) |
| 1874 | - .bg(rgb(match at == speed { | |
| 1875 | - true => BG_SELECTED(), | |
| 1876 | - false => BG_PANEL(), | |
| 1877 | - })) | |
| 2073 | + .when(dark && picked, |d| d.bg(rgb(DARK_RAISED()))) | |
| 2074 | + .when(!dark, |d| { | |
| 2075 | + d.bg(rgb(match picked { | |
| 2076 | + true => BG_SELECTED(), | |
| 2077 | + false => BG_PANEL(), | |
| 2078 | + })) | |
| 2079 | + }) | |
| 1878 | 2080 | .cursor_pointer() |
| 1879 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | |
| 2081 | + .hover(|s| s.bg(rgb(if dark { DARK_RAISED() } else { BG_HOVER() }))) | |
| 1880 | 2082 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 1881 | 2083 | this.set_speed(at, cx); |
| 1882 | 2084 | })) |
| 1883 | - .child(format!("{at}")) | |
| 2085 | + .when(dark, |d| d.child(dark_row_value(format!("{at}")))) | |
| 2086 | + .when(!dark, |d| d.child(format!("{at}"))) | |
| 1884 | 2087 | }) |
| 1885 | 2088 | .collect(); |
| 2089 | + let head_meta: SharedString = format!("{} clip {}", lane.label(), idx + 1).into(); | |
| 2090 | + let help_text = | |
| 2091 | + "drag the bar or ←→ moves it, r is 1.00x — the pitch moves with the rate; a click away or esc closes"; | |
| 2092 | + let tail_text: SharedString = format!( | |
| 2093 | + "{speed} — {} source frames over {} on the timeline ({})", | |
| 2094 | + clip.len(), | |
| 2095 | + clip.frames(), | |
| 2096 | + frames_timecode(clip.frames(), self.fps) | |
| 2097 | + ) | |
| 2098 | + .into(); | |
| 1886 | 2099 | Some( |
| 1887 | 2100 | drag_scrim(cx) |
| 1888 | 2101 | .flex() |
| @@ -1908,22 +2121,27 @@ impl Player { | ||
| 1908 | 2121 | .gap(px(6.)) |
| 1909 | 2122 | .p(px(12.)) |
| 1910 | 2123 | .rounded(px(6.)) |
| 1911 | - .bg(rgb(BG_RAISED())) | |
| 1912 | - .child(div().flex_none().px(px(6.)).child(format!( | |
| 1913 | - "Speed (tape) — {} clip {}", | |
| 1914 | - lane.label(), | |
| 1915 | - idx + 1 | |
| 1916 | - ))) | |
| 1917 | - .child( | |
| 1918 | - div() | |
| 1919 | - .flex_none() | |
| 1920 | - .px(px(6.)) | |
| 1921 | - .text_size(px(11.)) | |
| 1922 | - .text_color(rgb(FG_SECONDARY())) | |
| 1923 | - .child( | |
| 1924 | - "drag the bar or ←→ moves it, r is 1.00x — the pitch moves with the rate; a click away or esc closes", | |
| 1925 | - ), | |
| 1926 | - ) | |
| 2124 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) | |
| 2125 | + .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) | |
| 2126 | + .when(dark, |d| d.child(dark_card_head("Speed (tape)", Some(head_meta.clone())))) | |
| 2127 | + .when(!dark, |d| { | |
| 2128 | + d.child(div().flex_none().px(px(6.)).child(format!( | |
| 2129 | + "Speed (tape) — {} clip {}", | |
| 2130 | + lane.label(), | |
| 2131 | + idx + 1 | |
| 2132 | + ))) | |
| 2133 | + }) | |
| 2134 | + .when(dark, |d| d.child(dark_help(help_text))) | |
| 2135 | + .when(!dark, |d| { | |
| 2136 | + d.child( | |
| 2137 | + div() | |
| 2138 | + .flex_none() | |
| 2139 | + .px(px(6.)) | |
| 2140 | + .text_size(px(11.)) | |
| 2141 | + .text_color(rgb(FG_SECONDARY())) | |
| 2142 | + .child(help_text), | |
| 2143 | + ) | |
| 2144 | + }) | |
| 1927 | 2145 | .child( |
| 1928 | 2146 | // 4 px to look at and a whole row to hit (WCAG |
| 1929 | 2147 | // 2.5.8), the split the colour sliders and the ruler |
| @@ -1949,7 +2167,7 @@ impl Player { | ||
| 1949 | 2167 | .w_full() |
| 1950 | 2168 | .h(px(4.)) |
| 1951 | 2169 | .rounded(px(2.)) |
| 1952 | - .bg(rgb(BG_PANEL())) | |
| 2170 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_PANEL() })) | |
| 1953 | 2171 | .child( |
| 1954 | 2172 | div() |
| 1955 | 2173 | .h_full() |
| @@ -1960,22 +2178,20 @@ impl Player { | ||
| 1960 | 2178 | ), |
| 1961 | 2179 | ) |
| 1962 | 2180 | .child(div().flex().gap(px(4.)).children(presets)) |
| 1963 | - .child( | |
| 1964 | - div() | |
| 1965 | - .flex_none() | |
| 1966 | - .px(px(6.)) | |
| 1967 | - .text_size(px(11.)) | |
| 1968 | - .text_color(rgb(FG_SECONDARY())) | |
| 1969 | - // What the choice *is*, in the numbers the | |
| 1970 | - // timeline is measured in: the source range | |
| 1971 | - // never moves, the room it takes does. | |
| 1972 | - .child(format!( | |
| 1973 | - "{speed} — {} source frames over {} on the timeline ({})", | |
| 1974 | - clip.len(), | |
| 1975 | - clip.frames(), | |
| 1976 | - frames_timecode(clip.frames(), self.fps) | |
| 1977 | - )), | |
| 1978 | - ), | |
| 2181 | + .when(dark, |d| d.child(dark_help(tail_text.clone()))) | |
| 2182 | + .when(!dark, |d| { | |
| 2183 | + d.child( | |
| 2184 | + div() | |
| 2185 | + .flex_none() | |
| 2186 | + .px(px(6.)) | |
| 2187 | + .text_size(px(11.)) | |
| 2188 | + .text_color(rgb(FG_SECONDARY())) | |
| 2189 | + // What the choice *is*, in the numbers the | |
| 2190 | + // timeline is measured in: the source range | |
| 2191 | + // never moves, the room it takes does. | |
| 2192 | + .child(tail_text), | |
| 2193 | + ) | |
| 2194 | + }), | |
| 1979 | 2195 | ), |
| 1980 | 2196 | ) |
| 1981 | 2197 | } |
| @@ -2000,6 +2216,7 @@ impl Player { | ||
| 2000 | 2216 | if !self.mix_open { |
| 2001 | 2217 | return None; |
| 2002 | 2218 | } |
| 2219 | + let dark = self.darkroom; | |
| 2003 | 2220 | let session = self.session.as_ref(); |
| 2004 | 2221 | let lanes = self.mix_lanes(); |
| 2005 | 2222 | let limiter = session.map_or_else(Limiter::default, PlaybackSession::limiter); |
| @@ -2027,6 +2244,7 @@ impl Player { | ||
| 2027 | 2244 | .into_iter() |
| 2028 | 2245 | .enumerate() |
| 2029 | 2246 | .map(|(n, (label, value))| { |
| 2247 | + let picked = n == self.mix_field; | |
| 2030 | 2248 | div() |
| 2031 | 2249 | .id(("mix-row", n)) |
| 2032 | 2250 | .flex() |
| @@ -2036,51 +2254,80 @@ impl Player { | ||
| 2036 | 2254 | .justify_between() |
| 2037 | 2255 | .px(px(6.)) |
| 2038 | 2256 | .rounded(px(3.)) |
| 2039 | - .bg(rgb(match n == self.mix_field { | |
| 2040 | - true => BG_SELECTED(), | |
| 2041 | - false => BG_PANEL(), | |
| 2042 | - })) | |
| 2257 | + .when(dark && picked, |d| d.border_l_2().border_color(rgb(INK1()))) | |
| 2258 | + .when(!dark, |d| { | |
| 2259 | + d.bg(rgb(match picked { | |
| 2260 | + true => BG_SELECTED(), | |
| 2261 | + false => BG_PANEL(), | |
| 2262 | + })) | |
| 2263 | + }) | |
| 2043 | 2264 | .cursor_pointer() |
| 2044 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | |
| 2265 | + .hover(|s| s.bg(rgb(if dark { DARK_RAISED() } else { BG_HOVER() }))) | |
| 2045 | 2266 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 2046 | 2267 | this.mix_field = n; |
| 2047 | 2268 | cx.notify(); |
| 2048 | 2269 | })) |
| 2049 | - .child(div().text_color(rgb(FG_SECONDARY())).child(label)) | |
| 2270 | + .child( | |
| 2271 | + div() | |
| 2272 | + .when(dark, |d| d.child(dark_row_label(label.clone(), picked))) | |
| 2273 | + .when(!dark, |d| d.text_color(rgb(FG_SECONDARY())).child(label)), | |
| 2274 | + ) | |
| 2050 | 2275 | .child( |
| 2051 | 2276 | div() |
| 2052 | 2277 | .flex() |
| 2053 | 2278 | .items_center() |
| 2054 | 2279 | .gap(px(4.)) |
| 2055 | - .child(value) | |
| 2280 | + .when(dark, |d| d.child(dark_row_value(value.clone()))) | |
| 2281 | + .when(!dark, |d| d.child(value)) | |
| 2056 | 2282 | .children([-1, 1].map(|steps: i32| { |
| 2057 | - div() | |
| 2058 | - .id(("mix-step", n * 2 + usize::from(steps > 0))) | |
| 2059 | - .flex_none() | |
| 2060 | - .w(px(HIT_MIN)) | |
| 2061 | - .h(px(KEYS_ROW_H)) | |
| 2062 | - .flex() | |
| 2063 | - .items_center() | |
| 2064 | - .justify_center() | |
| 2065 | - .rounded(px(3.)) | |
| 2066 | - .bg(rgb(BG_PANEL())) | |
| 2067 | - .cursor_pointer() | |
| 2068 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | |
| 2069 | - .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | |
| 2070 | - // Picked as well as moved, the silence | |
| 2071 | - // card's rule: the row a press lands on | |
| 2072 | - // is the row the arrows carry on from. | |
| 2073 | - this.mix_field = n; | |
| 2074 | - this.nudge_mix(steps, cx); | |
| 2075 | - })) | |
| 2076 | - .child(match steps > 0 { | |
| 2077 | - true => "+", | |
| 2078 | - false => "−", | |
| 2079 | - }) | |
| 2283 | + let id = ("mix-step", n * 2 + usize::from(steps > 0)); | |
| 2284 | + match dark { | |
| 2285 | + true => dark_step_glyph( | |
| 2286 | + id, | |
| 2287 | + steps > 0, | |
| 2288 | + cx.listener(move |this, _: &ClickEvent, _, cx| { | |
| 2289 | + this.mix_field = n; | |
| 2290 | + this.nudge_mix(steps, cx); | |
| 2291 | + }), | |
| 2292 | + ) | |
| 2293 | + .into_any_element(), | |
| 2294 | + false => div() | |
| 2295 | + .id(id) | |
| 2296 | + .flex_none() | |
| 2297 | + .w(px(HIT_MIN)) | |
| 2298 | + .h(px(KEYS_ROW_H)) | |
| 2299 | + .flex() | |
| 2300 | + .items_center() | |
| 2301 | + .justify_center() | |
| 2302 | + .rounded(px(3.)) | |
| 2303 | + .bg(rgb(BG_PANEL())) | |
| 2304 | + .cursor_pointer() | |
| 2305 | + .hover(|s| s.bg(rgb(BG_HOVER()))) | |
| 2306 | + .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | |
| 2307 | + // Picked as well as moved, the silence | |
| 2308 | + // card's rule: the row a press lands on | |
| 2309 | + // is the row the arrows carry on from. | |
| 2310 | + this.mix_field = n; | |
| 2311 | + this.nudge_mix(steps, cx); | |
| 2312 | + })) | |
| 2313 | + .child(match steps > 0 { | |
| 2314 | + true => "+", | |
| 2315 | + false => "−", | |
| 2316 | + }) | |
| 2317 | + .into_any_element(), | |
| 2318 | + } | |
| 2080 | 2319 | })), |
| 2081 | 2320 | ) |
| 2082 | 2321 | }) |
| 2083 | 2322 | .collect(); |
| 2323 | + let help_text = "− and + move a setting, or ↑↓ picks one and ←→ moves it (hold to run it) — a track fader moves everything on that track; a click away or esc closes"; | |
| 2324 | + let tail_text = match limiter.on { | |
| 2325 | + true => format!( | |
| 2326 | + "the mix is held under {:+.0} dBFS — quieter passages are untouched", | |
| 2327 | + limiter.ceiling_db | |
| 2328 | + ), | |
| 2329 | + false => "the limiter is out of circuit — a hot mix clips at full scale".to_string(), | |
| 2330 | + }; | |
| 2084 | 2331 | Some( |
| 2085 | 2332 | scrim() |
| 2086 | 2333 | .flex() |
| @@ -2107,23 +2354,28 @@ impl Player { | ||
| 2107 | 2354 | .gap(px(6.)) |
| 2108 | 2355 | .p(px(12.)) |
| 2109 | 2356 | .rounded(px(6.)) |
| 2110 | - .bg(rgb(BG_RAISED())) | |
| 2111 | - .child( | |
| 2112 | - div() | |
| 2113 | - .flex_none() | |
| 2114 | - .px(px(6.)) | |
| 2115 | - .child("Mix — track volumes and the master limiter"), | |
| 2116 | - ) | |
| 2117 | - .child( | |
| 2118 | - div() | |
| 2119 | - .flex_none() | |
| 2120 | - .px(px(6.)) | |
| 2121 | - .text_size(px(11.)) | |
| 2122 | - .text_color(rgb(FG_SECONDARY())) | |
| 2123 | - .child( | |
| 2124 | - "− and + move a setting, or ↑↓ picks one and ←→ moves it (hold to run it) — a track fader moves everything on that track; a click away or esc closes", | |
| 2125 | - ), | |
| 2126 | - ) | |
| 2357 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) | |
| 2358 | + .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) | |
| 2359 | + .when(dark, |d| d.child(dark_card_head("Mix", None))) | |
| 2360 | + .when(!dark, |d| { | |
| 2361 | + d.child( | |
| 2362 | + div() | |
| 2363 | + .flex_none() | |
| 2364 | + .px(px(6.)) | |
| 2365 | + .child("Mix — track volumes and the master limiter"), | |
| 2366 | + ) | |
| 2367 | + }) | |
| 2368 | + .when(dark, |d| d.child(dark_help(help_text))) | |
| 2369 | + .when(!dark, |d| { | |
| 2370 | + d.child( | |
| 2371 | + div() | |
| 2372 | + .flex_none() | |
| 2373 | + .px(px(6.)) | |
| 2374 | + .text_size(px(11.)) | |
| 2375 | + .text_color(rgb(FG_SECONDARY())) | |
| 2376 | + .child(help_text), | |
| 2377 | + ) | |
| 2378 | + }) | |
| 2127 | 2379 | .child( |
| 2128 | 2380 | div() |
| 2129 | 2381 | .id("mix-rows") |
| @@ -2133,23 +2385,20 @@ impl Player { | ||
| 2133 | 2385 | .overflow_y_scroll() |
| 2134 | 2386 | .children(rows), |
| 2135 | 2387 | ) |
| 2136 | - .child( | |
| 2137 | - div() | |
| 2138 | - .flex_none() | |
| 2139 | - .px(px(6.)) | |
| 2140 | - .text_size(px(11.)) | |
| 2141 | - .text_color(rgb(FG_SECONDARY())) | |
| 2142 | - // What the choice *is*: the limiter's own line, | |
| 2143 | - // because "on" alone says nothing about what it | |
| 2144 | - // does to a mix that never reaches the ceiling. | |
| 2145 | - .child(match limiter.on { | |
| 2146 | - true => format!( | |
| 2147 | - "the mix is held under {:+.0} dBFS — quieter passages are untouched", | |
| 2148 | - limiter.ceiling_db | |
| 2149 | - ), | |
| 2150 | - false => "the limiter is out of circuit — a hot mix clips at full scale".to_string(), | |
| 2151 | - }), | |
| 2152 | - ), | |
| 2388 | + .when(dark, |d| d.child(dark_help(tail_text.clone()))) | |
| 2389 | + .when(!dark, |d| { | |
| 2390 | + d.child( | |
| 2391 | + div() | |
| 2392 | + .flex_none() | |
| 2393 | + .px(px(6.)) | |
| 2394 | + .text_size(px(11.)) | |
| 2395 | + .text_color(rgb(FG_SECONDARY())) | |
| 2396 | + // What the choice *is*: the limiter's own line, | |
| 2397 | + // because "on" alone says nothing about what it | |
| 2398 | + // does to a mix that never reaches the ceiling. | |
| 2399 | + .child(tail_text), | |
| 2400 | + ) | |
| 2401 | + }), | |
| 2153 | 2402 | ), |
| 2154 | 2403 | ) |
| 2155 | 2404 | } |
crates/app/src/ui/library.rsmodified+38 -10
| @@ -2,6 +2,8 @@ | ||
| 2 | 2 | |
| 3 | 3 | use crate::*; |
| 4 | 4 | use crate::ui::widgets::*; |
| 5 | +use crate::ui::type_scale::Typeset; | |
| 6 | +use crate::ui::stance::below_picture_floor; | |
| 5 | 7 | |
| 6 | 8 | impl Player { |
| 7 | 9 | /// The media library: a row per source the timeline knows, in the order |
| @@ -551,7 +553,11 @@ impl Player { | ||
| 551 | 553 | ) -> Option<impl IntoElement> { |
| 552 | 554 | let menu = self.library_menu.clone()?; |
| 553 | 555 | let path = menu.path.clone(); |
| 554 | - let row = |n: usize| { | |
| 556 | + // DESIGN §9: the same plate row treatment `Player::context_card` | |
| 557 | + // draws with -- one function, so a copy-paste sibling menu cannot | |
| 558 | + // drift from it (darkroom only; `OLD_GUI=1` is unchanged). | |
| 559 | + let darkroom = self.darkroom; | |
| 560 | + let row = move |n: usize| { | |
| 555 | 561 | div() |
| 556 | 562 | .id(("library-menu", n)) |
| 557 | 563 | .flex() |
| @@ -561,6 +567,22 @@ impl Player { | ||
| 561 | 567 | .gap(px(12.)) |
| 562 | 568 | .px(px(6.)) |
| 563 | 569 | .rounded(px(3.)) |
| 570 | + .when(darkroom, |d| { | |
| 571 | + d.type_style(crate::ui::type_scale::label( | |
| 572 | + crate::ui::type_scale::LABEL_ROW_PX, | |
| 573 | + gpui::FontWeight::MEDIUM, | |
| 574 | + )) | |
| 575 | + .text_color(rgb(INK2())) | |
| 576 | + }) | |
| 577 | + }; | |
| 578 | + let chord_style = |d: Div| -> Div { | |
| 579 | + d.when(darkroom, |d| { | |
| 580 | + d.type_style(crate::ui::type_scale::mono( | |
| 581 | + crate::ui::type_scale::CHORD_METADATA_MIN_PX, | |
| 582 | + gpui::FontWeight::MEDIUM, | |
| 583 | + )) | |
| 584 | + .text_color(rgb(INK3())) | |
| 585 | + }) | |
| 564 | 586 | }; |
| 565 | 587 | let mut rows: Vec<AnyElement> = Vec::new(); |
| 566 | 588 | // What every item of this menu is answered from, read once. |
| @@ -618,14 +640,14 @@ impl Player { | ||
| 618 | 640 | rows.push( |
| 619 | 641 | row(rows.len()) |
| 620 | 642 | .child(label) |
| 621 | - .child( | |
| 643 | + .child(chord_style( | |
| 622 | 644 | div() |
| 623 | 645 | .min_w(px(0.)) |
| 624 | 646 | .truncate() |
| 625 | 647 | .text_size(px(11.)) |
| 626 | - .text_color(rgb(FG_SECONDARY())) | |
| 627 | - .child(value), | |
| 648 | + .text_color(rgb(FG_SECONDARY())), | |
| 628 | 649 | ) |
| 650 | + .child(value)) | |
| 629 | 651 | .into_any_element(), |
| 630 | 652 | ); |
| 631 | 653 | } |
| @@ -641,11 +663,13 @@ impl Player { | ||
| 641 | 663 | row(rows.len()) |
| 642 | 664 | .child(item.label()) |
| 643 | 665 | .child( |
| 644 | - div() | |
| 645 | - .min_w(px(0.)) | |
| 646 | - .truncate() | |
| 647 | - .text_color(rgb(FG_SECONDARY())) | |
| 648 | - .child(refusal.why().unwrap_or_else(|| item.hint())), | |
| 666 | + chord_style( | |
| 667 | + div() | |
| 668 | + .min_w(px(0.)) | |
| 669 | + .truncate() | |
| 670 | + .text_color(rgb(FG_SECONDARY())), | |
| 671 | + ) | |
| 672 | + .child(refusal.why().unwrap_or_else(|| item.hint())), | |
| 649 | 673 | ) |
| 650 | 674 | .when(!enabled, |d| d.opacity(0.4).cursor_not_allowed()) |
| 651 | 675 | .when(enabled, |d| { |
| @@ -662,7 +686,11 @@ impl Player { | ||
| 662 | 686 | // Placed by the height it is drawn to, and drawn to what the window has |
| 663 | 687 | // room for -- the clip menu's rule, one function for all three. |
| 664 | 688 | let list_h = menu_rows_h(rows.len(), viewport); |
| 665 | - let (x, y) = menu_at(menu.at, viewport, MENU_PAD * 2. + list_h); | |
| 689 | + let mut at = menu.at; | |
| 690 | + if darkroom { | |
| 691 | + at.y = px(f32::from(at.y).max(below_picture_floor(f32::from(viewport.height)))); | |
| 692 | + } | |
| 693 | + let (x, y) = menu_at(at, viewport, MENU_PAD * 2. + list_h); | |
| 666 | 694 | let full: SharedString = path.display().to_string().into(); |
| 667 | 695 | Some( |
| 668 | 696 | scrim() |
crates/app/src/ui/overlays.rsmodified+74 -16
| @@ -2,6 +2,8 @@ | ||
| 2 | 2 | |
| 3 | 3 | use crate::*; |
| 4 | 4 | use crate::ui::widgets::*; |
| 5 | +use crate::ui::stance::below_picture_floor; | |
| 6 | +use crate::ui::type_scale::{self, Typeset}; | |
| 5 | 7 | |
| 6 | 8 | impl Player { |
| 7 | 9 | /// The running import holds its own bar above the notice's, for the notice |
| @@ -478,7 +480,13 @@ impl Player { | ||
| 478 | 480 | let clip = session.lane_clips(menu.lane).get(menu.idx).copied(); |
| 479 | 481 | let source = clip.and_then(|clip| session.sources().get(clip.source).cloned()); |
| 480 | 482 | let secs = |frames: u32| timecode(f64::from(frames) / self.fps, self.fps); |
| 481 | - let row = |n: usize| { | |
| 483 | + // DESIGN §9/§3: a menu row is a plate row, Archivo at the room's | |
| 484 | + // 10.5px row size -- `ink2`, dimmed to `ink3` on the disabled ones | |
| 485 | + // below by the same `.opacity` every row already carried. Gated on | |
| 486 | + // `self.darkroom` so `OLD_GUI=1` keeps its own unstyled rows exactly | |
| 487 | + // as they draw today. | |
| 488 | + let darkroom = self.darkroom; | |
| 489 | + let row = move |n: usize| { | |
| 482 | 490 | div() |
| 483 | 491 | .id(("menu", n)) |
| 484 | 492 | .flex() |
| @@ -490,6 +498,26 @@ impl Player { | ||
| 490 | 498 | .gap(px(12.)) |
| 491 | 499 | .px(px(6.)) |
| 492 | 500 | .rounded(px(3.)) |
| 501 | + .when(darkroom, |d| { | |
| 502 | + d.type_style(type_scale::label( | |
| 503 | + type_scale::LABEL_ROW_PX, | |
| 504 | + gpui::FontWeight::MEDIUM, | |
| 505 | + )) | |
| 506 | + .text_color(rgb(INK2())) | |
| 507 | + }) | |
| 508 | + }; | |
| 509 | + // The chord/metadata half of a row: mono, `ink3`, DESIGN §3's | |
| 510 | + // 9.5-10px band -- every value that is data about the film rather | |
| 511 | + // than a room verb goes through this rather than the row's ambient | |
| 512 | + // Archivo. | |
| 513 | + let chord_style = |d: Div| -> Div { | |
| 514 | + d.when(darkroom, |d| { | |
| 515 | + d.type_style(type_scale::mono( | |
| 516 | + type_scale::CHORD_METADATA_MIN_PX, | |
| 517 | + gpui::FontWeight::MEDIUM, | |
| 518 | + )) | |
| 519 | + .text_color(rgb(INK3())) | |
| 520 | + }) | |
| 493 | 521 | }; |
| 494 | 522 | let mut rows: Vec<AnyElement> = Vec::new(); |
| 495 | 523 | if let (true, Some((clip, source))) = (menu.details, clip.zip(source.clone())) { |
| @@ -520,7 +548,7 @@ impl Player { | ||
| 520 | 548 | rows.push( |
| 521 | 549 | row(rows.len()) |
| 522 | 550 | .child(label) |
| 523 | - .child( | |
| 551 | + .child(chord_style( | |
| 524 | 552 | div() |
| 525 | 553 | .min_w(px(0.)) |
| 526 | 554 | .truncate() |
| @@ -528,9 +556,9 @@ impl Player { | ||
| 528 | 556 | // pair is 25 characters and has to fit beside |
| 529 | 557 | // its label inside `MENU_W`. |
| 530 | 558 | .text_size(px(11.)) |
| 531 | - .text_color(rgb(FG_SECONDARY())) | |
| 532 | - .child(value), | |
| 559 | + .text_color(rgb(FG_SECONDARY())), | |
| 533 | 560 | ) |
| 561 | + .child(value)) | |
| 534 | 562 | .into_any_element(), |
| 535 | 563 | ); |
| 536 | 564 | } |
| @@ -570,15 +598,18 @@ impl Player { | ||
| 570 | 598 | // One truncated line, like the details side: a |
| 571 | 599 | // reason that wrapped would make the card taller |
| 572 | 600 | // than the height `menu_at` placed it by. |
| 573 | - Some(why) => div() | |
| 574 | - .min_w(px(0.)) | |
| 575 | - .truncate() | |
| 576 | - .text_size(px(11.)) | |
| 577 | - .text_color(rgb(FG_SECONDARY())) | |
| 578 | - .child(why), | |
| 579 | - None => div() | |
| 580 | - .flex_shrink_0() | |
| 581 | - .text_color(rgb(FG_SECONDARY())) | |
| 601 | + Some(why) => chord_style( | |
| 602 | + div() | |
| 603 | + .min_w(px(0.)) | |
| 604 | + .truncate() | |
| 605 | + .text_size(px(11.)) | |
| 606 | + .text_color(rgb(FG_SECONDARY())), | |
| 607 | + ) | |
| 608 | + .child(why), | |
| 609 | + // Every command wears its chord (DESIGN §4): mono, | |
| 610 | + // `ink3`, the same face the spine badges and the | |
| 611 | + // keys overlay already read theirs in. | |
| 612 | + None => chord_style(div().flex_shrink_0().text_color(rgb(FG_SECONDARY()))) | |
| 582 | 613 | .child(self.keymap.display(action)), |
| 583 | 614 | }) |
| 584 | 615 | .when(!enabled, |d| d.opacity(0.4).cursor_not_allowed()) |
| @@ -624,7 +655,7 @@ impl Player { | ||
| 624 | 655 | .child("Properties") |
| 625 | 656 | // No stroke reaches this one, and a blank column would read |
| 626 | 657 | // as one that was forgotten. |
| 627 | - .child(div().text_color(rgb(FG_SECONDARY())).child("…")) | |
| 658 | + .child(chord_style(div().text_color(rgb(FG_SECONDARY()))).child("…")) | |
| 628 | 659 | .into_any_element() |
| 629 | 660 | })); |
| 630 | 661 | } |
| @@ -632,7 +663,16 @@ impl Player { | ||
| 632 | 663 | // to are one number: placed by a taller one, the card would hang off the |
| 633 | 664 | // window's floor -- the very thing the clamp is for. |
| 634 | 665 | let list_h = menu_rows_h(rows.len(), viewport); |
| 635 | - let (x, y) = menu_at(menu.at, viewport, MENU_PAD * 2. + list_h); | |
| 666 | + // §5/§11 check 6: the picture is never covered. A right-click high on | |
| 667 | + // the window would otherwise hang the menu at the pointer, straight | |
| 668 | + // over the screen -- clamped below it into the bench/ledger/dock | |
| 669 | + // footprint instead, darkroom only (the legacy tree has no such | |
| 670 | + // fixed split to clamp against). | |
| 671 | + let mut at = menu.at; | |
| 672 | + if self.darkroom { | |
| 673 | + at.y = px(f32::from(at.y).max(below_picture_floor(f32::from(viewport.height)))); | |
| 674 | + } | |
| 675 | + let (x, y) = menu_at(at, viewport, MENU_PAD * 2. + list_h); | |
| 636 | 676 | let full: SharedString = source |
| 637 | 677 | .map(|source| source.path.display().to_string()) |
| 638 | 678 | .unwrap_or_default() |
| @@ -716,6 +756,7 @@ impl Player { | ||
| 716 | 756 | cx: &mut Context<Self>, |
| 717 | 757 | ) -> Option<impl IntoElement> { |
| 718 | 758 | let picker = self.picker?; |
| 759 | + let darkroom = self.darkroom; | |
| 719 | 760 | let rows: Vec<AnyElement> = self |
| 720 | 761 | .choices(picker.of) |
| 721 | 762 | .into_iter() |
| @@ -733,6 +774,13 @@ impl Player { | ||
| 733 | 774 | .gap(px(12.)) |
| 734 | 775 | .px(px(6.)) |
| 735 | 776 | .rounded(px(3.)) |
| 777 | + .when(darkroom, |d| { | |
| 778 | + d.type_style(type_scale::label( | |
| 779 | + type_scale::LABEL_ROW_PX, | |
| 780 | + gpui::FontWeight::MEDIUM, | |
| 781 | + )) | |
| 782 | + .text_color(rgb(INK2())) | |
| 783 | + }) | |
| 736 | 784 | .cursor_pointer() |
| 737 | 785 | .hover(|s| s.bg(rgb(BG_HOVER()))) |
| 738 | 786 | // The mark is a glyph as well as a highlight, like the |
| @@ -768,6 +816,12 @@ impl Player { | ||
| 768 | 816 | true => FG_PRIMARY(), |
| 769 | 817 | false => FG_SECONDARY(), |
| 770 | 818 | })) |
| 819 | + .when(darkroom, |d| { | |
| 820 | + d.type_style(type_scale::mono( | |
| 821 | + type_scale::CHORD_METADATA_MIN_PX, | |
| 822 | + gpui::FontWeight::MEDIUM, | |
| 823 | + )) | |
| 824 | + }) | |
| 771 | 825 | .child(detail), |
| 772 | 826 | ) |
| 773 | 827 | .on_click( |
| @@ -779,7 +833,11 @@ impl Player { | ||
| 779 | 833 | // The window's own room, and the list scrolls only where the window has |
| 780 | 834 | // none -- the clip menu's rule, one function for both. |
| 781 | 835 | let list_h = menu_rows_h(rows.len(), viewport); |
| 782 | - let (x, y) = menu_at(picker.at, viewport, MENU_PAD * 2. + list_h); | |
| 836 | + let mut at = picker.at; | |
| 837 | + if darkroom { | |
| 838 | + at.y = px(f32::from(at.y).max(below_picture_floor(f32::from(viewport.height)))); | |
| 839 | + } | |
| 840 | + let (x, y) = menu_at(at, viewport, MENU_PAD * 2. + list_h); | |
| 783 | 841 | Some( |
| 784 | 842 | scrim() |
| 785 | 843 | // Click away closes it, either button, swallowed so nothing |
crates/app/src/ui/stance.rsmodified+11 -0
| @@ -31,6 +31,17 @@ const LEDGER_H: f32 = 28.; | ||
| 31 | 31 | /// Right side panel, fixed width, carrying the Src/Clip tab pair. |
| 32 | 32 | const DOCK_W: f32 = 280.; |
| 33 | 33 | |
| 34 | +/// The lowest a menu's top edge may sit and still land inside the | |
| 35 | +/// bench/ledger/dock footprint below the screen (DESIGN §5, §9, §11 check 6): | |
| 36 | +/// a right-click near the top of the window must not walk the menu up over | |
| 37 | +/// the picture just because the pointer is there. `overlays.rs`/`library.rs` | |
| 38 | +/// clamp their `menu.at.y` against this before handing it to `menu_at`, only | |
| 39 | +/// in the darkroom stance -- the legacy tree has no fixed screen/time-band | |
| 40 | +/// split for this to mean anything against, and must not move. | |
| 41 | +pub(crate) fn below_picture_floor(viewport_h: f32) -> f32 { | |
| 42 | + (viewport_h - TIME_BAND_H - BENCH_H - LEDGER_H).max(0.) | |
| 43 | +} | |
| 44 | + | |
| 34 | 45 | thread_local! { |
| 35 | 46 | // FAULT 3: the picture region's own laid-out box, measured each frame by |
| 36 | 47 | // a [`bounds_probe`] the same shape `timeband_stance`'s contact strip |