Dock clip verbs hide (not grey) for the wrong media kind
Browse files at this commit726f956aa0e45749b25b05c0a87810a77fccb900Parent: a1f9f08- fix
- dock clip verbs hide (not grey) for the wrong media kind
4 changed files +166 -104
- DESIGN.md +4 -2
- crates/app/src/oracle.rs +7 -4
- crates/app/src/tests/editing.rs +95 -44
- crates/app/src/ui/dock_stance.rs +60 -54
DESIGN.mdmodified+4 -2
| @@ -173,8 +173,10 @@ one at a time; severity is a **3px left spine**, not a color flood: | |||
| 173 | 173 | ||
| 174 | Every failure names its remedy, and the wound stays visible where it lives (dark clips in the | 174 | Every failure names its remedy, and the wound stays visible where it lives (dark clips in the |
| 175 | lane). **A refusal string is a claim:** shipping "cannot be decoded" requires a test proving the | 175 | lane). **A refusal string is a claim:** shipping "cannot be decoded" requires a test proving the |
| 176 | -capability is genuinely absent — otherwise it is a bug, not a message. A verb the state refuses | 176 | +capability is genuinely absent — otherwise it is a bug, not a message. A verb the current *state* |
| 177 | -(in menus) greys out with its reason on hover; it never disappears. | 177 | +refuses (in menus) greys out with its reason on hover; it never disappears. A verb the selected |
| 178 | +clip's *media kind* can never use (a grade on sound, an equalizer on a picture) is hidden outright | ||
| 179 | +instead — a class refusal, not a moment's answer the next click could change (user 2026-08-27). | ||
| 178 | 180 | ||
| 179 | **No instructional copy (rejected pattern, user 2026-08-27).** The room never explains itself in | 181 | **No instructional copy (rejected pattern, user 2026-08-27).** The room never explains itself in |
| 180 | prose: no "pick a verb above", no "type to filter — name, codec, unused…", no "Import, or drop a | 182 | prose: no "pick a verb above", no "type to filter — name, codec, unused…", no "Import, or drop a |
crates/app/src/oracle.rsmodified+7 -4
| @@ -225,9 +225,13 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable { | |||
| 225 | // The scan reads samples, and a still has none -- ever, unlike a video | 225 | // The scan reads samples, and a still has none -- ever, unlike a video |
| 226 | // clip whose sound may be one lane down or simply silent. Exactly what | 226 | // clip whose sound may be one lane down or simply silent. Exactly what |
| 227 | // `unscannable` says after the fact, said before the row is drawn so | 227 | // `unscannable` says after the fact, said before the row is drawn so |
| 228 | - // there is no row left to click. | 228 | + // there is no row left to click. The mixer's track volumes are the |
| 229 | - ActionId::Silence if ctx.image => Enable::Hidden("this clip is a still"), | 229 | + // same class refusal over the same clip: nothing to mix for a picture |
| 230 | - ActionId::Silence if ctx.no_sound => Enable::Hidden("this clip has no sound"), | 230 | + // with no sound at all. |
| 231 | + ActionId::Silence | ActionId::Mix if ctx.image => Enable::Hidden("this clip is a still"), | ||
| 232 | + ActionId::Silence | ActionId::Mix if ctx.no_sound => { | ||
| 233 | + Enable::Hidden("this clip has no sound") | ||
| 234 | + } | ||
| 231 | // -- state: true of this clip now, and the next playhead click or the | 235 | // -- state: true of this clip now, and the next playhead click or the |
| 232 | // next selection changes the answer. Splits this clip only from inside | 236 | // next selection changes the answer. Splits this clip only from inside |
| 233 | // it: at either edge there is nothing to split off -- and, on a speeded | 237 | // it: at either edge there is nothing to split off -- and, on a speeded |
| @@ -464,4 +468,3 @@ pub(crate) fn menu_at(at: Point<Pixels>, viewport: Size<Pixels>, height: f32) -> | |||
| 464 | fit(f32::from(at.y), height, f32::from(viewport.height)), | 468 | fit(f32::from(at.y), height, f32::from(viewport.height)), |
| 465 | ) | 469 | ) |
| 466 | } | 470 | } |
| 467 | - | ||
crates/app/src/tests/editing.rsmodified+95 -44
| @@ -771,6 +771,30 @@ fn the_clip_menu_dims_what_the_playhead_is_not_on_and_stays_in_the_window() { | |||
| 771 | assert!(still.contains(&ActionId::Color)); | 771 | assert!(still.contains(&ActionId::Color)); |
| 772 | assert!(still.contains(&ActionId::Fit)); | 772 | assert!(still.contains(&ActionId::Fit)); |
| 773 | assert!(still.contains(&ActionId::Speed)); | 773 | assert!(still.contains(&ActionId::Speed)); |
| 774 | + // Mix is not in the clip menu, but it wears the same class refusal the | ||
| 775 | + // dock's verb row hides it by (`ui::dock_stance::ghost_verb`): nothing to | ||
| 776 | + // mix for a picture with no sound at all, live everywhere else. | ||
| 777 | + let mix_ctx = |lane, image| Ctx { | ||
| 778 | + clip: Some((clip, lane)), | ||
| 779 | + image, | ||
| 780 | + playhead: 60, | ||
| 781 | + timeline: true, | ||
| 782 | + ..Ctx::default() | ||
| 783 | + }; | ||
| 784 | + assert!(!enable(ActionId::Mix, mix_ctx(v1, true)).listed()); | ||
| 785 | + assert!(enable(ActionId::Mix, mix_ctx(v1, false)).listed()); | ||
| 786 | + assert!(enable(ActionId::Mix, mix_ctx(a1, false)).listed()); | ||
| 787 | + // A silent video (no still, but its source's stream table is empty) | ||
| 788 | + // refuses Mix and Silence the same way, by `no_sound` rather than `image`. | ||
| 789 | + let mute_video = Ctx { | ||
| 790 | + clip: Some((clip, v1)), | ||
| 791 | + no_sound: true, | ||
| 792 | + playhead: 60, | ||
| 793 | + timeline: true, | ||
| 794 | + ..Ctx::default() | ||
| 795 | + }; | ||
| 796 | + assert!(!enable(ActionId::Mix, mute_video).listed()); | ||
| 797 | + assert!(!enable(ActionId::Silence, mute_video).listed()); | ||
| 774 | // ...and the state refusals are on all three, dimmed rather than gone: | 798 | // ...and the state refusals are on all three, dimmed rather than gone: |
| 775 | // at 30 the playhead is on this clip's head, where a cut has nothing to | 799 | // at 30 the playhead is on this clip's head, where a cut has nothing to |
| 776 | // split off -- a row the next click of the playhead lights. | 800 | // split off -- a row the next click of the playhead lights. |
| @@ -1730,12 +1754,12 @@ fn a_copied_clip_is_renumbered_or_dropped_when_a_row_leaves_the_library() { | |||
| 1730 | assert!(clipboard_after_remove(Vec::new(), 0).is_empty()); | 1754 | assert!(clipboard_after_remove(Vec::new(), 0).is_empty()); |
| 1731 | // A set with one member's file gone loses only that member -- the rest | 1755 | // A set with one member's file gone loses only that member -- the rest |
| 1732 | // of the set survives to be pasted, gaps and lanes intact. | 1756 | // of the set survives to be pasted, gaps and lanes intact. |
| 1733 | - let trimmed = clipboard_after_remove( | 1757 | + let trimmed = clipboard_after_remove(vec![(Lane::V1, clip(1)), (Lane::A1, clip(2))], 1); |
| 1734 | - vec![(Lane::V1, clip(1)), (Lane::A1, clip(2))], | ||
| 1735 | - 1, | ||
| 1736 | - ); | ||
| 1737 | assert_eq!( | 1758 | assert_eq!( |
| 1738 | - trimmed.into_iter().map(|(_, c)| c.source).collect::<Vec<_>>(), | 1759 | + trimmed |
| 1760 | + .into_iter() | ||
| 1761 | + .map(|(_, c)| c.source) | ||
| 1762 | + .collect::<Vec<_>>(), | ||
| 1739 | vec![1] | 1763 | vec![1] |
| 1740 | ); | 1764 | ); |
| 1741 | } | 1765 | } |
| @@ -2042,18 +2066,22 @@ fn a_selection_drag_moves_every_pick_by_the_same_delta() { | |||
| 2042 | 2066 | ||
| 2043 | // clip0 on V1 at the fixture's own start; clip1 on V1 ten seconds in, | 2067 | // clip0 on V1 at the fixture's own start; clip1 on V1 ten seconds in, |
| 2044 | // appended to the open bed and rippling nothing. | 2068 | // appended to the open bed and rippling nothing. |
| 2045 | - assert!(session | 2069 | + assert!( |
| 2046 | - .place_stream_at(10.0, &second, 0, None) | 2070 | + session |
| 2047 | - .expect("av2 is on this timeline")); | 2071 | + .place_stream_at(10.0, &second, 0, None) |
| 2072 | + .expect("av2 is on this timeline") | ||
| 2073 | + ); | ||
| 2048 | let clip0 = session.lane_clips(Lane::V1)[0]; | 2074 | let clip0 = session.lane_clips(Lane::V1)[0]; |
| 2049 | let clip1 = session.lane_clips(Lane::V1)[1]; | 2075 | let clip1 = session.lane_clips(Lane::V1)[1]; |
| 2050 | assert_eq!((clip0.start, clip1.start), (0, 300)); | 2076 | assert_eq!((clip0.start, clip1.start), (0, 300)); |
| 2051 | 2077 | ||
| 2052 | // clipC on a second video row, well past both of the above. | 2078 | // clipC on a second video row, well past both of the above. |
| 2053 | let v2 = session.add_lane(LaneKind::Video); | 2079 | let v2 = session.add_lane(LaneKind::Video); |
| 2054 | - assert!(session | 2080 | + assert!( |
| 2055 | - .place_stream_at(20.0, &path, 0, Some(v2)) | 2081 | + session |
| 2056 | - .expect("test_av.mp4 is on this timeline")); | 2082 | + .place_stream_at(20.0, &path, 0, Some(v2)) |
| 2083 | + .expect("test_av.mp4 is on this timeline") | ||
| 2084 | + ); | ||
| 2057 | let clip_c = session.lane_clips(v2)[0]; | 2085 | let clip_c = session.lane_clips(v2)[0]; |
| 2058 | assert_eq!(clip_c.start, 600); | 2086 | assert_eq!(clip_c.start, 600); |
| 2059 | 2087 | ||
| @@ -2071,11 +2099,17 @@ fn a_selection_drag_moves_every_pick_by_the_same_delta() { | |||
| 2071 | // rather than clearing it. | 2099 | // rather than clearing it. |
| 2072 | assert_eq!( | 2100 | assert_eq!( |
| 2073 | session.lane_clips(Lane::V1)[0], | 2101 | session.lane_clips(Lane::V1)[0], |
| 2074 | - Clip { start: clip0.start + 50, ..clip0 } | 2102 | + Clip { |
| 2103 | + start: clip0.start + 50, | ||
| 2104 | + ..clip0 | ||
| 2105 | + } | ||
| 2075 | ); | 2106 | ); |
| 2076 | assert_eq!( | 2107 | assert_eq!( |
| 2077 | session.lane_clips(v2)[0], | 2108 | session.lane_clips(v2)[0], |
| 2078 | - Clip { start: clip_c.start + 50, ..clip_c } | 2109 | + Clip { |
| 2110 | + start: clip_c.start + 50, | ||
| 2111 | + ..clip_c | ||
| 2112 | + } | ||
| 2079 | ); | 2113 | ); |
| 2080 | 2114 | ||
| 2081 | assert!(session.undo(), "one step for the whole set-move"); | 2115 | assert!(session.undo(), "one step for the whole set-move"); |
| @@ -2100,35 +2134,35 @@ fn a_selection_drag_refuses_as_one_set_when_any_pick_cannot_land() { | |||
| 2100 | session.import(&asset("test_av2.mp4")).expect("av2 matches"); | 2134 | session.import(&asset("test_av2.mp4")).expect("av2 matches"); |
| 2101 | let second = session.sources()[1].path.clone(); | 2135 | let second = session.sources()[1].path.clone(); |
| 2102 | 2136 | ||
| 2103 | - assert!(session | 2137 | + assert!( |
| 2104 | - .place_stream_at(10.0, &second, 0, None) | 2138 | + session |
| 2105 | - .expect("av2 is on this timeline")); | 2139 | + .place_stream_at(10.0, &second, 0, None) |
| 2140 | + .expect("av2 is on this timeline") | ||
| 2141 | + ); | ||
| 2106 | let clip0 = session.lane_clips(Lane::V1)[0]; | 2142 | let clip0 = session.lane_clips(Lane::V1)[0]; |
| 2107 | let clip1 = session.lane_clips(Lane::V1)[1]; | 2143 | let clip1 = session.lane_clips(Lane::V1)[1]; |
| 2108 | 2144 | ||
| 2109 | let v2 = session.add_lane(LaneKind::Video); | 2145 | let v2 = session.add_lane(LaneKind::Video); |
| 2110 | - assert!(session | 2146 | + assert!( |
| 2111 | - .place_stream_at(0.0, &path, 0, Some(v2)) | 2147 | + session |
| 2112 | - .expect("test_av.mp4 is on this timeline")); | 2148 | + .place_stream_at(0.0, &path, 0, Some(v2)) |
| 2149 | + .expect("test_av.mp4 is on this timeline") | ||
| 2150 | + ); | ||
| 2113 | let clip_c = session.lane_clips(v2)[0]; | 2151 | let clip_c = session.lane_clips(v2)[0]; |
| 2114 | // A clip clip1 is not picked, blocking the road on V2 the drag is about | 2152 | // A clip clip1 is not picked, blocking the road on V2 the drag is about |
| 2115 | // to try: clip1 dragged onto V2 lands its head inside this one. | 2153 | // to try: clip1 dragged onto V2 lands its head inside this one. |
| 2116 | - assert!(session | 2154 | + assert!( |
| 2117 | - .place_stream_at(10.0, &second, 0, Some(v2)) | 2155 | + session |
| 2118 | - .expect("av2 is on this timeline")); | 2156 | + .place_stream_at(10.0, &second, 0, Some(v2)) |
| 2157 | + .expect("av2 is on this timeline") | ||
| 2158 | + ); | ||
| 2119 | let blocker = session.lane_clips(v2)[1]; | 2159 | let blocker = session.lane_clips(v2)[1]; |
| 2120 | assert_eq!(blocker.start, 300); | 2160 | assert_eq!(blocker.start, 300); |
| 2121 | 2161 | ||
| 2122 | let picks = [(Lane::V1, 0), (Lane::V1, 1), (v2, 0)]; | 2162 | let picks = [(Lane::V1, 0), (Lane::V1, 1), (v2, 0)]; |
| 2123 | // Dragged onto V2 at a frame inside the blocker: refused outright, the | 2163 | // Dragged onto V2 at a frame inside the blocker: refused outright, the |
| 2124 | // way a lone drag onto another clip already is. | 2164 | // way a lone drag onto another clip already is. |
| 2125 | - assert!(!session.move_selection_to( | 2165 | + assert!(!session.move_selection_to(&picks, Lane::V1, 1, v2, blocker.start + 10)); |
| 2126 | - &picks, | ||
| 2127 | - Lane::V1, | ||
| 2128 | - 1, | ||
| 2129 | - v2, | ||
| 2130 | - blocker.start + 10 | ||
| 2131 | - )); | ||
| 2132 | // Nothing moved -- not clip1 clamped short of the blocker, and not the | 2166 | // Nothing moved -- not clip1 clamped short of the blocker, and not the |
| 2133 | // two picks that had all the room to spare. | 2167 | // two picks that had all the room to spare. |
| 2134 | assert_eq!(session.lane_clips(Lane::V1)[0], clip0); | 2168 | assert_eq!(session.lane_clips(Lane::V1)[0], clip0); |
| @@ -2176,23 +2210,30 @@ fn a_three_pick_copy_paste_preserves_gaps_and_lane_assignment() { | |||
| 2176 | session.import(&asset("test_av2.mp4")).expect("av2 matches"); | 2210 | session.import(&asset("test_av2.mp4")).expect("av2 matches"); |
| 2177 | let second = session.sources()[1].path.clone(); | 2211 | let second = session.sources()[1].path.clone(); |
| 2178 | 2212 | ||
| 2179 | - assert!(session | 2213 | + assert!( |
| 2180 | - .place_stream_at(10.0, &second, 0, None) | 2214 | + session |
| 2181 | - .expect("av2 is on this timeline")); | 2215 | + .place_stream_at(10.0, &second, 0, None) |
| 2216 | + .expect("av2 is on this timeline") | ||
| 2217 | + ); | ||
| 2182 | let clip0 = session.lane_clips(Lane::V1)[0]; | 2218 | let clip0 = session.lane_clips(Lane::V1)[0]; |
| 2183 | let clip1 = session.lane_clips(Lane::V1)[1]; | 2219 | let clip1 = session.lane_clips(Lane::V1)[1]; |
| 2184 | 2220 | ||
| 2185 | let v2 = session.add_lane(LaneKind::Video); | 2221 | let v2 = session.add_lane(LaneKind::Video); |
| 2186 | - assert!(session | 2222 | + assert!( |
| 2187 | - .place_stream_at(20.0, &path, 0, Some(v2)) | 2223 | + session |
| 2188 | - .expect("test_av.mp4 is on this timeline")); | 2224 | + .place_stream_at(20.0, &path, 0, Some(v2)) |
| 2225 | + .expect("test_av.mp4 is on this timeline") | ||
| 2226 | + ); | ||
| 2189 | let clip_c = session.lane_clips(v2)[0]; | 2227 | let clip_c = session.lane_clips(v2)[0]; |
| 2190 | 2228 | ||
| 2191 | // Copied in click order, out of the lanes each was clicked in -- exactly | 2229 | // Copied in click order, out of the lanes each was clicked in -- exactly |
| 2192 | // what `Player::copy_selected` builds. | 2230 | // what `Player::copy_selected` builds. |
| 2193 | let items = [(Lane::V1, clip0), (Lane::V1, clip1), (v2, clip_c)]; | 2231 | let items = [(Lane::V1, clip0), (Lane::V1, clip1), (v2, clip_c)]; |
| 2194 | let at = session.timeline_duration(); | 2232 | let at = session.timeline_duration(); |
| 2195 | - assert!(session.paste_set_at(at, &items), "a free spot takes the set"); | 2233 | + assert!( |
| 2234 | + session.paste_set_at(at, &items), | ||
| 2235 | + "a free spot takes the set" | ||
| 2236 | + ); | ||
| 2196 | 2237 | ||
| 2197 | let new0 = session.lane_clips(Lane::V1)[2]; | 2238 | let new0 = session.lane_clips(Lane::V1)[2]; |
| 2198 | let new1 = session.lane_clips(Lane::V1)[3]; | 2239 | let new1 = session.lane_clips(Lane::V1)[3]; |
| @@ -2230,16 +2271,20 @@ fn a_colliding_set_paste_refuses_whole() { | |||
| 2230 | session.import(&asset("test_av2.mp4")).expect("av2 matches"); | 2271 | session.import(&asset("test_av2.mp4")).expect("av2 matches"); |
| 2231 | let second = session.sources()[1].path.clone(); | 2272 | let second = session.sources()[1].path.clone(); |
| 2232 | 2273 | ||
| 2233 | - assert!(session | 2274 | + assert!( |
| 2234 | - .place_stream_at(10.0, &second, 0, None) | 2275 | + session |
| 2235 | - .expect("av2 is on this timeline")); | 2276 | + .place_stream_at(10.0, &second, 0, None) |
| 2277 | + .expect("av2 is on this timeline") | ||
| 2278 | + ); | ||
| 2236 | let clip0 = session.lane_clips(Lane::V1)[0]; | 2279 | let clip0 = session.lane_clips(Lane::V1)[0]; |
| 2237 | let clip1 = session.lane_clips(Lane::V1)[1]; | 2280 | let clip1 = session.lane_clips(Lane::V1)[1]; |
| 2238 | 2281 | ||
| 2239 | let v2 = session.add_lane(LaneKind::Video); | 2282 | let v2 = session.add_lane(LaneKind::Video); |
| 2240 | - assert!(session | 2283 | + assert!( |
| 2241 | - .place_stream_at(20.0, &path, 0, Some(v2)) | 2284 | + session |
| 2242 | - .expect("test_av.mp4 is on this timeline")); | 2285 | + .place_stream_at(20.0, &path, 0, Some(v2)) |
| 2286 | + .expect("test_av.mp4 is on this timeline") | ||
| 2287 | + ); | ||
| 2243 | let clip_c = session.lane_clips(v2)[0]; | 2288 | let clip_c = session.lane_clips(v2)[0]; |
| 2244 | 2289 | ||
| 2245 | let items = [(Lane::V1, clip0), (Lane::V1, clip1), (v2, clip_c)]; | 2290 | let items = [(Lane::V1, clip0), (Lane::V1, clip1), (v2, clip_c)]; |
| @@ -2570,8 +2615,14 @@ fn escape_closes_a_card_before_it_can_ever_reach_deselect() { | |||
| 2570 | "if this.param_card_key(key, event.keystroke.modifiers.shift, cx) {", | 2615 | "if this.param_card_key(key, event.keystroke.modifiers.shift, cx) {", |
| 2571 | "a param card", | 2616 | "a param card", |
| 2572 | ), | 2617 | ), |
| 2573 | - ("if this.card_open()", "a card (keys overlay/export/eq/color/...)"), | 2618 | + ( |
| 2574 | - ("|| this.context_menu.is_some()", "the clip/row menu or a list"), | 2619 | + "if this.card_open()", |
| 2620 | + "a card (keys overlay/export/eq/color/...)", | ||
| 2621 | + ), | ||
| 2622 | + ( | ||
| 2623 | + "|| this.context_menu.is_some()", | ||
| 2624 | + "the clip/row menu or a list", | ||
| 2625 | + ), | ||
| 2575 | ( | 2626 | ( |
| 2576 | "if key == ESCAPE && !ctrl && this.preview_session.is_some() {", | 2627 | "if key == ESCAPE && !ctrl && this.preview_session.is_some() {", |
| 2577 | "an open preview", | 2628 | "an open preview", |
crates/app/src/ui/dock_stance.rsmodified+60 -54
| @@ -109,8 +109,10 @@ impl DockSort { | |||
| 109 | /// A ghost verb (DESIGN §4): borderless glyph/label in `ink2`, its chord in | 109 | /// A ghost verb (DESIGN §4): borderless glyph/label in `ink2`, its chord in |
| 110 | /// `ink3` beside it, read live off the keymap so it can never drift from the | 110 | /// `ink3` beside it, read live off the keymap so it can never drift from the |
| 111 | /// key that does the same thing. Hover is one fill step and an ink brighten; | 111 | /// key that does the same thing. Hover is one fill step and an ink brighten; |
| 112 | -/// held open (`active`) keeps both. A refused verb dims and says why on | 112 | +/// held open (`active`) keeps both. A verb the current *state* refuses dims |
| 113 | -/// hover instead of disappearing (§8). | 113 | +/// and says why on hover; a verb the clip's *media kind* can never use |
| 114 | +/// ([`Enable::Hidden`]) is left out of the row entirely instead (§8) -- the | ||
| 115 | +/// same `listed()`/`Hidden` split the clip menu already reads. | ||
| 114 | fn ghost_verb( | 116 | fn ghost_verb( |
| 115 | id: &'static str, | 117 | id: &'static str, |
| 116 | verb_label: &'static str, | 118 | verb_label: &'static str, |
| @@ -119,8 +121,11 @@ fn ghost_verb( | |||
| 119 | hint: &str, | 121 | hint: &str, |
| 120 | player: &Player, | 122 | player: &Player, |
| 121 | on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, | 123 | on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, |
| 122 | -) -> impl IntoElement { | 124 | +) -> Option<impl IntoElement> { |
| 123 | let enabled = player.enable(action, None); | 125 | let enabled = player.enable(action, None); |
| 126 | + if !enabled.listed() { | ||
| 127 | + return None; | ||
| 128 | + } | ||
| 124 | let key = player.keymap.chord(action); | 129 | let key = player.keymap.chord(action); |
| 125 | let say: SharedString = match enabled.why() { | 130 | let say: SharedString = match enabled.why() { |
| 126 | Some(why) => format!("{key} — {why}"), | 131 | Some(why) => format!("{key} — {why}"), |
| @@ -130,39 +135,41 @@ fn ghost_verb( | |||
| 130 | let on = enabled.yes(); | 135 | let on = enabled.yes(); |
| 131 | let label_style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM); | 136 | let label_style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM); |
| 132 | let chord_style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM); | 137 | let chord_style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM); |
| 133 | - div() | 138 | + Some( |
| 134 | - .id(id) | 139 | + div() |
| 135 | - .flex_none() | 140 | + .id(id) |
| 136 | - .flex() | 141 | + .flex_none() |
| 137 | - .items_center() | 142 | + .flex() |
| 138 | - .justify_between() | 143 | + .items_center() |
| 139 | - .h(px(CONTROL_H)) | 144 | + .justify_between() |
| 140 | - .px(px(8.)) | 145 | + .h(px(CONTROL_H)) |
| 141 | - .rounded(px(3.)) | 146 | + .px(px(8.)) |
| 142 | - .when(active, |d| d.bg(rgb(DARK_RAISED()))) | 147 | + .rounded(px(3.)) |
| 143 | - .tooltip(move |_, cx| cx.new(|_| Tip(say.clone())).into()) | 148 | + .when(active, |d| d.bg(rgb(DARK_RAISED()))) |
| 144 | - .when(!on, |d| d.opacity(0.4).cursor_not_allowed()) | 149 | + .tooltip(move |_, cx| cx.new(|_| Tip(say.clone())).into()) |
| 145 | - .when(on, |d| { | 150 | + .when(!on, |d| d.opacity(0.4).cursor_not_allowed()) |
| 146 | - d.cursor_pointer() | 151 | + .when(on, |d| { |
| 147 | - .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1()))) | 152 | + d.cursor_pointer() |
| 148 | - .on_click(on_click) | 153 | + .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1()))) |
| 149 | - }) | 154 | + .on_click(on_click) |
| 150 | - .children(hitmap::action(action, on)) | 155 | + }) |
| 151 | - .child( | 156 | + .children(hitmap::action(action, on)) |
| 152 | - div() | 157 | + .child( |
| 153 | - .font(label_style.font) | 158 | + div() |
| 154 | - .text_size(label_style.size) | 159 | + .font(label_style.font) |
| 155 | - .text_color(rgb(if active { INK1() } else { INK2() })) | 160 | + .text_size(label_style.size) |
| 156 | - .child(verb_label), | 161 | + .text_color(rgb(if active { INK1() } else { INK2() })) |
| 157 | - ) | 162 | + .child(verb_label), |
| 158 | - .child( | 163 | + ) |
| 159 | - div() | 164 | + .child( |
| 160 | - .flex_none() | 165 | + div() |
| 161 | - .font(chord_style.font) | 166 | + .flex_none() |
| 162 | - .text_size(chord_style.size) | 167 | + .font(chord_style.font) |
| 163 | - .text_color(rgb(if active { INK1() } else { INK3() })) | 168 | + .text_size(chord_style.size) |
| 164 | - .child(key), | 169 | + .text_color(rgb(if active { INK1() } else { INK3() })) |
| 165 | - ) | 170 | + .child(key), |
| 171 | + ), | ||
| 172 | + ) | ||
| 166 | } | 173 | } |
| 167 | 174 | ||
| 168 | /// One tab of the Src/Clip pair (MOCK-SPEC "Dock": no pill, no fill, no | 175 | /// One tab of the Src/Clip pair (MOCK-SPEC "Dock": no pill, no fill, no |
| @@ -827,11 +834,7 @@ fn subtitle_palette(player: &Player, cx: &mut Context<Player>) -> Option<AnyElem | |||
| 827 | /// filter, sort chips, rows, IMPORT, hint -- none of it the legacy | 834 | /// filter, sort chips, rows, IMPORT, hint -- none of it the legacy |
| 828 | /// Media/Audio/Text panel `library.rs` draws. That panel's row facts | 835 | /// Media/Audio/Text panel `library.rs` draws. That panel's row facts |
| 829 | /// ([`library_rows`]) are still what every row here is built from. | 836 | /// ([`library_rows`]) are still what every row here is built from. |
| 830 | -fn sources_tab( | 837 | +fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context<Player>) -> impl IntoElement { |
| 831 | - player: &Player, | ||
| 832 | - window: &mut Window, | ||
| 833 | - cx: &mut Context<Player>, | ||
| 834 | -) -> impl IntoElement { | ||
| 835 | let focused = player.focus_dock.is_focused(window); | 838 | let focused = player.focus_dock.is_focused(window); |
| 836 | let sources = player | 839 | let sources = player |
| 837 | .session | 840 | .session |
| @@ -1033,7 +1036,7 @@ fn sources_tab( | |||
| 1033 | .flex_none() | 1036 | .flex_none() |
| 1034 | .flex() | 1037 | .flex() |
| 1035 | .flex_col() | 1038 | .flex_col() |
| 1036 | - .child(ghost_verb( | 1039 | + .children(ghost_verb( |
| 1037 | "dock-import-files", | 1040 | "dock-import-files", |
| 1038 | "Add files", | 1041 | "Add files", |
| 1039 | ActionId::AddFiles, | 1042 | ActionId::AddFiles, |
| @@ -1042,7 +1045,7 @@ fn sources_tab( | |||
| 1042 | player, | 1045 | player, |
| 1043 | cx.listener(|this, _: &ClickEvent, _, cx| this.pick_and_import(cx)), | 1046 | cx.listener(|this, _: &ClickEvent, _, cx| this.pick_and_import(cx)), |
| 1044 | )) | 1047 | )) |
| 1045 | - .child(ghost_verb( | 1048 | + .children(ghost_verb( |
| 1046 | "dock-paste-path", | 1049 | "dock-paste-path", |
| 1047 | "Paste path", | 1050 | "Paste path", |
| 1048 | ActionId::PasteFilePath, | 1051 | ActionId::PasteFilePath, |
| @@ -1057,7 +1060,7 @@ fn sources_tab( | |||
| 1057 | // that no longer had the height for it (user 2026-08-21: | 1060 | // that no longer had the height for it (user 2026-08-21: |
| 1058 | // "the spine menu is too crowded"), and an import belongs | 1061 | // "the spine menu is too crowded"), and an import belongs |
| 1059 | // beside the other two imports, not beside the lane verbs. | 1062 | // beside the other two imports, not beside the lane verbs. |
| 1060 | - .child(ghost_verb( | 1063 | + .children(ghost_verb( |
| 1061 | "dock-import-subtitles", | 1064 | "dock-import-subtitles", |
| 1062 | "Import subtitles", | 1065 | "Import subtitles", |
| 1063 | ActionId::ImportSubtitles, | 1066 | ActionId::ImportSubtitles, |
| @@ -1117,11 +1120,14 @@ fn transition_row(player: &Player, cx: &mut Context<Player>) -> Option<impl Into | |||
| 1117 | let (lane, idx) = player.selected.anchor()?; | 1120 | let (lane, idx) = player.selected.anchor()?; |
| 1118 | let session = player.session.as_ref()?; | 1121 | let session = player.session.as_ref()?; |
| 1119 | let clips = session.lane_clips(lane); | 1122 | let clips = session.lane_clips(lane); |
| 1120 | - let (label_text, frames, cap) = | 1123 | + let (label_text, frames, cap) = transition_of(lane.kind, clips.get(idx)?, clips.get(idx + 1))?; |
| 1121 | - transition_of(lane.kind, clips.get(idx)?, clips.get(idx + 1))?; | ||
| 1122 | let label_style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM); | 1124 | let label_style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM); |
| 1123 | let field = player.transition_edit.as_ref(); | 1125 | let field = player.transition_edit.as_ref(); |
| 1124 | - let step = |id: &'static str, label: &'static str, glyph: &'static str, by: i32, cx: &mut Context<Player>| { | 1126 | + let step = |id: &'static str, |
| 1127 | + label: &'static str, | ||
| 1128 | + glyph: &'static str, | ||
| 1129 | + by: i32, | ||
| 1130 | + cx: &mut Context<Player>| { | ||
| 1125 | div() | 1131 | div() |
| 1126 | .id(id) | 1132 | .id(id) |
| 1127 | .flex() | 1133 | .flex() |
| @@ -1220,7 +1226,7 @@ fn clip_tab( | |||
| 1220 | .flex_col() | 1226 | .flex_col() |
| 1221 | .gap(px(2.)) | 1227 | .gap(px(2.)) |
| 1222 | .p(px(8.)) | 1228 | .p(px(8.)) |
| 1223 | - .child(ghost_verb( | 1229 | + .children(ghost_verb( |
| 1224 | "dock-verb-speed", | 1230 | "dock-verb-speed", |
| 1225 | "Speed", | 1231 | "Speed", |
| 1226 | ActionId::Speed, | 1232 | ActionId::Speed, |
| @@ -1229,7 +1235,7 @@ fn clip_tab( | |||
| 1229 | player, | 1235 | player, |
| 1230 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_speed(cx)), | 1236 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_speed(cx)), |
| 1231 | )) | 1237 | )) |
| 1232 | - .child(ghost_verb( | 1238 | + .children(ghost_verb( |
| 1233 | "dock-verb-color", | 1239 | "dock-verb-color", |
| 1234 | "Colour", | 1240 | "Colour", |
| 1235 | ActionId::Color, | 1241 | ActionId::Color, |
| @@ -1238,7 +1244,7 @@ fn clip_tab( | |||
| 1238 | player, | 1244 | player, |
| 1239 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_color(cx)), | 1245 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_color(cx)), |
| 1240 | )) | 1246 | )) |
| 1241 | - .child(ghost_verb( | 1247 | + .children(ghost_verb( |
| 1242 | "dock-verb-transform", | 1248 | "dock-verb-transform", |
| 1243 | "Transform", | 1249 | "Transform", |
| 1244 | ActionId::Transform, | 1250 | ActionId::Transform, |
| @@ -1247,7 +1253,7 @@ fn clip_tab( | |||
| 1247 | player, | 1253 | player, |
| 1248 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_transform(cx)), | 1254 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_transform(cx)), |
| 1249 | )) | 1255 | )) |
| 1250 | - .child(ghost_verb( | 1256 | + .children(ghost_verb( |
| 1251 | "dock-verb-eq", | 1257 | "dock-verb-eq", |
| 1252 | "EQ", | 1258 | "EQ", |
| 1253 | ActionId::Equalizer, | 1259 | ActionId::Equalizer, |
| @@ -1264,7 +1270,7 @@ fn clip_tab( | |||
| 1264 | // (`bench_stance.rs`, another builder's file this session); | 1270 | // (`bench_stance.rs`, another builder's file this session); |
| 1265 | // it stays reachable by its chord until that lane grows a | 1271 | // it stays reachable by its chord until that lane grows a |
| 1266 | // header to hang a verb on. | 1272 | // header to hang a verb on. |
| 1267 | - .child(ghost_verb( | 1273 | + .children(ghost_verb( |
| 1268 | "dock-verb-silence", | 1274 | "dock-verb-silence", |
| 1269 | "Silence", | 1275 | "Silence", |
| 1270 | ActionId::Silence, | 1276 | ActionId::Silence, |
| @@ -1273,7 +1279,7 @@ fn clip_tab( | |||
| 1273 | player, | 1279 | player, |
| 1274 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_silence(cx)), | 1280 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_silence(cx)), |
| 1275 | )) | 1281 | )) |
| 1276 | - .child(ghost_verb( | 1282 | + .children(ghost_verb( |
| 1277 | "dock-verb-mix", | 1283 | "dock-verb-mix", |
| 1278 | "Mix", | 1284 | "Mix", |
| 1279 | ActionId::Mix, | 1285 | ActionId::Mix, |
| @@ -1290,7 +1296,7 @@ fn clip_tab( | |||
| 1290 | // right-click menu (`overlays.rs`'s `Pick::Fit`); this is its | 1296 | // right-click menu (`overlays.rs`'s `Pick::Fit`); this is its |
| 1291 | // direct button, beside the other per-clip verbs it keeps | 1297 | // direct button, beside the other per-clip verbs it keeps |
| 1292 | // company with. | 1298 | // company with. |
| 1293 | - .child(ghost_verb( | 1299 | + .children(ghost_verb( |
| 1294 | "dock-verb-fit", | 1300 | "dock-verb-fit", |
| 1295 | "Fit", | 1301 | "Fit", |
| 1296 | ActionId::Fit, | 1302 | ActionId::Fit, |