struct Tree<'a, 'b> {Show 13 fields
state: &'a mut LibraryState,
project: &'a Project,
settings: &'a Settings,
used: &'a HashSet<u64>,
labels: &'a Vec<(String, [u8; 3])>,
palette: &'a Palette,
thumbs: &'a mut Option<&'b mut ThumbCache>,
resp: &'a mut LibraryResponse,
ops: &'a mut Vec<LibOp>,
op_start: &'a mut bool,
rows: &'a mut Vec<(Pick, Rect)>,
click: &'a mut Option<(Pick, bool, bool)>,
rec: &'a mut Option<RecOp>,
}Expand description
Shared borrows for the tree rows: they recurse, and would otherwise thread a dozen arguments each.
Fields§
§state: &'a mut LibraryState§project: &'a Project§settings: &'a Settings§used: &'a HashSet<u64>§labels: &'a Vec<(String, [u8; 3])>§palette: &'a Palette§thumbs: &'a mut Option<&'b mut ThumbCache>§resp: &'a mut LibraryResponse§ops: &'a mut Vec<LibOp>§op_start: &'a mut bool§rows: &'a mut Vec<(Pick, Rect)>Every selectable row of this frame, in draw order — Shift+click ranges and the band read it.
click: &'a mut Option<(Pick, bool, bool)>The click to resolve once every row is known.
rec: &'a mut Option<RecOp>settings.json edit asked for by a recent file’s menu; settings is only borrowed shared here,
so the browser applies it after the tree.
Implementations§
Source§impl Tree<'_, '_>
impl Tree<'_, '_>
Sourcefn is_open(&self, key: &str, dflt: bool) -> bool
fn is_open(&self, key: &str, dflt: bool) -> bool
Is this node open? Only the flip away from dflt is remembered, so a new folder inherits it.
fn flip(&mut self, key: &str)
Sourcefn arrow(&mut self, ui: &mut Ui, key: &str, dflt: bool, children: bool) -> bool
fn arrow(&mut self, ui: &mut Ui, key: &str, dflt: bool, children: bool) -> bool
The disclosure triangle at the head of a tree row; returns the node’s state after this frame’s click. Painted, not written: ▸ and ▾ are tofu boxes in Segoe UI.
fn folder_icon(&self, ui: &mut Ui, g: Glyph)
Sourcefn drop_asset(&mut self, r: &Response, folder: &str)
fn drop_asset(&mut self, r: &Response, folder: &str)
Move what was dropped onto a folder row into that folder — the whole selection when the dragged asset was part of it, so a marquee of clips moves in one gesture.
Sourcefn hit(&mut self, ui: &Ui, r: &Response, pick: Pick, path: &str)
fn hit(&mut self, ui: &Ui, r: &Response, pick: Pick, path: &str)
Register a drawn row and route its click (the selection is resolved once every row is known).
Sourcefn imported(&mut self, ui: &mut Ui, order: &[usize], flat: bool)
fn imported(&mut self, ui: &mut Ui, order: &[usize], flat: bool)
Root 1 — “Imported”: the folders and files this project contains.
Sourcefn folder(
&mut self,
ui: &mut Ui,
path: &str,
depth: usize,
names: &[String],
order: &[usize],
)
fn folder( &mut self, ui: &mut Ui, path: &str, depth: usize, names: &[String], order: &[usize], )
The subfolders of path (folders first, like an explorer), then the assets that live in it.
Sourcefn assets(&mut self, ui: &mut Ui, depth: usize, list: &[usize])
fn assets(&mut self, ui: &mut Ui, depth: usize, list: &[usize])
A run of assets, as rows or as gallery tiles (already filtered and sorted by the caller).
fn asset_row(&mut self, ui: &mut Ui, depth: usize, i: usize)
fn asset_tile(&mut self, ui: &mut Ui, i: usize)
Every id the menu acts on: the whole selection when the item is part of it, else just it.
Sourcefn global(&mut self, ui: &mut Ui)
fn global(&mut self, ui: &mut Ui)
Root 2 — “Global”: Recent, and the folders the user linked, browsed straight from disk.
Sourcefn recent(&mut self, ui: &mut Ui, depth: usize)
fn recent(&mut self, ui: &mut Ui, depth: usize)
Recent files, from settings.json — everything opened recently, across every project.
Sourcefn dir(&mut self, ui: &mut Ui, path: &str, depth: usize, root: bool)
fn dir(&mut self, ui: &mut Ui, path: &str, depth: usize, root: bool)
One folder on disk. root marks a linked folder — Refresh / Unlink live in its menu.
Sourcefn listing(&mut self, path: &str) -> Option<Vec<(String, bool)>>
fn listing(&mut self, path: &str) -> Option<Vec<(String, bool)>>
One level of a folder, read the first time the node is expanded and cached until Refresh. ponytail: a blocking read_dir on the UI thread, one level per expansion — an eager recursive walk of a media drive would hang the editor. Upgrade: scan on a worker + mpsc, like media/waveform.rs.
Sourcefn files(&mut self, ui: &mut Ui, depth: usize, paths: &[String], recent: bool)
fn files(&mut self, ui: &mut Ui, depth: usize, paths: &[String], recent: bool)
A run of files that are not in the project. recent shows their folder and Recent label colour.
Sourcefn recent_tint(&self, path: &str) -> Option<Color32>
fn recent_tint(&self, path: &str) -> Option<Color32>
Colour label of a recent file, if it has one.
Sourcefn file(&mut self, ui: &mut Ui, path: &str, depth: usize, recent: bool)
fn file(&mut self, ui: &mut Ui, path: &str, depth: usize, recent: bool)
One media file on disk: thumbnail, name, kind. Single click previews it, double click imports it.
fn file_tile(&mut self, ui: &mut Ui, path: &str, recent: bool)
Sourcefn file_click(&mut self, ui: &Ui, r: &Response, path: &str, recent: bool)
fn file_click(&mut self, ui: &Ui, r: &Response, path: &str, recent: bool)
Select + preview on a single click, import on a double click, plus the file menu (pins, labels and the recent list live here now that “Global” is where recent files are shown).
Auto Trait Implementations§
impl<'a, 'b> Freeze for Tree<'a, 'b>
impl<'a, 'b> !RefUnwindSafe for Tree<'a, 'b>
impl<'a, 'b> Send for Tree<'a, 'b>
impl<'a, 'b> Sync for Tree<'a, 'b>
impl<'a, 'b> Unpin for Tree<'a, 'b>
impl<'a, 'b> !UnwindSafe for Tree<'a, 'b>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more