26 MRVIEWER_API
virtual void appendAction( std::shared_ptr<HistoryAction> action );
35 [[nodiscard]]
bool isSceneModified()
const {
return firstRedoIndex_ != savedSceneIndex_; }
63 MRVIEWER_API
virtual bool undo();
67 MRVIEWER_API
virtual bool redo();
105 size_t firstRedoIndex_{ 0 };
109 size_t savedSceneIndex_{ 0 };
112 size_t storageLimit_{ size_t( ~0 ) };
115 bool undoRedoInProgress_{
false };
118 void filterByMemoryLimit_();
This class stores history stack for undo/redo.
Definition MRHistoryStore.h:16
boost::signals2::signal< void(HistoryStore &store, ChangeType, std::shared_ptr< HistoryAction > action)> HistoryStoreChangedSignal
Definition MRHistoryStore.h:94
virtual void appendAction(std::shared_ptr< HistoryAction > action)
HistoryActionsVector * getScopeBlockPtr() const
Returns current scope ptr.
Definition MRHistoryStore.h:29
size_t getMemoryLimit() const
Returns current memory limit for this store (by default uint64 max)
Definition MRHistoryStore.h:47
void setMemoryLimit(size_t limit)
Set memory limit for this store, if history stack exceed it - old actions are removed.
Definition MRHistoryStore.h:44
size_t calcUsedMemory() const
Compute amount of memory occupied by all actions in this store.
size_t getStackPointer() const
Returns index of first redo action in stack.
Definition MRHistoryStore.h:56
const HistoryActionsVector & getHistoryStack() const
Returns full history stack.
Definition MRHistoryStore.h:53
bool undoRedoInProgress() const
true only during Undo or Redo ongoing operation
Definition MRHistoryStore.h:70
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 ...
void clear()
Clears this HistoryStore.
void filterStack(HistoryStackFilter filteringCondition, bool deepFiltering=true)
remove some actions according to condition
ChangeType
Signal is called after this store changed.
Definition MRHistoryStore.h:83
@ PreUndo
called right before action is undone: action - the that will be undone
Definition MRHistoryStore.h:86
@ PreRedo
called right before action is redone: action - the that will be redone
Definition MRHistoryStore.h:88
@ PostUndo
called right after action is undone: action - the that have been undone
Definition MRHistoryStore.h:87
@ PostAppendAction
called after action is appended either to store or to current scope: action - one that was just added
Definition MRHistoryStore.h:85
@ PreAppendAction
called before action is appended (allows to decorate raw actions with scopes): action - that is about...
Definition MRHistoryStore.h:84
@ PopAction
called after removing action that exceeds memory limit: action - nullptr
Definition MRHistoryStore.h:91
@ Filter
called after this store is filtered: action - nullptr
Definition MRHistoryStore.h:92
@ Clear
called when this store is cleaned: action - nullptr
Definition MRHistoryStore.h:90
@ PostRedo
called right after action is redone: action - the that have been redone
Definition MRHistoryStore.h:89
std::vector< std::string > getNActions(unsigned n, HistoryAction::Type type) const
Returns names of last N undo actions or first N redo actions.
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)
void setSavedState()
Consider the current scene state as saved.
Definition MRHistoryStore.h:38
bool isSceneModified() const
Returns true if the current scene state does not match the saved state.
Definition MRHistoryStore.h:35
static HistoryStore * getViewerInstance()
HistoryStoreChangedSignal changedSignal
Definition MRHistoryStore.h:95
void setScopeBlockPtr(HistoryActionsVector *scopedBlock)
Sets pointer to current scope block.
Definition MRHistoryStore.h:32
std::function< bool(const std::shared_ptr< HistoryAction > &)> HistoryStackFilter
Definition MRHistoryAction.h:33
std::vector< std::shared_ptr< HistoryAction > > HistoryActionsVector
Definition MRHistoryAction.h:34
Type
Definition MRHistoryAction.h:22
only for bindings generation
Definition MRCameraOrientationPlugin.h:8