This class stores history stack for undo/redo. More...
#include <MRHistoryStore.h>
Public Types | |
enum class | ChangeType { AppendAction , Undo , Redo , 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 (const 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 () |
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::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 |
Undo | |
Redo | |
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 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 |
|
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 |
HistoryStoreChangedSignal MR::HistoryStore::changedSignal |