Merge branch 'worktree-agent-ab575acff76734cee'
Browse files at this commit11 changed files +230 -30
- crates/app/src/tests/cards.rs +3 -1
- crates/app/src/tests/layout.rs +107 -0
- crates/app/src/ui/bench_stance.rs +16 -0
- crates/app/src/ui/cards.rs +19 -1
- crates/app/src/ui/dock_stance.rs +14 -17
- crates/app/src/ui/overlays.rs +3 -0
- crates/app/src/ui/preview.rs +1 -0
- crates/app/src/ui/spine_stance.rs +5 -10
- crates/app/src/ui/stance.rs +1 -0
- crates/app/src/ui/timeband_stance.rs +7 -0
- crates/app/src/ui/widgets.rs +54 -1
crates/app/src/tests/cards.rsmodified+3 -1
| @@ -1083,7 +1083,9 @@ fn row_three_wears_the_encode_options_and_the_door_to_the_rest() { | |||
| 1083 | // the ink4 line the plan used to be. | 1083 | // the ink4 line the plan used to be. |
| 1084 | let seg = cards | 1084 | let seg = cards |
| 1085 | .find("fn moment_segment(") | 1085 | .find("fn moment_segment(") |
| 1086 | - .map(|at| &cards[at..at + 1200]) | 1086 | + // Wide enough for the atom's whole chain, plate included -- the |
| 1087 | + // hover line pushed the ink pair past the old 1200-char window. | ||
| 1088 | + .map(|at| &cards[at..at + 1900]) | ||
| 1087 | .expect("the segment atom"); | 1089 | .expect("the segment atom"); |
| 1088 | assert!(seg.contains("INK3()") && seg.contains("INK4()")); | 1090 | assert!(seg.contains("INK3()") && seg.contains("INK4()")); |
| 1089 | assert!(seg.contains("DARK_RAISED()"), "a segment does not answer hover"); | 1091 | assert!(seg.contains("DARK_RAISED()"), "a segment does not answer hover"); |
crates/app/src/tests/layout.rsmodified+107 -0
| @@ -3478,3 +3478,110 @@ fn the_only_hue_in_the_export_section_is_the_av1_gpu_notice() { | |||
| 3478 | ); | 3478 | ); |
| 3479 | } | 3479 | } |
| 3480 | } | 3480 | } |
| 3481 | + | ||
| 3482 | +/// Every control the hitmap names wears a hover line (the user, 2026-09-09, | ||
| 3483 | +/// over a screenshot of the time band: "each and every button needs hover | ||
| 3484 | +/// over information ... I don't know some of them"). The hitmap already | ||
| 3485 | +/// carries the pair a plate needs -- an id and a label -- so the sweep walks | ||
| 3486 | +/// the same emitters: a builder chain that records a control and never calls | ||
| 3487 | +/// `.tooltip` is a glyph the user cannot name. | ||
| 3488 | +/// | ||
| 3489 | +/// A scan and not a render: this crate has no gpui window in its tests, so | ||
| 3490 | +/// the text is the finest grain available. Each emitter must claim a | ||
| 3491 | +/// `.tooltip(` of *its own* within [`REACH`] lines -- one to one, nearest | ||
| 3492 | +/// first. Counting them per function instead let an unrelated plate (the | ||
| 3493 | +/// empty-dock hint) pay for a control that had none: `dock.sort.cycle` sat | ||
| 3494 | +/// bare under a green gate until this pairing was written. | ||
| 3495 | +/// | ||
| 3496 | +/// Controls outside the hitmap are outside this gate by charter. Named for | ||
| 3497 | +/// the record, since each is a control the pointer can press: a card's own | ||
| 3498 | +/// picker rows (colour/transform/mix/subtitle/silence bands, the speed | ||
| 3499 | +/// chips) and the two menus' rows, all of which already read as | ||
| 3500 | +/// `<label> <value-or-chord>` on the row itself -- a plate would repeat the | ||
| 3501 | +/// row it hangs off, which is DESIGN §8's prose rule the other way round. | ||
| 3502 | +#[test] | ||
| 3503 | +fn every_hitmap_control_wears_a_hover_line() { | ||
| 3504 | + /// How far from a control's `hitmap::` line its plate may be attached. | ||
| 3505 | + /// A builder chain runs long here (the contact strip's tooltip sits 65 | ||
| 3506 | + /// lines above its emitter), so the reach is generous; what it buys is | ||
| 3507 | + /// that a plate can be spent only once. | ||
| 3508 | + const REACH: usize = 80; | ||
| 3509 | + // Ids that name a control a *previous* emitter in the same chain already | ||
| 3510 | + // plated -- the second id is the harness's aim point, not a second | ||
| 3511 | + // control -- with the reason each is exempt. | ||
| 3512 | + const DOUBLE_NAMED: &[&str] = &[ | ||
| 3513 | + // `subtitle.N.M.row` and `subtitle.N.M.select` are one row. | ||
| 3514 | + ".select\")", | ||
| 3515 | + ]; | ||
| 3516 | + let mut controls = 0; | ||
| 3517 | + let mut naked = Vec::new(); | ||
| 3518 | + for path in source_files() { | ||
| 3519 | + let text = std::fs::read_to_string(&path).expect("a source file"); | ||
| 3520 | + if !text.contains("hitmap::") { | ||
| 3521 | + continue; | ||
| 3522 | + } | ||
| 3523 | + let file = path | ||
| 3524 | + .file_name() | ||
| 3525 | + .and_then(|n| n.to_str()) | ||
| 3526 | + .expect("a file name") | ||
| 3527 | + .to_string(); | ||
| 3528 | + let lines: Vec<&str> = text.lines().collect(); | ||
| 3529 | + let mut tips: Vec<(usize, bool)> = lines | ||
| 3530 | + .iter() | ||
| 3531 | + .enumerate() | ||
| 3532 | + .filter(|(_, l)| l.contains(".tooltip(")) | ||
| 3533 | + .map(|(i, _)| (i, false)) | ||
| 3534 | + .collect(); | ||
| 3535 | + for (i, line) in lines.iter().enumerate() { | ||
| 3536 | + let emitter = ["hitmap::control(", "hitmap::dynamic(", "hitmap::action("] | ||
| 3537 | + .iter() | ||
| 3538 | + .any(|needle| line.contains(needle)); | ||
| 3539 | + if !emitter { | ||
| 3540 | + continue; | ||
| 3541 | + } | ||
| 3542 | + // The id a `dynamic` builds sits a line or three below its call. | ||
| 3543 | + let head = lines[i..(i + 6).min(lines.len())].join("\n"); | ||
| 3544 | + if DOUBLE_NAMED.iter().any(|id| head.contains(id)) { | ||
| 3545 | + continue; | ||
| 3546 | + } | ||
| 3547 | + controls += 1; | ||
| 3548 | + let mut free: Vec<usize> = (0..tips.len()) | ||
| 3549 | + .filter(|n| !tips[*n].1 && tips[*n].0.abs_diff(i) <= REACH) | ||
| 3550 | + .collect(); | ||
| 3551 | + free.sort_by_key(|n| tips[*n].0.abs_diff(i)); | ||
| 3552 | + match free.first() { | ||
| 3553 | + Some(n) => tips[*n].1 = true, | ||
| 3554 | + None => naked.push(format!("{file}:{}: {}", i + 1, line.trim())), | ||
| 3555 | + } | ||
| 3556 | + } | ||
| 3557 | + } | ||
| 3558 | + assert!( | ||
| 3559 | + controls >= 40, | ||
| 3560 | + "the hover sweep found only {controls} controls -- it has gone blind" | ||
| 3561 | + ); | ||
| 3562 | + assert!( | ||
| 3563 | + naked.is_empty(), | ||
| 3564 | + "controls with no hover line of their own (attach \ | ||
| 3565 | + `widgets::tip_hover`/`action_hover` in the chain that emits the \ | ||
| 3566 | + hitmap id): {naked:#?}" | ||
| 3567 | + ); | ||
| 3568 | +} | ||
| 3569 | + | ||
| 3570 | +/// The one hover shape for the whole room: `<name> · <chord>`, and a control | ||
| 3571 | +/// the state refuses says why instead of naming a stroke that will not fire | ||
| 3572 | +/// (DESIGN §4/§8 -- a tooltip is not a sentence). | ||
| 3573 | +#[test] | ||
| 3574 | +fn a_hover_line_is_a_name_and_a_chord() { | ||
| 3575 | + use crate::ui::widgets::tip_line; | ||
| 3576 | + assert_eq!( | ||
| 3577 | + tip_line("One frame forward", "right", None), | ||
| 3578 | + "One frame forward · right" | ||
| 3579 | + ); | ||
| 3580 | + assert_eq!( | ||
| 3581 | + tip_line("Split", "s", Some("nothing selected")), | ||
| 3582 | + "Split · nothing selected" | ||
| 3583 | + ); | ||
| 3584 | + // `Keymap::chord`'s unbound badge is not a stroke. | ||
| 3585 | + assert_eq!(tip_line("Add files", "--", None), "Add files"); | ||
| 3586 | + assert_eq!(tip_line("Source", "", None), "Source"); | ||
| 3587 | +} | ||
crates/app/src/ui/bench_stance.rsmodified+16 -0
| @@ -337,6 +337,7 @@ fn clip_box( | |||
| 337 | move |_, _, _, cx| cx.new(|_| Tip(ghost.clone())) | 337 | move |_, _, _, cx| cx.new(|_| Tip(ghost.clone())) |
| 338 | }, | 338 | }, |
| 339 | ) | 339 | ) |
| 340 | + .tooltip(crate::ui::widgets::tip_hover("Clip", "drag to move", None)) | ||
| 340 | .children(hitmap::dynamic( | 341 | .children(hitmap::dynamic( |
| 341 | move || { | 342 | move || { |
| 342 | ( | 343 | ( |
| @@ -357,6 +358,12 @@ fn clip_box( | |||
| 357 | .filter(|_| trims(span)) | 358 | .filter(|_| trims(span)) |
| 358 | .map(|edge| { | 359 | .map(|edge| { |
| 359 | let mut zone = div() | 360 | let mut zone = div() |
| 361 | + // An id only so the strip can carry a hover plate -- | ||
| 362 | + // gpui's `.tooltip` lives on a stateful div. | ||
| 363 | + .id(( | ||
| 364 | + "bench-clip-trim", | ||
| 365 | + (lane.ord * 1000 + idx) * 2 + usize::from(edge == Edge::End), | ||
| 366 | + )) | ||
| 360 | .absolute() | 367 | .absolute() |
| 361 | .top_0() | 368 | .top_0() |
| 362 | .h_full() | 369 | .h_full() |
| @@ -379,6 +386,7 @@ fn clip_box( | |||
| 379 | this.open_menu(lane, idx, event.position, cx); | 386 | this.open_menu(lane, idx, event.position, cx); |
| 380 | }), | 387 | }), |
| 381 | ) | 388 | ) |
| 389 | + .tooltip(crate::ui::widgets::tip_hover("Trim clip edge", "drag", None)) | ||
| 382 | .children(hitmap::dynamic( | 390 | .children(hitmap::dynamic( |
| 383 | move || { | 391 | move || { |
| 384 | ( | 392 | ( |
| @@ -580,6 +588,10 @@ fn clip_box( | |||
| 580 | d.children([Edge::Start, Edge::End].into_iter().map(|edge| { | 588 | d.children([Edge::Start, Edge::End].into_iter().map(|edge| { |
| 581 | let is_in = edge == Edge::Start; | 589 | let is_in = edge == Edge::Start; |
| 582 | let mut handle = div() | 590 | let mut handle = div() |
| 591 | + .id(( | ||
| 592 | + "bench-clip-fade", | ||
| 593 | + (lane.ord * 1000 + idx) * 2 + usize::from(!is_in), | ||
| 594 | + )) | ||
| 583 | .absolute() | 595 | .absolute() |
| 584 | .top_0() | 596 | .top_0() |
| 585 | .w(px(FADE_HANDLE_W)) | 597 | .w(px(FADE_HANDLE_W)) |
| @@ -593,6 +605,7 @@ fn clip_box( | |||
| 593 | this.start_fade_drag(lane, idx, is_in, event.position.x, cx); | 605 | this.start_fade_drag(lane, idx, is_in, event.position.x, cx); |
| 594 | }), | 606 | }), |
| 595 | ) | 607 | ) |
| 608 | + .tooltip(crate::ui::widgets::tip_hover("Fade handle", "drag", None)) | ||
| 596 | .children(hitmap::dynamic( | 609 | .children(hitmap::dynamic( |
| 597 | move || { | 610 | move || { |
| 598 | ( | 611 | ( |
| @@ -713,6 +726,7 @@ fn sub_box( | |||
| 713 | move |_, _, _, cx| cx.new(|_| Tip(ghost.clone())) | 726 | move |_, _, _, cx| cx.new(|_| Tip(ghost.clone())) |
| 714 | }, | 727 | }, |
| 715 | ) | 728 | ) |
| 729 | + .tooltip(crate::ui::widgets::tip_hover("Subtitle", "drag to move", None)) | ||
| 716 | .children(hitmap::dynamic( | 730 | .children(hitmap::dynamic( |
| 717 | move || { | 731 | move || { |
| 718 | ( | 732 | ( |
| @@ -893,6 +907,7 @@ fn lane_row( | |||
| 893 | .on_drag(LaneDrag(lane), move |_, _, _, cx| { | 907 | .on_drag(LaneDrag(lane), move |_, _, _, cx| { |
| 894 | cx.new(|_| Tip(head_ghost.clone())) | 908 | cx.new(|_| Tip(head_ghost.clone())) |
| 895 | }) | 909 | }) |
| 910 | + .tooltip(crate::ui::widgets::tip_hover("Reorder lane", "drag", None)) | ||
| 896 | .children(hitmap::dynamic( | 911 | .children(hitmap::dynamic( |
| 897 | move || { | 912 | move || { |
| 898 | ( | 913 | ( |
| @@ -1189,6 +1204,7 @@ fn lane_row( | |||
| 1189 | this.preview_ghost_pick(track, lane, event.event.position.x, cx); | 1204 | this.preview_ghost_pick(track, lane, event.event.position.x, cx); |
| 1190 | }), | 1205 | }), |
| 1191 | ) | 1206 | ) |
| 1207 | + .tooltip(crate::ui::widgets::tip_hover("Lane bed", "drop media here", None)) | ||
| 1192 | .children(hitmap::dynamic( | 1208 | .children(hitmap::dynamic( |
| 1193 | move || { | 1209 | move || { |
| 1194 | ( | 1210 | ( |
crates/app/src/ui/cards.rsmodified+19 -1
| @@ -121,6 +121,7 @@ fn dark_card_head( | |||
| 121 | .into() | 121 | .into() |
| 122 | }) | 122 | }) |
| 123 | .child(if max { "▣ m" } else { "⤢ m" }) | 123 | .child(if max { "▣ m" } else { "⤢ m" }) |
| 124 | + .tooltip(crate::ui::widgets::overlay_tip_hover("Toggle card size", "", None)) | ||
| 124 | .children(hitmap::control("card.maximize", "Toggle card size", true)) | 125 | .children(hitmap::control("card.maximize", "Toggle card size", true)) |
| 125 | })) | 126 | })) |
| 126 | .child( | 127 | .child( |
| @@ -205,6 +206,11 @@ fn dark_step_glyph( | |||
| 205 | .cursor_pointer() | 206 | .cursor_pointer() |
| 206 | .hover(|s| s.bg(rgb(DARK_RAISED()))) | 207 | .hover(|s| s.bg(rgb(DARK_RAISED()))) |
| 207 | .on_click(on_click) | 208 | .on_click(on_click) |
| 209 | + .tooltip(crate::ui::widgets::overlay_tip_hover( | ||
| 210 | + if plus { "Step up" } else { "Step down" }, | ||
| 211 | + "", | ||
| 212 | + None, | ||
| 213 | + )) | ||
| 208 | .children(hitmap.flatten()) | 214 | .children(hitmap.flatten()) |
| 209 | .child(dark_row_value(if plus { "+" } else { "−" })) | 215 | .child(dark_row_value(if plus { "+" } else { "−" })) |
| 210 | } | 216 | } |
| @@ -223,6 +229,16 @@ fn moment_segment( | |||
| 223 | on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, | 229 | on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, |
| 224 | ) -> impl IntoElement { | 230 | ) -> impl IntoElement { |
| 225 | let text: SharedString = text.into(); | 231 | let text: SharedString = text.into(); |
| 232 | + let chord: SharedString = chord.into(); | ||
| 233 | + // The segment reads its *value* ("H.264 \u{b7} MP4"); the plate has to say | ||
| 234 | + // what pressing it does. Keyed off the id, so the next segment cannot | ||
| 235 | + // ship without one -- the sweep in `tests::layout` holds it to that. | ||
| 236 | + let name = match id { | ||
| 237 | + "moment-picture" => "Change the picture format", | ||
| 238 | + "moment-sound" => "Change the sound rate", | ||
| 239 | + "moment-encoder" => "Change the encoder seat", | ||
| 240 | + _ => "Open the export settings", | ||
| 241 | + }; | ||
| 226 | let hitmap = hitmap::enabled().then(|| { | 242 | let hitmap = hitmap::enabled().then(|| { |
| 227 | let label = text.clone(); | 243 | let label = text.clone(); |
| 228 | hitmap::dynamic(move || (format!("card.{id}"), label.to_string()), true) | 244 | hitmap::dynamic(move || (format!("card.{id}"), label.to_string()), true) |
| @@ -238,6 +254,7 @@ fn moment_segment( | |||
| 238 | .cursor_pointer() | 254 | .cursor_pointer() |
| 239 | .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK2()))) | 255 | .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK2()))) |
| 240 | .on_click(on_click) | 256 | .on_click(on_click) |
| 257 | + .tooltip(crate::ui::widgets::overlay_tip_hover(name, &chord, None)) | ||
| 241 | .children(hitmap.flatten()) | 258 | .children(hitmap.flatten()) |
| 242 | .type_style(type_scale::mono( | 259 | .type_style(type_scale::mono( |
| 243 | type_scale::CHORD_METADATA_MIN_PX, | 260 | type_scale::CHORD_METADATA_MIN_PX, |
| @@ -245,7 +262,7 @@ fn moment_segment( | |||
| 245 | )) | 262 | )) |
| 246 | .text_color(rgb(INK3())) | 263 | .text_color(rgb(INK3())) |
| 247 | .child(text) | 264 | .child(text) |
| 248 | - .child(div().flex_none().text_color(rgb(INK4())).child(chord.into())) | 265 | + .child(div().flex_none().text_color(rgb(INK4())).child(chord)) |
| 249 | } | 266 | } |
| 250 | 267 | ||
| 251 | fn dark_ghost_button( | 268 | fn dark_ghost_button( |
| @@ -275,6 +292,7 @@ fn dark_ghost_button( | |||
| 275 | .cursor_pointer() | 292 | .cursor_pointer() |
| 276 | .hover(|s| s.bg(rgb(DARK_RAISED()))) | 293 | .hover(|s| s.bg(rgb(DARK_RAISED()))) |
| 277 | .on_click(on_click) | 294 | .on_click(on_click) |
| 295 | + .tooltip(crate::ui::widgets::overlay_tip_hover(&text, chord, None)) | ||
| 278 | .children(hitmap.flatten()) | 296 | .children(hitmap.flatten()) |
| 279 | .child( | 297 | .child( |
| 280 | div() | 298 | div() |
crates/app/src/ui/dock_stance.rsmodified+14 -17
| @@ -118,7 +118,6 @@ fn ghost_verb( | |||
| 118 | verb_label: &'static str, | 118 | verb_label: &'static str, |
| 119 | action: ActionId, | 119 | action: ActionId, |
| 120 | active: bool, | 120 | active: bool, |
| 121 | - hint: &str, | ||
| 122 | player: &Player, | 121 | player: &Player, |
| 123 | on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, | 122 | on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, |
| 124 | ) -> Option<impl IntoElement> { | 123 | ) -> Option<impl IntoElement> { |
| @@ -127,11 +126,6 @@ fn ghost_verb( | |||
| 127 | return None; | 126 | return None; |
| 128 | } | 127 | } |
| 129 | let key = player.keymap.chord(action); | 128 | let key = player.keymap.chord(action); |
| 130 | - let say: SharedString = match enabled.why() { | ||
| 131 | - Some(why) => format!("{key} — {why}"), | ||
| 132 | - None => format!("{key} — {hint}"), | ||
| 133 | - } | ||
| 134 | - .into(); | ||
| 135 | let on = enabled.yes(); | 129 | let on = enabled.yes(); |
| 136 | let label_style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM); | 130 | let label_style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM); |
| 137 | let chord_style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM); | 131 | let chord_style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM); |
| @@ -146,7 +140,10 @@ fn ghost_verb( | |||
| 146 | .px(px(8.)) | 140 | .px(px(8.)) |
| 147 | .rounded(px(3.)) | 141 | .rounded(px(3.)) |
| 148 | .when(active, |d| d.bg(rgb(DARK_RAISED()))) | 142 | .when(active, |d| d.bg(rgb(DARK_RAISED()))) |
| 149 | - .tooltip(move |_, cx| cx.new(|_| Tip(say.clone())).into()) | 143 | + // One hover line for the whole room (`widgets::tip_line`): the |
| 144 | + // verb and its stroke, not the sentence this row used to carry | ||
| 145 | + // (DESIGN §8 -- a tooltip is not instructional prose). | ||
| 146 | + .tooltip(crate::ui::widgets::action_hover(player, action)) | ||
| 150 | .when(!on, |d| d.opacity(0.4).cursor_not_allowed()) | 147 | .when(!on, |d| d.opacity(0.4).cursor_not_allowed()) |
| 151 | .when(on, |d| { | 148 | .when(on, |d| { |
| 152 | d.cursor_pointer() | 149 | d.cursor_pointer() |
| @@ -210,6 +207,7 @@ fn dock_tab( | |||
| 210 | } | 207 | } |
| 211 | cx.notify(); | 208 | cx.notify(); |
| 212 | })) | 209 | })) |
| 210 | + .tooltip(crate::ui::widgets::tip_hover(&format!("Show {}", label_text.to_lowercase()), "", None)) | ||
| 213 | .children(hitmap::control(id, label_text, true)) | 211 | .children(hitmap::control(id, label_text, true)) |
| 214 | .child( | 212 | .child( |
| 215 | div() | 213 | div() |
| @@ -415,6 +413,7 @@ fn source_row( | |||
| 415 | cx.new(|_| Tip(ghost.clone())) | 413 | cx.new(|_| Tip(ghost.clone())) |
| 416 | }) | 414 | }) |
| 417 | }) | 415 | }) |
| 416 | + .tooltip(crate::ui::widgets::tip_hover("Source", "drag to a lane", None)) | ||
| 418 | .children(hitmap::dynamic( | 417 | .children(hitmap::dynamic( |
| 419 | move || (format!("source.{i}.row"), "Source row".into()), | 418 | move || (format!("source.{i}.row"), "Source row".into()), |
| 420 | usable, | 419 | usable, |
| @@ -741,6 +740,7 @@ fn subtitle_tab_rows(player: &Player, cx: &mut Context<Player>) -> (usize, Vec<A | |||
| 741 | cx.notify(); | 740 | cx.notify(); |
| 742 | })) | 741 | })) |
| 743 | }) | 742 | }) |
| 743 | + .tooltip(crate::ui::widgets::tip_hover("Subtitle track", "drag to a lane", None)) | ||
| 744 | .children(hitmap::dynamic( | 744 | .children(hitmap::dynamic( |
| 745 | move || { | 745 | move || { |
| 746 | ( | 746 | ( |
| @@ -810,6 +810,7 @@ fn subtitle_tab_rows(player: &Player, cx: &mut Context<Player>) -> (usize, Vec<A | |||
| 810 | cx.stop_propagation(); | 810 | cx.stop_propagation(); |
| 811 | this.remove_subtitle_track(track, cx); | 811 | this.remove_subtitle_track(track, cx); |
| 812 | })) | 812 | })) |
| 813 | + .tooltip(crate::ui::widgets::tip_hover("Remove subtitle track", "", None)) | ||
| 813 | .children(hitmap::dynamic( | 814 | .children(hitmap::dynamic( |
| 814 | move || { | 815 | move || { |
| 815 | ( | 816 | ( |
| @@ -846,6 +847,7 @@ fn subtitle_tab_rows(player: &Player, cx: &mut Context<Player>) -> (usize, Vec<A | |||
| 846 | } | 847 | } |
| 847 | cx.notify(); | 848 | cx.notify(); |
| 848 | })) | 849 | })) |
| 850 | + .tooltip(crate::ui::widgets::tip_hover("Fold this source", "click", None)) | ||
| 849 | .children(hitmap::dynamic( | 851 | .children(hitmap::dynamic( |
| 850 | move || { | 852 | move || { |
| 851 | ( | 853 | ( |
| @@ -1029,6 +1031,7 @@ fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context<Player>) - | |||
| 1029 | this.dock_filter_edit = true; | 1031 | this.dock_filter_edit = true; |
| 1030 | cx.notify(); | 1032 | cx.notify(); |
| 1031 | })) | 1033 | })) |
| 1034 | + .tooltip(crate::ui::widgets::tip_hover("Filter sources", "type to narrow", None)) | ||
| 1032 | .children(hitmap::control("dock.filter", "Filter sources", true)) | 1035 | .children(hitmap::control("dock.filter", "Filter sources", true)) |
| 1033 | .child(match player.dock_filter.is_empty() { | 1036 | .child(match player.dock_filter.is_empty() { |
| 1034 | true => "⌕ filter".to_string(), | 1037 | true => "⌕ filter".to_string(), |
| @@ -1059,6 +1062,7 @@ fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context<Player>) - | |||
| 1059 | this.library_tab = tab; | 1062 | this.library_tab = tab; |
| 1060 | cx.notify(); | 1063 | cx.notify(); |
| 1061 | })) | 1064 | })) |
| 1065 | + .tooltip(crate::ui::widgets::tip_hover(&format!("Show {} only", tab.label().to_lowercase()), "", None)) | ||
| 1062 | .children(hitmap::dynamic( | 1066 | .children(hitmap::dynamic( |
| 1063 | move || { | 1067 | move || { |
| 1064 | ( | 1068 | ( |
| @@ -1088,6 +1092,7 @@ fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context<Player>) - | |||
| 1088 | .text_color(rgb(INK2())) | 1092 | .text_color(rgb(INK2())) |
| 1089 | .cursor_pointer() | 1093 | .cursor_pointer() |
| 1090 | .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1()))) | 1094 | .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1()))) |
| 1095 | + .tooltip(crate::ui::widgets::tip_hover("Sort sources", "click to cycle", None)) | ||
| 1091 | .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { | 1096 | .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { |
| 1092 | this.dock_sort = this.dock_sort.next(); | 1097 | this.dock_sort = this.dock_sort.next(); |
| 1093 | cx.notify(); | 1098 | cx.notify(); |
| @@ -1139,7 +1144,6 @@ fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context<Player>) - | |||
| 1139 | "Add files", | 1144 | "Add files", |
| 1140 | ActionId::AddFiles, | 1145 | ActionId::AddFiles, |
| 1141 | false, | 1146 | false, |
| 1142 | - "adds a file to this list — or drop one on the window", | ||
| 1143 | player, | 1147 | player, |
| 1144 | cx.listener(|this, _: &ClickEvent, _, cx| this.pick_and_import(cx)), | 1148 | cx.listener(|this, _: &ClickEvent, _, cx| this.pick_and_import(cx)), |
| 1145 | )) | 1149 | )) |
| @@ -1148,7 +1152,6 @@ fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context<Player>) - | |||
| 1148 | "Paste path", | 1152 | "Paste path", |
| 1149 | ActionId::PasteFilePath, | 1153 | ActionId::PasteFilePath, |
| 1150 | false, | 1154 | false, |
| 1151 | - "imports the file named on the clipboard", | ||
| 1152 | player, | 1155 | player, |
| 1153 | cx.listener(|this, _: &ClickEvent, _, cx| this.paste_file_path(cx)), | 1156 | cx.listener(|this, _: &ClickEvent, _, cx| this.paste_file_path(cx)), |
| 1154 | )) | 1157 | )) |
| @@ -1163,7 +1166,6 @@ fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context<Player>) - | |||
| 1163 | "Import subtitles", | 1166 | "Import subtitles", |
| 1164 | ActionId::ImportSubtitles, | 1167 | ActionId::ImportSubtitles, |
| 1165 | false, | 1168 | false, |
| 1166 | - "reads an .srt/.ass file onto a subtitle lane", | ||
| 1167 | player, | 1169 | player, |
| 1168 | cx.listener(|this, _: &ClickEvent, window, cx| { | 1170 | cx.listener(|this, _: &ClickEvent, window, cx| { |
| 1169 | this.act(ActionId::ImportSubtitles, window, cx) | 1171 | this.act(ActionId::ImportSubtitles, window, cx) |
| @@ -1224,6 +1226,7 @@ fn transition_row(player: &Player, cx: &mut Context<Player>) -> Option<impl Into | |||
| 1224 | .bg(rgb(DARK_RAISED())) | 1226 | .bg(rgb(DARK_RAISED())) |
| 1225 | .cursor_pointer() | 1227 | .cursor_pointer() |
| 1226 | .hover(|s| s.text_color(rgb(INK1()))) | 1228 | .hover(|s| s.text_color(rgb(INK1()))) |
| 1229 | + .tooltip(crate::ui::widgets::tip_hover(label, "", None)) | ||
| 1227 | .children(hitmap::control(id, label, true)) | 1230 | .children(hitmap::control(id, label, true)) |
| 1228 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | 1231 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 1229 | this.nudge_transition(lane, idx, by, cx); | 1232 | this.nudge_transition(lane, idx, by, cx); |
| @@ -1246,6 +1249,7 @@ fn transition_row(player: &Player, cx: &mut Context<Player>) -> Option<impl Into | |||
| 1246 | .text_size(label_style.size) | 1249 | .text_size(label_style.size) |
| 1247 | .text_color(rgb(INK2())) | 1250 | .text_color(rgb(INK2())) |
| 1248 | .cursor_pointer() | 1251 | .cursor_pointer() |
| 1252 | + .tooltip(crate::ui::widgets::tip_hover("Transition duration", "click to type", None)) | ||
| 1249 | .children(hitmap::control( | 1253 | .children(hitmap::control( |
| 1250 | "transition-duration-field", | 1254 | "transition-duration-field", |
| 1251 | "Transition duration, type-in", | 1255 | "Transition duration, type-in", |
| @@ -1320,7 +1324,6 @@ fn clip_tab( | |||
| 1320 | "Speed", | 1324 | "Speed", |
| 1321 | ActionId::Speed, | 1325 | ActionId::Speed, |
| 1322 | player.speed_open.is_some(), | 1326 | player.speed_open.is_some(), |
| 1323 | - "how fast this clip and its group play", | ||
| 1324 | player, | 1327 | player, |
| 1325 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_speed(cx)), | 1328 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_speed(cx)), |
| 1326 | )) | 1329 | )) |
| @@ -1329,7 +1332,6 @@ fn clip_tab( | |||
| 1329 | "Colour", | 1332 | "Colour", |
| 1330 | ActionId::Color, | 1333 | ActionId::Color, |
| 1331 | player.color_open.is_some(), | 1334 | player.color_open.is_some(), |
| 1332 | - "exposure, contrast, saturation and temperature", | ||
| 1333 | player, | 1335 | player, |
| 1334 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_color(cx)), | 1336 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_color(cx)), |
| 1335 | )) | 1337 | )) |
| @@ -1338,7 +1340,6 @@ fn clip_tab( | |||
| 1338 | "Transform", | 1340 | "Transform", |
| 1339 | ActionId::Transform, | 1341 | ActionId::Transform, |
| 1340 | player.transform_open.is_some(), | 1342 | player.transform_open.is_some(), |
| 1341 | - "position, scale, rotation and crop for this clip", | ||
| 1342 | player, | 1343 | player, |
| 1343 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_transform(cx)), | 1344 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_transform(cx)), |
| 1344 | )) | 1345 | )) |
| @@ -1347,7 +1348,6 @@ fn clip_tab( | |||
| 1347 | "EQ", | 1348 | "EQ", |
| 1348 | ActionId::Equalizer, | 1349 | ActionId::Equalizer, |
| 1349 | player.eq_open.is_some(), | 1350 | player.eq_open.is_some(), |
| 1350 | - "the bands this clip's sound is filtered through", | ||
| 1351 | player, | 1351 | player, |
| 1352 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_eq(cx)), | 1352 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_eq(cx)), |
| 1353 | )) | 1353 | )) |
| @@ -1364,7 +1364,6 @@ fn clip_tab( | |||
| 1364 | "Silence", | 1364 | "Silence", |
| 1365 | ActionId::Silence, | 1365 | ActionId::Silence, |
| 1366 | player.silence_open.is_some(), | 1366 | player.silence_open.is_some(), |
| 1367 | - "scans for quiet stretches to cut or speed up", | ||
| 1368 | player, | 1367 | player, |
| 1369 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_silence(cx)), | 1368 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_silence(cx)), |
| 1370 | )) | 1369 | )) |
| @@ -1373,7 +1372,6 @@ fn clip_tab( | |||
| 1373 | "Mix", | 1372 | "Mix", |
| 1374 | ActionId::Mix, | 1373 | ActionId::Mix, |
| 1375 | player.mix_open, | 1374 | player.mix_open, |
| 1376 | - "track volumes and the limiter", | ||
| 1377 | player, | 1375 | player, |
| 1378 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_mix(None, cx)), | 1376 | cx.listener(|this, _: &ClickEvent, _, cx| this.open_mix(None, cx)), |
| 1379 | )) | 1377 | )) |
| @@ -1390,7 +1388,6 @@ fn clip_tab( | |||
| 1390 | "Fit", | 1388 | "Fit", |
| 1391 | ActionId::Fit, | 1389 | ActionId::Fit, |
| 1392 | false, | 1390 | false, |
| 1393 | - "how this picture is placed on the project canvas", | ||
| 1394 | player, | 1391 | player, |
| 1395 | cx.listener(|this, _: &ClickEvent, _, cx| this.cycle_fit(cx)), | 1392 | cx.listener(|this, _: &ClickEvent, _, cx| this.cycle_fit(cx)), |
| 1396 | )), | 1393 | )), |
crates/app/src/ui/overlays.rsmodified+3 -0
| @@ -368,6 +368,7 @@ impl Player { | |||
| 368 | } | 368 | } |
| 369 | cx.notify(); | 369 | cx.notify(); |
| 370 | })) | 370 | })) |
| 371 | + .tooltip(crate::ui::widgets::tip_hover("Properties", "", None)) | ||
| 371 | .children(hitmap::control("menu.properties", "Properties", true)) | 372 | .children(hitmap::control("menu.properties", "Properties", true)) |
| 372 | .child("Properties") | 373 | .child("Properties") |
| 373 | // No stroke reaches this one, and a blank column would read | 374 | // No stroke reaches this one, and a blank column would read |
| @@ -470,6 +471,7 @@ impl Player { | |||
| 470 | .enumerate() | 471 | .enumerate() |
| 471 | .map(|(n, (choice, label, detail, picked))| { | 472 | .map(|(n, (choice, label, detail, picked))| { |
| 472 | let hitmap_label = label.clone(); | 473 | let hitmap_label = label.clone(); |
| 474 | + let row_tip = label.clone(); | ||
| 473 | let hitmap_id = match theme_picker { | 475 | let hitmap_id = match theme_picker { |
| 474 | true => format!("theme.{n}.row"), | 476 | true => format!("theme.{n}.row"), |
| 475 | false => format!("picker.choice.{n}"), | 477 | false => format!("picker.choice.{n}"), |
| @@ -547,6 +549,7 @@ impl Player { | |||
| 547 | .on_click( | 549 | .on_click( |
| 548 | cx.listener(move |this, _: &ClickEvent, _, cx| this.choose(choice, cx)), | 550 | cx.listener(move |this, _: &ClickEvent, _, cx| this.choose(choice, cx)), |
| 549 | ) | 551 | ) |
| 552 | + .tooltip(crate::ui::widgets::overlay_tip_hover(&row_tip, "", None)) | ||
| 550 | .children(hitmap::dynamic( | 553 | .children(hitmap::dynamic( |
| 551 | move || (hitmap_id, hitmap_label.to_string()), | 554 | move || (hitmap_id, hitmap_label.to_string()), |
| 552 | true, | 555 | true, |
crates/app/src/ui/preview.rsmodified+1 -0
| @@ -49,6 +49,7 @@ impl Player { | |||
| 49 | .cursor_pointer() | 49 | .cursor_pointer() |
| 50 | .hover(|s| s.bg(rgb(DARK_RAISED()))) | 50 | .hover(|s| s.bg(rgb(DARK_RAISED()))) |
| 51 | .on_click(cx.listener(|this, _: &ClickEvent, _, cx| this.close_preview(cx))) | 51 | .on_click(cx.listener(|this, _: &ClickEvent, _, cx| this.close_preview(cx))) |
| 52 | + .tooltip(crate::ui::widgets::tip_hover("Stop preview", "esc", None)) | ||
| 52 | .children(hitmap::control("preview.stop", "Stop preview", true)) | 53 | .children(hitmap::control("preview.stop", "Stop preview", true)) |
| 53 | .child(div().text_color(rgb(INK2())).child("Stop")) | 54 | .child(div().text_color(rgb(INK2())).child("Stop")) |
| 54 | .child( | 55 | .child( |
crates/app/src/ui/spine_stance.rsmodified+5 -10
| @@ -91,11 +91,10 @@ fn glyph_sized( | |||
| 91 | // action answers to, and the keys overlay ([`crate::ui::stance`]) is | 91 | // action answers to, and the keys overlay ([`crate::ui::stance`]) is |
| 92 | // still where the full truth lives. | 92 | // still where the full truth lives. |
| 93 | let full = player.keymap.display(action); | 93 | let full = player.keymap.display(action); |
| 94 | - let say: SharedString = match enabled.why() { | 94 | + // The room's one hover shape (`widgets::tip_line`): the name first, then |
| 95 | - Some(why) => format!("{full} — {why}"), | 95 | + // the strokes -- `display`'s every stroke here rather than the compact |
| 96 | - None => format!("{full} — {}", action.label()), | 96 | + // badge, since the spine's glyph is already showing the compact one. |
| 97 | - } | 97 | + let say = crate::ui::widgets::tip_line(action.label(), &full, enabled.why()); |
| 98 | - .into(); | ||
| 99 | let compact = player.keymap.chord(action); | 98 | let compact = player.keymap.chord(action); |
| 100 | let on = enabled.yes(); | 99 | let on = enabled.yes(); |
| 101 | div() | 100 | div() |
| @@ -158,11 +157,7 @@ fn trim_control(active: bool, player: &Player, cx: &mut Context<Player>) -> impl | |||
| 158 | let half = |id: &'static str, txt: &'static str, action: ActionId, cx: &mut Context<Player>| { | 157 | let half = |id: &'static str, txt: &'static str, action: ActionId, cx: &mut Context<Player>| { |
| 159 | let enabled = player.enable(action, None); | 158 | let enabled = player.enable(action, None); |
| 160 | let full = player.keymap.display(action); | 159 | let full = player.keymap.display(action); |
| 161 | - let say: SharedString = match enabled.why() { | 160 | + let say = crate::ui::widgets::tip_line(action.label(), &full, enabled.why()); |
| 162 | - Some(why) => format!("{full} — {why}"), | ||
| 163 | - None => format!("{full} — {}", action.label()), | ||
| 164 | - } | ||
| 165 | - .into(); | ||
| 166 | let on = enabled.yes(); | 161 | let on = enabled.yes(); |
| 167 | div() | 162 | div() |
| 168 | .id(id) | 163 | .id(id) |
crates/app/src/ui/stance.rsmodified+1 -0
| @@ -442,6 +442,7 @@ fn ghost( | |||
| 442 | .rounded(px(3.)) | 442 | .rounded(px(3.)) |
| 443 | .cursor_pointer() | 443 | .cursor_pointer() |
| 444 | .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1()))) | 444 | .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1()))) |
| 445 | + .tooltip(crate::ui::widgets::action_hover(player, action)) | ||
| 445 | .on_click(cx.listener(move |this, _: &ClickEvent, window, cx| this.act(action, window, cx))) | 446 | .on_click(cx.listener(move |this, _: &ClickEvent, window, cx| this.act(action, window, cx))) |
| 446 | .type_style(type_scale::label( | 447 | .type_style(type_scale::label( |
| 447 | type_scale::LABEL_ROW_PX, | 448 | type_scale::LABEL_ROW_PX, |
crates/app/src/ui/timeband_stance.rsmodified+7 -0
| @@ -165,6 +165,10 @@ fn ghost( | |||
| 165 | this.act(action, window, cx); | 165 | this.act(action, window, cx); |
| 166 | })) | 166 | })) |
| 167 | .children(hitmap::action(action, player.enable(action, None).yes())) | 167 | .children(hitmap::action(action, player.enable(action, None).yes())) |
| 168 | + // The glyphs nobody could name (`|◂`, `∞`, `‹|`): the hover line is built | ||
| 169 | + // where the ghost is, so a glyph added to this band tomorrow cannot | ||
| 170 | + // ship without one. | ||
| 171 | + .tooltip(crate::ui::widgets::action_hover(player, action)) | ||
| 168 | .font(glyph_style.font) | 172 | .font(glyph_style.font) |
| 169 | .text_size(glyph_style.size) | 173 | .text_size(glyph_style.size) |
| 170 | .text_color(rgb(if active { INK1() } else { INK2() })) | 174 | .text_color(rgb(if active { INK1() } else { INK2() })) |
| @@ -571,6 +575,7 @@ fn grip(id: &'static str, left: bool, top: bool) -> impl IntoElement { | |||
| 571 | PAN_ANCHOR.with(|a| a.set(Some(f32::from(event.position.x)))); | 575 | PAN_ANCHOR.with(|a| a.set(Some(f32::from(event.position.x)))); |
| 572 | cx.stop_propagation(); | 576 | cx.stop_propagation(); |
| 573 | }) | 577 | }) |
| 578 | + .tooltip(crate::ui::widgets::tip_hover("Pan the timeline window", "drag", None)) | ||
| 574 | .children(hitmap::control(id, "Timeline viewport grip", true)) | 579 | .children(hitmap::control(id, "Timeline viewport grip", true)) |
| 575 | } | 580 | } |
| 576 | 581 | ||
| @@ -610,6 +615,7 @@ fn export_chip(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | |||
| 610 | } | 615 | } |
| 611 | cx.notify(); | 616 | cx.notify(); |
| 612 | })) | 617 | })) |
| 618 | + .tooltip(crate::ui::widgets::action_hover(player, if exporting { ActionId::CancelExport } else { ActionId::Export })) | ||
| 613 | .children(hitmap::action( | 619 | .children(hitmap::action( |
| 614 | if exporting { | 620 | if exporting { |
| 615 | ActionId::CancelExport | 621 | ActionId::CancelExport |
| @@ -928,6 +934,7 @@ fn save_verb(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | |||
| 928 | .on_click(cx.listener(|this, _: &ClickEvent, window, cx| { | 934 | .on_click(cx.listener(|this, _: &ClickEvent, window, cx| { |
| 929 | this.act(ActionId::Save, window, cx); | 935 | this.act(ActionId::Save, window, cx); |
| 930 | })) | 936 | })) |
| 937 | + .tooltip(crate::ui::widgets::action_hover(player, ActionId::Save)) | ||
| 931 | .children(hitmap::action( | 938 | .children(hitmap::action( |
| 932 | ActionId::Save, | 939 | ActionId::Save, |
| 933 | player.enable(ActionId::Save, None).yes(), | 940 | player.enable(ActionId::Save, None).yes(), |
crates/app/src/ui/widgets.rsmodified+54 -1
| @@ -122,6 +122,59 @@ pub(crate) fn dissolve_glyph() -> impl IntoElement { | |||
| 122 | .size_full() | 122 | .size_full() |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | +/// The hover line every control in the room wears (the user, 2026-09-09: | ||
| 126 | +/// "each and every button gets hover over information" -- nobody could name | ||
| 127 | +/// the band's own glyphs). One shape, built from the same pair the hitmap | ||
| 128 | +/// already names the control by: `<name> · <chord>`, DESIGN §4's "every | ||
| 129 | +/// command wears its chord" and §8's no-prose rule -- never a sentence. A | ||
| 130 | +/// control the current state refuses says *why* in the chord's place: naming | ||
| 131 | +/// a stroke that will not fire is the lie §4 forbids. | ||
| 132 | +pub(crate) fn tip_line(name: &str, chord: &str, why: Option<&str>) -> SharedString { | ||
| 133 | + match why { | ||
| 134 | + Some(why) => format!("{name} · {why}"), | ||
| 135 | + // `Keymap::chord`'s own "unbound" badge: a glyph with no stroke says | ||
| 136 | + // its name and stops, rather than wearing `--` as if that were one. | ||
| 137 | + None if chord.is_empty() || chord == "--" => name.to_string(), | ||
| 138 | + None => format!("{name} · {chord}"), | ||
| 139 | + } | ||
| 140 | + .into() | ||
| 141 | +} | ||
| 142 | + | ||
| 143 | +/// [`tip_line`] in the shape gpui's `.tooltip` takes. Every shared control | ||
| 144 | +/// constructor attaches this rather than building its own plate, which is | ||
| 145 | +/// what keeps the next control from shipping without a hover line. | ||
| 146 | +pub(crate) fn tip_hover( | ||
| 147 | + name: &str, | ||
| 148 | + chord: &str, | ||
| 149 | + why: Option<&str>, | ||
| 150 | +) -> impl Fn(&mut Window, &mut App) -> gpui::AnyView + use<> { | ||
| 151 | + let say = tip_line(name, chord, why); | ||
| 152 | + move |_, cx| cx.new(|_| Tip(say.clone())).into() | ||
| 153 | +} | ||
| 154 | + | ||
| 155 | +/// [`tip_hover`] for a control drawn *on* a card or a menu, where an | ||
| 156 | +/// ordinary [`Tip`] stands aside (`OVERLAID`) and would show nothing. | ||
| 157 | +pub(crate) fn overlay_tip_hover( | ||
| 158 | + name: &str, | ||
| 159 | + chord: &str, | ||
| 160 | + why: Option<&str>, | ||
| 161 | +) -> impl Fn(&mut Window, &mut App) -> gpui::AnyView + use<> { | ||
| 162 | + let say = tip_line(name, chord, why); | ||
| 163 | + move |_, cx| cx.new(|_| OverlayTip(say.clone())).into() | ||
| 164 | +} | ||
| 165 | + | ||
| 166 | +/// [`tip_hover`] for a control that dispatches an action: the name and the | ||
| 167 | +/// stroke are read live off the keymap and the enable state, so a rebind or | ||
| 168 | +/// a refusal can never leave a stale plate under the pointer. | ||
| 169 | +pub(crate) fn action_hover( | ||
| 170 | + player: &Player, | ||
| 171 | + action: ActionId, | ||
| 172 | +) -> impl Fn(&mut Window, &mut App) -> gpui::AnyView + use<> { | ||
| 173 | + let enabled = player.enable(action, None); | ||
| 174 | + let chord = player.keymap.chord(action); | ||
| 175 | + tip_hover(action.label(), &chord, enabled.why()) | ||
| 176 | +} | ||
| 177 | + | ||
| 125 | /// A toolbar button: its glyph, its name, and its key on hover. `id` only buys | 178 | /// A toolbar button: its glyph, its name, and its key on hover. `id` only buys |
| 126 | /// `on_click` and the tooltip -- it is still not focusable, so the root's own | 179 | /// `on_click` and the tooltip -- it is still not focusable, so the root's own |
| 127 | /// key listener keeps working after a press, and the click lands on mouse-up | 180 | /// key listener keeps working after a press, and the click lands on mouse-up |
| @@ -146,7 +199,7 @@ pub(crate) fn control( | |||
| 146 | on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, | 199 | on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, |
| 147 | ) -> impl IntoElement { | 200 | ) -> impl IntoElement { |
| 148 | let label = label.into(); | 201 | let label = label.into(); |
| 149 | - let tip: SharedString = format!("{label} — {shortcut}").into(); | 202 | + let tip = tip_line(&label, &shortcut, None); |
| 150 | div() | 203 | div() |
| 151 | .id(id) | 204 | .id(id) |
| 152 | .flex_none() | 205 | .flex_none() |