pub struct Layout {
pub tree: Tree<Pane>,
pub popped: Vec<Pane>,
pub undo: Vec<String>,
pub redo: Vec<String>,
}Expand description
The whole layout: the docked tree plus panes currently popped out into their own windows.
Fields§
§tree: Tree<Pane>§popped: Vec<Pane>§undo: Vec<String>The layout’s own undo history (serialised layouts): the layout is not the project, so it cannot ride the project’s snapshots. Never persisted, and 20 steps is plenty for “put that tab back”.
redo: Vec<String>Implementations§
Source§impl Layout
impl Layout
pub fn default_layout() -> Self
pub fn to_json(&self) -> String
Sourcepub fn from_json(s: &str) -> Option<Self>
pub fn from_json(s: &str) -> Option<Self>
None on malformed / incompatible JSON (caller falls back to the default layout). A layout saved before round 3 knows nothing about Tools / Nodes / Mixer / Markers: rather than dropping four panes into the root as loose tabs, it is rejected here and the caller resets to the new default.
Sourcepub fn from_json_migrating(s: &str) -> Option<Self>
pub fn from_json_migrating(s: &str) -> Option<Self>
Same, but an explicitly saved profile is migrated instead of rejected: panes it predates are added to the root rather than making the whole profile unloadable.
Sourcepub fn is_visible(&self, pane: Pane) -> bool
pub fn is_visible(&self, pane: Pane) -> bool
Visible = docked in the tree (and not hidden) or popped out.
Sourcepub fn toggle(&mut self, pane: Pane)
pub fn toggle(&mut self, pane: Pane)
Show (back where it was in the tree, or into the root when it is gone) or hide (invisible in the tree / close the popout).
Sourcepub fn reveal(&mut self, pane: Pane)
pub fn reveal(&mut self, pane: Pane)
Make the pane visible (docked or popped) and, if it is a tab, the active one.
pub fn popout(&mut self, pane: Pane)
pub fn dock(&mut self, pane: Pane)
pub fn reset(&mut self)
Sourcepub fn push_undo(&mut self, snapshot: String)
pub fn push_undo(&mut self, snapshot: String)
Remember the arrangement snapshot was taken from (before the move), so Ctrl+Z can go back to it.
pub fn undo(&mut self) -> bool
pub fn redo(&mut self) -> bool
fn step(&mut self, undoing: bool) -> bool
Sourcefn insert_into_root(&mut self, pane: Pane)
fn insert_into_root(&mut self, pane: Pane)
A pane that fell out of the tree entirely (e.g. an old profile): add it as a new tab in the root.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Layout
impl<'de> Deserialize<'de> for Layout
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnwindSafe for Layout
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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