Represents an entry of the undo or redo stack. More...
#include <mitkOperationEvent.h>
Public Member Functions | |
UndoStackItem (std::string description="") | |
virtual | ~UndoStackItem () |
int | GetGroupEventId () |
Returns the GroupEventId for this object. | |
int | GetObjectEventId () |
Returns the ObjectEventId for this object. | |
std::string | GetDescription () |
Returns the textual description of this object. | |
virtual void | ReverseOperations () |
virtual void | ReverseAndExecute () |
Static Public Member Functions | |
static int | GetCurrGroupEventId () |
For combining operations in groups. | |
static int | GetCurrObjectEventId () |
For combining operations in Objects. | |
static void | IncCurrObjectEventId () |
Sets the current ObjectEventId to be incremended when ExecuteIncrement is called For example if a button click generates operations the ObjectEventId has to be incremented to be able to undo the operations. Difference between ObjectEventId and GroupEventId: The ObjectEventId capsulates all operations caused by one event. A GroupEventId capsulates several ObjectEventIds so that several operations caused by several events can be undone with one Undo call. | |
static void | IncCurrGroupEventId () |
Sets the current GroupEventId to be incremended when ExecuteIncrement is called For example if a button click generates operations the GroupEventId has to be incremented to be able to undo the operations. Difference between ObjectEventId and GroupEventId: The ObjectEventId capsulates all operations caused by one event. A GroupEventId capsulates several ObjectEventIds so that several operations caused by several events can be undone with one Undo call. | |
static void | ExecuteIncrement () |
Executes the incrementation of objectEventId and groupEventId if they are set to be incremented. | |
Protected Attributes | |
bool | m_Reversed |
true, if operation and undooperation have been swaped/changed |
Represents an entry of the undo or redo stack.
This basic entry includes a textual description of the item and a pair of IDs. Static member functions handle creation and incrementing of these IDs.
The ObjectEventID is increased by the global EventMapper for most of the events (see code for details). Incrementation of the IDs is done in two steps. First the EventMapper sets a flag via (possibly multiple calls of) IncCurrObjectEventID(), then ExecuteIncrement() does the actual incementation.
The GroupEventID is intended for logical grouping of several related Operations. Currently this is used only by PointSetInteractor. How this is done and when to use GroupEventIDs is still undocumented.
Definition at line 46 of file mitkOperationEvent.h.
mitk::UndoStackItem::UndoStackItem | ( | std::string | description = "" ) |
Definition at line 29 of file mitkOperationEvent.cpp.
References GetCurrGroupEventId(), and GetCurrObjectEventId().
: m_Reversed(false), m_Description(description) { m_ObjectEventId = GetCurrObjectEventId(); m_GroupEventId = GetCurrGroupEventId(); }
mitk::UndoStackItem::~UndoStackItem | ( | ) | [virtual] |
Definition at line 37 of file mitkOperationEvent.cpp.
{
// nothing to do
}
void mitk::UndoStackItem::ExecuteIncrement | ( | ) | [static] |
Executes the incrementation of objectEventId and groupEventId if they are set to be incremented.
Definition at line 42 of file mitkOperationEvent.cpp.
Referenced by QmitkSlicesInterpolator::AcceptAllInterpolations(), QmitkPointBasedRegistrationView::calculateLandmarkWarping(), mitk::EventMapper::MapEvent(), mitkVerboseLimitedLinearUndoTest(), and QmitkSlicesInterpolator::OnAcceptInterpolationClicked().
{ if (m_IncrObjectEventId) { ++m_CurrObjectEventId; m_IncrObjectEventId = false; } if (m_IncrGroupEventId) { ++m_CurrGroupEventId; m_IncrGroupEventId = false; } }
int mitk::UndoStackItem::GetCurrGroupEventId | ( | ) | [static] |
For combining operations in groups.
This ID is used in the undo mechanism. For separation of the seperate operations If the GroupEventId of two OperationEvents is equal, then they share one group and will be undone in case of Undo(fine==false)
Definition at line 62 of file mitkOperationEvent.cpp.
Referenced by UndoStackItem().
{
return m_CurrGroupEventId;
}
int mitk::UndoStackItem::GetCurrObjectEventId | ( | ) | [static] |
For combining operations in Objects.
This ID is used in the Undo-Mechanism. For separation of the seperate operations If the ObjectEventId of two OperationEvents is equal, then they share one Object and will be undone in all cases of Undo(true and false). they shal not be seperated, because they were produced to realize one object-change. for example: OE_statechange and OE_addlastpoint
Definition at line 57 of file mitkOperationEvent.cpp.
Referenced by UndoStackItem().
{
return m_CurrObjectEventId;
}
std::string mitk::UndoStackItem::GetDescription | ( | ) |
Returns the textual description of this object.
Definition at line 87 of file mitkOperationEvent.cpp.
{
return m_Description;
}
int mitk::UndoStackItem::GetGroupEventId | ( | ) |
Returns the GroupEventId for this object.
Definition at line 82 of file mitkOperationEvent.cpp.
{
return m_GroupEventId;
}
int mitk::UndoStackItem::GetObjectEventId | ( | ) |
Returns the ObjectEventId for this object.
Definition at line 77 of file mitkOperationEvent.cpp.
{
return m_ObjectEventId;
}
void mitk::UndoStackItem::IncCurrGroupEventId | ( | ) | [static] |
Sets the current GroupEventId to be incremended when ExecuteIncrement is called For example if a button click generates operations the GroupEventId has to be incremented to be able to undo the operations. Difference between ObjectEventId and GroupEventId: The ObjectEventId capsulates all operations caused by one event. A GroupEventId capsulates several ObjectEventIds so that several operations caused by several events can be undone with one Undo call.
Definition at line 72 of file mitkOperationEvent.cpp.
Referenced by QmitkSlicesInterpolator::AcceptAllInterpolations(), mitk::StateMachine::IncCurrGroupEventId(), and QmitkSlicesInterpolator::OnAcceptInterpolationClicked().
{
m_IncrGroupEventId = true;
}
void mitk::UndoStackItem::IncCurrObjectEventId | ( | ) | [static] |
Sets the current ObjectEventId to be incremended when ExecuteIncrement is called For example if a button click generates operations the ObjectEventId has to be incremented to be able to undo the operations. Difference between ObjectEventId and GroupEventId: The ObjectEventId capsulates all operations caused by one event. A GroupEventId capsulates several ObjectEventIds so that several operations caused by several events can be undone with one Undo call.
Definition at line 67 of file mitkOperationEvent.cpp.
Referenced by QmitkSlicesInterpolator::AcceptAllInterpolations(), QmitkPointBasedRegistrationView::calculateLandmarkWarping(), mitk::EventMapper::MapEvent(), mitkVerboseLimitedLinearUndoTest(), and QmitkSlicesInterpolator::OnAcceptInterpolationClicked().
{
m_IncrObjectEventId = true;
}
void mitk::UndoStackItem::ReverseAndExecute | ( | ) | [virtual] |
Reimplemented in mitk::OperationEvent.
Definition at line 97 of file mitkOperationEvent.cpp.
{ ReverseOperations(); }
void mitk::UndoStackItem::ReverseOperations | ( | ) | [virtual] |
Reimplemented in mitk::OperationEvent.
Definition at line 92 of file mitkOperationEvent.cpp.
Referenced by mitk::OperationEvent::ReverseOperations().
{ m_Reversed = !m_Reversed; }
bool mitk::UndoStackItem::m_Reversed [protected] |
true, if operation and undooperation have been swaped/changed
Definition at line 109 of file mitkOperationEvent.h.