edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBff99ad6Tahinli6 days ago1055 commits
| 1 | //! The small elements every region is built out of. |
| 2 | |
| 3 | use crateFieldKey; |
| 4 | use crate; |
| 5 | use cratetheme; |
| 6 | use crate; |
| 7 | use crate::*; |
| 8 | use ; |
| 9 | use BTreeSet; |
| 10 | use ; |
| 11 | use Rc; |
| 12 | |
| 13 | /// How tall the "more below" fade is at the foot of a scrolled body. |
| 14 | const MORE_BELOW_H: f32 = 32.; |
| 15 | |
| 16 | /// The soft fade (no words) over the foot of a scrolled body while more of it is below -- |
| 17 | /// the export sheet's (the third row of preset tiles cut mid-text read as |
| 18 | /// the end of the list) and the Settings rows' (a short window cut them off |
| 19 | /// mid-row). The body tracks `scroll`; this sits after it in a `relative` |
| 20 | /// parent, over its last [`MORE_BELOW_H`] pixels. Painted, not laid out: the scroll handle's extent is only known |
| 21 | /// after the body's own layout, and a canvas painted after it reads that |
| 22 | /// frame's numbers rather than the last one's. No hitbox, so the tiles |
| 23 | /// under it stay pressable. |
| 24 | pub |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | /// `ClickEvent::modifiers()` answers the mouse-*up* modifiers (gpui-0.2.2 |
| 51 | /// `interactive.rs`), so releasing ctrl before the button lands undoes a |
| 52 | /// ctrl-held toggle decided on mouse-down. This reads the *press* modifiers |
| 53 | /// instead -- the ones a ctrl-click decision (multi-pick, no collapse) was |
| 54 | /// actually made under. |
| 55 | pub |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | /// As [`waveform`], but in a caller-picked ink rather than the fixed |
| 63 | /// secondary foreground -- the darkroom bench's own audio clips draw their |
| 64 | /// envelope in the source's ink (DESIGN §5), which the legacy timeline never |
| 65 | /// needed a colour for. |
| 66 | pub |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | /// An audio clip's fade, drawn as a translucent wedge over its box: silent |
| 102 | /// (full shade) at the clip's own edge, clear by the fade's far side -- |
| 103 | /// [`is_in`] mirrors it for the tail's ramp-down. The same `canvas` + |
| 104 | /// `PathBuilder` idiom [`waveform`] draws its envelope with, filled with the |
| 105 | /// same wash the in/out range already paints the bed with |
| 106 | /// (`ACCENT_WASH`, timeline.rs), so a fade reads as one more overlay on this |
| 107 | /// bed rather than a shape borrowed from somewhere else. |
| 108 | pub |
| 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 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | /// A video clip's dissolve into its neighbour, drawn as a small X astride the |
| 143 | /// join -- the box it is given is the last [`Clip::transition_out`] frames of |
| 144 | /// the clip's own width, so the mark sits right at the edge it dissolves |
| 145 | /// through. Two strokes rather than [`fade_wedge`]'s fill: a dissolve is not |
| 146 | /// a ramp to or from silence, it is two clips overlapping, and an X reads as |
| 147 | /// a splice the way a wedge reads as a fade. |
| 148 | pub |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | /// The hover line every control in the room wears (the user, 2026-09-09: |
| 171 | /// "each and every button gets hover over information" -- nobody could name |
| 172 | /// the band's own glyphs). One shape, built from the same pair the hitmap |
| 173 | /// already names the control by: `<name> · <chord>`, DESIGN §4's "every |
| 174 | /// command wears its chord" and §8's no-prose rule -- never a sentence. A |
| 175 | /// control the current state refuses says *why* in the chord's place: naming |
| 176 | /// a stroke that will not fire is the lie §4 forbids. |
| 177 | /// |
| 178 | /// The one-line form, kept for the test that pins it. The plates draw |
| 179 | /// [`TipParts`] instead (DESIGN §4.5: the key sits beside the name, not after a |
| 180 | /// dot, and a reason takes a line of its own). |
| 181 | |
| 182 | pub |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | /// What a hover plate says, in DESIGN §4.5's order: the name, the key beside |
| 194 | /// it (mono, ink3, from `Keymap::display` for an action), and -- when the |
| 195 | /// state refuses the control -- the reason on a line of its own in ink2. |
| 196 | |
| 197 | pub |
| 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 | |
| 225 | |
| 226 | |
| 227 | |
| 228 | |
| 229 | |
| 230 | |
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | |
| 240 | |
| 241 | /// Whether a tooltip's key text is a keycap (`Esc`, `Ctrl+K`, `↓ or .`). A key that |
| 242 | /// names a mouse gesture or reads as a phrase ("drag", "click to type", "Video, audio or |
| 243 | /// images") is a sentence the plate says as plain body text instead. |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | |
| 250 | /// The parts of an action's plate, read off the keymap and the enable answer |
| 251 | /// the caller already holds -- so the key is whatever the keymap says now, and |
| 252 | /// a refusal's reason is the oracle's own. Pulled out of [`action_hover`] so a |
| 253 | /// test can check it without a window. |
| 254 | pub |
| 255 | |
| 256 | |
| 257 | |
| 258 | /// [`TipParts`] in the shape gpui's `.tooltip` takes. Every shared control |
| 259 | /// constructor attaches this rather than building its own plate, which is |
| 260 | /// what keeps the next control from shipping without a hover line. |
| 261 | pub |
| 262 | |
| 263 | |
| 264 | |
| 265 | + use<> |
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | |
| 272 | |
| 273 | |
| 274 | |
| 275 | |
| 276 | /// [`tip_hover`] for a control drawn *on* a card or a menu, where an |
| 277 | /// ordinary [`KeyTip`] stands aside (`OVERLAID`) and would show nothing. |
| 278 | pub |
| 279 | |
| 280 | |
| 281 | |
| 282 | + use<> |
| 283 | |
| 284 | |
| 285 | |
| 286 | |
| 287 | |
| 288 | |
| 289 | |
| 290 | |
| 291 | |
| 292 | |
| 293 | /// [`tip_hover`] for a control that dispatches an action: the name and the |
| 294 | /// key are read live off the keymap and the enable state, so a rebind or a |
| 295 | /// refusal can never leave a stale plate under the pointer. |
| 296 | pub |
| 297 | |
| 298 | |
| 299 | + use<> |
| 300 | |
| 301 | |
| 302 | |
| 303 | |
| 304 | |
| 305 | |
| 306 | |
| 307 | |
| 308 | |
| 309 | |
| 310 | /// The keyboard focus ring (DESIGN §4.1): 2px of accent drawn *outside* the |
| 311 | /// control as a zero-blur shadow, so a focused control never moves its |
| 312 | /// neighbours. Applied through [`focus_ring`] on every control that can hold |
| 313 | /// gpui focus; the ring shows exactly while its handle is focused. |
| 314 | pub const FOCUS_RING_PX: f32 = 2.; |
| 315 | |
| 316 | /// The ring as a style: what `.focus(..)` paints. |
| 317 | pub |
| 318 | |
| 319 | |
| 320 | |
| 321 | |
| 322 | |
| 323 | |
| 324 | |
| 325 | |
| 326 | /// Gives a control the focus ring. One door so toolbar, menu bar and widgets |
| 327 | /// cannot drift apart on what a focused control looks like. |
| 328 | pub |
| 329 | |
| 330 | |
| 331 | |
| 332 | /// A toolbar button: its glyph, its name, and its key on hover. `id` only buys |
| 333 | /// `on_click` and the tooltip -- it is still not focusable, so the root's own |
| 334 | /// key listener keeps working after a press, and the click lands on mouse-up |
| 335 | /// inside the button (a press that slides off does nothing). |
| 336 | /// |
| 337 | /// A button that would do nothing says so: dimmed, no pointer, no listener. |
| 338 | |
| 339 | |
| 340 | |
| 341 | |
| 342 | pub |
| 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 | |
| 387 | |
| 388 | |
| 389 | |
| 390 | |
| 391 | |
| 392 | |
| 393 | |
| 394 | |
| 395 | |
| 396 | |
| 397 | |
| 398 | |
| 399 | |
| 400 | |
| 401 | |
| 402 | |
| 403 | |
| 404 | |
| 405 | |
| 406 | |
| 407 | |
| 408 | |
| 409 | |
| 410 | /// The monitoring level as something to drag: 4 px of bar to look at and the |
| 411 | /// whole control's height to hit (WCAG 2.5.8), the split the speed bar and the |
| 412 | /// colour sliders both make. Only the level -- mute is the button beside it, so |
| 413 | /// a muted slider still shows what unmuting comes back to, drawn dim. |
| 414 | /// |
| 415 | /// Whether a card or a menu is drawn over the window, as the hover labels see |
| 416 | /// it: written once a frame by [`Player::render`], read by every [`Tip`] before |
| 417 | /// it paints. |
| 418 | /// |
| 419 | /// A tooltip already on screen when an overlay opens *stays* on screen in gpui: |
| 420 | /// occluding the surface under it does not take it back, because the check that |
| 421 | /// keeps it visible works off the element's absolute bounds and knows nothing |
| 422 | /// about what was painted over it (`div.rs::handle_tooltip_mouse_move`, its own |
| 423 | /// TODO). So the tip is what has to stand aside -- here, once, for every hover |
| 424 | /// label in this window, rather than at fifteen call sites of which the |
| 425 | /// sixteenth would be forgotten. |
| 426 | pub static OVERLAID: AtomicBool = new; |
| 427 | |
| 428 | /// Whether a tip is cleared to paint: an ordinary tip stands aside whenever |
| 429 | /// `OVERLAID` is set (a card/menu is up over the underlying UI it belongs |
| 430 | /// to), but a tip *anchored on the overlay itself* -- the `?` glyph on a |
| 431 | /// card's own head, say -- was never the case `OVERLAID` meant to catch, so |
| 432 | /// it paints regardless. One predicate, so [`Tip`] and [`OverlayTip`] can't |
| 433 | /// drift apart on what "overlaid" is supposed to mean. |
| 434 | pub |
| 435 | |
| 436 | |
| 437 | |
| 438 | /// The name on a hover plate, and the reason beneath it (DESIGN §4.5: names |
| 439 | /// are 14px, the key is the 13px mono the room gives every chord). |
| 440 | const TIP_NAME_PX: f32 = 13.; |
| 441 | /// The widest a plate grows before its text wraps (DESIGN §4.5). |
| 442 | const TIP_MAX_W: f32 = 300.; |
| 443 | /// gpui puts a tooltip's box one pixel below-right of the pointer, so a plate |
| 444 | /// there covers the lower half of the control it describes. The box is padded |
| 445 | /// by these clear margins (transparent), which pushes the visible plate off the |
| 446 | /// control: down and to the right of where the pointer is. |
| 447 | const TIP_CLEAR_Y: f32 = 26.; |
| 448 | const TIP_CLEAR_X: f32 = 10.; |
| 449 | |
| 450 | /// The plate's definite width for these lines: wide enough for the longest on |
| 451 | /// one line, never past [`TIP_MAX_W`], so the text wraps inside it. A definite |
| 452 | /// width is what keeps gpui's measuring pass and its paint pass agreeing on |
| 453 | /// the height; with a max width alone the text overflowed its own box and ran |
| 454 | /// off the window's edge. |
| 455 | |
| 456 | |
| 457 | |
| 458 | |
| 459 | |
| 460 | |
| 461 | |
| 462 | |
| 463 | /// `text` broken into lines no wider than `max` px (by [`popup::text_w`]'s |
| 464 | /// upper bound). Broken here, by hand, because gpui's own wrapping did not take |
| 465 | /// the plate's width inside a tooltip (the text ran on past the plate's edge). |
| 466 | |
| 467 | |
| 468 | |
| 469 | |
| 470 | |
| 471 | |
| 472 | |
| 473 | |
| 474 | |
| 475 | |
| 476 | |
| 477 | |
| 478 | |
| 479 | |
| 480 | |
| 481 | |
| 482 | |
| 483 | /// Where gpui hangs a tooltip box of `size` for a pointer at `mouse`: one pixel |
| 484 | /// below-right, flipped to the left of / above the pointer where that would |
| 485 | /// leave the window, then pinned inside. gpui's own rule (window.rs |
| 486 | /// `prepaint_tooltip`), kept here so a test can hold it to "always inside". |
| 487 | |
| 488 | pub |
| 489 | |
| 490 | |
| 491 | |
| 492 | |
| 493 | |
| 494 | |
| 495 | |
| 496 | |
| 497 | |
| 498 | |
| 499 | |
| 500 | /// The dock's width, set every frame (`render.rs`): what a media row fits its meta lines to. |
| 501 | pub static DOCK_W_BITS: AtomicU32 = new; |
| 502 | |
| 503 | /// The window y where the time band (transport, toolbar, ruler, lanes) begins, set every frame |
| 504 | /// (`render.rs`); `0` while unknown. |
| 505 | pub static TIMELINE_TOP_BITS: AtomicU32 = new; |
| 506 | |
| 507 | /// The depth of the timeline's own chrome band (toolbar, sequence tabs, overview, ruler) in |
| 508 | /// which a plate is lifted above the region. Deeper (the lanes) a plate stays by the pointer: |
| 509 | /// a tooltip is always next to the control it names, never a long way off. |
| 510 | pub const TIP_LIFT_BAND: f32 = 100.; |
| 511 | |
| 512 | /// How far above a pointer at `mouse_y` a plate's bottom edge sits when the pointer is in the |
| 513 | /// timeline's chrome band (`top` to `top + TIP_LIFT_BAND`): the plate hangs just above the region, |
| 514 | /// `TIP_CLEAR_Y / 2` clear, so it never covers the ruler or the toolbar. `None` elsewhere, |
| 515 | /// where the ordinary below-right place applies. |
| 516 | pub |
| 517 | |
| 518 | |
| 519 | |
| 520 | /// The plate inside its transparent clear margin ([`TIP_CLEAR_Y`]), below-right of the pointer |
| 521 | /// (gpui flips it at the window's edge); with the pointer in the timeline's chrome band, above |
| 522 | /// that region ([`tip_lift`]). The one placement rule for every tooltip. |
| 523 | |
| 524 | |
| 525 | |
| 526 | |
| 527 | |
| 528 | |
| 529 | |
| 530 | |
| 531 | |
| 532 | |
| 533 | |
| 534 | |
| 535 | |
| 536 | |
| 537 | /// One line of a hover plate: the keycap's height, so a label and its chips share a line box |
| 538 | /// and the text centres on the chips. |
| 539 | const TIP_LINE_PX: f32 = 18.; |
| 540 | |
| 541 | /// DESIGN §2.5 and §4.5: a tooltip is a floating plate, so it is a panel with a |
| 542 | /// hairline, a 6px radius and the one shadow the room uses for floating plates |
| 543 | /// (menus, the palette, sheets, toasts). Padded 10px on every side. |
| 544 | |
| 545 | |
| 546 | |
| 547 | |
| 548 | |
| 549 | |
| 550 | |
| 551 | |
| 552 | |
| 553 | /// A plain prose tooltip ([`Tip`], [`OverlayTip`]): one line in ink1 on the |
| 554 | /// same plate, so a sentence-shaped hover still wears the room's one plate. |
| 555 | |
| 556 | |
| 557 | |
| 558 | |
| 559 | |
| 560 | |
| 561 | |
| 562 | |
| 563 | |
| 564 | |
| 565 | |
| 566 | |
| 567 | |
| 568 | |
| 569 | |
| 570 | |
| 571 | |
| 572 | /// One tooltip's text: the name in ink1, the key beside it in mono ink3, and |
| 573 | /// the reason (when the state refuses) on the line below in ink2. |
| 574 | |
| 575 | |
| 576 | |
| 577 | |
| 578 | |
| 579 | |
| 580 | |
| 581 | |
| 582 | |
| 583 | |
| 584 | |
| 585 | |
| 586 | |
| 587 | |
| 588 | |
| 589 | |
| 590 | |
| 591 | |
| 592 | |
| 593 | |
| 594 | |
| 595 | |
| 596 | |
| 597 | |
| 598 | |
| 599 | |
| 600 | |
| 601 | |
| 602 | |
| 603 | |
| 604 | |
| 605 | |
| 606 | |
| 607 | |
| 608 | |
| 609 | |
| 610 | |
| 611 | |
| 612 | |
| 613 | |
| 614 | |
| 615 | |
| 616 | |
| 617 | |
| 618 | |
| 619 | |
| 620 | |
| 621 | |
| 622 | |
| 623 | |
| 624 | |
| 625 | |
| 626 | |
| 627 | |
| 628 | |
| 629 | |
| 630 | |
| 631 | |
| 632 | |
| 633 | |
| 634 | |
| 635 | |
| 636 | |
| 637 | |
| 638 | |
| 639 | |
| 640 | |
| 641 | |
| 642 | |
| 643 | |
| 644 | |
| 645 | |
| 646 | |
| 647 | |
| 648 | |
| 649 | |
| 650 | /// A tooltip's entity, where the pointer was when it first painted, and whether it is dead. |
| 651 | type TipBorn = ; |
| 652 | |
| 653 | thread_local! |
| 654 | |
| 655 | |
| 656 | |
| 657 | |
| 658 | |
| 659 | |
| 660 | |
| 661 | /// Notes a press at `at`: a tooltip that has not shown yet must not show for it afterwards. |
| 662 | pub |
| 663 | |
| 664 | |
| 665 | |
| 666 | /// How far the pointer may drift from where a tooltip appeared before it is gone. |
| 667 | const TIP_DRIFT: f32 = 12.; |
| 668 | |
| 669 | /// Whether the tooltip view `id` must paint nothing: the pointer has left the spot it was |
| 670 | /// shown for (a stale plate, whatever kept gpui from hiding it), or it was born right under a |
| 671 | /// press (a tip whose delay ran out after the click). gpui's own rule hides a *shown* tip on a |
| 672 | /// press but lets a *waiting* one show afterwards; this is the one place that closes both. |
| 673 | |
| 674 | |
| 675 | |
| 676 | |
| 677 | |
| 678 | |
| 679 | |
| 680 | |
| 681 | |
| 682 | |
| 683 | |
| 684 | |
| 685 | |
| 686 | |
| 687 | /// A tooltip is a view in gpui and nothing smaller, so this is the smallest one |
| 688 | /// that carries a line of text. It paints outside the window's element tree and |
| 689 | /// therefore owns its colours. |
| 690 | pub SharedString); |
| 691 | |
| 692 | |
| 693 | |
| 694 | |
| 695 | |
| 696 | |
| 697 | |
| 698 | |
| 699 | |
| 700 | |
| 701 | |
| 702 | |
| 703 | |
| 704 | |
| 705 | |
| 706 | |
| 707 | |
| 708 | |
| 709 | /// Whether any `(start, len)` span holds `frame`. |
| 710 | |
| 711 | pub |
| 712 | |
| 713 | |
| 714 | |
| 715 | /// A tip anchored on the overlay itself -- a card's own `?` glyph, drawn on |
| 716 | /// its own card head. `OVERLAID` exists to hide a [`Tip`] on the UI *under* |
| 717 | /// a card while the card sits over it; a tip painted on the card is not |
| 718 | /// that case, so it is exempt (`tip_may_paint(true)` is always `true`). |
| 719 | /// Everything else about it is [`Tip`]'s own plate. |
| 720 | pub SharedString); |
| 721 | |
| 722 | |
| 723 | |
| 724 | |
| 725 | |
| 726 | |
| 727 | |
| 728 | |
| 729 | |
| 730 | |
| 731 | /// The hover plate every shared control and action wears (DESIGN §4.5): the |
| 732 | /// name, its key and, when refused, its reason. [`Tip`]'s rule applies: it |
| 733 | /// stands aside while a card is over the UI it belongs to, unless it is |
| 734 | /// anchored on the overlay (`on_overlay`, see [`tip_may_paint`]). |
| 735 | pub |
| 736 | |
| 737 | |
| 738 | |
| 739 | |
| 740 | |
| 741 | |
| 742 | |
| 743 | |
| 744 | |
| 745 | |
| 746 | |
| 747 | |
| 748 | |
| 749 | /// How much text the colour field will hold: `rgba(255, 255, 255, 255)` with |
| 750 | /// room to spare. Every legal colour is far inside it; the cap is there so a |
| 751 | /// held key cannot grow the buffer without bound. |
| 752 | const COLOR_EDIT_CHARS: usize = 32; |
| 753 | |
| 754 | /// A colour being typed into a row that has no text field of its own: the |
| 755 | /// free-text sibling of the kit number field, for the same reason it exists -- these |
| 756 | /// rows take no gpui focus, so the text is held as state and driven by the |
| 757 | /// root's key handler. One caller, the Clip tab's colour field |
| 758 | /// ([`Player::edit_viz_hex`]): typing, backspace, enter that commits and |
| 759 | /// escape that gives up, and a refusal in words when what is there is not a |
| 760 | /// colour. |
| 761 | |
| 762 | pub |
| 763 | |
| 764 | |
| 765 | |
| 766 | |
| 767 | |
| 768 | |
| 769 | |
| 770 | |
| 771 | |
| 772 | |
| 773 | |
| 774 | |
| 775 | |
| 776 | |
| 777 | |
| 778 | |
| 779 | |
| 780 | |
| 781 | |
| 782 | |
| 783 | |
| 784 | |
| 785 | |
| 786 | |
| 787 | |
| 788 | |
| 789 | |
| 790 | |
| 791 | |
| 792 | |
| 793 | |
| 794 | |
| 795 | |
| 796 | |
| 797 | |
| 798 | |
| 799 | |
| 800 | |
| 801 | |
| 802 | |
| 803 | |
| 804 | |
| 805 | |
| 806 | |
| 807 | |
| 808 | |
| 809 | |
| 810 | |
| 811 | |
| 812 | |
| 813 | |
| 814 | |
| 815 | |
| 816 | |
| 817 | |
| 818 | |
| 819 | |
| 820 | |
| 821 | |
| 822 | |
| 823 | |
| 824 | |
| 825 | |
| 826 | |
| 827 | |
| 828 | |
| 829 | |
| 830 | |
| 831 | /// How many characters a cue's words may run to in the in-place editor. Well |
| 832 | /// past any caption a viewer reads in the time it is up, so the cap only stops |
| 833 | /// a held key from growing the buffer without bound. |
| 834 | const CUE_EDIT_CHARS: usize = 500; |
| 835 | |
| 836 | /// A subtitle cue being retyped in place on its block: the free-text sibling of |
| 837 | /// [`ColorEdit`], for the same reason -- the block takes no gpui focus, so the |
| 838 | /// text is held as state and driven by the root's key handler |
| 839 | /// ([`Player::open_cue_edit`], [`Player::commit_cue_edit`]). Unlike a colour it |
| 840 | /// takes any printable character, not just ASCII, because a cue is words in |
| 841 | /// whatever language the file is in. |
| 842 | /// |
| 843 | /// `lane`, `track` and `cue` name the block being edited: `track` and `cue` are |
| 844 | /// the palette row and its cue ([`engine::PlaybackSession::set_cue_text`]), so |
| 845 | /// every placement of that track shows what is typed here on commit. |
| 846 | |
| 847 | pub |
| 848 | |
| 849 | |
| 850 | |
| 851 | |
| 852 | |
| 853 | |
| 854 | |
| 855 | |
| 856 | |
| 857 | |
| 858 | |
| 859 | |
| 860 | |
| 861 | |
| 862 | |
| 863 | |
| 864 | |
| 865 | |
| 866 | |
| 867 | |
| 868 | |
| 869 | |
| 870 | |
| 871 | |
| 872 | |
| 873 | |
| 874 | |
| 875 | |
| 876 | |
| 877 | |
| 878 | |
| 879 | |
| 880 | |
| 881 | |
| 882 | |
| 883 | |
| 884 | |
| 885 | |
| 886 | |
| 887 | |
| 888 | |
| 889 | |
| 890 | |
| 891 | |
| 892 | |
| 893 | |
| 894 | |
| 895 | |
| 896 | |
| 897 | |
| 898 | |
| 899 | |
| 900 | |
| 901 | |
| 902 | |
| 903 | |
| 904 | |
| 905 | |
| 906 | |
| 907 | |
| 908 | |
| 909 | |
| 910 | |
| 911 | |
| 912 | |
| 913 | |
| 914 | |
| 915 | |
| 916 | |
| 917 | |
| 918 | |
| 919 | |
| 920 | |
| 921 | |
| 922 | |
| 923 | |
| 924 | |
| 925 | |
| 926 | |
| 927 | |
| 928 | |
| 929 | |
| 930 | |
| 931 | |
| 932 | |
| 933 | |
| 934 | |
| 935 | |
| 936 | |
| 937 | |
| 938 | |
| 939 | |
| 940 | /// Which text of a marker the markers card is retyping. |
| 941 | |
| 942 | pub |
| 943 | |
| 944 | |
| 945 | |
| 946 | |
| 947 | /// A marker's name or note being retyped on the markers card: the free-text sibling of |
| 948 | /// [`CueEdit`], driven by the root's key handler for the same reason (the card takes no |
| 949 | /// gpui focus). `idx` is the marker's place in `PlaybackSession::markers`. |
| 950 | |
| 951 | pub |
| 952 | |
| 953 | |
| 954 | |
| 955 | |
| 956 | |
| 957 | |
| 958 | |
| 959 | |
| 960 | |
| 961 | |
| 962 | |
| 963 | |
| 964 | |
| 965 | |
| 966 | |
| 967 | |
| 968 | |
| 969 | |
| 970 | |
| 971 | |
| 972 | |
| 973 | |
| 974 | |
| 975 | |
| 976 | |
| 977 | |
| 978 | |
| 979 | |
| 980 | |
| 981 | |
| 982 | |
| 983 | |
| 984 | |
| 985 | |
| 986 | |
| 987 | |
| 988 | |
| 989 | |
| 990 | |
| 991 | |
| 992 | |
| 993 | /// Where a value sits on its slider, 0..1: the thumb's share of the track. |
| 994 | /// A value past either end pins to that end, and a range with no width (or a |
| 995 | /// value that is not a number) reads as the start rather than dividing by |
| 996 | /// nothing. |
| 997 | |
| 998 | pub |
| 999 | |
| 1000 | |
| 1001 | |
| 1002 | |
| 1003 | |
| 1004 | |
| 1005 | |
| 1006 | /// A slider press: window x of the sample, the card's own write. |
| 1007 | pub type SliderPress<V> = ; |
| 1008 | /// A slider reset: back to the default. |
| 1009 | pub type SliderReset<V> = ; |
| 1010 | |
| 1011 | /// One card slider's row (DESIGN §9.1). The card builds it and [`slider_row`] |
| 1012 | /// draws it, so every panel's slider reads the same and hits the same. |
| 1013 | |
| 1014 | pub |
| 1015 | |
| 1016 | |
| 1017 | |
| 1018 | |
| 1019 | |
| 1020 | |
| 1021 | |
| 1022 | |
| 1023 | |
| 1024 | |
| 1025 | |
| 1026 | |
| 1027 | |
| 1028 | |
| 1029 | |
| 1030 | |
| 1031 | |
| 1032 | |
| 1033 | |
| 1034 | |
| 1035 | |
| 1036 | /// Writes a typed slider value, already clamped, in the units the value reads. |
| 1037 | pub type SliderSet<V> = ; |
| 1038 | /// A typed value's write once it is due: it reaches the card's entity from outside the card. |
| 1039 | type TypedCommit = ; |
| 1040 | |
| 1041 | /// A slider's typed entry: the range a typed number clamps to and the write it makes, |
| 1042 | /// both in the units the value reads ("12 px" is 12, "40%" is 40). |
| 1043 | pub |
| 1044 | |
| 1045 | |
| 1046 | |
| 1047 | |
| 1048 | |
| 1049 | /// A slider value being typed: which row (the identity of its track), the buffer, the unit the |
| 1050 | /// value wears (" px", "%"), the range and the write a commit makes. |
| 1051 | |
| 1052 | |
| 1053 | |
| 1054 | |
| 1055 | |
| 1056 | |
| 1057 | |
| 1058 | |
| 1059 | |
| 1060 | |
| 1061 | |
| 1062 | |
| 1063 | |
| 1064 | thread_local! |
| 1065 | |
| 1066 | |
| 1067 | |
| 1068 | /// Whether a slider value is being typed: the keyboard is its until Enter or Escape. |
| 1069 | pub |
| 1070 | |
| 1071 | |
| 1072 | |
| 1073 | /// One key while a slider value is typed: Enter writes it, Escape drops it, the rest is text. |
| 1074 | pub |
| 1075 | |
| 1076 | |
| 1077 | |
| 1078 | |
| 1079 | |
| 1080 | |
| 1081 | |
| 1082 | |
| 1083 | |
| 1084 | |
| 1085 | |
| 1086 | /// Writes what was typed, once the update that delivered the keystroke or press is over: the |
| 1087 | /// card's own entity is still being updated when a key reaches it, so the write waits its turn. |
| 1088 | |
| 1089 | |
| 1090 | |
| 1091 | |
| 1092 | |
| 1093 | |
| 1094 | |
| 1095 | /// The typed value is written when the press lands outside the value, the way a click away |
| 1096 | /// from a field keeps what was typed. |
| 1097 | |
| 1098 | |
| 1099 | |
| 1100 | |
| 1101 | |
| 1102 | |
| 1103 | |
| 1104 | |
| 1105 | /// The focus a typed value gives back when it ends. |
| 1106 | |
| 1107 | |
| 1108 | |
| 1109 | |
| 1110 | /// Drops a row's typed value without writing it (a double-click resets the value instead). |
| 1111 | |
| 1112 | |
| 1113 | |
| 1114 | |
| 1115 | |
| 1116 | |
| 1117 | /// Splits a shown value into the number it opens on and the unit it wears: "12 px" is ("12", |
| 1118 | /// " px"), "−90°" is ("-90", "°"). |
| 1119 | |
| 1120 | |
| 1121 | |
| 1122 | |
| 1123 | |
| 1124 | |
| 1125 | /// The key a readout's typing is kept under: its id, hashed. Every typed readout has an id of |
| 1126 | /// its own, so one row's typing never shows in another's. |
| 1127 | pub |
| 1128 | |
| 1129 | |
| 1130 | |
| 1131 | |
| 1132 | |
| 1133 | |
| 1134 | /// A value's box, which a click types in: the value pill of a slider and of the rows that draw |
| 1135 | /// their own track. With `typed` set, a click opens the box as a field: Enter writes it, Escape |
| 1136 | /// drops it and a press outside keeps it. With `reset` set, a double-click resets the value. |
| 1137 | /// `open` is the number and unit the field opens on; `None` reads them off `shown`. |
| 1138 | |
| 1139 | pub |
| 1140 | |
| 1141 | |
| 1142 | |
| 1143 | |
| 1144 | |
| 1145 | |
| 1146 | |
| 1147 | |
| 1148 | |
| 1149 | |
| 1150 | |
| 1151 | |
| 1152 | |
| 1153 | |
| 1154 | |
| 1155 | |
| 1156 | |
| 1157 | |
| 1158 | |
| 1159 | |
| 1160 | |
| 1161 | |
| 1162 | |
| 1163 | |
| 1164 | |
| 1165 | |
| 1166 | |
| 1167 | |
| 1168 | |
| 1169 | |
| 1170 | |
| 1171 | |
| 1172 | |
| 1173 | |
| 1174 | |
| 1175 | |
| 1176 | |
| 1177 | |
| 1178 | |
| 1179 | |
| 1180 | |
| 1181 | |
| 1182 | |
| 1183 | |
| 1184 | |
| 1185 | |
| 1186 | |
| 1187 | |
| 1188 | |
| 1189 | |
| 1190 | |
| 1191 | |
| 1192 | |
| 1193 | |
| 1194 | |
| 1195 | |
| 1196 | |
| 1197 | |
| 1198 | |
| 1199 | |
| 1200 | |
| 1201 | |
| 1202 | |
| 1203 | |
| 1204 | |
| 1205 | |
| 1206 | |
| 1207 | |
| 1208 | |
| 1209 | |
| 1210 | |
| 1211 | |
| 1212 | |
| 1213 | |
| 1214 | |
| 1215 | |
| 1216 | |
| 1217 | |
| 1218 | |
| 1219 | |
| 1220 | |
| 1221 | |
| 1222 | |
| 1223 | |
| 1224 | |
| 1225 | |
| 1226 | |
| 1227 | |
| 1228 | |
| 1229 | |
| 1230 | |
| 1231 | |
| 1232 | |
| 1233 | |
| 1234 | |
| 1235 | |
| 1236 | |
| 1237 | |
| 1238 | |
| 1239 | |
| 1240 | |
| 1241 | |
| 1242 | |
| 1243 | |
| 1244 | |
| 1245 | |
| 1246 | |
| 1247 | |
| 1248 | |
| 1249 | /// A value pill with its Reset slot beside it, laid out the way [`crate::ui::kit::value_pill`] |
| 1250 | /// lays one out, with the box typed by [`typed_readout`]. |
| 1251 | |
| 1252 | pub |
| 1253 | |
| 1254 | |
| 1255 | |
| 1256 | |
| 1257 | |
| 1258 | |
| 1259 | |
| 1260 | |
| 1261 | |
| 1262 | |
| 1263 | |
| 1264 | |
| 1265 | |
| 1266 | |
| 1267 | |
| 1268 | |
| 1269 | |
| 1270 | |
| 1271 | |
| 1272 | |
| 1273 | /// The slider row (DESIGN §9.1): label left in ink3, value right in mono, a |
| 1274 | /// 4px track under them and a 14px thumb on it, the whole track one `HIT_MIN` |
| 1275 | /// tall to hit. Arrow keys are the card's own nudge, not this row's. |
| 1276 | |
| 1277 | pub |
| 1278 | |
| 1279 | |
| 1280 | |
| 1281 | /// [`slider_row`] whose label carries a tooltip saying what the setting is for. |
| 1282 | pub |
| 1283 | |
| 1284 | |
| 1285 | |
| 1286 | |
| 1287 | |
| 1288 | |
| 1289 | |
| 1290 | /// [`slider_row`] on one line: label at the left, the track filling the middle, the value (and |
| 1291 | /// reset slot) at the right, so a settings list can keep every row `CONTROL_H` tall. |
| 1292 | pub |
| 1293 | |
| 1294 | |
| 1295 | |
| 1296 | |
| 1297 | |
| 1298 | |
| 1299 | |
| 1300 | |
| 1301 | |
| 1302 | |
| 1303 | |
| 1304 | |
| 1305 | |
| 1306 | |
| 1307 | |
| 1308 | |
| 1309 | |
| 1310 | |
| 1311 | |
| 1312 | |
| 1313 | |
| 1314 | |
| 1315 | |
| 1316 | |
| 1317 | |
| 1318 | |
| 1319 | |
| 1320 | |
| 1321 | |
| 1322 | |
| 1323 | |
| 1324 | |
| 1325 | |
| 1326 | |
| 1327 | |
| 1328 | |
| 1329 | |
| 1330 | |
| 1331 | |
| 1332 | |
| 1333 | |
| 1334 | |
| 1335 | |
| 1336 | |
| 1337 | |
| 1338 | |
| 1339 | |
| 1340 | |
| 1341 | |
| 1342 | |
| 1343 | |
| 1344 | |
| 1345 | |
| 1346 | |
| 1347 | |
| 1348 | |
| 1349 | |
| 1350 | |
| 1351 | |
| 1352 | |
| 1353 | |
| 1354 | |
| 1355 | |
| 1356 | |
| 1357 | |
| 1358 | |
| 1359 | |
| 1360 | |
| 1361 | |
| 1362 | |
| 1363 | |
| 1364 | |
| 1365 | |
| 1366 | |
| 1367 | |
| 1368 | |
| 1369 | |
| 1370 | |
| 1371 | |
| 1372 | |
| 1373 | |
| 1374 | |
| 1375 | |
| 1376 | |
| 1377 | |
| 1378 | |
| 1379 | |
| 1380 | |
| 1381 | |
| 1382 | |
| 1383 | |
| 1384 | |
| 1385 | |
| 1386 | |
| 1387 | |
| 1388 | |
| 1389 | |
| 1390 | |
| 1391 | |
| 1392 | |
| 1393 | |
| 1394 | |
| 1395 | |
| 1396 | |
| 1397 | |
| 1398 | |
| 1399 | |
| 1400 | |
| 1401 | |
| 1402 | |
| 1403 | |
| 1404 | |
| 1405 | |
| 1406 | |
| 1407 | |
| 1408 | |
| 1409 | |
| 1410 | /// A bipolar slider's bare track, for a pan: the same track as [`slider_row`] with its |
| 1411 | /// neutral point (the centre, 0) marked by two notches above and below, clear of the thumb's |
| 1412 | /// footprint, and the fill running out from that centre to the value. |
| 1413 | pub |
| 1414 | |
| 1415 | |
| 1416 | |
| 1417 | |
| 1418 | |
| 1419 | |
| 1420 | |
| 1421 | |
| 1422 | |
| 1423 | |
| 1424 | |
| 1425 | |
| 1426 | |
| 1427 | |
| 1428 | |
| 1429 | |
| 1430 | |
| 1431 | |
| 1432 | |
| 1433 | |
| 1434 | |
| 1435 | |
| 1436 | |
| 1437 | |
| 1438 | |
| 1439 | |
| 1440 | |
| 1441 | |
| 1442 | |
| 1443 | |
| 1444 | |
| 1445 | |
| 1446 | |
| 1447 | |
| 1448 | |
| 1449 | |
| 1450 | |
| 1451 | |
| 1452 | |
| 1453 | |
| 1454 | |
| 1455 | |
| 1456 | |
| 1457 | |
| 1458 | |
| 1459 | |
| 1460 | |
| 1461 | |
| 1462 | |
| 1463 | |
| 1464 | /// The `More` fold (DESIGN §9.1): a row that opens and closes a group the |
| 1465 | /// card keeps hidden by default. The open state is the card's; keep it with |
| 1466 | /// [`load_folds`] / [`save_folds`] so it is remembered per panel. |
| 1467 | |
| 1468 | pub |
| 1469 | |
| 1470 | |
| 1471 | |
| 1472 | |
| 1473 | |
| 1474 | |
| 1475 | |
| 1476 | |
| 1477 | |
| 1478 | |
| 1479 | |
| 1480 | |
| 1481 | |
| 1482 | |
| 1483 | |
| 1484 | |
| 1485 | |
| 1486 | |
| 1487 | |
| 1488 | |
| 1489 | |
| 1490 | |
| 1491 | |
| 1492 | |
| 1493 | |
| 1494 | |
| 1495 | |
| 1496 | |
| 1497 | /// Where the open `More …` folds live: next to the other small preference |
| 1498 | /// files (`dock-tab`, `stance-splits`), one panel id per line. A fold the file |
| 1499 | /// does not name is closed, which is the default. |
| 1500 | |
| 1501 | pub |
| 1502 | |
| 1503 | |
| 1504 | |
| 1505 | |
| 1506 | pub |
| 1507 | |
| 1508 | |
| 1509 | |
| 1510 | |
| 1511 | pub |
| 1512 | |
| 1513 | |
| 1514 | |
| 1515 | |
| 1516 | |
| 1517 | |
| 1518 | |
| 1519 | |
| 1520 | |
| 1521 | |
| 1522 | |
| 1523 | |
| 1524 | pub |
| 1525 | |
| 1526 | |
| 1527 | |
| 1528 | |
| 1529 | pub |
| 1530 | |
| 1531 | |
| 1532 | |
| 1533 | |
| 1534 | |
| 1535 | |
| 1536 | |
| 1537 | |
| 1538 | |
| 1539 | |
| 1540 | |
| 1541 | |
| 1542 | |
| 1543 | |
| 1544 | |
| 1545 | |
| 1546 | |
| 1547 | |
| 1548 | |
| 1549 | |
| 1550 | |
| 1551 | |
| 1552 | |
| 1553 | |
| 1554 | |
| 1555 | |
| 1556 | |
| 1557 | |
| 1558 | |
| 1559 | |
| 1560 | |
| 1561 | |
| 1562 | |
| 1563 | |
| 1564 | |
| 1565 | |
| 1566 | |
| 1567 | |
| 1568 | |
| 1569 | |
| 1570 | |
| 1571 | |
| 1572 | |
| 1573 | |
| 1574 | |
| 1575 | |
| 1576 | |
| 1577 | |
| 1578 | |
| 1579 | |
| 1580 | |
| 1581 | |
| 1582 | |
| 1583 | |
| 1584 | |
| 1585 | |
| 1586 | |
| 1587 | |
| 1588 | |
| 1589 | |
| 1590 | |
| 1591 | |
| 1592 | |
| 1593 | |
| 1594 | |
| 1595 | |
| 1596 | |
| 1597 | |
| 1598 | |
| 1599 | |
| 1600 | |
| 1601 | |
| 1602 | |
| 1603 | |
| 1604 | |
| 1605 | |
| 1606 | |
| 1607 | |
| 1608 | |
| 1609 | |
| 1610 | |
| 1611 | |
| 1612 | |
| 1613 | |
| 1614 | |
| 1615 | |
| 1616 | |
| 1617 | |
| 1618 | |
| 1619 | |
| 1620 | |
| 1621 | |
| 1622 | |
| 1623 | |
| 1624 | |
| 1625 | |
| 1626 | |
| 1627 | |
| 1628 | |
| 1629 | |
| 1630 | |
| 1631 | |
| 1632 | |
| 1633 | |
| 1634 | |
| 1635 | |
| 1636 | |
| 1637 | |
| 1638 | |
| 1639 | |
| 1640 | |
| 1641 | |
| 1642 | |
| 1643 | |
| 1644 | |
| 1645 | |
| 1646 | |
| 1647 | |
| 1648 | |
| 1649 | |
| 1650 | |
| 1651 | |
| 1652 | |
| 1653 | |
| 1654 | |
| 1655 | |
| 1656 | |
| 1657 | |
| 1658 | |
| 1659 | |
| 1660 | |
| 1661 | |
| 1662 | |
| 1663 | |
| 1664 | |
| 1665 | |
| 1666 | |
| 1667 | |
| 1668 | |
| 1669 | |
| 1670 | |
| 1671 | |
| 1672 | |
| 1673 | |
| 1674 | |
| 1675 | |
| 1676 | |
| 1677 | |
| 1678 | |
| 1679 | |
| 1680 | |
| 1681 | |
| 1682 | |
| 1683 | |
| 1684 | |
| 1685 | |
| 1686 | |
| 1687 | |
| 1688 | |
| 1689 | |
| 1690 | |
| 1691 | |
| 1692 | |
| 1693 | |
| 1694 | |
| 1695 | |
| 1696 | |
| 1697 | |
| 1698 | |
| 1699 | |
| 1700 | |
| 1701 | |
| 1702 | |
| 1703 | |
| 1704 | |
| 1705 | |
| 1706 | |
| 1707 | /// A word that may change between two spellings (`Mute`/`Muted`, `Snap on`/ |
| 1708 | /// `Snap off`) without moving anything beside it: the slot is as wide as |
| 1709 | /// `widest` (laid out but unseen), and the word is painted over it, left |
| 1710 | /// aligned. Text metrics decide the width, so no pixel guess goes stale. |
| 1711 | |
| 1712 | pub |
| 1713 | |
| 1714 | |
| 1715 | |
| 1716 | |
| 1717 | |
| 1718 | |
| 1719 |