edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBff99ad6Tahinli6 days ago1055 commits
| 1 | //! The window's fixed geometry: what every region is measured in. |
| 2 | |
| 3 | use crate::*; |
| 4 | |
| 5 | /// ...and the narrowest it is drawn: a library row whose length the engine has |
| 6 | /// not measured yet has a landing place but no width, and a head marker says |
| 7 | /// where it goes where a zero-width box would say nothing. |
| 8 | pub const GHOST_MIN: f32 = 2.; |
| 9 | |
| 10 | /// Fixed so the video region takes every pixel the window gains and the controls |
| 11 | /// never clip at 640x360. |
| 12 | |
| 13 | pub const HEADER_H: f32 = 32.; |
| 14 | |
| 15 | /// The menu bar across the top of the room, above the dock and the centre alike |
| 16 | /// (DESIGN §6.1). The room below it is the window less this. |
| 17 | pub const MENU_BAR_H: f32 = 28.; |
| 18 | // 28 button row + 24 scrub strip + two 48 lanes + the timecode line + the gaps |
| 19 | // between them, with a few px of slack so a taller text line cannot push a lane |
| 20 | // off the bottom. The window measures itself from [`timeline_h`] now, so this |
| 21 | // figure is the guards' anchor for it and sits with them. |
| 22 | |
| 23 | pub const PANEL_H: f32 = 220.; |
| 24 | /// How many lane rows are drawn before the lane column starts scrolling: past |
| 25 | /// this the panel would be taller than the picture it belongs under, and a |
| 26 | /// timeline that pushes the video off the window is not a timeline. |
| 27 | pub const LANES_MAX: usize = 6; |
| 28 | pub const LANE_H: f32 = 48.; |
| 29 | /// The label row inside a clip; a waveform paints under it, never through it. |
| 30 | pub const LABEL_H: f32 = 15.; |
| 31 | /// Peak buckets per second of source. Fixed and modest on purpose: `peaks` |
| 32 | /// allocates one bucket per window, so a rate taken from anything the user can |
| 33 | /// influence is an allocation bomb -- and 40 is already finer than the pixels a |
| 34 | /// clip is ever given. |
| 35 | /// |
| 36 | /// corner-cut: "finer than the pixels" stops being true once the timeline is |
| 37 | /// zoomed -- past ~25 ms per bucket the envelope reads as steps rather than as |
| 38 | /// a shape. Ceiling: [`View::max_zoom`]'s 8 frames across the bed. The upgrade |
| 39 | /// is a second, finer pass over the visible span only, cached like `waves` is. |
| 40 | pub const WAVE_BPS: u32 = 40; |
| 41 | /// How many stand-ins may be in flight at once -- the engine's own number, not |
| 42 | /// a second one that happens to agree: the proxy cache sweeps with room left |
| 43 | /// for exactly this many encodes ([`engine::proxy::reserve`]), so a front-end |
| 44 | /// that started more would put the disk past the cap by whatever it added. |
| 45 | pub const PROXIES_AT_ONCE: usize = AT_ONCE; |
| 46 | /// Pixels per envelope column. Coarser than a pixel: the eye reads the shape, |
| 47 | /// and a path with a point per pixel is a path per repaint. |
| 48 | pub const WAVE_COL: f32 = 2.; |
| 49 | /// The most columns one envelope is ever built from. A waveform is drawn into |
| 50 | /// the slice of its box that is on the bed ([`visible_slice`]), and a bed is a |
| 51 | /// screen wide, so nothing on screen ever reaches this -- it is the backstop for |
| 52 | /// a box laid out wider than any screen, whose path would otherwise cost a point |
| 53 | /// per two pixels of a width nobody can see and stall the repaint that was |
| 54 | /// meant to draw the wave. |
| 55 | pub const WAVE_COLS_MAX: usize = 4096; |
| 56 | /// WCAG 2.5.8: nothing clickable is smaller than this. The scrub bar stays 6 px |
| 57 | /// to look at -- `RULER_HIT_H` is the strip that has to be hit. |
| 58 | pub const HIT_MIN: f32 = 24.; |
| 59 | /// The media library's column: a share of the window rather than a fixed width, |
| 60 | /// so it yields on a narrow one, and never more than a third of it -- the |
| 61 | /// picture is what this program is for and keeps the majority at every size. |
| 62 | /// The floor is what a file name and a timecode need to be readable at all. |
| 63 | pub const LIBRARY_FRAC: f32 = 0.2; |
| 64 | pub const LIBRARY_MIN_W: f32 = 120.; |
| 65 | pub const LIBRARY_MAX_W: f32 = 220.; |
| 66 | pub const CONTROL_H: f32 = 28.; |
| 67 | /// The volume slider beside its button: a hundred steps across it, so a pixel |
| 68 | /// is finer than a step and the drag reads as continuous. Cleanse round 2 |
| 69 | /// (2026-09-10) took that slider out of the time band, so the width is only |
| 70 | /// the drag-math guard's own bar now -- it sits with the tests, like |
| 71 | /// [`Volume::label`], rather than in the binary. |
| 72 | |
| 73 | pub const VOLUME_W: f32 = 110.; |
| 74 | pub const RULER_HIT_H: f32 = HIT_MIN; |
| 75 | /// The keybindings card: a row per action, a title and a status line, inside a |
| 76 | /// 360 px tall window. The rows are click targets, so `HIT_MIN` binds them too. |
| 77 | /// Wider than the export card, and for the same reason that one is wider than |
| 78 | /// this used to be: at 320 the longest labels ("Remove the last video track (it |
| 79 | /// must be empty)", before cleanse round 2 cut every label to its verb) ran |
| 80 | /// straight over the stroke printed at the other end of their row. Every label in the registry fits beside its stroke here, and the |
| 81 | /// one that cannot -- a row waiting for a key to be pressed -- truncates rather |
| 82 | /// than overprinting. Still inside the 640 px floor. |
| 83 | pub const KEYS_W: f32 = 480.; |
| 84 | pub const KEYS_ROW_H: f32 = HIT_MIN; |
| 85 | /// The export card is wider than the keybindings one: its rows carry a key, a |
| 86 | /// name *and* what the choice means, and the two summary lines under them state |
| 87 | /// the whole file. At `KEYS_W` every one of those wrapped to two lines, which is |
| 88 | /// the card the user called unfriendly. Still inside the 640 px floor with the |
| 89 | /// scrim showing either side of it. |
| 90 | pub const EXPORT_W: f32 = 420.; |
| 91 | |
| 92 | /// The column a key is printed in, wide enough for `0-9` -- the width the |
| 93 | /// subtitle plan line is still measured against ([`SUB_PLAN_CHARS`]). |
| 94 | pub const EXPORT_KEY_W: f32 = 26.; |
| 95 | /// The menu a right-click on a clip opens: wide enough for the longest label |
| 96 | /// beside the stroke that does the same thing, with the click targets `HIT_MIN` |
| 97 | /// binds like every other list here. |
| 98 | pub const MENU_W: f32 = 280.; |
| 99 | pub const MENU_ROW_H: f32 = 28.; |
| 100 | pub const MENU_PAD: f32 = 6.; |
| 101 | /// The breathing room a hanging menu keeps against every window edge. Without |
| 102 | /// it `menu_at`'s clamp let a menu sit flush on the bottom edge -- the last row |
| 103 | /// touching the frame reads as a list cut off rather than a list that ended, |
| 104 | /// which is what the user saw at 1280x720 (`f-clip-menu.png`, rows running to |
| 105 | /// y=720 exactly). Taken out of the room the list may fill as well as off the |
| 106 | /// clamp, so a floored menu never grows back up over the picture to buy it. |
| 107 | pub const MENU_EDGE: f32 = 4.; |
| 108 | |
| 109 | /// A cue's text, and the line it sits on. Fixed rather than a share of the |
| 110 | /// picture: the video region is 108 px tall at the 640x360 floor and a |
| 111 | /// proportional size there would be unreadable at exactly the size where it has |
| 112 | /// to be read. |
| 113 | pub const SUB_TEXT: f32 = 14.; |
| 114 | pub const SUB_LINE_H: f32 = 18.; |
| 115 | /// How far off the bottom of the picture the plate sits. |
| 116 | pub const SUB_BOTTOM: f32 = 8.; |
| 117 | /// The same, once the transient bars that hang off that bottom edge (import, |
| 118 | /// seek, notice) are `bars_h` tall: the cue steps up over them and comes back |
| 119 | /// down the frame they leave, which is what a player does with its OSD -- the |
| 120 | /// alternative, a notice drawn over the line being read, loses both of them. |
| 121 | /// |
| 122 | /// `bars_h` is *measured* ([`height_probe`]) and never counted: a notice wraps |
| 123 | /// to as many lines as the window is narrow, and any constant here would be |
| 124 | /// right at one width. Nothing hanging there means nothing to step over, so the |
| 125 | /// no-notice position is [`SUB_BOTTOM`] exactly, to the pixel. |
| 126 | pub |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | /// A mark narrower than this is still drawn this wide: a one-frame cue on a |
| 132 | /// zoomed-out bed is worth a fraction of a pixel, and a mark nobody can see says |
| 133 | /// the track is empty. The silence preview's marks are floored by it too -- they |
| 134 | /// are the same kind of thing, a picture of where something is and no target. |
| 135 | pub const SUB_CUE_MIN_W: f32 = 2.; |
| 136 | /// Roughly how wide one character of an 11 px list row is. Generous on purpose: |
| 137 | /// the element truncates for real, and a budget that overshoots would have the |
| 138 | /// element cut the tail off after [`clip_middle`] had already kept it. |
| 139 | pub const LIST_CHAR_W: f32 = 6.; |
| 140 | /// How long the export card's Subtitles line may get before it counts tracks |
| 141 | /// instead of naming them ([`subtitle_plan`]). Three lines of that row's value |
| 142 | /// box, at [`LIST_CHAR_W`] to a character: [`EXPORT_W`] less the row's padding |
| 143 | /// and gap, its tick and [`EXPORT_KEY_W`] key column, and the word "Subtitles" |
| 144 | /// in front of the value. Not a track count -- what walks the Destination row |
| 145 | /// off the bottom of the card is the *wrapping*, and thirty-five one-word |
| 146 | /// labels wrap less than three long ones. |
| 147 | // the subtitle plan line lives in Settings now |
| 148 | pub const SUB_PLAN_CHARS: usize = |
| 149 | |
| 150 | as usize; |
| 151 | |
| 152 | /// The one key name this file still spells out, and gpui's spelling of it: it |
| 153 | /// is the way out of a capture and out of the overlay, and both have to work |
| 154 | /// while the keymap itself is what is being changed -- so neither can go |
| 155 | /// through the keymap to find it. |
| 156 | pub const ESCAPE: &str = "escape"; |
| 157 | |
| 158 | /// How tall a column of `lanes` rows is, gaps included -- the panel's own gap |
| 159 | /// between them, since the rows sit in it. |
| 160 | pub |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | /// The same question for a column whose rows are not one height -- the |
| 168 | /// inspector's sections -- answered in pixels off what the scroll itself |
| 169 | /// reports: how far it may still be taken (`max_offset`) less how far it has |
| 170 | /// been (`offset`, which gpui keeps negative going down). |
| 171 | pub |
| 172 | |
| 173 | |
| 174 | |
| 175 | /// How tall the panel is with `lanes` tracks in it: [`PANEL_H`] is sized for the |
| 176 | /// two a project starts with, and every further one adds its own row -- up to |
| 177 | /// [`LANES_MAX`], past which the lane column scrolls instead and the panel stops |
| 178 | /// growing. Only the guards ask, so it sits with them. |
| 179 | |
| 180 | pub |
| 181 | |
| 182 | |
| 183 | |
| 184 | /// How tall the timeline region is: its own padding, the timecode line, the |
| 185 | /// ruler, the scrollbar strip under the lanes when there is one to draw, and |
| 186 | /// the gaps between them, plus a row per lane. Measured from its parts rather |
| 187 | /// than taken off `PANEL_H` -- the button row moved out of it |
| 188 | /// ([`Player::toolbar`]), and a height still carrying that row's pixels is a |
| 189 | /// height that cuts the last lane off the bottom of the window. |
| 190 | pub |
| 191 | |
| 192 | |
| 193 | |
| 194 | /// 8+8 padding, the timecode line, the 24 px ruler strip and the two 8 px gaps |
| 195 | /// between the three rows, with a couple of px of slack so a taller text line |
| 196 | /// cannot push a lane off the bottom. The scrollbar strip's row is *not* here: |
| 197 | /// the strip comes and goes with the zoom, so its pixels are carried by |
| 198 | /// [`timeline_fixed_h`] alone, where every derivation that must agree with |
| 199 | /// what is drawn reads them together. |
| 200 | pub const TIMELINE_FIXED_H: f32 = 16. + 18. + 8. + RULER_HIT_H + 8. + 4.; |
| 201 | |
| 202 | /// The panel's fixed furniture with its scrollbar strip while the timeline has |
| 203 | /// somewhere to scroll to. With nowhere to go the strip is not drawn -- a bar |
| 204 | /// for a view that cannot move is a bar teaching nothing -- and its row goes |
| 205 | /// with it, out of every budget at once: a height still carrying the row would |
| 206 | /// hand it to the lane column as a bonus at exactly the zoom where the hand is |
| 207 | /// least expecting the bed to move. |
| 208 | // The strip's hit area is the one thing that must stay a target (WCAG 2.5.8), |
| 209 | // however thin its bar is drawn. Checked here because layout is where it is |
| 210 | // spent against the bar, and nothing else reads it at build time. |
| 211 | const _: = assert!; |
| 212 | |
| 213 | /// The scrollbar strip's whole row: 12px with the bar centred in it, so the |
| 214 | /// thumb's drawn bar and the layout's pixels are one number. Taller than the |
| 215 | /// bar needs so the hit band below can stand on the row and the bench's own |
| 216 | /// bottom padding, and never reach the ledger seam under the bench. |
| 217 | pub const SCROLL_ROW_H: f32 = 12.; |
| 218 | const _: = assert!; |
| 219 | |
| 220 | /// How far the strip's hit band reaches above the row, into the bottom of the |
| 221 | /// lanes. The most a scrollbar may take from them: 8px. |
| 222 | pub const SCROLL_HIT_UP: f32 = 8.; |
| 223 | /// How far it reaches below the row: the 4px bottom padding `ui::stance::bench` |
| 224 | /// gives the bench's content, which nothing else hits. The band never goes |
| 225 | /// past the bench's own bottom edge. |
| 226 | pub const SCROLL_HIT_DOWN: f32 = 4.; |
| 227 | // Together the band is a WCAG 2.5.8 target, and it takes no more than 8px |
| 228 | // from the lanes above the row. |
| 229 | const _: = assert! |
| 230 | |
| 231 | |
| 232 | |
| 233 | ; |
| 234 | |
| 235 | pub |
| 236 | |
| 237 | |
| 238 | |
| 239 | |
| 240 | |
| 241 | |
| 242 | |
| 243 | /// The most of a short window the timeline may take, sized so the seam's own |
| 244 | /// floor still fits inside it ([`split_bounds`]): at the 640x360 floor that is |
| 245 | /// 171 px of the 360 -- the chrome with the scrollbar strip in it, one whole |
| 246 | /// lane, and the line saying the rest are below. Left smaller than the floor |
| 247 | /// the floor would win the clamp anyway and this number would say the panel |
| 248 | /// takes less of a short window than it does. The lanes scroll inside whatever |
| 249 | /// is left, which leaves the picture a region rather than a letterbox stripe. |
| 250 | pub const TIMELINE_SHARE: f32 = 171. / 360.; |
| 251 | |
| 252 | /// One edit-toolbar button's height: a 32px target, above the 24px floor |
| 253 | /// ([`HIT_MIN`]) with room for the word and its key (DESIGN §6.4). |
| 254 | pub const TOOLBAR_BTN_H: f32 = 32.; |
| 255 | |
| 256 | /// The edit toolbar directly above the timeline: a button row and 6px of air |
| 257 | /// either side of it. Fixed, and spent once: `stance::bench()` takes it out of |
| 258 | /// the bench's own box, so the lanes get the rest and nothing is reserved twice. |
| 259 | pub const TOOLBAR_ROW_H: f32 = TOOLBAR_BTN_H + 8.; |
| 260 | |
| 261 | /// The strip of sequence tabs under the toolbar row (NLE-style): always there, so |
| 262 | /// opening a second sequence moves nothing. Part of [`TOOLBAR_H`]. |
| 263 | pub const SEQ_BAR_H: f32 = 28.; |
| 264 | /// One sequence tab's height, inside the strip. |
| 265 | pub const SEQ_TAB_H: f32 = HIT_MIN; |
| 266 | |
| 267 | /// The whole region above the lanes: the button row and the sequence strip. Fixed, and spent |
| 268 | /// once: `stance::bench()` takes it out of the bench's own box, so the lanes get the rest. |
| 269 | pub const TOOLBAR_H: f32 = TOOLBAR_ROW_H + SEQ_BAR_H; |
| 270 | |
| 271 | /// One press of a zoom key, or one notch of ctrl+wheel. |
| 272 | pub const ZOOM_STEP: f32 = 1.25; |
| 273 | |
| 274 | /// How far one notch of a bare wheel slides the view along, as a share of what |
| 275 | /// is on the bed. A *share* rather than a number of pixels or of seconds: one |
| 276 | /// gesture then moves the same fraction of what is being looked at whether the |
| 277 | /// bed is showing five seconds or five hours, which is the only way a wheel is |
| 278 | /// usable at both ends of the zoom. |
| 279 | pub const SCROLL_NOTCH_SHARE: f32 = 0.1; |
| 280 | |
| 281 | /// How few frames the bed may be narrowed down to. Past this there is nothing |
| 282 | /// left to aim at -- a single frame across a whole window is a wall of colour, |
| 283 | /// not an edit surface. |
| 284 | pub const ZOOM_MIN_FRAMES: f64 = 8.; |
| 285 | |
| 286 | /// How thin a second of timeline may be drawn on a bed that is already showing |
| 287 | /// all of it: the far stop for a *short* project, which has no length of its own |
| 288 | /// worth widening to, so a five second import can still be zoomed out of. |
| 289 | pub const PPS_MIN: f64 = 1.; |
| 290 | |
| 291 | /// How much bed the far stop leaves past the last frame, as a multiple of the |
| 292 | /// timeline's own length -- so a timeline zoomed all the way out ends a sliver |
| 293 | /// short of the window's edge rather than glued to it. |
| 294 | pub const ZOOM_OUT_MARGIN: f64 = 1.05; |
| 295 | |
| 296 | /// How wide a second of timeline is drawn before anyone zooms: a five second |
| 297 | /// import is 300 px of a bed several times that, so a short clip reads as |
| 298 | /// short -- the thing a bed scaled to the content's own length cannot say. |
| 299 | /// [`View::fit`] is the one way back to "the whole timeline across the bed". |
| 300 | pub const PPS_DEFAULT: f64 = 60.; |
| 301 | |
| 302 | // -- the seams between the regions, and where a hand has dragged them --------- |
| 303 | |
| 304 | /// Which divider a hand has hold of. The legacy tree's three seams -- |
| 305 | /// library|picture, picture|inspector and the timeline's top edge -- plus the |
| 306 | /// darkroom's own two, dock|centre and time-band|bench: `stance.rs`'s own |
| 307 | /// `BENCH_H`/`DOCK_W` doc comments named this exact fold as the fix for |
| 308 | /// "fields are not stretchable" before this diff existed. |
| 309 | |
| 310 | pub |
| 311 | |
| 312 | |
| 313 | |
| 314 | |
| 315 | |
| 316 | |
| 317 | |
| 318 | |
| 319 | |
| 320 | |
| 321 | |
| 322 | |
| 323 | |
| 324 | |
| 325 | |
| 326 | |
| 327 | |
| 328 | |
| 329 | |
| 330 | |
| 331 | |
| 332 | |
| 333 | |
| 334 | |
| 335 | |
| 336 | |
| 337 | |
| 338 | |
| 339 | |
| 340 | |
| 341 | |
| 342 | |
| 343 | |
| 344 | /// How wide a divider is drawn *and* hit. Wider than the 1 px stroke it stands |
| 345 | /// in for: a seam nobody can put a pointer on is a seam nobody can drag, which |
| 346 | /// is why every editor that ships this draws a strip rather than the hairline |
| 347 | /// it looks like. |
| 348 | pub const SPLIT_W: f32 = 6.; |
| 349 | |
| 350 | /// How wide the same seam is *aimed at*. The strip above is what the layout |
| 351 | /// spends and the hairline is what the eye is given; this is the band the hand |
| 352 | /// gets, hung one row above the strip and overlaid on the two panels it parts, |
| 353 | /// so growing it moves nothing. 6 px asked the hand for precision it does not |
| 354 | /// have -- the lead's own press one row into the bench missed the seam by 5 px |
| 355 | /// and focused the bench instead ("panes should be enlargable and shrinkable", |
| 356 | /// of panes that already resized). 24 px is [`HIT_MIN`] (WCAG 2.5.8), the same |
| 357 | /// floor every pointer target holds (DESIGN §4.3). It is hung one row above the |
| 358 | /// strip rather than centred on it: what a hand aims at is the line it can see |
| 359 | /// (the panel's own edge at the strip's far side), not the transparent pixels |
| 360 | /// in front of it. |
| 361 | pub const GRAB_W: f32 = HIT_MIN; |
| 362 | |
| 363 | /// The bench seam's own band. It used to be deeper than [`GRAB_W`] because |
| 364 | /// what lay under the seam was `ui::stance::bench`'s own section head -- 24 px |
| 365 | /// with nothing in it to press, so the band reached down through it. That head |
| 366 | /// is gone (cleanse round 2): the ruler row is the bench's top edge now, and |
| 367 | /// the ruler *is* pressable (it scrubs). Every seam now takes the same |
| 368 | /// [`GRAB_W`] band, so the bench reaches exactly as far as every other seam |
| 369 | /// does: `-1 .. +23` of strip, `-7 .. +17` of the seam. |
| 370 | pub const BENCH_GRAB_H: f32 = GRAB_W; |
| 371 | |
| 372 | /// The most of the window one side column may be dragged to. A third each, so |
| 373 | /// the picture keeps the middle at every size -- the rule [`library_w`] and |
| 374 | /// [`inspector_w`] already lay an untouched window out by, kept once the hand |
| 375 | /// takes over. |
| 376 | pub const SIDE_MAX_FRAC: f32 = 1. / 3.; |
| 377 | |
| 378 | /// The least the dock may be dragged to (DESIGN §5: 280px). Its own floor, |
| 379 | /// not the legacy inspector's [`INSPECTOR_MIN_W`]: the two columns share a |
| 380 | /// ceiling but not a minimum. |
| 381 | pub const DOCK_MIN_W: f32 = 280.; |
| 382 | |
| 383 | /// The timeline block's untouched share of the window's height (DESIGN §5: |
| 384 | /// "about 42%"), from the edit toolbar down to the lanes. Clamped by |
| 385 | /// [`split_bounds`] like any other default, and a remembered hand still wins. |
| 386 | pub const BENCH_SHARE: f32 = TIMELINE_SHARE; |
| 387 | |
| 388 | /// The same, on a window shorter than 800 px (REDESIGN §2.2, §10): the picture keeps what the |
| 389 | /// 240 px floor leaves it and the timeline takes the rest, so four lanes show with the title row. |
| 390 | pub const BENCH_SHARE_SHORT: f32 = 0.55; |
| 391 | |
| 392 | /// The untouched timeline share for a window `h` px tall. |
| 393 | pub |
| 394 | |
| 395 | |
| 396 | |
| 397 | /// The most of the window the timeline may be dragged to. Past |
| 398 | /// [`TIMELINE_SHARE`], which is what it is *given*: a hand asking for a tall |
| 399 | /// timeline is asking on purpose, and the picture still keeps most of a third. |
| 400 | pub const TIMELINE_MAX_SHARE: f32 = 0.7; |
| 401 | |
| 402 | /// The room the ledger's own top border (`ui::stance::ledger`'s |
| 403 | /// `.border_t_1()`) needs kept clear below the bench's own last content |
| 404 | /// pixel. The ledger sits at a *fixed* distance from the window's own foot |
| 405 | /// (`ui::stance::LEDGER_H`), not from wherever the bench's content happens |
| 406 | /// to end, so if the bench's last lane row reaches exactly as far as the |
| 407 | /// ledger's own top row, the ledger's border -- later in the same flex |
| 408 | /// column, so it paints over whatever is already there -- wins the shared |
| 409 | /// pixel rather than sitting cleanly below it. Driven, at [`BENCH_MIN_H`]'s |
| 410 | /// own third clip: `bench=95` (the stack's exact content need, no spare row) |
| 411 | /// still lost A1's status dot's last row to the rule; `bench=96` (one row of |
| 412 | /// clearance) drew it whole. The 95-vs-96 tension is this term, not a |
| 413 | /// rounding accident -- a bench exactly as tall as its content still shares |
| 414 | /// its last row with the ledger's border. |
| 415 | const LEDGER_SEAM_CLEARANCE: f32 = 1.; |
| 416 | |
| 417 | /// The least the darkroom's bench may be dragged to: derived, not measured, |
| 418 | /// from the same stack `ui::stance::bench` and `ui::bench_stance::render` |
| 419 | /// actually build, top to bottom -- |
| 420 | /// [`crate::ui::stance::BENCH_CHROME_H`] (the "bench" section head's real |
| 421 | /// line box, plus the bench div's own top border and top padding -- see its |
| 422 | /// own doc comment) + [`crate::ui::bench_stance::RULER_H`] (the pinned |
| 423 | /// ruler) + [`crate::ui::bench_stance::ROW_GAP`] (the gap `bench-content`'s |
| 424 | /// flex column puts between the ruler and the lane column) + two lane rows |
| 425 | /// at [`crate::ui::bench_stance::LANE_MIN_H`] each (the darkroom's own floor |
| 426 | /// of two lanes -- V1, A1, `bench_stance::render`'s own no-session |
| 427 | /// fallback) + one more `ROW_GAP` between those two rows (`bench-lanes`'s |
| 428 | /// own flex gap) + [`LEDGER_SEAM_CLEARANCE`] (the row the ledger's own |
| 429 | /// border needs kept clear, see its own doc comment). Below this the |
| 430 | /// `bench-lanes` column asks for more height than `bench-content`'s flex_1 |
| 431 | /// gives it, and since that column scrolls rather than clips visibly, the |
| 432 | /// shortfall comes off the bottom row's own pixels unscrolled -- A1's |
| 433 | /// clip-bar border and status dot, first. Lanes are not even rows any more: |
| 434 | /// each has its own height (`bench_stance::lane_height`), and a stack taller |
| 435 | /// than the box just scrolls. The floor still gives the default two lanes |
| 436 | /// their minimum, so V1 and A1 are whole at the least the bench may be. |
| 437 | /// `LANE_MIN_H` is checked against what a lane head actually draws |
| 438 | /// (`a_lane_row_fits_what_its_own_head_draws`). |
| 439 | /// |
| 440 | /// With the 18/15/14-13/12/10px type scale, the same derivation uses a 24px |
| 441 | /// chrome block and two 28px lane floors: |
| 442 | /// `24 + 22 + 2 + 56 + 2 + 1` = `107.`. |
| 443 | pub const BENCH_MIN_H: f32 = crateBENCH_CHROME_H |
| 444 | + TOOLBAR_H |
| 445 | + cratechrome_h |
| 446 | + 2. * crateLANE_MIN_H |
| 447 | + crateROW_GAP |
| 448 | + LEDGER_SEAM_CLEARANCE; |
| 449 | |
| 450 | /// What a hand has done to the three seams: the size it dragged each panel to, |
| 451 | /// or `None` where nobody has touched one and the window's own share still |
| 452 | /// answers. Held in the model and not recomputed, so a size outlives the |
| 453 | /// release -- and read through [`split_size`], so it cannot outlive the window |
| 454 | /// it was set in. |
| 455 | |
| 456 | pub |
| 457 | |
| 458 | |
| 459 | |
| 460 | |
| 461 | |
| 462 | |
| 463 | |
| 464 | |
| 465 | |
| 466 | |
| 467 | |
| 468 | |
| 469 | |
| 470 | |
| 471 | |
| 472 | |
| 473 | |
| 474 | |
| 475 | |
| 476 | |
| 477 | |
| 478 | |
| 479 | |
| 480 | |
| 481 | |
| 482 | |
| 483 | |
| 484 | |
| 485 | |
| 486 | |
| 487 | |
| 488 | |
| 489 | |
| 490 | |
| 491 | |
| 492 | |
| 493 | |
| 494 | |
| 495 | |
| 496 | |
| 497 | |
| 498 | /// Where every seam's dragged size lives. Same small, silent round trip as |
| 499 | /// [`crate::ui::dock_stance`]'s tab pick: unreadable or absent leaves a seam |
| 500 | /// `None`, which [`split_size`] already reads as "give it the window's own |
| 501 | /// share". |
| 502 | pub |
| 503 | |
| 504 | |
| 505 | |
| 506 | pub |
| 507 | |
| 508 | |
| 509 | |
| 510 | /// One `split=pixels` line per touched seam, read from `path` -- factored out |
| 511 | /// of [`load_stance_splits`] so a test can round-trip a scratch file instead |
| 512 | /// of the real config. `window` is the size the layout is about to be drawn |
| 513 | /// at -- a file written by a wider or taller window can hold a seam past |
| 514 | /// this one's own ceiling, so each value is clamped to it here, before it |
| 515 | /// ever reaches [`Splits`]. [`split_size`] still re-clamps every frame on |
| 516 | /// top of this, but that clamp needs a lane count and a scroll state |
| 517 | /// nothing here has yet; this one runs on the three bounds that do not -- |
| 518 | /// [`SIDE_MAX_FRAC`], [`TIMELINE_MAX_SHARE`] and [`BENCH_MIN_H`] -- so a |
| 519 | /// value this open never reaches even the first frame. |
| 520 | pub |
| 521 | |
| 522 | |
| 523 | |
| 524 | |
| 525 | |
| 526 | |
| 527 | |
| 528 | |
| 529 | |
| 530 | |
| 531 | |
| 532 | |
| 533 | |
| 534 | |
| 535 | |
| 536 | |
| 537 | |
| 538 | |
| 539 | |
| 540 | |
| 541 | |
| 542 | |
| 543 | |
| 544 | |
| 545 | /// Writes the sizes a hand has actually dragged, one line per seam a hand |
| 546 | /// has touched. Walks [`Split::PERSISTED`] rather than a hand-written `if let` per field, |
| 547 | /// so a region added there needs no second, separately-maintained list here. |
| 548 | pub |
| 549 | |
| 550 | |
| 551 | |
| 552 | pub |
| 553 | |
| 554 | |
| 555 | |
| 556 | |
| 557 | |
| 558 | |
| 559 | |
| 560 | |
| 561 | |
| 562 | |
| 563 | |
| 564 | |
| 565 | |
| 566 | |
| 567 | /// How small a panel may be dragged and how large: the floor is the size it |
| 568 | /// still shows something at, the ceiling is what its neighbour needs to stay a |
| 569 | /// region rather than a sliver. Neither end is passable -- a panel dragged to |
| 570 | /// nothing is a panel nobody can get back, and a picture squeezed out by two |
| 571 | /// side columns is the same loss on the other side of the window. |
| 572 | pub |
| 573 | |
| 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 | pub |
| 629 | |
| 630 | |
| 631 | |
| 632 | |
| 633 | |
| 634 | |
| 635 | |
| 636 | |
| 637 | |
| 638 | |
| 639 | |
| 640 | |
| 641 | |
| 642 | |
| 643 | |
| 644 | |
| 645 | |
| 646 | |
| 647 | |
| 648 | |
| 649 | |
| 650 | /// Where a divider drag puts the panel it belongs to: the pointer's position |
| 651 | /// turned into that panel's size. Half a strip is taken off each answer because |
| 652 | /// the strip is grabbed by its middle -- without it the panel jumps a strip's |
| 653 | /// width on the press and then trails the pointer for the rest of the gesture. |
| 654 | pub |
| 655 | |
| 656 | |
| 657 | |
| 658 | |
| 659 | |
| 660 | |
| 661 | |
| 662 | |
| 663 | |
| 664 | |
| 665 | |
| 666 | |
| 667 | |
| 668 | |
| 669 | |
| 670 | |
| 671 | |
| 672 | |
| 673 | |
| 674 | |
| 675 | |
| 676 | |
| 677 | |
| 678 | |
| 679 | |
| 680 | |
| 681 | |
| 682 | |
| 683 | |
| 684 | |
| 685 | |
| 686 | |
| 687 | |
| 688 | |
| 689 | |
| 690 | |
| 691 | |
| 692 | |
| 693 | |
| 694 | /// REDESIGN §1.2 / §2 geometry, the numbers later phases adopt region by region. |
| 695 | /// New names beside the old ones on purpose: P1 only defines them, P2 (timeline) |
| 696 | /// and P3 (chrome) switch their layouts over and then delete the legacy twins. |
| 697 | |
| 698 | pub |
| 699 | |
| 700 | |
| 701 | |
| 702 | |
| 703 | |
| 704 | |
| 705 | |
| 706 | |
| 707 | |
| 708 | |
| 709 | |
| 710 | |
| 711 | |
| 712 | |
| 713 | |
| 714 | |
| 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 | |
| 751 | |
| 752 | |
| 753 | |
| 754 | |
| 755 | |
| 756 | |
| 757 | |
| 758 | |
| 759 | |
| 760 | |
| 761 | |
| 762 |