The dock keeps a decoder refusal where it drops a seat
Browse files at this commit47adb87c2a40ab5c6ca7685d82e714bc927cca63Parent: c2e0146- test
- the dock keeps a decoder refusal where it drops a seat
2 changed files +297 -152
- crates/app/src/tests/layout.rs +53 -18
- crates/app/src/ui/dock_stance.rs +244 -134
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() { | |||
| 351 | /// strip's row at the zoom boundary without the strip to show for it. | 351 | /// strip's row at the zoom boundary without the strip to show for it. |
| 352 | #[test] | 352 | #[test] |
| 353 | fn the_scroll_strip_row_comes_and_goes_with_the_zoom() { | 353 | 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}; |
| 355 | use gpui::{px, size}; | 355 | use gpui::{px, size}; |
| 356 | 356 | ||
| 357 | // The strip's row, and only the strip's row, is what the two faces differ | 357 | // 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() { | |||
| 398 | /// on the track, the time axis's own thumb turned through a right angle. | 398 | /// on the track, the time axis's own thumb turned through a right angle. |
| 399 | #[test] | 399 | #[test] |
| 400 | fn the_lane_thumb_is_the_visible_share_of_the_stack() { | 400 | fn the_lane_thumb_is_the_visible_share_of_the_stack() { |
| 401 | - use crate::lanes_thumb; | ||
| 402 | use crate::SCROLL_THUMB_MIN; | 401 | use crate::SCROLL_THUMB_MIN; |
| 402 | + use crate::lanes_thumb; | ||
| 403 | 403 | ||
| 404 | // Whole stack on screen: the track fills and there is nothing to scroll. | 404 | // Whole stack on screen: the track fills and there is nothing to scroll. |
| 405 | assert_eq!(lanes_thumb(200., 104., 200., 0.), (0., 200.)); | 405 | assert_eq!(lanes_thumb(200., 104., 200., 0.), (0., 200.)); |
| @@ -1301,7 +1301,7 @@ fn the_darkroom_subtitle_palette_drags_tracks_to_subtitle_lanes() { | |||
| 1301 | /// arrival order, at the end. | 1301 | /// arrival order, at the end. |
| 1302 | #[test] | 1302 | #[test] |
| 1303 | fn a_file_subtitle_group_follows_its_own_row() { | 1303 | 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}; |
| 1305 | let film = PathBuf::from("/films/a.mkv"); | 1305 | let film = PathBuf::from("/films/a.mkv"); |
| 1306 | let other = PathBuf::from("/rec/b.mp4"); | 1306 | let other = PathBuf::from("/rec/b.mp4"); |
| 1307 | let loose = PathBuf::from("/subs/late.srt"); | 1307 | let loose = PathBuf::from("/subs/late.srt"); |
| @@ -1798,8 +1798,8 @@ fn darkroom_lane_header_verbs_are_targeted_and_visible() { | |||
| 1798 | fn a_dragged_divider_stops_before_either_panel_disappears() { | 1798 | fn a_dragged_divider_stops_before_either_panel_disappears() { |
| 1799 | use crate::ui::theme::INSPECTOR_MIN_W; | 1799 | use crate::ui::theme::INSPECTOR_MIN_W; |
| 1800 | use crate::{ | 1800 | use crate::{ |
| 1801 | - inspector_w, library_w, split_drag_size, split_size, timeline_fixed_h, timeline_h, Split, | 1801 | + SIDE_MAX_FRAC, SPLIT_W, Split, TIMELINE_MAX_SHARE, TOOLBAR_H, inspector_w, library_w, |
| 1802 | - SIDE_MAX_FRAC, SPLIT_W, TIMELINE_MAX_SHARE, TOOLBAR_H, | 1802 | + split_drag_size, split_size, timeline_fixed_h, timeline_h, |
| 1803 | }; | 1803 | }; |
| 1804 | use gpui::{point, px, size}; | 1804 | use gpui::{point, px, size}; |
| 1805 | 1805 | ||
| @@ -1919,7 +1919,7 @@ fn a_dragged_divider_stops_before_either_panel_disappears() { | |||
| 1919 | fn the_darkroom_seams_stop_before_either_side_disappears() { | 1919 | fn the_darkroom_seams_stop_before_either_side_disappears() { |
| 1920 | use crate::ui::theme::INSPECTOR_MIN_W; | 1920 | use crate::ui::theme::INSPECTOR_MIN_W; |
| 1921 | use crate::{ | 1921 | 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, |
| 1923 | }; | 1923 | }; |
| 1924 | use gpui::{point, px, size}; | 1924 | use gpui::{point, px, size}; |
| 1925 | 1925 | ||
| @@ -1978,9 +1978,9 @@ fn the_darkroom_seams_stop_before_either_side_disappears() { | |||
| 1978 | /// ~2px at the old `BENCH_MIN_H = 80.`). | 1978 | /// ~2px at the old `BENCH_MIN_H = 80.`). |
| 1979 | #[test] | 1979 | #[test] |
| 1980 | fn both_default_lanes_fit_the_bench_at_its_floor() { | 1980 | 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; | ||
| 1983 | use crate::BENCH_MIN_H; | 1981 | 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; | ||
| 1984 | 1984 | ||
| 1985 | let box_h = BENCH_MIN_H - BENCH_CHROME_H; | 1985 | let box_h = BENCH_MIN_H - BENCH_CHROME_H; |
| 1986 | let avail = box_h - RULER_H - ROW_GAP; | 1986 | let avail = box_h - RULER_H - ROW_GAP; |
| @@ -2020,9 +2020,9 @@ fn both_default_lanes_fit_the_bench_at_its_floor() { | |||
| 2020 | /// painted bounds back, so it stays geometry-only, same as its neighbours. | 2020 | /// painted bounds back, so it stays geometry-only, same as its neighbours. |
| 2021 | #[test] | 2021 | #[test] |
| 2022 | fn the_whole_bench_stack_fits_its_own_floor_with_the_ledger_seam_clear() { | 2022 | fn the_whole_bench_stack_fits_its_own_floor_with_the_ledger_seam_clear() { |
| 2023 | + use crate::BENCH_MIN_H; | ||
| 2023 | use crate::ui::bench_stance::{LANE_MIN_H, ROW_GAP, RULER_H}; | 2024 | use crate::ui::bench_stance::{LANE_MIN_H, ROW_GAP, RULER_H}; |
| 2024 | use crate::ui::stance::BENCH_CHROME_H; | 2025 | use crate::ui::stance::BENCH_CHROME_H; |
| 2025 | - use crate::BENCH_MIN_H; | ||
| 2026 | 2026 | ||
| 2027 | const BENCH_BORDER_T: f32 = 1.; | 2027 | const BENCH_BORDER_T: f32 = 1.; |
| 2028 | const BENCH_PY_TOP: f32 = 4.; | 2028 | const BENCH_PY_TOP: f32 = 4.; |
| @@ -2092,9 +2092,9 @@ fn a_lane_row_fits_what_its_own_head_draws() { | |||
| 2092 | #[test] | 2092 | #[test] |
| 2093 | fn a_saved_seam_survives_a_reload() { | 2093 | fn a_saved_seam_survives_a_reload() { |
| 2094 | use crate::{ | 2094 | 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, |
| 2096 | }; | 2096 | }; |
| 2097 | - use gpui::{px, size, Pixels, Size}; | 2097 | + use gpui::{Pixels, Size, px, size}; |
| 2098 | 2098 | ||
| 2099 | let dir = engine::scratch::Scratch::dir("edith-stance-splits"); | 2099 | let dir = engine::scratch::Scratch::dir("edith-stance-splits"); |
| 2100 | let path = dir.join("stance-splits"); | 2100 | let path = dir.join("stance-splits"); |
| @@ -2137,7 +2137,7 @@ fn a_saved_seam_survives_a_reload() { | |||
| 2137 | /// drag that never started (`None`) owes nothing. | 2137 | /// drag that never started (`None`) owes nothing. |
| 2138 | #[test] | 2138 | #[test] |
| 2139 | fn only_the_persisted_seams_owe_a_save_when_a_drag_loses_the_window() { | 2139 | 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}; |
| 2141 | 2141 | ||
| 2142 | assert!(split_drag_owes_save(Some(Split::Dock))); | 2142 | assert!(split_drag_owes_save(Some(Split::Dock))); |
| 2143 | assert!(split_drag_owes_save(Some(Split::Bench))); | 2143 | 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() { | |||
| 2151 | /// `load_stance_splits`'s doc comment promises. | 2151 | /// `load_stance_splits`'s doc comment promises. |
| 2152 | #[test] | 2152 | #[test] |
| 2153 | fn a_missing_stance_splits_file_leaves_every_region_at_its_default() { | 2153 | fn a_missing_stance_splits_file_leaves_every_region_at_its_default() { |
| 2154 | - use crate::{load_stance_splits_from, Split}; | 2154 | + use crate::{Split, load_stance_splits_from}; |
| 2155 | - use gpui::{px, size, Pixels, Size}; | 2155 | + use gpui::{Pixels, Size, px, size}; |
| 2156 | 2156 | ||
| 2157 | let dir = engine::scratch::Scratch::dir("edith-stance-splits-missing"); | 2157 | let dir = engine::scratch::Scratch::dir("edith-stance-splits-missing"); |
| 2158 | let window: Size<Pixels> = size(px(1280.), px(720.)); | 2158 | let window: Size<Pixels> = size(px(1280.), px(720.)); |
| @@ -2993,7 +2993,7 @@ fn the_bench_answers_a_wheel_notch_anywhere_over_it() { | |||
| 2993 | /// kept beside the first ([`Splits::clear`]). | 2993 | /// kept beside the first ([`Splits::clear`]). |
| 2994 | #[test] | 2994 | #[test] |
| 2995 | fn a_double_pressed_divider_forgets_the_size_it_was_dragged_to() { | 2995 | 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}; |
| 2997 | use gpui::{px, size}; | 2997 | use gpui::{px, size}; |
| 2998 | 2998 | ||
| 2999 | let window = size(px(1280.), px(720.)); | 2999 | let window = size(px(1280.), px(720.)); |
| @@ -3083,7 +3083,7 @@ fn the_bench_seam_reaches_no_further_than_every_other_seam() { | |||
| 3083 | /// `bench=105` at the floor, `bench=1164` at the ceiling. | 3083 | /// `bench=105` at the floor, `bench=1164` at the ceiling. |
| 3084 | #[test] | 3084 | #[test] |
| 3085 | fn the_bench_seam_stops_at_its_floor_and_its_ceiling() { | 3085 | 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}; |
| 3087 | use gpui::{px, size}; | 3087 | use gpui::{px, size}; |
| 3088 | 3088 | ||
| 3089 | let window = size(px(2560.), px(1440.)); | 3089 | let window = size(px(2560.), px(1440.)); |
| @@ -3197,6 +3197,41 @@ fn a_source_row_shows_its_name_before_anything_else() { | |||
| 3197 | ); | 3197 | ); |
| 3198 | } | 3198 | } |
| 3199 | 3199 | ||
| 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 | + | ||
| 3200 | /// A room key pressed while the ring sits in the dock has to reach the room. | 3235 | /// A room key pressed while the ring sits in the dock has to reach the room. |
| 3201 | /// Two ways it did not: the dock's own handler could stop a key it does not | 3236 | /// Two ways it did not: the dock's own handler could stop a key it does not |
| 3202 | /// answer, and the body the dock mounts could leave the focused | 3237 | /// 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() { | |||
| 3400 | /// deletion. | 3435 | /// deletion. |
| 3401 | #[test] | 3436 | #[test] |
| 3402 | fn select_all_left_the_ruler_for_the_rulers_own_menu() { | 3437 | fn select_all_left_the_ruler_for_the_rulers_own_menu() { |
| 3403 | - use crate::menus::BENCH_ITEMS; | ||
| 3404 | use crate::ActionId; | 3438 | use crate::ActionId; |
| 3439 | + use crate::menus::BENCH_ITEMS; | ||
| 3405 | let bench = src_text("ui/bench_stance.rs"); | 3440 | let bench = src_text("ui/bench_stance.rs"); |
| 3406 | for gone in ["bench-select-all", "select_all_band", "SELECT_ALL_PAD"] { | 3441 | for gone in ["bench-select-all", "select_all_band", "SELECT_ALL_PAD"] { |
| 3407 | assert!(!bench.contains(gone), "the ruler still carries {gone}"); | 3442 | assert!(!bench.contains(gone), "the ruler still carries {gone}"); |
| @@ -3873,7 +3908,7 @@ fn the_export_section_is_four_rows_and_no_fifth() { | |||
| 3873 | /// cannot write, because [`Player::set_format`] would only refuse it back. | 3908 | /// cannot write, because [`Player::set_format`] would only refuse it back. |
| 3874 | #[test] | 3909 | #[test] |
| 3875 | fn the_picture_row_cycles_codec_and_container_together_and_skips_a_refusal() { | 3910 | 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}; |
| 3877 | assert_eq!( | 3912 | assert_eq!( |
| 3878 | PICTURE_CYCLE, | 3913 | PICTURE_CYCLE, |
| 3879 | [ | 3914 | [ |
crates/app/src/ui/dock_stance.rsmodified+244 -134
| @@ -185,7 +185,11 @@ fn dock_tab( | |||
| 185 | } | 185 | } |
| 186 | cx.notify(); | 186 | cx.notify(); |
| 187 | })) | 187 | })) |
| 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 | + )) | ||
| 189 | .children(hitmap::control(id, label_text, true)) | 193 | .children(hitmap::control(id, label_text, true)) |
| 190 | .child( | 194 | .child( |
| 191 | div() | 195 | div() |
| @@ -232,6 +236,25 @@ fn usage_line(player: &Player, source_idx: usize, placed: usize) -> String { | |||
| 232 | lanes.join(" ") | 236 | lanes.join(" ") |
| 233 | } | 237 | } |
| 234 | 238 | ||
| 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 | + | ||
| 235 | /// The file's name without its extension -- what the editor calls the film, | 258 | /// The file's name without its extension -- what the editor calls the film, |
| 236 | /// not what the filesystem calls the bytes (cleanse round 2). A row that | 259 | /// not what the filesystem calls the bytes (cleanse round 2). A row that |
| 237 | /// names several streams of one file keeps the stream half it was given | 260 | /// names several streams of one file keeps the stream half it was given |
| @@ -281,12 +304,7 @@ fn source_row( | |||
| 281 | Backend::Gap, | 304 | Backend::Gap, |
| 282 | ] | 305 | ] |
| 283 | .map(Backend::label); | 306 | .map(Backend::label); |
| 284 | - let detail = row | 307 | + let detail = without_seats(&row.detail, &seats); |
| 285 | - .detail | ||
| 286 | - .split(" · ") | ||
| 287 | - .filter(|part| !seats.contains(part)) | ||
| 288 | - .collect::<Vec<_>>() | ||
| 289 | - .join(" · "); | ||
| 290 | let under: String = match &row.unusable { | 308 | let under: String = match &row.unusable { |
| 291 | Some(why) => why.clone(), | 309 | Some(why) => why.clone(), |
| 292 | None => join_detail( | 310 | None => join_detail( |
| @@ -690,15 +708,15 @@ fn subtitle_tab_rows( | |||
| 690 | .on_drag(SubPick(track), { | 708 | .on_drag(SubPick(track), { |
| 691 | let me = cx.entity(); | 709 | let me = cx.entity(); |
| 692 | move |_, _, _, cx| { | 710 | move |_, _, _, cx| { |
| 693 | - // A fresh gesture inherits nothing: `Player::drag_lane` | 711 | + // A fresh gesture inherits nothing: `Player::drag_lane` |
| 694 | - // and `Player::drag_x` are the *last live sample* of the | 712 | + // and `Player::drag_x` are the *last live sample* of the |
| 695 | - // drag being made, and a drag whose first sample lands | 713 | + // drag being made, and a drag whose first sample lands |
| 696 | - // outside every row would otherwise be let go onto the | 714 | + // outside every row would otherwise be let go onto the |
| 697 | - // lane the previous one ended over. | 715 | + // lane the previous one ended over. |
| 698 | - me.update(cx, |this, _| { | 716 | + me.update(cx, |this, _| { |
| 699 | - this.drag_lane = None; | 717 | + this.drag_lane = None; |
| 700 | - this.drag_x = None; | 718 | + this.drag_x = None; |
| 701 | - }); | 719 | + }); |
| 702 | cx.new(|_| Tip(ghost.clone())) | 720 | cx.new(|_| Tip(ghost.clone())) |
| 703 | } | 721 | } |
| 704 | }) | 722 | }) |
| @@ -707,7 +725,11 @@ fn subtitle_tab_rows( | |||
| 707 | cx.notify(); | 725 | cx.notify(); |
| 708 | })) | 726 | })) |
| 709 | }) | 727 | }) |
| 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 | + )) | ||
| 711 | .children(hitmap::dynamic( | 733 | .children(hitmap::dynamic( |
| 712 | move || { | 734 | move || { |
| 713 | ( | 735 | ( |
| @@ -777,7 +799,11 @@ fn subtitle_tab_rows( | |||
| 777 | cx.stop_propagation(); | 799 | cx.stop_propagation(); |
| 778 | this.remove_subtitle_track(track, cx); | 800 | this.remove_subtitle_track(track, cx); |
| 779 | })) | 801 | })) |
| 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 | + )) | ||
| 781 | .children(hitmap::dynamic( | 807 | .children(hitmap::dynamic( |
| 782 | move || { | 808 | move || { |
| 783 | ( | 809 | ( |
| @@ -794,78 +820,79 @@ fn subtitle_tab_rows( | |||
| 794 | let has_header = !nested || track_count > 3; | 820 | let has_header = !nested || track_count > 3; |
| 795 | let folded = has_header && (nested != player.sub_folded.contains(&group_path)); | 821 | let folded = has_header && (nested != player.sub_folded.contains(&group_path)); |
| 796 | let header = div() | 822 | let header = div() |
| 797 | - .id(("dock-subtitle-group", group_ord)) | 823 | + .id(("dock-subtitle-group", group_ord)) |
| 798 | - .flex_none() | 824 | + .flex_none() |
| 799 | - .flex() | 825 | + .flex() |
| 800 | - .items_center() | 826 | + .items_center() |
| 801 | - .gap(px(6.)) | 827 | + .gap(px(6.)) |
| 802 | - .px(px(8.)) | 828 | + .px(px(8.)) |
| 803 | - // Stepped in under its parent when it has one, the | 829 | + // Stepped in under its parent when it has one, the |
| 804 | - // same outline the track rows below it read as. | 830 | + // same outline the track rows below it read as. |
| 805 | - .when(nested, |d| d.pl(px(22.))) | 831 | + .when(nested, |d| d.pl(px(22.))) |
| 806 | - .py(px(4.)) | 832 | + .py(px(4.)) |
| 807 | - .rounded(px(3.)) | 833 | + .rounded(px(3.)) |
| 808 | - .cursor_pointer() | 834 | + .cursor_pointer() |
| 809 | - .hover(|s| s.bg(rgb(DARK_RAISED()))) | 835 | + .hover(|s| s.bg(rgb(DARK_RAISED()))) |
| 810 | - .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | 836 | + .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 811 | - if !this.sub_folded.remove(&fold_path) { | 837 | + if !this.sub_folded.remove(&fold_path) { |
| 812 | - this.sub_folded.insert(fold_path.clone()); | 838 | + this.sub_folded.insert(fold_path.clone()); |
| 813 | - } | 839 | + } |
| 814 | - cx.notify(); | 840 | + cx.notify(); |
| 815 | - })) | 841 | + })) |
| 816 | - .tooltip(crate::ui::widgets::tip_hover("Fold this source", "click", None)) | 842 | + .tooltip(crate::ui::widgets::tip_hover( |
| 817 | - .children(hitmap::dynamic( | 843 | + "Fold this source", |
| 818 | - move || { | 844 | + "click", |
| 819 | - ( | 845 | + None, |
| 820 | - format!("subtitle-group.{group_ord}.fold"), | 846 | + )) |
| 821 | - "Toggle subtitle group".into(), | 847 | + .children(hitmap::dynamic( |
| 822 | - ) | 848 | + move || { |
| 823 | - }, | 849 | + ( |
| 824 | - true, | 850 | + format!("subtitle-group.{group_ord}.fold"), |
| 825 | - )) | 851 | + "Toggle subtitle group".into(), |
| 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), | ||
| 855 | ) | 852 | ) |
| 856 | - .child( | 853 | + }, |
| 857 | - div() | 854 | + true, |
| 858 | - .flex_none() | 855 | + )) |
| 859 | - .type_style(mono( | 856 | + // Bare, the glyph inherited the panel's dim ink and |
| 860 | - type_scale::CHORD_METADATA_MIN_PX, | 857 | + // vanished ("the little arrow on left side is hard |
| 861 | - FontWeight::MEDIUM, | 858 | + // to see", user 2026-08-27) -- it reads at the same |
| 862 | - )) | 859 | + // ink as the name it folds. |
| 863 | - .text_color(rgb(INK3())) | 860 | + .child( |
| 864 | - .child(format!( | 861 | + div() |
| 865 | - "{track_count} track{}", | 862 | + .flex_none() |
| 866 | - if track_count == 1 { "" } else { "s" } | 863 | + .w(px(10.)) |
| 867 | - )), | 864 | + .text_color(rgb(INK1())) |
| 868 | - ); | 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 | + ); | ||
| 869 | ( | 896 | ( |
| 870 | group_path, | 897 | group_path, |
| 871 | track_count, | 898 | track_count, |
| @@ -1033,7 +1060,11 @@ fn sources_tab( | |||
| 1033 | this.dock_filter_edit = true; | 1060 | this.dock_filter_edit = true; |
| 1034 | cx.notify(); | 1061 | cx.notify(); |
| 1035 | })) | 1062 | })) |
| 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 | + )) | ||
| 1037 | .children(hitmap::control("dock.filter", "Filter sources", true)) | 1068 | .children(hitmap::control("dock.filter", "Filter sources", true)) |
| 1038 | // The glass alone at rest: the word "filter" beside it was | 1069 | // The glass alone at rest: the word "filter" beside it was |
| 1039 | // the box telling the editor what a filter box is (DESIGN §8). | 1070 | // 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 | |||
| 1160 | .text_size(label_style.size) | 1191 | .text_size(label_style.size) |
| 1161 | .text_color(rgb(INK2())) | 1192 | .text_color(rgb(INK2())) |
| 1162 | .cursor_pointer() | 1193 | .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 | + )) | ||
| 1164 | .children(hitmap::control( | 1199 | .children(hitmap::control( |
| 1165 | "transition-duration-field", | 1200 | "transition-duration-field", |
| 1166 | "Transition duration, type-in", | 1201 | "Transition duration, type-in", |
| @@ -1371,7 +1406,12 @@ fn viz_slot_chips(player: &Player, paint: u64, cx: &mut Context<Player>) -> impl | |||
| 1371 | .flex() | 1406 | .flex() |
| 1372 | .items_center() | 1407 | .items_center() |
| 1373 | .child(chip("dock-viz-colour", "Colour", VizSlot::Main, true)) | 1408 | .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 | + )) | ||
| 1375 | } | 1415 | } |
| 1376 | 1416 | ||
| 1377 | /// The picked slot's colour as text, and the way in: a click opens the type-in | 1417 | /// 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 | |||
| 1395 | .text_size(row.size) | 1435 | .text_size(row.size) |
| 1396 | .text_color(rgb(INK2())) | 1436 | .text_color(rgb(INK2())) |
| 1397 | .cursor_pointer() | 1437 | .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 | + )) | ||
| 1399 | .children(hitmap::control( | 1443 | .children(hitmap::control( |
| 1400 | "dock-viz-hex-field", | 1444 | "dock-viz-hex-field", |
| 1401 | "Colour hex, type-in", | 1445 | "Colour hex, type-in", |
| @@ -1424,7 +1468,11 @@ fn viz_color_wheel(player: &Player, paint: u64, cx: &mut Context<Player>) -> imp | |||
| 1424 | .h(px(112.)) | 1468 | .h(px(112.)) |
| 1425 | .relative() | 1469 | .relative() |
| 1426 | .cursor_pointer() | 1470 | .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 | + )) | ||
| 1428 | .children(hitmap::control("dock-viz-hs", "Colour wheel", true)) | 1476 | .children(hitmap::control("dock-viz-hs", "Colour wheel", true)) |
| 1429 | .child(bounds_probe(player.viz_wheel.clone())) | 1477 | .child(bounds_probe(player.viz_wheel.clone())) |
| 1430 | .child( | 1478 | .child( |
| @@ -1448,10 +1496,22 @@ fn viz_color_wheel(player: &Player, paint: u64, cx: &mut Context<Player>) -> imp | |||
| 1448 | let hue = i as f32 / wedges as f32 * 360.; | 1496 | let hue = i as f32 / wedges as f32 * 360.; |
| 1449 | let (r, g, b) = engine::decode::viz_hsv_rgb(hue, sat, 0.84); | 1497 | let (r, g, b) = engine::decode::viz_hsv_rgb(hue, sat, 0.84); |
| 1450 | let color = (u32::from(r) << 16) | (u32::from(g) << 8) | u32::from(b); | 1498 | 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())); | 1499 | + let p00 = point( |
| 1452 | - let p01 = point(px(cx + radius * s0 * a1.sin()), px(cy - radius * s0 * a1.cos())); | 1500 | + px(cx + radius * s0 * a0.sin()), |
| 1453 | - let p11 = point(px(cx + radius * s1 * a1.sin()), px(cy - radius * s1 * a1.cos())); | 1501 | + px(cy - radius * s0 * a0.cos()), |
| 1454 | - let p10 = point(px(cx + radius * s1 * a0.sin()), px(cy - radius * s1 * 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 | + ); | ||
| 1455 | let mut path = PathBuilder::fill(); | 1515 | let mut path = PathBuilder::fill(); |
| 1456 | path.add_polygon(&[p00, p01, p11, p10], false); | 1516 | path.add_polygon(&[p00, p01, p11, p10], false); |
| 1457 | if let Ok(path) = path.build() { | 1517 | if let Ok(path) = path.build() { |
| @@ -1523,9 +1583,20 @@ fn viz_paint_knobs(player: &Player, paint: u64, cx: &mut Context<Player>) -> imp | |||
| 1523 | .text_color(rgb(INK2())) | 1583 | .text_color(rgb(INK2())) |
| 1524 | .child("Strands"), | 1584 | .child("Strands"), |
| 1525 | ) | 1585 | ) |
| 1526 | - .child(viz_step("dock-viz-strands-minus", "Fewer strands", "−", cx, |this, cx| { | 1586 | + .child(viz_step( |
| 1527 | - this.set_viz_strands(engine::decode::viz_strands_of(this.viz_paint()).saturating_sub(1).max(1), cx); | 1587 | + "dock-viz-strands-minus", |
| 1528 | - })) | 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 | + )) | ||
| 1529 | .child( | 1600 | .child( |
| 1530 | div() | 1601 | div() |
| 1531 | .font(style.font.clone()) | 1602 | .font(style.font.clone()) |
| @@ -1533,9 +1604,20 @@ fn viz_paint_knobs(player: &Player, paint: u64, cx: &mut Context<Player>) -> imp | |||
| 1533 | .text_color(rgb(INK1())) | 1604 | .text_color(rgb(INK1())) |
| 1534 | .child(format!("{strands}")), | 1605 | .child(format!("{strands}")), |
| 1535 | ) | 1606 | ) |
| 1536 | - .child(viz_step("dock-viz-strands-plus", "More strands", "+", cx, |this, cx| { | 1607 | + .child(viz_step( |
| 1537 | - this.set_viz_strands(engine::decode::viz_strands_of(this.viz_paint()).saturating_add(1).min(32), cx); | 1608 | + "dock-viz-strands-plus", |
| 1538 | - })), | 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 | + )), | ||
| 1539 | ) | 1621 | ) |
| 1540 | .child( | 1622 | .child( |
| 1541 | div() | 1623 | div() |
| @@ -1550,9 +1632,18 @@ fn viz_paint_knobs(player: &Player, paint: u64, cx: &mut Context<Player>) -> imp | |||
| 1550 | .text_color(rgb(INK2())) | 1632 | .text_color(rgb(INK2())) |
| 1551 | .child("Glow"), | 1633 | .child("Glow"), |
| 1552 | ) | 1634 | ) |
| 1553 | - .child(viz_step("dock-viz-glow-minus", "Less glow", "−", cx, |this, cx| { | 1635 | + .child(viz_step( |
| 1554 | - this.set_viz_glow(engine::decode::viz_glow_of(this.viz_paint()).saturating_sub(1), cx); | 1636 | + "dock-viz-glow-minus", |
| 1555 | - })) | 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 | + )) | ||
| 1556 | .child( | 1647 | .child( |
| 1557 | div() | 1648 | div() |
| 1558 | .font(style.font.clone()) | 1649 | .font(style.font.clone()) |
| @@ -1560,9 +1651,20 @@ fn viz_paint_knobs(player: &Player, paint: u64, cx: &mut Context<Player>) -> imp | |||
| 1560 | .text_color(rgb(INK1())) | 1651 | .text_color(rgb(INK1())) |
| 1561 | .child(format!("{glow}")), | 1652 | .child(format!("{glow}")), |
| 1562 | ) | 1653 | ) |
| 1563 | - .child(viz_step("dock-viz-glow-plus", "More glow", "+", cx, |this, cx| { | 1654 | + .child(viz_step( |
| 1564 | - this.set_viz_glow(engine::decode::viz_glow_of(this.viz_paint()).saturating_add(1).min(16), cx); | 1655 | + "dock-viz-glow-plus", |
| 1565 | - })), | 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 | + )), | ||
| 1566 | ) | 1668 | ) |
| 1567 | } | 1669 | } |
| 1568 | 1670 | ||
| @@ -1806,36 +1908,44 @@ fn keys_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | |||
| 1806 | .font(style.font.clone()) | 1908 | .font(style.font.clone()) |
| 1807 | .text_size(style.size) | 1909 | .text_size(style.size) |
| 1808 | .text_color(rgb(INK1())) | 1910 | .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 | + )) | ||
| 1810 | .children(hitmap::control("dock.keys-filter", "Filter keys", true)) | 1916 | .children(hitmap::control("dock.keys-filter", "Filter keys", true)) |
| 1811 | .child(match player.keys_filter.is_empty() { | 1917 | .child(match player.keys_filter.is_empty() { |
| 1812 | true => "⌕".to_string(), | 1918 | true => "⌕".to_string(), |
| 1813 | false => format!("⌕ {filter_text}"), | 1919 | false => format!("⌕ {filter_text}"), |
| 1814 | }) | 1920 | }) |
| 1815 | }) | 1921 | }) |
| 1816 | - .children(keys_rows_matching(&player.keys_filter, &player.keymap).into_iter().map(|row| match row { | 1922 | + .children( |
| 1817 | - KeyRow::Head(category) => div() | 1923 | + keys_rows_matching(&player.keys_filter, &player.keymap) |
| 1818 | - .flex_none() | 1924 | + .into_iter() |
| 1819 | - .pt(px(4.)) | 1925 | + .map(|row| match row { |
| 1820 | - .child(section_head(category.label().to_uppercase())) | 1926 | + KeyRow::Head(category) => div() |
| 1821 | - .into_any_element(), | 1927 | + .flex_none() |
| 1822 | - // The full-truth surface: every chord the action answers to | 1928 | + .pt(px(4.)) |
| 1823 | - // (`display`), not the badge's primary-only compact form. | 1929 | + .child(section_head(category.label().to_uppercase())) |
| 1824 | - KeyRow::Act(action) => pair( | 1930 | + .into_any_element(), |
| 1825 | - action.label().to_string(), | 1931 | + // The full-truth surface: every chord the action answers to |
| 1826 | - player.keymap.display(action), | 1932 | + // (`display`), not the badge's primary-only compact form. |
| 1827 | - match player.enable(action, None) { | 1933 | + KeyRow::Act(action) => pair( |
| 1828 | - Enable::Yes => INK2(), | 1934 | + action.label().to_string(), |
| 1829 | - _ => INK4(), | 1935 | + player.keymap.display(action), |
| 1830 | - }, | 1936 | + match player.enable(action, None) { |
| 1831 | - ), | 1937 | + Enable::Yes => INK2(), |
| 1832 | - // A fixed stroke is the window's, not an action the room can | 1938 | + _ => INK4(), |
| 1833 | - // refuse, so it never greys. | 1939 | + }, |
| 1834 | - KeyRow::Fixed(i) => { | 1940 | + ), |
| 1835 | - let f = &keymap::FIXED[i]; | 1941 | + // A fixed stroke is the window's, not an action the room can |
| 1836 | - pair(f.label.to_string(), f.chord.to_string(), INK2()) | 1942 | + // refuse, so it never greys. |
| 1837 | - } | 1943 | + KeyRow::Fixed(i) => { |
| 1838 | - })) | 1944 | + let f = &keymap::FIXED[i]; |
| 1945 | + pair(f.label.to_string(), f.chord.to_string(), INK2()) | ||
| 1946 | + } | ||
| 1947 | + }), | ||
| 1948 | + ) | ||
| 1839 | } | 1949 | } |
| 1840 | 1950 | ||
| 1841 | /// The dock's content, under `stance.rs::dock()`'s tab-bar-and-body frame: | 1951 | /// The dock's content, under `stance.rs::dock()`'s tab-bar-and-body frame: |