-
-
Notifications
You must be signed in to change notification settings - Fork 235
Undo and Redo via the Object Constructor History
Doug Binks edited this page Jan 15, 2020
·
1 revision
Changes to compiled code at runtime can be reversed with through the IObjectyFactorySystem
functions below. These only modify the compiled binary which is being used, not the source code.
// sets the history of object constructors to a given size
// if set to smaller than before, will preserve the latest
// will not resize smaller than required to preserve current undo state
// default history size is 0, which means history is off (no undo & redo)
// if AddConstructors is called when the current history location is -ve,
// the constructors are updated to locatin 0 (current) prior to adding.
virtual void SetObjectConstructorHistorySize( int num_ ) = 0;
virtual int GetObjectConstructorHistorySize() = 0;
// undo & redo object constructor changes
// this will only undo swapped constructors, not new ones
virtual bool UndoObjectConstructorChange() = 0;
virtual bool RedoObjectConstructorChange() = 0;
// history location is 0 for current, +ve number for a previous location
// undo calls causes location +1, redo -1 bounded by HistorySize and 0.
virtual int GetObjectContstructorHistoryLocation() = 0;
Typically you use these functions through the RuntimeObjectSystem:
// Set the RCC++ undo history size (default is 0 so this enables it)
// This should be done at the start of the app after initializing the RuntimeObjectSystem
m_pRuntimeObjectSystem->GetObjectFactorySystem()->SetObjectConstructorHistorySize( 5 );
// Undo last change:
m_pRuntimeObjectSystem->GetObjectFactorySystem()->UndoObjectConstructorChange();
// redo the change:
m_pRuntimeObjectSystem->GetObjectFactorySystem()->RedoObjectConstructorChange();