edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBff99ad6Tahinli6 days ago1055 commits
| 1 | //! The edit toolbar (REDESIGN §3.4, DESIGN.md §6.4): the row of editing commands |
| 2 | //! that sits at the top of the bench, directly above the lanes. `stance.rs::bench()` |
| 3 | //! mounts it and spends its height out of the bench's own box, so nothing is |
| 4 | //! reserved twice: the seam drag, the floor and the lanes all read the one |
| 5 | //! [`TOOLBAR_H`]. |
| 6 | //! |
| 7 | //! Groups, left to right, separated by 1px rules: split, delete and lift; undo |
| 8 | //! and redo; snap and the two marks. Then, pushed right, zoom out, a zoom |
| 9 | //! slider, zoom in and Fit. Export lives on the menu bar now. |
| 10 | //! |
| 11 | //! Every button is an icon and a word (Split, Delete, Lift, Undo, Redo, Snap, |
| 12 | //! In, Out, Fit) -- never a key: the key is in the tooltip, read from the |
| 13 | //! keymap. Below [`COMPACT_BELOW`] the second and third groups drop their words |
| 14 | //! and keep their icons, so nothing is ever clipped. A button the oracle |
| 15 | //! refuses is drawn dim with the reason as its tooltip; a click still goes |
| 16 | //! through [`Player::act`], which says the same reason as a notice. |
| 17 | |
| 18 | use crate; |
| 19 | use cratehitmap; |
| 20 | use crateIcon; |
| 21 | use crate; |
| 22 | use cratetimeband_stance; |
| 23 | use crate; |
| 24 | use crate; |
| 25 | use crate::*; |
| 26 | |
| 27 | /// The zoom slider's track, end to end, in px. |
| 28 | const ZOOM_TRACK_W: f32 = 120.; |
| 29 | /// The slider's thumb, square. |
| 30 | const ZOOM_THUMB: f32 = 12.; |
| 31 | |
| 32 | /// Below this column width the second and third groups (undo, redo, snap, the |
| 33 | /// marks) keep only their icons (the word stays in the tooltip), so the zoom |
| 34 | /// group always fits. Measured at 1280x720 (column 958 px): all words need |
| 35 | /// about 1010 px, the compact row about 730. |
| 36 | const COMPACT_BELOW: f32 = 900.; |
| 37 | |
| 38 | /// Below this the zoom slider's track is [`ZOOM_TRACK_TIGHT_W`] wide. |
| 39 | const TIGHT_BELOW: f32 = 1100.; |
| 40 | const ZOOM_TRACK_TIGHT_W: f32 = 60.; |
| 41 | |
| 42 | /// Whether the column is narrow enough that buttons shed their key. |
| 43 | pub |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | /// The zoom track's width at the column's current width. |
| 49 | /// One recorded box per tab (the anchor registry is keyed by static names), so a tab's menu can |
| 50 | /// hang from the tab that was pressed. |
| 51 | const SEQ_TAB_ANCHORS: = ; |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | /// The drag payload that carries a zoom-slider gesture. Only its type matters: |
| 59 | /// `on_drag_move::<ZoomDrag>` is how the slider hears the pointer after the |
| 60 | /// press, with no state kept on [`Player`] for it. |
| 61 | |
| 62 | ; |
| 63 | |
| 64 | /// The toolbar region: the button row over the sequence strip, full width of the centre column. |
| 65 | pub |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | /// The sequence strip (REDESIGN §3.5): one tab per sequence, the open one marked |
| 78 | /// with a 2px accent underline, a plus for a new one, and the way back out of a |
| 79 | /// compound clip with the path in. A fixed height whatever it holds, drawn with |
| 80 | /// one sequence too, so nothing moves when a second appears. |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 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 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | |
| 209 | |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 | |
| 218 | |
| 219 | |
| 220 | |
| 221 | /// A name while it is being typed: a text field in the name's own place, with the accent edge the |
| 222 | /// other fields wear, the name selected when it is all selected (a rename that has not been typed |
| 223 | /// into yet) and the caret after it otherwise. Shared by the sequence tabs and the markers card. |
| 224 | pub |
| 225 | |
| 226 | |
| 227 | |
| 228 | |
| 229 | |
| 230 | |
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | |
| 240 | |
| 241 | |
| 242 | |
| 243 | |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | |
| 250 | |
| 251 | /// The toolbar's button row. |
| 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 | /// A 1px rule between two groups, 16px tall with 8px of margin. |
| 287 | |
| 288 | |
| 289 | |
| 290 | |
| 291 | |
| 292 | |
| 293 | |
| 294 | |
| 295 | |
| 296 | /// One command: a ghost button with its icon and (at wide widths) its word, never |
| 297 | /// its key. `on` is the toggle state (Snap): accent icon on an `e3` fill. Always |
| 298 | /// dispatches through [`Player::act`] so a refused press still says why; draws |
| 299 | /// dim when the oracle refuses it. |
| 300 | |
| 301 | |
| 302 | |
| 303 | |
| 304 | |
| 305 | |
| 306 | |
| 307 | |
| 308 | |
| 309 | |
| 310 | |
| 311 | |
| 312 | |
| 313 | |
| 314 | |
| 315 | |
| 316 | |
| 317 | |
| 318 | |
| 319 | |
| 320 | |
| 321 | |
| 322 | |
| 323 | |
| 324 | |
| 325 | |
| 326 | |
| 327 | |
| 328 | |
| 329 | |
| 330 | |
| 331 | |
| 332 | /// The hover line a toolbar button wears. Delete and Lift say what they leave behind in the |
| 333 | /// toolbar's own words; every other button has its action's name, as ever. |
| 334 | + use<> |
| 335 | |
| 336 | |
| 337 | |
| 338 | |
| 339 | |
| 340 | |
| 341 | |
| 342 | |
| 343 | /// Where a share of the slider, 0 at the far-out stop and 1 at the far-in one, |
| 344 | /// sits in pixels per second. The scale is logarithmic because a zoom is a |
| 345 | /// multiplier: each equal step of the thumb is the same factor of magnification. |
| 346 | |
| 347 | |
| 348 | |
| 349 | |
| 350 | /// The inverse of [`zoom_at`]: which share of the slider a given zoom sits at. |
| 351 | |
| 352 | |
| 353 | |
| 354 | |
| 355 | |
| 356 | |
| 357 | |
| 358 | /// Zooms the timeline so that the slider reads `share`. Goes through |
| 359 | /// [`Player::zoom`], the one zoom door, so the stops clamp it exactly as they do |
| 360 | /// a key press, and the playhead stays where it was. |
| 361 | |
| 362 | |
| 363 | |
| 364 | |
| 365 | |
| 366 | |
| 367 | |
| 368 | |
| 369 | |
| 370 | |
| 371 | /// The zoom slider: a thumb on a hairline track, showing the timeline's current |
| 372 | /// zoom on every render, and dragged to set it. A bed that has never been |
| 373 | /// painted has no stops yet, so the slider is drawn dim and takes no drag. |
| 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 | |
| 411 | |
| 412 | |
| 413 | |
| 414 | |
| 415 | |
| 416 | |
| 417 | |
| 418 | |
| 419 | |
| 420 | |
| 421 | |
| 422 | |
| 423 | |
| 424 | |
| 425 |