edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBff99ad6Tahinli6 days ago1055 commits
| 1 | //! The timeline's arithmetic: takes, trims, snapping and envelopes. |
| 2 | |
| 3 | use crate::*; |
| 4 | |
| 5 | /// Whether this clip is a whole take, i.e. whether deleting it may close the |
| 6 | /// hole under it: a take is what the first pair of lanes carries between them, |
| 7 | /// `V1`'s picture and the sound grouped with it, and dropping one moves the |
| 8 | /// frames after it on every lane. A caption a hand grouped with the clip |
| 9 | /// counts as its partner too: the group is what pairs, not the lane's kind -- |
| 10 | /// and a group answers `true` from *whichever* member's lane the question is |
| 11 | /// asked from, added row or not, because a grouped delete |
| 12 | /// ([`PlaybackSession::delete_clip`] -> `Project::delete_members`) closes |
| 13 | /// every member's own lane by its own span already, not just the first pair's. |
| 14 | /// |
| 15 | /// Everything else is a half or a layer, and is *lifted* instead: a half whose |
| 16 | /// picture was lifted (what a lift leaves behind) has no take to ripple, and an |
| 17 | /// *ungrouped* clip on a further lane is laid over the timeline rather than |
| 18 | /// part of it -- closing a hole under it would drag the take beneath out of |
| 19 | /// step with it. |
| 20 | pub |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 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 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | /// The clip a Group would pair this one with: the first clip on another track, |
| 63 | /// in the order the lanes are drawn, covering exactly the same frames and not in |
| 64 | /// this clip's group already. Exactly the same frames because that is all a |
| 65 | /// group id can mean (engine `links_are_consistent`), which is what leaves |
| 66 | /// nothing for a second click to choose. `None` when no track has one, and the |
| 67 | /// notice says so. |
| 68 | pub |
| 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 | /// What the timeline has picked: every clip and caption a hand ctrl-clicked |
| 95 | /// into the selection, in click order and with no two the same. The last of |
| 96 | /// them is the [`anchor`](Selection::anchor) -- the one every action that is |
| 97 | /// about *one* thing (delete, lift, copy, the equalizer) acts on -- and the |
| 98 | /// whole list is what a manual Group names to the engine. |
| 99 | /// |
| 100 | /// Indices move under every edit, exactly as the single mark this replaces |
| 101 | /// did, so every edit that renumbers a lane clears the picks it cannot keep |
| 102 | /// honest. Pure and engine-free, so a test can build one without a window. |
| 103 | |
| 104 | pub |
| 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 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 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 | /// The lane stack's thumb over a track `h` px tall: `(y, height)` of the box |
| 181 | /// standing for the visible share of a stack `content` px tall in a box |
| 182 | /// `box_h` px tall, taken down by `scrolled` px. Full track when the whole |
| 183 | /// stack is on screen, never shorter than |
| 184 | /// [`SCROLL_THUMB_MIN`] when it is not, and never off the track either way. |
| 185 | pub |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | /// A hole the bed may offer as a gap: one with a placement on both sides of it. The stretch |
| 205 | /// before a lane's first placement starts at frame 0 and is not a gap a hand made by moving |
| 206 | /// clips apart, so it is never drawn, picked or closed -- an empty track reads as empty. |
| 207 | /// `gap_at` still answers it for the engine; the bed asks this before it offers one. |
| 208 | pub |
| 209 | |
| 210 | |
| 211 | |
| 212 | /// Whether a click marks this box: any pick on it always, and any box sharing |
| 213 | /// a group id with a pick -- the clip the anchor was ctrl-clicked beside, and |
| 214 | /// the caption a hand pinned to a clip. A group whose only member is picked |
| 215 | /// marks that member alone, which is what makes a detached half separately |
| 216 | /// deletable. |
| 217 | /// |
| 218 | /// `pick_links` are the group ids of the picks themselves, read by the caller |
| 219 | /// off the session in the same order as `picks` -- the one fact this pure |
| 220 | /// question cannot know. |
| 221 | pub |
| 222 | |
| 223 | |
| 224 | |
| 225 | |
| 226 | |
| 227 | |
| 228 | |
| 229 | |
| 230 | /// The clip a trim is *showing*, worked out the way `Project::trim` will write |
| 231 | /// it: the timeline room the edge leaves is turned into source frames by the one |
| 232 | /// conversion that exists for it ([`Speed::fit`]), and the box is drawn from |
| 233 | /// that. The preview and the commit are then the same arithmetic -- a box let go |
| 234 | /// of stays where the hand left it at every rate. Assigning the timeline count |
| 235 | /// straight to the source field, as this used to, drew a speeded clip's tail |
| 236 | /// moving at the wrong rate (it snapped on release) and drew a *head* trim |
| 237 | /// moving the clip's other edge, since the length it implied was not the length |
| 238 | /// the release would commit. |
| 239 | /// |
| 240 | /// A still grows forward from source frame 0 instead: every frame of it is the |
| 241 | /// same picture, so there is no earlier one for an in-point to walk back to. |
| 242 | /// |
| 243 | /// Room too narrow to hold one source frame is the edit the engine refuses, and |
| 244 | /// the box is drawn unchanged rather than as something that will not be |
| 245 | /// committed. |
| 246 | pub |
| 247 | |
| 248 | |
| 249 | |
| 250 | |
| 251 | |
| 252 | |
| 253 | |
| 254 | |
| 255 | |
| 256 | |
| 257 | |
| 258 | |
| 259 | |
| 260 | |
| 261 | |
| 262 | |
| 263 | |
| 264 | |
| 265 | |
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | |
| 272 | |
| 273 | |
| 274 | |
| 275 | |
| 276 | |
| 277 | |
| 278 | |
| 279 | |
| 280 | |
| 281 | |
| 282 | |
| 283 | |
| 284 | |
| 285 | |
| 286 | |
| 287 | |
| 288 | |
| 289 | |
| 290 | |
| 291 | |
| 292 | |
| 293 | |
| 294 | |
| 295 | /// The cut odometer's own arithmetic (DESIGN.md §6): where `,` `.` land from |
| 296 | /// `idx`, `stride` cuts forward or back among `len` of them. Clamped rather |
| 297 | /// than wrapping -- an odometer that wraps at the last cut reads as landing |
| 298 | /// back at the first, which is not "next" -- so a walk already at either end |
| 299 | /// simply holds there, the way [`Player::step`]'s own ends do. |
| 300 | pub |
| 301 | |
| 302 | |
| 303 | |
| 304 | |
| 305 | |
| 306 | |
| 307 | |
| 308 | |
| 309 | |
| 310 | |
| 311 | |
| 312 | |
| 313 | /// The no-aim trim's own arithmetic (DESIGN.md §6): `current` moved `dir` |
| 314 | /// frames (usually ±1, a held key's ratchet) and clamped into the room |
| 315 | /// [`engine::PlaybackSession::trim_room`] already answered -- the same wall a |
| 316 | /// pointer drag is clamped to, so a keyboard trim can never draw an edge the |
| 317 | /// engine would refuse. |
| 318 | pub |
| 319 | |
| 320 | |
| 321 | |
| 322 | /// Where a pro trim's anchor (a cut's frame, a clip's start) lands when moved |
| 323 | /// `by` frames, held inside the room `(lo, hi)` the engine answered |
| 324 | /// ([`engine::PlaybackSession::roll_room`], [`engine::PlaybackSession::slide_room`]). |
| 325 | pub |
| 326 | |
| 327 | |
| 328 | |
| 329 | /// Whether a loop-trim window ([`ActionId::LoopTrim`]) has been played out to |
| 330 | /// its far edge and wants restarting at its near one: pure so the pump's own |
| 331 | /// tick ([`Player::pump`]) is one `if` over a fact this decides. `None` -- |
| 332 | /// loop-trim off -- never restarts anything. |
| 333 | pub |
| 334 | |
| 335 | |
| 336 | |
| 337 | /// Which window is actually looping, in priority order: the i/o range |
| 338 | /// ([`Player::range`]) beats the subject-cut trim ([`Player::loop_trim`]) |
| 339 | /// beats the whole timeline -- but only once *something* is already armed |
| 340 | /// (`loop_on` or `loop_trim`). A bare in/out mark with neither on is an |
| 341 | /// export mark first, not a loop request, so it answers `None` here and |
| 342 | /// never restarts anything on its own. |
| 343 | pub |
| 344 | |
| 345 | |
| 346 | |
| 347 | |
| 348 | |
| 349 | |
| 350 | |
| 351 | |
| 352 | |
| 353 | |
| 354 | /// How far a Play Around ([`ActionId::PlayAround`]) runs before the playhead and |
| 355 | /// after it, in seconds. |
| 356 | pub const PLAY_AROUND_PAD: f64 = 2.0; |
| 357 | |
| 358 | /// A Play Around in flight: where the playhead was when it began, and the second |
| 359 | /// the run stops on. Kept on the [`Player`] until the run ends. |
| 360 | |
| 361 | pub |
| 362 | |
| 363 | |
| 364 | |
| 365 | |
| 366 | /// The run a Play Around from `playhead` covers on a timeline `duration` seconds |
| 367 | /// long: [`PLAY_AROUND_PAD`] before the playhead to the same after it, clamped to |
| 368 | /// the timeline. `(start, stop)` in seconds. |
| 369 | pub |
| 370 | |
| 371 | |
| 372 | |
| 373 | |
| 374 | |
| 375 | /// How close to its stop a run must read before it counts as having reached it. |
| 376 | /// The clock can stop a hair short of the timeline's end when play runs out. |
| 377 | pub const PLAY_AROUND_SLACK: f64 = 0.05; |
| 378 | |
| 379 | /// Where a play resumes from on crossing into [`Transport::Ended`] |
| 380 | /// (`Player::pump`): the active window's own near edge |
| 381 | /// ([`active_loop_window`]) when one is armed, *even when its far edge is |
| 382 | /// the film's own last frame* -- half of all cuts in a two-clip film sit on |
| 383 | /// the final clip (DESIGN.md §6), so that coincidence is not an edge case |
| 384 | /// and must not read as "reached the end, stop". Falls back to the |
| 385 | /// whole-timeline loop's top, and `None` -- nothing armed -- restarts |
| 386 | /// nothing, which is the halt this crossing otherwise means. |
| 387 | pub |
| 388 | |
| 389 | |
| 390 | |
| 391 | |
| 392 | |
| 393 | |
| 394 | |
| 395 | |
| 396 | |
| 397 | |
| 398 | /// How many timeline frames a stretch of a subtitle track is worth: the one |
| 399 | /// conversion between the two clocks a caption has -- microseconds for its |
| 400 | /// words, frames for where it sits -- and the app-side twin of the engine's own |
| 401 | /// (`Project::trim_sub_room`). Never zero: a placement of no frames is the one |
| 402 | /// [`Project::place_sub`] refuses as empty, and a track shorter than a frame is |
| 403 | /// still a caption somebody dragged. |
| 404 | /// A fade handle's drag, turned into timeline frames: `dx` pixels at `pps` |
| 405 | /// pixels per second, at `fps` frames per second -- the one conversion a |
| 406 | /// fade-in or fade-out handle needs, and the app-side twin of every other |
| 407 | /// pixel-to-frame door on this bed ([`Scale::time_at`]). Zero for a |
| 408 | /// degenerate scale (nothing drawn to drag against), never negative on its |
| 409 | /// own -- the caller adds this to the fade's length before clamping to the |
| 410 | /// clip's own room, so a delta can still shrink a fade by coming back signed. |
| 411 | pub |
| 412 | |
| 413 | |
| 414 | |
| 415 | |
| 416 | |
| 417 | |
| 418 | /// The spacing a ruler tick is drawn at, and so how its label reads |
| 419 | /// (DESIGN §6.5). |
| 420 | |
| 421 | pub |
| 422 | |
| 423 | |
| 424 | |
| 425 | |
| 426 | |
| 427 | |
| 428 | |
| 429 | /// Frame steps, in frames, for zoomed-in views where a whole second is still |
| 430 | /// too wide to clear the pitch. Only the ones that divide the frame rate are |
| 431 | /// used (`1, 5` at 25fps; `1, 2, 4, 6, 12` at 24fps; `1, 2, 5, 6, 10, 15` at |
| 432 | /// 30fps), so every whole second is itself a tick and the `+Nf` labels count |
| 433 | /// up to it and start over -- ten-frame ticks at 25fps would read `+20f`, |
| 434 | /// `+5f`, `+15f` with the second never landing on one. |
| 435 | const RULER_FRAME_STEPS: = ; |
| 436 | /// Second steps: the human ones -- 1 s, 2 s, 5 s, 10 s, 30 s, a minute, then |
| 437 | /// 2, 5, 10 and 30 minutes and an hour. Never 15 s or 20 s, which a reader |
| 438 | /// cannot count along. |
| 439 | const RULER_SECOND_STEPS: = ; |
| 440 | |
| 441 | |
| 442 | |
| 443 | |
| 444 | |
| 445 | |
| 446 | |
| 447 | |
| 448 | |
| 449 | |
| 450 | |
| 451 | /// The finest step whose pixel width at `pps` clears `min_px`, walking frame |
| 452 | /// steps first, then the second steps up to an hour. Frame steps only appear |
| 453 | /// once a whole second is wider than the pitch allows, so the far zoom never |
| 454 | /// shows frame labels and the near zoom never shows minutes. |
| 455 | pub |
| 456 | |
| 457 | |
| 458 | |
| 459 | |
| 460 | |
| 461 | |
| 462 | |
| 463 | |
| 464 | |
| 465 | |
| 466 | /// A whole-second ruler label that cannot be misread as a timecode: `0s`, |
| 467 | /// `2s`, `30s` under a minute, `1:00`, `1:30` past it, `1:00:00` past an |
| 468 | /// hour. The transport's own `HH:MM:SS:FF` readout stays where it is; this |
| 469 | /// is the ruler's shorter voice. |
| 470 | pub |
| 471 | |
| 472 | |
| 473 | |
| 474 | |
| 475 | |
| 476 | |
| 477 | |
| 478 | /// The label of the `index`th tick at `step`: a second step reads the whole |
| 479 | /// second, a frame step reads the whole second when it lands on one and |
| 480 | /// `+Nf` frames past the last whole second otherwise. Indexed rather than |
| 481 | /// timed so a frame tick never drifts onto the wrong frame over a long bed. |
| 482 | pub |
| 483 | |
| 484 | |
| 485 | |
| 486 | |
| 487 | |
| 488 | |
| 489 | |
| 490 | |
| 491 | |
| 492 | |
| 493 | |
| 494 | |
| 495 | |
| 496 | /// Only the app's tests call this; the GUI path no longer does. |
| 497 | |
| 498 | pub |
| 499 | |
| 500 | |
| 501 | |
| 502 | |
| 503 | |
| 504 | |
| 505 | |
| 506 | |
| 507 | /// The *placement* a trim is showing, the same way for a caption: |
| 508 | /// [`Project::trim_sub`] moves the head or the tail and the window follows it, |
| 509 | /// so the box on screen is the frames alone -- the words it will keep are the |
| 510 | /// engine's arithmetic at the release, and nothing here draws them. |
| 511 | /// |
| 512 | /// An edge that has not moved draws the placement it pressed, and one dragged |
| 513 | /// past its other end keeps the one frame the engine's own walls always leave. |
| 514 | pub |
| 515 | |
| 516 | |
| 517 | |
| 518 | |
| 519 | |
| 520 | |
| 521 | |
| 522 | |
| 523 | |
| 524 | |
| 525 | |
| 526 | |
| 527 | |
| 528 | |
| 529 | |
| 530 | |
| 531 | /// Which index on its own lane a dragged clip is at *now*: the one it was picked |
| 532 | /// up at while nothing has moved, and wherever the clip itself has slid to when |
| 533 | /// an edit during the drag rippled the lane's indices -- a delete, an undo or a |
| 534 | /// paste from a stroke, none of which gpui's frozen drag payload hears about. |
| 535 | /// `None` when the clip is gone altogether, and then the drop is not an edit at |
| 536 | /// all: moving whatever slid into its place is the one thing the hand did not |
| 537 | /// ask for. A lane's clips are disjoint and sorted, so at most one of them can |
| 538 | /// be the clip that was picked up. Generic over what a lane holds, because a |
| 539 | /// [`SubClip`] is dragged under exactly the same rule. |
| 540 | pub |
| 541 | |
| 542 | |
| 543 | |
| 544 | |
| 545 | |
| 546 | |
| 547 | /// Which index a lane's mark is on after that lane was renumbered: the caption |
| 548 | /// that starts at `start`, and `None` when it is not there any more. |
| 549 | /// |
| 550 | /// The mark on a caption is an index like a clip's ([`Player::selected`]), and a |
| 551 | /// subtitle lane both *inserts in start order* ([`engine::Project::place_sub`]) |
| 552 | /// and removes, so any placement or lift renumbers every caption after it and an |
| 553 | /// index left as it was names a neighbour -- the caption the next Delete would |
| 554 | /// take. So the mark is read off the caption's start frame before such an edit |
| 555 | /// and found again by it after: captions on a lane are disjoint and in order, so |
| 556 | /// a start frame names exactly one of them and is the identity an index is not. |
| 557 | pub |
| 558 | |
| 559 | |
| 560 | |
| 561 | /// Scales an envelope to its own loudest sample, so a quietly mastered source |
| 562 | /// still draws as a shape. The fixtures peak around an eighth of full scale, and |
| 563 | /// an eighth of a 30 px lane is a flat line -- which says "silent" about a file |
| 564 | /// that is not. |
| 565 | pub |
| 566 | |
| 567 | |
| 568 | |
| 569 | |
| 570 | |
| 571 | |
| 572 | |
| 573 | |
| 574 | |
| 575 | |
| 576 | /// The min/max envelope of `peaks` over the source seconds `from..to`, as |
| 577 | /// `(x, top, bottom)` columns of a `w` x `h` box. Every point is inside that box |
| 578 | /// -- a clip's waveform cannot paint over its neighbour -- and every column is |
| 579 | /// at least a pixel tall, so silence reads as a line through the middle rather |
| 580 | /// than as a polygon with no area. |
| 581 | pub |
| 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 | /// Records its parent's laid-out box: gpui hands a mouse listener the window |
| 609 | /// position only, and the ruler sits behind the panel's padding. Paints |
| 610 | /// nothing and takes no hitbox of its own, so the click still reaches the bar. |
| 611 | pub |
| 612 | |
| 613 | |
| 614 | |
| 615 | |
| 616 | |
| 617 | /// [`bounds_probe`] for a box something *else* is laid out against: it also asks |
| 618 | /// for one more frame whenever the height changed. |
| 619 | /// |
| 620 | /// A measurement is read by the frame after the one that took it, and a notice |
| 621 | /// arriving over a paused picture repaints exactly once -- so without this the |
| 622 | /// cue would sit under that notice until something else happened to draw, which |
| 623 | /// on a paused window can be never. |
| 624 | pub |
| 625 | |
| 626 | |
| 627 | |
| 628 | |
| 629 | |
| 630 | |
| 631 | |
| 632 | |
| 633 | |
| 634 | |
| 635 | |
| 636 | |
| 637 | |
| 638 | /// Where along an element a click landed, 0..1. An element that was never |
| 639 | /// painted has no width, and reads as its start rather than as NaN. |
| 640 | pub |
| 641 | |
| 642 | |
| 643 | |
| 644 | |
| 645 | |
| 646 | |
| 647 | /// Where along an element a click landed, in pixels from its own left edge: |
| 648 | /// [`frac_along`] in the units the timeline is drawn in, since a [`Scale`] |
| 649 | /// measures in pixels and not in shares of a bed. Clamped to the element -- a |
| 650 | /// drag that slid off the end names its end -- and an element that was never |
| 651 | /// painted reads as its start. |
| 652 | pub |
| 653 | |
| 654 | |
| 655 | |
| 656 | /// [`px_along`] turned through a right angle, for the lane stack's scrollbar: |
| 657 | /// how far down its track a press landed. |
| 658 | pub |
| 659 | |
| 660 | |
| 661 | |
| 662 | /// One turn of the wheel as a single number, positive for a turn *up*, in |
| 663 | /// whatever units the device sends (a mouse counts lines, a touchpad pixels). |
| 664 | /// A tilt wheel's own axis counts as the same gesture: it is the sideways |
| 665 | /// scroll a mouse that has one sends, and the controls this drives have one |
| 666 | /// direction each, so the two axes are one answer here. |
| 667 | pub |
| 668 | |
| 669 | |
| 670 | |
| 671 | |
| 672 | |
| 673 | |
| 674 | |
| 675 | |
| 676 | |
| 677 | |
| 678 | /// The frame a dropped clip's head lands on: `raw`, unless one of `marks` is |
| 679 | /// within `tol` frames of where its head -- or its tail, `len` frames along -- |
| 680 | /// would come to rest, in which case that edge wins. The snap every timeline |
| 681 | /// has: clips meet exactly instead of a frame apart, and the hand does not have |
| 682 | /// to aim. The nearest mark wins, and a head landing on one beats a tail at the |
| 683 | /// same distance -- what was dragged is the head. |
| 684 | pub |
| 685 | |
| 686 | |
| 687 | |
| 688 | |
| 689 | |
| 690 | |
| 691 | |
| 692 | |
| 693 | |
| 694 | |
| 695 | |
| 696 | |
| 697 | |
| 698 | |
| 699 | |
| 700 | /// The edges worth landing on, off *every* lane: both ends of every clip on the |
| 701 | /// timeline, less `skip` -- the clip being dragged, which does not snap to where |
| 702 | /// it already is -- and less `skip_link`, the group id of whatever is being |
| 703 | /// dragged: its clips travel with it, and so does any caption the id names. |
| 704 | /// `skip` is a lane's place in `lanes` and an index into it; `skip_link` is |
| 705 | /// read off a caption by the caller, whose drag has no clip for `skip` to |
| 706 | /// name. The playhead and the head of the timeline go on the end: a clip meets |
| 707 | /// the cursor and the start of the show as readily as it meets another take. |
| 708 | /// `markers` are the comment markers' edges and the chapter starts, which the |
| 709 | /// caller reads off the project ([`Player::snap_targets`]). |
| 710 | /// |
| 711 | /// All lanes rather than the one being dropped on, because a cut is made across |
| 712 | /// the timeline: a title on V2 lines up with the shot under it, and a sound |
| 713 | /// effect lines up with the frame it belongs to. |
| 714 | pub |
| 715 | |
| 716 | |
| 717 | |
| 718 | |
| 719 | |
| 720 | |
| 721 | |
| 722 | |
| 723 | |
| 724 | |
| 725 | |
| 726 | |
| 727 | |
| 728 | |
| 729 | |
| 730 | |
| 731 | |
| 732 | |
| 733 | |
| 734 | |
| 735 | |
| 736 | |
| 737 | |
| 738 | |
| 739 | |
| 740 | |
| 741 | |
| 742 | |
| 743 | |
| 744 | |
| 745 | |
| 746 | |
| 747 | |
| 748 | |
| 749 | |
| 750 | /// [`snapped`], and the mark that pulled it there -- the line the bed draws |
| 751 | /// while the hand is still moving. `None` when nothing was near enough: a line |
| 752 | /// standing over open bed would promise a landing that is not going to happen. |
| 753 | /// The head is read before the tail, exactly as [`snapped`] prefers it. |
| 754 | /// |
| 755 | /// `on` is the switch ([`ActionId::ToggleSnap`]): off, the gesture lands raw and |
| 756 | /// draws no line at all, which is the whole point of being able to turn it off. |
| 757 | pub |
| 758 | |
| 759 | |
| 760 | |
| 761 | |
| 762 | |
| 763 | |
| 764 | |
| 765 | |
| 766 | |
| 767 | |
| 768 | |
| 769 | |
| 770 | |
| 771 | |
| 772 | |
| 773 | |
| 774 | /// Whether the magnet is on for the gesture in flight: the switch, unless |
| 775 | /// `alt` is held -- the temporary override Resolve, Premiere and Final Cut all |
| 776 | /// put on that key, off for this one drag and leaving the switch where the hand |
| 777 | /// left it. [`Player::snap_live`]'s whole rule, here so it can be read without |
| 778 | /// a window. |
| 779 | pub |
| 780 | |
| 781 | |
| 782 | |
| 783 | /// Where a drag lands and the mark that pulled it there: the frame under the |
| 784 | /// pointer, less however far into the box the hand grabbed it (so a clip travels |
| 785 | /// with the pointer rather than jumping its head under it), snapped by |
| 786 | /// [`snap_cue`]. One answer, asked by the shadow drawn in flight |
| 787 | /// ([`Player::preview_ghost`]), by the line ([`Player::preview_drop`]) and by |
| 788 | /// the drop that commits ([`Player::move_clip`]) -- which is what makes the |
| 789 | /// promise and the landing the same frame. |
| 790 | pub |
| 791 | |
| 792 | |
| 793 | |
| 794 | |
| 795 | |
| 796 | |
| 797 | |
| 798 | |
| 799 | |
| 800 | |
| 801 | /// Where a clip `len` frames long, let go over *another* lane with its head |
| 802 | /// asked at `at`, really comes to rest -- `None` when the engine refuses the |
| 803 | /// drop outright. A mirror of [`Project::move_room`]: the release is refused |
| 804 | /// only when the asked head sits *inside* a take already there (a clamp has no |
| 805 | /// answer for that), or when the gap it names is narrower than the clip; |
| 806 | /// otherwise the head is clamped into that gap exactly as a same-lane move is |
| 807 | /// ([`gap_clamp`]). `others` is `(start, end)` of every clip already on the |
| 808 | /// destination lane, less the ones travelling with this one. |
| 809 | /// |
| 810 | /// The shadow reads this, so a landing the release *will* make is never drawn |
| 811 | /// as refused -- a whole-span overlap test refuses far more than the engine |
| 812 | /// does, and a shadow that lies about a refusal reads as a broken timeline. |
| 813 | pub |
| 814 | |
| 815 | |
| 816 | |
| 817 | |
| 818 | |
| 819 | |
| 820 | |
| 821 | |
| 822 | |
| 823 | |
| 824 | |
| 825 | |
| 826 | |
| 827 | |
| 828 | |
| 829 | |
| 830 | /// Where a clip staying on its own lane really comes to rest: `want`, clamped |
| 831 | /// into the gap it is sitting in -- the take behind it and the take in front of |
| 832 | /// it are walls ([`Project::move_selection`] clamps the delta by exactly these, |
| 833 | /// it does not refuse), so a clip dragged hard left past its neighbour lands |
| 834 | /// flush against that neighbour's tail rather than nowhere. `now` is its head |
| 835 | /// today, which is what names the gap. The shadow reads this, so the box drawn |
| 836 | /// in flight is the box the release leaves behind. |
| 837 | pub |
| 838 | |
| 839 | |
| 840 | |
| 841 | |
| 842 | |
| 843 | |
| 844 | |
| 845 | |
| 846 | |
| 847 | |
| 848 | |
| 849 | |
| 850 | |
| 851 | |
| 852 | |
| 853 | /// The lane a release lands on when the pointer is off the rows themselves: |
| 854 | /// the row under it while its kind can hold what is in the hand, and otherwise |
| 855 | /// the last one that could -- a picture clip carried down across A1 on its way |
| 856 | /// to the empty bench below is still aiming at V1. [`Player::drag_lane`]'s |
| 857 | /// whole rule. |
| 858 | pub |
| 859 | |
| 860 | |
| 861 | |
| 862 | |
| 863 | |
| 864 | |
| 865 | /// Why this file may not go on that lane, in the words the refusal is told in -- |
| 866 | /// `None` when it may. A file with no picture belongs on an audio lane and |
| 867 | /// nowhere else, and a still is silent, so an audio lane is the one place it |
| 868 | /// cannot go. Asked twice: by the ghost tinting itself as refused on the way |
| 869 | /// down, and by the insert that commits ([`Player::insert_source`]), so what is |
| 870 | /// shown as impossible is exactly what is refused. |
| 871 | /// |
| 872 | /// `has_video` is [`Player::has_video`]'s answer for `path`: the probed truth |
| 873 | /// where the header has been read, and an extension's guess otherwise -- never |
| 874 | /// `engine::is_audio` alone, which a song muxed into an `.mp4` lies to. |
| 875 | pub |
| 876 | |
| 877 | |
| 878 | |
| 879 | |
| 880 | |
| 881 | |
| 882 | |
| 883 | |
| 884 | |
| 885 | |
| 886 | |
| 887 | |
| 888 | |
| 889 | |
| 890 | |
| 891 | |
| 892 | |
| 893 | |
| 894 | /// What a three-point edit needs to know, gathered from the window so the plan |
| 895 | /// itself ([`plan_source_edit`]) is arithmetic and can be tested without one. |
| 896 | pub |
| 897 | |
| 898 | |
| 899 | |
| 900 | |
| 901 | |
| 902 | |
| 903 | |
| 904 | |
| 905 | |
| 906 | |
| 907 | |
| 908 | |
| 909 | |
| 910 | |
| 911 | |
| 912 | |
| 913 | |
| 914 | |
| 915 | |
| 916 | |
| 917 | /// The three-point edit the keys ask for: where it lands (`at`, a frame) and |
| 918 | /// the `(lane, clip)` halves of the take. |
| 919 | /// |
| 920 | /// Where: the timeline's in mark when one is set, else the playhead. How long: |
| 921 | /// the source's marked in..out when it has an out mark; else the timeline's |
| 922 | /// in..out length when that is set (the classic three-point: source in plus a |
| 923 | /// timeline range); else to the end of the file. A still takes no marks and |
| 924 | /// shows for the timeline range, else five seconds. Lanes: the first unlocked |
| 925 | /// video lane for the picture and the first unlocked audio lane for the sound, |
| 926 | /// whichever halves the source has. |
| 927 | pub |
| 928 | |
| 929 | |
| 930 | |
| 931 | |
| 932 | |
| 933 | |
| 934 | |
| 935 | |
| 936 | |
| 937 | |
| 938 | |
| 939 | |
| 940 | |
| 941 | |
| 942 | |
| 943 | |
| 944 | |
| 945 | |
| 946 | |
| 947 | |
| 948 | |
| 949 | |
| 950 | |
| 951 | |
| 952 | |
| 953 | |
| 954 | |
| 955 | |
| 956 | |
| 957 | |
| 958 | |
| 959 | |
| 960 | |
| 961 | |
| 962 | |
| 963 | |
| 964 | |
| 965 | |
| 966 | /// Where down an element a pointer sits, 0..1 from the top: the vertical twin |
| 967 | /// of [`frac_along`], for the equalizer, whose gain axis is the y one. An |
| 968 | /// element that was never painted reads as its middle -- flat, the one answer |
| 969 | /// that changes nothing -- rather than as a full boost. |
| 970 | pub |
| 971 | |
| 972 | |
| 973 | |
| 974 | |
| 975 | |
| 976 | |
| 977 | |
| 978 | |
| 979 | |
| 980 | |
| 981 | |
| 982 | |
| 983 | |
| 984 | |
| 985 | |
| 986 | |
| 987 | |
| 988 | |
| 989 | |
| 990 | |
| 991 | |
| 992 | |
| 993 | |
| 994 | |
| 995 | |
| 996 | |
| 997 | |
| 998 | |
| 999 | |
| 1000 | |
| 1001 | |
| 1002 | |
| 1003 | |
| 1004 | |
| 1005 | |
| 1006 | |
| 1007 | |
| 1008 | |
| 1009 | |
| 1010 | |
| 1011 | |
| 1012 | |
| 1013 | |
| 1014 | |
| 1015 | |
| 1016 | |
| 1017 | |
| 1018 | |
| 1019 | |
| 1020 | |
| 1021 | |
| 1022 | |
| 1023 | |
| 1024 | |
| 1025 | |
| 1026 | |
| 1027 | |
| 1028 | |
| 1029 | |
| 1030 | |
| 1031 | |
| 1032 | |
| 1033 | |
| 1034 | |
| 1035 | |
| 1036 | |
| 1037 | |
| 1038 | |
| 1039 | |
| 1040 | |
| 1041 | |
| 1042 | |
| 1043 | |
| 1044 | |
| 1045 | |
| 1046 | |
| 1047 | |
| 1048 | |
| 1049 | |
| 1050 | |
| 1051 | |
| 1052 | |
| 1053 | |
| 1054 | |
| 1055 | |
| 1056 | |
| 1057 | |
| 1058 | |
| 1059 | |
| 1060 | |
| 1061 | |
| 1062 | |
| 1063 | |
| 1064 | |
| 1065 | |
| 1066 | |
| 1067 | |
| 1068 | |
| 1069 | |
| 1070 | |
| 1071 | |
| 1072 | |
| 1073 | |
| 1074 | |
| 1075 | |
| 1076 | |
| 1077 | |
| 1078 | |
| 1079 | |
| 1080 | |
| 1081 | |
| 1082 | |
| 1083 | |
| 1084 | |
| 1085 | |
| 1086 | |
| 1087 | |
| 1088 | |
| 1089 | |
| 1090 | |
| 1091 | |
| 1092 | |
| 1093 | |
| 1094 | |
| 1095 | |
| 1096 | |
| 1097 | |
| 1098 | |
| 1099 | |
| 1100 | |
| 1101 | |
| 1102 | |
| 1103 | |
| 1104 | |
| 1105 | |
| 1106 | |
| 1107 | |
| 1108 | |
| 1109 | |
| 1110 | |
| 1111 | |
| 1112 | |
| 1113 | |
| 1114 | |
| 1115 | |
| 1116 | |
| 1117 | |
| 1118 | |
| 1119 | |
| 1120 | |
| 1121 | |
| 1122 | |
| 1123 | |
| 1124 | |
| 1125 | |
| 1126 | |
| 1127 | |
| 1128 | |
| 1129 | |
| 1130 | |
| 1131 | |
| 1132 | |
| 1133 | |
| 1134 | |
| 1135 | |
| 1136 | |
| 1137 | |
| 1138 | |
| 1139 | |
| 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 | |
| 1250 | |
| 1251 | |
| 1252 | |
| 1253 | |
| 1254 | |
| 1255 | |
| 1256 | |
| 1257 | |
| 1258 | |
| 1259 | |
| 1260 | |
| 1261 | |
| 1262 | |
| 1263 | |
| 1264 | |
| 1265 | |
| 1266 | |
| 1267 | |
| 1268 | |
| 1269 | |
| 1270 | |
| 1271 | |
| 1272 | |
| 1273 | |
| 1274 | |
| 1275 | |
| 1276 | |
| 1277 | |
| 1278 | |
| 1279 | |
| 1280 | |
| 1281 | |
| 1282 | |
| 1283 | |
| 1284 | |
| 1285 | |
| 1286 | |
| 1287 | |
| 1288 | |
| 1289 | |
| 1290 | |
| 1291 | |
| 1292 | |
| 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 |