Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::gui::actions::UndoManager Class Referencefinal

Undo manager. More...

#include <src/gui/backend/backend/actions/undo_manager.h>

Inheritance diagram for zrythm::gui::actions::UndoManager:
Collaboration diagram for zrythm::gui::actions::UndoManager:

Public Member Functions

 UndoManager (QObject *parent=nullptr)
 
void init_loaded (sample_rate_t engine_sample_rate)
 Inits the undo manager by populating the undo/redo stacks.
 
UndoStackgetUndoStack () const
 
UndoStackgetRedoStack () const
 
Q_INVOKABLE void undo ()
 Undo last action.
 
Q_INVOKABLE void redo ()
 Redo last undone action.
 
Q_INVOKABLE void perform (QObject *action_qobject)
 Performs the action and pushes it to the undo stack.
 
bool contains_clip (const AudioClip &clip) const
 Returns whether the given clip is used by any stack.
 
void get_plugins (std::vector< zrythm::gui::old_dsp::plugins::Plugin * > &arr) const
 Returns all plugins in the undo stacks.
 
std::optional< UndoableActionPtrVariant > get_last_action () const
 Returns the last performed action, or NULL if the stack is empty.
 
void clear_stacks ()
 Clears the undo and redo stacks.
 

Data Fields

UndoStackundo_stack_ = nullptr
 
UndoStackredo_stack_ = nullptr
 
bool redo_stack_locked_ = false
 Whether the redo stack is currently locked.
 
std::binary_semaphore action_sem_ { 1 }
 Semaphore for performing actions.
 

Properties

QML_ELEMENT UndoStackundoStack
 
UndoStackredoStack
 

Friends

void init_from (UndoManager &obj, const UndoManager &other, utils::ObjectCloneType clone_type)
 
void to_json (nlohmann::json &j, const UndoManager &undo_manager)
 
void from_json (const nlohmann::json &j, UndoManager &undo_manager)
 

Detailed Description

Undo manager.

Definition at line 20 of file undo_manager.h.

Member Function Documentation

◆ get_plugins()

void zrythm::gui::actions::UndoManager::get_plugins ( std::vector< zrythm::gui::old_dsp::plugins::Plugin * > & arr) const

Returns all plugins in the undo stacks.

Used when cleaning up state dirs.

◆ getRedoStack()

UndoStack * zrythm::gui::actions::UndoManager::getRedoStack ( ) const
inline

Definition at line 38 of file undo_manager.h.

◆ getUndoStack()

UndoStack * zrythm::gui::actions::UndoManager::getUndoStack ( ) const
inline

Definition at line 37 of file undo_manager.h.

◆ perform()

Q_INVOKABLE void zrythm::gui::actions::UndoManager::perform ( QObject * action_qobject)

Performs the action and pushes it to the undo stack.

Note
Takes ownership of the action.
Exceptions
ZrythmExceptionIf the action couldn't be performed.

◆ redo()

Q_INVOKABLE void zrythm::gui::actions::UndoManager::redo ( )

Redo last undone action.

Exceptions
ZrythmExceptionon error.

◆ undo()

Q_INVOKABLE void zrythm::gui::actions::UndoManager::undo ( )

Undo last action.

Exceptions
ZrythmExceptionon error.

Friends And Related Symbol Documentation

◆ from_json

void from_json ( const nlohmann::json & j,
UndoManager & undo_manager )
friend

Definition at line 99 of file undo_manager.h.

◆ to_json

void to_json ( nlohmann::json & j,
const UndoManager & undo_manager )
friend

Definition at line 95 of file undo_manager.h.

Field Documentation

◆ action_sem_

std::binary_semaphore zrythm::gui::actions::UndoManager::action_sem_ { 1 }

Semaphore for performing actions.

Definition at line 133 of file undo_manager.h.

◆ redo_stack_

UndoStack* zrythm::gui::actions::UndoManager::redo_stack_ = nullptr

Definition at line 123 of file undo_manager.h.

◆ redo_stack_locked_

bool zrythm::gui::actions::UndoManager::redo_stack_locked_ = false

Whether the redo stack is currently locked.

This is used as a hack when cancelling arranger drags.

Definition at line 130 of file undo_manager.h.

◆ undo_stack_

UndoStack* zrythm::gui::actions::UndoManager::undo_stack_ = nullptr

Definition at line 122 of file undo_manager.h.

Property Documentation

◆ redoStack

UndoStack * zrythm::gui::actions::UndoManager::redoStack
read

Definition at line 25 of file undo_manager.h.

◆ undoStack

QML_ELEMENT UndoStack * zrythm::gui::actions::UndoManager::undoStack
read

Definition at line 24 of file undo_manager.h.


The documentation for this class was generated from the following file: