Struct undo_stack::UndoStack
source · pub struct UndoStack<T>where
T: Undoable,{
pub verbose: bool,
/* private fields */
}Expand description
The main struct where all the undo values are kept.
Fields§
§verbose: boolControls whether warning messages are printed or not. True by default.
Implementations§
source§impl<T> UndoStack<T>where
T: Undoable,
impl<T> UndoStack<T>where
T: Undoable,
sourcepub fn push(&mut self, undo_value: T)
pub fn push(&mut self, undo_value: T)
Push a discrete “Undoable” value to the undo stack. Automatically clears future_stack redo values. Will do nothing if value matches the value on top of undo stack.
sourcepub fn start_group(&mut self)
pub fn start_group(&mut self)
Starts a “group” with multiple undo values that can be undone simultaneously.
sourcepub fn finish_group(&mut self)
pub fn finish_group(&mut self)
Finishes the previously started undo group.
sourcepub fn undo(&mut self, project: &mut T::ProjectType) -> Option<&T>
pub fn undo(&mut self, project: &mut T::ProjectType) -> Option<&T>
Performs undo, which will call the “restore” method on the restored value. Returns an option with the undone value for convenience.
sourcepub fn redo(&mut self, project: &mut T::ProjectType) -> Option<&T>
pub fn redo(&mut self, project: &mut T::ProjectType) -> Option<&T>
Performs redo, which will call the “restore” method on the restored value. Returns an option with the redone value for convenience.
sourcepub fn buffer_is_empty(&self) -> bool
pub fn buffer_is_empty(&self) -> bool
Returns true is the temporary buffer is empty.
sourcepub fn start_buffer(&mut self, value: T)
pub fn start_buffer(&mut self, value: T)
Stores the initial value of a continuously changing interaction - i.e. dragging a GUI slider.
sourcepub fn finish_buffer(&mut self, final_value: T)
pub fn finish_buffer(&mut self, final_value: T)
Finalizes continuous interaction, stores value from the buffer if change has occurred.