forge
Explore
Log in

Don't you dare go Hollow

Four defect classes made impossible instead of tested

Browse files at this commit

5909fc91e48dce0664793f9c152e578fe58c8a6dAhmet Kaan GümüşParent: 00fea7e
  • fix
    • four defect classes made impossible instead of tested
Show full message
🛡️ fix(ui): four defect classes made impossible instead of tested

The action list is one list now: a `macro_rules!` writes the enum and
`ActionId::ALL` from the same names, so a variant added with `ALL`
untouched -- which compiled, passed and dropped the action off the keys
card -- cannot be written any more.

The reachability guard reads `keymap::FIXED` too: every card-local
stroke names the element a pointer presses instead, or says in the type
(`Reach::Gesture`) that there is nothing to press. `g` and `r` on the
export card were keyboard-only while the card advertised them, and are
rows of their own now.

Trim strips are suppressed under three handles of clip: a jumpcut's
short clips were 100% handle, so nothing could select or drag them.

The codec row's chord comes off `FORMATS` (it said six keys for the
seven codecs its label named -- OGG's `o` was invisible), and the panel's
button row carries a pinned door beside the scrolling part, since "it
scrolls" is not "it can be found" at the 640x360 floor.
crates/app/src/keymap.rsmodified+289 -213
@@ -36,10 +36,31 @@ use std::path::{Path, PathBuf};
3636 /// First line, exactly. The version is part of it, as in the project file.
3737 const MAGIC: &str = "edith-keys 1";
3838
39-/// Everything a stroke can ask for. Not the mouse's actions: only what a key
40-/// can reach is bindable.
41-#[derive(Clone, Copy, PartialEq, Eq, Debug)]
42-pub enum ActionId {
39+/// The action list, written once: the enum and the display-order array come out
40+/// of the same names, so an action added here is in [`ActionId::ALL`] by
41+/// construction. It used to be two lists, and a variant added to one of them
42+/// compiled, passed every test, and was simply missing from the keys card --
43+/// the pointer-unreachable action this editor opened with.
44+macro_rules! actions {
45+ ($($(#[$note:meta])* $variant:ident),+ $(,)?) => {
46+ /// Everything a stroke can ask for. Not the mouse's actions: only what a
47+ /// key can reach is bindable.
48+ #[derive(Clone, Copy, PartialEq, Eq, Debug)]
49+ pub enum ActionId {
50+ $($(#[$note])* $variant,)+
51+ }
52+
53+ impl ActionId {
54+ /// Display order everywhere -- the editor lists them in it and
55+ /// [`Keymap::defaults`] binds them in it. Derived from the list
56+ /// above, so there is no second place to forget.
57+ pub const ALL: [ActionId; [$(stringify!($variant)),+].len()] =
58+ [$(ActionId::$variant),+];
59+ }
60+ };
61+}
62+
63+actions! {
4364 Play,
4465 StepBack,
4566 StepForward,
@@ -88,53 +109,6 @@ pub enum ActionId {
88109 }
89110
90111 impl ActionId {
91- /// Display order everywhere -- the editor lists them in it and
92- /// [`Keymap::defaults`] binds them in it.
93- pub const ALL: [ActionId; 42] = [
94- ActionId::Play,
95- ActionId::StepBack,
96- ActionId::StepForward,
97- ActionId::JumpBack,
98- ActionId::JumpForward,
99- ActionId::GoStart,
100- ActionId::GoEnd,
101- ActionId::Export,
102- ActionId::Save,
103- ActionId::Copy,
104- ActionId::Paste,
105- ActionId::Cut,
106- ActionId::Regroup,
107- ActionId::Detach,
108- ActionId::Group,
109- ActionId::Select,
110- ActionId::SelectNext,
111- ActionId::SelectPrev,
112- ActionId::Delete,
113- ActionId::Lift,
114- ActionId::Color,
115- ActionId::Fit,
116- ActionId::Resolution,
117- ActionId::ZoomIn,
118- ActionId::ZoomOut,
119- ActionId::ZoomFit,
120- ActionId::Undo,
121- ActionId::AddVideoLane,
122- ActionId::AddAudioLane,
123- ActionId::RemoveVideoLane,
124- ActionId::RemoveAudioLane,
125- ActionId::ToggleMute,
126- ActionId::VolumeUp,
127- ActionId::VolumeDown,
128- ActionId::Equalizer,
129- ActionId::Speed,
130- ActionId::Silence,
131- ActionId::Mix,
132- ActionId::ToggleSnap,
133- ActionId::ToggleSubtitles,
134- ActionId::CancelExport,
135- ActionId::ShowActions,
136- ];
137-
138112 /// What a person calls it.
139113 pub fn label(self) -> &'static str {
140114 match self {
@@ -347,171 +321,234 @@ impl Category {
347321 /// and fails on any key that reaches neither this table nor a binding.
348322 pub struct Fixed {
349323 /// As a person reads it, which for a single key is [`Chord::pretty`]'s
350- /// spelling and for a family of keys is the family (`0–9`).
351- pub chord: &'static str,
324+ /// spelling and for a family of keys is the family (`0–9`). A `String`
325+ /// because one of them is generated: the codec row's keys are the export
326+ /// card's own table, not a line typed a second time here.
327+ pub chord: String,
352328 pub label: &'static str,
353329 pub category: Category,
330+ /// What a hand with only a mouse does instead. Every stroke here is
331+ /// card-local, and a card whose rows only a keyboard can reach is half this
332+ /// editor's users locked out of it, so each row names the thing on its card
333+ /// -- `every_action_is_reachable_without_the_keyboard` looks each id up in
334+ /// the render's own source.
335+ pub reach: Reach,
336+}
337+
338+/// The pointer's answer to a fixed stroke.
339+#[derive(Clone, Copy, PartialEq, Eq, Debug)]
340+pub enum Reach {
341+ /// The id of the element on the card that does the same thing by click or
342+ /// by drag.
343+ Click(&'static str),
344+ /// Not an action a pointer takes: the way *out* of a card, and the hold
345+ /// that only repeats what a drag already does continuously. A variant
346+ /// rather than an omission, so a row with nothing to click is a decision
347+ /// somebody wrote down instead of a line missing from a list.
348+ Gesture,
349+}
350+
351+/// The codec row's keys, from the export card's own table. Typed out here once,
352+/// it named six of the seven codecs the same row's label advertised -- OGG had
353+/// a key (`o`) that this card never said.
354+fn codec_chord() -> String {
355+ crate::FORMATS
356+ .iter()
357+ .map(|(_, stroke, ..)| *stroke)
358+ .filter(|stroke| !stroke.is_empty())
359+ .collect::<Vec<_>>()
360+ .join(" / ")
354361 }
355362
356-pub const FIXED: [Fixed; 28] = [
357- // Not a chord at all but a way of pressing one, and the only place the
358- // editor can say so: holding a key that moves a *value* runs it, and
359- // holding anything else still does what one press did.
360- Fixed {
361- chord: "hold ← → ↑ ↓",
362- label: "Run a card's slider, or the volume and zoom keys, while held",
363- category: Category::View,
364- },
365- Fixed {
366- chord: "esc",
367- label: "Close this card or menu, or cancel a capture",
368- category: Category::View,
369- },
370- Fixed {
371- chord: "n",
372- label: "Open the custom export bitrate field — ↑↓ step it",
373- category: Category::File,
374- },
375- Fixed {
376- chord: "0–9",
377- label: "Type into that field — nothing outside it",
378- category: Category::File,
379- },
380- Fixed {
381- chord: "m / a / h / w / f / p",
382- label: "Pick the export codec: H.264, AV1, HEVC, WAV, FLAC, MP3 or OGG",
383- category: Category::File,
384- },
385- // The rest of the export card's own rows, each on the letter its row is
386- // named after. They shadow the clip keys of the same letter while the card
387- // is up, exactly as its digits shadow nothing and its arrows would: a modal
388- // card owns the keyboard, and cutting a clip under it is not a thing that
389- // can happen anyway.
390- Fixed {
391- chord: "c",
392- label: "Switch the export container: Matroska or MP4",
393- category: Category::File,
394- },
395- Fixed {
396- chord: "q",
397- label: "Step through the export quality rows",
398- category: Category::File,
399- },
400- Fixed {
401- chord: "b",
402- label: "Step through the export sound bitrates",
403- category: Category::File,
404- },
405- Fixed {
406- chord: "d",
407- label: "Choose where the export is written",
408- category: Category::File,
409- },
410- Fixed {
411- chord: "g",
412- label: "Export card: sections or one flat list",
413- category: Category::File,
414- },
415- Fixed {
416- chord: "r",
417- label: "Export card: the formats with no encoder as rows or as one line",
418- category: Category::File,
419- },
420- Fixed {
421- chord: "enter",
422- label: "Start the export — or commit the bitrate field",
423- category: Category::File,
424- },
425- Fixed {
426- chord: "backspace",
427- label: "Erase a digit in the bitrate field",
428- category: Category::File,
429- },
430- // The equalizer card's own input, for the same reason the export card has
431- // its own: a band nothing but a drag can reach is a band half the users of
432- // this editor cannot move at all. Card-local, so none of them is bindable.
433- Fixed {
434- chord: "1–9, 0",
435- label: "Pick an equalizer band",
436- category: Category::Audio,
437- },
438- Fixed {
439- chord: "up",
440- label: "Raise the picked band 1 dB",
441- category: Category::Audio,
442- },
443- Fixed {
444- chord: "down",
445- label: "Lower the picked band 1 dB",
446- category: Category::Audio,
447- },
448- Fixed {
449- chord: "← / →",
450- label: "Move the picked band down or up in frequency",
451- category: Category::Audio,
452- },
453- Fixed {
454- chord: "shift ← / →",
455- label: "Widen or narrow the picked band (its Q)",
456- category: Category::Audio,
457- },
458- Fixed {
459- chord: "a",
460- label: "Add an equalizer band beside the picked one",
461- category: Category::Audio,
462- },
463- Fixed {
464- chord: "x",
465- label: "Remove the picked equalizer band",
466- category: Category::Audio,
467- },
468- Fixed {
469- chord: "f",
470- label: "Flatten the picked band (double-click does the same)",
471- category: Category::Audio,
472- },
473- Fixed {
474- chord: "r",
475- label: "Flatten every band",
476- category: Category::Audio,
477- },
478- Fixed {
479- chord: "s",
480- label: "Show or hide the spectrum behind the curve",
481- category: Category::Audio,
482- },
483- // The colour card's own three, which mean nothing outside it -- the same
484- // card-local input the export card's digits are.
485- Fixed {
486- chord: "↑ / ↓",
487- label: "Pick a colour slider",
488- category: Category::Clips,
489- },
490- Fixed {
491- chord: "← / →",
492- label: "Move the picked colour slider",
493- category: Category::Clips,
494- },
495- Fixed {
496- chord: "r",
497- label: "Take the colour grade off the clip",
498- category: Category::Clips,
499- },
500- // The silence card's two apply keys. Card-local like every stroke above --
501- // they mean nothing while it is closed -- but the card is the one place in
502- // this editor where a key rewrites forty places at once, so both of them
503- // are listed rather than hidden in the card's own hint line.
504- Fixed {
505- chord: "enter",
506- label: "Cut every silence the card found",
507- category: Category::Clips,
508- },
509- Fixed {
510- chord: "f",
511- label: "Speed the silences up instead of cutting them",
512- category: Category::Clips,
513- },
514-];
363+pub static FIXED: std::sync::LazyLock<[Fixed; 28]> = std::sync::LazyLock::new(|| {
364+ [
365+ // Not a chord at all but a way of pressing one, and the only place the
366+ // editor can say so: holding a key that moves a *value* runs it, and
367+ // holding anything else still does what one press did.
368+ Fixed {
369+ chord: "hold ← → ↑ ↓".into(),
370+ label: "Run a card's slider, or the volume and zoom keys, while held",
371+ category: Category::View,
372+ reach: Reach::Gesture,
373+ },
374+ Fixed {
375+ chord: "esc".into(),
376+ label: "Close this card or menu, or cancel a capture",
377+ category: Category::View,
378+ reach: Reach::Gesture,
379+ },
380+ Fixed {
381+ chord: "n".into(),
382+ label: "Open the custom export bitrate field — ↑↓ step it",
383+ category: Category::File,
384+ reach: Reach::Click("quality"),
385+ },
386+ Fixed {
387+ chord: "0–9".into(),
388+ label: "Type into that field — nothing outside it",
389+ category: Category::File,
390+ reach: Reach::Click("mbps-up"),
391+ },
392+ Fixed {
393+ chord: codec_chord(),
394+ label: "Pick the export codec: H.264, AV1, HEVC, WAV, FLAC, MP3 or OGG",
395+ category: Category::File,
396+ reach: Reach::Click("format"),
397+ },
398+ // The rest of the export card's own rows, each on the letter its row is
399+ // named after. They shadow the clip keys of the same letter while the card
400+ // is up, exactly as its digits shadow nothing and its arrows would: a modal
401+ // card owns the keyboard, and cutting a clip under it is not a thing that
402+ // can happen anyway.
403+ Fixed {
404+ chord: "c".into(),
405+ label: "Switch the export container: Matroska or MP4",
406+ category: Category::File,
407+ reach: Reach::Click("container"),
408+ },
409+ Fixed {
410+ chord: "q".into(),
411+ label: "Step through the export quality rows",
412+ category: Category::File,
413+ reach: Reach::Click("quality"),
414+ },
415+ Fixed {
416+ chord: "b".into(),
417+ label: "Step through the export sound bitrates",
418+ category: Category::File,
419+ reach: Reach::Click("sound"),
420+ },
421+ Fixed {
422+ chord: "d".into(),
423+ label: "Choose where the export is written",
424+ category: Category::File,
425+ reach: Reach::Click("destination"),
426+ },
427+ Fixed {
428+ chord: "g".into(),
429+ label: "Export card: sections or one flat list",
430+ category: Category::File,
431+ reach: Reach::Click("export-layout"),
432+ },
433+ Fixed {
434+ chord: "r".into(),
435+ label: "Export card: the formats with no encoder as rows or as one line",
436+ category: Category::File,
437+ reach: Reach::Click("export-refusals"),
438+ },
439+ Fixed {
440+ chord: "enter".into(),
441+ label: "Start the export — or commit the bitrate field",
442+ category: Category::File,
443+ reach: Reach::Click("export-confirm"),
444+ },
445+ Fixed {
446+ chord: "backspace".into(),
447+ label: "Erase a digit in the bitrate field",
448+ category: Category::File,
449+ reach: Reach::Click("mbps-down"),
450+ },
451+ // The equalizer card's own input, for the same reason the export card has
452+ // its own: a band nothing but a drag can reach is a band half the users of
453+ // this editor cannot move at all. Card-local, so none of them is bindable.
454+ Fixed {
455+ chord: "1–9, 0".into(),
456+ label: "Pick an equalizer band",
457+ category: Category::Audio,
458+ reach: Reach::Click("eq-graph"),
459+ },
460+ Fixed {
461+ chord: "up".into(),
462+ label: "Raise the picked band 1 dB",
463+ category: Category::Audio,
464+ reach: Reach::Click("eq-gain-up"),
465+ },
466+ Fixed {
467+ chord: "down".into(),
468+ label: "Lower the picked band 1 dB",
469+ category: Category::Audio,
470+ reach: Reach::Click("eq-gain-down"),
471+ },
472+ Fixed {
473+ chord: "← / →".into(),
474+ label: "Move the picked band down or up in frequency",
475+ category: Category::Audio,
476+ reach: Reach::Click("eq-freq-up"),
477+ },
478+ Fixed {
479+ chord: "shift ← / →".into(),
480+ label: "Widen or narrow the picked band (its Q)",
481+ category: Category::Audio,
482+ reach: Reach::Click("eq-q-wider"),
483+ },
484+ Fixed {
485+ chord: "a".into(),
486+ label: "Add an equalizer band beside the picked one",
487+ category: Category::Audio,
488+ reach: Reach::Click("eq-add"),
489+ },
490+ Fixed {
491+ chord: "x".into(),
492+ label: "Remove the picked equalizer band",
493+ category: Category::Audio,
494+ reach: Reach::Click("eq-remove"),
495+ },
496+ Fixed {
497+ chord: "f".into(),
498+ label: "Flatten the picked band (double-click does the same)",
499+ category: Category::Audio,
500+ reach: Reach::Click("eq-flat-band"),
501+ },
502+ Fixed {
503+ chord: "r".into(),
504+ label: "Flatten every band",
505+ category: Category::Audio,
506+ reach: Reach::Click("eq-reset"),
507+ },
508+ Fixed {
509+ chord: "s".into(),
510+ label: "Show or hide the spectrum behind the curve",
511+ category: Category::Audio,
512+ reach: Reach::Click("eq-spectrum"),
513+ },
514+ // The colour card's own three, which mean nothing outside it -- the same
515+ // card-local input the export card's digits are.
516+ Fixed {
517+ chord: "↑ / ↓".into(),
518+ label: "Pick a colour slider",
519+ category: Category::Clips,
520+ reach: Reach::Click("color-row"),
521+ },
522+ Fixed {
523+ chord: "← / →".into(),
524+ label: "Move the picked colour slider",
525+ category: Category::Clips,
526+ reach: Reach::Click("color-bar"),
527+ },
528+ Fixed {
529+ chord: "r".into(),
530+ label: "Take the colour grade off the clip",
531+ category: Category::Clips,
532+ reach: Reach::Click("color-reset"),
533+ },
534+ // The silence card's two apply keys. Card-local like every stroke above --
535+ // they mean nothing while it is closed -- but the card is the one place in
536+ // this editor where a key rewrites forty places at once, so both of them
537+ // are listed rather than hidden in the card's own hint line.
538+ Fixed {
539+ chord: "enter".into(),
540+ label: "Cut every silence the card found",
541+ category: Category::Clips,
542+ reach: Reach::Click("silence-apply"),
543+ },
544+ Fixed {
545+ chord: "f".into(),
546+ label: "Speed the silences up instead of cutting them",
547+ category: Category::Clips,
548+ reach: Reach::Click("silence-apply"),
549+ },
550+ ]
551+});
515552
516553 /// A stroke as the key handler sees it: gpui's key name plus the one modifier
517554 /// this editor binds. Nothing else is a chord here -- shift and alt are part of
@@ -1222,13 +1259,52 @@ mod tests {
12221259 assert_eq!(whole("edith-keys 1\n").display(ActionId::Cut), "unbound");
12231260 // The label is the editor's column, and never the file's word for it.
12241261 assert_eq!(ActionId::CancelExport.label(), "Cancel export");
1225- assert_eq!(ActionId::ALL.len(), 42);
12261262 assert_eq!(k.display(ActionId::ToggleSnap), "n");
12271263 assert_eq!(k.display(ActionId::ShowActions), "f1");
12281264 assert_eq!(k.display(ActionId::ToggleSubtitles), "t");
12291265 assert_eq!(k.display(ActionId::ZoomIn), "ctrl+=");
12301266 }
12311267
1268+ /// The one row of [`FIXED`] that speaks for a whole table elsewhere: it
1269+ /// named six keys for seven codecs, and OGG's `o` was a stroke the card
1270+ /// never mentioned. The chord is generated from `FORMATS` now, and this
1271+ /// holds the *label* to the same table -- a codec added there with no name
1272+ /// in this row fails here rather than in a user's hands.
1273+ #[test]
1274+ fn the_codec_row_says_every_codec_the_export_card_offers() {
1275+ let row = super::FIXED
1276+ .iter()
1277+ .find(|f| f.label.starts_with("Pick the export codec"))
1278+ .expect("the codec row");
1279+ let keys: Vec<&str> = row.chord.split(" / ").collect();
1280+ for (boxes, stroke, label, _) in crate::FORMATS {
1281+ if stroke.is_empty() {
1282+ // A codec this program cannot write at all has no key and no
1283+ // business in this row.
1284+ assert!(boxes.is_empty(), "{label} has a box but no stroke");
1285+ assert!(!keys.contains(&stroke));
1286+ continue;
1287+ }
1288+ assert!(
1289+ keys.contains(&stroke),
1290+ "{label}'s key {stroke:?} is not in {:?}",
1291+ row.chord
1292+ );
1293+ assert!(
1294+ row.label.contains(label),
1295+ "{label} is not named in {:?}",
1296+ row.label
1297+ );
1298+ }
1299+ assert_eq!(
1300+ keys.len(),
1301+ crate::FORMATS
1302+ .iter()
1303+ .filter(|(_, s, ..)| !s.is_empty())
1304+ .count()
1305+ );
1306+ }
1307+
12321308 #[test]
12331309 fn a_saved_keymap_comes_back_off_the_disk() {
12341310 // Its own directory, never the real config one: this test writes.
crates/app/src/main.rsmodified+538 -367
@@ -473,6 +473,18 @@ struct Trim {
473473 /// still the body.
474474 const EDGE_W: f32 = 6.;
475475
476+/// Whether a clip box this wide gets its two trim strips at all. Below three
477+/// handles wide the pair would occlude the whole box: every press on it would
478+/// trim, and the clip could not be selected, dragged to another lane or picked
479+/// up by its middle -- which is exactly what a jumpcut leaves behind
480+/// ([`Player::cut_silences`] manufactures a great many short clips). Above it,
481+/// what is left between the two strips is a handle's width of body in its own
482+/// right. A clip too short for its handles is trimmed by zooming in first: the
483+/// bed is a magnifier, and the strip grows with the box.
484+fn trims(width: f32) -> bool {
485+ width >= 3. * EDGE_W
486+}
487+
476488 /// How close to an edge a dragged clip has to be let go for it to land *on* it:
477489 /// the snap every timeline has, in pixels rather than frames so that it feels
478490 /// the same at every zoom. Narrower than [`EDGE_W`] -- a hand aiming between two
@@ -693,7 +705,7 @@ fn keys_filter(needle: &str, keymap: &Keymap) -> Vec<(usize, KeyRow)> {
693705 }
694706 KeyRow::Fixed(f) => {
695707 let fixed = &keymap::FIXED[*f];
696- if hit(fixed.label, fixed.chord) {
708+ if hit(fixed.label, &fixed.chord) {
697709 out.extend(pending.take());
698710 out.push((i, row));
699711 }
@@ -6196,347 +6208,382 @@ impl Player {
61966208 // off the right edge is a button a pointer cannot press. A plain
61976209 // wheel moves it -- gpui puts a vertical delta on the x axis when
61986210 // that is the only one scrolling (div.rs:2424).
6211+ //
6212+ // ...and "it scrolls" is not "it can be found": the button beside
6213+ // the row is pinned outside it and never scrolls away, so Export,
6214+ // Save and the rest are one press from the smallest window even
6215+ // when the row's tail is off the edge.
6216+ // `toolbar_fits_the_smallest_window` is the guard.
61996217 .child(
62006218 div()
6201- .id("controls")
62026219 .flex_none()
62036220 .flex()
62046221 .items_center()
62056222 .gap(px(8.))
6206- .overflow_x_scroll()
6207- .child(control(
6208- "transport",
6209- Some(transport_glyph(state).into_any_element()),
6210- if state.is_playing() { "Pause" } else { "Play" },
6211- if nothing_to_play(self.session.as_ref()) && !state.is_playing() {
6212- format!("{} — put a clip on a lane first", key(ActionId::Play))
6213- } else {
6214- key(ActionId::Play)
6215- },
6216- // An empty timeline has nothing to play, so the button
6217- // says so by being dim rather than by starting a clock
6218- // against nothing (the key press answers with the
6219- // notice). Still live while it *is* playing: a delete
6220- // can empty the timeline mid-play and that has to stop.
6221- live && (state.is_playing() || !nothing_to_play(self.session.as_ref())),
6222- cx.listener(|this, _: &ClickEvent, _, cx| this.toggle_or_restart(cx)),
6223- ))
6224- .child(separator())
6225- .child(control(
6226- "cut",
6227- Some(cut_glyph().into_any_element()),
6228- "Cut",
6229- format!(
6230- "{} — splits the clip under the playhead",
6231- key(ActionId::Cut)
6232- ),
6233- live,
6234- cx.listener(|this, _: &ClickEvent, _, cx| this.cut(cx)),
6235- ))
6236- .child(control(
6237- "delete",
6238- Some(delete_glyph().into_any_element()),
6239- "Delete",
6240- if self.selected.is_some() {
6241- key(ActionId::Delete)
6242- } else {
6243- format!("{} — click a clip below first", key(ActionId::Delete))
6244- },
6245- live && self.selected.is_some(),
6246- cx.listener(|this, _: &ClickEvent, _, cx| this.delete_selected(cx)),
6247- ))
6248- // The way back from every one of them. It was a stroke and
6249- // nothing else, which made the whole edit group a one-way
6250- // door for anyone working with a pointer.
6251- .child(control(
6252- "undo",
6253- None,
6254- "Undo",
6255- format!("{} — takes the last edit back", key(ActionId::Undo)),
6256- live,
6257- cx.listener(|this, _: &ClickEvent, _, cx| this.undo(cx)),
6258- ))
6259- // With the edit group, beside the buttons that change the
6260- // edit list: a track is a row of it, and adding one is an
6261- // undoable edit like the rest. Two buttons rather than one
6262- // with a choice, because the choice is the whole action.
6263- .child(control(
6264- "add-video-lane",
6265- None,
6266- "+ V",
6267- format!(
6268- "{} — adds a video track under the ones there",
6269- key(ActionId::AddVideoLane)
6270- ),
6271- live,
6272- cx.listener(|this, _: &ClickEvent, _, cx| {
6273- this.add_lane(LaneKind::Video, cx)
6274- }),
6275- ))
6276- .child(control(
6277- "add-audio-lane",
6278- None,
6279- "+ A",
6280- format!(
6281- "{} — adds an audio track under the ones there",
6282- key(ActionId::AddAudioLane)
6283- ),
6284- live,
6285- cx.listener(|this, _: &ClickEvent, _, cx| {
6286- this.add_lane(LaneKind::Audio, cx)
6287- }),
6288- ))
6289- // With the transport, not the edit group: it changes what
6290- // the file sounds like, never what it is. Reads as its own
6291- // state, so muted is legible without a tooltip.
6292- .child(control(
6293- "volume",
6294- None,
6295- self.volume.label(),
6296- format!(
6297- "{} mutes · {} louder · {} quieter",
6298- key(ActionId::ToggleMute),
6299- key(ActionId::VolumeUp),
6300- key(ActionId::VolumeDown)
6301- ),
6302- live,
6303- cx.listener(|this, _: &ClickEvent, _, cx| {
6304- this.set_volume(|volume| volume.muted = !volume.muted, cx)
6305- }),
6306- ))
6307- // The level itself, to drag. The button beside it stays the
6308- // mute -- one gesture each -- and the label above is what
6309- // this writes, live, so the number follows the hand.
6310- .child(volume_slider(
6311- self.volume,
6312- self.volume_bar.clone(),
6313- live,
6314- cx,
6315- ))
6316- .child(separator())
6317- // The size every clip is composed onto, which is also the
6318- // size the export comes out at. Five sizes, so a click opens
6319- // the list of them with this one marked and picks whichever
6320- // was meant: a button that stepped one on per press made the
6321- // user click round the ladder to get back to where they
6322- // were. The stroke still steps, for the hand already on it.
6323- .child(control(
6324- "resolution",
6325- None,
6326- resolution.map_or_else(|| "Size".to_string(), |(_, h)| format!("{h}p")),
6327- match resolution {
6328- Some((w, h)) => format!(
6329- "click to pick a size — the project is {w}x{h}; {} steps to the next",
6330- key(ActionId::Resolution)
6331- ),
6332- None => format!("{} — open a file first", key(ActionId::Resolution)),
6333- },
6334- live,
6335- cx.listener(|this, event: &ClickEvent, _, cx| {
6336- this.open_picker(Pick::Resolution, event.position(), cx)
6337- }),
6338- ))
6339- // The rate every clip is counted in, which is also the rate
6340- // the export is written at -- the other half of "the project
6341- // is not the media", and the one the panel could only ever
6342- // read out before. A click opens the rates with this one
6343- // marked; picking one conforms the whole timeline to it.
6344- .child(control(
6345- "fps",
6346- None,
6347- match self.session.is_some() {
6348- true => format!("{} fps", fps_label(self.fps)),
6349- false => "Rate".to_string(),
6350- },
6351- match self.session.is_some() {
6352- true => format!(
6353- "click to pick a frame rate — the project is cut at {} fps",
6354- fps_label(self.fps)
6355- ),
6356- false => "the project's frame rate — open a file first".to_string(),
6357- },
6358- live,
6359- cx.listener(|this, event: &ClickEvent, _, cx| {
6360- this.open_picker(Pick::Fps, event.position(), cx)
6361- }),
6362- ))
6363- // ...and which rendition its HDR media is watched in, the
6364- // third thing that is the project's rather than the media's.
6365- // Listed whatever is on the timeline, and the tooltip says
6366- // who it acts on: a control that came and went with the
6367- // media would be one nobody could find when they wanted it.
6368- .child(control(
6369- "tonemap",
6370- None,
6371- match &self.session {
6372- Some(session) => format!("HDR {}", tone_label(session.tone())),
6373- None => "HDR".to_string(),
6374- },
6375- match &self.session {
6376- Some(session) => format!(
6377- "click to pick the HDR rendition — the project is {}; SDR media is untouched",
6378- tone_label(session.tone())
6379- ),
6380- None => "the HDR rendition — open a file first".to_string(),
6381- },
6382- live,
6383- cx.listener(|this, event: &ClickEvent, _, cx| {
6384- this.open_picker(Pick::Tone, event.position(), cx)
6385- }),
6386- ))
6387- // How much of the timeline the panel below is showing --
6388- // beside the resolution, since neither of them edits
6389- // anything: they are both what is being looked at. The
6390- // middle one says how much of it is on the bed, and is the
6391- // way back to the whole of it.
6392- .child(control(
6393- "zoom-out",
6394- None,
6395- "−",
6396- format!(
6397- "{} — show more of the timeline; stops with all of it on the bed",
6398- key(ActionId::ZoomOut)
6399- ),
6400- live,
6401- cx.listener(|this, _: &ClickEvent, _, cx| {
6402- this.zoom(1. / ZOOM_STEP, None, cx)
6403- }),
6404- ))
6405- .child(control(
6406- "zoom-fit",
6407- None,
6408- // How much timeline is on the bed, not a multiple of
6409- // "the whole of it": the scale no longer knows what the
6410- // whole of it is, and a number that changed on every
6411- // import was a number that lied.
6412- span_label(self.view().span()),
6413- format!(
6414- "{} — fit the whole timeline; showing {} to {}",
6415- key(ActionId::ZoomFit),
6416- timecode(self.scale.start, self.fps),
6417- timecode(
6418- (self.scale.start + self.view().span()).min(duration),
6419- self.fps
6420- )
6421- ),
6422- live,
6423- cx.listener(|this, _: &ClickEvent, _, cx| this.zoom_fit(cx)),
6424- ))
6425- .child(control(
6426- "zoom-in",
6427- None,
6428- "+",
6429- format!(
6430- "{} — magnify around the playhead; ctrl+wheel on the bar zooms at the pointer",
6431- key(ActionId::ZoomIn)
6432- ),
6433- live,
6434- cx.listener(|this, _: &ClickEvent, _, cx| this.zoom(ZOOM_STEP, None, cx)),
6435- ))
6436- // The magnet, beside the zoom for the zoom's own reason: it
6437- // changes nothing on the timeline, it changes how the hand
6438- // meets it. The label is the state, as the volume's is --
6439- // a toggle that looks the same either way says nothing.
6440- .child(control(
6441- "snap",
6442- None,
6443- if self.snap { "Snap" } else { "No snap" },
6444- format!(
6445- "{} — {}",
6446- key(ActionId::ToggleSnap),
6447- match self.snap {
6448- true => "drags and trims land on clip edges, the playhead and the start",
6449- false => "drags and trims land exactly where the hand leaves them",
6450- }
6451- ),
6452- live,
6453- cx.listener(|this, _: &ClickEvent, _, cx| this.toggle_snap(cx)),
6454- ))
6455- // The cues over the picture, off and on -- beside the zoom
6456- // and the snap, since like both of them it changes what is
6457- // being looked at and nothing about the edit. The label is
6458- // the state, as the snap's is, and it says what there is to
6459- // toggle when there is nothing.
6460- .child(control(
6461- "subs",
6462- None,
6463- match (self.subtitle_track().is_some(), self.subs_on) {
6464- (false, _) => "No subs",
6465- (true, true) => "Subs",
6466- (true, false) => "Subs off",
6467- },
6468- match self.enable(ActionId::ToggleSubtitles, None).why() {
6469- Some(why) => format!(
6470- "{} — {why}; drop a .srt on the window, or open an mkv that carries them",
6471- key(ActionId::ToggleSubtitles)
6472- ),
6473- None => format!(
6474- "{} — {}",
6475- key(ActionId::ToggleSubtitles),
6476- match self.subs_on {
6477- true => "the cue under the playhead is drawn over the picture",
6478- false => "the cues are on the timeline and off the picture",
6479- }
6480- ),
6481- },
6482- live && self.enable(ActionId::ToggleSubtitles, None).yes(),
6483- cx.listener(|this, _: &ClickEvent, _, cx| this.toggle_subtitles(cx)),
6484- ))
6485- // Import is not here: it belongs to the media list it adds
6486- // to, and two doors into one action is a question about
6487- // which one is the real one.
6488- //
6489- // While one runs, this button is the way out of it: the
6490- // progress line promised esc and nothing else, which left a
6491- // pointer no way to stop an export it had started.
6492- .child(control(
6493- "export",
6494- None,
6495- if exporting { "Cancel" } else { "Export" },
6496- if exporting {
6497- format!(
6498- "{} — stops the export; the part-written file goes",
6499- key(ActionId::CancelExport)
6500- )
6501- } else {
6502- format!(
6503- "{} — quality and destination, then writes the timeline out",
6504- key(ActionId::Export)
6505- )
6506- },
6507- if exporting {
6508- true
6509- } else {
6510- live && self.export.is_none()
6511- },
6512- cx.listener(|this, _: &ClickEvent, _, cx| {
6513- if this.exporting().is_some() {
6514- this.cancel_export();
6515- cx.notify();
6516- } else {
6517- this.open_export(cx);
6518- }
6519- }),
6520- ))
6521- .child(control(
6522- "save",
6523- None,
6524- "Save",
6525- format!("{} — writes the project file", key(ActionId::Save)),
6526- live,
6527- cx.listener(|this, _: &ClickEvent, _, cx| this.save_project(cx)),
6528- ))
6529- // Closed while an export runs, which is what keeps a waiting
6530- // row from swallowing the escape the progress line promises
6531- // cancels the export.
6223+ .child(
6224+ div()
6225+ .id("controls")
6226+ .flex_1()
6227+ .min_w(px(0.))
6228+ .flex()
6229+ .items_center()
6230+ .gap(px(8.))
6231+ .overflow_x_scroll()
6232+ .child(control(
6233+ "transport",
6234+ Some(transport_glyph(state).into_any_element()),
6235+ if state.is_playing() { "Pause" } else { "Play" },
6236+ if nothing_to_play(self.session.as_ref()) && !state.is_playing() {
6237+ format!("{} — put a clip on a lane first", key(ActionId::Play))
6238+ } else {
6239+ key(ActionId::Play)
6240+ },
6241+ // An empty timeline has nothing to play, so the button
6242+ // says so by being dim rather than by starting a clock
6243+ // against nothing (the key press answers with the
6244+ // notice). Still live while it *is* playing: a delete
6245+ // can empty the timeline mid-play and that has to stop.
6246+ live && (state.is_playing() || !nothing_to_play(self.session.as_ref())),
6247+ cx.listener(|this, _: &ClickEvent, _, cx| this.toggle_or_restart(cx)),
6248+ ))
6249+ .child(separator())
6250+ .child(control(
6251+ "cut",
6252+ Some(cut_glyph().into_any_element()),
6253+ "Cut",
6254+ format!(
6255+ "{} — splits the clip under the playhead",
6256+ key(ActionId::Cut)
6257+ ),
6258+ live,
6259+ cx.listener(|this, _: &ClickEvent, _, cx| this.cut(cx)),
6260+ ))
6261+ .child(control(
6262+ "delete",
6263+ Some(delete_glyph().into_any_element()),
6264+ "Delete",
6265+ if self.selected.is_some() {
6266+ key(ActionId::Delete)
6267+ } else {
6268+ format!("{} — click a clip below first", key(ActionId::Delete))
6269+ },
6270+ live && self.selected.is_some(),
6271+ cx.listener(|this, _: &ClickEvent, _, cx| this.delete_selected(cx)),
6272+ ))
6273+ // The way back from every one of them. It was a stroke and
6274+ // nothing else, which made the whole edit group a one-way
6275+ // door for anyone working with a pointer.
6276+ .child(control(
6277+ "undo",
6278+ None,
6279+ "Undo",
6280+ format!("{} — takes the last edit back", key(ActionId::Undo)),
6281+ live,
6282+ cx.listener(|this, _: &ClickEvent, _, cx| this.undo(cx)),
6283+ ))
6284+ // With the edit group, beside the buttons that change the
6285+ // edit list: a track is a row of it, and adding one is an
6286+ // undoable edit like the rest. Two buttons rather than one
6287+ // with a choice, because the choice is the whole action.
6288+ .child(control(
6289+ "add-video-lane",
6290+ None,
6291+ "+ V",
6292+ format!(
6293+ "{} — adds a video track under the ones there",
6294+ key(ActionId::AddVideoLane)
6295+ ),
6296+ live,
6297+ cx.listener(|this, _: &ClickEvent, _, cx| {
6298+ this.add_lane(LaneKind::Video, cx)
6299+ }),
6300+ ))
6301+ .child(control(
6302+ "add-audio-lane",
6303+ None,
6304+ "+ A",
6305+ format!(
6306+ "{} — adds an audio track under the ones there",
6307+ key(ActionId::AddAudioLane)
6308+ ),
6309+ live,
6310+ cx.listener(|this, _: &ClickEvent, _, cx| {
6311+ this.add_lane(LaneKind::Audio, cx)
6312+ }),
6313+ ))
6314+ // With the transport, not the edit group: it changes what
6315+ // the file sounds like, never what it is. Reads as its own
6316+ // state, so muted is legible without a tooltip.
6317+ .child(control(
6318+ "volume",
6319+ None,
6320+ self.volume.label(),
6321+ format!(
6322+ "{} mutes · {} louder · {} quieter",
6323+ key(ActionId::ToggleMute),
6324+ key(ActionId::VolumeUp),
6325+ key(ActionId::VolumeDown)
6326+ ),
6327+ live,
6328+ cx.listener(|this, _: &ClickEvent, _, cx| {
6329+ this.set_volume(|volume| volume.muted = !volume.muted, cx)
6330+ }),
6331+ ))
6332+ // The level itself, to drag. The button beside it stays the
6333+ // mute -- one gesture each -- and the label above is what
6334+ // this writes, live, so the number follows the hand.
6335+ .child(volume_slider(
6336+ self.volume,
6337+ self.volume_bar.clone(),
6338+ live,
6339+ cx,
6340+ ))
6341+ .child(separator())
6342+ // The size every clip is composed onto, which is also the
6343+ // size the export comes out at. Five sizes, so a click opens
6344+ // the list of them with this one marked and picks whichever
6345+ // was meant: a button that stepped one on per press made the
6346+ // user click round the ladder to get back to where they
6347+ // were. The stroke still steps, for the hand already on it.
6348+ .child(control(
6349+ "resolution",
6350+ None,
6351+ resolution.map_or_else(|| "Size".to_string(), |(_, h)| format!("{h}p")),
6352+ match resolution {
6353+ Some((w, h)) => format!(
6354+ "click to pick a size — the project is {w}x{h}; {} steps to the next",
6355+ key(ActionId::Resolution)
6356+ ),
6357+ None => format!("{} — open a file first", key(ActionId::Resolution)),
6358+ },
6359+ live,
6360+ cx.listener(|this, event: &ClickEvent, _, cx| {
6361+ this.open_picker(Pick::Resolution, event.position(), cx)
6362+ }),
6363+ ))
6364+ // The rate every clip is counted in, which is also the rate
6365+ // the export is written at -- the other half of "the project
6366+ // is not the media", and the one the panel could only ever
6367+ // read out before. A click opens the rates with this one
6368+ // marked; picking one conforms the whole timeline to it.
6369+ .child(control(
6370+ "fps",
6371+ None,
6372+ match self.session.is_some() {
6373+ true => format!("{} fps", fps_label(self.fps)),
6374+ false => "Rate".to_string(),
6375+ },
6376+ match self.session.is_some() {
6377+ true => format!(
6378+ "click to pick a frame rate — the project is cut at {} fps",
6379+ fps_label(self.fps)
6380+ ),
6381+ false => "the project's frame rate — open a file first".to_string(),
6382+ },
6383+ live,
6384+ cx.listener(|this, event: &ClickEvent, _, cx| {
6385+ this.open_picker(Pick::Fps, event.position(), cx)
6386+ }),
6387+ ))
6388+ // ...and which rendition its HDR media is watched in, the
6389+ // third thing that is the project's rather than the media's.
6390+ // Listed whatever is on the timeline, and the tooltip says
6391+ // who it acts on: a control that came and went with the
6392+ // media would be one nobody could find when they wanted it.
6393+ .child(control(
6394+ "tonemap",
6395+ None,
6396+ match &self.session {
6397+ Some(session) => format!("HDR {}", tone_label(session.tone())),
6398+ None => "HDR".to_string(),
6399+ },
6400+ match &self.session {
6401+ Some(session) => format!(
6402+ "click to pick the HDR rendition — the project is {}; SDR media is untouched",
6403+ tone_label(session.tone())
6404+ ),
6405+ None => "the HDR rendition — open a file first".to_string(),
6406+ },
6407+ live,
6408+ cx.listener(|this, event: &ClickEvent, _, cx| {
6409+ this.open_picker(Pick::Tone, event.position(), cx)
6410+ }),
6411+ ))
6412+ // How much of the timeline the panel below is showing --
6413+ // beside the resolution, since neither of them edits
6414+ // anything: they are both what is being looked at. The
6415+ // middle one says how much of it is on the bed, and is the
6416+ // way back to the whole of it.
6417+ .child(control(
6418+ "zoom-out",
6419+ None,
6420+ "−",
6421+ format!(
6422+ "{} — show more of the timeline; stops with all of it on the bed",
6423+ key(ActionId::ZoomOut)
6424+ ),
6425+ live,
6426+ cx.listener(|this, _: &ClickEvent, _, cx| {
6427+ this.zoom(1. / ZOOM_STEP, None, cx)
6428+ }),
6429+ ))
6430+ .child(control(
6431+ "zoom-fit",
6432+ None,
6433+ // How much timeline is on the bed, not a multiple of
6434+ // "the whole of it": the scale no longer knows what the
6435+ // whole of it is, and a number that changed on every
6436+ // import was a number that lied.
6437+ span_label(self.view().span()),
6438+ format!(
6439+ "{} — fit the whole timeline; showing {} to {}",
6440+ key(ActionId::ZoomFit),
6441+ timecode(self.scale.start, self.fps),
6442+ timecode(
6443+ (self.scale.start + self.view().span()).min(duration),
6444+ self.fps
6445+ )
6446+ ),
6447+ live,
6448+ cx.listener(|this, _: &ClickEvent, _, cx| this.zoom_fit(cx)),
6449+ ))
6450+ .child(control(
6451+ "zoom-in",
6452+ None,
6453+ "+",
6454+ format!(
6455+ "{} — magnify around the playhead; ctrl+wheel on the bar zooms at the pointer",
6456+ key(ActionId::ZoomIn)
6457+ ),
6458+ live,
6459+ cx.listener(|this, _: &ClickEvent, _, cx| this.zoom(ZOOM_STEP, None, cx)),
6460+ ))
6461+ // The magnet, beside the zoom for the zoom's own reason: it
6462+ // changes nothing on the timeline, it changes how the hand
6463+ // meets it. The label is the state, as the volume's is --
6464+ // a toggle that looks the same either way says nothing.
6465+ .child(control(
6466+ "snap",
6467+ None,
6468+ if self.snap { "Snap" } else { "No snap" },
6469+ format!(
6470+ "{} — {}",
6471+ key(ActionId::ToggleSnap),
6472+ match self.snap {
6473+ true => "drags and trims land on clip edges, the playhead and the start",
6474+ false => "drags and trims land exactly where the hand leaves them",
6475+ }
6476+ ),
6477+ live,
6478+ cx.listener(|this, _: &ClickEvent, _, cx| this.toggle_snap(cx)),
6479+ ))
6480+ // The cues over the picture, off and on -- beside the zoom
6481+ // and the snap, since like both of them it changes what is
6482+ // being looked at and nothing about the edit. The label is
6483+ // the state, as the snap's is, and it says what there is to
6484+ // toggle when there is nothing.
6485+ .child(control(
6486+ "subs",
6487+ None,
6488+ match (self.subtitle_track().is_some(), self.subs_on) {
6489+ (false, _) => "No subs",
6490+ (true, true) => "Subs",
6491+ (true, false) => "Subs off",
6492+ },
6493+ match self.enable(ActionId::ToggleSubtitles, None).why() {
6494+ Some(why) => format!(
6495+ "{} — {why}; drop a .srt on the window, or open an mkv that carries them",
6496+ key(ActionId::ToggleSubtitles)
6497+ ),
6498+ None => format!(
6499+ "{} — {}",
6500+ key(ActionId::ToggleSubtitles),
6501+ match self.subs_on {
6502+ true => "the cue under the playhead is drawn over the picture",
6503+ false => "the cues are on the timeline and off the picture",
6504+ }
6505+ ),
6506+ },
6507+ live && self.enable(ActionId::ToggleSubtitles, None).yes(),
6508+ cx.listener(|this, _: &ClickEvent, _, cx| this.toggle_subtitles(cx)),
6509+ ))
6510+ // Import is not here: it belongs to the media list it adds
6511+ // to, and two doors into one action is a question about
6512+ // which one is the real one.
6513+ //
6514+ // While one runs, this button is the way out of it: the
6515+ // progress line promised esc and nothing else, which left a
6516+ // pointer no way to stop an export it had started.
6517+ .child(control(
6518+ "export",
6519+ None,
6520+ if exporting { "Cancel" } else { "Export" },
6521+ if exporting {
6522+ format!(
6523+ "{} — stops the export; the part-written file goes",
6524+ key(ActionId::CancelExport)
6525+ )
6526+ } else {
6527+ format!(
6528+ "{} — quality and destination, then writes the timeline out",
6529+ key(ActionId::Export)
6530+ )
6531+ },
6532+ if exporting {
6533+ true
6534+ } else {
6535+ live && self.export.is_none()
6536+ },
6537+ cx.listener(|this, _: &ClickEvent, _, cx| {
6538+ if this.exporting().is_some() {
6539+ this.cancel_export();
6540+ cx.notify();
6541+ } else {
6542+ this.open_export(cx);
6543+ }
6544+ }),
6545+ ))
6546+ .child(control(
6547+ "save",
6548+ None,
6549+ "Save",
6550+ format!("{} — writes the project file", key(ActionId::Save)),
6551+ live,
6552+ cx.listener(|this, _: &ClickEvent, _, cx| this.save_project(cx)),
6553+ ))
6554+ // Closed while an export runs, which is what keeps a waiting
6555+ // row from swallowing the escape the progress line promises
6556+ // cancels the export.
6557+ .child(control(
6558+ "keys",
6559+ None,
6560+ "Actions",
6561+ // The pointer's way to every action there is, including
6562+ // the ones no button here has room for.
6563+ format!(
6564+ "{} — do any action, or change the key that does it",
6565+ key(ActionId::ShowActions)
6566+ ),
6567+ !exporting,
6568+ cx.listener(|this, _: &ClickEvent, _, cx| match this.keys_open {
6569+ true => {
6570+ this.keys_open = false;
6571+ this.rebinding = None;
6572+ cx.notify();
6573+ }
6574+ false => this.show_actions(cx),
6575+ }),
6576+ ))
6577+ )
6578+ // The door to everything the row cannot show at this
6579+ // window: the same card the Actions button opens, by the
6580+ // same call, pinned where a scroll cannot take it.
65326581 .child(control(
6533- "keys",
6582+ "controls-more",
65346583 None,
6535- "Actions",
6536- // The pointer's way to every action there is, including
6537- // the ones no button here has room for.
6584+ "⋯",
65386585 format!(
6539- "{} — do any action, or change the key that does it",
6586+ "{} — every action, including the ones scrolled off this row",
65406587 key(ActionId::ShowActions)
65416588 ),
65426589 !exporting,
@@ -6962,7 +7009,7 @@ impl Player {
69627009 row()
69637010 .child(f.label)
69647011 // Dim, and no hover: this one is not a row you can click.
6965- .child(div().text_color(rgb(INK_DIM)).child(f.chord))
7012+ .child(div().text_color(rgb(INK_DIM)).child(f.chord.clone()))
69667013 .into_any_element()
69677014 }
69687015 });
@@ -7343,6 +7390,45 @@ impl Player {
73437390 )
73447391 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| this.pick_destination(cx)))
73457392 .into_any_element();
7393+ // The card's own two layout switches. They were `g` and `r` and nothing
7394+ // else, while the status line under the title advertised both of them:
7395+ // a hand on the mouse read what they do and had nothing to press.
7396+ list.push(
7397+ entry(
7398+ ("export-layout", 0),
7399+ "g",
7400+ "Layout".into(),
7401+ match self.export_grouped {
7402+ true => "sections — g for one flat list".into(),
7403+ false => "one flat list — g for sections".into(),
7404+ },
7405+ self.export_grouped,
7406+ true,
7407+ )
7408+ .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
7409+ this.export_grouped = !this.export_grouped;
7410+ cx.notify();
7411+ }))
7412+ .into_any_element(),
7413+ );
7414+ list.push(
7415+ entry(
7416+ ("export-refusals", 0),
7417+ "r",
7418+ "Codecs with no encoder".into(),
7419+ match self.export_refusals_inline {
7420+ true => "a dimmed row each — r collapses them".into(),
7421+ false => "one line at the foot — r shows a row each".into(),
7422+ },
7423+ self.export_refusals_inline,
7424+ true,
7425+ )
7426+ .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
7427+ this.export_refusals_inline = !this.export_refusals_inline;
7428+ cx.notify();
7429+ }))
7430+ .into_any_element(),
7431+ );
73467432 match self.export_grouped {
73477433 true => list.push(destination),
73487434 // Flat: the same rows with no headers over them, and the
@@ -9634,36 +9720,45 @@ impl Player {
96349720 // them, which is what keeps one gesture one thing:
96359721 // a press here trims, a press anywhere else on the
96369722 // box still starts the move to another lane.
9637- .children([Edge::Start, Edge::End].map(|edge| {
9638- let mut zone = div()
9639- .absolute()
9640- .top_0()
9641- .h_full()
9642- .w(px(EDGE_W))
9643- .occlude()
9644- .cursor(CursorStyle::ResizeLeftRight)
9645- .hover(|s| s.bg(rgb(ACCENT)))
9646- .on_mouse_down(
9647- MouseButton::Left,
9648- cx.listener(move |this, _: &MouseDownEvent, _, cx| {
9649- this.start_trim(lane, i, edge, cx);
9650- }),
9651- )
9652- // Occluded, so the box's own right-button
9653- // listener never fires here: the menu is
9654- // the same menu, opened by the same call.
9655- .on_mouse_down(
9656- MouseButton::Right,
9657- cx.listener(move |this, event: &MouseDownEvent, _, cx| {
9658- this.open_menu(lane, i, event.position, cx);
9659- }),
9660- );
9661- zone = match edge {
9662- Edge::Start => zone.left_0(),
9663- Edge::End => zone.right_0(),
9664- };
9665- zone
9666- }))
9723+ .children(
9724+ [Edge::Start, Edge::End]
9725+ .into_iter()
9726+ .filter(|_| trims(width))
9727+ .map(|edge| {
9728+ let mut zone = div()
9729+ .absolute()
9730+ .top_0()
9731+ .h_full()
9732+ .w(px(EDGE_W))
9733+ .occlude()
9734+ .cursor(CursorStyle::ResizeLeftRight)
9735+ .hover(|s| s.bg(rgb(ACCENT)))
9736+ .on_mouse_down(
9737+ MouseButton::Left,
9738+ cx.listener(
9739+ move |this, _: &MouseDownEvent, _, cx| {
9740+ this.start_trim(lane, i, edge, cx);
9741+ },
9742+ ),
9743+ )
9744+ // Occluded, so the box's own right-button
9745+ // listener never fires here: the menu is
9746+ // the same menu, opened by the same call.
9747+ .on_mouse_down(
9748+ MouseButton::Right,
9749+ cx.listener(
9750+ move |this, event: &MouseDownEvent, _, cx| {
9751+ this.open_menu(lane, i, event.position, cx);
9752+ },
9753+ ),
9754+ );
9755+ zone = match edge {
9756+ Edge::Start => zone.left_0(),
9757+ Edge::End => zone.right_0(),
9758+ };
9759+ zone
9760+ }),
9761+ )
96679762 // Under the label row, never through it.
96689763 .children(wave.filter(|_| audio && vis_w > 0.).and_then(|wave| {
96699764 let inner: AnyElement = match wave {
@@ -13179,7 +13274,7 @@ mod tests {
1317913274 whole_take, window_title,
1318013275 };
1318113276 use super::{
13182- Choice, ETA_SPAN, Edge, FITS, FRAME_RATES, LaneKind, PPS_DEFAULT, PPS_MIN, Preset, RESOLUTIONS, Repeat,
13277+ Choice, EDGE_W, ETA_SPAN, Edge, FITS, FRAME_RATES, LaneKind, PPS_DEFAULT, PPS_MIN, Preset, RESOLUTIONS, Repeat,
1318313278 Scale, View,
1318413279 ZOOM_MIN_FRAMES, ZOOM_OUT_MARGIN, ZOOM_STEP, audio_rate_choices, clock, eta_secs, file_name, file_uri,
1318513280 fit_choices, landing, lane_refuses, library_rows, live_idx, next_fit, next_resolution,
@@ -13188,7 +13283,7 @@ mod tests {
1318813283 Landing, arrival, launch_queue,
1318913284 read_ahead, scan_plan, seek_line, silence_line, stash_or_write,
1319013285 repeats, resolution_choices, resolution_ladder, span_label, tone_choices, tone_label,
13191- trimmed_clip, unscannable,
13286+ trimmed_clip, trims, unscannable,
1319213287 visible_slice,
1319313288 };
1319413289 use super::{
@@ -13806,6 +13901,25 @@ mod tests {
1380613901 ] {
1380713902 assert!(element(id), "{id} is not on any card");
1380813903 }
13904+ // ...and each one is named by the row that carries its stroke, so a
13905+ // card-local key added to `FIXED` with nothing to click fails here
13906+ // instead of being noticed by whoever tries to use the card without a
13907+ // keyboard. `KeyRow::Fixed` is "shown and never offered", which used to
13908+ // mean the twenty-eight rows below were the one part of this editor no
13909+ // reachability test read.
13910+ for fixed in keymap::FIXED.iter() {
13911+ match fixed.reach {
13912+ keymap::Reach::Click(id) => assert!(
13913+ element(id),
13914+ "{:?} ({}) points at {id}, which is on no card",
13915+ fixed.chord,
13916+ fixed.label
13917+ ),
13918+ // Nothing to click by decision, not by omission: getting out of
13919+ // a card, and the hold that repeats what a drag already does.
13920+ keymap::Reach::Gesture => {}
13921+ }
13922+ }
1380913923 }
1381013924
1381113925 /// What the Detach and Group items do to a real timeline: a music video's
@@ -14772,7 +14886,7 @@ mod tests {
1477214886 for action in ActionId::ALL {
1477314887 assert!(keymap::Category::ALL.contains(&action.category()));
1477414888 }
14775- for fixed in &keymap::FIXED {
14889+ for fixed in keymap::FIXED.iter() {
1477614890 assert!(keymap::Category::ALL.contains(&fixed.category));
1477714891 }
1477814892 }
@@ -17303,6 +17417,45 @@ mod tests {
1730317417 assert_eq!(cue_box(scale, &mapped[1]), (80., 40.));
1730417418 }
1730517419
17420+ /// The panel's button row against the 640x360 floor the whole editor is
17421+ /// measured at. It does not fit and cannot be made to -- so what it may
17422+ /// never do is *hide* the tail: the row scrolls, and the door to everything
17423+ /// scrolled off it is pinned outside the scrolling box.
17424+ #[test]
17425+ fn toolbar_fits_the_smallest_window() {
17426+ let source = include_str!("main.rs")
17427+ .split("#[cfg(test)]")
17428+ .next()
17429+ .unwrap();
17430+ let panel = &source[source.find(" fn panel(").expect("the panel")
17431+ ..source.find(" fn import_bar(").expect("the panel's end")];
17432+ // Every button in the row is a hit target, so none of them is narrower
17433+ // than `HIT_MIN`, and they sit in 8 px gaps inside the panel's own
17434+ // 12 px padding. The level slider is the one fixed width among them.
17435+ let buttons = panel.matches("control(").count();
17436+ assert!(buttons >= 15, "the row's buttons moved; this scan is blind");
17437+ let row_w = buttons as f32 * (HIT_MIN + 8.) + VOLUME_W + 24.;
17438+ assert!(
17439+ row_w > 640.,
17440+ "{row_w} px of buttons now fits the floor -- the pinned door may go"
17441+ );
17442+ // So Export, Save and Actions are off the right edge at that width, and
17443+ // "it scrolls" is not "it can be found": this is the button that never
17444+ // scrolls, and the card it opens carries every action there is
17445+ // (`every_action_is_on_the_actions_card`).
17446+ assert!(
17447+ panel.contains("\"controls-more\""),
17448+ "nothing pinned beside the scrolling row: the tail is unreachable at 640 px"
17449+ );
17450+ // ...and it is outside the scrolling box, which is the whole point of
17451+ // it: one `overflow_x_scroll`, and the door is written after it closes.
17452+ assert_eq!(panel.matches("overflow_x_scroll").count(), 1);
17453+ assert!(
17454+ panel.find("\"controls-more\"") > panel.find("overflow_x_scroll"),
17455+ "the pinned door is inside the row it is meant to outlive"
17456+ );
17457+ }
17458+
1730617459 #[test]
1730717460 fn nothing_clickable_is_smaller_than_the_wcag_minimum() {
1730817461 // Every hit target in the panel, including the scrub strip -- whose bar
@@ -17310,6 +17463,24 @@ mod tests {
1731017463 assert!(CONTROL_H >= HIT_MIN);
1731117464 assert!(RULER_HIT_H >= HIT_MIN);
1731217465 assert!(LANE_H >= HIT_MIN);
17466+ // A clip box is a hit target too, and its two trim strips occlude it:
17467+ // on a box narrower than the pair there is no body left to press, so
17468+ // the clip cannot be selected, dragged or menued at all -- which is
17469+ // every clip a jumpcut leaves at a normal zoom. Below three handles
17470+ // there are no strips.
17471+ assert!(!trims(0.));
17472+ assert!(!trims(EDGE_W));
17473+ assert!(!trims(2. * EDGE_W), "a box that is all handle and no clip");
17474+ assert!(!trims(3. * EDGE_W - 0.1));
17475+ // And where they are drawn, what is left between them is a hit target
17476+ // in its own right -- a whole handle's width of clip.
17477+ for width in [3. * EDGE_W, 24., 100., 4000.] {
17478+ assert!(trims(width));
17479+ assert!(
17480+ width - 2. * EDGE_W >= EDGE_W,
17481+ "{width} px of box leaves no middle"
17482+ );
17483+ }
1731317484 }
1731417485
1731517486 /// WCAG 2.1 relative luminance of a packed `0xRRGGBB`.