edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBff99ad6Tahinli6 days ago1055 commits
| 1 | //! The row atoms and helpers every property card shares: what a row's label, |
| 2 | //! value and step glyph paint in the darkroom (DESIGN §3/§4), and the card head. |
| 3 | |
| 4 | use crateredesign as r; |
| 5 | use cratehitmap; |
| 6 | use crate; |
| 7 | use crate; |
| 8 | use cratetokens; |
| 9 | use crate; |
| 10 | use crate*; |
| 11 | use crate::*; |
| 12 | |
| 13 | /// DESIGN §3/§4 atoms shared by every param/setting card below (colour, |
| 14 | /// transform, speed, EQ, silence, mix, subtitle style): what a row's label |
| 15 | /// and value paint in the darkroom, so the seven card bodies each pick |
| 16 | /// tokens rather than reimplement the same font/colour swap seven times. |
| 17 | /// |
| 18 | /// A row label is what the room says about the control -- Archivo, §3's |
| 19 | /// label-row size, `ink2` at rest / `ink1` picked (no permanent pill: the |
| 20 | /// picked state is a 1px `ink1` rule, §4's focus ring, not a fill). |
| 21 | pub |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | /// A transform row's value with its unit: degrees for rotation, `×` for |
| 29 | /// scale (a multiplier, not a fraction of the frame), percent for |
| 30 | /// position/crop (both are a fraction of the frame's own size) -- the bare |
| 31 | /// `{value:.2}` this used to print could not tell a percent from a |
| 32 | /// multiplier apart. |
| 33 | pub |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | /// A row's value -- what the film/the setting *says*, mono per §3. Ink1 once |
| 44 | /// it is changed from its default, ink3 while it sits there (DESIGN §9.1). |
| 45 | pub |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | /// A card's own head line: the verb in Archivo (§3 section-head casing) and, |
| 54 | /// where there is one, the clip it names in mono beside it -- "which clip" |
| 55 | /// is metadata about the footage, not the room's own voice. `help`, when |
| 56 | /// given, is the card's own how-to sentence -- it used to sit under the |
| 57 | /// head as a permanent line (a terminal-screen row of prose the user named |
| 58 | /// directly); now it rides a `?` glyph beside the head and only shows on |
| 59 | /// hover, the same hover-only convention [`dock_stance::ghost_verb`] |
| 60 | /// already uses for a verb's own description. |
| 61 | /// `maximize` is `None` for the one card this head builds that is not one of |
| 62 | /// the seven param cards (the export progress sheet): everything else passes |
| 63 | /// `Some(self.card_maximized)` and gets the affordance this session's |
| 64 | /// complaint asked for -- worn on the head (DESIGN.md:91's "chord is worn"), |
| 65 | /// so it never was a keyboard-only option (the repeated "some options are |
| 66 | /// only reachable via keyboard shortcut" complaint). A double-click anywhere |
| 67 | /// on the head does the same thing the glyph's click and the `m` chord do |
| 68 | /// ([`Player::toggle_maximize`]) -- mouse and key reach the same switch. |
| 69 | // `+ use<>` (edition 2024 precise capturing): without it, the elided |
| 70 | // lifetime on `cx` would be captured into the returned opaque type by |
| 71 | // default, so a hoisted `let head = true.then(|| dark_card_head(..., cx));` |
| 72 | // would keep `cx` borrowed until `head` is finally consumed -- fighting |
| 73 | // every other `cx.listener(...)` call built in between, which is exactly |
| 74 | // the E0500/E0501 chain this card's own hoist is here to avoid. |
| 75 | pub |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | + use<> |
| 82 | |
| 83 | |
| 84 | |
| 85 | /// [`dark_card_head`] with the `Reset all` slot (DESIGN §9.1): the button shows |
| 86 | /// only when the card hands it a `reset`, and presses it through the card. |
| 87 | pub |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | + use<> |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | /// A card's section header row: the section's `title` on the left (`section` |
| 136 | /// type, `ink2`), and on the right the `?` help (its sentence on hover) and |
| 137 | /// the `Reset all` ghost button. Each of the two is drawn only when given, and |
| 138 | /// the row is drawn only when there is something to put in it, so a card never |
| 139 | /// shows an empty bar with a lone `?`. `reset` is pressed through the card. |
| 140 | |
| 141 | pub |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | + use<> |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | /// A disclosure row ("More"): a chevron (right when closed, down when open) |
| 192 | /// and the label, one 28px click target; `ink2` at rest, `ink1` under the |
| 193 | /// pointer. `on_toggle` flips the card's own open flag. The chevron is the |
| 194 | /// Lucide icon, never a text glyph. |
| 195 | |
| 196 | pub |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | |
| 209 | |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 | |
| 218 | |
| 219 | |
| 220 | |
| 221 | |
| 222 | |
| 223 | |
| 224 | /// Gap between a card's head, rows and sections: one for every card. |
| 225 | pub const CARD_GAP: f32 = 6.; |
| 226 | |
| 227 | |
| 228 | |
| 229 | |
| 230 | |
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | |
| 240 | |
| 241 | |
| 242 | |
| 243 | |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | |
| 250 | |
| 251 | |
| 252 | |
| 253 | |
| 254 | |
| 255 | |
| 256 | |
| 257 | |
| 258 | |
| 259 | |
| 260 | |
| 261 | |
| 262 | |
| 263 | |
| 264 | |
| 265 | |
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | /// The help/status line under a card's head: what the keys do, which is |
| 271 | /// metadata about the room's controls -- mono, §3. |
| 272 | pub |
| 273 | |
| 274 | |
| 275 | |
| 276 | |
| 277 | |
| 278 | |
| 279 | |
| 280 | |
| 281 | /// A ghost action row (DESIGN §4): borderless label + its chord, never a |
| 282 | /// filled box -- the shape every card's Reset/Flatten/Add/Remove/toggle |
| 283 | /// button takes now that "boxes are commitments" and Export is the one box |
| 284 | /// in the room. `active` is a toggle's own held-on state (EQ's spectrum |
| 285 | /// switch), not hover -- it keeps the fill and brightens the ink the same |
| 286 | /// way a picked param row's ring does. |
| 287 | pub |
| 288 | |
| 289 | |
| 290 | |
| 291 | |
| 292 | |
| 293 | |
| 294 | |
| 295 | |
| 296 | |
| 297 | |
| 298 | |
| 299 | |
| 300 | |
| 301 | |
| 302 | |
| 303 | |
| 304 | |
| 305 | |
| 306 | |
| 307 | |
| 308 | |
| 309 | |
| 310 | |
| 311 | |
| 312 | |
| 313 | |
| 314 | |
| 315 | |
| 316 | |
| 317 | |
| 318 | |
| 319 | |
| 320 | |
| 321 | |
| 322 | |
| 323 | |
| 324 | |
| 325 | |
| 326 | |
| 327 | |
| 328 | |
| 329 | |
| 330 | |
| 331 | |
| 332 | |
| 333 | /// A two-state toggle button (Mute, Solo): when `on` it takes a fill and a border of `tint` and |
| 334 | /// its label in `tint`, so the held state reads at a glance; off, it is the plain ghost button. |
| 335 | /// The border is drawn either way, so the button is the same size on and off. `tip` says what the |
| 336 | /// switch does, in plain words, on hover. |
| 337 | pub |
| 338 | |
| 339 | |
| 340 | |
| 341 | |
| 342 | |
| 343 | |
| 344 | |
| 345 | |
| 346 | |
| 347 | |
| 348 | |
| 349 | |
| 350 | |
| 351 | |
| 352 | |
| 353 | |
| 354 | |
| 355 | |
| 356 | |
| 357 | |
| 358 | |
| 359 | |
| 360 | |
| 361 | |
| 362 | |
| 363 | |
| 364 | |
| 365 | |
| 366 | |
| 367 | |
| 368 | |
| 369 | |
| 370 | |
| 371 | |
| 372 | |
| 373 | |
| 374 | |
| 375 | |
| 376 | |
| 377 | |
| 378 | |
| 379 | |
| 380 | |
| 381 | |
| 382 | |
| 383 | |
| 384 | |
| 385 | |
| 386 |