Controller that manages undo/redo operations by delegating to an UndoModel.
More...
#include <mitkUndoController.h>
Controller that manages undo/redo operations by delegating to an UndoModel.
The UndoController selects and delegates to an UndoModel implementation (e.g. LimitedLinearUndo or VerboseLimitedLinearUndo). Multiple UndoModel types can be registered and switched at runtime.
Definition at line 40 of file mitkUndoController.h.
◆ UndoModelMap
◆ UndoModelMapIter
◆ UndoType
Enumeration of available undo model types.
| Enumerator |
|---|
| LIMITEDLINEARUNDO | |
| VERBOSE_LIMITEDLINEARUNDO | |
| TREEUNDO | |
Definition at line 44 of file mitkUndoController.h.
◆ UndoController()
Construct an UndoController.
Adds the specified UndoType to the model list if it does not exist, or switches to it if it already exists.
- Parameters
-
| [in] | undoType | The type of undo model to use. Defaults to DEFAULTUNDOMODEL. |
◆ ~UndoController()
| virtual mitk::UndoController::~UndoController |
( |
| ) |
|
|
virtual |
◆ AddUndoModel()
| bool mitk::UndoController::AddUndoModel |
( |
UndoType |
undoType | ) |
|
Add a new undo model type and switch to it.
If the type already exists, nothing is done and false is returned.
- Parameters
-
| [in] | undoType | The undo model type to add. |
- Returns
- True if the model was added successfully.
◆ Clear()
| void mitk::UndoController::Clear |
( |
| ) |
|
Clear both the undo and redo lists.
◆ ClearRedoList()
| void mitk::UndoController::ClearRedoList |
( |
| ) |
|
Clear the redo list only.
◆ GetCurrentUndoModel()
| static UndoModel* mitk::UndoController::GetCurrentUndoModel |
( |
| ) |
|
|
static |
Return the currently active UndoModel.
Can be used to access model-specific functions, such as retrieving text descriptions of the undo/redo stack from VerboseLimitedLinearUndo.
- Returns
- Pointer to the current UndoModel.
◆ GetLastGroupEventIdInList()
| int mitk::UndoController::GetLastGroupEventIdInList |
( |
| ) |
|
Return the GroupEventId of the top element in the undo history.
- Returns
- The GroupEventId of the most recent undo stack entry.
◆ GetLastObjectEventIdInList()
| int mitk::UndoController::GetLastObjectEventIdInList |
( |
| ) |
|
Return the ObjectEventId of the top element in the undo history.
- Returns
- The ObjectEventId of the most recent undo stack entry.
◆ GetLastOfType()
Return the last OperationEvent matching the given destination and operation type.
- Parameters
-
| [in] | destination | The target OperationActor. |
| [in] | opType | The operation type to search for. |
- Returns
- The matching OperationEvent, or nullptr if not found.
◆ Redo() [1/2]
| bool mitk::UndoController::Redo |
( |
| ) |
|
Redo the last undone change (fine-grained, by ObjectEventId).
- Returns
- True if the redo was performed successfully.
◆ Redo() [2/2]
| bool mitk::UndoController::Redo |
( |
bool |
fine | ) |
|
Redo the last undone change with control over granularity.
- Parameters
-
| [in] | fine | If true, redo by ObjectEventId; if false, redo by GroupEventId. |
- Returns
- True if the redo was performed successfully.
◆ RedoListEmpty()
| bool mitk::UndoController::RedoListEmpty |
( |
| ) |
|
Check whether the redo list is empty.
- Returns
- True if the redo list contains no entries.
◆ RemoveUndoModel()
| bool mitk::UndoController::RemoveUndoModel |
( |
UndoType |
undoType | ) |
|
Remove an undo model type from the list.
If the removed type is the currently active one, the controller switches to the default model or the first available model. The last remaining model cannot be removed.
- Parameters
-
| [in] | undoType | The undo model type to remove. |
- Returns
- True if the model was removed successfully.
◆ SetOperationEvent()
| bool mitk::UndoController::SetOperationEvent |
( |
UndoStackItem * |
operationEvent | ) |
|
Store an operation event in the current undo model.
- Parameters
-
| [in] | operationEvent | The undo stack item to store. |
- Returns
- True if the operation was stored successfully.
◆ SwitchUndoModel()
| bool mitk::UndoController::SwitchUndoModel |
( |
UndoType |
undoType | ) |
|
Switch to a different undo model type.
- Parameters
-
| [in] | undoType | The undo model type to switch to. |
- Returns
- True if the switch was successful, false if the type is not registered.
◆ Undo() [1/2]
| bool mitk::UndoController::Undo |
( |
| ) |
|
Undo the last change (fine-grained, by ObjectEventId).
- Returns
- True if the undo was performed successfully.
◆ Undo() [2/2]
| bool mitk::UndoController::Undo |
( |
bool |
fine | ) |
|
Undo the last change with control over granularity.
The undo mechanism can undo in two ways:
- Fine undo: undo all operations with the same ObjectEventId
- Coarse undo: undo all operations with the same GroupEventId
- Parameters
-
| [in] | fine | If true, undo by ObjectEventId; if false, undo by GroupEventId. |
- Returns
- True if the undo was performed successfully.
◆ DEFAULTUNDOMODEL
| const UndoType mitk::UndoController::DEFAULTUNDOMODEL |
|
static |
The documentation for this class was generated from the following file: