Struct Tree

Source
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<'_, '_>

Source

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.

Source

fn flip(&mut self, key: &str)

Source

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.

Source

fn folder_icon(&self, ui: &mut Ui, g: Glyph)

Source

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.

Source

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).

Source

fn imported(&mut self, ui: &mut Ui, order: &[usize], flat: bool)

Root 1 — “Imported”: the folders and files this project contains.

Source

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.

Source

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).

Source

fn asset_row(&mut self, ui: &mut Ui, depth: usize, i: usize)

Source

fn asset_tile(&mut self, ui: &mut Ui, i: usize)

Source

fn menu_targets(&self, id: u64) -> Vec<u64>

Every id the menu acts on: the whole selection when the item is part of it, else just it.

Source

fn asset_menu(&mut self, r: &Response, i: usize)

Source

fn global(&mut self, ui: &mut Ui)

Root 2 — “Global”: Recent, and the folders the user linked, browsed straight from disk.

Source

fn recent(&mut self, ui: &mut Ui, depth: usize)

Recent files, from settings.json — everything opened recently, across every project.

Source

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.

Source

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.

Source

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.

Source

fn recent_tint(&self, path: &str) -> Option<Color32>

Colour label of a recent file, if it has one.

Source

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.

Source

fn file_tile(&mut self, ui: &mut Ui, path: &str, recent: bool)

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

§

impl<T> MaybeSend for T

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,