diff --git a/crates/app/src/files.rs b/crates/app/src/files.rs index 1cc039e..d8a0ee7 100644 --- a/crates/app/src/files.rs +++ b/crates/app/src/files.rs @@ -92,7 +92,7 @@ pub(crate) fn pick_file(title: &str) -> Result, &'static str> { ("kdialog", vec!["--getopenfilename".into()]), ]) .ok_or( - "NO FILE CHOOSER — install zenity or kdialog, or drag the file onto this window to import it", + "NO FILE CHOOSER — install zenity or kdialog", ) } @@ -116,7 +116,7 @@ pub(crate) fn pick_save(default: &std::path::Path) -> Result, &' ("kdialog", vec!["--getsavefilename".into(), default]), ]) .ok_or( - "NO FILE CHOOSER — install zenity or kdialog to choose where; exporting beside the source", + "NO FILE CHOOSER — exporting beside the source", ) } diff --git a/crates/app/src/importing.rs b/crates/app/src/importing.rs index 153bf21..b57bf4e 100644 --- a/crates/app/src/importing.rs +++ b/crates/app/src/importing.rs @@ -45,7 +45,7 @@ impl LibraryTab { pub(crate) fn empty(self) -> &'static str { match self { LibraryTab::Media => "No video", - LibraryTab::Audio => "No sound", + LibraryTab::Audio => "none", LibraryTab::Text => "No subtitles", } } diff --git a/crates/app/src/interact.rs b/crates/app/src/interact.rs index 1b50577..950d60d 100644 --- a/crates/app/src/interact.rs +++ b/crates/app/src/interact.rs @@ -247,6 +247,17 @@ pub(crate) fn drag_scrim(cx: &mut Context) -> Div { /// dragging right now ([`Player::split_drag`]), which the pointer leaves on the /// first move -- so the lit line has to come from the model, not from `hover`. /// +/// What the *hand* aims at is wider than what the eye is given: the press and +/// the resize cursor live on a [`GRAB_W`] band centred on the *line the eye +/// sees* -- one row above the strip, so it reaches past the panel edge the +/// strip stands in front of rather than being centred on the strip -- mounted +/// absolutely so it overlays its neighbours instead of pushing them (the strip +/// keeps its [`SPLIT_W`] of layout, and `layout::split_drag_size` keeps +/// answering in strip coordinates). A 6 px target missed by 5 px is a resize +/// the hand cannot find, which is the same as no resize at all (user +/// 2026-09-09: "panes should be enlargable and shrinkable" -- they already +/// were). +/// /// A double press resets the seam to the window's own share /// ([`Splits::clear`]): the cheap way back from a layout dragged somewhere /// unusable, and the one every editor's dividers answer to. @@ -269,23 +280,42 @@ pub(crate) fn divider(split: Split, held: bool, cx: &mut Context) -> Div .when(!held, |d| { d.hover(|s| s.border_color(rgb(STROKE_DIVIDER()))) }) - .on_mouse_down( - MouseButton::Left, - cx.listener(move |this, event: &MouseDownEvent, _, cx| { - match event.click_count >= 2 { - // The reset is written where a release would have written - // the drag, the same small round trip: a seam put back by - // hand must not come back on the next launch. - true => { - this.split_drag = None; - this.splits.clear(split); - crate::layout::save_stance_splits(&this.splits); - } - false => this.split_drag = Some(split), - } - cx.notify(); - cx.stop_propagation(); - }), + .relative() + .child( + div() + .absolute() + .when(across, |d| { + d.left_0() + .right_0() + .top(px(-1.)) + .h(px(GRAB_W)) + .cursor_row_resize() + }) + .when(!across, |d| { + d.top_0() + .bottom_0() + .left(px(-1.)) + .w(px(GRAB_W)) + .cursor_col_resize() + }) + .on_mouse_down( + MouseButton::Left, + cx.listener(move |this, event: &MouseDownEvent, _, cx| { + match event.click_count >= 2 { + // The reset is written where a release would have written + // the drag, the same small round trip: a seam put back by + // hand must not come back on the next launch. + true => { + this.split_drag = None; + this.splits.clear(split); + crate::layout::save_stance_splits(&this.splits); + } + false => this.split_drag = Some(split), + } + cx.notify(); + cx.stop_propagation(); + }), + ), ) } diff --git a/crates/app/src/layout.rs b/crates/app/src/layout.rs index 9dd4372..851e86c 100644 --- a/crates/app/src/layout.rs +++ b/crates/app/src/layout.rs @@ -93,6 +93,13 @@ pub(crate) const EXPORT_KEY_W: f32 = 26.; pub(crate) const MENU_W: f32 = 260.; pub(crate) const MENU_ROW_H: f32 = HIT_MIN; pub(crate) const MENU_PAD: f32 = 6.; +/// The breathing room a hanging menu keeps against every window edge. Without +/// it `menu_at`'s clamp let a menu sit flush on the bottom edge -- the last row +/// touching the frame reads as a list cut off rather than a list that ended, +/// which is what the user saw at 1280x720 (`f-clip-menu.png`, rows running to +/// y=720 exactly). Taken out of the room the list may fill as well as off the +/// clamp, so a floored menu never grows back up over the picture to buy it. +pub(crate) const MENU_EDGE: f32 = 4.; /// A cue's text, and the line it sits on. Fixed rather than a share of the /// picture: the video region is 108 px tall at the 640x360 floor and a @@ -293,6 +300,18 @@ impl Split { /// it looks like. pub(crate) const SPLIT_W: f32 = 6.; +/// How wide the same seam is *aimed at*. The strip above is what the layout +/// spends and the hairline is what the eye is given; this is the band the hand +/// gets, centred on the strip and overlaid on the two panels it parts, so +/// growing it moves nothing. 6 px asked the hand for precision it does not +/// have -- the lead's own press one row into the bench missed the seam by 5 px +/// and focused the bench instead ("panes should be enlargable and shrinkable", +/// of panes that already resized). 12 px is the ±6 px of aim every editor's +/// dividers allow, and it is hung one row above the strip rather than centred +/// on it: what a hand aims at is the line it can see (the panel's own edge at +/// the strip's far side), not the six transparent pixels in front of it. +pub(crate) const GRAB_W: f32 = 14.; + /// The most of the window one side column may be dragged to. A third each, so /// the picture keeps the middle at every size -- the rule [`library_w`] and /// [`inspector_w`] already lay an untouched window out by, kept once the hand diff --git a/crates/app/src/menus.rs b/crates/app/src/menus.rs index 8c0a488..80d2345 100644 --- a/crates/app/src/menus.rs +++ b/crates/app/src/menus.rs @@ -112,8 +112,9 @@ pub(crate) enum Choice { pub(crate) type ChoiceRow = (Choice, SharedString, SharedString, bool); /// What a library row's menu offers, in the order it lists them. Unlike the clip -/// menu's items none of these is a stroke -- there is no keyboard way to a row -- -/// so the label and the hint are written here rather than read off the keymap. +/// menu's items only one of these ([`RowItem::Add`]) is a stroke, and that one +/// is not a bindable [`ActionId`] but `ui/stance.rs`'s own `enter` branch, so +/// the label and the chord are written here rather than read off the keymap. #[derive(Clone, Copy, PartialEq)] pub(crate) enum RowItem { Add, @@ -142,29 +143,34 @@ impl RowItem { match self { Self::Add => "Add at playhead", Self::Remove => "Remove from library", - // Same label as the plain remove: only ever one of the two is on - // the plate (the oracle hides the other), so what differs is the - // consequence, and the consequence belongs in the hint column - // where every other row states its own. The long dashed title - // truncated its own hint at `MENU_W`. - Self::RemoveWithClips => "Remove from library", + // The consequence is in the label now rather than in the hint + // column beside a label identical to the plain remove's: that + // column carries chords ([`RowItem::hint`]), and a destructive + // verb whose difference from the row above it lived in dim grey + // prose is a verb that reads as the same verb. It fits `MENU_W` + // whole exactly because nothing is printed to its right. + Self::RemoveWithClips => "Remove with its clips", Self::Reveal => "Reveal in files", Self::Properties => "Properties", } } - /// The dim right-hand column, where the clip menu prints the stroke: what - /// the item will do to the timeline, so nothing here is a surprise. + /// The dim right-hand column: the *stroke* that does the same thing, the + /// one thing DESIGN §4 puts there ("every command wears its chord"), and + /// nothing at all where no stroke reaches the verb. + /// + /// It used to carry a prose gloss on every row -- a phrase about the whole + /// file, one about the desktop's file browser, one about clips -- which is + /// §8's instructional copy sitting in the column the sibling clip menu + /// spends on chords, and which the user read as the crowding it is. The + /// only row a stroke reaches is the add (`ui/stance.rs`'s `enter` branch, + /// live while a dock row is picked); its own row in the dock already wears + /// the same `↵`. A refusal still prints here in place of the chord + /// (`oracle::row_enable`) -- that is state, not instruction. pub(crate) fn hint(self) -> &'static str { match self { - // Short enough to sit beside its label inside `MENU_W`, the clip - // menu's rule for a refusal: this column truncates, and a hint cut - // off mid-word says less than a shorter one. - Self::Add => "the whole file", - Self::Remove => "nothing plays it", - Self::RemoveWithClips => "clips too", - Self::Reveal => "file manager", - Self::Properties => "…", + Self::Add => "↵", + Self::Remove | Self::RemoveWithClips | Self::Reveal | Self::Properties => "", } } } diff --git a/crates/app/src/notices.rs b/crates/app/src/notices.rs index 7d1aa8d..299d54f 100644 --- a/crates/app/src/notices.rs +++ b/crates/app/src/notices.rs @@ -51,6 +51,37 @@ pub(crate) fn audio_notice(session: &PlaybackSession) -> Option { .map(|reason| format!(" — NO AUDIO: {reason}")) } +/// The strip's own width is finite and its message is one line: what a +/// too-long line must never do is lose its *state* word, which sits at the +/// front, or stop mid-word with nothing saying it stopped (user report, +/// `OPENED he_is_not_the_only_one.mp4 — 1 subtitle track(s) in `). Every +/// message is a handful of words plus a file name now (DESIGN §8), so the one +/// part long enough to overflow the strip alone is the name -- elided through +/// its middle here, head and tail kept, before gpui's own end ellipsis +/// ([`crate::ui::stance`]) ever has to cut a word. +pub(crate) const LEDGER_WORD_MAX: usize = 28; + +pub(crate) fn ledger_line(message: &str) -> String { + message + .split(' ') + .map(|word| match word.chars().count() > LEDGER_WORD_MAX { + false => word.to_string(), + // Chars, not bytes: a name is whatever the filesystem holds. + true => { + let chars: Vec = word.chars().collect(); + let head = LEDGER_WORD_MAX / 2 - 1; + let tail = LEDGER_WORD_MAX - head - 1; + format!( + "{}…{}", + chars[..head].iter().collect::(), + chars[chars.len() - tail..].iter().collect::() + ) + } + }) + .collect::>() + .join(" ") +} + #[cfg(test)] mod tests { use super::*; @@ -83,4 +114,20 @@ mod tests { // message's text. assert_eq!(notices.back().unwrap().as_ref(), refusal); } + + /// The line the strip paints keeps its state word and never stops + /// mid-word without a sign: a long name loses its middle, everything + /// short is untouched, and the count at the end survives. + #[test] + fn a_long_name_loses_its_middle_rather_than_the_state_word() { + assert_eq!(ledger_line("SNAP OFF"), "SNAP OFF"); + let long = ledger_line("OPENED he_is_not_the_only_one_at_all_here.mp4 · 1 subtitle track(s)"); + assert!(long.starts_with("OPENED "), "{long}"); + assert!(long.ends_with(" · 1 subtitle track(s)"), "{long}"); + assert!(long.contains('…'), "{long}"); + assert!( + long.split(' ').all(|w| w.chars().count() <= LEDGER_WORD_MAX), + "{long}" + ); + } } diff --git a/crates/app/src/oracle.rs b/crates/app/src/oracle.rs index 372001a..b913e9c 100644 --- a/crates/app/src/oracle.rs +++ b/crates/app/src/oracle.rs @@ -451,18 +451,22 @@ pub(crate) fn row_items(ctx: RowCtx) -> Vec { /// How tall a menu's list may draw: the whole of it where the window has room, /// and what the window has where it has not -- only then does the list scroll. /// A cap fixed at twelve rows put the last items behind a scroll on a window -/// with room to spare, which reads as a menu cut off by the bottom edge. +/// with room to spare, which reads as a menu cut off by the bottom edge. Both +/// [`MENU_EDGE`] margins come off the room first, so the plate `menu_at` places +/// from this always fits between them whatever the anchor. pub(crate) fn menu_rows_h(rows: usize, viewport: Size) -> f32 { - let room = f32::from(viewport.height) - MENU_PAD * 2.; + let room = f32::from(viewport.height) - MENU_PAD * 2. - MENU_EDGE * 2.; (rows as f32 * MENU_ROW_H).min(room.max(MENU_ROW_H)) } /// Where the menu actually hangs: at the pointer, pulled back inside the window /// when it would not fit -- an item off the bottom edge is an item nobody can -/// click. Never negative, so a window smaller than the menu loses the bottom of -/// it rather than the top, where the items are. +/// click. All four edges, [`MENU_EDGE`] clear of each: a plate flush on the +/// frame reads as a list that was cut, not one that ended. Never past the top +/// or left edge, so a window smaller than the menu loses the bottom of it +/// rather than the top, where the items are. pub(crate) fn menu_at(at: Point, viewport: Size, height: f32) -> (f32, f32) { - let fit = |v: f32, size: f32, room: f32| v.min(room - size).max(0.); + let fit = |v: f32, size: f32, room: f32| v.min(room - MENU_EDGE - size).max(MENU_EDGE); ( fit(f32::from(at.x), MENU_W, f32::from(viewport.width)), fit(f32::from(at.y), height, f32::from(viewport.height)), diff --git a/crates/app/src/player/actions.rs b/crates/app/src/player/actions.rs index 8b990da..fc1c4ac 100644 --- a/crates/app/src/player/actions.rs +++ b/crates/app/src/player/actions.rs @@ -251,8 +251,8 @@ impl Player { self.snap_cue = None; self.ghost.clear(); self.notify_user(match self.snap { - true => "SNAP ON — drags land on clip edges, the playhead and the start".into(), - false => "SNAP OFF — drags land exactly where the hand leaves them".into(), + true => "SNAP ON".into(), + false => "SNAP OFF".into(), }); cx.notify(); } @@ -649,7 +649,7 @@ impl Player { }; self.loop_trim = self.cut_span(lane, idx); if self.loop_trim.is_some() { - self.notify_user("LOOP-TRIM ON — looping the subject cut while you trim".into()); + self.notify_user("LOOP-TRIM ON".into()); } cx.notify(); } diff --git a/crates/app/src/player/cards.rs b/crates/app/src/player/cards.rs index b455f25..5f267d8 100644 --- a/crates/app/src/player/cards.rs +++ b/crates/app/src/player/cards.rs @@ -244,7 +244,7 @@ impl Player { return; } let Some(session) = &self.session else { - self.notify_user("no timeline to grade — open a file first".into()); + self.notify_user("no timeline to grade — no file open".into()); cx.notify(); return; }; @@ -262,8 +262,7 @@ impl Player { Some(half) => Some(half), None => { self.notify_user( - "NOTHING TO GRADE — a caption has no picture; group it with a clip \ - first (ctrl-click both, then Group)" + "NOTHING TO GRADE — a caption has no picture" .into(), ); cx.notify(); @@ -400,7 +399,7 @@ impl Player { return; } let Some(session) = &self.session else { - self.notify_user("no timeline to place — open a file first".into()); + self.notify_user("no timeline to place — no file open".into()); cx.notify(); return; }; @@ -410,8 +409,7 @@ impl Player { Some(half) => Some(half), None => { self.notify_user( - "NOTHING TO PLACE — a caption has no picture; group it with a clip \ - first (ctrl-click both, then Group)" + "NOTHING TO PLACE — a caption has no picture" .into(), ); cx.notify(); @@ -533,7 +531,7 @@ impl Player { return; } let Some(session) = &self.session else { - self.notify_user("no timeline to re-time — open a file first".into()); + self.notify_user("no timeline to re-time — no file open".into()); cx.notify(); return; }; @@ -551,8 +549,7 @@ impl Player { Some(half) => Some(half), None => { self.notify_user( - "NOTHING TO RE-TIME — a caption has no speed of its own; group it \ - with a clip first (ctrl-click both, then Group)" + "NOTHING TO RE-TIME — a caption has no speed of its own" .into(), ); cx.notify(); @@ -696,7 +693,7 @@ impl Player { return; } let Some(session) = &self.session else { - self.notify_user("no timeline to scan — open a file first".into()); + self.notify_user("no timeline to scan — no file open".into()); cx.notify(); return; }; @@ -714,8 +711,7 @@ impl Player { Some(half) => Some(half), None => { self.notify_user( - "NOTHING TO SCAN — a caption has no sound of its own; group it with \ - the take's sound first (ctrl-click both, then Group)" + "NOTHING TO SCAN — a caption has no sound of its own" .into(), ); cx.notify(); @@ -870,6 +866,45 @@ impl Player { /// Nothing here is a clip's or even the project's -- it never reaches the /// export, which never burns a cue into the picture -- so like the mix /// card it opens with no timeline required and nothing to refuse. + /// The settings page's Picture row: the next file this machine can write + /// ([`ui::settings_stance::next_picture`] -- codec and container in one + /// cycle now), through [`Self::set_format`] like every other pick, so the + /// destination follows the format and a refusal is still said out loud. + pub(crate) fn cycle_export_picture(&mut self) { + let next = crate::ui::settings_stance::next_picture(self.format, |f| { + self.session + .as_ref() + .and_then(|session| format_refusal(session, f)) + .is_some() + }); + self.set_format(next); + } + + /// The Sound row: the next rate in [`engine::export::AUDIO_KBPS`], and + /// nothing at all where the picked format's codec carries no rate -- the + /// row shows no chord there either. + pub(crate) fn cycle_audio_kbps(&mut self) { + if !crate::ui::settings_stance::sound_codec(self.format).1 { + return; + } + let at = AUDIO_KBPS + .iter() + .position(|&kbps| kbps == self.audio_kbps) + .unwrap_or_default(); + self.audio_kbps = AUDIO_KBPS[(at + 1) % AUDIO_KBPS.len()]; + } + + /// The Encoder row: the next seat, through [`Self::apply_encoder`] so the + /// pick is said and saved with the project exactly as the card's own list + /// row saves it. + pub(crate) fn cycle_encoder(&mut self, cx: &mut Context) { + let at = EncoderSeat::ALL + .iter() + .position(|&seat| seat == self.encoder_seat()) + .unwrap_or_default(); + self.apply_encoder(EncoderSeat::ALL[(at + 1) % EncoderSeat::ALL.len()], cx); + } + /// Opens the settings page (PROJECT rows beside EDITOR rows, /// `ui::settings_stance`): the one door for "edit project and editor /// settings" -- refused while an export is running, same as every other @@ -1161,7 +1196,7 @@ impl Player { if self.silence_marks.is_empty() { self.notify_user( format!( - "no silence under {:.0} dBFS lasting {:.2} s — raise the threshold or forgive less", + "no silence under {:.0} dBFS lasting {:.2} s", self.silence.threshold_db, self.silence.min_silence ) .into(), @@ -1213,7 +1248,7 @@ impl Player { self.reset_after_reseek(); self.notify_user( format!( - "{count} SILENCES CUT {reach} — {} shorter, {} takes it back", + "{count} SILENCES CUT {reach} — {} shorter · undo {}", secs_label(saved), self.keymap.display(ActionId::Undo) ) @@ -1252,7 +1287,7 @@ impl Player { self.reset_after_reseek(); self.notify_user( format!( - "{count} SILENCES AT {rate} {reach} — {} takes it back", + "{count} SILENCES AT {rate} {reach} · undo {}", self.keymap.display(ActionId::Undo) ) .into(), @@ -1392,13 +1427,13 @@ impl Player { _ => self.selected.anchor(), }; let refusal = match (anchor, &self.session) { - (_, None) => Some("NO TIMELINE — open a file first".to_string()), + (_, None) => Some("NO TIMELINE — no file open".to_string()), (None, _) => Some(format!( - "NOTHING SELECTED — click an audio clip or press {}, then ask again", + "NOTHING SELECTED · select all {}", self.keymap.display(ActionId::Select) )), (Some((lane, _)), _) if lane.kind != LaneKind::Audio => Some( - "NOT AN AUDIO CLIP — the equalizer works on the sound, so pick a clip in an audio lane".to_string(), + "NOT AN AUDIO CLIP — the equalizer works on sound".to_string(), ), _ => None, }; @@ -1495,7 +1530,7 @@ impl Player { if self.eq_params.bands.len() >= EQ_BANDS_MAX { self.notify_user( format!( - "EQUALIZER FULL — {EQ_BANDS_MAX} bands is all this card holds; move one instead" + "EQUALIZER FULL — {EQ_BANDS_MAX} bands" ) .into(), ); @@ -1512,7 +1547,7 @@ impl Player { /// is a card with nothing to edit, and flattening is what "off" means here. pub(crate) fn remove_band(&mut self, cx: &mut Context) { if self.eq_params.bands.len() <= 1 { - self.notify_user("LAST BAND — flatten it instead (r), or close the card".into()); + self.notify_user("LAST BAND · flatten r".into()); cx.notify(); return; } @@ -1788,6 +1823,20 @@ impl Player { } return true; } + // The settings page's EXPORT rows: `c` steps the file, `b` the rate + // its sound is coded at and `e` the encoder seat. Card-local like the + // colour and transform branches above -- and only these three, so + // escape still closes the page and every other key falls through to + // the room. + if self.settings_open { + match key { + "c" => self.cycle_export_picture(), + "b" => self.cycle_audio_kbps(), + "e" => self.cycle_encoder(cx), + _ => return false, + } + return true; + } // The export moment: its own chords, and every other stroke // swallowed while it is up -- a chord this surface consumes must // never also reach the room's keymap underneath it diff --git a/crates/app/src/player/export.rs b/crates/app/src/player/export.rs index e823ad5..5a771da 100644 --- a/crates/app/src/player/export.rs +++ b/crates/app/src/player/export.rs @@ -449,7 +449,7 @@ impl Player { // Nothing to write out, and a refusal rather than a card about it: the // window is empty and the export path is not even chosen yet. if self.session.is_none() { - self.notify_user("NOTHING TO EXPORT — open a file first".into()); + self.notify_user("NOTHING TO EXPORT — no file open".into()); cx.notify(); return; } @@ -769,7 +769,7 @@ impl Player { settings.subtitles = self.export_subs(); settings.range = self.range; let Some(session) = &mut self.session else { - self.notify_user("NOTHING TO EXPORT — open a file first".into()); + self.notify_user("NOTHING TO EXPORT — no file open".into()); cx.notify(); return; }; diff --git a/crates/app/src/player/library.rs b/crates/app/src/player/library.rs index e9a428e..11c671a 100644 --- a/crates/app/src/player/library.rs +++ b/crates/app/src/player/library.rs @@ -180,7 +180,7 @@ impl Player { true => { self.close_session(); format!( - "REMOVED {} — the library is empty; import a file to start again", + "REMOVED {} — the library is empty", file_name(path) ) } @@ -194,7 +194,7 @@ impl Player { } } Some(Err(e)) => format!("NOT REMOVED — {e}"), - None => "NO TIMELINE — open a file first".to_string(), + None => "NO TIMELINE — no file open".to_string(), }; self.notify_user(text.into()); cx.notify(); @@ -218,7 +218,7 @@ impl Player { return; } let Some(session) = self.session.as_mut() else { - self.notify_user("NO TIMELINE — open a file first".into()); + self.notify_user("NO TIMELINE — no file open".into()); return; }; let Some(idx) = session @@ -732,7 +732,7 @@ impl Player { // and the film has a stand-in now. Some(Proxy::Ready) if showed_stop => { let text = format!( - "PROXY READY for {} — it finished before the stop; click again to delete it", + "PROXY READY for {} — it finished before the stop", file_name(path) ); eprintln!("{text}"); @@ -904,9 +904,9 @@ impl Player { let text = match (on, ready, making) { (false, ..) => "PROXIES OFF — the films themselves are what play".to_string(), (true, 0, 0) => { - "PROXIES ON — no film here has one, so the films themselves play".to_string() + "PROXIES ON — no film here has one".to_string() } - (true, 0, n) => format!("PROXIES ON — {n} still being made; the films play until then"), + (true, 0, n) => format!("PROXIES ON — {n} still being made"), (true, n, 0) => format!("PROXIES ON — cutting on {n}"), (true, n, m) => format!("PROXIES ON — cutting on {n}, {m} still being made"), }; @@ -951,8 +951,8 @@ impl Player { session.set_auto_proxies(on); } let text = match on { - true => "AUTO PROXIES ON — a film that wants a stand-in gets one as it arrives", - false => "AUTO PROXIES OFF — no import makes one; Proxies on is what asks for them", + true => "AUTO PROXIES ON — every import gets a stand-in", + false => "AUTO PROXIES OFF — no import makes one", }; eprintln!("{text}"); // Kept for the next launch, not only the next project -- a flip made @@ -1114,7 +1114,7 @@ impl Player { .and_then(|session| subtitle_tail(session, subs)) .unwrap_or_default(); format!( - "IMPORTED {} to the library — drag it onto a lane to place it{tail}{}", + "IMPORTED {} to the library{tail}{}", file_name(path), audio_import_tail(path, self.has_video(path) && !no_video) ) @@ -1207,7 +1207,7 @@ impl Player { let what = match place { true => format!("OPENED {name}"), false => { - format!("IMPORTED {name} to the library — drag it onto a lane to place it") + format!("IMPORTED {name} to the library") } }; let audio = match place { @@ -1396,7 +1396,7 @@ impl Player { self.keymap.display(ActionId::ToggleSubtitles) ), Some(Err(e)) => format!("SUBTITLE IMPORT FAILED: {e}"), - None => "NO SUBTITLES ADDED — open a file for them to run against first".to_string(), + None => "NO SUBTITLES ADDED — no file open".to_string(), }; eprintln!("{text}"); self.notify_user(text.into()); @@ -1461,7 +1461,7 @@ impl Player { ) } Some(Err(e)) => format!("NO SUBTITLES REMOVED — {e}"), - None => "NO SUBTITLES REMOVED — open a file first".to_string(), + None => "NO SUBTITLES REMOVED — no file open".to_string(), }; eprintln!("{text}"); self.notify_user(text.into()); @@ -1587,7 +1587,7 @@ impl Player { format!("SAVED {}", file_name(&self.project_path)) } Some(Err(e)) => format!("SAVE FAILED: {e}"), - None => "NOTHING TO SAVE — open a file first".to_string(), + None => "NOTHING TO SAVE — no file open".to_string(), }; eprintln!("{text}"); self.notify_user(text.into()); @@ -1751,22 +1751,14 @@ impl Player { let lane = session.add_lane(kind); self.notify_user( format!( - "{} ADDED — drag {} onto it, {} takes it back", + "{} ADDED · undo {}", lane.label(), - // A subtitle lane takes no clip at all: what lands on it - // is a palette row, so the notice names the panel the - // hand has to go to rather than "a clip", which is the - // one thing that will never work here. - match kind { - LaneKind::Subtitle => "a subtitle from the panel", - _ => "a clip", - }, self.keymap.display(ActionId::Undo) ) .into(), ); } - None => self.notify_user("NO TRACK ADDED — open a file first".into()), + None => self.notify_user("NO TRACK ADDED — no file open".into()), } cx.notify(); } @@ -1809,7 +1801,7 @@ impl Player { ) } Some(Err(e)) => format!("NO TRACK REMOVED — {e}"), - None => "NO TRACK REMOVED — open a file first".to_string(), + None => "NO TRACK REMOVED — no file open".to_string(), }; self.notify_user(text.into()); cx.notify(); @@ -1863,7 +1855,7 @@ impl Player { } self.notify_user( format!( - "{} IS TRACK {} NOW — {} puts it back", + "{} IS TRACK {} NOW · undo {}", moved.label(), to + 1, self.keymap.display(ActionId::Undo) @@ -1901,7 +1893,7 @@ impl Player { LaneKind::Subtitle => "subtitle", } ), - false => "NO TRACK REMOVED — open a file first".to_string(), + false => "NO TRACK REMOVED — no file open".to_string(), } .into(), ); diff --git a/crates/app/src/player/timeline_edit.rs b/crates/app/src/player/timeline_edit.rs index 5a93948..c878660 100644 --- a/crates/app/src/player/timeline_edit.rs +++ b/crates/app/src/player/timeline_edit.rs @@ -73,7 +73,7 @@ impl Player { self.selected.clear(); } else { self.notify_user( - "NOTHING TO REGROUP — put the playhead where two clips meet, on frames that were cut apart" + "NOTHING TO REGROUP — no cut under the playhead" .into(), ); } @@ -98,7 +98,7 @@ impl Player { } } (Some(_), None) => { - self.notify_user("NOTHING DETACHED — click the take to take apart first".into()) + self.notify_user("NOTHING DETACHED — nothing selected".into()) } (None, _) => {} } @@ -127,7 +127,7 @@ impl Player { let picks = self.marks().0; match (&mut self.session, self.selected.anchor(), picks.len()) { (_, None, _) => { - self.notify_user("NOTHING GROUPED — click one of the halves first".into()) + self.notify_user("NOTHING GROUPED — nothing selected".into()) } // The hand's group: every pick, one id. (Some(session), _, 2..) => { @@ -147,8 +147,7 @@ impl Player { } } None => self.notify_user( - "NOTHING TO GROUP WITH — no clip on another track covers exactly these \ - frames; ctrl-click the clips to group instead" + "NOTHING TO GROUP WITH — no clip covers these frames" .into(), ), }, @@ -239,7 +238,7 @@ impl Player { } } (Some(_), None) => { - self.notify_user("NOTHING LIFTED — click the half to remove first".into()) + self.notify_user("NOTHING LIFTED — nothing selected".into()) } (None, _) => {} } @@ -407,7 +406,7 @@ impl Player { // cannot be dragged. false if from.kind != to.kind => self.notify_user( format!( - "NOT ON {} — that is a {kind} clip; drop it on a {lanes} lane", + "NOT ON {} — a {kind} clip takes a {lanes} lane", to.label() ) .into(), @@ -530,10 +529,10 @@ impl Player { // The row is greyed and says why in the list; here it says why at // the moment somebody tried to use it anyway. (None, Some(_)) => Some( - "NOT PLACED — that subtitle track has no cues to place; the list says why" + "NOT PLACED — that subtitle track has no cues" .to_string(), ), - (_, None) => Some("NOT PLACED — open a file first".to_string()), + (_, None) => Some("NOT PLACED — no file open".to_string()), }; match (text, marked) { (Some(text), _) => self.notify_user(text.into()), @@ -679,7 +678,7 @@ impl Player { .is_some_and(|session| session.lift_sub(lane, idx)); let text = match lifted { true => format!( - "CAPTION LIFTED — {} puts it back", + "CAPTION LIFTED · undo {}", self.keymap.display(ActionId::Undo) ), false => "NOTHING LIFTED — that caption is not there any more".to_string(), @@ -1254,7 +1253,7 @@ impl Player { }; self.notify_user( format!( - "GAP CLOSED on {where_} — {} takes it back", + "GAP CLOSED on {where_} · undo {}", self.keymap.display(ActionId::Undo) ) .into(), @@ -1291,12 +1290,12 @@ impl Player { let notice = match (report.closed, skipped) { (0, 0) => format!("NO GAPS TO CLOSE on {}", lane.label()), (0, 1) => format!( - "NO GAPS CLOSED on {} — 1 skipped at {}; match linked gaps or detach", + "NO GAPS CLOSED on {} — 1 linked gap skipped at {}", lane.label(), report.skipped[0].start ), (0, n) => format!( - "NO GAPS CLOSED on {} — {n} skipped; match linked gaps or detach", + "NO GAPS CLOSED on {} — {n} linked gaps skipped", lane.label() ), (n, 0) => format!( @@ -1592,7 +1591,7 @@ impl Player { _ => self.selected.anchor(), }) else { self.notify_user( - "NOTHING TO CROSSFADE — select an audio clip that has a neighbour".into(), + "NOTHING TO CROSSFADE — no audio clip selected".into(), ); cx.notify(); return; @@ -1601,7 +1600,7 @@ impl Player { if let Some(session) = &mut self.session { if !session.crossfade(lane, idx, frames) { self.notify_user( - "NOTHING TO CROSSFADE — it takes two audio clips sitting end to end on one lane" + "NOTHING TO CROSSFADE — no neighbour end to end" .into(), ); } @@ -1624,7 +1623,7 @@ impl Player { _ => self.selected.anchor(), }) else { self.notify_user( - "NOTHING TO DISSOLVE — select a video clip that has a neighbour".into(), + "NOTHING TO DISSOLVE — no video clip selected".into(), ); cx.notify(); return; @@ -1641,7 +1640,7 @@ impl Player { }; if !session.set_transition_out(lane, idx, frames) { self.notify_user( - "NOTHING TO DISSOLVE — it takes two video clips sitting end to end on one lane" + "NOTHING TO DISSOLVE — no neighbour end to end" .into(), ); } else if removing { diff --git a/crates/app/src/player/view.rs b/crates/app/src/player/view.rs index e7df591..0e5f60e 100644 --- a/crates/app/src/player/view.rs +++ b/crates/app/src/player/view.rs @@ -55,7 +55,7 @@ impl Player { pub(crate) fn select_under_playhead(&mut self, cx: &mut Context) { let under = self.under_playhead(); let Some(&first) = under.first() else { - self.notify_user("NOTHING UNDER THE PLAYHEAD — move it onto a clip first".into()); + self.notify_user("NOTHING UNDER THE PLAYHEAD".into()); cx.notify(); return; }; @@ -133,7 +133,7 @@ impl Player { return; } let Some(session) = &mut self.session else { - self.notify_user("no timeline to fit — open a file first".into()); + self.notify_user("no timeline to fit — no file open".into()); cx.notify(); return; }; @@ -151,8 +151,7 @@ impl Player { Some(half) => Some(half), None => { self.notify_user( - "NOTHING TO FIT — a caption has no picture; group it with a clip \ - first (ctrl-click both, then Group)" + "NOTHING TO FIT — a caption has no picture" .into(), ); cx.notify(); diff --git a/crates/app/src/subs.rs b/crates/app/src/subs.rs index 2fa9962..c35bfad 100644 --- a/crates/app/src/subs.rs +++ b/crates/app/src/subs.rs @@ -320,10 +320,10 @@ pub(crate) type Subs = engine::Result>; /// argv named, an import, and an import into an empty window cannot say the same /// thing differently, whichever thread read the cues. /// -/// Worded for where they actually land: a *list* beside the media and nothing -/// over the picture -- a track shows when it is dragged onto a subtitle lane -/// ([`Player::subtitle_overlay`]), so the tail says the next move rather than -/// letting a count read as "and there they are on screen". +/// A count and nothing else (DESIGN §8: the room never explains itself in +/// prose). The tracks land in a *list* beside the media, not over the picture +/// ([`Player::subtitle_overlay`] shows one once it is on a subtitle lane) -- +/// where they went is the list's own geography to say, not this line's. /// /// `None` for a file that gave none and for one whose tracks are on the timeline /// already -- an import that adds nothing says nothing about subtitles. A @@ -334,8 +334,7 @@ pub(crate) fn subtitle_tail(session: &mut PlaybackSession, subs: Subs) -> Option Ok(tracks) => match session.add_subtitle_tracks(tracks) { 0 => None, n => Some(format!( - " — {n} subtitle track(s) in the file, in the subtitle list: drag one onto a \ - subtitle track to show it" + " · {n} subtitle track(s)" )), }, Err(e) => Some(format!(" — SUBTITLES UNREAD: {e}")), diff --git a/crates/app/src/tests/cards.rs b/crates/app/src/tests/cards.rs index 8fb4361..59da863 100644 --- a/crates/app/src/tests/cards.rs +++ b/crates/app/src/tests/cards.rs @@ -1428,7 +1428,7 @@ fn a_choice_list_offers_every_value_and_fits_the_smallest_window() { assert!(tall <= 360., "the list is taller than the floor"); assert_eq!( menu_at(point(px(600.), px(340.)), size(px(640.), px(360.)), tall), - (640. - MENU_W, 360. - tall), + (640. - crate::layout::MENU_EDGE - MENU_W, 360. - crate::layout::MENU_EDGE - tall), "the list would hang off the smallest window" ); } diff --git a/crates/app/src/tests/editing.rs b/crates/app/src/tests/editing.rs index d56b980..2480851 100644 --- a/crates/app/src/tests/editing.rs +++ b/crates/app/src/tests/editing.rs @@ -983,12 +983,14 @@ fn the_clip_menu_dims_what_the_playhead_is_not_on_and_stays_in_the_window() { assert_eq!(menu_at(point(px(10.), px(10.)), viewport, 150.), (10., 10.)); assert_eq!( menu_at(point(px(700.), px(380.)), viewport, 150.), - (800. - MENU_W, 250.) + (800. - crate::layout::MENU_EDGE - MENU_W, 400. - crate::layout::MENU_EDGE - 150.) ); - // A window smaller than the menu loses its bottom, never its top. + // A window smaller than the menu loses its bottom, never its top: the + // top-left margin wins over the bottom-right one, because the items are + // at the top. assert_eq!( menu_at(point(px(90.), px(40.)), size(px(100.), px(50.)), 150.), - (0., 0.) + (crate::layout::MENU_EDGE, crate::layout::MENU_EDGE) ); // Every item is an action the registry knows, so the menu and the keys // menu say the same thing about it -- and none of them is unreachable @@ -1015,7 +1017,7 @@ fn the_clip_menu_dims_what_the_playhead_is_not_on_and_stays_in_the_window() { menu_at(point(px(0.), px(0.)), floor, { MENU_PAD * 2. + menu_rows_h(items, floor) }), - (0., 0.) + (crate::layout::MENU_EDGE, crate::layout::MENU_EDGE) ); // The picker is the same card and the longest list in it is the palette // family list, which grows every time somebody asks for more colours. @@ -1219,6 +1221,67 @@ fn a_menu_offers_only_what_applies_and_is_drawn_inside_the_window() { assert!(menu_rows_h(items, size(px(640.), px(360.))) < items as f32 * MENU_ROW_H); } +/// Defects 2 and 3 of the menu-placement lane, as source guards -- this binary +/// has no `VisualTestContext`, so where an element *mounts* and what its dim +/// column *says* are read off the source the way every other layout scan here +/// is. +/// +/// 1. All three hanging menus mount on the room's ROOT. Mounted inside +/// `stance-centre` the clip menu's window-coordinate anchor was laid out +/// from the centre column's own origin and painted under the dock, which is +/// the "chords cut mid-word" the user photographed. +/// 2. The library menu hangs a row clear of the pointer, so it cannot cover the +/// row it is about. +/// 3. The library rows carry chords, not prose. DESIGN §4 puts the stroke in +/// that column and §8 forbids the instructional copy that used to sit there. +#[test] +fn the_hanging_menus_mount_at_the_room_root_and_their_rows_wear_chords_not_prose() { + let stance = src_text("ui/stance.rs"); + let (centre, root) = stance + .split_once(".child(divider(Split::Dock,") + .expect("the dock seam splits the centre column from the room root"); + for menu in [ + "children(player.context_card(", + "children(player.library_card(", + "children(player.picker_card(", + ] { + assert!( + root.contains(menu), + "{menu} must mount after the dock, on the room root" + ); + assert!( + !centre.contains(menu), + "{menu} mounted inside stance-centre paints under the dock" + ); + } + let library = src_text("ui/library.rs"); + assert!( + library.contains("menu.at.y + px(ROW_CLEAR)"), + "the library menu must hang clear of the row it names" + ); + // Exactly one row wears a chord, and it is the one `ui/stance.rs`'s + // `enter` branch actually answers; every other row's column is empty. + for item in ROW_ITEMS { + let hint = item.hint(); + match item { + RowItem::Add => { + assert_eq!(hint, "↵"); + assert!( + stance.contains("if key == \"enter\"\n && this.dock_src_active"), + "the ↵ this menu advertises must still be the stroke that adds" + ); + } + _ => assert!(hint.is_empty(), "{:?} prints prose: {hint:?}", item.label()), + } + // §9: no junk drawer. A label that fits the plate whole beside its + // chord, and never a sentence. + assert!(item.label().split_whitespace().count() <= 4, "{}", item.label()); + } + // The two removes must not read as the same verb now that the column + // beside them is empty. + assert_ne!(RowItem::Remove.label(), RowItem::RemoveWithClips.label()); +} + /// The other half of the keys menu's guarantee, and the audit this batch was /// asked for kept as a test: no action may be a stroke and nothing else. /// The actions card answers it for all of them at once -- its rows come off diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index aaaa842..373915f 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -2206,9 +2206,11 @@ fn every_darkroom_menu_sizes_its_list_against_the_floor_room_not_the_raw_viewpor to the picture floor (the 'menu in somewhere nonsense' defect)" ); assert!( - library.contains("menu_at(menu.at, viewport"), - "ui/library.rs no longer anchors its menu to the pointer through \ - menu_at -- update this guard" + library.contains("menu_at(at, viewport, h)") + && library.contains("point(menu.at.x, menu.at.y + px(ROW_CLEAR))"), + "ui/library.rs no longer anchors its menu to the pointer -- one row \ + clear of it, so the menu cannot cover the row it names -- through \ + menu_at; update this guard" ); } @@ -2724,7 +2726,9 @@ fn the_bench_answers_a_wheel_notch_anywhere_over_it() { "the row's wheel lost the mapping or its stop: {}", &row_wheel[..200] ); - let content = bench.find(".id(\"bench-content\")").expect("no bench content"); + let content = bench + .find(".id(\"bench-content\")") + .expect("no bench content"); let content_wheel = bench[content..] .find(".on_scroll_wheel(") .expect("the bench container does not answer the wheel"); @@ -2791,7 +2795,14 @@ fn the_seam_paints_nothing_until_a_pointer_finds_it() { body.contains("gpui::transparent_black()"), "the divider's line is inked at rest: {body}" ); - for step in [".hover(", "STROKE_DIVIDER()", "INK3()", "border_t_1()", "border_l_1()"] { + for step in [ + ".hover(", + "GRAB_W", + "STROKE_DIVIDER()", + "INK3()", + "border_t_1()", + "border_l_1()", + ] { assert!(body.contains(step), "the divider is missing {step}"); } } @@ -2814,3 +2825,625 @@ fn the_lane_bed_clips_its_clips_at_the_pinned_heads() { pinned lane heads: {bed}" ); } + +/// A source row is its name first (user 2026-09-09: "clunky, crowded and +/// problematic"). At DOCK_W 280 the name used to be the only flexible child +/// among six, so it measured 0px and the library showed +/// `● V1 A1 · 2 uses Preview Add ↵ ○` -- every part of a row except the one +/// thing the row is for. The fix is subtraction, not a hover gate (DESIGN §8): +/// the name keeps 60% of the row, usage joins the metadata line under it, and +/// the three verbs shrink to glyph ghosts at the right edge. +#[test] +fn a_source_row_shows_its_name_before_anything_else() { + let dock = src_text("ui/dock_stance.rs"); + let start = dock.find("fn source_row(").expect("the source row"); + let row = &dock[start..dock.find("/// Imported subtitle tracks").expect("its end")]; + assert!( + row.contains(".min_w(relative(0.6))"), + "the row name can still collapse under its siblings" + ); + assert!( + !row.contains(".min_w(px(0.))"), + "the row name is still allowed to measure nothing" + ); + // The usage moved to the second line, beside codec/length, in ink3. + assert!( + row.contains(r#".child(format!("{usage} · {under}"))"#), + "usage is not folded into the metadata line" + ); + // Preview / Add / proxy are glyph+chord ghosts now, not word buttons: + // ~66px for the three together, inside the 96px the name can spare. + for glyph in [r#".child("▷")"#, r#".child("+")"#, r#".child("↵")"#] { + assert!(row.contains(glyph), "the right-edge verbs lost {glyph}"); + } + for word in [r#".child("Preview")"#, r#".child("Add")"#] { + assert!(!row.contains(word), "{word} still spends the name's width"); + } + // Every verb keeps its own hitmap name and its chord. + for id in ["source.{i}.preview", "source.{i}.add", "source.{i}.proxy"] { + assert!(row.contains(id), "{id} lost its hitmap entry"); + } + // DESIGN §8: the permanent footer telling the editor how to use a list + // ("drag · ↵ add · double-click plays") is instructional copy and is gone. + assert!( + !dock.contains("double-click plays"), + "the dock still carries an instruction footer" + ); + // ...and an Audio tab with no audio-only file in it is a single noun, not + // the claim `No sound` over a source whose A1 stream is on the bench. + assert_eq!(crate::LibraryTab::Audio.empty(), "none"); +} + +/// Focus and selection rings are drawn, never inserted: a `when(focused, +/// border_1())` puts a pixel of box into the flow and every row in the dock +/// steps sideways the moment the surface takes focus (hunter: h-clip-tab.png +/// vs i-library-menu.png). +#[test] +fn a_dock_ring_never_moves_what_it_rings() { + let dock = src_text("ui/dock_stance.rs"); + for gate in [ + ".when(picked, |d| d.border_1()", + ".when(focused, |d| d.border_1()", + ] { + assert!( + !dock.contains(gate), + "a dock ring is still added on state ({gate}), shifting its content" + ); + } + assert_eq!( + dock.matches("gpui::transparent_black()").count(), + 4, + "a dock ring lost its at-rest transparent border" + ); +} + +/// The spine is 56px and every pair must fit inside it. Measured at +/// 1280x720 the full-size halves did not: hitmap `action.WalkCutPrev10 +/// x=-5 w=31`, `action.AddVideoLane x=-2 w=28` -- the `‹10` glyph was cut +/// at the window's own left edge. Fixed by subtraction (13px + 1px padding +/// for the paired halves, 3px row gap), so this scan is what keeps a new +/// pair from being written at the full row size again. +#[test] +fn every_paired_spine_glyph_is_drawn_at_the_narrow_size() { + let src = src_text("ui/spine_stance.rs"); + // Inside every `pair(...)` call, both halves come from `small`. + let mut rest = src.as_str(); + let mut pairs = 0; + while let Some(at) = rest.find("pair(") { + let after = &rest[at..]; + // The definition and the doc comments are not call sites. + if rest[..at].ends_with("fn ") || rest[..at].ends_with('`') { + rest = &after[5..]; + continue; + } + let mut depth = 0i32; + let mut end = after.len(); + for (i, c) in after.char_indices() { + match c { + '(' => depth += 1, + ')' => { + depth -= 1; + if depth == 0 { + end = i; + break; + } + } + _ => {} + } + } + let body = &after[..end]; + assert!( + !body.contains("glyph("), + "a spine pair draws a full-size glyph, which lays out past the \ + 56px rail: {}", + &body[..body.len().min(120)] + ); + pairs += 1; + rest = &after[end..]; + } + assert!(pairs >= 8, "the spine's pairs went missing ({pairs} found)"); + // And `small` is the narrow one: one step down the §3 scale, 1px sides. + assert!( + src.contains("type_scale::CHORD_METADATA_MIN_PX") + && src.contains("let pad = if paired { 1. } else { 3. };"), + "the paired size/padding subtraction is gone from spine_stance" + ); + assert!( + src.contains(".gap(px(3.))\n .child(left)"), + "the pair row's own gap grew again" + ); +} + +/// DESIGN §8 (no instructional copy) and §9: the keys plate's heading is one +/// noun, its way out is a chord like every other row, and its bottom edge is +/// inside the window -- the shipped plate said `ALL COMMANDS · HOLD ? · +/// RELEASE TO CLOSE` while sitting there latched after a click, with its last +/// rows cut off below y=720. +#[test] +fn the_keys_plate_says_one_noun_and_ends_inside_the_window() { + let src = src_text("ui/stance.rs"); + let lower = src.to_lowercase(); + assert!( + !lower.contains("hold ? · release to close") && !lower.contains("all commands"), + "the keys plate still tells the hand what to do" + ); + assert!( + src.contains("section_head(\"keys\")") && src.contains(".child(\"esc\")"), + "the keys plate lost its noun or its escape chord" + ); + assert!( + src.contains(".h(px((bench_h + LEDGER_H - 16.).max(0.)))"), + "the keys plate is no longer capped inside the bench+ledger footprint" + ); +} + + +/// The ruler's right edge was soup: `bench-select-all` sits `right(4.)` over +/// the tick band while tick suppression only guarded the LEFT plate, so the +/// `00:20` label drew straight under the `all` chord. The control's band is +/// reserved now -- a label whose right edge would enter it is dropped, the +/// mirror of the left rule. +#[test] +fn the_ruler_reserves_a_band_for_its_select_all_control() { + use crate::ui::bench_stance::{SELECT_ALL_PAD, char_w}; + use crate::ui::type_scale::{CHORD_METADATA_MIN_PX, FLOOR_PX}; + let bench = src_text("ui/bench_stance.rs"); + assert!( + bench.contains("x + label_w <= bed_w - all_w"), + "the tick loop no longer keeps the select-all band clear" + ); + // The rule itself, with the shipped widths: `all` + `^a` at the chord + // size, a `00:20` label at the floor size, a 850 px bed. + let all_w = ("all".len() + "^a".len()) as f32 * char_w(CHORD_METADATA_MIN_PX) + SELECT_ALL_PAD; + let label_w = "00:20".len() as f32 * char_w(FLOOR_PX); + let clear = |x: f32| x + label_w <= 850. - all_w; + assert!(!clear(820.), "a tick at the right edge still draws under `all`"); + assert!( + !clear(850. - all_w - label_w + 1.), + "the band's own edge leaks" + ); + assert!(clear(700.), "the rule eats ticks that clear the band"); +} + +/// Clicking `all` selected all AND scrubbed: the control lives inside +/// `bench-ruler`, whose `on_mouse_down` seeks, and the press reached it (the +/// playhead jumped 00:00:11:12 -> 00:00:20:14). The scrub refuses the +/// control's reserved band now -- a `stop_propagation` on the control is what +/// this looks like at first and it does NOT work: gpui builds the control's +/// own click out of that same mouse-down, so stopping it drops the selection +/// (measured live, run 20260909-174243-jZzccm/after-all.png: nothing but the +/// hover changed). +#[test] +fn a_press_on_the_select_all_band_does_not_scrub_the_ruler() { + use crate::ui::bench_stance::select_all_band; + let bench = src_text("ui/bench_stance.rs"); + let at = bench.find(r#".id("bench-ruler")"#).expect("no ruler"); + let listener = &bench[at..at + bench[at..].find(".children(ticks").expect("its ticks")]; + assert!( + listener.contains("bed_w - band") && listener.contains("select_all_band("), + "the ruler's scrub takes the select-all band's presses again: {listener}" + ); + assert!( + !bench[at..].contains("cx.stop_propagation()"), + "a press stopped inside the ruler also swallows the control's own click" + ); + // The rule the listener runs, at the shipped widths: a 850 px bed, `^a`. + let band = select_all_band("^a"); + assert!(band > 30. && band < 70., "the band is not a control's width: {band}"); + assert!(850. - 4. >= 850. - band, "a press on the control still seeks"); + assert!(500. < 850. - band, "a press mid-ruler stopped seeking"); +} + +/// DESIGN §4/§5: the hero timecode leads the time band and the ledger carries +/// position. The ruler's left plate was a third resting copy of the same +/// reading -- it stays only for the state change it belongs to, a live scrub. +#[test] +fn the_ruler_plate_shows_the_timecode_only_while_a_scrub_is_live() { + let bench = src_text("ui/bench_stance.rs"); + let at = bench + .find(".child(playhead_tc)") + .expect("no playhead timecode in the ruler"); + let before = &bench[..at]; + let guard = before + .rfind(".when(player.scrubbing") + .expect("the ruler plate draws its timecode at rest -- the third copy"); + assert!( + before[guard..].matches(".child(").count() <= 2, + "the scrubbing guard is not the plate's own: {}", + &before[guard..guard + 200] + ); + assert!( + bench.contains("let plate_w = if player.scrubbing { PLATE_W } else { 0. };"), + "the ticks still lose the plate's width at rest" + ); +} + + +/// The band overflowed its own column at 1280x720 (`$EDITH_HITMAP`: +/// `action.Export x=1113 w=80` with the column ending at x=995, the contact +/// strip measured `w=0`), so the Export chip was invisible under the dock and +/// a click on blank dock space at (1130,435) opened the export card. Three +/// things hold that shut: the row clips itself, the strip keeps a floor, and +/// the ladder sheds groups above it. +#[test] +fn the_time_band_never_paints_outside_its_own_column() { + let src = src_text("ui/timeband_stance.rs"); + let start = src.find(r#".id("stance-time-band-row")"#).expect("the band row"); + let row = &src[start..start + src[start..].find(".child(hero_timecode(").expect("the timecode")]; + assert!( + row.contains(".overflow_hidden()"), + "the band row lets its children paint (and be clicked) under the dock: {row}" + ); + assert!( + src.contains(".min_w(px(STRIP_MIN_W))"), + "the contact strip is the flex_1 that absorbs the slack; without a floor it measures 0" + ); + assert!(crate::ui::timeband_stance::STRIP_MIN_W >= 120.); +} + +/// DESIGN §7's ladder, one layer per threshold: the four things the band is +/// *for* -- timecode, cut readout, contact strip, Export -- survive every +/// rung, and the sheddable groups go in a fixed order (chords, then the +/// monitoring cluster, then sync/loop, then the range marks), never all at +/// once. Thresholds are the measured group widths; this pins their order and +/// the 1280x720 column (939px measured, spine 56 + dock 285) landing on the +/// marks-only rung, which is what makes Export fit there (it ended at x=991 +/// inside a column ending at 995, against x=1113 under the dock before). +#[test] +fn the_band_sheds_one_layer_per_threshold_in_a_fixed_order() { + use crate::ui::timeband_stance::band_layers; + let ladder = [2000., 1300., 1100., 939., 800., 0.] + .map(|w| band_layers(w)) + .map(|l| (l.chords, l.volume, l.sync, l.marks)); + assert_eq!( + ladder, + [ + (true, true, true, true), + (false, true, true, true), + (false, false, true, true), + (false, false, false, true), + (false, false, false, false), + (false, false, false, false), + ], + "the band must drop chords, then the monitoring cluster, then sync/loop, then the marks" + ); + // Monotone: a wider band never shows less than a narrower one. + let mut prev = band_layers(0.); + for w in (0..2400).step_by(10).map(|w| w as f32) { + let now = band_layers(w); + for (a, b) in [ + (prev.chords, now.chords), + (prev.volume, now.volume), + (prev.sync, now.sync), + (prev.marks, now.marks), + ] { + assert!(b || !a, "layer came back off at {w}px"); + } + prev = now; + } +} + +/// Every door in this band is at least `HIT_MIN` wide and tall (WCAG 2.5.8). +/// The hitmap read `SetIn w=8`, `VolumeDown w=12`, `Loop w=13`, `SetOut w=15`, +/// `Prev/NextSyncPoint w=16` before this: padding on the shared `ghost`, not a +/// bigger glyph. +#[test] +fn every_ghost_in_the_time_band_carries_a_full_hit_area() { + let src = src_text("ui/timeband_stance.rs"); + let start = src.find("fn ghost(").expect("the band's ghost"); + let ghost = &src[start..start + src[start..].find(".child(glyph.into())").expect("its glyph")]; + for needle in [".min_w(px(HIT_MIN))", ".min_h(px(HIT_MIN))"] { + assert!(ghost.contains(needle), "the band's ghost lost {needle}: {ghost}"); + } + assert!(HIT_MIN >= 24.); +} + +/// Mute wore `"{volume}%"` as its glyph while the slider beside it drew the +/// same value: one number, two places, and a toggle with no verb of its own. +/// The level is a mono readout beside the slider now, once. +#[test] +fn the_level_is_written_once_and_mute_wears_a_glyph() { + let src = src_text("ui/timeband_stance.rs"); + assert_eq!( + src.matches(r#"player.volume.percent()"#).count(), + 1, + "the volume level must be written in exactly one place in the band" + ); + assert!( + src.contains(r#"if player.volume.muted { "◁×" } else { "◁))" }"#), + "mute must wear a speaker glyph, struck when muted" + ); + assert!(src.contains("fn volume_readout("), "the level readout is the one place it is written"); +} + +/// `Play` and `StepForward` drew the same solid right-triangle: two verbs one +/// shape, told apart only by their chords. Step wears the frame-step pair. +#[test] +fn transport_verbs_differ_by_shape_not_only_by_chord() { + let src = src_text("ui/timeband_stance.rs"); + let glyph = |action: &str| { + let at = src.find(&format!("ActionId::{action},")).expect("the call"); + src[..at].rsplit('"').nth(1).expect("its glyph").to_string() + }; + let shapes = ["Play", "StepBack", "StepForward", "JumpBack", "JumpForward"].map(glyph); + let mut seen = shapes.to_vec(); + seen.sort(); + seen.dedup(); + assert_eq!(seen.len(), shapes.len(), "two transport verbs share one glyph: {shapes:?}"); +} + +/// DESIGN §6: "the cut readout is the odometer". Keyed off the selection it +/// read `cut —/—` immediately after a split -- two clips on the bench, the +/// playhead resting on the new cut, nothing picked. It reads the playhead +/// now: the cut under it, else the next one ahead, else the selection. +#[test] +fn the_cut_readout_counts_from_the_playhead() { + use crate::ui::timeband_stance::odometer_cut; + let at = |start: u32, len: u32| Clip { + fade_in: 0, + fade_out: 0, + transition_out: 0, + start, + in_frame: 0, + out_frame: len, + source: 0, + link: None, + eq: None, + color: None, + transform: None, + fit: FitPolicy::Fit, + speed: Speed::NORMAL, + }; + let lane = [at(0, 30), at(30, 30)]; + assert_eq!(odometer_cut(&lane, 0), Some(0)); + assert_eq!(odometer_cut(&lane, 29), Some(0)); + // The split's own frame: the playhead rests on the SECOND cut's head. + assert_eq!(odometer_cut(&lane, 30), Some(1)); + assert_eq!(odometer_cut(&lane, 59), Some(1)); + // Past the last cut there is nothing to count -- the selection answers. + assert_eq!(odometer_cut(&lane, 60), None); + // In a gap: the next cut ahead of the playhead. + let gapped = [at(0, 10), at(40, 10)]; + assert_eq!(odometer_cut(&gapped, 20), Some(1)); + assert_eq!(odometer_cut(&[], 0), None); + assert!( + src_text("ui/timeband_stance.rs").contains("odometer_cut(s.lane_clips(lane), frame)"), + "the readout must derive its odometer from the playhead" + ); +} + +/// DESIGN §8's rejected pattern, swept over the source rather than argued +/// per message: "the room never explains itself in prose ... any new string +/// over ~4 words that instructs rather than reports state is a defect". The +/// notices are what the ledger strip paints, and a sentence there is what cut +/// mid-word in the user's own screenshot (`OPENED ... 1 subtitle track(s) in `). +/// +/// The scan reads every notice-shaped literal -- one whose first word is a +/// state word in capitals, which is how every message this window pushes +/// opens -- and refuses one that is both long (over eight words) and +/// instructional (an imperative tell). A refusal *claim* may still be long: +/// those are the allowlist below, each one naming a genuine absent capability, +/// never a lesson in how to use the room. +#[test] +fn no_notice_teaches_the_room_in_prose() { + // Long refusal claims that report a capability genuinely absent from this + // machine (DESIGN §8, "a refusal string is a claim"), kept whole on + // purpose: the remedy is not a chord in this room because the missing + // thing is not in this room. + const ALLOWED: &[&str] = &["NO FILE CHOOSER"]; + const TELLS: &[&str] = &[ + "drag ", + "press ", + "pick ", + "type ", + "click ", + "to show", + "to use", + "takes it back", + "puts it back", + "first", + "instead", + ]; + let mut offenders = Vec::new(); + for path in source_files() { + let text = std::fs::read_to_string(&path).expect("a source file"); + for literal in string_literals(&text) { + // A notice opens with its state in capitals -- placeholders in + // front of it (`{count} SILENCES CUT`) are stepped over. + let head = literal + .split_whitespace() + .find(|word| !word.starts_with('{')) + .unwrap_or(""); + let shouty = head.len() >= 2 + && head + .chars() + .all(|c| c.is_ascii_uppercase() || c == '-' || c == ':'); + if !shouty || ALLOWED.iter().any(|allowed| literal.starts_with(allowed)) { + continue; + } + let long = literal.split_whitespace().count() > 8; + if long && TELLS.iter().any(|tell| literal.contains(tell)) { + offenders.push(format!("{}: {literal}", path.display())); + } + } + } + assert!( + offenders.is_empty(), + "a notice that instructs instead of reporting state (DESIGN §8):\n{}", + offenders.join("\n") + ); +} + +/// Every string literal in `text`, comments dropped first so the prose about +/// a message is never read as the message. +fn string_literals(text: &str) -> Vec { + let code: String = text + .lines() + .filter(|line| !line.trim_start().starts_with("//")) + .collect::>() + .join("\n"); + let mut out = Vec::new(); + let mut chars = code.chars().peekable(); + while let Some(c) = chars.next() { + if c != '"' { + continue; + } + let mut literal = String::new(); + while let Some(c) = chars.next() { + match c { + // A line continuation joins the halves of a wrapped message; + // every other escape is not a word either way. + '\\' => { + if chars.next() == Some('\n') { + while chars.peek() == Some(&' ') { + chars.next(); + } + } + } + '"' => break, + _ => literal.push(c), + } + } + out.push(literal); + } + out +} + +/// The export moment holds the file and the budget; everything a project is +/// *delivered as* is a settings row now (user: the export card was "too +/// complicated"). Four rows, and a fifth would be the card growing back -- +/// this is a source scan for the same reason every guard on this page is. +#[test] +fn the_export_section_is_four_rows_and_no_fifth() { + let source = src_text("ui/settings_stance.rs"); + let start = source + .find("fn export_section(") + .expect("the export section"); + let body = &source[start..]; + let end = body.find("\n/// The page itself").expect("the page's render fn"); + let body = &body[..end]; + let rows = [ + "settings-export-picture", + "settings-export-sound", + "settings-export-encoder", + "settings-export-range", + ]; + for row in rows { + assert!(body.contains(row), "the EXPORT section has no {row} row"); + } + // The Sound row is written twice -- a rated codec's keyed row and an + // unrated one's readout, never both at once -- so the count is by label, + // not by id. + for label in ["\"Picture\"", "\"Sound\"", "\"Encoder\"", "\"Range\""] { + assert!(body.contains(label), "the EXPORT section has no {label} row"); + } + let ids = body.match_indices("\"settings-export-").count(); + assert_eq!(ids, 5, "the EXPORT section grew a row past the four (the two Sound rows are one row's two shapes)"); + assert!( + source.contains("what a delivery is written as"), + "the section lost its head" + ); + // Every row wears its chord (DESIGN §4): three keyed rows plus the + // range's own marks, which are keymap actions. + for chord in ["\"c\"", "\"b\"", "\"e\"", "ActionId::SetIn"] { + assert!(body.contains(chord), "an EXPORT row lost its chord {chord}"); + } +} + +/// `c` walks the nine files in one order -- a codec's two boxes side by side, +/// the sound-only formats last -- and never stops on a format this machine +/// cannot write, because [`Player::set_format`] would only refuse it back. +#[test] +fn the_picture_row_cycles_codec_and_container_together_and_skips_a_refusal() { + use crate::ui::settings_stance::{PICTURE_CYCLE, next_picture, picture_label}; + assert_eq!( + PICTURE_CYCLE, + [ + Format::Mp4, + Format::Av1Mp4, + Format::Av1, + Format::Hevc, + Format::HevcMp4, + Format::Wav, + Format::Flac, + Format::Mp3, + Format::Ogg, + ] + ); + // Nothing refused: the whole ring, wrapping back to the head. + let mut at = Format::Mp4; + let mut walked = vec![at]; + for _ in 1..PICTURE_CYCLE.len() { + at = next_picture(at, |_| false); + walked.push(at); + } + assert_eq!(walked, PICTURE_CYCLE.to_vec()); + assert_eq!(next_picture(at, |_| false), Format::Mp4); + + // HEVC unavailable (no plugin): `c` steps over both of its boxes rather + // than parking on a pick the setter refuses. + let no_hevc = |f: Format| matches!(f, Format::Hevc | Format::HevcMp4); + assert_eq!(next_picture(Format::Av1, no_hevc), Format::Wav); + // Everything refused: the row keeps what it has instead of cycling to + // nothing. + assert_eq!(next_picture(Format::Mp4, |_| true), Format::Mp4); + + assert_eq!(picture_label(Format::Mp4), "H.264 · MP4"); + assert_eq!(picture_label(Format::Av1), "AV1 · MKV"); + assert_eq!(picture_label(Format::Av1Mp4), "AV1 · MP4"); + assert_eq!(picture_label(Format::Wav), "WAV"); +} + +/// A refused codec is greyed with its reason, never hidden (DESIGN §8), and +/// the reason is short enough to sit beside a value: six words, the rest of +/// the sentence still said by the export moment's own banner. The sound row +/// wears a chord only where its codec has a rate to step. +#[test] +fn a_refusal_is_six_words_beside_the_value_and_soundless_codecs_wear_no_chord() { + use crate::ui::settings_stance::{encoder_word, short_reason, sound_codec}; + let long = "HEVC needs the VA-API plugin, which this machine has not built"; + assert_eq!(short_reason(long), "HEVC needs the VA-API plugin, which"); + assert!(short_reason(long).split_whitespace().count() <= 6); + assert_eq!(short_reason("no encoder here"), "no encoder here"); + + for (format, codec, rated) in [ + (Format::Mp4, "AAC", true), + (Format::Av1, "AAC", true), + (Format::Mp3, "MP3", true), + (Format::Wav, "PCM", false), + (Format::Flac, "FLAC", false), + (Format::Ogg, "Vorbis", false), + ] { + assert_eq!(sound_codec(format), (codec, rated), "{format:?}"); + } + + assert_eq!(encoder_word(EncoderSeat::Auto), "auto"); + assert_eq!(encoder_word(EncoderSeat::Hardware), "GPU"); + assert_eq!(encoder_word(EncoderSeat::Software), "software"); +} + +/// The one amber line on the page is the AV1-on-the-GPU seat, and it is the +/// only hue the EXPORT rows introduce -- every other value is an ink. +#[test] +fn the_only_hue_in_the_export_section_is_the_av1_gpu_notice() { + let source = src_text("ui/settings_stance.rs"); + let start = source + .find("fn export_section(") + .expect("the export section"); + let body = &source[start..]; + let body = &body[..body.find("\n/// The page itself").expect("the render fn")]; + assert!( + body.contains("NOTICE_LOOK()"), + "the AV1-on-the-GPU row lost its amber" + ); + assert_eq!( + crate::ui::settings_stance::AV1_GPU_NOTICE, + "ignores the budget \u{2014} constant quality" + ); + for hue in ["ACCENT_", "STATUS_", "NOTICE_TELL", "NOTICE_DECIDE"] { + assert!( + !body.contains(hue), + "the EXPORT rows reached for a second hue ({hue})" + ); + } +} diff --git a/crates/app/src/tests/view.rs b/crates/app/src/tests/view.rs index de6fe56..d6face9 100644 --- a/crates/app/src/tests/view.rs +++ b/crates/app/src/tests/view.rs @@ -111,11 +111,11 @@ fn a_lane_refuses_the_files_it_cannot_hold_before_the_release_says_so() { let movie = Path::new("/media/take.mp4"); assert_eq!( lane_refuses(sound, video, false).as_deref(), - Some("NOT ON V1 — take.mp3 has no picture; drop it on an audio lane") + Some("NOT ON V1 — take.mp3 has no picture") ); assert_eq!( lane_refuses(still, audio, true).as_deref(), - Some("NOT ON A1 — card.png is a still image; drop it on a video lane") + Some("NOT ON A1 — card.png is a still image") ); // ...and every lane a file *can* go on says nothing at all, which is a // ghost drawn in the file's own colour. @@ -131,7 +131,7 @@ fn a_lane_refuses_the_files_it_cannot_hold_before_the_release_says_so() { // twin above got -- `has_video` is what decides it now, not the suffix. assert_eq!( lane_refuses(movie, video, false).as_deref(), - Some("NOT ON V1 — take.mp4 has no picture; drop it on an audio lane") + Some("NOT ON V1 — take.mp4 has no picture") ); // ...and a subtitle lane holds none of the three: a caption comes off the // Subtitles list, which is where the refusal points. diff --git a/crates/app/src/timeline_math.rs b/crates/app/src/timeline_math.rs index 22a52eb..c566853 100644 --- a/crates/app/src/timeline_math.rs +++ b/crates/app/src/timeline_math.rs @@ -659,10 +659,10 @@ pub(crate) fn lane_refuses(path: &Path, lane: Lane, has_video: bool) -> Option Some(format!( - "NOT ON {label} — {name} has no picture; drop it on an audio lane" + "NOT ON {label} — {name} has no picture" )), LaneKind::Audio if engine::is_image(path) => Some(format!( - "NOT ON {label} — {name} is a still image; drop it on a video lane" + "NOT ON {label} — {name} is a still image" )), // A subtitle lane holds words and no media at all: the refusal is here // rather than at the engine's door so the shadow is tinted red on the diff --git a/crates/app/src/transport.rs b/crates/app/src/transport.rs index 355beb9..7acb3c0 100644 --- a/crates/app/src/transport.rs +++ b/crates/app/src/transport.rs @@ -8,7 +8,7 @@ pub(crate) const NO_FILE: &str = "no file open"; /// What a press of play says when there is nothing to play: no timeline at all /// and an emptied one are the same answer to the user, so they are one line. -pub(crate) const NOTHING_TO_PLAY: &str = "NOTHING TO PLAY — put a clip on the timeline first"; +pub(crate) const NOTHING_TO_PLAY: &str = "NOTHING TO PLAY — the timeline is empty"; /// Whether a press of play would have anything to play. No timeline at all and /// one every clip has been taken off are the same state to a transport, and the diff --git a/crates/app/src/ui/bench_stance.rs b/crates/app/src/ui/bench_stance.rs index fb141bb..de4eb48 100644 --- a/crates/app/src/ui/bench_stance.rs +++ b/crates/app/src/ui/bench_stance.rs @@ -63,6 +63,25 @@ const TICK_MIN_PX: f64 = 64.; const PLATE_W: f32 = 11. * crate::layout::LIST_CHAR_W / type_scale::CHORD_METADATA_MIN_PX * type_scale::CHORD_METADATA_MAX_PX + 9.; +/// The reserved right-edge band `bench-select-all` sits in: its own +/// `right(4.)` offset, the `px(3.)` either side of its text and the `gap(3.)` +/// between the label and its chord. The band's text width is measured per +/// render (the chord is keymap-dependent) and added to this. +pub(crate) const SELECT_ALL_PAD: f32 = 4. + 3. + 3. + 3.; +/// The width of that band for a given chord: `all`, the chord, and the +/// padding around them. Read by the tick loop (no label may enter it) and by +/// the ruler's own scrub listener (no press inside it seeks) -- one rule, so +/// the two can never disagree about where the control's edge is. +pub(crate) fn select_all_band(chord: &str) -> f32 { + ("all".len() + chord.chars().count()) as f32 * char_w(type_scale::CHORD_METADATA_MIN_PX) + + SELECT_ALL_PAD +} +/// A mono character's width at `size_px`, from the shared +/// [`crate::layout::LIST_CHAR_W`] calibration (taken at +/// [`type_scale::CHORD_METADATA_MIN_PX`]). +pub(crate) fn char_w(size_px: f32) -> f32 { + crate::layout::LIST_CHAR_W / type_scale::CHORD_METADATA_MIN_PX * size_px +} /// The pinned track-head column: wide enough for its lane-specific ghost /// verbs and their compact chords without shrinking their pointer targets. const HEAD_W: f32 = 72.; @@ -1278,18 +1297,26 @@ pub(crate) fn render( // first tick at or after the bed's left edge to the bed's right edge. // Guarded on `pps > 0` -- a zero scale (no session yet) has no interval // that ever advances past the bed's own width, which would loop forever. - // FAULT 4: the playhead timecode plate is pinned at `left_0`..`PLATE_W` - // over the ruler (DESIGN §5), so a tick whose label would land under it - // is suppressed here rather than drawn and overlapped -- the plate - // already owns that lane. + // The ruler's two reserved bands, and no tick label may enter either. + // Left: the playhead timecode plate, which now shows only while a scrub + // drag is live (the hero timecode leads the time band at rest, DESIGN + // §4, and the ledger keeps position, §5 -- a third resting copy is the + // crowding) -- at rest the band is zero and the ticks have the width + // back. Right: `bench-select-all`, which used to be drawn straight over + // the `00:20` label because only the left plate was ever suppressed. + let plate_w = if player.scrubbing { PLATE_W } else { 0. }; + let all_chord = player.keymap.chord(ActionId::SelectAll); + let all_w = select_all_band(&all_chord); let mut ticks = Vec::new(); if scale.pps > 0. { let interval = tick_interval(scale.pps); let mut t = (scale.start / interval).ceil() * interval; while scale.px_at(t) <= bed_w { let x = scale.px_at(t).max(0.); - if x >= PLATE_W { - ticks.push((x, tick_mmss(t))); + let label = tick_mmss(t); + let label_w = label.chars().count() as f32 * char_w(type_scale::FLOOR_PX); + if x >= plate_w && x + label_w <= bed_w - all_w { + ticks.push((x, label)); } t += interval; } @@ -1331,6 +1358,21 @@ pub(crate) fn render( .on_mouse_down( MouseButton::Left, cx.listener(|this, event: &MouseDownEvent, _, cx| { + // The reserved right-edge band is `bench-select-all`'s, + // not the scrub's: a press there used to select all AND + // seek the playhead under the control (11:12 -> 20:14). + // The guard lives here rather than as a + // `stop_propagation` on the control, because stopping + // the press also swallows the control's own click -- + // gpui builds a click out of that same mouse-down. + let bounds = this.ruler.get(); + let bed_w = f32::from(bounds.size.width).max(1.); + let band = select_all_band(&this.keymap.chord(ActionId::SelectAll)); + if f32::from(crate::timeline_math::px_along(event.position.x, bounds)) + >= bed_w - band + { + return; + } this.scrubbing = true; this.scrub_to(event.position.x, true, cx); }), @@ -1362,11 +1404,15 @@ pub(crate) fn render( .w(px(1.)) .bg(rgb(LAMP_WHITE())), ) - .child( - // The pinned playhead timecode plate, DESIGN §5's own - // "playhead's own timecode in a plate at the left edge" -- - // always at `left_0`, never following the scrubbed x, so - // it never overlaps the picture region above it. + .when(player.scrubbing, |ruler| { + // The playhead timecode plate, and ONLY while a scrub drag + // is live: a drag is a state change, which is what a plate + // is for. At rest the hero timecode leads the time band + // (DESIGN §4) and the ledger carries position (§5); this + // was the third resting copy of the same reading. Always + // at `left_0`, never following the scrubbed x, so it never + // overlaps the picture region above it. + ruler.child( div() .absolute() .top_0() @@ -1383,7 +1429,8 @@ pub(crate) fn render( )) .text_color(rgb(INK1())) .child(playhead_tc), - ) + ) + }) .child( div() .id("bench-select-all") @@ -1411,7 +1458,7 @@ pub(crate) fn render( )) .text_color(rgb(INK3())) .child("all") - .child(player.keymap.chord(ActionId::SelectAll)), + .child(all_chord), ), ) .child( diff --git a/crates/app/src/ui/dock_stance.rs b/crates/app/src/ui/dock_stance.rs index f53bf9a..1bcd98d 100644 --- a/crates/app/src/ui/dock_stance.rs +++ b/crates/app/src/ui/dock_stance.rs @@ -353,7 +353,14 @@ fn source_row( // carries no film ink of its own to complement, it is a plain list // line, so the general focus/selection ring applies, the same one // the bench already uses for the same job. - .when(picked, |d| d.border_1().border_color(rgb(INK1()))) + .border_1() + .border_color(match picked { + // The ring is always in flow -- transparent at rest, ink1 when + // picked -- because a `when(picked, border_1())` added a pixel of + // box on selection and shoved every row's text sideways. + true => rgb(INK1()).into(), + false => gpui::transparent_black(), + }) // Right-click ANYWHERE on the row opens the row's menu -- Add, // Remove, Reveal, Properties (DESIGN §9: "verbs of the thing under // the cursor"). It used to hang off the 8px ink dot alone, and only @@ -446,22 +453,22 @@ fn source_row( let style = mono(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM); div() .flex_1() - .min_w(px(0.)) + // FAULT: this was `min_w(px(0.))` -- the row's five + // flex_none siblings (usage, Preview, Add ↵, proxy) + // took their full width first and the name, the one + // thing a row is *for*, collapsed to nothing at the + // default dock width: the library read `● V1 A1 · 2 + // uses Preview Add ↵ ○` with no filename at all. The + // name is the first line and keeps at least 60% of + // the row; the verbs shrank to glyph ghosts and the + // usage moved down to the metadata line. + .min_w(relative(0.6)) .truncate() .font(style.font) .text_size(style.size) .text_color(rgb(INK1())) .child(name) }) - .child({ - let style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM); - div() - .flex_none() - .font(style.font) - .text_size(style.size) - .text_color(rgb(INK3())) - .child(usage) - }) .when(usable, |d| { d.child({ let style = label(type_scale::FLOOR_PX, FontWeight::MEDIUM); @@ -490,7 +497,7 @@ fn source_row( .font(style.font) .text_size(style.size) .text_color(rgb(INK2())) - .child("Preview"), + .child("▷"), ) }) }) @@ -544,7 +551,7 @@ fn source_row( .font(label_style.font) .text_size(label_style.size) .text_color(rgb(INK2())) - .child("Add"), + .child("+"), ) .child( div() @@ -612,7 +619,7 @@ fn source_row( .font(style.font) .text_size(style.size) .text_color(rgb(INK3())) - .child(under) + .child(format!("{usage} · {under}")) }) } @@ -707,7 +714,14 @@ fn subtitle_tab_rows(player: &Player, cx: &mut Context) -> (usize, Vec rgb(INK1()).into(), + false => gpui::transparent_black(), + }) .when(!usable, |d| d.opacity(0.5)) .when(usable, |d| { d.cursor_pointer() @@ -963,7 +977,11 @@ fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context) - .on_key_down(cx.listener(move |this, event: &KeyDownEvent, window, cx| { cycle_on_key_down(Surface::Dock)(this, event, window, cx) })) - .when(focused, |d| d.border_1().border_color(rgb(STROKE_FOCUS()))) + .border_1() + .border_color(match focused { + true => rgb(STROKE_FOCUS()).into(), + false => gpui::transparent_black(), + }) .flex_1() .min_h(px(0.)) .flex() @@ -1145,19 +1163,6 @@ fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context) - }), )), ) - .child({ - // Metadata, not a row: DESIGN §3's metadata role, and the quietest - // text in the dock: ink3, tight leading so it never competes with - // the source rows above it. - let style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM); - div() - .flex_none() - .line_height(relative(1.25)) - .font(style.font) - .text_size(style.size) - .text_color(rgb(INK3())) - .child("drag · ↵ add · double-click plays") - }) } /// The transition a clip carries into its immediate successor, if any -- a @@ -1285,7 +1290,11 @@ fn clip_tab( .on_key_down(cx.listener(move |this, event: &KeyDownEvent, window, cx| { cycle_on_key_down(Surface::Inspector)(this, event, window, cx) })) - .when(focused, |d| d.border_1().border_color(rgb(STROKE_FOCUS()))) + .border_1() + .border_color(match focused { + true => rgb(STROKE_FOCUS()).into(), + false => gpui::transparent_black(), + }) .flex_1() .min_h(px(0.)) .flex() diff --git a/crates/app/src/ui/library.rs b/crates/app/src/ui/library.rs index e7812f1..c767084 100644 --- a/crates/app/src/ui/library.rs +++ b/crates/app/src/ui/library.rs @@ -4,6 +4,18 @@ use crate::ui::type_scale::Typeset; use crate::ui::widgets::*; use crate::*; +/// How far below the pointer a library menu hangs so it clears the row it was +/// opened on: a source row is two lines (`dock_stance::source_row` -- `py(4.)` +/// twice, a `gap(2.)` and two ~20px line boxes), and the pointer may land on +/// its very first pixel. +/// +/// corner-cut: a constant rather than the row's measured bottom, which the +/// `on_mouse_down` listener that sets `LibraryMenu::at` has no access to. The +/// ceiling is a row that grows a third line -- the menu would then start +/// inside it. Upgrade path: carry the row's `Bounds` bottom in `LibraryMenu` +/// via a `canvas`/`prepaint` probe in `source_row` and hang the menu off that. +const ROW_CLEAR: f32 = 52.; + impl Player { /// The menu a right-click on a library row opens: what can be done with the /// *file* rather than with a clip of it, and a turn-over side saying what @@ -161,14 +173,29 @@ impl Player { ); } } - // Placed at the pointer, clamped only to the window's own bounds -- - // standard context-menu behavior. Unlike the clip menu, this menu - // mounts on the root over the dock (no picture behind it to protect), - // so it does not go through `menu_floor`'s picture-floor clamp; doing - // so pulled a right-click high in the dock down to the picture floor, - // teleporting the menu away from the pointer that opened it. + // Hung BELOW the row it is about, not on the pointer: opened at the + // pointer it covered the very row it names (`k-lib-menu.png` -- the + // source row vanished under its own menu), and a menu that hides its + // subject is DESIGN §11.6's occlusion rule broken on the other panel. + // `menu_at` then does the rest -- left-aligned to the pointer, pulled + // back inside all four window edges, and flipped up above the row + // where the dock has no room below. Unlike the clip menu it does not + // go through `menu_floor`'s picture-floor clamp: it mounts over the + // dock, which has no picture behind it, and clamping there pulled a + // right-click high in the dock down to the picture floor, teleporting + // the menu away from the pointer that opened it. let list_h = menu_rows_h(rows.len(), viewport); - let (x, y) = menu_at(menu.at, viewport, MENU_PAD * 2. + list_h); + let h = MENU_PAD * 2. + list_h; + let below = point(menu.at.x, menu.at.y + px(ROW_CLEAR)); + // Above the row instead when the plate would not fit whole below it: + // `menu_at`'s own clamp would otherwise slide it back up *over* the + // row, which is the thing this placement exists to prevent. + let at = if f32::from(below.y) + h + MENU_EDGE > f32::from(viewport.height) { + point(menu.at.x, px((f32::from(menu.at.y) - h).max(0.))) + } else { + below + }; + let (x, y) = menu_at(at, viewport, h); let full: SharedString = path.display().to_string().into(); Some( scrim() diff --git a/crates/app/src/ui/settings_stance.rs b/crates/app/src/ui/settings_stance.rs index fd39f33..3342b50 100644 --- a/crates/app/src/ui/settings_stance.rs +++ b/crates/app/src/ui/settings_stance.rs @@ -89,6 +89,7 @@ fn row_keyed( value, hint, Some(player.keymap.chord(action).into()), + None, player, on_click, INK1(), @@ -108,7 +109,7 @@ fn row_ink( value_ink: u32, ) -> impl IntoElement { row_full( - id, label_text, value, hint, None, player, on_click, value_ink, + id, label_text, value, hint, None, None, player, on_click, value_ink, ) } @@ -123,6 +124,7 @@ fn row_full( value: impl Into, hint: &'static str, chord: Option, + tail: Option<(SharedString, u32)>, player: &Player, on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, value_ink: u32, @@ -162,6 +164,17 @@ fn row_full( .flex() .items_baseline() .gap(px(8.)) + .children(tail.map(|(tail, ink)| { + let tail_style = type_scale::mono( + type_scale::CHORD_METADATA_MIN_PX, + gpui::FontWeight::MEDIUM, + ); + div() + .font(tail_style.font) + .text_size(tail_style.size) + .text_color(rgb(ink)) + .child(tail) + })) .children(chord.map(|chord| { let chord_style = type_scale::mono( type_scale::CHORD_METADATA_MIN_PX, @@ -195,6 +208,7 @@ fn row_static( label_text: &'static str, value: impl Into, hint: &'static str, + chord: Option, value_ink: u32, ) -> impl IntoElement { let value: SharedString = value.into(); @@ -221,10 +235,27 @@ fn row_static( .child( div() .flex_none() - .font(value_style.font) - .text_size(value_style.size) - .text_color(rgb(value_ink)) - .child(value), + .flex() + .items_baseline() + .gap(px(8.)) + .children(chord.map(|chord| { + let chord_style = type_scale::mono( + type_scale::CHORD_METADATA_MIN_PX, + gpui::FontWeight::MEDIUM, + ); + div() + .font(chord_style.font) + .text_size(chord_style.size) + .text_color(rgb(INK3())) + .child(chord) + })) + .child( + div() + .font(value_style.font) + .text_size(value_style.size) + .text_color(rgb(value_ink)) + .child(value), + ), ) } @@ -331,6 +362,7 @@ fn project_section(player: &Player, cx: &mut Context) -> impl IntoElemen "HDR reference", master_val, "the mastering display's own peak white, in cd/m^2, as the grade declared it -- what a 'Reference' tonemap targets before it ever looks at this film's own pixels", + None, master_ink, )) .child(row_static( @@ -338,6 +370,7 @@ fn project_section(player: &Player, cx: &mut Context) -> impl IntoElemen "Content light", content_val, "MaxCLL/MaxFALL: the brightest single pixel and the brightest frame average measured in the finished encode -- what a 'Reference' tonemap actually rolls off from when the file declares it, ahead of the mastering peak above", + None, content_ink, )) .child(row( @@ -408,6 +441,226 @@ fn editor_section(player: &Player, cx: &mut Context) -> impl IntoElement )) } +/// [`row_keyed`] for a stroke that is the *card's* own rather than a binding: +/// the export rows' `c`/`b`/`e` mean nothing outside this page and so are not +/// in the keymap, exactly as the colour and transform cards' keys are not. +/// The badge is drawn from the slot a bound row's is, so no reader can tell -- +/// nor needs to -- which table a stroke came out of (DESIGN §4). +fn row_chord( + id: &'static str, + label_text: &'static str, + value: impl Into, + hint: &'static str, + chord: &'static str, + tail: Option<(SharedString, u32)>, + player: &Player, + on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, +) -> impl IntoElement { + row_full( + id, + label_text, + value, + hint, + Some(chord.into()), + tail, + player, + on_click, + INK1(), + ) +} + +/// The nine files this editor writes, in the order the Picture row cycles +/// them: a codec's two boxes side by side (the container question the export +/// card asked in a row of its own, folded into this one), and the sound-only +/// formats after the pictures. +pub(crate) const PICTURE_CYCLE: [Format; 9] = [ + Format::Mp4, + Format::Av1Mp4, + Format::Av1, + Format::Hevc, + Format::HevcMp4, + Format::Wav, + Format::Flac, + Format::Mp3, + Format::Ogg, +]; + +/// `H.264 · MP4`: the codec by the name it is picked under ([`format_label`]) +/// and the box it lands in. An audio-only format names itself once -- `WAV · +/// WAV` would be the one field on the line that says nothing. +pub(crate) fn picture_label(format: Format) -> String { + match format.has_video() { + true => format!("{} · {}", format_label(format), format.ext().to_uppercase()), + false => format_label(format).to_string(), + } +} + +/// The next file in [`PICTURE_CYCLE`] this machine can actually write. +/// `refused` is the same door [`Player::set_format`] asks, so the stroke never +/// stops on a codec the setter would only refuse back -- the refused ones are +/// still *said*, on the row's own greyed tail (DESIGN §8: never hidden). +/// `current` where every other stop is refused, so `c` cannot cycle to +/// nothing. +pub(crate) fn next_picture(current: Format, refused: impl Fn(Format) -> bool) -> Format { + let n = PICTURE_CYCLE.len(); + let at = PICTURE_CYCLE + .iter() + .position(|&f| f == current) + .unwrap_or_default(); + (1..=n) + .map(|step| PICTURE_CYCLE[(at + step) % n]) + .find(|&f| !refused(f)) + .unwrap_or(current) +} + +/// What the sound of a file in this format is, and whether that codec takes a +/// rate: `AAC 256` steps with `b`, `PCM` has no rate to step and so wears no +/// chord at all. +pub(crate) fn sound_codec(format: Format) -> (&'static str, bool) { + match format { + Format::Wav => ("PCM", false), + Format::Flac => ("FLAC", false), + Format::Ogg => ("Vorbis", false), + Format::Mp3 => ("MP3", true), + _ => ("AAC", true), + } +} + +/// The seat in the words the artboard writes it in -- lowercase `auto` and +/// `software` because they are what happens, `GPU` because that is the part +/// of this machine a person picked. +pub(crate) fn encoder_word(seat: EncoderSeat) -> &'static str { + match seat { + EncoderSeat::Auto => "auto", + EncoderSeat::Hardware => "GPU", + EncoderSeat::Software => "software", + } +} + +/// The one amber line on this page (`NOTICE_LOOK`, DESIGN §8's "worth a +/// look"): the plugin's AV1 seat is constant-quality, so the budget the +/// export moment now asks for is the one thing this pick does not honour. +pub(crate) const AV1_GPU_NOTICE: &str = "ignores the budget \u{2014} constant quality"; + +/// A refusal in six words, which is what fits beside a value on one row -- +/// the whole sentence is still said where the pick is actually refused +/// ([`Player::set_format`]'s own banner). +pub(crate) fn short_reason(why: &str) -> String { + why.split_whitespace().take(6).collect::>().join(" ") +} + +/// EXPORT: the four choices a film is delivered by, off the export card (user: +/// it was "too complicated") and into the room where a project's other +/// once-a-project answers already live. The export moment keeps the file and +/// the budget; the codec, the sound, the encoder and the range are here. +fn export_section(player: &Player, cx: &mut Context) -> impl IntoElement { + let format = player.format; + let refusals: Vec = PICTURE_CYCLE + .into_iter() + .filter_map(|f| { + player + .session + .as_ref() + .and_then(|session| format_refusal(session, f)) + .map(|why| format!("{} {}", format_label(f), short_reason(&why))) + }) + .collect(); + // Never hidden (DESIGN §8): a codec this machine has no encoder for stays + // on the row, greyed, with the reason beside it -- the export card's own + // refusal rows, in the one place a codec is picked now. + let refused_tail = (!refusals.is_empty()).then(|| (refusals.join(" \u{b7} ").into(), INK4())); + let (codec, rated) = sound_codec(format); + let seat = player.encoder_seat(); + let av1_gpu = seat == EncoderSeat::Hardware && matches!(format, Format::Av1 | Format::Av1Mp4); + let range = match player.range { + Some((start, end)) => format!( + "marks {}\u{2013}{}", + timecode(f64::from(start) / player.fps, player.fps), + timecode(f64::from(end) / player.fps, player.fps), + ), + None => "whole film".to_string(), + }; + div() + .flex_none() + .flex() + .flex_col() + .gap(px(2.)) + .child(section_head("EXPORT \u{b7} what a delivery is written as")) + .child(row_chord( + "settings-export-picture", + "Picture", + picture_label(format), + "the codec the picture is written with and the box it lands in; the export moment asks only for the file and the budget", + "c", + refused_tail, + player, + cx.listener(|this, _: &ClickEvent, _, cx| { + this.cycle_export_picture(); + cx.notify(); + }), + )) + .children(rated.then(|| { + row_chord( + "settings-export-sound", + "Sound", + format!("{codec} {}", player.audio_kbps), + "what the sound inside that file is coded at, in kbps", + "b", + None, + player, + cx.listener(|this, _: &ClickEvent, _, cx| { + this.cycle_audio_kbps(); + cx.notify(); + }), + ) + .into_any_element() + })) + // A codec with no rate to pick is a readout, not a button that would + // do nothing when pressed -- and it wears no chord, because there is + // no step for one to take. + .children((!rated).then(|| { + row_static( + "settings-export-sound", + "Sound", + codec, + "this codec carries no rate to pick: it is written as the format itself says", + None, + INK1(), + ) + .into_any_element() + })) + .child(row_chord( + "settings-export-encoder", + "Encoder", + encoder_word(seat), + "which encoder writes the picture: the GPU where this machine has a seat, or the CPU", + "e", + av1_gpu.then(|| (AV1_GPU_NOTICE.into(), NOTICE_LOOK())), + player, + cx.listener(|this, _: &ClickEvent, _, cx| { + this.cycle_encoder(cx); + }), + )) + // Read-only: the range is set on the timeline with the marks + // themselves ([`keymap::ActionId::SetIn`]/`SetOut`), which is where a + // person can see what they are marking. + .child(row_static( + "settings-export-range", + "Range", + range, + "the span an export writes: the whole timeline, or whatever the in/out marks hold", + Some( + format!( + "{} {}", + player.keymap.chord(ActionId::SetIn), + player.keymap.chord(ActionId::SetOut) + ) + .into(), + ), + INK1(), + )) +} + /// The page itself: a plate in the room's own below-picture footprint, /// closed by a click away or `esc` through [`Player::close_card`] like every /// other card here. @@ -513,6 +766,20 @@ pub(crate) fn render( .border_color(rgb(DARK_HAIRLINE())) .pl(px(12.)) .child(editor_section(player, cx)), + ) + // The third column: what a delivery is written as, the + // rows the export card used to hold (user: it was "too + // complicated"). Beside the other two rather than under + // them -- a fold with no scrollbar is the defect this + // page's own two columns exist to avoid. + .child( + div() + .flex_1() + .min_w(px(0.)) + .border_l_1() + .border_color(rgb(DARK_HAIRLINE())) + .pl(px(12.)) + .child(export_section(player, cx)), ), ), ) diff --git a/crates/app/src/ui/spine_stance.rs b/crates/app/src/ui/spine_stance.rs index 2727154..3481281 100644 --- a/crates/app/src/ui/spine_stance.rs +++ b/crates/app/src/ui/spine_stance.rs @@ -47,6 +47,44 @@ fn glyph( player: &Player, cx: &mut Context, ) -> impl IntoElement + use<> { + glyph_sized(false, id, glyph, action, active, quiet, player, cx) +} + +/// The paired half of [`glyph`]: same control, one step down the §3 scale +/// (13px, the chord size) and 1px of side padding instead of 3. Two +/// full-size halves plus their padding measured 66px against a 56px rail +/// and laid out at negative x -- `‹10` was cut at the window's own left +/// edge (hitmap `action.WalkCutPrev10 x=-5 w=31`). Subtraction, not a wider +/// spine: the pair now fits inside the column with room on both sides. +fn small( + id: &'static str, + glyph: &'static str, + action: ActionId, + active: bool, + quiet: bool, + player: &Player, + cx: &mut Context, +) -> impl IntoElement + use<> { + glyph_sized(true, id, glyph, action, active, quiet, player, cx) +} + +#[allow(clippy::too_many_arguments)] +fn glyph_sized( + paired: bool, + id: &'static str, + glyph: &'static str, + action: ActionId, + active: bool, + quiet: bool, + player: &Player, + cx: &mut Context, +) -> impl IntoElement + use<> { + let size = if paired { + type_scale::CHORD_METADATA_MIN_PX + } else { + type_scale::LABEL_ROW_PX + }; + let pad = if paired { 1. } else { 3. }; let enabled = player.enable(action, None); // The badge shows the primary chord only (FAULT 1: a chord badge is a // compact token, not a sentence); the tooltip keeps every stroke an @@ -67,7 +105,7 @@ fn glyph( .flex_col() .items_center() .gap(px(1.)) - .px(px(3.)) + .px(px(pad)) .py(px(1.)) .rounded(px(3.)) .when(active, |d| d.bg(rgb(DARK_RAISED()))) @@ -88,10 +126,7 @@ fn glyph( .line_height(relative(1.05)) // FAULT 1: the glyph is the loudest thing in its row -- BOLD, // not the MEDIUM weight the chord beneath it also wears. - .type_style(type_scale::label( - type_scale::LABEL_ROW_PX, - gpui::FontWeight::BOLD, - )) + .type_style(type_scale::label(size, gpui::FontWeight::BOLD)) .text_color(rgb(if active { INK1() } else if quiet { @@ -132,7 +167,7 @@ fn trim_control(active: bool, player: &Player, cx: &mut Context) -> impl div() .id(id) .flex_none() - .px(px(2.)) + .px(px(1.)) .rounded(px(3.)) .tooltip(move |_, cx| cx.new(|_| Tip(say.clone())).into()) .when(!on, |d| d.opacity(0.4).cursor_not_allowed()) @@ -147,8 +182,9 @@ fn trim_control(active: bool, player: &Player, cx: &mut Context) -> impl .child( div() .line_height(relative(1.05)) + // Paired, so the same step down the scale `small` takes. .type_style(type_scale::label( - type_scale::LABEL_ROW_PX, + type_scale::CHORD_METADATA_MIN_PX, gpui::FontWeight::BOLD, )) .text_color(rgb(if active { INK1() } else { INK2() })) @@ -213,11 +249,10 @@ fn pair(left: impl IntoElement, right: impl IntoElement) -> impl IntoElement { .w_full() .items_center() .justify_center() - // 4px, not 6: two two-glyph halves plus their own padding used to - // measure wider than the 56px rail and bled past its left edge - // (measured at 1280x720: the `AP`/`FS` row started at x=0, outside - // the spine's own surface). - .gap(px(4.)) + // 3px, and both halves come from `small` (13px, 1px padding): two + // full-size halves plus 4px measured 66px against the 56px rail and + // laid out at negative x (hitmap `action.AddVideoLane x=-2 w=28`). + .gap(px(3.)) .child(left) .child(right) } @@ -271,16 +306,16 @@ pub(crate) fn render(player: &Player, cx: &mut Context) -> impl IntoElem cx, )) .child(pair( - glyph("spine-undo", "↺", ActionId::Undo, false, false, player, cx), + small("spine-undo", "↺", ActionId::Undo, false, false, player, cx), // Redo had a legacy toolbar button (`toolbar.rs:347`) but no // darkroom home -- Undo got a glyph here and Redo did not. // Same row, same door (`this.act`), the pair anatomy the // cut-prev/cut-next row below already uses. - glyph("spine-redo", "⟳", ActionId::Redo, false, false, player, cx), + small("spine-redo", "⟳", ActionId::Redo, false, false, player, cx), )) .child(group_head("cut")) .child(pair( - glyph( + small( "spine-cut-prev", "‹", ActionId::WalkCutPrev, @@ -289,7 +324,7 @@ pub(crate) fn render(player: &Player, cx: &mut Context) -> impl IntoElem player, cx, ), - glyph( + small( "spine-cut-next", "›", ActionId::WalkCutNext, @@ -312,7 +347,7 @@ pub(crate) fn render(player: &Player, cx: &mut Context) -> impl IntoElem .items_center() .gap(px(1.)) .child(pair( - glyph( + small( "spine-cut-prev-ten", "‹10", ActionId::WalkCutPrev10, @@ -321,7 +356,7 @@ pub(crate) fn render(player: &Player, cx: &mut Context) -> impl IntoElem player, cx, ), - glyph( + small( "spine-cut-next-ten", "10›", ActionId::WalkCutNext10, @@ -336,7 +371,7 @@ pub(crate) fn render(player: &Player, cx: &mut Context) -> impl IntoElem // Trim-to-playhead (debt #42): the keyboard's own version // of the pointer's drag-to-a-spot trim, beside the nudge // pair it shares its primitive with. - glyph( + small( "spine-trim-in-playhead", "[▮", ActionId::TrimInToPlayhead, @@ -345,7 +380,7 @@ pub(crate) fn render(player: &Player, cx: &mut Context) -> impl IntoElem player, cx, ), - glyph( + small( "spine-trim-out-playhead", "▮]", ActionId::TrimOutToPlayhead, @@ -379,7 +414,7 @@ pub(crate) fn render(player: &Player, cx: &mut Context) -> impl IntoElem .items_center() .gap(px(1.)) .child(pair( - glyph( + small( "spine-zoom-out", "−", ActionId::ZoomOut, @@ -388,7 +423,7 @@ pub(crate) fn render(player: &Player, cx: &mut Context) -> impl IntoElem player, cx, ), - glyph( + small( "spine-zoom-in", "+", ActionId::ZoomIn, @@ -431,7 +466,7 @@ pub(crate) fn render(player: &Player, cx: &mut Context) -> impl IntoElem .items_center() .gap(px(1.)) .child(pair( - glyph( + small( "spine-add-video", "+V", ActionId::AddVideoLane, @@ -440,7 +475,7 @@ pub(crate) fn render(player: &Player, cx: &mut Context) -> impl IntoElem player, cx, ), - glyph( + small( "spine-add-audio", "+A", ActionId::AddAudioLane, @@ -457,7 +492,7 @@ pub(crate) fn render(player: &Player, cx: &mut Context) -> impl IntoElem // beside "Add files" (`dock_stance`), where an editor // already goes to bring a file into the room. .child(pair( - glyph( + small( "spine-add-subtitle", "+S", ActionId::AddSubtitleLane, @@ -466,7 +501,7 @@ pub(crate) fn render(player: &Player, cx: &mut Context) -> impl IntoElem player, cx, ), - glyph( + small( "spine-remove-subtitle", "−S", ActionId::RemoveSubtitleLane, @@ -500,7 +535,7 @@ pub(crate) fn render(player: &Player, cx: &mut Context) -> impl IntoElem .items_center() .gap(px(1.)) .child(pair( - glyph( + small( "spine-settings", "St", ActionId::Settings, @@ -509,7 +544,7 @@ pub(crate) fn render(player: &Player, cx: &mut Context) -> impl IntoElem player, cx, ), - glyph( + small( "spine-screenshot", "Sh", ActionId::Screenshot, diff --git a/crates/app/src/ui/stance.rs b/crates/app/src/ui/stance.rs index c47a5af..20b470f 100644 --- a/crates/app/src/ui/stance.rs +++ b/crates/app/src/ui/stance.rs @@ -224,17 +224,59 @@ mod menu_floor_tests { let floor = below_picture_floor(f32::from(viewport.height), BENCH_H); let (at, room) = menu_floor(point(px(300.), px(20.)), viewport, BENCH_H); assert_eq!(f32::from(at.y), floor); - // 396px of rows (the charter's measured menu height) does not fit in - // the 316px footprint room, so it must be capped to it, not the - // window's 720. - let list_h = (396f32).min(f32::from(room.height)); + // 17 rows -- more than the footprint holds -- sized through the real + // sizer, so the `MENU_EDGE` margin is in the number the clamp sees. + let list_h = crate::oracle::menu_rows_h(17, room); assert!(list_h <= f32::from(room.height)); - let (_, y) = crate::oracle::menu_at(at, viewport, list_h); + let h = crate::layout::MENU_PAD * 2. + list_h; + let (_, y) = crate::oracle::menu_at(at, viewport, h); assert_eq!( y, floor, "the top edge must not be walked back above the floor" ); } + + /// Defect 1 as the user met it (`f-clip-menu.png`): a menu opened near the + /// right and bottom of a 1280x720 window ran off both edges -- chords cut + /// mid-word at the dock seam, rows past the frame. Pure clamp math, both + /// window sizes the charter names, and both the floored (clip) menu and + /// the unfloored (library) one: whatever the anchor, the whole plate lands + /// inside the frame with [`MENU_EDGE`] to spare, and the floored one never + /// buys that room off the picture. + #[test] + fn a_menu_opened_in_the_bottom_right_corner_lands_whole_inside_the_window() { + use crate::layout::{MENU_EDGE, MENU_PAD, MENU_W}; + for viewport in [size(px(1280.), px(720.)), size(px(2560.), px(1440.))] { + let (w, v) = (f32::from(viewport.width), f32::from(viewport.height)); + let floor = below_picture_floor(v, BENCH_H); + for rows in [1usize, 5, 16, 40] { + for anchor in [ + point(px(w - 1.), px(v - 1.)), + point(px(w - 1.), px(0.)), + point(px(0.), px(v - 1.)), + ] { + // The clip menu's path: floored below the picture, sized + // against the room that leaves, then clamped. + let (at, room) = menu_floor(anchor, viewport, BENCH_H); + let h = MENU_PAD * 2. + crate::oracle::menu_rows_h(rows, room); + let (x, y) = crate::oracle::menu_at(at, viewport, h); + assert!(x >= MENU_EDGE && x + MENU_W <= w - MENU_EDGE, "x {x} rows {rows}"); + assert!(y >= MENU_EDGE && y + h <= v - MENU_EDGE, "y {y} h {h} rows {rows}"); + assert!(y >= floor, "y {y} walked above the picture floor {floor}"); + // The library menu's path: no floor, hung a row below the + // pointer, same clamp. + let h = MENU_PAD * 2. + crate::oracle::menu_rows_h(rows, viewport); + let (x, y) = crate::oracle::menu_at( + point(anchor.x, anchor.y + px(52.)), + viewport, + h, + ); + assert!(x >= MENU_EDGE && x + MENU_W <= w - MENU_EDGE, "lib x {x}"); + assert!(y >= MENU_EDGE && y + h <= v - MENU_EDGE, "lib y {y} h {h}"); + } + } + } + } } #[cfg(test)] @@ -407,11 +449,11 @@ fn ghost( )) .text_color(rgb(INK2())) .child(glyph.to_string()) - // The badge is skipped when the stroke IS the glyph: `?` over `?` - // drew as two identical rows stacked at the foot of the rail and read - // as a duplicated control rather than as one command wearing its own - // chord. - .children((player.keymap.chord(action) != glyph).then(|| { + // Every command wears its chord (DESIGN §4) -- including the one + // whose glyph IS its stroke: `?` reads as `?` over a dimmer `?`, + // the same glyph-over-chord anatomy every other spine ghost draws, + // rather than as the one control on the rail with nothing under it. + .child( div() .type_style(type_scale::mono( type_scale::CHORD_METADATA_MIN_PX, @@ -420,8 +462,8 @@ fn ghost( .text_color(rgb(INK3())) // FAULT 1: the badge shows the primary chord, compact -- // same rule as every glyph in `spine_stance`. - .child(player.keymap.chord(action)) - })) + .child(player.keymap.chord(action)), + ) } /// The keys overlay (DESIGN §9, §12 step 7): every bound command, sectioned @@ -460,6 +502,13 @@ fn keys_overlay(player: &Player, bench_h: f32, cx: &mut Context) -> impl .h(px(bench_h + LEDGER_H)) .bg(rgba(SCRIM())) .flex() + // The plate's inset lives on the scrim, not on the plate's own + // margins: a margin under a fixed `h()` left the list flush with the + // window's bottom edge and its last rows cut over the ledger. Padding + // here takes the room off the footprint before the plate is measured. + .pl(px(12.)) + .pt(px(8.)) + .pb(px(8.)) // Bottom-left, not centred: the `?` control that opens this lives at // the foot of the spine ([`spine`]'s last child), and this overlay // mounts inside the *centre* column next to it -- anchoring the list @@ -482,9 +531,10 @@ fn keys_overlay(player: &Player, bench_h: f32, cx: &mut Context) -> impl .child( div() .id("stance-keys-list") - .ml(px(12.)) - .mb(px(12.)) - .h(px((bench_h + LEDGER_H - 24.).max(0.))) + // Capped to the bench+ledger footprint less the scrim's own + // inset, so the bottom border is on screen and the rows + // scroll inside it (DESIGN §9). + .h(px((bench_h + LEDGER_H - 16.).max(0.))) .w(px(460.)) .overflow_y_scroll() .p(px(10.)) @@ -496,7 +546,27 @@ fn keys_overlay(player: &Player, bench_h: f32, cx: &mut Context) -> impl .flex() .flex_col() .gap(px(3.)) - .child(section_head("all commands · hold ? · release to close")) + // DESIGN §8, no instructional copy: the heading is the + // single noun, and the way out is a chord on the right like + // every other row here -- not a sentence that lied anyway + // (a click-opened plate does not close on a release). + .child( + div() + .flex_none() + .flex() + .justify_between() + .gap(px(12.)) + .child(section_head("keys")) + .child( + div() + .type_style(type_scale::mono( + type_scale::CHORD_METADATA_MIN_PX, + gpui::FontWeight::MEDIUM, + )) + .text_color(rgb(INK3())) + .child("esc"), + ), + ) .children(keys_rows().into_iter().map(|row| { match row { KeyRow::Head(category) => div() @@ -783,13 +853,18 @@ fn ledger(player: &Player, position: f64) -> impl IntoElement { div() .flex_1() .min_w(px(0.)) - .truncate() + // Ellipsis, not a bare cut: `.truncate()` stops mid-word with + // nothing saying it stopped (user report, `… 1 subtitle track(s) + // in `). The name inside the message is elided through its + // middle first ([`ledger_line`]) so the state word at the front + // is never what the strip drops. + .text_ellipsis() .type_style(type_scale::mono( type_scale::CHORD_METADATA_MIN_PX, gpui::FontWeight::MEDIUM, )) .text_color(rgb(action_ink)) - .child(last_action), + .child(ledger_line(&last_action)), ) .children(export.map(|e| { div() @@ -1102,17 +1177,6 @@ pub(crate) fn render( .when(player.settings_open, |el| { el.child(settings_stance::render(player, window_size, cx)) }) - // The two menus (DESIGN §9: "verbs of the thing under the - // cursor", plate styling, the same scrim-and-row component - // the legacy tree already uses -- `library.rs`'s own doc - // comment: "Built like `Player::context_card` ... because it - // is the same menu on the other panel") and the open list a - // picker sets: none of the three had a home in the stance, - // so `overlaid()` refused every key over them for nothing - // ever drawn (FAULT 2). `render.rs`'s children order is kept - // -- clip menu, then library menu, then the open list last so - // it floats over whichever row opened it. - .children(player.context_card(window_size, cx)) // The export card and its running-progress sheet, mounted // over the whole room exactly as the legacy tree mounts them // (`render.rs`) -- the fix for the shipped "Export does @@ -1120,7 +1184,6 @@ pub(crate) fn render( // what draws it once open. .children(player.export_card(window_size, cx)) .children(player.export_progress_card(cx)) - .children(player.picker_card(window_size, cx)) // A maximized clip param card (EQ/Colour/Transform/Speed/ // Silence/Mix/Subtitle style) escapes the dock to mount here // instead, the same window-space `stance-centre` context @@ -1145,14 +1208,21 @@ pub(crate) fn render( ) .child(divider(Split::Dock, player.split_drag == Some(Split::Dock), cx)) .child(dock(player, dock_w, window_size, window, cx)) - // The library row menu mounts on the ROOT, not inside - // `stance-centre` like the clip menu beside it: it is opened from a - // dock row, so its anchor is a window x past the centre column's own - // right edge, and the dock -- painted after the centre -- covered - // every pixel of it. That is the whole of the shipped "can not - // remove a media from library" defect: the plate was built, placed - // and never visible. Mounted here it paints last, over the dock it - // belongs to, and its own `menu_floor` window coordinates finally - // mean what they say. + // All three hanging menus (DESIGN §9: "verbs of the thing under the + // cursor") mount on the ROOT, and none of them inside + // `stance-centre`. Their anchors are *window* coordinates -- a + // `MouseDownEvent::position` -- while an absolutely placed child of + // the centre column is laid out from that column's own origin and + // ends where it ends: the spine shifted every clip menu right by + // `SPINE_W`, and the dock, painted after the centre, covered every + // pixel past x = width - dock. That is the shipped "can not remove a + // media from library" defect (the library plate was built, placed and + // never visible) and the clip menu whose chords were cut off mid-word + // at the dock seam. Mounted here they paint last, over the dock they + // may overlap, and `menu_floor`/`menu_at`'s window coordinates finally + // mean what they say. Order is `render.rs`'s -- clip menu, library + // menu, then the open list last so it floats over whichever row set it. + .children(player.context_card(window_size, cx)) .children(player.library_card(window_size, cx)) + .children(player.picker_card(window_size, cx)) } diff --git a/crates/app/src/ui/timeband_stance.rs b/crates/app/src/ui/timeband_stance.rs index 2d9bff6..f1e8bc3 100644 --- a/crates/app/src/ui/timeband_stance.rs +++ b/crates/app/src/ui/timeband_stance.rs @@ -23,6 +23,92 @@ thread_local! { // fold both into `Player` once `main.rs` is free again. static STRIP_BOUNDS: Rc>> = Rc::new(Cell::new(Bounds::default())); static PAN_ANCHOR: Cell> = Cell::new(None); + /// The band row's own measured width, read by the frame after the one + /// that took it (`width_probe` asks for that frame whenever it changes). + /// This is what the degradation ladder below keys off: the band cannot + /// know its column's width any other way without a `Window` this + /// module's `render` is not handed. + static BAND_W: Rc> = Rc::new(Cell::new(px(0.))); + /// Set once per `render` from the ladder, read by `ghost` (which the + /// band's own helpers call three levels down) -- a render-scoped + /// constant rather than a parameter threaded through every call site. + static SHOW_CHORDS: Cell = const { Cell::new(true) }; +} + +/// The contact strip's floor: the flex_1 element absorbs the band's slack, +/// but a minimap narrower than this is not a map. +pub(crate) const STRIP_MIN_W: f32 = 120.; + +/// The band's own width probe, `timeline_math::height_probe`'s shape on the +/// other axis: a measurement is read by the frame after the one that took it, +/// so a change has to ask for that frame or a resize would leave the ladder +/// one layer behind until something else happened to draw. +fn width_probe(into: Rc>) -> impl IntoElement { + canvas( + move |bounds, window, _| { + // Only on a change: an unconditional request is a repaint loop. + if into.replace(bounds.size.width) != bounds.size.width { + window.request_animation_frame(); + } + }, + |_, _, _, _| (), + ) + .absolute() + .size_full() +} + +/// Which layers of the band are still drawn at a given column width +/// (DESIGN §7's ladder, one layer per threshold, never all at once). +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub(crate) struct BandLayers { + /// Chord badges under the transport glyphs. + pub(crate) chords: bool, + /// The audio-monitoring cluster (mute, -/+, slider, level readout). + pub(crate) volume: bool, + /// The sync-point pair and the loop toggle. + pub(crate) sync: bool, + /// The export-range marks (I / O / x). + pub(crate) marks: bool, +} + +/// The ladder itself. Every threshold is a MEASURED number: the band drawn +/// whole at 2560x1440 (`$EDITH_HITMAP`) reads 1246px of fixed groups beside a +/// 974px strip, and the same band at 1280x720 (chords off) reads each glyph's +/// door at its `HIT_MIN` floor. Fixed width + `STRIP_MIN_W`, rounded up to the +/// next 10px, is what each rung costs: +/// +/// | drawn | fixed | needs | +/// |----------------------------------------------|-------|--------| +/// | everything, chords under every glyph | 1246 | 1370px | +/// | chords dropped (-97px, doors keep `HIT_MIN`) | 1149 | 1270px | +/// | + monitoring cluster dropped (-256px) | 893 | 1020px | +/// | + sync pair and loop dropped (-102px) | 791 | 920px | +/// | + range marks dropped (-92px): the floor | 699 | 820px | +/// +/// The four things the band is *for* -- timecode, cut readout, contact strip +/// (>=`STRIP_MIN_W`, the flex_1 that absorbs the slack) and the Export chip -- +/// are on every rung; below the floor's own 820px there is nothing left to +/// shed and `overflow_hidden` is what keeps the rest inside the column. +/// There is no zoom group in this band (the charter's rung 2): the monitoring +/// cluster is the band's equivalent extra and takes its place. +pub(crate) fn band_layers(band_w: f32) -> BandLayers { + BandLayers { + chords: band_w >= 1370., + volume: band_w >= 1270., + sync: band_w >= 1020., + marks: band_w >= 920., + } +} + +/// The odometer's cut (DESIGN §6, "the cut readout is the odometer"): the cut +/// the playhead rests on, or -- when it rests in a gap -- the next one ahead +/// of it. `None` only when there is no cut at or after the playhead, which is +/// when the caller falls back to the selection. +pub(crate) fn odometer_cut(clips: &[Clip], frame: u32) -> Option { + clips + .iter() + .position(|c| frame >= c.start && frame < c.end()) + .or_else(|| clips.iter().position(|c| c.start > frame)) } /// A stacked ghost command (DESIGN §4, MOCK-SPEC "Ghost transport"/"spine"): @@ -66,6 +152,13 @@ fn ghost( .flex() .flex_col() .items_center() + .justify_center() + // WCAG 2.5.8, the same `HIT_MIN` floor `interact.rs` holds clip edges + // to: a glyph may be 8px wide, its door may not. Padding only -- + // glyph sizes and the groups' own gaps are untouched. + .min_w(px(HIT_MIN)) + .min_h(px(HIT_MIN)) + .px(px(2.)) .gap(px(1.)) .cursor_pointer() .on_click(cx.listener(move |this, _: &ClickEvent, window, cx| { @@ -76,13 +169,16 @@ fn ghost( .text_size(glyph_style.size) .text_color(rgb(if active { INK1() } else { INK2() })) .child(glyph.into()) - .child( - div() - .font(chord_style.font) - .text_size(chord_style.size) - .text_color(rgb(INK3())) - .child(player.keymap.chord(action)), - ) + .when(SHOW_CHORDS.with(Cell::get), |el| { + el.child( + div() + .flex_none() + .font(chord_style.font) + .text_size(chord_style.size) + .text_color(rgb(INK3())) + .child(player.keymap.chord(action)), + ) + }) } /// The hero timecode, digits `ink1` and colons `ink3` (DESIGN §3, MOCK-SPEC @@ -114,11 +210,24 @@ fn signed_delta(frames: i64, fps: f64) -> String { /// the subject cut's own trim deltas against where roll armed it (only real /// once [`Player::loop_trim`] has a baseline to measure against), and the /// roll word itself, on or dim. `·` separators in `ink3`, values in `ink2`. -fn cut_readout(player: &Player) -> impl IntoElement { +fn cut_readout(player: &Player, position: f64) -> impl IntoElement { let sep = || div().text_color(rgb(INK3())).child(" · "); let val = |s: String| div().text_color(rgb(INK2())).child(s); let anchor = player.selected.anchor(); - let odometer = anchor + // The odometer reads the PLAYHEAD, not the selection (DESIGN 6): right + // after a split the two halves are on the bench and nothing is picked, + // and a readout saying `cut -/-` while the playhead sits on the new cut + // is an odometer that stopped turning. The selection only answers when + // the playhead is off every cut on its lane. + let frame = (position * player.active_fps()).max(0.).round() as u32; + let at_playhead = player.session.as_ref().and_then(|s| { + let lane = anchor + .map(|(lane, _)| lane) + .or_else(|| s.lanes().into_iter().find(|l| l.kind == LaneKind::Video))?; + Some((lane, odometer_cut(s.lane_clips(lane), frame)?)) + }); + let odometer = at_playhead + .or(anchor) .and_then(|(lane, idx)| { player .session @@ -285,7 +394,10 @@ fn contact_strip(player: &Player, position: f64, cx: &mut Context) -> im .id("stance-contact-strip") .relative() .flex_1() - .min_w(px(0.)) + // The strip is what absorbs the band's slack, and it measured w=0 at + // 1280 before this: it holds a floor now and the ladder sheds groups + // above it instead of squeezing the map to nothing. + .min_w(px(STRIP_MIN_W)) .h(px(28.)) .cursor_pointer() .tooltip(|_, cx| { @@ -570,6 +682,20 @@ fn volume_slider(player: &Player, cx: &mut Context) -> impl IntoElement ) } +/// The level, written once (DESIGN 3: a number about a level is mono). It +/// sits beside the slider that sets it -- the slider's fill and this readout +/// are one truth in two forms, where the mute button used to wear a third. +fn volume_readout(player: &Player) -> impl IntoElement { + let style = mono(type_scale::CHORD_METADATA_MAX_PX, FontWeight::MEDIUM); + div() + .flex_none() + .w(px(34.)) + .font(style.font) + .text_size(style.size) + .text_color(rgb(if player.volume.muted { INK3() } else { INK2() })) + .child(format!("{}%", player.volume.percent())) +} + /// The whole band, left to right per MOCK-SPEC: hero timecode, ghost /// transport, cut readout, the contact strip filling the rest, the Export /// chip at the end. @@ -579,6 +705,12 @@ pub(crate) fn render( cx: &mut Context, ) -> impl IntoElement { let tc = timecode(position, player.active_fps()); + let band_w = BAND_W.with(Rc::clone); + // Layer decision for THIS frame, off the width the last frame measured + // (`width_probe` asks for a frame whenever that width changes, so a + // resize settles in one). + let layers = band_layers(f32::from(band_w.get())); + SHOW_CHORDS.with(|c| c.set(layers.chords)); div() .id("stance-time-band-row") // FAULT 1 fix: this div used to be `flex_none`, which sized it to its @@ -591,8 +723,13 @@ pub(crate) fn render( .h_full() .flex() .items_center() - .gap(px(16.)) + // Nothing in this band may ever paint (or be clicked) outside its own + // column again: the Export chip used to land at x=1113 under the + // dock, where a click on blank dock space opened the export card. + .overflow_hidden() + .gap(px(12.)) .px(px(12.)) + .child(width_probe(band_w)) // The most-read element anchors its region (DESIGN §5): the // timecode leads. .child(hero_timecode(&tc)) @@ -647,7 +784,7 @@ pub(crate) fn render( .child(ghost( "stance-tb-step-back", player, - "◀", + "|◂", ActionId::StepBack, false, cx, @@ -655,7 +792,7 @@ pub(crate) fn render( .child(ghost( "stance-tb-step-forward", player, - "▶", + "▸|", ActionId::StepForward, false, cx, @@ -676,36 +813,40 @@ pub(crate) fn render( false, cx, )) - .child(ghost( - "stance-tb-sync-prev", - player, - "‹|", - ActionId::PrevSyncPoint, - false, - cx, - )) - .child(ghost( - "stance-tb-sync-next", - player, - "|›", - ActionId::NextSyncPoint, - false, - cx, - )) + .when(layers.sync, |el| { + el.child(ghost( + "stance-tb-sync-prev", + player, + "‹|", + ActionId::PrevSyncPoint, + false, + cx, + )) + .child(ghost( + "stance-tb-sync-next", + player, + "|›", + ActionId::NextSyncPoint, + false, + cx, + )) + }) // Loop (homeless per this task's audit): the playback-loop // toggle -- burst-use during editing per the charter's own // classification -- earns the transport cluster it plays // alongside, not the CUT group's `LoopTrim` two files over // (a different verb already drawn on the spine, "↻" taken). // "∞" reads as "keeps going" without borrowing that glyph. - .child(ghost( - "stance-tb-loop", - player, - "∞", - ActionId::Loop, - player.loop_on, - cx, - )), + .when(layers.sync, |el| { + el.child(ghost( + "stance-tb-loop", + player, + "∞", + ActionId::Loop, + player.loop_on, + cx, + )) + }), ) // The audio-monitoring cluster (homeless per this task's audit): // ToggleMute/VolumeUp/VolumeDown, burst-use per the charter, placed @@ -717,7 +858,7 @@ pub(crate) fn render( // mute and the two ghosts flanking it nudge the level -- three // homeless actions sharing one cluster rather than three unrelated // rows. - .child( + .when(layers.volume, |el| el.child( div() .flex_none() .flex() @@ -731,19 +872,22 @@ pub(crate) fn render( false, cx, )) + // The level is NOT this button's label any more: the slider + // beside it already draws the same number as a fill and + // `volume_readout` writes it once, so wearing it here made + // mute a ghost with no glyph of its own (a percentage is not + // a verb). Speaker, struck when muted -- typographic, the + // same hand-drawn grammar as the glyphs around it. .child(ghost( "stance-tb-mute", player, - if player.volume.muted { - format!("× {}%", player.volume.percent()) - } else { - format!("{}%", player.volume.percent()) - }, + if player.volume.muted { "◁×" } else { "◁))" }, ActionId::ToggleMute, player.volume.muted, cx, )) .child(volume_slider(player, cx)) + .child(volume_readout(player)) .child(ghost( "stance-tb-vol-up", player, @@ -752,9 +896,9 @@ pub(crate) fn render( false, cx, )), - ) - .child(range_marks(player, cx)) - .child(cut_readout(player)) + )) + .when(layers.marks, |el| el.child(range_marks(player, cx))) + .child(cut_readout(player, position)) .child(contact_strip(player, position, cx)) .child(save_verb(player, cx)) .child(export_chip(player, cx))