MeshLib
 
Loading...
Searching...
No Matches
MR::HistoryStore Class Reference

This class stores history stack for undo/redo. More...

#include <MRHistoryStore.h>

Public Types

enum class  ChangeType {
  AppendAction , Undo , Redo , Clear ,
  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)
 
HistoryActionsVectorgetScopeBlockPtr () 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)
 
const HistoryActionsVectorgetHistoryStack () 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
 

Detailed Description

This class stores history stack for undo/redo.

Member Typedef Documentation

◆ HistoryStoreChangedSignal

using MR::HistoryStore::HistoryStoreChangedSignal = boost::signals2::signal<void( const HistoryStore& store, ChangeType )>

Member Enumeration Documentation

◆ ChangeType

enum class MR::HistoryStore::ChangeType
strong

Signal is called after this store changed.

Enumerator
AppendAction 

additions in scoped block does not provide signal

Undo 
Redo 
Clear 
Filter 

Constructor & Destructor Documentation

◆ ~HistoryStore()

virtual MRVIEWER_API MR::HistoryStore::~HistoryStore ( )
virtual

Member Function Documentation

◆ appendAction()

virtual MRVIEWER_API void MR::HistoryStore::appendAction ( const std::shared_ptr< HistoryAction > & action)
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)

◆ clear()

MRVIEWER_API void MR::HistoryStore::clear ( )

Clears this HistoryStore.

◆ filterStack()

MRVIEWER_API void MR::HistoryStore::filterStack ( HistoryStackFilter filteringCondition,
bool deepFiltering = true )

remove some actions according to condition

◆ getHistoryStack()

const HistoryActionsVector & MR::HistoryStore::getHistoryStack ( ) const
inline

Returns full history stack.

◆ getLastActionName()

MRVIEWER_API std::string MR::HistoryStore::getLastActionName ( HistoryAction::Type type) const

Returns the name of last undo or redo action (or empty string if there is no such action)

◆ getMemoryLimit()

size_t MR::HistoryStore::getMemoryLimit ( ) const
inline

Returns current memory limit for this store (by default uint64 max)

◆ getNActions()

MRVIEWER_API std::vector< std::string > MR::HistoryStore::getNActions ( unsigned n,
HistoryAction::Type type ) const

Returns names of last N undo actions or first N redo actions.

◆ getScopeBlockPtr()

HistoryActionsVector * MR::HistoryStore::getScopeBlockPtr ( ) const
inline

Returns current scope ptr.

◆ getStackPointer()

size_t MR::HistoryStore::getStackPointer ( ) const
inline

Returns index of first redo action in stack.

◆ getViewerInstance()

static MRVIEWER_API const std::shared_ptr< HistoryStore > & MR::HistoryStore::getViewerInstance ( )
static

returns the instance (if any) of HistoryStore from the viewer

◆ isSceneModified()

bool MR::HistoryStore::isSceneModified ( ) const
inline

Returns true if the current scene state does not match the saved state.

◆ redo()

virtual MRVIEWER_API bool MR::HistoryStore::redo ( )
virtual

◆ setMemoryLimit()

void MR::HistoryStore::setMemoryLimit ( size_t limit)
inline

Set memory limit for this store, if history stack exceed it - old actions are removed.

◆ setSavedState()

void MR::HistoryStore::setSavedState ( )
inline

Consider the current scene state as saved.

◆ setScopeBlockPtr()

void MR::HistoryStore::setScopeBlockPtr ( HistoryActionsVector * scopedBlock)
inline

Sets pointer to current scope block.

◆ undo()

virtual MRVIEWER_API bool MR::HistoryStore::undo ( )
virtual

Member Data Documentation

◆ changedSignal

HistoryStoreChangedSignal MR::HistoryStore::changedSignal

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