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 | use crate::ui::type_scale::{self, Typeset}; | 4 | use crate::ui::type_scale::{self, Typeset}; |
| 5 | use crate::ui::widgets::*; | 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 | impl Player { | 134 | impl Player { |
| 8 | /// What an export is going to be, before there is one: the codec, the box | 135 | /// What an export is going to be, before there is one: the codec, the box |
| 9 | /// it goes into, the bitrate, where it lands -- and, above the button, the | 136 | /// it goes into, the bitrate, where it lands -- and, above the button, the |
| @@ -1555,6 +1682,7 @@ impl Player { | |||
| 1555 | pub(crate) fn color_card(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> { | 1682 | pub(crate) fn color_card(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> { |
| 1556 | let (lane, idx) = self.color_open?; | 1683 | let (lane, idx) = self.color_open?; |
| 1557 | let params = self.color_params(); | 1684 | let params = self.color_params(); |
| 1685 | + let dark = self.darkroom; | ||
| 1558 | let rows: Vec<_> = COLOR_BANDS | 1686 | let rows: Vec<_> = COLOR_BANDS |
| 1559 | .iter() | 1687 | .iter() |
| 1560 | .enumerate() | 1688 | .enumerate() |
| @@ -1572,13 +1700,24 @@ impl Player { | |||
| 1572 | .px(px(6.)) | 1700 | .px(px(6.)) |
| 1573 | .rounded(px(3.)) | 1701 | .rounded(px(3.)) |
| 1574 | .cursor_pointer() | 1702 | .cursor_pointer() |
| 1575 | - .when(picked, |d| d.bg(rgb(BG_SELECTED()))) | 1703 | + // Darkroom: no permanent pill under a label -- the picked |
| 1576 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | 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 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | 1709 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 1578 | this.color_band = i; | 1710 | this.color_band = i; |
| 1579 | cx.notify(); | 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 | .child( | 1721 | .child( |
| 1583 | // The bar is 4 px to look at and a whole row to hit | 1722 | // The bar is 4 px to look at and a whole row to hit |
| 1584 | // (WCAG 2.5.8), the same split the ruler makes between | 1723 | // (WCAG 2.5.8), the same split the ruler makes between |
| @@ -1608,7 +1747,7 @@ impl Player { | |||
| 1608 | .w_full() | 1747 | .w_full() |
| 1609 | .h(px(4.)) | 1748 | .h(px(4.)) |
| 1610 | .rounded(px(2.)) | 1749 | .rounded(px(2.)) |
| 1611 | - .bg(rgb(BG_PANEL())) | 1750 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_PANEL() })) |
| 1612 | .child( | 1751 | .child( |
| 1613 | div() | 1752 | div() |
| 1614 | .h_full() | 1753 | .h_full() |
| @@ -1621,12 +1760,18 @@ impl Player { | |||
| 1621 | .child( | 1760 | .child( |
| 1622 | div() | 1761 | div() |
| 1623 | .w(px(44.)) | 1762 | .w(px(44.)) |
| 1624 | - .text_size(px(11.)) | 1763 | + .when(dark, |d| d.child(dark_row_value(format!("{value:.2}")))) |
| 1625 | - .text_color(rgb(FG_SECONDARY())) | 1764 | + .when(!dark, |d| { |
| 1626 | - .child(format!("{value:.2}")), | 1765 | + d.text_size(px(11.)) |
| 1766 | + .text_color(rgb(FG_SECONDARY())) | ||
| 1767 | + .child(format!("{value:.2}")) | ||
| 1768 | + }), | ||
| 1627 | ) | 1769 | ) |
| 1628 | }) | 1770 | }) |
| 1629 | .collect(); | 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 | Some( | 1775 | Some( |
| 1631 | drag_scrim(cx) | 1776 | drag_scrim(cx) |
| 1632 | .flex() | 1777 | .flex() |
| @@ -1652,22 +1797,27 @@ impl Player { | |||
| 1652 | .gap(px(2.)) | 1797 | .gap(px(2.)) |
| 1653 | .p(px(12.)) | 1798 | .p(px(12.)) |
| 1654 | .rounded(px(6.)) | 1799 | .rounded(px(6.)) |
| 1655 | - .bg(rgb(BG_RAISED())) | 1800 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) |
| 1656 | - .child(div().flex_none().px(px(6.)).child(format!( | 1801 | + .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) |
| 1657 | - "Colour — {} clip {}", | 1802 | + .when(dark, |d| d.child(dark_card_head("Colour", Some(head_meta.clone())))) |
| 1658 | - lane.label(), | 1803 | + .when(!dark, |d| { |
| 1659 | - idx + 1 | 1804 | + d.child(div().flex_none().px(px(6.)).child(format!( |
| 1660 | - ))) | 1805 | + "Colour — {} clip {}", |
| 1661 | - .child( | 1806 | + lane.label(), |
| 1662 | - div() | 1807 | + idx + 1 |
| 1663 | - .flex_none() | 1808 | + ))) |
| 1664 | - .px(px(6.)) | 1809 | + }) |
| 1665 | - .text_size(px(11.)) | 1810 | + .when(dark, |d| d.child(dark_help(help_text))) |
| 1666 | - .text_color(rgb(FG_SECONDARY())) | 1811 | + .when(!dark, |d| { |
| 1667 | - .child( | 1812 | + d.child( |
| 1668 | - "drag a bar, or ↑↓ picks one and ←→ moves it, r resets — a click away or esc closes", | 1813 | + div() |
| 1669 | - ), | 1814 | + .flex_none() |
| 1670 | - ) | 1815 | + .px(px(6.)) |
| 1816 | + .text_size(px(11.)) | ||
| 1817 | + .text_color(rgb(FG_SECONDARY())) | ||
| 1818 | + .child(help_text), | ||
| 1819 | + ) | ||
| 1820 | + }) | ||
| 1671 | // The frame as it is being graded, over the controls | 1821 | // The frame as it is being graded, over the controls |
| 1672 | // grading it: the three lines are what the picture is | 1822 | // grading it: the three lines are what the picture is |
| 1673 | // made of, and every sample of a drag reseeks, so they | 1823 | // made of, and every sample of a drag reseeks, so they |
| @@ -1677,28 +1827,41 @@ impl Player { | |||
| 1677 | .flex_none() | 1827 | .flex_none() |
| 1678 | .h(px(HIST_H)) | 1828 | .h(px(HIST_H)) |
| 1679 | .rounded(px(3.)) | 1829 | .rounded(px(3.)) |
| 1680 | - .bg(rgb(BG_HOVER_DIM())) | 1830 | + .bg(rgb(if dark { DARK_HAIRLINE() } else { BG_HOVER_DIM() })) |
| 1681 | .relative() | 1831 | .relative() |
| 1682 | .child(hist_curves(self.histogram)), | 1832 | .child(hist_curves(self.histogram)), |
| 1683 | ) | 1833 | ) |
| 1684 | .children(rows) | 1834 | .children(rows) |
| 1685 | - .child( | 1835 | + .when(dark, |d| { |
| 1686 | - div() | 1836 | + d.child(dark_ghost_button( |
| 1687 | - .id("color-reset") | 1837 | + "color-reset", |
| 1688 | - .mt(px(4.)) | 1838 | + "Reset", |
| 1689 | - .flex() | 1839 | + "r", |
| 1690 | - .h(px(CONTROL_H)) | 1840 | + false, |
| 1691 | - .items_center() | 1841 | + cx.listener(|this, _: &ClickEvent, _, cx| { |
| 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| { | ||
| 1698 | this.set_color(ColorParams::default(), cx); | 1842 | this.set_color(ColorParams::default(), cx); |
| 1699 | - })) | 1843 | + }), |
| 1700 | - .child("Reset"), | 1844 | + )) |
| 1701 | - ), | 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 | pub(crate) fn transform_card(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> { | 1872 | pub(crate) fn transform_card(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> { |
| 1710 | let (lane, idx) = self.transform_open?; | 1873 | let (lane, idx) = self.transform_open?; |
| 1711 | let params = self.transform_params(); | 1874 | let params = self.transform_params(); |
| 1875 | + let dark = self.darkroom; | ||
| 1712 | let rows: Vec<_> = TRANSFORM_BANDS | 1876 | let rows: Vec<_> = TRANSFORM_BANDS |
| 1713 | .iter() | 1877 | .iter() |
| 1714 | .enumerate() | 1878 | .enumerate() |
| @@ -1726,13 +1890,21 @@ impl Player { | |||
| 1726 | .px(px(6.)) | 1890 | .px(px(6.)) |
| 1727 | .rounded(px(3.)) | 1891 | .rounded(px(3.)) |
| 1728 | .cursor_pointer() | 1892 | .cursor_pointer() |
| 1729 | - .when(picked, |d| d.bg(rgb(BG_SELECTED()))) | 1893 | + .when(dark && picked, |d| d.border_l_2().border_color(rgb(INK1()))) |
| 1730 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | 1894 | + .when(!dark && picked, |d| d.bg(rgb(BG_SELECTED()))) |
| 1895 | + .hover(|s| s.bg(rgb(if dark { DARK_RAISED() } else { BG_HOVER() }))) | ||
| 1731 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | 1896 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 1732 | this.transform_band = i; | 1897 | this.transform_band = i; |
| 1733 | cx.notify(); | 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 | .child( | 1908 | .child( |
| 1737 | div() | 1909 | div() |
| 1738 | .id(("transform-bar", i)) | 1910 | .id(("transform-bar", i)) |
| @@ -1757,7 +1929,7 @@ impl Player { | |||
| 1757 | .w_full() | 1929 | .w_full() |
| 1758 | .h(px(4.)) | 1930 | .h(px(4.)) |
| 1759 | .rounded(px(2.)) | 1931 | .rounded(px(2.)) |
| 1760 | - .bg(rgb(BG_PANEL())) | 1932 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_PANEL() })) |
| 1761 | .child( | 1933 | .child( |
| 1762 | div() | 1934 | div() |
| 1763 | .h_full() | 1935 | .h_full() |
| @@ -1768,17 +1940,25 @@ impl Player { | |||
| 1768 | ), | 1940 | ), |
| 1769 | ) | 1941 | ) |
| 1770 | .child( | 1942 | .child( |
| 1771 | - div() | 1943 | + div().w(px(44.)).when(dark, |d| { |
| 1772 | - .w(px(44.)) | 1944 | + d.child(dark_row_value(match i == ROTATE_BAND { |
| 1773 | - .text_size(px(11.)) | ||
| 1774 | - .text_color(rgb(FG_SECONDARY())) | ||
| 1775 | - .child(match i == ROTATE_BAND { | ||
| 1776 | true => format!("{value:.0}°"), | 1945 | true => format!("{value:.0}°"), |
| 1777 | false => format!("{value:.2}"), | 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 | .collect(); | 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 | Some( | 1962 | Some( |
| 1783 | drag_scrim(cx) | 1963 | drag_scrim(cx) |
| 1784 | .flex() | 1964 | .flex() |
| @@ -1803,41 +1983,58 @@ impl Player { | |||
| 1803 | .gap(px(2.)) | 1983 | .gap(px(2.)) |
| 1804 | .p(px(12.)) | 1984 | .p(px(12.)) |
| 1805 | .rounded(px(6.)) | 1985 | .rounded(px(6.)) |
| 1806 | - .bg(rgb(BG_RAISED())) | 1986 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) |
| 1807 | - .child(div().flex_none().px(px(6.)).child(format!( | 1987 | + .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) |
| 1808 | - "Transform — {} clip {}", | 1988 | + .when(dark, |d| d.child(dark_card_head("Transform", Some(head_meta.clone())))) |
| 1809 | - lane.label(), | 1989 | + .when(!dark, |d| { |
| 1810 | - idx + 1 | 1990 | + d.child(div().flex_none().px(px(6.)).child(format!( |
| 1811 | - ))) | 1991 | + "Transform — {} clip {}", |
| 1812 | - .child( | 1992 | + lane.label(), |
| 1813 | - div() | 1993 | + idx + 1 |
| 1814 | - .flex_none() | 1994 | + ))) |
| 1815 | - .px(px(6.)) | 1995 | + }) |
| 1816 | - .text_size(px(11.)) | 1996 | + .when(dark, |d| d.child(dark_help(help_text))) |
| 1817 | - .text_color(rgb(FG_SECONDARY())) | 1997 | + .when(!dark, |d| { |
| 1818 | - .child( | 1998 | + d.child( |
| 1819 | - "drag a bar, or ↑↓ picks one and ←→ moves it (rotation steps \ | 1999 | + div() |
| 1820 | - by 90°), r resets — a click away or esc closes", | 2000 | + .flex_none() |
| 1821 | - ), | 2001 | + .px(px(6.)) |
| 1822 | - ) | 2002 | + .text_size(px(11.)) |
| 2003 | + .text_color(rgb(FG_SECONDARY())) | ||
| 2004 | + .child(help_text), | ||
| 2005 | + ) | ||
| 2006 | + }) | ||
| 1823 | .children(rows) | 2007 | .children(rows) |
| 1824 | - .child( | 2008 | + .when(dark, |d| { |
| 1825 | - div() | 2009 | + d.child(dark_ghost_button( |
| 1826 | - .id("transform-reset") | 2010 | + "transform-reset", |
| 1827 | - .mt(px(4.)) | 2011 | + "Reset", |
| 1828 | - .flex() | 2012 | + "r", |
| 1829 | - .h(px(CONTROL_H)) | 2013 | + false, |
| 1830 | - .items_center() | 2014 | + cx.listener(|this, _: &ClickEvent, _, cx| { |
| 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| { | ||
| 1837 | this.set_transform(TransformParams::default(), cx); | 2015 | this.set_transform(TransformParams::default(), cx); |
| 1838 | - })) | 2016 | + }), |
| 1839 | - .child("Reset"), | 2017 | + )) |
| 1840 | - ), | 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 | let speed = self.card_speed(); | 2053 | let speed = self.card_speed(); |
| 1857 | let session = self.session.as_ref()?; | 2054 | let session = self.session.as_ref()?; |
| 1858 | let clip = session.lane_clips(lane).get(idx).copied()?; | 2055 | let clip = session.lane_clips(lane).get(idx).copied()?; |
| 2056 | + let dark = self.darkroom; | ||
| 1859 | let lo = f32::from(Speed::MIN.permille()); | 2057 | let lo = f32::from(Speed::MIN.permille()); |
| 1860 | let hi = f32::from(Speed::MAX.permille()); | 2058 | let hi = f32::from(Speed::MAX.permille()); |
| 1861 | let frac = ((f32::from(speed.permille()) - lo) / (hi - lo)).clamp(0., 1.); | 2059 | let frac = ((f32::from(speed.permille()) - lo) / (hi - lo)).clamp(0., 1.); |
| @@ -1863,6 +2061,7 @@ impl Player { | |||
| 1863 | .into_iter() | 2061 | .into_iter() |
| 1864 | .map(|permille| { | 2062 | .map(|permille| { |
| 1865 | let at = Speed::from_permille(permille); | 2063 | let at = Speed::from_permille(permille); |
| 2064 | + let picked = at == speed; | ||
| 1866 | div() | 2065 | div() |
| 1867 | .id(("speed-preset", usize::from(permille))) | 2066 | .id(("speed-preset", usize::from(permille))) |
| 1868 | .flex_1() | 2067 | .flex_1() |
| @@ -1871,18 +2070,32 @@ impl Player { | |||
| 1871 | .items_center() | 2070 | .items_center() |
| 1872 | .justify_center() | 2071 | .justify_center() |
| 1873 | .rounded(px(3.)) | 2072 | .rounded(px(3.)) |
| 1874 | - .bg(rgb(match at == speed { | 2073 | + .when(dark && picked, |d| d.bg(rgb(DARK_RAISED()))) |
| 1875 | - true => BG_SELECTED(), | 2074 | + .when(!dark, |d| { |
| 1876 | - false => BG_PANEL(), | 2075 | + d.bg(rgb(match picked { |
| 1877 | - })) | 2076 | + true => BG_SELECTED(), |
| 2077 | + false => BG_PANEL(), | ||
| 2078 | + })) | ||
| 2079 | + }) | ||
| 1878 | .cursor_pointer() | 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 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | 2082 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 1881 | this.set_speed(at, cx); | 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 | .collect(); | 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 | Some( | 2099 | Some( |
| 1887 | drag_scrim(cx) | 2100 | drag_scrim(cx) |
| 1888 | .flex() | 2101 | .flex() |
| @@ -1908,22 +2121,27 @@ impl Player { | |||
| 1908 | .gap(px(6.)) | 2121 | .gap(px(6.)) |
| 1909 | .p(px(12.)) | 2122 | .p(px(12.)) |
| 1910 | .rounded(px(6.)) | 2123 | .rounded(px(6.)) |
| 1911 | - .bg(rgb(BG_RAISED())) | 2124 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) |
| 1912 | - .child(div().flex_none().px(px(6.)).child(format!( | 2125 | + .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) |
| 1913 | - "Speed (tape) — {} clip {}", | 2126 | + .when(dark, |d| d.child(dark_card_head("Speed (tape)", Some(head_meta.clone())))) |
| 1914 | - lane.label(), | 2127 | + .when(!dark, |d| { |
| 1915 | - idx + 1 | 2128 | + d.child(div().flex_none().px(px(6.)).child(format!( |
| 1916 | - ))) | 2129 | + "Speed (tape) — {} clip {}", |
| 1917 | - .child( | 2130 | + lane.label(), |
| 1918 | - div() | 2131 | + idx + 1 |
| 1919 | - .flex_none() | 2132 | + ))) |
| 1920 | - .px(px(6.)) | 2133 | + }) |
| 1921 | - .text_size(px(11.)) | 2134 | + .when(dark, |d| d.child(dark_help(help_text))) |
| 1922 | - .text_color(rgb(FG_SECONDARY())) | 2135 | + .when(!dark, |d| { |
| 1923 | - .child( | 2136 | + d.child( |
| 1924 | - "drag the bar or ←→ moves it, r is 1.00x — the pitch moves with the rate; a click away or esc closes", | 2137 | + div() |
| 1925 | - ), | 2138 | + .flex_none() |
| 1926 | - ) | 2139 | + .px(px(6.)) |
| 2140 | + .text_size(px(11.)) | ||
| 2141 | + .text_color(rgb(FG_SECONDARY())) | ||
| 2142 | + .child(help_text), | ||
| 2143 | + ) | ||
| 2144 | + }) | ||
| 1927 | .child( | 2145 | .child( |
| 1928 | // 4 px to look at and a whole row to hit (WCAG | 2146 | // 4 px to look at and a whole row to hit (WCAG |
| 1929 | // 2.5.8), the split the colour sliders and the ruler | 2147 | // 2.5.8), the split the colour sliders and the ruler |
| @@ -1949,7 +2167,7 @@ impl Player { | |||
| 1949 | .w_full() | 2167 | .w_full() |
| 1950 | .h(px(4.)) | 2168 | .h(px(4.)) |
| 1951 | .rounded(px(2.)) | 2169 | .rounded(px(2.)) |
| 1952 | - .bg(rgb(BG_PANEL())) | 2170 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_PANEL() })) |
| 1953 | .child( | 2171 | .child( |
| 1954 | div() | 2172 | div() |
| 1955 | .h_full() | 2173 | .h_full() |
| @@ -1960,22 +2178,20 @@ impl Player { | |||
| 1960 | ), | 2178 | ), |
| 1961 | ) | 2179 | ) |
| 1962 | .child(div().flex().gap(px(4.)).children(presets)) | 2180 | .child(div().flex().gap(px(4.)).children(presets)) |
| 1963 | - .child( | 2181 | + .when(dark, |d| d.child(dark_help(tail_text.clone()))) |
| 1964 | - div() | 2182 | + .when(!dark, |d| { |
| 1965 | - .flex_none() | 2183 | + d.child( |
| 1966 | - .px(px(6.)) | 2184 | + div() |
| 1967 | - .text_size(px(11.)) | 2185 | + .flex_none() |
| 1968 | - .text_color(rgb(FG_SECONDARY())) | 2186 | + .px(px(6.)) |
| 1969 | - // What the choice *is*, in the numbers the | 2187 | + .text_size(px(11.)) |
| 1970 | - // timeline is measured in: the source range | 2188 | + .text_color(rgb(FG_SECONDARY())) |
| 1971 | - // never moves, the room it takes does. | 2189 | + // What the choice *is*, in the numbers the |
| 1972 | - .child(format!( | 2190 | + // timeline is measured in: the source range |
| 1973 | - "{speed} — {} source frames over {} on the timeline ({})", | 2191 | + // never moves, the room it takes does. |
| 1974 | - clip.len(), | 2192 | + .child(tail_text), |
| 1975 | - clip.frames(), | 2193 | + ) |
| 1976 | - frames_timecode(clip.frames(), self.fps) | 2194 | + }), |
| 1977 | - )), | ||
| 1978 | - ), | ||
| 1979 | ), | 2195 | ), |
| 1980 | ) | 2196 | ) |
| 1981 | } | 2197 | } |
| @@ -2000,6 +2216,7 @@ impl Player { | |||
| 2000 | if !self.mix_open { | 2216 | if !self.mix_open { |
| 2001 | return None; | 2217 | return None; |
| 2002 | } | 2218 | } |
| 2219 | + let dark = self.darkroom; | ||
| 2003 | let session = self.session.as_ref(); | 2220 | let session = self.session.as_ref(); |
| 2004 | let lanes = self.mix_lanes(); | 2221 | let lanes = self.mix_lanes(); |
| 2005 | let limiter = session.map_or_else(Limiter::default, PlaybackSession::limiter); | 2222 | let limiter = session.map_or_else(Limiter::default, PlaybackSession::limiter); |
| @@ -2027,6 +2244,7 @@ impl Player { | |||
| 2027 | .into_iter() | 2244 | .into_iter() |
| 2028 | .enumerate() | 2245 | .enumerate() |
| 2029 | .map(|(n, (label, value))| { | 2246 | .map(|(n, (label, value))| { |
| 2247 | + let picked = n == self.mix_field; | ||
| 2030 | div() | 2248 | div() |
| 2031 | .id(("mix-row", n)) | 2249 | .id(("mix-row", n)) |
| 2032 | .flex() | 2250 | .flex() |
| @@ -2036,51 +2254,80 @@ impl Player { | |||
| 2036 | .justify_between() | 2254 | .justify_between() |
| 2037 | .px(px(6.)) | 2255 | .px(px(6.)) |
| 2038 | .rounded(px(3.)) | 2256 | .rounded(px(3.)) |
| 2039 | - .bg(rgb(match n == self.mix_field { | 2257 | + .when(dark && picked, |d| d.border_l_2().border_color(rgb(INK1()))) |
| 2040 | - true => BG_SELECTED(), | 2258 | + .when(!dark, |d| { |
| 2041 | - false => BG_PANEL(), | 2259 | + d.bg(rgb(match picked { |
| 2042 | - })) | 2260 | + true => BG_SELECTED(), |
| 2261 | + false => BG_PANEL(), | ||
| 2262 | + })) | ||
| 2263 | + }) | ||
| 2043 | .cursor_pointer() | 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 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | 2266 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 2046 | this.mix_field = n; | 2267 | this.mix_field = n; |
| 2047 | cx.notify(); | 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 | .child( | 2275 | .child( |
| 2051 | div() | 2276 | div() |
| 2052 | .flex() | 2277 | .flex() |
| 2053 | .items_center() | 2278 | .items_center() |
| 2054 | .gap(px(4.)) | 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 | .children([-1, 1].map(|steps: i32| { | 2282 | .children([-1, 1].map(|steps: i32| { |
| 2057 | - div() | 2283 | + let id = ("mix-step", n * 2 + usize::from(steps > 0)); |
| 2058 | - .id(("mix-step", n * 2 + usize::from(steps > 0))) | 2284 | + match dark { |
| 2059 | - .flex_none() | 2285 | + true => dark_step_glyph( |
| 2060 | - .w(px(HIT_MIN)) | 2286 | + id, |
| 2061 | - .h(px(KEYS_ROW_H)) | 2287 | + steps > 0, |
| 2062 | - .flex() | 2288 | + cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 2063 | - .items_center() | 2289 | + this.mix_field = n; |
| 2064 | - .justify_center() | 2290 | + this.nudge_mix(steps, cx); |
| 2065 | - .rounded(px(3.)) | 2291 | + }), |
| 2066 | - .bg(rgb(BG_PANEL())) | 2292 | + ) |
| 2067 | - .cursor_pointer() | 2293 | + .into_any_element(), |
| 2068 | - .hover(|s| s.bg(rgb(BG_HOVER()))) | 2294 | + false => div() |
| 2069 | - .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | 2295 | + .id(id) |
| 2070 | - // Picked as well as moved, the silence | 2296 | + .flex_none() |
| 2071 | - // card's rule: the row a press lands on | 2297 | + .w(px(HIT_MIN)) |
| 2072 | - // is the row the arrows carry on from. | 2298 | + .h(px(KEYS_ROW_H)) |
| 2073 | - this.mix_field = n; | 2299 | + .flex() |
| 2074 | - this.nudge_mix(steps, cx); | 2300 | + .items_center() |
| 2075 | - })) | 2301 | + .justify_center() |
| 2076 | - .child(match steps > 0 { | 2302 | + .rounded(px(3.)) |
| 2077 | - true => "+", | 2303 | + .bg(rgb(BG_PANEL())) |
| 2078 | - false => "−", | 2304 | + .cursor_pointer() |
| 2079 | - }) | 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 | .collect(); | 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 | Some( | 2331 | Some( |
| 2085 | scrim() | 2332 | scrim() |
| 2086 | .flex() | 2333 | .flex() |
| @@ -2107,23 +2354,28 @@ impl Player { | |||
| 2107 | .gap(px(6.)) | 2354 | .gap(px(6.)) |
| 2108 | .p(px(12.)) | 2355 | .p(px(12.)) |
| 2109 | .rounded(px(6.)) | 2356 | .rounded(px(6.)) |
| 2110 | - .bg(rgb(BG_RAISED())) | 2357 | + .bg(rgb(if dark { DARK_PANEL() } else { BG_RAISED() })) |
| 2111 | - .child( | 2358 | + .when(dark, |d| d.border_1().border_color(rgba(DARK_SEAM()))) |
| 2112 | - div() | 2359 | + .when(dark, |d| d.child(dark_card_head("Mix", None))) |
| 2113 | - .flex_none() | 2360 | + .when(!dark, |d| { |
| 2114 | - .px(px(6.)) | 2361 | + d.child( |
| 2115 | - .child("Mix — track volumes and the master limiter"), | 2362 | + div() |
| 2116 | - ) | 2363 | + .flex_none() |
| 2117 | - .child( | 2364 | + .px(px(6.)) |
| 2118 | - div() | 2365 | + .child("Mix — track volumes and the master limiter"), |
| 2119 | - .flex_none() | 2366 | + ) |
| 2120 | - .px(px(6.)) | 2367 | + }) |
| 2121 | - .text_size(px(11.)) | 2368 | + .when(dark, |d| d.child(dark_help(help_text))) |
| 2122 | - .text_color(rgb(FG_SECONDARY())) | 2369 | + .when(!dark, |d| { |
| 2123 | - .child( | 2370 | + d.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", | 2371 | + div() |
| 2125 | - ), | 2372 | + .flex_none() |
| 2126 | - ) | 2373 | + .px(px(6.)) |
| 2374 | + .text_size(px(11.)) | ||
| 2375 | + .text_color(rgb(FG_SECONDARY())) | ||
| 2376 | + .child(help_text), | ||
| 2377 | + ) | ||
| 2378 | + }) | ||
| 2127 | .child( | 2379 | .child( |
| 2128 | div() | 2380 | div() |
| 2129 | .id("mix-rows") | 2381 | .id("mix-rows") |
| @@ -2133,23 +2385,20 @@ impl Player { | |||
| 2133 | .overflow_y_scroll() | 2385 | .overflow_y_scroll() |
| 2134 | .children(rows), | 2386 | .children(rows), |
| 2135 | ) | 2387 | ) |
| 2136 | - .child( | 2388 | + .when(dark, |d| d.child(dark_help(tail_text.clone()))) |
| 2137 | - div() | 2389 | + .when(!dark, |d| { |
| 2138 | - .flex_none() | 2390 | + d.child( |
| 2139 | - .px(px(6.)) | 2391 | + div() |
| 2140 | - .text_size(px(11.)) | 2392 | + .flex_none() |
| 2141 | - .text_color(rgb(FG_SECONDARY())) | 2393 | + .px(px(6.)) |
| 2142 | - // What the choice *is*: the limiter's own line, | 2394 | + .text_size(px(11.)) |
| 2143 | - // because "on" alone says nothing about what it | 2395 | + .text_color(rgb(FG_SECONDARY())) |
| 2144 | - // does to a mix that never reaches the ceiling. | 2396 | + // What the choice *is*: the limiter's own line, |
| 2145 | - .child(match limiter.on { | 2397 | + // because "on" alone says nothing about what it |
| 2146 | - true => format!( | 2398 | + // does to a mix that never reaches the ceiling. |
| 2147 | - "the mix is held under {:+.0} dBFS — quieter passages are untouched", | 2399 | + .child(tail_text), |
| 2148 | - limiter.ceiling_db | 2400 | + ) |
| 2149 | - ), | 2401 | + }), |
| 2150 | - false => "the limiter is out of circuit — a hot mix clips at full scale".to_string(), | ||
| 2151 | - }), | ||
| 2152 | - ), | ||
| 2153 | ), | 2402 | ), |
| 2154 | ) | 2403 | ) |
| 2155 | } | 2404 | } |
crates/app/src/ui/library.rsmodified+38 -10
| @@ -2,6 +2,8 @@ | |||
| 2 | 2 | ||
| 3 | use crate::*; | 3 | use crate::*; |
| 4 | use crate::ui::widgets::*; | 4 | use crate::ui::widgets::*; |
| 5 | +use crate::ui::type_scale::Typeset; | ||
| 6 | +use crate::ui::stance::below_picture_floor; | ||
| 5 | 7 | ||
| 6 | impl Player { | 8 | impl Player { |
| 7 | /// The media library: a row per source the timeline knows, in the order | 9 | /// The media library: a row per source the timeline knows, in the order |
| @@ -551,7 +553,11 @@ impl Player { | |||
| 551 | ) -> Option<impl IntoElement> { | 553 | ) -> Option<impl IntoElement> { |
| 552 | let menu = self.library_menu.clone()?; | 554 | let menu = self.library_menu.clone()?; |
| 553 | let path = menu.path.clone(); | 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 | div() | 561 | div() |
| 556 | .id(("library-menu", n)) | 562 | .id(("library-menu", n)) |
| 557 | .flex() | 563 | .flex() |
| @@ -561,6 +567,22 @@ impl Player { | |||
| 561 | .gap(px(12.)) | 567 | .gap(px(12.)) |
| 562 | .px(px(6.)) | 568 | .px(px(6.)) |
| 563 | .rounded(px(3.)) | 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 | let mut rows: Vec<AnyElement> = Vec::new(); | 587 | let mut rows: Vec<AnyElement> = Vec::new(); |
| 566 | // What every item of this menu is answered from, read once. | 588 | // What every item of this menu is answered from, read once. |
| @@ -618,14 +640,14 @@ impl Player { | |||
| 618 | rows.push( | 640 | rows.push( |
| 619 | row(rows.len()) | 641 | row(rows.len()) |
| 620 | .child(label) | 642 | .child(label) |
| 621 | - .child( | 643 | + .child(chord_style( |
| 622 | div() | 644 | div() |
| 623 | .min_w(px(0.)) | 645 | .min_w(px(0.)) |
| 624 | .truncate() | 646 | .truncate() |
| 625 | .text_size(px(11.)) | 647 | .text_size(px(11.)) |
| 626 | - .text_color(rgb(FG_SECONDARY())) | 648 | + .text_color(rgb(FG_SECONDARY())), |
| 627 | - .child(value), | ||
| 628 | ) | 649 | ) |
| 650 | + .child(value)) | ||
| 629 | .into_any_element(), | 651 | .into_any_element(), |
| 630 | ); | 652 | ); |
| 631 | } | 653 | } |
| @@ -641,11 +663,13 @@ impl Player { | |||
| 641 | row(rows.len()) | 663 | row(rows.len()) |
| 642 | .child(item.label()) | 664 | .child(item.label()) |
| 643 | .child( | 665 | .child( |
| 644 | - div() | 666 | + chord_style( |
| 645 | - .min_w(px(0.)) | 667 | + div() |
| 646 | - .truncate() | 668 | + .min_w(px(0.)) |
| 647 | - .text_color(rgb(FG_SECONDARY())) | 669 | + .truncate() |
| 648 | - .child(refusal.why().unwrap_or_else(|| item.hint())), | 670 | + .text_color(rgb(FG_SECONDARY())), |
| 671 | + ) | ||
| 672 | + .child(refusal.why().unwrap_or_else(|| item.hint())), | ||
| 649 | ) | 673 | ) |
| 650 | .when(!enabled, |d| d.opacity(0.4).cursor_not_allowed()) | 674 | .when(!enabled, |d| d.opacity(0.4).cursor_not_allowed()) |
| 651 | .when(enabled, |d| { | 675 | .when(enabled, |d| { |
| @@ -662,7 +686,11 @@ impl Player { | |||
| 662 | // Placed by the height it is drawn to, and drawn to what the window has | 686 | // Placed by the height it is drawn to, and drawn to what the window has |
| 663 | // room for -- the clip menu's rule, one function for all three. | 687 | // room for -- the clip menu's rule, one function for all three. |
| 664 | let list_h = menu_rows_h(rows.len(), viewport); | 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 | let full: SharedString = path.display().to_string().into(); | 694 | let full: SharedString = path.display().to_string().into(); |
| 667 | Some( | 695 | Some( |
| 668 | scrim() | 696 | scrim() |
crates/app/src/ui/overlays.rsmodified+74 -16
| @@ -2,6 +2,8 @@ | |||
| 2 | 2 | ||
| 3 | use crate::*; | 3 | use crate::*; |
| 4 | use crate::ui::widgets::*; | 4 | use crate::ui::widgets::*; |
| 5 | +use crate::ui::stance::below_picture_floor; | ||
| 6 | +use crate::ui::type_scale::{self, Typeset}; | ||
| 5 | 7 | ||
| 6 | impl Player { | 8 | impl Player { |
| 7 | /// The running import holds its own bar above the notice's, for the notice | 9 | /// The running import holds its own bar above the notice's, for the notice |
| @@ -478,7 +480,13 @@ impl Player { | |||
| 478 | let clip = session.lane_clips(menu.lane).get(menu.idx).copied(); | 480 | let clip = session.lane_clips(menu.lane).get(menu.idx).copied(); |
| 479 | let source = clip.and_then(|clip| session.sources().get(clip.source).cloned()); | 481 | let source = clip.and_then(|clip| session.sources().get(clip.source).cloned()); |
| 480 | let secs = |frames: u32| timecode(f64::from(frames) / self.fps, self.fps); | 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 | div() | 490 | div() |
| 483 | .id(("menu", n)) | 491 | .id(("menu", n)) |
| 484 | .flex() | 492 | .flex() |
| @@ -490,6 +498,26 @@ impl Player { | |||
| 490 | .gap(px(12.)) | 498 | .gap(px(12.)) |
| 491 | .px(px(6.)) | 499 | .px(px(6.)) |
| 492 | .rounded(px(3.)) | 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 | let mut rows: Vec<AnyElement> = Vec::new(); | 522 | let mut rows: Vec<AnyElement> = Vec::new(); |
| 495 | if let (true, Some((clip, source))) = (menu.details, clip.zip(source.clone())) { | 523 | if let (true, Some((clip, source))) = (menu.details, clip.zip(source.clone())) { |
| @@ -520,7 +548,7 @@ impl Player { | |||
| 520 | rows.push( | 548 | rows.push( |
| 521 | row(rows.len()) | 549 | row(rows.len()) |
| 522 | .child(label) | 550 | .child(label) |
| 523 | - .child( | 551 | + .child(chord_style( |
| 524 | div() | 552 | div() |
| 525 | .min_w(px(0.)) | 553 | .min_w(px(0.)) |
| 526 | .truncate() | 554 | .truncate() |
| @@ -528,9 +556,9 @@ impl Player { | |||
| 528 | // pair is 25 characters and has to fit beside | 556 | // pair is 25 characters and has to fit beside |
| 529 | // its label inside `MENU_W`. | 557 | // its label inside `MENU_W`. |
| 530 | .text_size(px(11.)) | 558 | .text_size(px(11.)) |
| 531 | - .text_color(rgb(FG_SECONDARY())) | 559 | + .text_color(rgb(FG_SECONDARY())), |
| 532 | - .child(value), | ||
| 533 | ) | 560 | ) |
| 561 | + .child(value)) | ||
| 534 | .into_any_element(), | 562 | .into_any_element(), |
| 535 | ); | 563 | ); |
| 536 | } | 564 | } |
| @@ -570,15 +598,18 @@ impl Player { | |||
| 570 | // One truncated line, like the details side: a | 598 | // One truncated line, like the details side: a |
| 571 | // reason that wrapped would make the card taller | 599 | // reason that wrapped would make the card taller |
| 572 | // than the height `menu_at` placed it by. | 600 | // than the height `menu_at` placed it by. |
| 573 | - Some(why) => div() | 601 | + Some(why) => chord_style( |
| 574 | - .min_w(px(0.)) | 602 | + div() |
| 575 | - .truncate() | 603 | + .min_w(px(0.)) |
| 576 | - .text_size(px(11.)) | 604 | + .truncate() |
| 577 | - .text_color(rgb(FG_SECONDARY())) | 605 | + .text_size(px(11.)) |
| 578 | - .child(why), | 606 | + .text_color(rgb(FG_SECONDARY())), |
| 579 | - None => div() | 607 | + ) |
| 580 | - .flex_shrink_0() | 608 | + .child(why), |
| 581 | - .text_color(rgb(FG_SECONDARY())) | 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 | .child(self.keymap.display(action)), | 613 | .child(self.keymap.display(action)), |
| 583 | }) | 614 | }) |
| 584 | .when(!enabled, |d| d.opacity(0.4).cursor_not_allowed()) | 615 | .when(!enabled, |d| d.opacity(0.4).cursor_not_allowed()) |
| @@ -624,7 +655,7 @@ impl Player { | |||
| 624 | .child("Properties") | 655 | .child("Properties") |
| 625 | // No stroke reaches this one, and a blank column would read | 656 | // No stroke reaches this one, and a blank column would read |
| 626 | // as one that was forgotten. | 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 | .into_any_element() | 659 | .into_any_element() |
| 629 | })); | 660 | })); |
| 630 | } | 661 | } |
| @@ -632,7 +663,16 @@ impl Player { | |||
| 632 | // to are one number: placed by a taller one, the card would hang off the | 663 | // to are one number: placed by a taller one, the card would hang off the |
| 633 | // window's floor -- the very thing the clamp is for. | 664 | // window's floor -- the very thing the clamp is for. |
| 634 | let list_h = menu_rows_h(rows.len(), viewport); | 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 | let full: SharedString = source | 676 | let full: SharedString = source |
| 637 | .map(|source| source.path.display().to_string()) | 677 | .map(|source| source.path.display().to_string()) |
| 638 | .unwrap_or_default() | 678 | .unwrap_or_default() |
| @@ -716,6 +756,7 @@ impl Player { | |||
| 716 | cx: &mut Context<Self>, | 756 | cx: &mut Context<Self>, |
| 717 | ) -> Option<impl IntoElement> { | 757 | ) -> Option<impl IntoElement> { |
| 718 | let picker = self.picker?; | 758 | let picker = self.picker?; |
| 759 | + let darkroom = self.darkroom; | ||
| 719 | let rows: Vec<AnyElement> = self | 760 | let rows: Vec<AnyElement> = self |
| 720 | .choices(picker.of) | 761 | .choices(picker.of) |
| 721 | .into_iter() | 762 | .into_iter() |
| @@ -733,6 +774,13 @@ impl Player { | |||
| 733 | .gap(px(12.)) | 774 | .gap(px(12.)) |
| 734 | .px(px(6.)) | 775 | .px(px(6.)) |
| 735 | .rounded(px(3.)) | 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 | .cursor_pointer() | 784 | .cursor_pointer() |
| 737 | .hover(|s| s.bg(rgb(BG_HOVER()))) | 785 | .hover(|s| s.bg(rgb(BG_HOVER()))) |
| 738 | // The mark is a glyph as well as a highlight, like the | 786 | // The mark is a glyph as well as a highlight, like the |
| @@ -768,6 +816,12 @@ impl Player { | |||
| 768 | true => FG_PRIMARY(), | 816 | true => FG_PRIMARY(), |
| 769 | false => FG_SECONDARY(), | 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 | .child(detail), | 825 | .child(detail), |
| 772 | ) | 826 | ) |
| 773 | .on_click( | 827 | .on_click( |
| @@ -779,7 +833,11 @@ impl Player { | |||
| 779 | // The window's own room, and the list scrolls only where the window has | 833 | // The window's own room, and the list scrolls only where the window has |
| 780 | // none -- the clip menu's rule, one function for both. | 834 | // none -- the clip menu's rule, one function for both. |
| 781 | let list_h = menu_rows_h(rows.len(), viewport); | 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 | Some( | 841 | Some( |
| 784 | scrim() | 842 | scrim() |
| 785 | // Click away closes it, either button, swallowed so nothing | 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 | /// Right side panel, fixed width, carrying the Src/Clip tab pair. | 31 | /// Right side panel, fixed width, carrying the Src/Clip tab pair. |
| 32 | const DOCK_W: f32 = 280.; | 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 | thread_local! { | 45 | thread_local! { |
| 35 | // FAULT 3: the picture region's own laid-out box, measured each frame by | 46 | // FAULT 3: the picture region's own laid-out box, measured each frame by |
| 36 | // a [`bounds_probe`] the same shape `timeband_stance`'s contact strip | 47 | // a [`bounds_probe`] the same shape `timeband_stance`'s contact strip |