forge
Explore
Log in

Don't you dare go Hollow

Sources get their own colour and the ruler learns to count

Browse files at this commit

25a08e310c931f9b859a446fab7096257c3142faAhmet Kaan GümüşParent: 622904e
  • feat
    • sources get their own colour and the ruler learns to count
Show full message
✨ feat(ui): sources get their own colour and the ruler learns to count

The darkroom's source tints were four greys, so every source carried the
same non-identity and the mock's whole read — each film marking its own
dot, spine and waveform — could not happen. The family gets the real
twelve-hue wheel the language describes, stepped off the reference inks and
held in the contrast band; the other twelve palettes keep their own tints
untouched.

The bench ruler was a filled bar. It has ticks and MM:SS labels now, chosen
so they never crowd, with the playhead's own timecode pinned at its left
edge, and each lane head wears a dot in its first clip's ink.

The dock's import verbs stop lying: they carry real actions with real
chords. Add files takes ctrl+o, which the once-a-project proxy toggle gives
up to a command an editor runs all day. Paste path takes ctrl+l rather than
the mock's ctrl+v, which the timeline's own paste has earned. The tab
letters are gone rather than shown unbound — bare l and i belong to lift
and mark-in.
crates/app/src/keymap.rsmodified+39 -8
@@ -143,6 +143,13 @@ actions! {
143 /// track to that list places nothing -- the pair above it is what makes the143 /// track to that list places nothing -- the pair above it is what makes the
144 /// timeline row a caption can land on.144 /// timeline row a caption can land on.
145 ImportSubtitles,145 ImportSubtitles,
146+ /// The dock's own `Add files` verb (MOCK-SPEC "Dock" IMPORT section):
147+ /// the file chooser, same door [`crate::Player::pick_and_import`] and a
148+ /// drop on the window already use.
149+ AddFiles,
150+ /// The dock's `Paste path` verb: imports whatever file the OS clipboard
151+ /// names ([`crate::Player::paste_file_path`]).
152+ PasteFilePath,
146 ToggleMute,153 ToggleMute,
147 VolumeUp,154 VolumeUp,
148 VolumeDown,155 VolumeDown,
@@ -259,6 +266,8 @@ impl ActionId {
259 ActionId::AddSubtitleLane => "Add a subtitle track",266 ActionId::AddSubtitleLane => "Add a subtitle track",
260 ActionId::RemoveSubtitleLane => "Remove the last subtitle track (it must be empty)",267 ActionId::RemoveSubtitleLane => "Remove the last subtitle track (it must be empty)",
261 ActionId::ImportSubtitles => "Add subtitles from a file…",268 ActionId::ImportSubtitles => "Add subtitles from a file…",
269+ ActionId::AddFiles => "Add files…",
270+ ActionId::PasteFilePath => "Paste path (import the file it names)",
262 ActionId::ToggleMute => "Mute / Unmute",271 ActionId::ToggleMute => "Mute / Unmute",
263 ActionId::VolumeUp => "Volume up",272 ActionId::VolumeUp => "Volume up",
264 ActionId::VolumeDown => "Volume down",273 ActionId::VolumeDown => "Volume down",
@@ -335,6 +344,8 @@ impl ActionId {
335 ActionId::AddSubtitleLane => "add-subtitle-lane",344 ActionId::AddSubtitleLane => "add-subtitle-lane",
336 ActionId::RemoveSubtitleLane => "remove-subtitle-lane",345 ActionId::RemoveSubtitleLane => "remove-subtitle-lane",
337 ActionId::ImportSubtitles => "import-subtitles",346 ActionId::ImportSubtitles => "import-subtitles",
347+ ActionId::AddFiles => "add-files",
348+ ActionId::PasteFilePath => "paste-file-path",
338 ActionId::ToggleMute => "toggle-mute",349 ActionId::ToggleMute => "toggle-mute",
339 ActionId::VolumeUp => "volume-up",350 ActionId::VolumeUp => "volume-up",
340 ActionId::VolumeDown => "volume-down",351 ActionId::VolumeDown => "volume-down",
@@ -479,7 +490,11 @@ impl ActionId {
479 // It writes a file like the three above it, and touches no edit490 // It writes a file like the three above it, and touches no edit
480 // list -- what an export's own allow-list already means it stays491 // list -- what an export's own allow-list already means it stays
481 // out of, not what puts it in this heading.492 // out of, not what puts it in this heading.
482- | ActionId::Screenshot => Category::File,493+ | ActionId::Screenshot
494+ // The dock's import pair brings a file *in*, the same heading a
495+ // file going *out* (Export, Save) already sits under.
496+ | ActionId::AddFiles
497+ | ActionId::PasteFilePath => Category::File,
483 }498 }
484 }499 }
485 }500 }
@@ -1066,6 +1081,18 @@ impl Keymap {
1066 // track to the timeline, so it is not the bare "s": ctrl+i, the1081 // track to the timeline, so it is not the bare "s": ctrl+i, the
1067 // i of import, free and next to nothing that deletes.1082 // i of import, free and next to nothing that deletes.
1068 b(ActionId::ImportSubtitles, "i", true),1083 b(ActionId::ImportSubtitles, "i", true),
1084+ // The dock's own import pair (MOCK-SPEC "Dock" IMPORT
1085+ // section). Add files takes the chord the mock draws, ^o
1086+ // (freed above): it is the burst-use command an editor
1087+ // reaches for constantly, where the setting it displaces is
1088+ // thrown once a project. Paste path stays off ^v -- that
1089+ // chord is the timeline's own Paste, asked for far more
1090+ // often while cutting than a clipboard path is pasted while
1091+ // importing -- and takes ctrl+l instead, the browser's own
1092+ // "go to this location" chord, which is what pasting a path
1093+ // to jump straight to a file already is.
1094+ b(ActionId::AddFiles, "o", true),
1095+ b(ActionId::PasteFilePath, "l", true),
1069 b(ActionId::ToggleMute, "m", false),1096 b(ActionId::ToggleMute, "m", false),
1070 // The unshifted pair, which is what gpui reports for those two1097 // The unshifted pair, which is what gpui reports for those two
1071 // keys ("=" and "-", platform.rs:862): the volume keys every1098 // keys ("=" and "-", platform.rs:862): the volume keys every
@@ -1123,11 +1150,13 @@ impl Keymap {
1123 // thrown once for a whole session rather than one wanted under1150 // thrown once for a whole session rather than one wanted under
1124 // a hand -- the theme takes ctrl+h for that reason.1151 // a hand -- the theme takes ctrl+h for that reason.
1125 b(ActionId::ToggleProxies, "p", true),1152 b(ActionId::ToggleProxies, "p", true),
1126- // Making them takes the key next to it, ctrl+o: the pair is one1153+ // ctrl+o moved to Add files (below, with `ImportSubtitles` --
1127- // subject and the two chords are under the same finger, and1154+ // display order follows [`ActionId::ALL`]) per DESIGN §11's
1128- // every letter of the word itself is spoken for ("a" adds an1155+ // frequency check: a burst-use import command over a
1129- // audio lane, ctrl+a selects everything).1156+ // once-a-project setting. The auto-proxy switch takes "m"
1130- b(ActionId::ToggleAutoProxies, "o", true),1157+ // instead, free and still a stand-in word ("make" -- what
1158+ // the switch decides is whether one gets made on import).
1159+ b(ActionId::ToggleAutoProxies, "m", true),
1131 // The theme takes ctrl+h -- the h of the word, since "t" is the1160 // The theme takes ctrl+h -- the h of the word, since "t" is the
1132 // subtitles and ctrl+t takes one off -- and a ctrl chord because1161 // subtitles and ctrl+t takes one off -- and a ctrl chord because
1133 // it is a preference set once, not a stroke wanted under a hand1162 // it is a preference set once, not a stroke wanted under a hand
@@ -1420,7 +1449,7 @@ mod tests {
1420 #[test]1449 #[test]
1421 fn every_default_stroke_reaches_its_action() {1450 fn every_default_stroke_reaches_its_action() {
1422 let k = Keymap::defaults();1451 let k = Keymap::defaults();
1423- assert_eq!(k.entries().len(), 71);1452+ assert_eq!(k.entries().len(), 73);
1424 // The cut odometer: bare walks one, `<`/`>` (what shift+,/shift+.1453 // The cut odometer: bare walks one, `<`/`>` (what shift+,/shift+.
1425 // actually type) strides ten.1454 // actually type) strides ten.
1426 assert_eq!(k.lookup(".", false), Some(ActionId::WalkCutNext));1455 assert_eq!(k.lookup(".", false), Some(ActionId::WalkCutNext));
@@ -1435,7 +1464,9 @@ mod tests {
1435 assert_eq!(k.lookup("w", false), Some(ActionId::Screenshot));1464 assert_eq!(k.lookup("w", false), Some(ActionId::Screenshot));
1436 assert_eq!(k.lookup("y", false), Some(ActionId::SubtitleStyle));1465 assert_eq!(k.lookup("y", false), Some(ActionId::SubtitleStyle));
1437 assert_eq!(k.lookup("p", true), Some(ActionId::ToggleProxies));1466 assert_eq!(k.lookup("p", true), Some(ActionId::ToggleProxies));
1438- assert_eq!(k.lookup("o", true), Some(ActionId::ToggleAutoProxies));1467+ assert_eq!(k.lookup("m", true), Some(ActionId::ToggleAutoProxies));
1468+ assert_eq!(k.lookup("o", true), Some(ActionId::AddFiles));
1469+ assert_eq!(k.lookup("l", true), Some(ActionId::PasteFilePath));
1439 assert_eq!(k.lookup("?", false), Some(ActionId::ShowActions));1470 assert_eq!(k.lookup("?", false), Some(ActionId::ShowActions));
1440 assert_eq!(k.lookup("h", true), Some(ActionId::Theme));1471 assert_eq!(k.lookup("h", true), Some(ActionId::Theme));
1441 assert_eq!(k.lookup("space", false), Some(ActionId::Play));1472 assert_eq!(k.lookup("space", false), Some(ActionId::Play));
crates/app/src/oracle.rsmodified+5 -0
@@ -132,6 +132,11 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {
132 // (`Player::pending_settings`), so refusing them before the first132 // (`Player::pending_settings`), so refusing them before the first
133 // file was refusing them exactly when they mean the most.133 // file was refusing them exactly when they mean the most.
134 | ActionId::Resolution134 | ActionId::Resolution
135+ // The dock's import pair: how a first file gets in at all, so
136+ // both are live with no timeline open, exactly like the two
137+ // stand-in switches above.
138+ | ActionId::AddFiles
139+ | ActionId::PasteFilePath
135 ) {140 ) {
136 return match ctx.exporting {141 return match ctx.exporting {
137 true => Enable::No("an export is running"),142 true => Enable::No("an export is running"),
crates/app/src/player/actions.rsmodified+2 -0
@@ -127,6 +127,8 @@ impl Player {
127 // The chooser the palette's own button opens: a file's tracks into127 // The chooser the palette's own button opens: a file's tracks into
128 // the list, the file itself joining nothing.128 // the list, the file itself joining nothing.
129 ActionId::ImportSubtitles => self.pick_and_add_subtitles(cx),129 ActionId::ImportSubtitles => self.pick_and_add_subtitles(cx),
130+ ActionId::AddFiles => self.pick_and_import(cx),
131+ ActionId::PasteFilePath => self.paste_file_path(cx),
130 ActionId::ToggleMute => self.set_volume(|volume| volume.muted = !volume.muted, cx),132 ActionId::ToggleMute => self.set_volume(|volume| volume.muted = !volume.muted, cx),
131 ActionId::VolumeUp => self.set_volume(|volume| volume.step(true), cx),133 ActionId::VolumeUp => self.set_volume(|volume| volume.step(true), cx),
132 ActionId::VolumeDown => self.set_volume(|volume| volume.step(false), cx),134 ActionId::VolumeDown => self.set_volume(|volume| volume.step(false), cx),
crates/app/src/tests/layout.rsmodified+22 -0
@@ -1004,6 +1004,16 @@ fn source_tints_are_all_discernible() {
1004 apart(tint, p.BG_RAISED)1004 apart(tint, p.BG_RAISED)
1005 );1005 );
1006 for (j, &other) in p.SOURCE_TINTS.iter().enumerate().skip(i + 1) {1006 for (j, &other) in p.SOURCE_TINTS.iter().enumerate().skip(i + 1) {
1007+ // The eleven non-darkroom families still cycle four tuned
1008+ // tints through the 12-wide wheel (`source_tint`'s own `%
1009+ // len()` reads them back identically either way) -- a
1010+ // literal repeat there is the intended cycle, not a
1011+ // collision, so it is skipped rather than failed. Darkroom's
1012+ // own twelve (DESIGN §2) are twelve *different* hues and
1013+ // never repeat, so a real collision there still fails this.
1014+ if tint == other {
1015+ continue;
1016+ }
1007 assert!(1017 assert!(
1008 apart(tint, other) >= 16,1018 apart(tint, other) >= 16,
1009 "{id:?} tints {i} and {j} are only {} apart",1019 "{id:?} tints {i} and {j} are only {} apart",
@@ -1016,6 +1026,18 @@ fn source_tints_are_all_discernible() {
1016 // the second.1026 // the second.
1017 assert!(apart(p.SOURCE_TINTS[0], p.SOURCE_TINTS[1]) >= 32, "{id:?}");1027 assert!(apart(p.SOURCE_TINTS[0], p.SOURCE_TINTS[1]) >= 32, "{id:?}");
1018 }1028 }
1029+ // Darkroom's own 12-hue wheel (DESIGN §2/§12 step 5's hook): every one
1030+ // of the twelve is a genuinely different hue, not four repeated three
1031+ // times like the other families still cycle -- a hue accidentally
1032+ // reintroduced by a future edit here is the "four shades of grey" bug
1033+ // this task exists to fix, so it fails loudly rather than skip past the
1034+ // `tint == other` escape hatch above.
1035+ let dr = crate::ui::theme::PaletteId::Darkroom.palette();
1036+ for (i, &a) in dr.SOURCE_TINTS.iter().enumerate() {
1037+ for (j, &b) in dr.SOURCE_TINTS.iter().enumerate().skip(i + 1) {
1038+ assert_ne!(a, b, "darkroom tints {i} and {j} collide");
1039+ }
1040+ }
1019 }1041 }
1020 1042
1021 /// A `.srt` dropped on the window is nobody's stream: it has no source1043 /// A `.srt` dropped on the window is nobody's stream: it has no source
crates/app/src/ui/bench_stance.rsmodified+104 -13
@@ -29,8 +29,22 @@
29 29
30 use crate::*;30 use crate::*;
31 31
32-/// The pinned ruler's own height, above the lane stack.32+/// The pinned ruler's own height, above the lane stack -- tall enough for a
33-const RULER_H: f32 = 10.;33+/// tick line plus a mono `MM:SS` label under it (DESIGN §5's "tick marks with
34+/// mono ink3 timecodes").
35+const RULER_H: f32 = 22.;
36+/// The stops a tick interval is picked from (DESIGN §5, the previous
37+/// builder's own note): the smallest one whose pixel width at the current
38+/// zoom still clears [`TICK_MIN_PX`].
39+const TICK_STOPS: [f64; 13] = [
40+ 0.5, 1., 2., 5., 10., 15., 30., 60., 120., 300., 600., 1800., 3600.,
41+];
42+/// The floor a tick's pixel spacing must clear before its label is legible
43+/// mono text at 8px.
44+const TICK_MIN_PX: f64 = 64.;
45+/// The playhead timecode plate's own width, wide enough for `HH:MM:SS:FF`
46+/// mono at 10px plus the plate's padding.
47+const PLATE_W: f32 = 74.;
34 /// The pinned track-head column, DESIGN §5's "track heads" -- narrower than48 /// The pinned track-head column, DESIGN §5's "track heads" -- narrower than
35 /// the legacy timeline's `HEADER_W` since a darkroom lane carries no mix/eye49 /// the legacy timeline's `HEADER_W` since a darkroom lane carries no mix/eye
36 /// button yet (deferred with the rest of the header's verbs).50 /// button yet (deferred with the rest of the header's verbs).
@@ -68,6 +82,27 @@ fn mmss(secs: f64) -> String {
68 format!("{}:{:02}", s / 60, s % 60)82 format!("{}:{:02}", s / 60, s % 60)
69 }83 }
70 84
85+/// `MM:SS` zero-padded on both fields, the ruler's own tick label (mock:
86+/// `00:30`, `01:00`, `01:30`) -- distinct from [`mmss`]'s unpadded minutes,
87+/// which reads right in a trim delta but not lined up under evenly spaced
88+/// ticks.
89+fn tick_mmss(secs: f64) -> String {
90+ let s = secs.max(0.).round() as u64;
91+ format!("{:02}:{:02}", s / 60, s % 60)
92+}
93+
94+/// The tick spacing at `pps` pixels per second: the smallest [`TICK_STOPS`]
95+/// entry whose pixel width still clears [`TICK_MIN_PX`], so labels never
96+/// crowd into soup as the bed zooms in and never thin to nothing zoomed out
97+/// (the far stop, an hour, is the last one there is).
98+fn tick_interval(pps: f64) -> f64 {
99+ TICK_STOPS
100+ .iter()
101+ .copied()
102+ .find(|&i| i * pps >= TICK_MIN_PX)
103+ .unwrap_or(3600.)
104+}
105+
71 /// A clip's thumbnail, filling its box. `Cover` rather than `Contain`: a clip106 /// A clip's thumbnail, filling its box. `Cover` rather than `Contain`: a clip
72 /// is a strip of film, so it crops rather than letterboxing inside a lane.107 /// is a strip of film, so it crops rather than letterboxing inside a lane.
73 fn cover_image(image: std::sync::Arc<gpui::RenderImage>) -> impl IntoElement {108 fn cover_image(image: std::sync::Arc<gpui::RenderImage>) -> impl IntoElement {
@@ -302,6 +337,12 @@ fn lane_row(
302 .enumerate()337 .enumerate()
303 .map(|(idx, clip)| clip_box(player, lane, idx, clip, scale, picks, pick_links, cx))338 .map(|(idx, clip)| clip_box(player, lane, idx, clip, scale, picks, pick_links, cx))
304 .collect();339 .collect();
340+ // DESIGN §5's lane heads: "a small ink dot under each head, coloured by
341+ // the lane's source ink" -- the first clip's source stands for the lane,
342+ // since a lane with several sources still needs one dot, not a legend.
343+ let dot = clips
344+ .first()
345+ .map_or_else(INK4, |clip| source_tint(clip.source));
305 div()346 div()
306 .id(("bench-lane", lane.ord * 10 + lane.kind as usize))347 .id(("bench-lane", lane.ord * 10 + lane.kind as usize))
307 .flex_none()348 .flex_none()
@@ -314,12 +355,15 @@ fn lane_row(
314 .w(px(HEAD_W))355 .w(px(HEAD_W))
315 .h_full()356 .h_full()
316 .flex()357 .flex()
358+ .flex_col()
317 .items_center()359 .items_center()
318 .justify_center()360 .justify_center()
361+ .gap(px(2.))
319 .bg(rgb(DARK_PANEL()))362 .bg(rgb(DARK_PANEL()))
320 .text_size(px(9.5))363 .text_size(px(9.5))
321 .text_color(rgb(INK2()))364 .text_color(rgb(INK2()))
322- .child(lane.label()),365+ .child(lane.label())
366+ .child(div().flex_none().w(px(4.)).h(px(4.)).rounded(px(2.)).bg(rgb(dot))),
323 )367 )
324 .child(368 .child(
325 // The bed: a drop target for the Sources tab (`AssetDrag`,369 // The bed: a drop target for the Sources tab (`AssetDrag`,
@@ -359,6 +403,21 @@ pub(crate) fn render(player: &mut Player, box_h: f32, cx: &mut Context<Player>)
359 for &lane in &lanes {403 for &lane in &lanes {
360 rows.push(lane_row(player, lane, h, scale, &picks, &pick_links, cx));404 rows.push(lane_row(player, lane, h, scale, &picks, &pick_links, cx));
361 }405 }
406+ // Ruler ticks (DESIGN §5): the interval is the smallest [`TICK_STOPS`]
407+ // entry whose pixel spacing still clears [`TICK_MIN_PX`], walked from the
408+ // first tick at or after the bed's left edge to the bed's right edge.
409+ // Guarded on `pps > 0` -- a zero scale (no session yet) has no interval
410+ // that ever advances past the bed's own width, which would loop forever.
411+ let mut ticks = Vec::new();
412+ if scale.pps > 0. {
413+ let interval = tick_interval(scale.pps);
414+ let mut t = (scale.start / interval).ceil() * interval;
415+ while scale.px_at(t) <= bed_w {
416+ ticks.push((scale.px_at(t).max(0.), tick_mmss(t)));
417+ t += interval;
418+ }
419+ }
420+ let playhead_tc = crate::viewport::timecode(position, player.fps);
362 div()421 div()
363 .id("bench-content")422 .id("bench-content")
364 .flex_1()423 .flex_1()
@@ -369,9 +428,10 @@ pub(crate) fn render(player: &mut Player, box_h: f32, cx: &mut Context<Player>)
369 .gap(px(ROW_GAP))428 .gap(px(ROW_GAP))
370 .child(429 .child(
371 // Pinned ruler: click/drag to seek (reuses `Player::scrub_to`,430 // Pinned ruler: click/drag to seek (reuses `Player::scrub_to`,
372- // the same call the legacy ruler makes), the playhead's own431+ // the same call the legacy ruler makes), tick marks with mono
373- // lamp-white line (DESIGN §1 law 3 -- the only other legal use432+ // `ink3` timecodes (DESIGN §5), and the playhead's own lamp-white
374- // of pure white besides the splice).433+ // line (DESIGN §1 law 3 -- the only other legal use of pure
434+ // white besides the splice).
375 div()435 div()
376 .id("bench-ruler")436 .id("bench-ruler")
377 .flex_none()437 .flex_none()
@@ -379,7 +439,7 @@ pub(crate) fn render(player: &mut Player, box_h: f32, cx: &mut Context<Player>)
379 .ml(px(HEAD_W))439 .ml(px(HEAD_W))
380 .relative()440 .relative()
381 .rounded(px(2.))441 .rounded(px(2.))
382- .bg(rgb(DARK_HAIRLINE()))442+ .bg(rgb(DARK_PANEL()))
383 .cursor_pointer()443 .cursor_pointer()
384 .child(bounds_probe(player.ruler.clone()))444 .child(bounds_probe(player.ruler.clone()))
385 .on_mouse_down(445 .on_mouse_down(
@@ -389,13 +449,25 @@ pub(crate) fn render(player: &mut Player, box_h: f32, cx: &mut Context<Player>)
389 this.scrub_to(event.position.x, true, cx);449 this.scrub_to(event.position.x, true, cx);
390 }),450 }),
391 )451 )
392- .child(452+ .children(ticks.into_iter().map(|(x, label)| {
393 div()453 div()
394- .h_full()454+ .absolute()
395- .w(px(filled))455+ .top_0()
396- .rounded(px(2.))456+ .left(px(x))
397- .bg(rgb(INK1())),457+ .child(
398- )458+ div()
459+ .flex()
460+ .flex_col()
461+ .items_start()
462+ .child(div().w(px(1.)).h(px(4.)).bg(rgb(INK3())))
463+ .child(
464+ div()
465+ .text_size(px(8.))
466+ .text_color(rgb(INK3()))
467+ .child(label),
468+ ),
469+ )
470+ }))
399 .child(471 .child(
400 div()472 div()
401 .absolute()473 .absolute()
@@ -404,6 +476,25 @@ pub(crate) fn render(player: &mut Player, box_h: f32, cx: &mut Context<Player>)
404 .left(px(filled))476 .left(px(filled))
405 .w(px(1.))477 .w(px(1.))
406 .bg(rgb(LAMP_WHITE())),478 .bg(rgb(LAMP_WHITE())),
479+ )
480+ .child(
481+ // The pinned playhead timecode plate, DESIGN §5's own
482+ // "playhead's own timecode in a plate at the left edge" --
483+ // always at `left_0`, never following the scrubbed x, so
484+ // it never overlaps the picture region above it.
485+ div()
486+ .absolute()
487+ .top_0()
488+ .left_0()
489+ .h_full()
490+ .w(px(PLATE_W))
491+ .flex()
492+ .items_center()
493+ .px(px(4.))
494+ .bg(rgb(DARK_CANVAS()))
495+ .text_size(px(10.))
496+ .text_color(rgb(INK1()))
497+ .child(playhead_tc),
407 ),498 ),
408 )499 )
409 .child(500 .child(
crates/app/src/ui/dock_stance.rsmodified+17 -52
@@ -116,53 +116,15 @@ fn ghost_verb(
116 )116 )
117 }117 }
118 118
119-/// A row in the IMPORT section: a ghost verb that has no [`ActionId`] of its
120-/// own to read a chord off. `Add files`/`Paste path` have no keymap binding
121-/// -- nearly every ctrl+letter in this editor's table is already spoken for
122-/// (`git grep '", true)'` in `keymap.rs` turns up every letter but a handful),
123-/// and giving either one a fresh global chord is a keymap-wide decision --
124-/// which strokes move, which don't -- outside one dock diff. The verb still
125-/// works by click; the chord badge is honest about there being none rather
126-/// than inventing one MOCK-SPEC's `^o`/`^v` never actually bind to.
127-///
128-/// corner-cut: no chord. Ceiling: a keymap diff that clears two ctrl slots
129-/// (or two bare ones -- neither Import nor "paste a path" has ever had a key
130-/// in this editor) and threads `ActionId`s for both through `oracle::enable`
131-/// and `Player::act`, at which point this calls [`ghost_verb`] instead.
132-fn import_verb(
133- id: &'static str,
134- label: &'static str,
135- hint: &'static str,
136- on: bool,
137- on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
138-) -> impl IntoElement {
139- div()
140- .id(id)
141- .flex_none()
142- .flex()
143- .items_center()
144- .justify_between()
145- .h(px(CONTROL_H))
146- .px(px(8.))
147- .rounded(px(3.))
148- .text_color(rgb(INK2()))
149- .tooltip(move |_, cx| cx.new(|_| Tip(hint.into())).into())
150- .when(!on, |d| d.opacity(0.4).cursor_not_allowed())
151- .when(on, |d| {
152- d.cursor_pointer()
153- .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1())))
154- .on_click(on_click)
155- })
156- .child(label)
157- .child(div().flex_none().text_size(px(9.5)).text_color(rgb(INK3())).child("—"))
158-}
159-
160 /// One tab of the Src/Clip pair (MOCK-SPEC "Dock": no pill, no fill, no119 /// One tab of the Src/Clip pair (MOCK-SPEC "Dock": no pill, no fill, no
161 /// rounded button -- a 1px `ink1` top rule and `ink1` text mark the showing120 /// rounded button -- a 1px `ink1` top rule and `ink1` text mark the showing
162-/// tab; the resting one is `ink3`). `chord` is decorative, not bound: tab121+/// tab; the resting one is `ink3`). The mock's own trailing letters (`L`,
163-/// switching has no gesture named in the charter's four, so it is drawn but122+/// `I`) are dropped rather than bound: both bare keys are already this
164-/// not wired to a global key, exactly `import_verb`'s reasoning above.123+/// editor's own busiest edit strokes (`l` lifts a clip, `i` marks in), and
165-fn dock_tab(id: &'static str, label: &'static str, chord: &'static str, active: bool, cx: &mut Context<Player>) -> impl IntoElement {124+/// DESIGN §11's frequency check puts a lift and a mark far ahead of a tab
125+/// switch -- wearing a chord this room does not answer to would be exactly
126+/// the lie DESIGN §4 forbids, so the letters go instead.
127+fn dock_tab(id: &'static str, label: &'static str, active: bool, cx: &mut Context<Player>) -> impl IntoElement {
166 div()128 div()
167 .id(id)129 .id(id)
168 .flex_1()130 .flex_1()
@@ -187,7 +149,6 @@ fn dock_tab(id: &'static str, label: &'static str, chord: &'static str, active:
187 .text_color(rgb(if active { INK1() } else { INK3() }))149 .text_color(rgb(if active { INK1() } else { INK3() }))
188 .child(label),150 .child(label),
189 )151 )
190- .child(div().text_color(rgb(INK3())).child(chord))
191 }152 }
192 153
193 /// A 9px uppercase Archivo section head, `ink3` (DESIGN §3).154 /// A 9px uppercase Archivo section head, `ink3` (DESIGN §3).
@@ -463,18 +424,22 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
463 .flex_none()424 .flex_none()
464 .flex()425 .flex()
465 .flex_col()426 .flex_col()
466- .child(import_verb(427+ .child(ghost_verb(
467 "dock-import-files",428 "dock-import-files",
468 "Add files",429 "Add files",
430+ ActionId::AddFiles,
431+ false,
469 "adds a file to this list — or drop one on the window",432 "adds a file to this list — or drop one on the window",
470- player.exporting().is_none(),433+ player,
471 cx.listener(|this, _: &ClickEvent, _, cx| this.pick_and_import(cx)),434 cx.listener(|this, _: &ClickEvent, _, cx| this.pick_and_import(cx)),
472 ))435 ))
473- .child(import_verb(436+ .child(ghost_verb(
474 "dock-paste-path",437 "dock-paste-path",
475 "Paste path",438 "Paste path",
439+ ActionId::PasteFilePath,
440+ false,
476 "imports the file named on the clipboard",441 "imports the file named on the clipboard",
477- player.exporting().is_none(),442+ player,
478 cx.listener(|this, _: &ClickEvent, _, cx| this.paste_file_path(cx)),443 cx.listener(|this, _: &ClickEvent, _, cx| this.paste_file_path(cx)),
479 )),444 )),
480 )445 )
@@ -610,8 +575,8 @@ pub(crate) fn render(player: &Player, width: f32, window_h: Pixels, cx: &mut Con
610 .px(px(8.))575 .px(px(8.))
611 .border_b_1()576 .border_b_1()
612 .border_color(rgb(DARK_HAIRLINE()))577 .border_color(rgb(DARK_HAIRLINE()))
613- .child(dock_tab("dock-tab-src", "SOURCES", "L", src_active, cx))578+ .child(dock_tab("dock-tab-src", "SOURCES", src_active, cx))
614- .child(dock_tab("dock-tab-clip", "CLIP", "I", !src_active, cx)),579+ .child(dock_tab("dock-tab-clip", "CLIP", !src_active, cx)),
615 )580 )
616 .child(match src_active {581 .child(match src_active {
617 true => sources_tab(player, cx).into_any_element(),582 true => sources_tab(player, cx).into_any_element(),
crates/app/src/ui/theme.rsmodified+25 -14
@@ -117,7 +117,7 @@ palette! {
117 CLIP_AUDIO: u32,117 CLIP_AUDIO: u32,
118 CLIP_IMAGE: u32,118 CLIP_IMAGE: u32,
119 CLIP_TEXT: u32,119 CLIP_TEXT: u32,
120- SOURCE_TINTS: [u32; 4],120+ SOURCE_TINTS: [u32; 12],
121 STATUS_ERROR: u32,121 STATUS_ERROR: u32,
122 STATUS_WARNING: u32,122 STATUS_WARNING: u32,
123 STATUS_SUCCESS: u32,123 STATUS_SUCCESS: u32,
@@ -377,7 +377,7 @@ pub mod cool {
377 /// from somewhere else than its neighbour. The *kind* is the body colour now377 /// from somewhere else than its neighbour. The *kind* is the body colour now
378 /// ([`super::clip_kind`]); this is the identity stripe and the library378 /// ([`super::clip_kind`]); this is the identity stripe and the library
379 /// swatch, and it only has to be four things telling each other apart.379 /// swatch, and it only has to be four things telling each other apart.
380- pub const SOURCE_TINTS: [u32; 4] = [0x4f8fd6, 0xd69a4f, 0x4fd6a8, 0xb14fd6];380+ pub const SOURCE_TINTS: [u32; 12] = [0x4f8fd6, 0xd69a4f, 0x4fd6a8, 0xb14fd6, 0x4f8fd6, 0xd69a4f, 0x4fd6a8, 0xb14fd6, 0x4f8fd6, 0xd69a4f, 0x4fd6a8, 0xb14fd6];
381 381
382 // -- feedback ---------------------------------------------------------------382 // -- feedback ---------------------------------------------------------------
383 pub const STATUS_ERROR: u32 = 0xef4444;383 pub const STATUS_ERROR: u32 = 0xef4444;
@@ -459,7 +459,7 @@ pub mod warm {
459 459
460 /// Warm-side identity stripes: the same four-way distinctness the cool460 /// Warm-side identity stripes: the same four-way distinctness the cool
461 /// family's are held to, in hues that belong to this ground.461 /// family's are held to, in hues that belong to this ground.
462- pub const SOURCE_TINTS: [u32; 4] = [0xe08a4f, 0x4fa8d6, 0x8fc94f, 0xd67aa8];462+ pub const SOURCE_TINTS: [u32; 12] = [0xe08a4f, 0x4fa8d6, 0x8fc94f, 0xd67aa8, 0xe08a4f, 0x4fa8d6, 0x8fc94f, 0xd67aa8, 0xe08a4f, 0x4fa8d6, 0x8fc94f, 0xd67aa8];
463 463
464 // -- feedback ---------------------------------------------------------------464 // -- feedback ---------------------------------------------------------------
465 pub const STATUS_ERROR: u32 = 0xc85050;465 pub const STATUS_ERROR: u32 = 0xc85050;
@@ -539,7 +539,7 @@ pub mod forest {
539 pub const CLIP_IMAGE: u32 = 0x1a6a6a;539 pub const CLIP_IMAGE: u32 = 0x1a6a6a;
540 pub const CLIP_TEXT: u32 = 0x6b46c1;540 pub const CLIP_TEXT: u32 = 0x6b46c1;
541 541
542- pub const SOURCE_TINTS: [u32; 4] = [0x5fd68f, 0xd6a45f, 0x5fa8d6, 0xc15fd6];542+ pub const SOURCE_TINTS: [u32; 12] = [0x5fd68f, 0xd6a45f, 0x5fa8d6, 0xc15fd6, 0x5fd68f, 0xd6a45f, 0x5fa8d6, 0xc15fd6, 0x5fd68f, 0xd6a45f, 0x5fa8d6, 0xc15fd6];
543 543
544 // -- feedback ---------------------------------------------------------------544 // -- feedback ---------------------------------------------------------------
545 /// Not the accent family: a success that wore the emerald would say "this is545 /// Not the accent family: a success that wore the emerald would say "this is
@@ -618,7 +618,7 @@ pub mod violet {
618 /// be the same purple.618 /// be the same purple.
619 pub const CLIP_TEXT: u32 = 0x6d3fa8;619 pub const CLIP_TEXT: u32 = 0x6d3fa8;
620 620
621- pub const SOURCE_TINTS: [u32; 4] = [0x9b7fe8, 0xe8a97f, 0x7fc8e8, 0xe87fb4];621+ pub const SOURCE_TINTS: [u32; 12] = [0x9b7fe8, 0xe8a97f, 0x7fc8e8, 0xe87fb4, 0x9b7fe8, 0xe8a97f, 0x7fc8e8, 0xe87fb4, 0x9b7fe8, 0xe8a97f, 0x7fc8e8, 0xe87fb4];
622 622
623 // -- feedback ---------------------------------------------------------------623 // -- feedback ---------------------------------------------------------------
624 pub const STATUS_ERROR: u32 = 0xf87171;624 pub const STATUS_ERROR: u32 = 0xf87171;
@@ -691,7 +691,7 @@ pub mod rose {
691 pub const CLIP_IMAGE: u32 = 0x1c6270;691 pub const CLIP_IMAGE: u32 = 0x1c6270;
692 pub const CLIP_TEXT: u32 = 0x6b46c1;692 pub const CLIP_TEXT: u32 = 0x6b46c1;
693 693
694- pub const SOURCE_TINTS: [u32; 4] = [0xe87f97, 0x7fc8e8, 0xe8c87f, 0x9b7fe8];694+ pub const SOURCE_TINTS: [u32; 12] = [0xe87f97, 0x7fc8e8, 0xe8c87f, 0x9b7fe8, 0xe87f97, 0x7fc8e8, 0xe8c87f, 0x9b7fe8, 0xe87f97, 0x7fc8e8, 0xe8c87f, 0x9b7fe8];
695 695
696 // -- feedback ---------------------------------------------------------------696 // -- feedback ---------------------------------------------------------------
697 /// Brighter and more saturated than the accent it sits near on the wheel: on697 /// Brighter and more saturated than the accent it sits near on the wheel: on
@@ -768,7 +768,7 @@ pub mod amber {
768 pub const CLIP_IMAGE: u32 = 0x1c6270;768 pub const CLIP_IMAGE: u32 = 0x1c6270;
769 pub const CLIP_TEXT: u32 = 0x6b46c1;769 pub const CLIP_TEXT: u32 = 0x6b46c1;
770 770
771- pub const SOURCE_TINTS: [u32; 4] = [0xe8b45f, 0x5fa8e8, 0x7fd69b, 0xd68fc1];771+ pub const SOURCE_TINTS: [u32; 12] = [0xe8b45f, 0x5fa8e8, 0x7fd69b, 0xd68fc1, 0xe8b45f, 0x5fa8e8, 0x7fd69b, 0xd68fc1, 0xe8b45f, 0x5fa8e8, 0x7fd69b, 0xd68fc1];
772 772
773 // -- feedback ---------------------------------------------------------------773 // -- feedback ---------------------------------------------------------------
774 /// The warning steps to orange: amber *is* the accent here, and a warning774 /// The warning steps to orange: amber *is* the accent here, and a warning
@@ -843,7 +843,7 @@ pub mod ocean {
843 pub const CLIP_IMAGE: u32 = 0x1c6270;843 pub const CLIP_IMAGE: u32 = 0x1c6270;
844 pub const CLIP_TEXT: u32 = 0x6b46c1;844 pub const CLIP_TEXT: u32 = 0x6b46c1;
845 845
846- pub const SOURCE_TINTS: [u32; 4] = [0x5fa8e8, 0xe8a95f, 0x5fd6a0, 0xc98fe8];846+ pub const SOURCE_TINTS: [u32; 12] = [0x5fa8e8, 0xe8a95f, 0x5fd6a0, 0xc98fe8, 0x5fa8e8, 0xe8a95f, 0x5fd6a0, 0xc98fe8, 0x5fa8e8, 0xe8a95f, 0x5fd6a0, 0xc98fe8];
847 847
848 // -- feedback ---------------------------------------------------------------848 // -- feedback ---------------------------------------------------------------
849 pub const STATUS_ERROR: u32 = 0xf05252;849 pub const STATUS_ERROR: u32 = 0xf05252;
@@ -919,7 +919,7 @@ pub mod ice {
919 pub const CLIP_IMAGE: u32 = 0x1c6270;919 pub const CLIP_IMAGE: u32 = 0x1c6270;
920 pub const CLIP_TEXT: u32 = 0x6b46c1;920 pub const CLIP_TEXT: u32 = 0x6b46c1;
921 921
922- pub const SOURCE_TINTS: [u32; 4] = [0x7fd6e8, 0xe8b47f, 0x8fd69b, 0xc79be8];922+ pub const SOURCE_TINTS: [u32; 12] = [0x7fd6e8, 0xe8b47f, 0x8fd69b, 0xc79be8, 0x7fd6e8, 0xe8b47f, 0x8fd69b, 0xc79be8, 0x7fd6e8, 0xe8b47f, 0x8fd69b, 0xc79be8];
923 923
924 // -- feedback ---------------------------------------------------------------924 // -- feedback ---------------------------------------------------------------
925 pub const STATUS_ERROR: u32 = 0xff6b6b;925 pub const STATUS_ERROR: u32 = 0xff6b6b;
@@ -993,7 +993,7 @@ pub mod orchid {
993 pub const CLIP_IMAGE: u32 = 0x1c6270;993 pub const CLIP_IMAGE: u32 = 0x1c6270;
994 pub const CLIP_TEXT: u32 = 0x5a45b8;994 pub const CLIP_TEXT: u32 = 0x5a45b8;
995 995
996- pub const SOURCE_TINTS: [u32; 4] = [0xe88fd6, 0x8fc9e8, 0xe8c48f, 0x8fe8b4];996+ pub const SOURCE_TINTS: [u32; 12] = [0xe88fd6, 0x8fc9e8, 0xe8c48f, 0x8fe8b4, 0xe88fd6, 0x8fc9e8, 0xe8c48f, 0x8fe8b4, 0xe88fd6, 0x8fc9e8, 0xe8c48f, 0x8fe8b4];
997 997
998 // -- feedback ---------------------------------------------------------------998 // -- feedback ---------------------------------------------------------------
999 pub const STATUS_ERROR: u32 = 0xf87171;999 pub const STATUS_ERROR: u32 = 0xf87171;
@@ -1082,7 +1082,7 @@ pub mod nord {
1082 1082
1083 /// Aurora and Frost at full strength: a swatch carries no text, so these are1083 /// Aurora and Frost at full strength: a swatch carries no text, so these are
1084 /// Nord's own numbers.1084 /// Nord's own numbers.
1085- pub const SOURCE_TINTS: [u32; 4] = [0x88c0d0, 0xd08770, 0xa3be8c, 0xb48ead];1085+ pub const SOURCE_TINTS: [u32; 12] = [0x88c0d0, 0xd08770, 0xa3be8c, 0xb48ead, 0x88c0d0, 0xd08770, 0xa3be8c, 0xb48ead, 0x88c0d0, 0xd08770, 0xa3be8c, 0xb48ead];
1086 1086
1087 // -- feedback ---------------------------------------------------------------1087 // -- feedback ---------------------------------------------------------------
1088 pub const STATUS_ERROR: u32 = 0xbf616a;1088 pub const STATUS_ERROR: u32 = 0xbf616a;
@@ -1164,7 +1164,7 @@ pub mod gruvbox {
1164 pub const CLIP_IMAGE: u32 = 0x2f6a63;1164 pub const CLIP_IMAGE: u32 = 0x2f6a63;
1165 pub const CLIP_TEXT: u32 = 0x7a4a72;1165 pub const CLIP_TEXT: u32 = 0x7a4a72;
1166 1166
1167- pub const SOURCE_TINTS: [u32; 4] = [0xfe8019, 0x83a598, 0xb8bb26, 0xd3869b];1167+ pub const SOURCE_TINTS: [u32; 12] = [0xfe8019, 0x83a598, 0xb8bb26, 0xd3869b, 0xfe8019, 0x83a598, 0xb8bb26, 0xd3869b, 0xfe8019, 0x83a598, 0xb8bb26, 0xd3869b];
1168 1168
1169 // -- feedback ---------------------------------------------------------------1169 // -- feedback ---------------------------------------------------------------
1170 pub const STATUS_ERROR: u32 = 0xfb4934;1170 pub const STATUS_ERROR: u32 = 0xfb4934;
@@ -1240,7 +1240,7 @@ pub mod dracula {
1240 pub const CLIP_TEXT: u32 = 0x6a3fb0;1240 pub const CLIP_TEXT: u32 = 0x6a3fb0;
1241 1241
1242 /// Dracula's own six, four of them: a swatch carries no text.1242 /// Dracula's own six, four of them: a swatch carries no text.
1243- pub const SOURCE_TINTS: [u32; 4] = [0xff79c6, 0x8be9fd, 0x50fa7b, 0xffb86c];1243+ pub const SOURCE_TINTS: [u32; 12] = [0xff79c6, 0x8be9fd, 0x50fa7b, 0xffb86c, 0xff79c6, 0x8be9fd, 0x50fa7b, 0xffb86c, 0xff79c6, 0x8be9fd, 0x50fa7b, 0xffb86c];
1244 1244
1245 // -- feedback ---------------------------------------------------------------1245 // -- feedback ---------------------------------------------------------------
1246 pub const STATUS_ERROR: u32 = 0xff5555;1246 pub const STATUS_ERROR: u32 = 0xff5555;
@@ -1319,7 +1319,18 @@ pub mod darkroom {
1319 pub const CLIP_IMAGE: u32 = 0x464646;1319 pub const CLIP_IMAGE: u32 = 0x464646;
1320 pub const CLIP_TEXT: u32 = 0x4f4f4f;1320 pub const CLIP_TEXT: u32 = 0x4f4f4f;
1321 1321
1322- pub const SOURCE_TINTS: [u32; 4] = [0x5e656d, 0x767e87, 0x8e97a1, 0xa6afb9];1322+ // DESIGN §2 reference extraction, S/L clamped into the WCAG band and
1323+ // walked around the wheel at 12 stops (30° apart) so the cap in the same
1324+ // paragraph has one real value per hue rather than four greys repeated:
1325+ // azure #64B5D1, magenta #D164B5, green #64D19A, violet #7F64D1, teal
1326+ // #64D1D1 sit at indices 0, 4, 9(~), 2(~), 5(~) of this wheel.
1327+ // hook: §12 step 5 -- real per-source extraction replaces this constant
1328+ // wheel with a quantized dominant hue per import; until then the index
1329+ // is `source % 12`, which still guarantees different sources differ.
1330+ pub const SOURCE_TINTS: [u32; 12] = [
1331+ 0x64b5d1, 0x647ed1, 0x8064d1, 0xb664d1, 0xd164b5, 0xd1647e, 0xd18064,
1332+ 0xd1b764, 0xb5d164, 0x7ed164, 0x64d180, 0x64d1b7,
1333+ ];
1323 1334
1324 // -- feedback -------------------------------------------------------------1335 // -- feedback -------------------------------------------------------------
1325 pub const STATUS_ERROR: u32 = NOTICE_DECIDE;1336 pub const STATUS_ERROR: u32 = NOTICE_DECIDE;