UndoManager

Engine/source/util/undo.h

More...

Compound Actions

The compound action stack allows to redirect undos to a CompoundUndoAction and thus assemble multi-operation undos directly through the UndoManager.

When the bottom-most CompoundUndoAction is popped off the stack, the compound will be moved onto the undo stack.

Push a compound action called "name" onto the compound stack.

popCompound(bool discard)

Pop the topmost compound off the compound stack and add it to the undo manager.

Return the current nesting depth of the compound stack.

Public Types

Parent 

Private Static Attributes

Default number of undo & redo levels.

Private Attributes

Stack for assembling compound actions.

The stacks of undo & redo actions. They will be capped at size mNumLevels.

Public Attributes

Number of undo & redo levels.

Private Functions

Clamps a Vector to mNumLevels entries.

Deletes all the UndoActions in a stack, then clears it.

doRemove(UndoAction * action, bool noDelete)

Run the removal logic on the action.

Public Functions

UndoManager(U32 levels)

Constructor. If levels = 0, we use the default number of undo levels.

Destructor. deletes and clears the undo & redo stacks.

Add an action to the top of the undo stack, and clear the redo stack.

Clears the undo and redo stacks.

const char *

Returns the printable name of the top actions on the undo & redo stacks.

const char *
const char *
redo()

Redo the last action, and put it on the undo stack.

removeAction(UndoAction * action, bool noDelete)
undo()

Undo last action, and put it on the redo stack.

Public Static Functions

Accessor to the default undo manager singleton. Creates one if needed.

Detailed Description

Compound Actions

The compound action stack allows to redirect undos to a CompoundUndoAction and thus assemble multi-operation undos directly through the UndoManager.

When the bottom-most CompoundUndoAction is popped off the stack, the compound will be moved onto the undo stack.

pushCompound(const String & name)

Push a compound action called "name" onto the compound stack.

While the compound stack is not empty, all undos that are queued on the undo manager will go to the topmost compound instead of the undo stack.

popCompound(bool discard)

Pop the topmost compound off the compound stack and add it to the undo manager.

If the compound stack is still not empty, the compound will be added to the next lower compound on the stack. Otherwise it will be recorded as a regular undo.

getCompoundStackDepth()

Return the current nesting depth of the compound stack.

Public Types

typedef SimObject Parent 

Private Static Attributes

const U32 kDefaultNumLevels 

Default number of undo & redo levels.

Private Attributes

Vector< CompoundUndoAction * > mCompoundStack 

Stack for assembling compound actions.

Vector< UndoAction * > mRedoStack 
Vector< UndoAction * > mUndoStack 

The stacks of undo & redo actions. They will be capped at size mNumLevels.

Public Attributes

U32 mNumLevels 

Number of undo & redo levels.

Private Functions

clampStack(Vector< UndoAction * > & stack)

Clamps a Vector to mNumLevels entries.

clearStack(Vector< UndoAction * > & stack)

Deletes all the UndoActions in a stack, then clears it.

doRemove(UndoAction * action, bool noDelete)

Run the removal logic on the action.

Public Functions

UndoManager(U32 levels)

Constructor. If levels = 0, we use the default number of undo levels.

~UndoManager()

Destructor. deletes and clears the undo & redo stacks.

addAction(UndoAction * action)

Add an action to the top of the undo stack, and clear the redo stack.

clearAll()

Clears the undo and redo stacks.

DECLARE_CONOBJECT(UndoManager )

getNextRedoName()

getNextUndoName()

Returns the printable name of the top actions on the undo & redo stacks.

getRedoAction(S32 index)

getRedoCount()

getRedoName(S32 index)

getUndoAction(S32 index)

getUndoCount()

getUndoName(S32 index)

redo()

Redo the last action, and put it on the undo stack.

removeAction(UndoAction * action, bool noDelete)

undo()

Undo last action, and put it on the redo stack.

Public Static Functions

getDefaultManager()

Accessor to the default undo manager singleton. Creates one if needed.

initPersistFields()