Module library

Source
Expand description

Left panel: the project browser — Premiere’s project panel, in two sub-tabs.

“Imported” is what the project contains, drawn as a real file explorer: nested folders, the assets under them, a “+ New” button (folder / import / sequence / adjustment layer), rename and delete from the context menu, and move-by-drag onto a folder row. “Global” browses the disk instead: the recent files from settings.json plus the folders the user linked, one directory level read per expansion (never an eager recursive walk — that hangs the UI on a media drive) and only inside a node the user linked or opened.

Selection is multi: a click replaces it, Ctrl+click toggles one item, Shift+click takes the range over the rows in the order they were drawn, and a drag across empty space rubber-bands. LibraryState.selected / sel_path are the anchor inside the set — app.rs writes selected after an import, and show notices that write and collapses the set onto it. With something selected the toolbar grows a batch strip (Import, Convert To, Convert…, Compress…, Remove) that routes through the same LibraryResponse fields the per-item menus use, so App needs no new plumbing.

The bottom of the pane is a dedicated asset preview: a big picture of the anchor, its format line, and the ONLY place its description, tags, label and folder are edited — never inline in the list. Every file row and tile carries a picture: the cached thumbnail, or a painted glyph while there is none — a speaker for audio, a film strip for video, a camera for stills, a sheet stack for the rest. The toolbar works over both tabs: search (name/tags/description/folder), kind chips (All/Video/Audio/ Image/Seq, Short SFX ≤ 10 s, Music > 10 s), label colours, “Unused only”, sort, the List/Gallery switch (LibraryState.view) and the zoom (LibraryState.zoom, the +/- buttons and Ctrl+Scroll) that scales both gallery tiles and row thumbnails. A search or a filter flattens “Imported” into its hits, the way an explorer shows search results. Under the tree, the Imported tab also lists what the project can reuse: its sequences (drag DragPayload::Sequence, double-click opens), saved templates, and the effects / node graphs / adjustment layers already in use or saved in settings.json.

Structs§

LibraryResponse
LibraryState
PreviewFrame
The frame the app’s preview player produced this update, with its pixel size. The preview box paints it instead of the still thumbnail, which is what makes a clicked asset play.
Tree 🔒
Shared borrows for the tree rows: they recurse, and would otherwise thread a dozen arguments each.

Enums§

Art 🔒
What fills a picture box.
LabelPick 🔒
What a label menu returned.
LibOp 🔒
Project mutations collected during the frame, applied after all widgets (one undo per gesture).
Pick 🔒
One selectable thing in the browser: a project asset, or a file on disk.
RecOp 🔒
Reuse 🔒
One reusable thing the project already holds.

Constants§

ARROW 🔒
Width of the disclosure column.
AUDIO_EXTS 🔒
CLEAR_RECENT 🔒
IMAGE_EXTS 🔒
ROW_H 🔒
TILE 🔒
Gallery cell width and row thumbnail height at zoom 1.
VIDEO_EXTS 🔒
ZOOM_MAX 🔒
ZOOM_MIN 🔒

Functions§

apply_click 🔒
One click on a row/tile, resolved against the rows as they were drawn this frame. Plain replaces the selection, Ctrl toggles one item, Shift takes the range from the anchor (which stays put, so a second Shift+click re-ranges from the same place, like every file explorer).
asset_preview 🔒
band_select 🔒
Rubber band over empty space: press, move, and every row the band touches is selected. Derived from the pointer each frame — no state to keep. A press that landed on a row is left alone: that gesture belongs to the drag-and-drop source.
batch_strip 🔒
What to do with everything selected. Every button routes through the LibraryResponse fields the per-item menus already use, so App needs no new plumbing. ponytail: the Convert and Compress windows each take one file, so those two open on the first asset of the selection. Upgrade: queue one job per asset once those windows accept a list.
browser 🔒
confirm 🔒
Yes/No dialog for destructive, non-undoable actions.
delete_sequence 🔒
Remove a sequence and every clip that uses it (main timeline, stash, other sequences).
dir_key 🔒
Tree key of a folder on disk (one place, so the tests build the same key).
dot 🔒
A filled dot in the label’s colour — painted, because ● is tofu in half the shipped fonts.
dur_cell 🔒
Duration cell of an asset — “Loading…” while its import probe is still out (see engine::import).
ext_class 🔒
1 video, 2 audio, 3 image, 0 unknown — by extension only.
external_select 🔒
app.rs sets selected on its own after an import or a “reveal in library”; the multi-selection follows that write (and only that one — our own writes go through set_anchor).
fallback_glyph 🔒
The painted stand-in for a file with no thumbnail: a speaker for audio, a film strip for video, a camera for stills, a stack of sheets for everything else.
file_art 🔒
The picture of a media file h px tall: its cached thumbnail, or the painted fallback for its kind. ponytail: asking for a thumbnail is what queues the decode, so expanding a folder of 500 clips queues 500 of them (LIFO, so what you look at wins). Upgrade: only ask for rows inside the viewport.
folder_ok 🔒
Folder filter: None = all, “” = root only, name = that folder and its subfolders.
folder_tree_names 🔒
Every project folder plus the parents only an asset implies (“A/B” with no “A” in folders), so no branch of the tree hangs off a node that is never drawn.
glyph 🔒
A painted icon the size of a text label, for the rows that are not files.
indent 🔒
Indent of a row depth levels into the tree. Rows that hold no disclosure triangle (files, hints) add ARROW, so their icon lines up with the folder icons beside them.
inline_edit 🔒
TextEdit for inline renames; Some(text) once editing finishes with a non-empty name.
kind_rank 🔒
kind_tag 🔒
kind_tag_for_class 🔒
label_menu 🔒
“Label ▸” submenu over the project’s own labels; returns the pick (“Edit labels…” included).
lbl_color 🔒
Colour of a label index using the project’s palette (falls back to the built-in colours).
lbl_name 🔒
Name of a label index in the project’s palette.
matches_kind 🔒
Kind chip: 0 All, 1 Video, 2 Audio, 3 Image, 4 Sequences (assets never match), 5 Short SFX (audio ≤ 10 s), 6 Music (audio > 10 s).
matches_search 🔒
Case-insensitive match of the search text against name, tags, description and folder. A search is about the FILE, so it matches the name and what the user wrote about it — never the containing folder. Matching the folder meant searching “pop” returned every file that happened to sit in a folder called pop, which is the opposite of narrowing.
paint_art 🔒
Paint art inside rect on the panel fill. The box is drawn even when empty, so names line up.
parent_of 🔒
The folder that directly contains path; “” for a top-level folder.
path_matches 🔒
Search + kind chips against a bare path (recents and files on disk have no duration): the SFX/Music chips can only mean “audio” there.
path_preview 🔒
Preview of a file that is not in the project yet: import it from here, and edit the tags it carries as a recent file (the only place a file outside the project can keep any).
preview_head 🔒
Name / path / format, over the picture — shared by both previews.
preview_panel 🔒
The dedicated asset preview: the bottom of the pane, and the only place tags / description / label / folder are edited.
recent_clear 🔒
recent_matches 🔒
Same, plus the recent entry’s own tags and colour label.
recent_remove 🔒
rename_folder 🔒
Rename a folder (and subfolders); assets follow.
reuse_face 🔒
(name, kind tag, icon, drag payload) of one reusable item. ponytail: only adjustment layers have a drop target today — the others carry their name as a Template payload because row()/tile() are drag sources, and a stray drop just misses.
reuse_pick 🔒
What a click on a reusable item asks the app to do.
reuse_sections 🔒
The reusable sections, read straight off the project and settings.json each frame. ponytail: linear scans + a JSON decode per template (is_adjustment_template), same as the Presets pane — the lists are short. A dedicated presets store plugs in here as extra Reuse items.
reuse_ui 🔒
The reusable sections under the tree, in whichever view the toolbar selected.
row 🔒
One list row: a drag source with a click-sensing overlay (select / double-click / context menu) and an optional action button on the right. Returns (row response, button clicked).
row_art 🔒
The picture in front of a file row, h points tall (16:9 box, so every row lines up).
scan_dir 🔒
One level of a folder on disk: subfolders first, then media files. None = unreadable.
sequences_section 🔒
show
thumbs: the app’s ThumbCache, so rows and the preview can show a picture. None (no cache / headless) draws the painted fallback instead. ytdlp = yt-dlp was found at start-up; the “Import URL…” button only exists when it is installed.
split_path 🔒
(“file.mp4”, “C:\dir”) — pure string split on the last path separator.
split_tags 🔒
templates_section 🔒
tile 🔒
Gallery cell: a picture box with the kind tag in its corner and the name under it. Shared by the asset gallery and the reuse sections; the caller decides what the click means.
tile_grid 🔒
Lay items out as a grid of tiles, wrapping every time tile_w more would not fit the pane. horizontal_wrapped cannot do this for tiles: a tile is a drag source whose size is not known until after its contents are drawn, so the wrap test always says the row still has room and a gallery grows one row deep, sideways, forever. Compute the columns instead.
toolbar 🔒
The search + filter toolbar: a framed band in the panel fill with a separator under it, so it never reads as content. head draws the tab-specific leading row (New / Open / Import / sort).
zoom_scroll 🔒
Ctrl+Scroll (and pinch) over the list scales the thumbnails, like every asset browser.

Type Aliases§

Labels 🔒
(name, colour) of every Project.labels entry, snapshotted once per frame.