28 this->ClearList(&m_UndoList);
29 this->ClearList(&m_RedoList);
34 while (!list->empty())
49 if (!m_RedoList.empty())
51 this->ClearList(&m_RedoList);
52 InvokeEvent(RedoEmptyEvent());
55 m_UndoList.push_back(operationEvent);
57 InvokeEvent(UndoNotEmptyEvent());
72 int oeid = FirstObjectEventIdOfCurrentGroup(
80 if (m_UndoList.empty())
83 int undoObjectEventId = m_UndoList.back()->GetObjectEventId();
84 return Undo(undoObjectEventId);
89 if (m_UndoList.empty())
95 m_UndoList.back()->ReverseAndExecute();
97 m_RedoList.push_back(m_UndoList.back());
98 m_UndoList.pop_back();
99 InvokeEvent(RedoNotEmptyEvent());
101 if (m_UndoList.empty())
103 InvokeEvent(UndoEmptyEvent());
107 }
while (m_UndoList.back()->GetObjectEventId() >= oeid);
121 if (m_RedoList.empty())
124 int redoObjectEventId = m_RedoList.back()->GetObjectEventId();
125 return Redo(redoObjectEventId);
130 if (m_RedoList.empty())
135 m_RedoList.back()->ReverseAndExecute();
137 m_UndoList.push_back(m_RedoList.back());
138 m_RedoList.pop_back();
139 InvokeEvent(UndoNotEmptyEvent());
141 if (m_RedoList.empty())
143 InvokeEvent(RedoEmptyEvent());
146 }
while (m_RedoList.back()->GetObjectEventId() <= oeid);
155 this->ClearList(&m_UndoList);
156 InvokeEvent(UndoEmptyEvent());
158 this->ClearList(&m_RedoList);
159 InvokeEvent(RedoEmptyEvent());
164 this->ClearList(&m_RedoList);
165 InvokeEvent(RedoEmptyEvent());
170 return m_RedoList.empty();
175 return m_UndoList.back()->GetObjectEventId();
180 return m_UndoList.back()->GetGroupEventId();
186 for (
auto iter = m_UndoList.rbegin(); iter != m_UndoList.rend(); ++iter)
202 int currentGroupEventId = stack.back()->GetGroupEventId();
203 int firstObjectEventId = -1;
205 for (
auto iter = stack.rbegin(); iter != stack.rend(); ++iter)
207 if ((*iter)->GetGroupEventId() == currentGroupEventId)
209 firstObjectEventId = (*iter)->GetObjectEventId();
215 return firstObjectEventId;
virtual bool Redo() override
Undoes the last changes.
virtual ~LimitedLinearUndo()
void ClearList(UndoContainer *list)
virtual bool Undo() override
Undoes the last changes.
virtual void ClearRedoList() override
Clears the RedoList.
OperationActor * GetDestination()
abstract class, that can be used by Undo to undo an operation.
virtual void Clear() override
Clears UndoList and RedoList.
static RenderingManager * GetInstance()
Operation * GetOperation()
virtual OperationEvent * GetLastOfType(OperationActor *destination, OperationType opType) override
Returns the last specified OperationEvent in Undo-list corresponding to the given values; if nothing ...
virtual bool RedoListEmpty() override
True, if RedoList is empty.
Represents an entry of the undo or redo stack.
virtual bool SetOperationEvent(UndoStackItem *stackItem) override
virtual int GetLastGroupEventIdInList() override
Returns the GroupEventId of the top element in the OperationHistory.
std::vector< UndoStackItem * > UndoContainer
OperationType GetOperationType()
virtual int GetLastObjectEventIdInList() override
Returns the ObjectEventId of the top element in the OperationHistory.
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
Represents a pair of operations: undo and the according redo.