This class stores history stack for undo/redo. More...
#include <MRHistoryStore.h>
Public Types | |
| enum class | ChangeType { AppendAction , PreUndo , PostUndo , PreRedo , PostRedo , Clear , PopAction , Filter } |
| Signal is called after this store changed. More... | |
| using | HistoryStoreChangedSignal = boost::signals2::signal<void( const HistoryStore& store, ChangeType )> |
Public Member Functions | |
| virtual MRVIEWER_API | ~HistoryStore () |
| virtual MRVIEWER_API void | appendAction (std::shared_ptr< HistoryAction > action) |
| HistoryActionsVector * | getScopeBlockPtr () const |
| Returns current scope ptr. | |
| void | setScopeBlockPtr (HistoryActionsVector *scopedBlock) |
| Sets pointer to current scope block. | |
| bool | isSceneModified () const |
| Returns true if the current scene state does not match the saved state. | |
| void | setSavedState () |
| Consider the current scene state as saved. | |
| MRVIEWER_API void | clear () |
| Clears this HistoryStore. | |
| void | setMemoryLimit (size_t limit) |
| Set memory limit for this store, if history stack exceed it - old actions are removed. | |
| size_t | getMemoryLimit () const |
| Returns current memory limit for this store (by default uint64 max) | |
| MRVIEWER_API size_t | calcUsedMemory () const |
| Compute amount of memory occupied by all actions in this store. | |
| const HistoryActionsVector & | getHistoryStack () const |
| Returns full history stack. | |
| size_t | getStackPointer () const |
| Returns index of first redo action in stack. | |
| MRVIEWER_API void | filterStack (HistoryStackFilter filteringCondition, bool deepFiltering=true) |
| remove some actions according to condition | |
| virtual MRVIEWER_API bool | undo () |
| virtual MRVIEWER_API bool | redo () |
| bool | undoRedoInProgress () const |
| true only during Undo or Redo ongoing operation | |
| MRVIEWER_API std::vector< std::string > | getNActions (unsigned n, HistoryAction::Type type) const |
| Returns names of last N undo actions or first N redo actions. | |
| MRVIEWER_API std::shared_ptr< HistoryAction > | getLastAction (HistoryAction::Type type) const |
| Returns the last undo or redo action based on requested type or empty pointer if corresponding stack is empty. | |
| MRVIEWER_API std::string | getLastActionName (HistoryAction::Type type) const |
| Returns the name of last undo or redo action (or empty string if there is no such action) | |
Static Public Member Functions | |
| static MRVIEWER_API const std::shared_ptr< HistoryStore > & | getViewerInstance () |
| returns the instance (if any) of HistoryStore from the viewer | |
Public Attributes | |
| HistoryStoreChangedSignal | changedSignal |
This class stores history stack for undo/redo.
| using MR::HistoryStore::HistoryStoreChangedSignal = boost::signals2::signal<void( const HistoryStore& store, ChangeType )> |
|
strong |
Signal is called after this store changed.
| Enumerator | |
|---|---|
| AppendAction | additions in scoped block does not provide signal |
| PreUndo | |
| PostUndo | |
| PreRedo | |
| PostRedo | |
| Clear | |
| PopAction | called after removing action that exceeds memory limit |
| Filter | |
|
virtual |
|
virtual |
Adds action in history stack (clears available redo actions) adds actions to scope block if scope mode is active (do not affect main stack)
|
nodiscard |
Compute amount of memory occupied by all actions in this store.
| MRVIEWER_API void MR::HistoryStore::clear | ( | ) |
Clears this HistoryStore.
| MRVIEWER_API void MR::HistoryStore::filterStack | ( | HistoryStackFilter | filteringCondition, |
| bool | deepFiltering = true ) |
remove some actions according to condition
|
inlinenodiscard |
Returns full history stack.
|
nodiscard |
Returns the last undo or redo action based on requested type or empty pointer if corresponding stack is empty.
|
nodiscard |
Returns the name of last undo or redo action (or empty string if there is no such action)
|
inlinenodiscard |
Returns current memory limit for this store (by default uint64 max)
|
nodiscard |
Returns names of last N undo actions or first N redo actions.
|
inlinenodiscard |
Returns current scope ptr.
|
inlinenodiscard |
Returns index of first redo action in stack.
|
staticnodiscard |
returns the instance (if any) of HistoryStore from the viewer
|
inlinenodiscard |
Returns true if the current scene state does not match the saved state.
|
virtual |
performs redo of one action, must not be called during ongoing undo or redo, temporary sets undoRedoInProgress()=true
|
inline |
Set memory limit for this store, if history stack exceed it - old actions are removed.
|
inline |
Consider the current scene state as saved.
|
inline |
Sets pointer to current scope block.
|
virtual |
performs undo of one action, must not be called during ongoing undo or redo, temporary sets undoRedoInProgress()=true
|
inlinenodiscard |
true only during Undo or Redo ongoing operation
| HistoryStoreChangedSignal MR::HistoryStore::changedSignal |