forge
Explore
Log in

Don't you dare go Hollow

🔀 merge(refusal): the decoder refusal survives the dock's seat drop

Browse files at this commit

1896852b1ddba13aec9896c158a27cca2387a296Ahmet Kaan GümüşParent: b8aec2947adb87
crates/app/src/library_meta.rsmodified+45 -4
@@ -64,7 +64,7 @@ pub(crate) struct Row {
6464 pub(crate) fn library_rows(
6565 sources: &[Source],
6666 streams: &HashMap<PathBuf, Vec<StreamInfo>>,
67- decoders: &HashMap<PathBuf, Option<(Option<Codec>, Backend)>>,
67+ decoders: &HashMap<PathBuf, Decoder>,
6868 timeline_audio: Option<(u32, u16)>,
6969 frames: impl Fn(&Path) -> u32,
7070 ) -> Vec<Row> {
@@ -89,9 +89,7 @@ pub(crate) fn library_rows(
8989 detail: join_detail(
9090 &decoders
9191 .get(&source.path)
92- .copied()
93- .flatten()
94- .map_or_else(String::new, |(codec, backend)| decode_label(codec, backend)),
92+ .map_or_else(|| Decoder::Pending.detail(), Decoder::detail),
9593 &info
9694 .filter(|_| of_file.len() > 1)
9795 .map_or_else(String::new, stream_detail),
@@ -196,6 +194,49 @@ pub(crate) fn decode_label(codec: Option<Codec>, backend: Backend) -> String {
196194 }
197195 }
198196
197+/// What the one-shot probe said about a file: the seat it will open on, or --
198+/// when the decoder itself refused -- the refusal, in the decoder's own words.
199+///
200+/// Three answers, not two, because "asked" and "refused" are not the same
201+/// answer. Both used to be a missing entry, and a missing entry drew an empty
202+/// second line -- the same line a song draws -- so a file this machine cannot
203+/// decode was indistinguishable from one that needs no word at all.
204+#[derive(Debug, Clone, PartialEq)]
205+pub(crate) enum Decoder {
206+ /// Asked and not yet answered: the probe is still walking the file. A
207+ /// real wait, and one that claims nothing while it lasts.
208+ Pending,
209+ /// The codec (`None` for a still, which has no coded stream) and the seat
210+ /// the engine picked for it.
211+ Seat(Option<Codec>, Backend),
212+ /// The decoder refused this file, and these are its words. Not a message
213+ /// of this program's own making: the probe is `engine::decode::probe`,
214+ /// and the refusal is the one opening the file would give.
215+ Refused(String),
216+}
217+
218+impl From<engine::Result<(Option<Codec>, Backend)>> for Decoder {
219+ fn from(probed: engine::Result<(Option<Codec>, Backend)>) -> Self {
220+ match probed {
221+ Ok((codec, backend)) => Self::Seat(codec, backend),
222+ Err(why) => Self::Refused(why.to_string()),
223+ }
224+ }
225+}
226+
227+impl Decoder {
228+ /// What the row's second line says about the file's decoder: the seat for
229+ /// a file that opens, the refusal for one that does not, and nothing for a
230+ /// probe still running.
231+ pub(crate) fn detail(&self) -> String {
232+ match self {
233+ Self::Pending => String::new(),
234+ Self::Seat(codec, backend) => decode_label(*codec, *backend),
235+ Self::Refused(why) => why.clone(),
236+ }
237+ }
238+}
239+
199240 /// How a row names its file: the file alone when it has one audio stream or
200241 /// none, and the file plus which stream this row is when it has several --
201242 /// counted from 1, the way a player numbers tracks.
crates/app/src/main.rsmodified+10 -9
@@ -68,11 +68,11 @@ use engine::transform::TransformParams;
6868 use engine::{Clip, Codec, ExportHandle, Frame, MediaBitrate, PlaybackSession};
6969 use gpui::{
7070 AnyElement, App, Application, Bounds, ClickEvent, Context, Corners, CursorStyle, Div,
71- DragMoveEvent, FocusHandle, KeyDownEvent, MouseButton, MouseDownEvent,
72- MouseExitEvent, MouseMoveEvent, MouseUpEvent, PathBuilder, Pixels, Point, RenderImage,
73- ScrollDelta, ScrollHandle, ScrollWheelEvent, SharedString, Size, Stateful, TextAlign,
74- TitlebarOptions, Window, WindowBounds, WindowOptions, canvas, div, point, prelude::*, px,
75- relative, rgb, rgba, size,
71+ DragMoveEvent, FocusHandle, KeyDownEvent, MouseButton, MouseDownEvent, MouseExitEvent,
72+ MouseMoveEvent, MouseUpEvent, PathBuilder, Pixels, Point, RenderImage, ScrollDelta,
73+ ScrollHandle, ScrollWheelEvent, SharedString, Size, Stateful, TextAlign, TitlebarOptions,
74+ Window, WindowBounds, WindowOptions, canvas, div, point, prelude::*, px, relative, rgb, rgba,
75+ size,
7676 };
7777
7878 struct Player {
@@ -278,13 +278,14 @@ struct Player {
278278 /// must stay in the map or every repaint would ask again.
279279 syncs: HashMap<PathBuf, Vec<u32>>,
280280 /// Which decoder each source will run on, probed once at import and kept:
281- /// the codec (`None` for a still) and the seat the engine picked for it.
281+ /// the codec (`None` for a still) and the seat the engine picked for it --
282+ /// or, where the decoder refused the file, the refusal in its own words.
282283 /// What a library row says *before* anything plays; the running answer is
283284 /// the session's own (`PlaybackSession::decode_backend`), which follows a
284285 /// fallback this cannot. Filled like `sizes`: presence means "asked", and
285- /// `None` is a source with no decoder to name -- a song, or one the probe
286- /// refused -- which must stay in the map or every repaint would ask again.
287- decoders: HashMap<PathBuf, Option<(Option<Codec>, Backend)>>,
286+ /// `Decoder::Pending` is that asked-but-unanswered window -- which must
287+ /// stay in the map or every repaint would ask again.
288+ decoders: HashMap<PathBuf, Decoder>,
288289 /// What an export of the picked settings would open -- the picture's seat
289290 /// or the copy that means it opens none, and the sound's -- and what it was
290291 /// asked about: the settings, the canvas and the *cuts*, since where they
crates/app/src/player/export.rsmodified+13 -6
@@ -180,13 +180,15 @@ impl Player {
180180 // a frame of it plays. Off the render thread like the streams above: a
181181 // stream the plugin takes costs one VA-API init (~90 ms) to answer.
182182 for path in unseen_paths(session.sources(), &self.decoders) {
183- self.decoders.insert(path.clone(), None);
183+ self.decoders.insert(path.clone(), Decoder::Pending);
184184 let probed = cx.background_executor().spawn({
185185 let path = path.clone();
186- // A song and a source no decoder here takes are both `None`:
187- // the row says nothing about them rather than guessing, and
188- // import refused the second at the door anyway.
189- async move { engine::decode::probe(&path).ok() }
186+ // A refusal is kept in the decoder's own words, and the row
187+ // shows them: a file this machine cannot decode is the one
188+ // whose second line has to say so. A song is a different
189+ // answer entirely -- it has no coded stream, and the probe
190+ // says so by naming the still seat.
191+ async move { Decoder::from(engine::decode::probe(&path)) }
190192 });
191193 cx.spawn(async move |this, cx| {
192194 let probed = probed.await;
@@ -644,7 +646,12 @@ impl Player {
644646 ///
645647 /// Escape retreats one step at a time (DESIGN.md:146): the field first,
646648 /// the moment second.
647- pub(crate) fn export_moment_key(&mut self, key: &str, shift: bool, cx: &mut Context<Self>) -> bool {
649+ pub(crate) fn export_moment_key(
650+ &mut self,
651+ key: &str,
652+ shift: bool,
653+ cx: &mut Context<Self>,
654+ ) -> bool {
648655 if !self.export_open {
649656 return false;
650657 }
crates/app/src/tests/editing.rsmodified+166 -71
@@ -109,9 +109,11 @@ fn a_song_opens_the_window_by_itself() {
109109 // ...and it places, on the audio lane, through the door `insert_source`
110110 // uses: a second copy of the song at the playhead.
111111 session.seek(1.0);
112- assert!(session
113- .place_stream_at(1.0, &path, 0, Some(Lane::A1))
114- .expect("its own file is on this timeline"));
112+ assert!(
113+ session
114+ .place_stream_at(1.0, &path, 0, Some(Lane::A1))
115+ .expect("its own file is on this timeline")
116+ );
115117 assert_eq!(session.lane_clips(Lane::A1).len(), 2);
116118 assert!(session.lane_clips(Lane::V1).is_empty(), "still no picture");
117119
@@ -256,6 +258,63 @@ fn every_audio_stream_of_a_file_is_a_row_usable_or_not() {
256258 assert_eq!(rows[1].tint, 1, "the other file is the other tint");
257259 }
258260
261+/// A file the decoder refuses says so on its own row, in the decoder's own
262+/// words. The refusal is the only thing a person can act on for a file that
263+/// will not play, and before this the row drew an empty second line -- the
264+/// same line a song draws, which claims nothing and means nothing.
265+///
266+/// Dumped through the real [`engine::decode::probe`], not a hand-written
267+/// `Err`: a `.mkv` that is not a container is refused by the demuxer, with no
268+/// plugin and no hardware involved, so the words under test are the ones the
269+/// engine really produces.
270+#[test]
271+fn a_refused_file_names_the_refusal_on_its_row() {
272+ let junk = std::env::temp_dir().join("edith-lane-j-refused.mkv");
273+ std::fs::write(&junk, b"not a container, and never will be").expect("write the junk file");
274+ let words = engine::decode::probe(&junk)
275+ .expect_err("a file that is not a stream is refused")
276+ .to_string();
277+ assert!(
278+ !words.is_empty(),
279+ "a refusal that says nothing says nothing"
280+ );
281+
282+ let mut decoders = HashMap::new();
283+ decoders.insert(junk.clone(), Decoder::from(engine::decode::probe(&junk)));
284+ let rows = library_rows(
285+ &[Source {
286+ path: junk.clone(),
287+ audio_stream: 0,
288+ }],
289+ &HashMap::new(),
290+ &decoders,
291+ None,
292+ |_| 0,
293+ );
294+ assert_eq!(
295+ rows[0].detail, words,
296+ "the row carries the refusal verbatim"
297+ );
298+
299+ // A probe still running says nothing, and must keep saying nothing: an
300+ // empty second line is a real answer here, not a missing one.
301+ let mut pending = HashMap::new();
302+ pending.insert(junk.clone(), Decoder::Pending);
303+ let rows = library_rows(
304+ &[Source {
305+ path: junk.clone(),
306+ audio_stream: 0,
307+ }],
308+ &HashMap::new(),
309+ &pending,
310+ None,
311+ |_| 0,
312+ );
313+ assert_eq!(rows[0].detail, "", "an unasked decoder claims nothing");
314+
315+ std::fs::remove_file(&junk).ok();
316+}
317+
259318 /// What the clip menu offers, and where it hangs. The two items that act on
260319 /// the playhead rather than on the clicked clip are the ones that can be
261320 /// inapplicable, and a menu at the edge of the window has to come back inside
@@ -343,11 +402,13 @@ fn a_caption_is_deleted_by_the_same_row_and_stroke_every_box_is() {
343402 );
344403 // ...and the same reading with a clip under it is the clip menu, untouched:
345404 // the flag is off wherever a `Clip` was clicked.
346- assert!(menu_items(Ctx {
347- timeline: true,
348- ..Ctx::default()
349- })
350- .contains(&ActionId::Cut));
405+ assert!(
406+ menu_items(Ctx {
407+ timeline: true,
408+ ..Ctx::default()
409+ })
410+ .contains(&ActionId::Cut)
411+ );
351412 }
352413
353414 /// A timeline with a subtitle palette and an empty subtitle lane: what a
@@ -949,14 +1010,16 @@ fn the_clip_menu_dims_what_the_playhead_is_not_on_and_stays_in_the_window() {
9491010 }
9501011 assert!(!whole(ActionId::Delete, live).yes());
9511012 assert!(!whole(ActionId::Paste, live).yes());
952- assert!(whole(
953- ActionId::Paste,
954- Ctx {
955- clipboard: true,
956- ..live
957- }
958- )
959- .yes());
1013+ assert!(
1014+ whole(
1015+ ActionId::Paste,
1016+ Ctx {
1017+ clipboard: true,
1018+ ..live
1019+ }
1020+ )
1021+ .yes()
1022+ );
9601023 assert!(!whole(ActionId::CancelExport, live).yes());
9611024 let busy = Ctx {
9621025 exporting: true,
@@ -1176,14 +1239,16 @@ fn a_menu_offers_only_what_applies_and_is_drawn_inside_the_window() {
11761239 assert!(row_enable(RowItem::RemoveWithClips, placed).yes());
11771240 let unplaced = row_items(live);
11781241 assert!(unplaced.contains(&RowItem::Remove) && !unplaced.contains(&RowItem::RemoveWithClips));
1179- assert!(!row_enable(
1180- RowItem::RemoveWithClips,
1181- RowCtx {
1182- exporting: true,
1183- ..placed
1184- }
1185- )
1186- .yes());
1242+ assert!(
1243+ !row_enable(
1244+ RowItem::RemoveWithClips,
1245+ RowCtx {
1246+ exporting: true,
1247+ ..placed
1248+ }
1249+ )
1250+ .yes()
1251+ );
11871252 assert!(!row_enable(RowItem::Add, RowCtx::default()).yes());
11881253 // Every refusal is short enough to sit in the hint column beside its
11891254 // label, the clip menu's rule.
@@ -1617,9 +1682,11 @@ fn adding_a_row_drops_the_whole_source_in_at_the_playhead() {
16171682 let frames = session.file_frames(&second);
16181683 // Through the engine door `insert_source` uses, with the row's own
16191684 // stream: the button, the drop and this are one call.
1620- assert!(session
1621- .place_stream_at(2.0, &second, 0, None)
1622- .expect("av2 is already on the timeline"));
1685+ assert!(
1686+ session
1687+ .place_stream_at(2.0, &second, 0, None)
1688+ .expect("av2 is already on the timeline")
1689+ );
16231690 // The whole of source 1 went in and nothing was painted over: the
16241691 // timeline is longer by exactly that file.
16251692 assert_eq!(session.timeline_duration(), 9.0);
@@ -1646,9 +1713,11 @@ fn adding_a_row_drops_the_whole_source_in_at_the_playhead() {
16461713 let path = session.sources()[0].path.clone();
16471714 let frames = session.file_frames(&path);
16481715 let end = session.timeline_duration();
1649- assert!(session
1650- .place_stream_at(end, &path, 1, None)
1651- .expect("the French track shares the timeline's parameters"));
1716+ assert!(
1717+ session
1718+ .place_stream_at(end, &path, 1, None)
1719+ .expect("the French track shares the timeline's parameters")
1720+ );
16521721 assert_eq!(session.sources()[1].audio_stream, 1);
16531722 assert_eq!(session.timeline_duration(), end * 2.0);
16541723 // Both rows are the same file, so both rows are that file's length --
@@ -1698,9 +1767,11 @@ fn a_row_dropped_on_the_open_bed_lands_under_the_pointer() {
16981767
16991768 // ...and what the release does with it: the frame back through the same
17001769 // rate every box is drawn at, into the door the Add button uses too.
1701- assert!(session
1702- .place_stream_at(f64::from(at) / fps, &second, 0, None)
1703- .expect("av2 is already on this timeline"));
1770+ assert!(
1771+ session
1772+ .place_stream_at(f64::from(at) / fps, &second, 0, None)
1773+ .expect("av2 is already on this timeline")
1774+ );
17041775 let head = |lane| {
17051776 session
17061777 .lane_clips(lane)
@@ -1734,9 +1805,11 @@ fn removing_a_row_is_refused_while_it_plays_and_takes_the_row_away() {
17341805 session.import(&asset("test_av2.mp4")).expect("av2 matches");
17351806 let second = session.sources()[1].path.clone();
17361807 let end = session.timeline_duration();
1737- assert!(session
1738- .place_stream_at(end, &second, 0, None)
1739- .expect("a file just imported is on this timeline"));
1808+ assert!(
1809+ session
1810+ .place_stream_at(end, &second, 0, None)
1811+ .expect("a file just imported is on this timeline")
1812+ );
17401813 let streams = HashMap::new();
17411814 let rows = |session: &PlaybackSession| {
17421815 library_rows(session.sources(), &streams, &HashMap::new(), None, |_| 0).len()
@@ -1957,7 +2030,7 @@ fn trim_to_playhead_moves_the_selected_clips_edge_and_undoes_in_one_step() {
19572030 /// it makes.
19582031 #[test]
19592032 fn the_windows_settings_caches_follow_the_session_across_undo_and_redo() {
1960- use crate::player::actions::{history_step, HistoryBefore, SessionCaches};
2033+ use crate::player::actions::{HistoryBefore, SessionCaches, history_step};
19612034
19622035 let mut session = PlaybackSession::open(asset("test_av.mp4")).expect("open the fixture");
19632036 session.set_gain(0.0);
@@ -2037,7 +2110,7 @@ fn the_windows_settings_caches_follow_the_session_across_undo_and_redo() {
20372110 /// keyed by where a cue sits -- but because the step moves the cues under it.
20382111 #[test]
20392112 fn the_subtitle_pick_follows_its_track_across_an_undo_of_a_removal() {
2040- use crate::player::actions::{history_step, HistoryBefore, SessionCaches};
2113+ use crate::player::actions::{HistoryBefore, SessionCaches, history_step};
20412114
20422115 let mut session = PlaybackSession::open(asset("test_av.mp4")).expect("open the fixture");
20432116 session.set_gain(0.0);
@@ -2268,9 +2341,11 @@ fn a_track_can_be_added_dropped_on_edited_and_taken_back() {
22682341 // A library row let go over that row: the same door the Add button
22692342 // uses, told which lane it was let go over.
22702343 let path = session.sources()[0].path.clone();
2271- assert!(session
2272- .place_stream_at(1.0, &path, 0, Some(v2))
2273- .expect("its own file is on this timeline"));
2344+ assert!(
2345+ session
2346+ .place_stream_at(1.0, &path, 0, Some(v2))
2347+ .expect("its own file is on this timeline")
2348+ );
22742349 assert_eq!(session.lane_clips(v2).len(), 1, "the drop landed on V2");
22752350 assert_eq!(session.lane_clips(v2)[0].start, 30, "at the playhead");
22762351 // ...with the sound it came with, on the row of its own the drop added:
@@ -2357,18 +2432,22 @@ fn a_selection_drag_moves_every_pick_by_the_same_delta() {
23572432
23582433 // clip0 on V1 at the fixture's own start; clip1 on V1 ten seconds in,
23592434 // appended to the open bed and rippling nothing.
2360- assert!(session
2361- .place_stream_at(10.0, &second, 0, None)
2362- .expect("av2 is on this timeline"));
2435+ assert!(
2436+ session
2437+ .place_stream_at(10.0, &second, 0, None)
2438+ .expect("av2 is on this timeline")
2439+ );
23632440 let clip0 = session.lane_clips(Lane::V1)[0];
23642441 let clip1 = session.lane_clips(Lane::V1)[1];
23652442 assert_eq!((clip0.start, clip1.start), (0, 300));
23662443
23672444 // clipC on a second video row, well past both of the above.
23682445 let v2 = session.add_lane(LaneKind::Video);
2369- assert!(session
2370- .place_stream_at(20.0, &path, 0, Some(v2))
2371- .expect("test_av.mp4 is on this timeline"));
2446+ assert!(
2447+ session
2448+ .place_stream_at(20.0, &path, 0, Some(v2))
2449+ .expect("test_av.mp4 is on this timeline")
2450+ );
23722451 let clip_c = session.lane_clips(v2)[0];
23732452 assert_eq!(clip_c.start, 600);
23742453
@@ -2421,22 +2500,28 @@ fn a_selection_drag_refuses_as_one_set_when_any_pick_cannot_land() {
24212500 session.import(&asset("test_av2.mp4")).expect("av2 matches");
24222501 let second = session.sources()[1].path.clone();
24232502
2424- assert!(session
2425- .place_stream_at(10.0, &second, 0, None)
2426- .expect("av2 is on this timeline"));
2503+ assert!(
2504+ session
2505+ .place_stream_at(10.0, &second, 0, None)
2506+ .expect("av2 is on this timeline")
2507+ );
24272508 let clip0 = session.lane_clips(Lane::V1)[0];
24282509 let clip1 = session.lane_clips(Lane::V1)[1];
24292510
24302511 let v2 = session.add_lane(LaneKind::Video);
2431- assert!(session
2432- .place_stream_at(0.0, &path, 0, Some(v2))
2433- .expect("test_av.mp4 is on this timeline"));
2512+ assert!(
2513+ session
2514+ .place_stream_at(0.0, &path, 0, Some(v2))
2515+ .expect("test_av.mp4 is on this timeline")
2516+ );
24342517 let clip_c = session.lane_clips(v2)[0];
24352518 // A clip clip1 is not picked, blocking the road on V2 the drag is about
24362519 // to try: clip1 dragged onto V2 lands its head inside this one.
2437- assert!(session
2438- .place_stream_at(10.0, &second, 0, Some(v2))
2439- .expect("av2 is on this timeline"));
2520+ assert!(
2521+ session
2522+ .place_stream_at(10.0, &second, 0, Some(v2))
2523+ .expect("av2 is on this timeline")
2524+ );
24402525 let blocker = session.lane_clips(v2)[1];
24412526 assert_eq!(blocker.start, 300);
24422527
@@ -2491,16 +2576,20 @@ fn a_three_pick_copy_paste_preserves_gaps_and_lane_assignment() {
24912576 session.import(&asset("test_av2.mp4")).expect("av2 matches");
24922577 let second = session.sources()[1].path.clone();
24932578
2494- assert!(session
2495- .place_stream_at(10.0, &second, 0, None)
2496- .expect("av2 is on this timeline"));
2579+ assert!(
2580+ session
2581+ .place_stream_at(10.0, &second, 0, None)
2582+ .expect("av2 is on this timeline")
2583+ );
24972584 let clip0 = session.lane_clips(Lane::V1)[0];
24982585 let clip1 = session.lane_clips(Lane::V1)[1];
24992586
25002587 let v2 = session.add_lane(LaneKind::Video);
2501- assert!(session
2502- .place_stream_at(20.0, &path, 0, Some(v2))
2503- .expect("test_av.mp4 is on this timeline"));
2588+ assert!(
2589+ session
2590+ .place_stream_at(20.0, &path, 0, Some(v2))
2591+ .expect("test_av.mp4 is on this timeline")
2592+ );
25042593 let clip_c = session.lane_clips(v2)[0];
25052594
25062595 // Copied in click order, out of the lanes each was clicked in -- exactly
@@ -2548,16 +2637,20 @@ fn a_colliding_set_paste_refuses_whole() {
25482637 session.import(&asset("test_av2.mp4")).expect("av2 matches");
25492638 let second = session.sources()[1].path.clone();
25502639
2551- assert!(session
2552- .place_stream_at(10.0, &second, 0, None)
2553- .expect("av2 is on this timeline"));
2640+ assert!(
2641+ session
2642+ .place_stream_at(10.0, &second, 0, None)
2643+ .expect("av2 is on this timeline")
2644+ );
25542645 let clip0 = session.lane_clips(Lane::V1)[0];
25552646 let clip1 = session.lane_clips(Lane::V1)[1];
25562647
25572648 let v2 = session.add_lane(LaneKind::Video);
2558- assert!(session
2559- .place_stream_at(20.0, &path, 0, Some(v2))
2560- .expect("test_av.mp4 is on this timeline"));
2649+ assert!(
2650+ session
2651+ .place_stream_at(20.0, &path, 0, Some(v2))
2652+ .expect("test_av.mp4 is on this timeline")
2653+ );
25612654 let clip_c = session.lane_clips(v2)[0];
25622655
25632656 let items = [(Lane::V1, clip0), (Lane::V1, clip1), (v2, clip_c)];
@@ -2612,9 +2705,11 @@ fn a_grouped_clip_on_an_added_lane_closes_its_hole_with_its_caption() {
26122705 let (mut session, sub_lane) = with_subtitle_lane();
26132706 let v2 = session.add_lane(LaneKind::Video);
26142707 let path = session.sources()[0].path.clone();
2615- assert!(session
2616- .place_stream_at(0.0, &path, 0, Some(v2))
2617- .expect("its own file is on this timeline"));
2708+ assert!(
2709+ session
2710+ .place_stream_at(0.0, &path, 0, Some(v2))
2711+ .expect("its own file is on this timeline")
2712+ );
26182713 session
26192714 .place_sub(sub_lane, 0, one_second(0))
26202715 .expect("the caption goes down");
crates/app/src/tests/layout.rsmodified+53 -18
@@ -351,7 +351,7 @@ fn a_lane_row_is_a_fixed_header_and_a_bed_that_can_be_hit() {
351351 /// strip's row at the zoom boundary without the strip to show for it.
352352 #[test]
353353 fn the_scroll_strip_row_comes_and_goes_with_the_zoom() {
354- use crate::{lanes_h, split_size, timeline_fixed_h, timeline_h, Split, SCROLL_HIT};
354+ use crate::{SCROLL_HIT, Split, lanes_h, split_size, timeline_fixed_h, timeline_h};
355355 use gpui::{px, size};
356356
357357 // The strip's row, and only the strip's row, is what the two faces differ
@@ -398,8 +398,8 @@ fn the_scroll_strip_row_comes_and_goes_with_the_zoom() {
398398 /// on the track, the time axis's own thumb turned through a right angle.
399399 #[test]
400400 fn the_lane_thumb_is_the_visible_share_of_the_stack() {
401- use crate::lanes_thumb;
402401 use crate::SCROLL_THUMB_MIN;
402+ use crate::lanes_thumb;
403403
404404 // Whole stack on screen: the track fills and there is nothing to scroll.
405405 assert_eq!(lanes_thumb(200., 104., 200., 0.), (0., 200.));
@@ -1301,7 +1301,7 @@ fn the_darkroom_subtitle_palette_drags_tracks_to_subtitle_lanes() {
13011301 /// arrival order, at the end.
13021302 #[test]
13031303 fn a_file_subtitle_group_follows_its_own_row() {
1304- use crate::ui::dock_stance::{source_list_order, Slot};
1304+ use crate::ui::dock_stance::{Slot, source_list_order};
13051305 let film = PathBuf::from("/films/a.mkv");
13061306 let other = PathBuf::from("/rec/b.mp4");
13071307 let loose = PathBuf::from("/subs/late.srt");
@@ -1798,8 +1798,8 @@ fn darkroom_lane_header_verbs_are_targeted_and_visible() {
17981798 fn a_dragged_divider_stops_before_either_panel_disappears() {
17991799 use crate::ui::theme::INSPECTOR_MIN_W;
18001800 use crate::{
1801- inspector_w, library_w, split_drag_size, split_size, timeline_fixed_h, timeline_h, Split,
1802- SIDE_MAX_FRAC, SPLIT_W, TIMELINE_MAX_SHARE, TOOLBAR_H,
1801+ SIDE_MAX_FRAC, SPLIT_W, Split, TIMELINE_MAX_SHARE, TOOLBAR_H, inspector_w, library_w,
1802+ split_drag_size, split_size, timeline_fixed_h, timeline_h,
18031803 };
18041804 use gpui::{point, px, size};
18051805
@@ -1919,7 +1919,7 @@ fn a_dragged_divider_stops_before_either_panel_disappears() {
19191919 fn the_darkroom_seams_stop_before_either_side_disappears() {
19201920 use crate::ui::theme::INSPECTOR_MIN_W;
19211921 use crate::{
1922- split_bounds, split_drag_size, split_size, Split, BENCH_MIN_H, SIDE_MAX_FRAC, SPLIT_W,
1922+ BENCH_MIN_H, SIDE_MAX_FRAC, SPLIT_W, Split, split_bounds, split_drag_size, split_size,
19231923 };
19241924 use gpui::{point, px, size};
19251925
@@ -1978,9 +1978,9 @@ fn the_darkroom_seams_stop_before_either_side_disappears() {
19781978 /// ~2px at the old `BENCH_MIN_H = 80.`).
19791979 #[test]
19801980 fn both_default_lanes_fit_the_bench_at_its_floor() {
1981- use crate::ui::bench_stance::{row_h, LANE_MIN_H, ROW_GAP, RULER_H};
1982- use crate::ui::stance::BENCH_CHROME_H;
19831981 use crate::BENCH_MIN_H;
1982+ use crate::ui::bench_stance::{LANE_MIN_H, ROW_GAP, RULER_H, row_h};
1983+ use crate::ui::stance::BENCH_CHROME_H;
19841984
19851985 let box_h = BENCH_MIN_H - BENCH_CHROME_H;
19861986 let avail = box_h - RULER_H - ROW_GAP;
@@ -2020,9 +2020,9 @@ fn both_default_lanes_fit_the_bench_at_its_floor() {
20202020 /// painted bounds back, so it stays geometry-only, same as its neighbours.
20212021 #[test]
20222022 fn the_whole_bench_stack_fits_its_own_floor_with_the_ledger_seam_clear() {
2023+ use crate::BENCH_MIN_H;
20232024 use crate::ui::bench_stance::{LANE_MIN_H, ROW_GAP, RULER_H};
20242025 use crate::ui::stance::BENCH_CHROME_H;
2025- use crate::BENCH_MIN_H;
20262026
20272027 const BENCH_BORDER_T: f32 = 1.;
20282028 const BENCH_PY_TOP: f32 = 4.;
@@ -2092,9 +2092,9 @@ fn a_lane_row_fits_what_its_own_head_draws() {
20922092 #[test]
20932093 fn a_saved_seam_survives_a_reload() {
20942094 use crate::{
2095- load_stance_splits_from, save_stance_splits_to, Split, Splits, BENCH_MIN_H, SIDE_MAX_FRAC,
2095+ BENCH_MIN_H, SIDE_MAX_FRAC, Split, Splits, load_stance_splits_from, save_stance_splits_to,
20962096 };
2097- use gpui::{px, size, Pixels, Size};
2097+ use gpui::{Pixels, Size, px, size};
20982098
20992099 let dir = engine::scratch::Scratch::dir("edith-stance-splits");
21002100 let path = dir.join("stance-splits");
@@ -2137,7 +2137,7 @@ fn a_saved_seam_survives_a_reload() {
21372137 /// drag that never started (`None`) owes nothing.
21382138 #[test]
21392139 fn only_the_persisted_seams_owe_a_save_when_a_drag_loses_the_window() {
2140- use crate::{player::timeline_edit::split_drag_owes_save, Split};
2140+ use crate::{Split, player::timeline_edit::split_drag_owes_save};
21412141
21422142 assert!(split_drag_owes_save(Some(Split::Dock)));
21432143 assert!(split_drag_owes_save(Some(Split::Bench)));
@@ -2151,8 +2151,8 @@ fn only_the_persisted_seams_owe_a_save_when_a_drag_loses_the_window() {
21512151 /// `load_stance_splits`'s doc comment promises.
21522152 #[test]
21532153 fn a_missing_stance_splits_file_leaves_every_region_at_its_default() {
2154- use crate::{load_stance_splits_from, Split};
2155- use gpui::{px, size, Pixels, Size};
2154+ use crate::{Split, load_stance_splits_from};
2155+ use gpui::{Pixels, Size, px, size};
21562156
21572157 let dir = engine::scratch::Scratch::dir("edith-stance-splits-missing");
21582158 let window: Size<Pixels> = size(px(1280.), px(720.));
@@ -2993,7 +2993,7 @@ fn the_bench_answers_a_wheel_notch_anywhere_over_it() {
29932993 /// kept beside the first ([`Splits::clear`]).
29942994 #[test]
29952995 fn a_double_pressed_divider_forgets_the_size_it_was_dragged_to() {
2996- use crate::layout::{split_size, Split, Splits};
2996+ use crate::layout::{Split, Splits, split_size};
29972997 use gpui::{px, size};
29982998
29992999 let window = size(px(1280.), px(720.));
@@ -3083,7 +3083,7 @@ fn the_bench_seam_reaches_no_further_than_every_other_seam() {
30833083 /// `bench=105` at the floor, `bench=1164` at the ceiling.
30843084 #[test]
30853085 fn the_bench_seam_stops_at_its_floor_and_its_ceiling() {
3086- use crate::{split_bounds, split_size, Split, BENCH_MIN_H};
3086+ use crate::{BENCH_MIN_H, Split, split_bounds, split_size};
30873087 use gpui::{px, size};
30883088
30893089 let window = size(px(2560.), px(1440.));
@@ -3197,6 +3197,41 @@ fn a_source_row_shows_its_name_before_anything_else() {
31973197 );
31983198 }
31993199
3200+/// The dock's metadata line drops the decoder *seat* and nothing else. A file
3201+/// the decoder refused has no seat to drop: its detail is the refusal, and it
3202+/// is the only thing the line has to say.
3203+#[test]
3204+fn the_dock_keeps_a_refusal_where_it_drops_a_seat() {
3205+ use crate::ui::dock_stance::without_seats;
3206+ use engine::decode::Backend;
3207+
3208+ let seats = [
3209+ Backend::Opening,
3210+ Backend::Hardware,
3211+ Backend::Software,
3212+ Backend::Still,
3213+ Backend::Gap,
3214+ ]
3215+ .map(Backend::label);
3216+ assert_eq!(
3217+ without_seats("h264 · HW", &seats),
3218+ "h264",
3219+ "the seat is how this machine reads it, and the row says what the file is"
3220+ );
3221+ let refusal = "no Segment element: not a Matroska file";
3222+ assert_eq!(
3223+ without_seats(refusal, &seats),
3224+ refusal,
3225+ "a refusal is not a seat, and reaches the row whole"
3226+ );
3227+ // The halves keep their separator either way: a stream detail beside a
3228+ // refusal is still two things said in order.
3229+ assert_eq!(
3230+ without_seats(&format!("{refusal} · stereo · 48 kHz"), &seats),
3231+ format!("{refusal} · stereo · 48 kHz")
3232+ );
3233+}
3234+
32003235 /// A room key pressed while the ring sits in the dock has to reach the room.
32013236 /// Two ways it did not: the dock's own handler could stop a key it does not
32023237 /// answer, and the body the dock mounts could leave the focused
@@ -3400,8 +3435,8 @@ fn the_ledger_carries_the_rooms_four_verbs_and_no_rail_remains() {
34003435 /// deletion.
34013436 #[test]
34023437 fn select_all_left_the_ruler_for_the_rulers_own_menu() {
3403- use crate::menus::BENCH_ITEMS;
34043438 use crate::ActionId;
3439+ use crate::menus::BENCH_ITEMS;
34053440 let bench = src_text("ui/bench_stance.rs");
34063441 for gone in ["bench-select-all", "select_all_band", "SELECT_ALL_PAD"] {
34073442 assert!(!bench.contains(gone), "the ruler still carries {gone}");
@@ -3873,7 +3908,7 @@ fn the_export_section_is_four_rows_and_no_fifth() {
38733908 /// cannot write, because [`Player::set_format`] would only refuse it back.
38743909 #[test]
38753910 fn the_picture_row_cycles_codec_and_container_together_and_skips_a_refusal() {
3876- use crate::ui::settings_stance::{next_picture, picture_label, PICTURE_CYCLE};
3911+ use crate::ui::settings_stance::{PICTURE_CYCLE, next_picture, picture_label};
38773912 assert_eq!(
38783913 PICTURE_CYCLE,
38793914 [
crates/app/src/tests/mod.rsmodified+30 -29
@@ -10,55 +10,56 @@ mod media;
1010 mod view;
1111
1212 use super::{
13- active_lane, auto_bps, band_label, bitrate_detail, clipboard_after_remove, color_snap,
14- containers, destructive, enable, enable_lane, envelope, eq_card_w, eq_freq, eq_freq_label,
15- eq_graph_h, eq_spectrum, eq_x, eq_y, estimated_bytes, export_path, export_settings,
16- format_refusal, fps_choices, fps_label, frac_along, frac_down, frame_at, frame_rate_ladder,
17- histogram, inserted_band, is_project, keymap, keys_rows, keys_rows_matching, lane_items,
18- lanes_h, marked, menu_at, menu_items, menu_rows_h, next_container, normalise, nothing_to_play,
19- notice_tone, panel_h, parse_budget, project_path, proxies_to_start, push_notice, px_below,
20- range_word, rate_label, retarget, row_enable, row_items, scrub_due, secs_label, should_resync,
13+ ACCENT_PRIMARY, AUDIO_KBPS, BENCH_ITEMS, BG_RAISED, BPS_COARSE, BPS_FINE, BPS_MAX, BPS_MIN,
14+ COLOR_BANDS, COLOR_BAR_W, COLOR_STEP, COLOR_W, CONTROL_H, Clip, ColorEdit, Ctx,
15+ DEFAULT_AUDIO_KBPS, Decoder, EQ_BANDS_MAX, EQ_CURVE_STEPS, EQ_FFT, EQ_FREQ_HIGH, EQ_FREQ_LOW,
16+ EQ_FREQ_STEP, EQ_GAIN_LIMIT, EQ_GRAPH_H, EQ_HANDLE, EQ_Q_HIGH, EQ_Q_LOW, EQ_Q_STEP,
17+ EQ_SPECTRUM_DB, EQ_TICKS, EQ_W_MAX, ESCAPE, EXPORT_DONE, EXPORT_MOMENT_H, Enable, EncoderSeat,
18+ FORMATS, Format, HEADER_H, HIST_BINS, HIST_H, HIST_SAMPLES, HIT_MIN, KEYS_ROW_H, KEYS_W,
19+ KeyRow, LABEL_H, LANE_H, LANES_MAX, LATE_RESYNC, LIBRARY_MAX_W, LIBRARY_MIN_W, Lane, MB_FLOOR,
20+ MENU_ITEMS, MENU_PAD, MENU_ROW_H, MENU_W, NO_FILE, NOTICES_MAX, NumberEdit, OVERLAID, PANEL_H,
21+ RESYNC_GAP, ROW_ITEMS, RULER_HIT_H, RowCtx, RowItem, SCROLL_NOTCH_SHARE, SILENCE_ROWS,
22+ SOURCE_TINTS, SPEED_PRESETS, SPEED_STEP, STATUS_ERROR, STATUS_SUCCESS, STATUS_WARNING,
23+ SUB_PLAN_CHARS, Source, Speed, StreamInfo, SubPickKey, TIMELINE_SHARE, Transport, VOLUME_W,
24+ VizSlot, Volume, WAVE_BPS, WAVE_COL, WAVE_COLS_MAX, Wave, ZOOM_MIN_FRAMES, active_lane,
25+ auto_bps, band_label, bitrate_detail, clipboard_after_remove, color_snap, containers,
26+ destructive, enable, enable_lane, envelope, eq_card_w, eq_freq, eq_freq_label, eq_graph_h,
27+ eq_spectrum, eq_x, eq_y, estimated_bytes, export_path, export_settings, format_refusal,
28+ fps_choices, fps_label, frac_along, frac_down, frame_at, frame_rate_ladder, histogram,
29+ inserted_band, is_project, keymap, keys_rows, keys_rows_matching, lane_items, lanes_h, marked,
30+ menu_at, menu_items, menu_rows_h, next_container, normalise, nothing_to_play, notice_tone,
31+ panel_h, parse_budget, project_path, proxies_to_start, push_notice, px_below, range_word,
32+ rate_label, retarget, row_enable, row_items, scrub_due, secs_label, should_resync,
2133 silence_rate, size_label, snap_cue, snap_marks, snapped, source_tint, span_partner, speed_at,
2234 sub_pick_after_removal, sub_pick_after_restore, subtitle_plan, timecode, timeline_fixed_h,
2335 tip_may_paint, transport, typed, unseen_paths, unseen_sources, viz_held_paint, whole_take,
24- window_title, Clip, ColorEdit, Ctx, Enable, EncoderSeat, Format, KeyRow, Lane, NumberEdit,
25- RowCtx, RowItem, Source, Speed, StreamInfo, SubPickKey, Transport, VizSlot, Volume, Wave,
26- ACCENT_PRIMARY, AUDIO_KBPS, BENCH_ITEMS, BG_RAISED, BPS_COARSE, BPS_FINE, BPS_MAX, BPS_MIN,
27- COLOR_BANDS, COLOR_BAR_W, COLOR_STEP, COLOR_W, CONTROL_H, DEFAULT_AUDIO_KBPS, EQ_BANDS_MAX,
28- EQ_CURVE_STEPS, EQ_FFT, EQ_FREQ_HIGH, EQ_FREQ_LOW, EQ_FREQ_STEP, EQ_GAIN_LIMIT, EQ_GRAPH_H,
29- EQ_HANDLE, EQ_Q_HIGH, EQ_Q_LOW, EQ_Q_STEP, EQ_SPECTRUM_DB, EQ_TICKS, EQ_W_MAX, ESCAPE,
30- EXPORT_DONE, EXPORT_MOMENT_H, FORMATS, HEADER_H, HIST_BINS, HIST_H, HIST_SAMPLES, HIT_MIN,
31- KEYS_ROW_H, KEYS_W, LABEL_H, LANES_MAX, LANE_H, LATE_RESYNC, LIBRARY_MAX_W, LIBRARY_MIN_W,
32- MB_FLOOR, MENU_ITEMS, MENU_PAD, MENU_ROW_H, MENU_W, NOTICES_MAX, NO_FILE, OVERLAID, PANEL_H,
33- RESYNC_GAP, ROW_ITEMS, RULER_HIT_H, SCROLL_NOTCH_SHARE, SILENCE_ROWS, SOURCE_TINTS,
34- SPEED_PRESETS, SPEED_STEP, STATUS_ERROR, STATUS_SUCCESS, STATUS_WARNING, SUB_PLAN_CHARS,
35- TIMELINE_SHARE, VOLUME_W, WAVE_BPS, WAVE_COL, WAVE_COLS_MAX, ZOOM_MIN_FRAMES,
36+ window_title,
3637 };
3738
3839 use super::{
39- arrival, audio_rate_choices, av1_hw_warning, clip_width, clock, encoder_choices, encoder_label,
40+ ActionId, Choice, EDGE_W, ETA_SPAN, Edge, FITS, FRAME_RATES, IMPORT_STALL, Import, ImportStage,
41+ Landing, LaneKind, PPS_DEFAULT, PPS_MIN, Preset, RESOLUTIONS, Repeat, SAMPLE_RATES, SEEK_STALL,
42+ Scale, ScanKey, ScanPlan, SilenceScan, SubClip, View, ZOOM_OUT_MARGIN, ZOOM_STEP, arrival,
43+ audio_rate_choices, av1_hw_warning, clip_width, clock, encoder_choices, encoder_label,
4044 eta_secs, file_name, file_uri, fit_choices, frames_of_us, full_scan_key, import_line, landing,
4145 lane_refuses, launch_queue, library_rows, live_idx, next_fit, next_resolution, note_progress,
4246 pending_fps_choices, pending_resolution_choices, px_along, read_ahead, repeats,
4347 resolution_choices, resolution_ladder, sample_rate_choices, scan_plan, seek_line,
4448 silence_cached, silence_line, slice_whole_levels, source_secs, stash_or_write, tone_choices,
45- tone_label, trimmed_clip, trimmed_sub, trims, unscannable, unusable, ActionId, Choice, Edge,
46- Import, ImportStage, Landing, LaneKind, Preset, Repeat, Scale, ScanKey, ScanPlan, SilenceScan,
47- SubClip, View, EDGE_W, ETA_SPAN, FITS, FRAME_RATES, IMPORT_STALL, PPS_DEFAULT, PPS_MIN,
48- RESOLUTIONS, SAMPLE_RATES, SEEK_STALL, ZOOM_OUT_MARGIN, ZOOM_STEP,
49+ tone_label, trimmed_clip, trimmed_sub, trims, unscannable, unusable,
4950 };
5051
5152 use super::{
52- carries_subtitles, cue_box, cues_at, file_tint, is_subtitle, lang_human, sub_bottom,
53- sub_pick_name, subtitle_detail, subtitle_notice, subtitle_rows, subtitle_tail,
54- subtitle_toggle_notice, walk_subtitles, Subs, SUB_BOTTOM, SUB_CUE_MIN_W, SUB_LINE_H, SUB_TEXT,
53+ SUB_BOTTOM, SUB_CUE_MIN_W, SUB_LINE_H, SUB_TEXT, Subs, carries_subtitles, cue_box, cues_at,
54+ file_tint, is_subtitle, lang_human, sub_bottom, sub_pick_name, subtitle_detail,
55+ subtitle_notice, subtitle_rows, subtitle_tail, subtitle_toggle_notice, walk_subtitles,
5556 };
5657
5758 use engine::PlaybackSession;
5859
5960 use engine::scale::FitPolicy;
6061
61-use gpui::{point, px, size, Bounds, Pixels};
62+use gpui::{Bounds, Pixels, point, px, size};
6263
6364 use std::collections::HashMap;
6465
crates/app/src/ui/dock_stance.rsmodified+244 -134
@@ -185,7 +185,11 @@ fn dock_tab(
185185 }
186186 cx.notify();
187187 }))
188- .tooltip(crate::ui::widgets::tip_hover(&format!("Show {}", label_text.to_lowercase()), "", None))
188+ .tooltip(crate::ui::widgets::tip_hover(
189+ &format!("Show {}", label_text.to_lowercase()),
190+ "",
191+ None,
192+ ))
189193 .children(hitmap::control(id, label_text, true))
190194 .child(
191195 div()
@@ -232,6 +236,25 @@ fn usage_line(player: &Player, source_idx: usize, placed: usize) -> String {
232236 lanes.join(" ")
233237 }
234238
239+/// A row's detail line with the decoder seats taken out of it, which is what
240+/// the dock draws: the seat is how this machine happens to read the file and
241+/// the transport line and the Properties side both still say it, so the row
242+/// says what the file *is* instead.
243+///
244+/// Only a whole part is dropped, and a part is a seat only when it is exactly
245+/// a seat's word. That is what keeps a refusal: the row's detail for a file
246+/// the decoder would not take is the refusal itself
247+/// ([`crate::Decoder::Refused`]), and no seat is ever named by a sentence --
248+/// so the one line that has to say why the file will not play reaches the
249+/// dock whole.
250+pub(crate) fn without_seats(detail: &str, seats: &[&str]) -> String {
251+ detail
252+ .split(" · ")
253+ .filter(|part| !seats.contains(part))
254+ .collect::<Vec<_>>()
255+ .join(" · ")
256+}
257+
235258 /// The file's name without its extension -- what the editor calls the film,
236259 /// not what the filesystem calls the bytes (cleanse round 2). A row that
237260 /// names several streams of one file keeps the stream half it was given
@@ -281,12 +304,7 @@ fn source_row(
281304 Backend::Gap,
282305 ]
283306 .map(Backend::label);
284- let detail = row
285- .detail
286- .split(" · ")
287- .filter(|part| !seats.contains(part))
288- .collect::<Vec<_>>()
289- .join(" · ");
307+ let detail = without_seats(&row.detail, &seats);
290308 let under: String = match &row.unusable {
291309 Some(why) => why.clone(),
292310 None => join_detail(
@@ -690,15 +708,15 @@ fn subtitle_tab_rows(
690708 .on_drag(SubPick(track), {
691709 let me = cx.entity();
692710 move |_, _, _, cx| {
693- // A fresh gesture inherits nothing: `Player::drag_lane`
694- // and `Player::drag_x` are the *last live sample* of the
695- // drag being made, and a drag whose first sample lands
696- // outside every row would otherwise be let go onto the
697- // lane the previous one ended over.
698- me.update(cx, |this, _| {
699- this.drag_lane = None;
700- this.drag_x = None;
701- });
711+ // A fresh gesture inherits nothing: `Player::drag_lane`
712+ // and `Player::drag_x` are the *last live sample* of the
713+ // drag being made, and a drag whose first sample lands
714+ // outside every row would otherwise be let go onto the
715+ // lane the previous one ended over.
716+ me.update(cx, |this, _| {
717+ this.drag_lane = None;
718+ this.drag_x = None;
719+ });
702720 cx.new(|_| Tip(ghost.clone()))
703721 }
704722 })
@@ -707,7 +725,11 @@ fn subtitle_tab_rows(
707725 cx.notify();
708726 }))
709727 })
710- .tooltip(crate::ui::widgets::tip_hover("Subtitle track", "drag to a lane", None))
728+ .tooltip(crate::ui::widgets::tip_hover(
729+ "Subtitle track",
730+ "drag to a lane",
731+ None,
732+ ))
711733 .children(hitmap::dynamic(
712734 move || {
713735 (
@@ -777,7 +799,11 @@ fn subtitle_tab_rows(
777799 cx.stop_propagation();
778800 this.remove_subtitle_track(track, cx);
779801 }))
780- .tooltip(crate::ui::widgets::tip_hover("Remove subtitle track", "", None))
802+ .tooltip(crate::ui::widgets::tip_hover(
803+ "Remove subtitle track",
804+ "",
805+ None,
806+ ))
781807 .children(hitmap::dynamic(
782808 move || {
783809 (
@@ -794,78 +820,79 @@ fn subtitle_tab_rows(
794820 let has_header = !nested || track_count > 3;
795821 let folded = has_header && (nested != player.sub_folded.contains(&group_path));
796822 let header = div()
797- .id(("dock-subtitle-group", group_ord))
798- .flex_none()
799- .flex()
800- .items_center()
801- .gap(px(6.))
802- .px(px(8.))
803- // Stepped in under its parent when it has one, the
804- // same outline the track rows below it read as.
805- .when(nested, |d| d.pl(px(22.)))
806- .py(px(4.))
807- .rounded(px(3.))
808- .cursor_pointer()
809- .hover(|s| s.bg(rgb(DARK_RAISED())))
810- .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
811- if !this.sub_folded.remove(&fold_path) {
812- this.sub_folded.insert(fold_path.clone());
813- }
814- cx.notify();
815- }))
816- .tooltip(crate::ui::widgets::tip_hover("Fold this source", "click", None))
817- .children(hitmap::dynamic(
818- move || {
819- (
820- format!("subtitle-group.{group_ord}.fold"),
821- "Toggle subtitle group".into(),
822- )
823- },
824- true,
825- ))
826- // Bare, the glyph inherited the panel's dim ink and
827- // vanished ("the little arrow on left side is hard
828- // to see", user 2026-08-27) -- it reads at the same
829- // ink as the name it folds.
830- .child(
831- div()
832- .flex_none()
833- .w(px(10.))
834- .text_color(rgb(INK1()))
835- .child(if folded { "▸" } else { "▾" }),
836- )
837- .when_some(tint, |d, tint| {
838- d.child(
839- div()
840- .flex_none()
841- .w(px(8.))
842- .h(px(8.))
843- .rounded(px(4.))
844- .bg(rgb(tint)),
845- )
846- })
847- .child(
848- div()
849- .flex_1()
850- .min_w(px(0.))
851- .truncate()
852- .type_style(mono(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM))
853- .text_color(rgb(INK1()))
854- .child(group.name),
823+ .id(("dock-subtitle-group", group_ord))
824+ .flex_none()
825+ .flex()
826+ .items_center()
827+ .gap(px(6.))
828+ .px(px(8.))
829+ // Stepped in under its parent when it has one, the
830+ // same outline the track rows below it read as.
831+ .when(nested, |d| d.pl(px(22.)))
832+ .py(px(4.))
833+ .rounded(px(3.))
834+ .cursor_pointer()
835+ .hover(|s| s.bg(rgb(DARK_RAISED())))
836+ .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
837+ if !this.sub_folded.remove(&fold_path) {
838+ this.sub_folded.insert(fold_path.clone());
839+ }
840+ cx.notify();
841+ }))
842+ .tooltip(crate::ui::widgets::tip_hover(
843+ "Fold this source",
844+ "click",
845+ None,
846+ ))
847+ .children(hitmap::dynamic(
848+ move || {
849+ (
850+ format!("subtitle-group.{group_ord}.fold"),
851+ "Toggle subtitle group".into(),
855852 )
856- .child(
857- div()
858- .flex_none()
859- .type_style(mono(
860- type_scale::CHORD_METADATA_MIN_PX,
861- FontWeight::MEDIUM,
862- ))
863- .text_color(rgb(INK3()))
864- .child(format!(
865- "{track_count} track{}",
866- if track_count == 1 { "" } else { "s" }
867- )),
868- );
853+ },
854+ true,
855+ ))
856+ // Bare, the glyph inherited the panel's dim ink and
857+ // vanished ("the little arrow on left side is hard
858+ // to see", user 2026-08-27) -- it reads at the same
859+ // ink as the name it folds.
860+ .child(
861+ div()
862+ .flex_none()
863+ .w(px(10.))
864+ .text_color(rgb(INK1()))
865+ .child(if folded { "▸" } else { "▾" }),
866+ )
867+ .when_some(tint, |d, tint| {
868+ d.child(
869+ div()
870+ .flex_none()
871+ .w(px(8.))
872+ .h(px(8.))
873+ .rounded(px(4.))
874+ .bg(rgb(tint)),
875+ )
876+ })
877+ .child(
878+ div()
879+ .flex_1()
880+ .min_w(px(0.))
881+ .truncate()
882+ .type_style(mono(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM))
883+ .text_color(rgb(INK1()))
884+ .child(group.name),
885+ )
886+ .child(
887+ div()
888+ .flex_none()
889+ .type_style(mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM))
890+ .text_color(rgb(INK3()))
891+ .child(format!(
892+ "{track_count} track{}",
893+ if track_count == 1 { "" } else { "s" }
894+ )),
895+ );
869896 (
870897 group_path,
871898 track_count,
@@ -1033,7 +1060,11 @@ fn sources_tab(
10331060 this.dock_filter_edit = true;
10341061 cx.notify();
10351062 }))
1036- .tooltip(crate::ui::widgets::tip_hover("Filter sources", "type to narrow", None))
1063+ .tooltip(crate::ui::widgets::tip_hover(
1064+ "Filter sources",
1065+ "type to narrow",
1066+ None,
1067+ ))
10371068 .children(hitmap::control("dock.filter", "Filter sources", true))
10381069 // The glass alone at rest: the word "filter" beside it was
10391070 // the box telling the editor what a filter box is (DESIGN §8).
@@ -1160,7 +1191,11 @@ fn transition_row(player: &Player, cx: &mut Context<Player>) -> Option<impl Into
11601191 .text_size(label_style.size)
11611192 .text_color(rgb(INK2()))
11621193 .cursor_pointer()
1163- .tooltip(crate::ui::widgets::tip_hover("Transition duration", "click to type", None))
1194+ .tooltip(crate::ui::widgets::tip_hover(
1195+ "Transition duration",
1196+ "click to type",
1197+ None,
1198+ ))
11641199 .children(hitmap::control(
11651200 "transition-duration-field",
11661201 "Transition duration, type-in",
@@ -1371,7 +1406,12 @@ fn viz_slot_chips(player: &Player, paint: u64, cx: &mut Context<Player>) -> impl
13711406 .flex()
13721407 .items_center()
13731408 .child(chip("dock-viz-colour", "Colour", VizSlot::Main, true))
1374- .child(chip("dock-viz-strand", "Strand", VizSlot::Strand, strand_live))
1409+ .child(chip(
1410+ "dock-viz-strand",
1411+ "Strand",
1412+ VizSlot::Strand,
1413+ strand_live,
1414+ ))
13751415 }
13761416
13771417 /// The picked slot's colour as text, and the way in: a click opens the type-in
@@ -1395,7 +1435,11 @@ fn viz_hex_row(player: &Player, paint: u64, cx: &mut Context<Player>) -> impl In
13951435 .text_size(row.size)
13961436 .text_color(rgb(INK2()))
13971437 .cursor_pointer()
1398- .tooltip(crate::ui::widgets::tip_hover("Colour", "click to type", None))
1438+ .tooltip(crate::ui::widgets::tip_hover(
1439+ "Colour",
1440+ "click to type",
1441+ None,
1442+ ))
13991443 .children(hitmap::control(
14001444 "dock-viz-hex-field",
14011445 "Colour hex, type-in",
@@ -1424,7 +1468,11 @@ fn viz_color_wheel(player: &Player, paint: u64, cx: &mut Context<Player>) -> imp
14241468 .h(px(112.))
14251469 .relative()
14261470 .cursor_pointer()
1427- .tooltip(crate::ui::widgets::tip_hover("Colour wheel", "drag to pick", None))
1471+ .tooltip(crate::ui::widgets::tip_hover(
1472+ "Colour wheel",
1473+ "drag to pick",
1474+ None,
1475+ ))
14281476 .children(hitmap::control("dock-viz-hs", "Colour wheel", true))
14291477 .child(bounds_probe(player.viz_wheel.clone()))
14301478 .child(
@@ -1448,10 +1496,22 @@ fn viz_color_wheel(player: &Player, paint: u64, cx: &mut Context<Player>) -> imp
14481496 let hue = i as f32 / wedges as f32 * 360.;
14491497 let (r, g, b) = engine::decode::viz_hsv_rgb(hue, sat, 0.84);
14501498 let color = (u32::from(r) << 16) | (u32::from(g) << 8) | u32::from(b);
1451- let p00 = point(px(cx + radius * s0 * a0.sin()), px(cy - radius * s0 * a0.cos()));
1452- let p01 = point(px(cx + radius * s0 * a1.sin()), px(cy - radius * s0 * a1.cos()));
1453- let p11 = point(px(cx + radius * s1 * a1.sin()), px(cy - radius * s1 * a1.cos()));
1454- let p10 = point(px(cx + radius * s1 * a0.sin()), px(cy - radius * s1 * a0.cos()));
1499+ let p00 = point(
1500+ px(cx + radius * s0 * a0.sin()),
1501+ px(cy - radius * s0 * a0.cos()),
1502+ );
1503+ let p01 = point(
1504+ px(cx + radius * s0 * a1.sin()),
1505+ px(cy - radius * s0 * a1.cos()),
1506+ );
1507+ let p11 = point(
1508+ px(cx + radius * s1 * a1.sin()),
1509+ px(cy - radius * s1 * a1.cos()),
1510+ );
1511+ let p10 = point(
1512+ px(cx + radius * s1 * a0.sin()),
1513+ px(cy - radius * s1 * a0.cos()),
1514+ );
14551515 let mut path = PathBuilder::fill();
14561516 path.add_polygon(&[p00, p01, p11, p10], false);
14571517 if let Ok(path) = path.build() {
@@ -1523,9 +1583,20 @@ fn viz_paint_knobs(player: &Player, paint: u64, cx: &mut Context<Player>) -> imp
15231583 .text_color(rgb(INK2()))
15241584 .child("Strands"),
15251585 )
1526- .child(viz_step("dock-viz-strands-minus", "Fewer strands", "−", cx, |this, cx| {
1527- this.set_viz_strands(engine::decode::viz_strands_of(this.viz_paint()).saturating_sub(1).max(1), cx);
1528- }))
1586+ .child(viz_step(
1587+ "dock-viz-strands-minus",
1588+ "Fewer strands",
1589+ "−",
1590+ cx,
1591+ |this, cx| {
1592+ this.set_viz_strands(
1593+ engine::decode::viz_strands_of(this.viz_paint())
1594+ .saturating_sub(1)
1595+ .max(1),
1596+ cx,
1597+ );
1598+ },
1599+ ))
15291600 .child(
15301601 div()
15311602 .font(style.font.clone())
@@ -1533,9 +1604,20 @@ fn viz_paint_knobs(player: &Player, paint: u64, cx: &mut Context<Player>) -> imp
15331604 .text_color(rgb(INK1()))
15341605 .child(format!("{strands}")),
15351606 )
1536- .child(viz_step("dock-viz-strands-plus", "More strands", "+", cx, |this, cx| {
1537- this.set_viz_strands(engine::decode::viz_strands_of(this.viz_paint()).saturating_add(1).min(32), cx);
1538- })),
1607+ .child(viz_step(
1608+ "dock-viz-strands-plus",
1609+ "More strands",
1610+ "+",
1611+ cx,
1612+ |this, cx| {
1613+ this.set_viz_strands(
1614+ engine::decode::viz_strands_of(this.viz_paint())
1615+ .saturating_add(1)
1616+ .min(32),
1617+ cx,
1618+ );
1619+ },
1620+ )),
15391621 )
15401622 .child(
15411623 div()
@@ -1550,9 +1632,18 @@ fn viz_paint_knobs(player: &Player, paint: u64, cx: &mut Context<Player>) -> imp
15501632 .text_color(rgb(INK2()))
15511633 .child("Glow"),
15521634 )
1553- .child(viz_step("dock-viz-glow-minus", "Less glow", "−", cx, |this, cx| {
1554- this.set_viz_glow(engine::decode::viz_glow_of(this.viz_paint()).saturating_sub(1), cx);
1555- }))
1635+ .child(viz_step(
1636+ "dock-viz-glow-minus",
1637+ "Less glow",
1638+ "−",
1639+ cx,
1640+ |this, cx| {
1641+ this.set_viz_glow(
1642+ engine::decode::viz_glow_of(this.viz_paint()).saturating_sub(1),
1643+ cx,
1644+ );
1645+ },
1646+ ))
15561647 .child(
15571648 div()
15581649 .font(style.font.clone())
@@ -1560,9 +1651,20 @@ fn viz_paint_knobs(player: &Player, paint: u64, cx: &mut Context<Player>) -> imp
15601651 .text_color(rgb(INK1()))
15611652 .child(format!("{glow}")),
15621653 )
1563- .child(viz_step("dock-viz-glow-plus", "More glow", "+", cx, |this, cx| {
1564- this.set_viz_glow(engine::decode::viz_glow_of(this.viz_paint()).saturating_add(1).min(16), cx);
1565- })),
1654+ .child(viz_step(
1655+ "dock-viz-glow-plus",
1656+ "More glow",
1657+ "+",
1658+ cx,
1659+ |this, cx| {
1660+ this.set_viz_glow(
1661+ engine::decode::viz_glow_of(this.viz_paint())
1662+ .saturating_add(1)
1663+ .min(16),
1664+ cx,
1665+ );
1666+ },
1667+ )),
15661668 )
15671669 }
15681670
@@ -1806,36 +1908,44 @@ fn keys_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
18061908 .font(style.font.clone())
18071909 .text_size(style.size)
18081910 .text_color(rgb(INK1()))
1809- .tooltip(crate::ui::widgets::tip_hover("Filter keys", "click to type", None))
1911+ .tooltip(crate::ui::widgets::tip_hover(
1912+ "Filter keys",
1913+ "click to type",
1914+ None,
1915+ ))
18101916 .children(hitmap::control("dock.keys-filter", "Filter keys", true))
18111917 .child(match player.keys_filter.is_empty() {
18121918 true => "⌕".to_string(),
18131919 false => format!("⌕ {filter_text}"),
18141920 })
18151921 })
1816- .children(keys_rows_matching(&player.keys_filter, &player.keymap).into_iter().map(|row| match row {
1817- KeyRow::Head(category) => div()
1818- .flex_none()
1819- .pt(px(4.))
1820- .child(section_head(category.label().to_uppercase()))
1821- .into_any_element(),
1822- // The full-truth surface: every chord the action answers to
1823- // (`display`), not the badge's primary-only compact form.
1824- KeyRow::Act(action) => pair(
1825- action.label().to_string(),
1826- player.keymap.display(action),
1827- match player.enable(action, None) {
1828- Enable::Yes => INK2(),
1829- _ => INK4(),
1830- },
1831- ),
1832- // A fixed stroke is the window's, not an action the room can
1833- // refuse, so it never greys.
1834- KeyRow::Fixed(i) => {
1835- let f = &keymap::FIXED[i];
1836- pair(f.label.to_string(), f.chord.to_string(), INK2())
1837- }
1838- }))
1922+ .children(
1923+ keys_rows_matching(&player.keys_filter, &player.keymap)
1924+ .into_iter()
1925+ .map(|row| match row {
1926+ KeyRow::Head(category) => div()
1927+ .flex_none()
1928+ .pt(px(4.))
1929+ .child(section_head(category.label().to_uppercase()))
1930+ .into_any_element(),
1931+ // The full-truth surface: every chord the action answers to
1932+ // (`display`), not the badge's primary-only compact form.
1933+ KeyRow::Act(action) => pair(
1934+ action.label().to_string(),
1935+ player.keymap.display(action),
1936+ match player.enable(action, None) {
1937+ Enable::Yes => INK2(),
1938+ _ => INK4(),
1939+ },
1940+ ),
1941+ // A fixed stroke is the window's, not an action the room can
1942+ // refuse, so it never greys.
1943+ KeyRow::Fixed(i) => {
1944+ let f = &keymap::FIXED[i];
1945+ pair(f.label.to_string(), f.chord.to_string(), INK2())
1946+ }
1947+ }),
1948+ )
18391949 }
18401950
18411951 /// The dock's content, under `stance.rs::dock()`'s tab-bar-and-body frame: