From 000f4a46008e13b374e712878b3eb637951a22b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 10 Sep 2026 00:09:22 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20remove(app):=20cleanse=20the=20d?= =?UTF-8?q?ock=20=E2=80=94=20one=20list,=20one=20filter,=20one=20door=20in?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DESIGN.md | 15 +- crates/app/src/importing.rs | 54 +--- crates/app/src/main.rs | 4 - crates/app/src/menus.rs | 37 ++- crates/app/src/oracle.rs | 4 + crates/app/src/player/actions.rs | 14 + crates/app/src/tests/cards.rs | 44 ++- crates/app/src/tests/layout.rs | 128 +++++--- crates/app/src/ui/dock_stance.rs | 540 +++++++++---------------------- crates/app/src/ui/overlays.rs | 3 +- 10 files changed, 346 insertions(+), 497 deletions(-) diff --git a/DESIGN.md b/DESIGN.md index 81f5735..b06ad39 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -135,8 +135,19 @@ Fixed geography; nothing moves, nothing occludes the picture: cursor to be right-clicked on. `ink3` + chord, hover raises to `ink2` with the room's own plate, `CC` reads `ink1` + fill while subtitles are shown. State lives here, notices rise from here. -- **Dock** (right, the only side panel): Sources tab (assembly: filter, usage chips, import), - Clip tab (verbs: Speed / Colour / Transform / EQ as ghost verbs over param rows) and KEYS tab. +- **Dock** (right, the only side panel): SOURCES tab, CLIP tab, KEYS tab. + **Cleanse round 2 (2026-09-10):** SOURCES is a filter and *one* list. The filter is the glass + alone (`⌕`, no placeholder word); the list holds every source together — picture, sound and + subtitle tracks — in arrival order, with no `Media / Audio / Text` sub-tabs, no sort row, no + `MEDIA` or `IMPORT` head. A row is: dot · name **without its extension** (ellipsized, ≥60% of + the width) · one right-edge ghost `+↵`; under it one metadata line, `H.264 · 01:39:18 · V1 A1` + — codec, length, the lanes that play it (no decoder seat, no use count), which is also where a + row says what kind it is. Preview is a double-click or the row menu's `Preview`; the stand-in + is that menu's `Proxy` plus Settings. The foot is one row, `Add ^o`, and it takes a `.srt`/ + `.vtt` as readily as an `.mkv`; `Paste path ^l` and `Import subtitles ^i` keep their strokes, + their KEYS rows and the dock's own right-click menu. Empty list: the one noun `none`. + CLIP tab: the per-clip verbs (Speed / Colour / Transform / EQ / Silence / Mix / Fit) as plain + ghost rows — label + chord, no head styling — over the param rows they open. **Amendment (2026-09-09), user decision "option C":** there is no rail. The 56px spine — every command as a ghost glyph + chord down the left edge — is deleted, and the picture, time band, diff --git a/crates/app/src/importing.rs b/crates/app/src/importing.rs index b57bf4e..17d77e6 100644 --- a/crates/app/src/importing.rs +++ b/crates/app/src/importing.rs @@ -2,54 +2,12 @@ use crate::*; -/// The library's three categories, in the order the giants list them: the -/// pictures, the sound, and the words. A file is in exactly one of them, so a -/// tab is a question with an answer rather than a filter with a guess. -#[derive(Clone, Copy, PartialEq, Eq, Debug)] -pub(crate) enum LibraryTab { - Media, - Audio, - Text, -} - -pub(crate) const LIBRARY_TABS: [LibraryTab; 3] = - [LibraryTab::Media, LibraryTab::Audio, LibraryTab::Text]; - -impl LibraryTab { - pub(crate) fn label(self) -> &'static str { - match self { - LibraryTab::Media => "Media", - LibraryTab::Audio => "Audio", - LibraryTab::Text => "Text", - } - } - - /// Whether a source belongs on this tab. Text mirrors Media/Audio's own - /// rule -- an extension-only kind check, [`is_subtitle`] -- rather than - /// the `false` it used to hardcode: a standalone `.srt`/`.vtt`/`.ass` is - /// a Text source in the same sense an `.mp3` is an Audio one. A track - /// *inside* a container (a Matroska's embedded track) never reaches this - /// check at all -- the Text tab's rows are built from - /// [`crate::subs::subtitle_rows`] grouped by source, not filtered off - /// [`crate::library_meta::library_rows`] the way Media/Audio's are -- so - /// this only ever gates a standalone subtitle file. - pub(crate) fn holds(self, path: &Path) -> bool { - match self { - LibraryTab::Media => !engine::is_audio(path), - LibraryTab::Audio => engine::is_audio(path), - LibraryTab::Text => is_subtitle(path), - } - } - - /// What an empty tab says instead of being a blank column. - pub(crate) fn empty(self) -> &'static str { - match self { - LibraryTab::Media => "No video", - LibraryTab::Audio => "none", - LibraryTab::Text => "No subtitles", - } - } -} +// The library's three categories -- `LibraryTab::Media/Audio/Text`, their +// `holds` filter and their three empty nouns -- went with cleanse round 2 +// (2026-09-10): the dock shows one list of everything and a row says its own +// kind on its metadata line, so there is no tab to answer and no third empty +// word to keep in step. `is_subtitle` (subs.rs) is still the kind check the +// import fork reads. /// What is known about a source's audio. Three states and not two, because a /// file whose peaks have not come back yet must not be drawn as one that has no diff --git a/crates/app/src/main.rs b/crates/app/src/main.rs index f2561c6..eae9b79 100644 --- a/crates/app/src/main.rs +++ b/crates/app/src/main.rs @@ -207,7 +207,6 @@ struct Player { /// Which category of the library is being looked at. A tab and not a /// filter box: the categories are what the media *is*, and every editor /// this one is measured against splits its pool the same way. - library_tab: LibraryTab, /// Which of the darkroom dock's Src/Clip tabs is showing (DESIGN §5). /// `Player`-owned rather than the process-global static it used to be /// (VIOLATION 3), and persisted the way `ui::theme`'s pick is @@ -222,7 +221,6 @@ struct Player { pub(crate) dock_filter: String, pub(crate) dock_filter_edit: bool, /// Which of the four sort chips is showing (MOCK-SPEC "Dock" §3). - pub(crate) dock_sort: ui::dock_stance::DockSort, /// What is known about each source's audio, taken once and kept. Keyed on /// the path *and stream* -- two streams of one file are two envelopes -- and /// the key is inserted the moment the decode is *started*: presence means @@ -908,11 +906,9 @@ fn main() { picker: None, library_menu: None, selected_asset: None, - library_tab: LibraryTab::Media, dock_src_active: ui::dock_stance::load(), dock_filter: String::new(), dock_filter_edit: false, - dock_sort: ui::dock_stance::DockSort::Recent, waves: HashMap::new(), thumbs: HashMap::new(), proxies: HashMap::new(), diff --git a/crates/app/src/menus.rs b/crates/app/src/menus.rs index bf29a11..1365add 100644 --- a/crates/app/src/menus.rs +++ b/crates/app/src/menus.rs @@ -22,6 +22,12 @@ pub(crate) enum MenuOn { /// A lane head: the verbs of the track itself, on the lane the menu /// already names ([`oracle::lane_items`]). Head, + /// The dock's Sources body, anywhere its rows are not: the ways *in* + /// ([`DOCK_ITEMS`]). Cleanse round 2 took `Paste path` and `Import + /// subtitles` out of the footer, and this is the door they kept -- an + /// empty library included, which is exactly when a pasted path is worth + /// most. The lane field means nothing here and no row reads it. + Dock, } /// An open clip menu: what it was opened on, where it hangs, and whether it @@ -127,6 +133,14 @@ pub(crate) type ChoiceRow = (Choice, SharedString, SharedString, bool); #[derive(Clone, Copy, PartialEq)] pub(crate) enum RowItem { Add, + /// Play the source outside the timeline ([`Player::open_preview`]). The + /// row's `▷` ghost until cleanse round 2 (2026-09-10); a double-click on + /// the row is the other door. + Preview, + /// Make or delete the source's stand-in ([`Player::toggle_proxy`]) -- the + /// row's `○` ghost until the same cleanse. Settings carries the policy; + /// this is the one file. + Proxy, Remove, /// Remove that first deletes every clip playing the row. The plain /// [`RowItem::Remove`] is refused while any clip plays a source (the @@ -139,8 +153,10 @@ pub(crate) enum RowItem { Properties, } -pub(crate) const ROW_ITEMS: [RowItem; 5] = [ +pub(crate) const ROW_ITEMS: [RowItem; 7] = [ RowItem::Add, + RowItem::Preview, + RowItem::Proxy, RowItem::Remove, RowItem::RemoveWithClips, RowItem::Reveal, @@ -151,6 +167,8 @@ impl RowItem { pub(crate) fn label(self) -> &'static str { match self { Self::Add => "Add at playhead", + Self::Preview => "Preview", + Self::Proxy => "Proxy", Self::Remove => "Remove from library", // The consequence is in the label now rather than in the hint // column beside a label identical to the plain remove's: that @@ -179,7 +197,12 @@ impl RowItem { pub(crate) fn hint(self) -> &'static str { match self { Self::Add => "↵", - Self::Remove | Self::RemoveWithClips | Self::Reveal | Self::Properties => "", + Self::Preview + | Self::Proxy + | Self::Remove + | Self::RemoveWithClips + | Self::Reveal + | Self::Properties => "", } } } @@ -250,6 +273,16 @@ pub(crate) const BENCH_ITEMS: [ActionId; 10] = [ ActionId::Redo, ]; +/// What a right-click on the dock's Sources body offers: the three ways a +/// file gets in. Every one is an [`ActionId`] the keyboard already reaches, +/// so the row's label and its chord come out of the registry -- the dock +/// itself only draws one of them (`Add`) as a row of its own now. +pub(crate) const DOCK_ITEMS: [ActionId; 3] = [ + ActionId::AddFiles, + ActionId::PasteFilePath, + ActionId::ImportSubtitles, +]; + /// The tracks a lane head's menu can add, in the order it lists them. Its /// remove is the one of the clicked lane's own kind and comes from /// [`oracle::lane_items`], which is what puts it under the rule line. diff --git a/crates/app/src/oracle.rs b/crates/app/src/oracle.rs index fc60289..c0cc3e3 100644 --- a/crates/app/src/oracle.rs +++ b/crates/app/src/oracle.rs @@ -449,6 +449,10 @@ pub(crate) fn row_enable(item: RowItem, ctx: RowCtx) -> Enable { // Dimmed and saying why rather than clicked and refused afterwards: the // row's own grey already says the file cannot join this timeline. RowItem::Add if !ctx.usable => Enable::No("it cannot join this one"), + // A file the engine cannot read has nothing to play and nothing to + // make a stand-in from: hidden rather than dimmed, the way the two + // removes are, because neither verb has a state that would light it. + RowItem::Preview | RowItem::Proxy if !ctx.usable => Enable::Hidden("it cannot be read"), // The two removes are one verb with two shapes, and exactly one of // them is ever on the plate: the plain one while nothing plays the // source, the clips-too one while something does. Hidden rather than diff --git a/crates/app/src/player/actions.rs b/crates/app/src/player/actions.rs index 2037557..0185411 100644 --- a/crates/app/src/player/actions.rs +++ b/crates/app/src/player/actions.rs @@ -486,6 +486,20 @@ impl Player { self.library_menu = None; self.remove_source_and_clips(&menu.path, menu.stream, cx); } + // The row's two former ghosts (`▷`, `○`), each still the one + // implementation it always called (cleanse round 2). + RowItem::Preview => { + self.library_menu = None; + self.open_preview(&menu.path, menu.stream, cx); + } + RowItem::Proxy => { + self.library_menu = None; + let stops = matches!( + self.proxies.get(&menu.path), + Some(Proxy::Making(_) | Proxy::Cancelling(_)) + ); + self.toggle_proxy(&menu.path, stops, cx); + } RowItem::Reveal => { self.library_menu = None; // Another process starting: off the UI thread, exactly as the diff --git a/crates/app/src/tests/cards.rs b/crates/app/src/tests/cards.rs index d66312c..d456ce4 100644 --- a/crates/app/src/tests/cards.rs +++ b/crates/app/src/tests/cards.rs @@ -2041,39 +2041,55 @@ fn darkroom_preview_mounts_stop_and_drag_scrub() { ); } -/// Source management must stay reachable in the Darkroom itself: per-row -/// stand-in control/progress, pointer Add-at-playhead alongside its `↵` chord, -/// and the three legacy source questions as dock filters. The test reads the +/// Source management must stay reachable in the Darkroom itself: pointer +/// Add-at-playhead alongside its `↵` chord on the row, and -- since cleanse +/// round 2 (2026-09-10) took the `▷` and `○` ghosts off the row -- preview +/// and the per-file stand-in in the row's own right-click menu, each still +/// calling the one implementation it always called. The test reads the /// mounted dock source because this binary has no `TestAppContext` to inspect /// GPUI's painted controls. #[test] -fn darkroom_source_rows_keep_proxy_add_and_media_audio_text_paths() { +fn darkroom_source_rows_keep_proxy_add_and_preview_doors() { let dock = src_text("ui/dock_stance.rs"); let row_at = dock.find("fn source_row(").expect("Darkroom source row"); let row = &dock[row_at..]; for needle in [ - "dock-proxy-toggle", - "toggle_proxy(&proxy_path, proxy_stops, cx)", - "proxy_progress.map", "dock-add-at-playhead", "Add at playhead — ↵ does the same", "this.insert_source(", ] { assert!( row.contains(needle), - "Darkroom source row lost `{needle}`: a source must keep its proxy control/progress \ - and mouse-reachable Add-at-playhead path" + "Darkroom source row lost `{needle}`: a source must keep its \ + mouse-reachable Add-at-playhead path" ); } + // The two former ghosts, in the menu the same row opens. + assert!( + crate::ROW_ITEMS.contains(&crate::RowItem::Preview) + && crate::ROW_ITEMS.contains(&crate::RowItem::Proxy), + "the row menu lost Preview or Proxy" + ); + let actions = src_text("player/actions.rs"); for needle in [ - "LIBRARY_TABS.map", + "self.open_preview(&menu.path, menu.stream, cx);", + "self.toggle_proxy(&menu.path, stops, cx);", + ] { + assert!( + actions.contains(needle), + "the row menu's `{needle}` is a second implementation, not the door" + ); + } + // One list, no sub-tabs: a row says its kind on its own metadata line. + for gone in [ + "LIBRARY_TABS", + "library_tab", "dock-source-filter", - "player.library_tab.holds(&row.path)", - "true => player.library_tab.empty().to_string(),", + "dock.sort.cycle", ] { assert!( - dock.contains(needle), - "Darkroom Sources lost `{needle}`: Media, Audio, and Text must remain distinct paths" + !dock.contains(gone), + "the dock still carries `{gone}`: Sources is one list now" ); } } diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index 9726d5f..e22df0a 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -1210,46 +1210,54 @@ fn the_subtitles_toggle_says_what_is_placed_and_never_the_picked_row() { ); } -/// The door this editor answers "don't make me import the film again" with, -/// and it is in the dock's IMPORT section beside the other two imports -/// (`ui/dock_stance.rs`'s own doc comment: it moved off the old rail's crowded -/// TRACK group here): reads a file's subtitle tracks onto the open timeline -/// -- a release's `.mkv`, an `.srt` beside it -- while the file itself -/// joins nothing. It is the *action* and not a second implementation of it, -/// so the button, the stroke and the actions card cannot drift apart, and -/// it is oracle-gated like every other verb in the dock, so with no timeline -/// open it dims and says why instead of opening a chooser for nothing. -#[test] -fn the_text_tab_carries_the_add_subtitles_door() { +/// The door this editor answers "don't make me import the film again" with: +/// it reads a file's subtitle tracks onto the open timeline -- a release's +/// `.mkv`, an `.srt` beside it -- while the file itself joins nothing. +/// +/// Cleanse round 2 (2026-09-10) took its ghost row out of the dock's footer +/// along with the `IMPORT` head: one `Add` row is the dock's one door, and +/// `Add` itself forks a subtitle file to the same place. The verb keeps its +/// stroke, its KEYS row, and a pointer door of its own -- the dock's +/// right-click menu ([`DOCK_ITEMS`]), which an *empty* library carries too. +/// It is the action and not a second implementation of it, so the row, the +/// stroke and the actions card cannot drift apart, and the menu row is +/// oracle-gated like every other, so with no timeline open it dims and says +/// why instead of opening a chooser for nothing. +#[test] +fn the_dock_menu_carries_the_add_subtitles_door() { + use crate::{ActionId, DOCK_ITEMS}; + assert!( + DOCK_ITEMS.contains(&ActionId::ImportSubtitles) + && DOCK_ITEMS.contains(&ActionId::PasteFilePath) + && DOCK_ITEMS.contains(&ActionId::AddFiles), + "the dock's right-click menu lost one of the three ways in" + ); + // ...and that menu is actually opened from the Sources body. let dock = src_text("ui/dock_stance.rs"); - let at = dock - .find("\"dock-import-subtitles\"") - .expect("no import-subtitles control in the dock"); - let block = &dock[at..(at + 500).min(dock.len())]; assert!( - block.contains("ActionId::ImportSubtitles"), - "the button is a door of its own rather than the action: {block}" + dock.contains("on: MenuOn::Dock,"), + "nothing in the dock opens the menu that now carries the two imports" ); + // The rows are drawn from `DOCK_ITEMS` by the one menu render. + let overlays = src_text("ui/overlays.rs"); assert!( - block.contains("this.act(ActionId::ImportSubtitles"), - "the button does not dispatch through the action oracle: {block}" + overlays.contains("MenuOn::Dock => DOCK_ITEMS.to_vec(),"), + "the dock menu draws something other than the three import actions" ); // `act(ActionId::ImportSubtitles, ...)` routes to `pick_and_add_subtitles` - // -- the button names the action, not a second implementation of it. + // -- the row names the action, not a second implementation of it. let actions = src_text("player/actions.rs"); assert!( actions.contains("ActionId::ImportSubtitles => self.pick_and_add_subtitles(cx)"), "ImportSubtitles no longer opens the subtitle chooser" ); - // `ghost_verb` is the oracle-gated one: dimmed with the refusal in the - // oracle's own words (`player.enable(action, None)` in its own body). + // A subtitle file taken through the plain `Add files` door lands as + // subtitles rather than as a source that cannot be read. + let library = src_text("player/library.rs"); assert!( - dock[..at].ends_with("ghost_verb(\n "), - "the add-subtitles button is not built from the oracle-gated ghost_verb" + library.contains("if is_subtitle(path) {"), + "Add files no longer forks a .srt/.vtt to the subtitle list" ); - // ...and the empty tab stays a noun, not a sentence pointing at the - // button (DESIGN §8, 2026-08-27: no instructional copy). - assert_eq!(crate::LibraryTab::Text.empty(), "No subtitles"); } /// The Darkroom keeps imported subtitle tracks in the Text tab itself (moved @@ -2644,9 +2652,9 @@ fn hitmap_names_every_darkroom_pointer_entry_surface() { for needle in [ "subtitle.{group_ord}.{track}.row", "subtitle.{group_ord}.{track}.select", - "source.{i}.preview", - "source.{i}.proxy", - "Proxy making", + "source.{i}.row", + "source.{i}.add", + "dock.filter", ] { assert!( dock.contains(needle), @@ -2939,32 +2947,54 @@ fn a_source_row_shows_its_name_before_anything_else() { !row.contains(".min_w(px(0.))"), "the row name is still allowed to measure nothing" ); - // The usage moved to the second line, beside codec/length, in ink3. + // Cleanse round 2: the name is what the editor calls the film, not what + // the filesystem calls the bytes. assert!( - row.contains(r#".child(format!("{usage} · {under}"))"#), - "usage is not folded into the metadata line" + row.contains("let name: SharedString = stem(&row.name).into();"), + "the row name still wears its extension" ); - // Preview / Add / proxy are glyph+chord ghosts now, not word buttons: - // ~66px for the three together, inside the 96px the name can spare. - for glyph in [r#".child("▷")"#, r#".child("+")"#, r#".child("↵")"#] { - assert!(row.contains(glyph), "the right-edge verbs lost {glyph}"); - } - for word in [r#".child("Preview")"#, r#".child("Add")"#] { - assert!(!row.contains(word), "{word} still spends the name's width"); + assert_eq!( + crate::ui::dock_stance::stem("he_is_not_the_only_one.mp4"), + "he_is_not_the_only_one" + ); + // A file with several audio streams keeps the stream half of its name and + // loses only the extension; a name that is all extension keeps it. + assert_eq!( + crate::ui::dock_stance::stem("A Film.mkv [audio 2]"), + "A Film [audio 2]" + ); + assert_eq!(crate::ui::dock_stance::stem(".srt"), ".srt"); + // One ghost on the right edge, and one only: preview and the stand-in + // moved into the row's own menu (`RowItem::Preview`/`Proxy`). + for glyph in [r#".child("+")"#, r#".child("↵")"#] { + assert!(row.contains(glyph), "the right-edge verb lost {glyph}"); } - // Every verb keeps its own hitmap name and its chord. - for id in ["source.{i}.preview", "source.{i}.add", "source.{i}.proxy"] { - assert!(row.contains(id), "{id} lost its hitmap entry"); + for gone in [r#".child("▷")"#, "dock-proxy-toggle", "dock-preview"] { + assert!(!row.contains(gone), "the row still carries `{gone}`"); } + assert!( + row.contains("source.{i}.add"), + "the add ghost lost its hitmap entry" + ); + // The metadata line is codec · length · lanes: no decoder seat, no use + // count (`usage_line` and the `seats` filter above it). + assert!( + row.contains(".map(Backend::label);") && row.contains(".child(under)"), + "the metadata line no longer drops the decoder seat" + ); + let usage = &dock[dock.find("fn usage_line(").expect("the usage line")..start]; + assert!(!usage.contains("use{}"), "the metadata line still counts uses"); // DESIGN §8: the permanent footer telling the editor how to use a list // ("drag · ↵ add · double-click plays") is instructional copy and is gone. assert!( !dock.contains("double-click plays"), "the dock still carries an instruction footer" ); - // ...and an Audio tab with no audio-only file in it is a single noun, not - // the claim `No sound` over a source whose A1 stream is on the bench. - assert_eq!(crate::LibraryTab::Audio.empty(), "none"); + // ...and an empty list is a single noun, whatever emptied it. + assert!( + dock.contains(r#".child("none"),"#), + "the empty dock says something other than the one noun" + ); } /// A room key pressed while the ring sits in the dock has to reach the room. @@ -3744,8 +3774,12 @@ fn every_hitmap_control_wears_a_hover_line() { } } } + // The floor moved 40 -> 35 with cleanse round 2 (2026-09-10): the dock + // gave up five named controls in one diff (the three sub-tabs, the sort + // cycle, the row's preview and stand-in ghosts, against one Add row kept) + // and a floor above the true count is a red gate, not a blindness check. assert!( - controls >= 40, + controls >= 35, "the hover sweep found only {controls} controls -- it has gone blind" ); assert!( diff --git a/crates/app/src/ui/dock_stance.rs b/crates/app/src/ui/dock_stance.rs index 93f24ff..f2b1898 100644 --- a/crates/app/src/ui/dock_stance.rs +++ b/crates/app/src/ui/dock_stance.rs @@ -68,44 +68,6 @@ pub(crate) fn save_maximized(maximized: bool) { let _ = std::fs::write(path, if maximized { "1\n" } else { "0\n" }); } -/// The Sources tab's four sort chips (MOCK-SPEC "Dock" §3). `Recent` is the -/// library's own arrival order -- the only order this editor tracks without -/// a fourth field to keep it in. -#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)] -pub(crate) enum DockSort { - #[default] - Recent, - Name, - Usage, - Unused, -} - -impl DockSort { - const ALL: [DockSort; 4] = [ - DockSort::Recent, - DockSort::Name, - DockSort::Usage, - DockSort::Unused, - ]; - fn label(self) -> &'static str { - match self { - DockSort::Recent => "Recent", - DockSort::Name => "Name", - DockSort::Usage => "Usage", - DockSort::Unused => "Unused", - } - } - - /// The next chip in the cycle, wrapping back to `Recent` -- the whole - /// row collapsed to one ghost control that cycles on click instead of - /// four chips fighting for the same line (user 2026-08-27: "too much - /// chrome"). - fn next(self) -> DockSort { - let idx = Self::ALL.iter().position(|s| *s == self).unwrap_or(0); - Self::ALL[(idx + 1) % Self::ALL.len()] - } -} - /// A ghost verb (DESIGN §4): borderless glyph/label in `ink2`, its chord in /// `ink3` beside it, read live off the keymap so it can never drift from the /// key that does the same thing. Hover is one fill step and an ink brighten; @@ -246,9 +208,10 @@ fn section_head(text: impl Into) -> impl IntoElement { } /// Every lane a source plays on right now, as its own `V1`/`A1` labels -/// (MOCK-SPEC "Dock" §4's usage line), plus how many clips altogether -- -/// [`Player::row_ctx`]'s `placed` count, the same number the library card's -/// Remove refusal reads. +/// (MOCK-SPEC "Dock" §4's usage line). The clip *count* that used to trail it +/// ("2 uses") is gone with cleanse round 2 (2026-09-10): the lanes are the +/// answer to "is it in the film?", the number is a statistic, and the +/// Properties side of the row menu still prints it whole. fn usage_line(player: &Player, source_idx: usize, placed: usize) -> String { if placed == 0 { return "unused".to_string(); @@ -266,11 +229,26 @@ fn usage_line(player: &Player, source_idx: usize, placed: usize) -> String { .map(Lane::label) .collect() }); - format!( - "{} · {placed} use{}", - lanes.join(" "), - if placed == 1 { "" } else { "s" } - ) + lanes.join(" ") +} + +/// The file's name without its extension -- what the editor calls the film, +/// not what the filesystem calls the bytes (cleanse round 2). A row that +/// names several streams of one file keeps the stream half it was given +/// ([`library_meta::row_name`] appends it after the file name). +/// +/// corner-cut: private to the dock while U2's shared `stem()` is unlanded; +/// the lead reconciles the two into `ui/widgets.rs` or `files.rs`. +pub(crate) fn stem(name: &str) -> String { + let (file, tail) = match name.split_once(" [") { + Some((file, tail)) => (file, format!(" [{tail}")), + None => (name, String::new()), + }; + match file.rsplit_once('.') { + // A name that is *all* extension (".srt") keeps it: it is the name. + Some(("", _)) | None => format!("{file}{tail}"), + Some((base, _)) => format!("{base}{tail}"), + } } /// One source row, two lines (MOCK-SPEC "Dock" §4): an ink dot, the name in @@ -289,70 +267,43 @@ fn source_row( cx: &mut Context, ) -> impl IntoElement { let usable = row.unusable.is_none(); - let name: SharedString = row.name.clone().into(); + let name: SharedString = stem(&row.name).into(); + // The decoder seat (`HW`/`SW`) is off the row with cleanse round 2: the + // codec is what the file *is*, the seat is how this machine happens to + // read it today, and the transport line and the Properties side both + // still say it. Read off `Backend::label` rather than a copy of those + // words, so a renamed seat cannot leave a stale filter behind. + let seats = [ + Backend::Opening, + Backend::Hardware, + Backend::Software, + Backend::Still, + Backend::Gap, + ] + .map(Backend::label); + let detail = row + .detail + .split(" · ") + .filter(|part| !seats.contains(part)) + .collect::>() + .join(" · "); let under: String = match &row.unusable { Some(why) => why.clone(), None => join_detail( - &row.detail, - &timecode(f64::from(row.frames) / player.fps, player.fps), + &join_detail( + &detail, + &timecode(f64::from(row.frames) / player.fps, player.fps), + ), + &usage_line(player, row.tint, placed), ), }; - let usage = usage_line(player, row.tint, placed); let (path, stream) = (row.path.clone(), row.stream); let dragged = (path.clone(), stream); - let preview_path = path.clone(); let dot_path = path.clone(); let menu_path = path.clone(); let add_path = path.clone(); - let proxy_path = path.clone(); let ghost = name.clone(); let can_insert = usable && player.session.is_some() && player.exporting().is_none(); - let (proxy_glyph, proxy_on, proxy_progress, proxy_waiting, proxy_tip) = - match player.proxies.get(&row.path) { - Some(Proxy::Ready) => ( - "●", - true, - None, - false, - format!("Stand-in ON for {} — click to delete it", row.name), - ), - Some(Proxy::Making(job)) => ( - "■", - true, - Some(job.progress()), - false, - format!("Stop making the stand-in for {}", row.name), - ), - Some(Proxy::Cancelling(_)) => ( - "■", - true, - None, - true, - format!("Stopping the stand-in for {}…", row.name), - ), - Some(Proxy::Asked(_)) => ( - "○", - false, - None, - true, - format!("Preparing the stand-in for {}…", row.name), - ), - _ => ( - "○", - false, - None, - false, - format!("Stand-in OFF for {} — click to make one", row.name), - ), - }; - let proxy_stops = proxy_glyph == "■"; - let proxy_label = match (proxy_on, proxy_waiting, proxy_progress) { - (_, true, _) => "Proxy cancelling".to_string(), - (true, false, Some(progress)) => format!("Proxy making {:.0}%", progress * 100.), - (true, false, None) => "Proxy ready".to_string(), - (false, false, _) => "Proxy off".to_string(), - }; - let proxy_tip: SharedString = proxy_tip.into(); div() .id(("dock-source", i)) .flex_none() @@ -491,38 +442,11 @@ fn source_row( .text_color(rgb(INK1())) .child(name) }) - .when(usable, |d| { - d.child({ - let style = label(type_scale::FLOOR_PX, FontWeight::MEDIUM); - div() - .id(("dock-preview", i)) - .flex_none() - .px(px(4.)) - .py(px(2.)) - .rounded(px(3.)) - .cursor_pointer() - .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1()))) - .tooltip(move |_, cx| { - cx.new(|_| Tip("Preview — play this source outside the timeline".into())) - .into() - }) - .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { - cx.stop_propagation(); - this.open_preview(&preview_path, stream, cx); - })) - .children(hitmap::dynamic( - move || (format!("source.{i}.preview"), "Preview source".into()), - true, - )) - .child( - div() - .font(style.font) - .text_size(style.size) - .text_color(rgb(INK2())) - .child("▷"), - ) - }) - }) + // Preview (`▷`) and the stand-in toggle (`○`) are off the + // row with cleanse round 2: a double-click starts the source playing + // and the row menu carries `Preview`, the stand-in lives in + // that same menu's `Proxy` row and in Settings. What is left + // on the right edge is the one verb a source row is *for*. .when(usable, |d| { d.child({ let label_style = label(type_scale::FLOOR_PX, FontWeight::MEDIUM); @@ -583,54 +507,6 @@ fn source_row( .child("↵"), ) }) - .child({ - let style = mono(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM); - div() - .id(("dock-proxy-toggle", i)) - .flex_none() - .flex() - .flex_col() - .items_center() - .gap(px(2.)) - .px(px(4.)) - .py(px(2.)) - .rounded(px(3.)) - .when(proxy_on, |d| d.bg(rgb(DARK_RAISED()))) - .when(proxy_waiting, |d| d.opacity(0.55)) - .cursor_pointer() - .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1()))) - .tooltip(move |_, cx| cx.new(|_| Tip(proxy_tip.clone())).into()) - .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { - cx.stop_propagation(); - this.toggle_proxy(&proxy_path, proxy_stops, cx); - })) - .children(hitmap::dynamic( - move || (format!("source.{i}.proxy"), proxy_label), - !proxy_waiting, - )) - .child( - div() - .font(style.font) - .text_size(style.size) - .text_color(rgb(if proxy_on { INK1() } else { INK3() })) - .child(proxy_glyph), - ) - .children(proxy_progress.map(|progress| { - div() - .flex_none() - .w(px(20.)) - .h(px(2.)) - .rounded(px(1.)) - .bg(rgb(DARK_HAIRLINE())) - .child( - div() - .h_full() - .w(px(20. * progress.clamp(0., 1.))) - .rounded(px(1.)) - .bg(rgb(INK2())), - ) - })) - }) }), ) .child({ @@ -641,7 +517,7 @@ fn source_row( .font(style.font) .text_size(style.size) .text_color(rgb(INK3())) - .child(format!("{usage} · {under}")) + .child(under) }) } @@ -924,80 +800,88 @@ fn subtitle_tab_rows(player: &Player, cx: &mut Context) -> (usize, Vec, +) -> impl Fn(&MouseDownEvent, &mut Window, &mut App) + 'static { + cx.listener(|this, event: &MouseDownEvent, _, cx| { + if this.modal() || this.session.is_none() { + return; + } + cx.stop_propagation(); + this.context_menu = Some(ContextMenu { + lane: Lane::V1, + on: MenuOn::Dock, + at: event.position, + details: false, + }); + cx.notify(); + }) +} + +/// The Sources tab, cleanse round 2 (2026-09-10, user "seems cool, let's +/// apply"): one filter and one list of everything this project holds -- +/// picture, sound, and the subtitle tracks beside them -- with what a row +/// *is* read off its own metadata line instead of off a sub-tab the editor +/// had to pick first. The `MEDIA` head, the `Media / Audio / Text` strip, the +/// `↕ Recent` sort cycle and the `IMPORT` head are all gone with it; the row +/// facts are still [`library_rows`]' and [`subtitle_tab_rows`]'. fn sources_tab( player: &Player, _window: &mut Window, cx: &mut Context, ) -> impl IntoElement { - let text_tab = player.library_tab == LibraryTab::Text; - // Text has no per-stream `Row` to fill -- its rows are subtitle tracks - // grouped by source ([`subtitle_tab_rows`]), not `library_rows`' files -- - // so it takes its own branch instead of a `Row` shape that would not fit - // it. `dock_filter`/`dock_sort` stay Media/Audio's own: a subtitle track - // has no "unused" count and its own row order is the file's own order, - // the same reason the old palette never carried either control. - let (total, unused_count, row_elements): (usize, usize, Vec) = if text_tab { - let (count, elements) = subtitle_tab_rows(player, cx); - (count, 0, elements) - } else { - let sources = player - .session - .as_ref() - .map_or(&[][..], PlaybackSession::sources); - let all_rows: Vec = library_rows( - sources, - &player.streams, - &player.decoders, - player.timeline_audio(), - |path| { - player - .session - .as_ref() - .map_or(0, |session| session.file_frames(path)) - }, - ); - let filter = player.dock_filter.to_lowercase(); - let mut rows: Vec<(Row, usize)> = all_rows - .into_iter() - .filter(|row| player.library_tab.holds(&row.path)) - .map(|row| { - let placed = player.row_ctx(&row.path, row.stream).placed; - (row, placed) - }) - .filter(|(row, placed)| { - filter.is_empty() - || row.name.to_lowercase().contains(&filter) - || row.detail.to_lowercase().contains(&filter) - || ("unused".contains(&filter) && *placed == 0) - }) - .collect(); - let unused_count = rows.iter().filter(|(_, placed)| *placed == 0).count(); - match player.dock_sort { - DockSort::Recent => {} - DockSort::Name => { - rows.sort_by(|(a, _), (b, _)| a.name.to_lowercase().cmp(&b.name.to_lowercase())) - } - DockSort::Usage => rows.sort_by(|(_, a), (_, b)| b.cmp(a)), - DockSort::Unused => rows.sort_by_key(|(_, placed)| *placed > 0), - } - let total = rows.len(); - let elements: Vec = rows - .iter() - .enumerate() - .map(|(i, (row, placed))| { - let picked = player - .selected_asset - .as_ref() - .is_some_and(|p| *p == (row.path.clone(), row.stream)); - source_row(player, i, row, *placed, picked, cx).into_any_element() - }) - .collect(); - (total, unused_count, elements) - }; + let sources = player + .session + .as_ref() + .map_or(&[][..], PlaybackSession::sources); + let all_rows: Vec = library_rows( + sources, + &player.streams, + &player.decoders, + player.timeline_audio(), + |path| { + player + .session + .as_ref() + .map_or(0, |session| session.file_frames(path)) + }, + ); + let filter = player.dock_filter.to_lowercase(); + let rows: Vec<(Row, usize)> = all_rows + .into_iter() + .map(|row| { + let placed = player.row_ctx(&row.path, row.stream).placed; + (row, placed) + }) + .filter(|(row, placed)| { + filter.is_empty() + || row.name.to_lowercase().contains(&filter) + || row.detail.to_lowercase().contains(&filter) + || ("unused".contains(&filter) && *placed == 0) + }) + .collect(); + let mut row_elements: Vec = rows + .iter() + .enumerate() + .map(|(i, (row, placed))| { + let picked = player + .selected_asset + .as_ref() + .is_some_and(|p| *p == (row.path.clone(), row.stream)); + source_row(player, i, row, *placed, picked, cx).into_any_element() + }) + .collect(); + // The subtitle tracks join the same list rather than hiding behind a tab + // of their own: a standalone `.srt` is a source in the sense that matters + // here -- something that came in and can go on a lane -- and the tracks + // inside a container stay grouped under the file that carries them. + let (_, subtitles) = subtitle_tab_rows(player, cx); + row_elements.extend(subtitles); let filter_text: SharedString = player.dock_filter.clone().into(); div() .id("dock-sources") @@ -1005,6 +889,11 @@ fn sources_tab( .on_key_down(cx.listener(move |this, event: &KeyDownEvent, window, cx| { cycle_on_key_down(Surface::Dock)(this, event, window, cx) })) + // Right-click anywhere the rows are not: the ways *in* (Add files, + // Paste path, Import subtitles), which is what the dock itself can be + // told -- and the door those last two kept when their rows left the + // footer. A row's own right-click stops here first (`source_row`). + .on_mouse_down(MouseButton::Right, opens_dock_menu(cx)) // The focus ring is not painted (user 2026-09-09: "clicking through // timeline draws a white overlay around the timeline, same happens // for library section too"). The border stays in flow, transparent in @@ -1018,22 +907,6 @@ fn sources_tab( .gap(px(6.)) .p(px(8.)) .overflow_y_scroll() - .child({ - let style = head(); - let hint: SharedString = match text_tab { - true => format!("{total} total"), - false => format!("{total} total · {unused_count} unused"), - } - .into(); - div() - .id("dock-header") - .flex_none() - .font(style.font) - .text_size(style.size) - .text_color(rgb(INK3())) - .tooltip(move |_, cx| cx.new(|_| Tip(hint.clone())).into()) - .child(player.library_tab.label().to_uppercase()) - }) .child({ let style = mono(type_scale::CHORD_METADATA_MAX_PX, FontWeight::MEDIUM); div() @@ -1053,82 +926,13 @@ fn sources_tab( })) .tooltip(crate::ui::widgets::tip_hover("Filter sources", "type to narrow", None)) .children(hitmap::control("dock.filter", "Filter sources", true)) + // The glass alone at rest: the word "filter" beside it was + // the box telling the editor what a filter box is (DESIGN §8). .child(match player.dock_filter.is_empty() { - true => "⌕ filter".to_string(), + true => "⌕".to_string(), false => format!("⌕ {filter_text}"), }) }) - .child( - div() - .flex_none() - .flex() - .gap(px(4.)) - .children(LIBRARY_TABS.map(|tab| { - let on = tab == player.library_tab; - let style = label(type_scale::FLOOR_PX, FontWeight::MEDIUM); - div() - .id(("dock-source-filter", tab as usize)) - .flex_none() - .px(px(6.)) - .py(px(2.)) - .rounded(px(3.)) - .font(style.font) - .text_size(style.size) - .when(on, |d| d.bg(rgb(DARK_RAISED())).text_color(rgb(INK1()))) - .when(!on, |d| d.text_color(rgb(INK3()))) - .cursor_pointer() - .hover(|s| s.bg(rgb(DARK_RAISED()))) - .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { - this.library_tab = tab; - cx.notify(); - })) - .tooltip(crate::ui::widgets::tip_hover(&format!("Show {} only", tab.label().to_lowercase()), "", None)) - .children(hitmap::dynamic( - move || { - ( - format!("dock.filter.{}", tab.label()), - format!("Filter {}", tab.label()), - ) - }, - true, - )) - .child(tab.label()) - })), - ) - // The sort cycle is Media/Audio's own: a subtitle track's order is - // its file's own order, not a pick among Recent/Name/Usage/Unused. - .when(!text_tab, |d| { - d.child({ - let current = player.dock_sort; - let style = label(type_scale::FLOOR_PX, FontWeight::MEDIUM); - div() - .id("dock-sort-cycle") - .flex_none() - .px(px(6.)) - .py(px(2.)) - .rounded(px(3.)) - .font(style.font) - .text_size(style.size) - .text_color(rgb(INK2())) - .cursor_pointer() - .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1()))) - .tooltip(crate::ui::widgets::tip_hover("Sort sources", "click to cycle", None)) - .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { - this.dock_sort = this.dock_sort.next(); - cx.notify(); - })) - .children(hitmap::dynamic( - move || { - ( - "dock.sort.cycle".to_string(), - format!("Sort: {} — click to cycle", current.label()), - ) - }, - true, - )) - .child(format!("↕ {}", current.label())) - }) - }) .child( div() .id("dock-source-rows") @@ -1138,6 +942,10 @@ fn sources_tab( .flex_col() .gap(px(2.)) .overflow_y_scroll() + // The list fills the dock, so the empty stretch under the last + // row is *this* element and not its parent: the menu opens off + // both, or a right-click below the rows finds nothing. + .on_mouse_down(MouseButton::Right, opens_dock_menu(cx)) .when(row_elements.is_empty(), |d| { let style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM); d.child( @@ -1145,53 +953,27 @@ fn sources_tab( .font(style.font) .text_size(style.size) .text_color(rgb(INK3())) - .child(match text_tab || player.dock_filter.is_empty() { - true => player.library_tab.empty().to_string(), - false => "nothing matches the filter".to_string(), - }), + // One noun for both empties -- nothing imported and + // nothing matching are the same sight, and neither + // is a sentence (DESIGN §8). + .child("none"), ) }) .children(row_elements), ) - .child(section_head("IMPORT")) - .child( - div() - .flex_none() - .flex() - .flex_col() - .children(ghost_verb( - "dock-import-files", - "Add files", - ActionId::AddFiles, - false, - player, - cx.listener(|this, _: &ClickEvent, _, cx| this.pick_and_import(cx)), - )) - .children(ghost_verb( - "dock-paste-path", - "Paste path", - ActionId::PasteFilePath, - false, - player, - cx.listener(|this, _: &ClickEvent, _, cx| this.paste_file_path(cx)), - )) - // Subtitles come in through the same door every other file - // does. This row is `↓S`'s new geographic home: the spine's - // TRACK group carried it as a two-glyph badge on a 56px rail - // that no longer had the height for it (user 2026-08-21: - // "the spine menu is too crowded"), and an import belongs - // beside the other two imports, not beside the lane verbs. - .children(ghost_verb( - "dock-import-subtitles", - "Import subtitles", - ActionId::ImportSubtitles, - false, - player, - cx.listener(|this, _: &ClickEvent, window, cx| { - this.act(ActionId::ImportSubtitles, window, cx) - }), - )), - ) + // One door in, at the bottom. `Paste path` (`^l`) and `Import + // subtitles` (`^i`) keep their strokes, their KEYS rows and the + // dock's own right-click menu; `Add files` takes a `.srt`/`.vtt` as + // happily as an `.mkv` (`Player::import` forks on `is_subtitle`), so + // subtitles arrive through this row too. + .children(ghost_verb( + "dock-import-files", + "Add", + ActionId::AddFiles, + false, + player, + cx.listener(|this, _: &ClickEvent, _, cx| this.pick_and_import(cx)), + )) } /// The transition a clip carries into its immediate successor, if any -- a diff --git a/crates/app/src/ui/overlays.rs b/crates/app/src/ui/overlays.rs index e01deeb..c72e5df 100644 --- a/crates/app/src/ui/overlays.rs +++ b/crates/app/src/ui/overlays.rs @@ -131,7 +131,7 @@ impl Player { // would be a right-click that opens nothing. let idx = match menu.on { MenuOn::Clip(idx) => Some(idx), - MenuOn::Gap(..) | MenuOn::Bench | MenuOn::Head => None, + MenuOn::Gap(..) | MenuOn::Bench | MenuOn::Head | MenuOn::Dock => None, }; let clip = idx.and_then(|idx| session.lane_clips(menu.lane).get(idx).copied()); let source = clip.and_then(|clip| session.sources().get(clip.source).cloned()); @@ -272,6 +272,7 @@ impl Player { // the label and the chord still come out of the registry. let actions = match menu.on { MenuOn::Bench => BENCH_ITEMS.to_vec(), + MenuOn::Dock => DOCK_ITEMS.to_vec(), MenuOn::Head => lane_items(menu.lane), _ => menu_items(ctx), };