diff --git a/crates/app/src/export_ui.rs b/crates/app/src/export_ui.rs index d8e7158..ce5acde 100644 --- a/crates/app/src/export_ui.rs +++ b/crates/app/src/export_ui.rs @@ -724,32 +724,15 @@ pub(crate) fn parse_budget(text: &str, seconds: f64, audio_bps: u64) -> Option, - hardware: bool, -) -> String { - let mut parts: Vec = Vec::new(); - if format.has_video() { - parts.push(format_label(format).to_string()); - } - if !audio.is_empty() { - parts.push(audio.to_string()); - } - parts.push(match (marks, format.has_video()) { +/// The span an export writes, in the words row 3 says it in: the marked +/// range where there is one, the whole timeline otherwise -- and "sound only" +/// for a file that carries no picture at all. +pub(crate) fn range_word(marks: Option<&str>, has_video: bool) -> String { + match (marks, has_video) { (Some(marks), _) => format!("marks {marks}"), (None, true) => "whole film".to_string(), (None, false) => "sound only".to_string(), - }); - if format.has_video() { - parts.push(match hardware { - true => "GPU".to_string(), - false => "SW".to_string(), - }); } - parts.join(" · ") } /// A clip's share of the lane. A timeline with no length reads as one full-width diff --git a/crates/app/src/player/cards.rs b/crates/app/src/player/cards.rs index 5f267d8..d32c374 100644 --- a/crates/app/src/player/cards.rs +++ b/crates/app/src/player/cards.rs @@ -1824,7 +1824,7 @@ 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 + // its sound is coded at and `g` 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. @@ -1832,7 +1832,7 @@ impl Player { match key { "c" => self.cycle_export_picture(), "b" => self.cycle_audio_kbps(), - "e" => self.cycle_encoder(cx), + "g" => self.cycle_encoder(cx), _ => return false, } return true; diff --git a/crates/app/src/player/export.rs b/crates/app/src/player/export.rs index 5a771da..3132679 100644 --- a/crates/app/src/player/export.rs +++ b/crates/app/src/player/export.rs @@ -648,6 +648,20 @@ impl Player { "d" => self.pick_destination(cx), "n" => self.edit_budget(), "e" | "enter" => self.start_export(cx), + // The encode options, on the moment that spends them (user + // 2026-09-09: "couldn't find how to change encode options") -- + // the Settings room's own `c`/`b`/`g` setters, so the two + // surfaces can never say different things. `g` and not `e` + // because `e` is this moment's Export, and a ghost wears no + // shifted letter (DESIGN §4). + "c" => self.cycle_export_picture(), + "b" => self.cycle_audio_kbps(), + "g" => self.cycle_encoder(cx), + // corner-cut: the settings door answers a bare `,` as well as the + // room's `^,` it wears, because `param_card_key` is handed shift + // only -- ceiling: no modifier reaches a card's keys. Upgrade: + // thread `Modifiers` through `ui::stance`'s handler. + "," => self.open_settings(cx), "up" | "right" | "+" | "=" => self.nudge_budget(1, shift), "down" | "left" | "-" => self.nudge_budget(-1, shift), _ => {} diff --git a/crates/app/src/tests/cards.rs b/crates/app/src/tests/cards.rs index e23a5cd..1e34668 100644 --- a/crates/app/src/tests/cards.rs +++ b/crates/app/src/tests/cards.rs @@ -1047,11 +1047,71 @@ fn a_chord_the_export_moment_answers_never_reaches_the_room() { assert!(typing.contains("self.budget_edit = None"), "esc leaves the field"); assert!(closed.contains("self.close_card()"), "then esc closes the moment"); // Its chords, all of them consumed here rather than by the keymap. - for chord in ["\"d\"", "\"n\"", "\"e\"", "\"enter\"", "\"up\"", "\"down\""] { + for chord in [ + "\"d\"", "\"n\"", "\"e\"", "\"enter\"", "\"up\"", "\"down\"", "\"c\"", "\"b\"", "\"g\"", + "\",\"", + ] { assert!(closed.contains(chord), "{chord} is not the moment's own"); } } +/// The user could not find the encode options from the moment that spends +/// them ("simplifying doesn't mean getting rid of advanced settings"): row 3 +/// now *is* the options -- three ghost segments carrying the Settings room's +/// own setters, plus the door to the rest of that room. +#[test] +fn row_three_wears_the_encode_options_and_the_door_to_the_rest() { + let cards = src_text("ui/cards.rs"); + let start = cards.find("fn export_card(").expect("the moment"); + let body = &cards[start..start + cards[start..].find("\n /// ").unwrap_or(cards.len() - start)]; + // A segment is the setter it names, not a readout of it. + for (id, chord, setter) in [ + ("moment-picture", "\"c\"", "cycle_export_picture"), + ("moment-sound", "\"b\"", "cycle_audio_kbps"), + ("moment-encoder", "\"g\"", "cycle_encoder"), + ] { + assert!(body.contains(id), "row 3 lost its {id} segment"); + assert!(body.contains(chord), "the {id} segment wears no chord"); + assert!(body.contains(setter), "the {id} segment changes nothing"); + } + // The door, wearing the room's own chord rather than a hand-typed one. + assert!(body.contains("moment-settings"), "row 3 has no settings door"); + assert!( + body.contains("self.keymap.chord(ActionId::Settings)"), + "the door's chord is not read from the keymap" + ); + assert!(body.contains("open_settings"), "the door opens nothing"); + // Quiet, and a control: ink3 with the chord in ink4 (DESIGN §4), never + // the ink4 line the plan used to be. + let seg = cards + .find("fn moment_segment(") + .map(|at| &cards[at..at + 1200]) + .expect("the segment atom"); + assert!(seg.contains("INK3()") && seg.contains("INK4()")); + assert!(seg.contains("DARK_RAISED()"), "a segment does not answer hover"); +} + +/// One chord per thing, said the same on both surfaces: the moment's segments +/// and the Settings room's EXPORT rows drive the same setters, so a chord that +/// drifted on one of them would teach the user a key the other refuses. +#[test] +fn the_moment_and_the_settings_room_wear_the_same_export_chords() { + let settings = src_text("ui/settings_stance.rs"); + let moment = src_text("ui/cards.rs"); + let player = src_text("player/cards.rs"); + let handler = fn_body("export_moment_key"); + for chord in ["\"c\"", "\"b\"", "\"g\""] { + assert!(settings.contains(chord), "the EXPORT rows lost {chord}"); + assert!(moment.contains(chord), "row 3 lost {chord}"); + assert!(handler.contains(chord), "the moment answers no {chord}"); + assert!(player.contains(chord), "the settings page answers no {chord}"); + } + // `e` stays the Export press: the encoder seat took `g` rather than a + // shifted letter, which no ghost wears. + assert!(handler.contains("\"e\" | \"enter\" => self.start_export")); + assert!(!settings.contains("\n \"e\","), "the Encoder row took `e` back"); +} + /// The Sound row: what it offers, and that the pick travels to the engine /// for a *video* export as much as for an MP3 -- both files carry sound, so /// a row that only reached the audio formats would be half a control. diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index 373915f..a649ab6 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -3345,7 +3345,7 @@ fn the_export_section_is_four_rows_and_no_fifth() { ); // 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"] { + for chord in ["\"c\"", "\"b\"", "\"g\"", "ActionId::SetIn"] { assert!(body.contains(chord), "an EXPORT row lost its chord {chord}"); } } diff --git a/crates/app/src/tests/media.rs b/crates/app/src/tests/media.rs index 3c0af40..ee2d835 100644 --- a/crates/app/src/tests/media.rs +++ b/crates/app/src/tests/media.rs @@ -690,18 +690,14 @@ fn the_budget_row_states_the_size_before_it_is_written() { assert_eq!(rate_label(6_000_000), "6.0"); assert_eq!(rate_label(6_500_000), "6.5"); assert_eq!(rate_label(BPS_MIN), "1.0"); - // The faintest line: what resolved, never a control -- and it says the - // marked span where there is one rather than "whole film". - let line = plan_line(Format::Mp4, "AAC 256 kbps", None, true); - assert_eq!(line, "H.264 · AAC 256 kbps · whole film · GPU"); - assert!(plan_line(Format::Mp4, "AAC", None, false).ends_with("SW")); - assert!( - plan_line(Format::Mp4, "AAC", Some("00:00:04:00–00:00:12:00"), true) - .contains("marks 00:00:04:00–00:00:12:00") + // Row 3's range readout: the marked span where there is one, and a + // sound-only file names no film to take a range from. + assert_eq!(range_word(None, true), "whole film"); + assert_eq!(range_word(None, false), "sound only"); + assert_eq!( + range_word(Some("00:00:04:00\u{2013}00:00:12:00"), true), + "marks 00:00:04:00\u{2013}00:00:12:00" ); - // A sound-only export names no picture codec and no seat to write it on. - let sound = plan_line(Format::Flac, "FLAC", None, true); - assert_eq!(sound, "FLAC · sound only"); } /// Which cue is on screen when: the whole of what the overlay decides, and diff --git a/crates/app/src/tests/mod.rs b/crates/app/src/tests/mod.rs index b93dc75..73d4db3 100644 --- a/crates/app/src/tests/mod.rs +++ b/crates/app/src/tests/mod.rs @@ -27,7 +27,7 @@ use super::{ export_settings, format_refusal, fps_choices, fps_label, frac_along, frac_down, frame_at, frame_rate_ladder, histogram, inserted_band, is_project, keymap, keys_rows, lanes_h, marked, menu_at, menu_items, menu_rows_h, next_container, normalise, nothing_to_play, - notice_tone, panel_h, parse_budget, plan_line, project_path, proxies_to_start, push_notice, px_below, retarget, + notice_tone, panel_h, parse_budget, project_path, range_word, proxies_to_start, push_notice, px_below, retarget, row_enable, row_items, scrub_due, secs_label, should_resync, silence_rate, size_label, rate_label, snap_cue, snap_marks, snapped, source_tint, span_partner, speed_at, sub_pick_after_removal, subtitle_plan, timecode, timeline_fixed_h, tip_may_paint, diff --git a/crates/app/src/ui/cards.rs b/crates/app/src/ui/cards.rs index 2c9185a..bc3d39a 100644 --- a/crates/app/src/ui/cards.rs +++ b/crates/app/src/ui/cards.rs @@ -209,6 +209,45 @@ fn dark_step_glyph( .child(dark_row_value(if plus { "+" } else { "−" })) } +/// One segment of the export moment's plan line (row 3): the thing it says +/// *is* the button that changes it, so `H.264 \u{b7} MP4` is pressed to walk the +/// files and wears `c` beside it exactly as the Settings row does (user +/// 2026-09-09: "couldn't find how to change encode options, simplifying +/// doesn't mean getting rid of advanced settings"). A ghost (DESIGN \u{a7}4) at a +/// readout's size: `ink3` at rest so the line stays as quiet as the one it +/// replaced, `ink2` and one fill step on hover, the chord in `ink4` beside it. +fn moment_segment( + id: &'static str, + text: impl Into, + chord: impl Into, + on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, +) -> impl IntoElement { + let text: SharedString = text.into(); + let hitmap = hitmap::enabled().then(|| { + let label = text.clone(); + hitmap::dynamic(move || (format!("card.{id}"), label.to_string()), true) + }); + div() + .id(id) + .flex_none() + .flex() + .items_baseline() + .gap(px(5.)) + .px(px(4.)) + .rounded(px(3.)) + .cursor_pointer() + .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK2()))) + .on_click(on_click) + .children(hitmap.flatten()) + .type_style(type_scale::mono( + type_scale::CHORD_METADATA_MIN_PX, + gpui::FontWeight::MEDIUM, + )) + .text_color(rgb(INK3())) + .child(text) + .child(div().flex_none().text_color(rgb(INK4())).child(chord.into())) +} + fn dark_ghost_button( id: impl Into, text: impl Into, @@ -323,7 +362,33 @@ impl Player { timecode(f64::from(end) / self.fps, self.fps), ) }); - let plan = plan_line(self.format, audio, marks.as_deref(), hardware); + // Row 3's segments are the Settings room's own EXPORT rows worn as + // ghosts on the line that used to only *report* them -- the same + // setters, so both surfaces can never disagree. + // What the engine says the sound *will* be ("AAC 256 kbps", or "AAC + // copy" where the source's own stream is carried through): a rate + // nobody is choosing wears no chord, the Settings row's own rule for + // a codec with no rate to pick. + let (codec, rated) = crate::ui::settings_stance::sound_codec(self.format); + let sound_label = match audio.is_empty() { + true => codec.to_string(), + false => audio.to_string(), + }; + let sound_keyed = rated && !audio.contains("copy"); + // `auto` is a promise until the probe answers; once it has, the seat + // says what it resolved to rather than the word nobody picked. + let seat = self.encoder_seat(); + let seat_label = match seat { + EncoderSeat::Auto => format!( + "auto \u{2192} {}", + match hardware { + true => "GPU", + false => "SW", + } + ), + _ => crate::ui::settings_stance::encoder_word(seat).to_string(), + }; + let range = range_word(marks.as_deref(), self.format.has_video()); // The refusal the button used to carry, said before it is pressed and // in the readout's own place: a few words and the chord that fixes it, // never the sentence the old card wrapped over three lines. @@ -530,17 +595,82 @@ impl Player { div() .flex_1() .min_w(px(0.)) - .truncate() - .type_style(type_scale::mono( - type_scale::CHORD_METADATA_MIN_PX, - gpui::FontWeight::MEDIUM, - )) - .text_color(rgb(match blocked.is_some() { - true => STATUS_WARNING(), - false => INK4(), + .flex() + .items_baseline() + .gap(px(6.)) + .children(self.format.has_video().then(|| { + moment_segment( + "moment-picture", + crate::ui::settings_stance::picture_label(self.format), + "c", + cx.listener(|this, _: &ClickEvent, _, cx| { + this.cycle_export_picture(); + cx.notify(); + }), + ) + })) + .children(sound_keyed.then(|| { + moment_segment( + "moment-sound", + sound_label.clone(), + "b", + cx.listener(|this, _: &ClickEvent, _, cx| { + this.cycle_audio_kbps(); + cx.notify(); + }), + ) + })) + // A codec with no rate to pick is a readout, not a button + // that would do nothing when pressed -- the Settings row's + // own rule. + .children((!sound_keyed).then(|| { + div() + .flex_none() + .type_style(type_scale::mono( + type_scale::CHORD_METADATA_MIN_PX, + gpui::FontWeight::MEDIUM, + )) + .text_color(rgb(INK4())) + .child(sound_label.clone()) })) - .child(blocked.clone().unwrap_or(plan)), + .children(self.format.has_video().then(|| { + moment_segment( + "moment-encoder", + seat_label.clone(), + "g", + cx.listener(|this, _: &ClickEvent, _, cx| { + this.cycle_encoder(cx); + }), + ) + })) + // The range is set on the timeline with the marks + // themselves, so here it is what the file will hold -- + // or, where the press would be refused, the refusal in + // its place (DESIGN \u{a7}8: said before it is pressed). + .child( + div() + .flex_1() + .min_w(px(0.)) + .truncate() + .type_style(type_scale::mono( + type_scale::CHORD_METADATA_MIN_PX, + gpui::FontWeight::MEDIUM, + )) + .text_color(rgb(match blocked.is_some() { + true => STATUS_WARNING(), + false => INK4(), + })) + .child(blocked.clone().unwrap_or(range)), + ), ) + // The door to everything else this file could be written as: the + // room's own settings chord, on the moment that needed it. + .child(moment_segment( + "moment-settings", + "settings", + self.keymap.chord(ActionId::Settings), + cx.listener(|this, _: &ClickEvent, _, cx| this.open_settings(cx)), + )) .child( div() .id("export-confirm") diff --git a/crates/app/src/ui/settings_stance.rs b/crates/app/src/ui/settings_stance.rs index 3342b50..1fc92de 100644 --- a/crates/app/src/ui/settings_stance.rs +++ b/crates/app/src/ui/settings_stance.rs @@ -634,7 +634,7 @@ fn export_section(player: &Player, cx: &mut Context) -> impl IntoElement "Encoder", encoder_word(seat), "which encoder writes the picture: the GPU where this machine has a seat, or the CPU", - "e", + "g", av1_gpu.then(|| (AV1_GPU_NOTICE.into(), NOTICE_LOOK())), player, cx.listener(|this, _: &ClickEvent, _, cx| {