| 48 | } |
| 49 | |
| 50 | bool mitk::LimitedLinearUndo::SetOperationEvent(UndoStackItem *stackItem) |
| 51 | { |
| 52 | auto *operationEvent = dynamic_cast<OperationEvent *>(stackItem); |
| 53 | if (!operationEvent) |
| 54 | return false; |
| 55 | |
| 56 | // clear the redolist, if a new operation is saved |
| 57 | if (!m_RedoList.empty()) |
| 58 | { |
| 59 | this->ClearList(&m_RedoList); |
| 60 | InvokeEvent(RedoEmptyEvent()); |
| 61 | } |
| 62 | |
| 63 | if (0 != m_UndoLimit && m_UndoList.size() == m_UndoLimit) |
| 64 | { |
| 65 | auto item = m_UndoList.front(); |
| 66 | m_UndoList.pop_front(); |
| 67 | delete item; |
| 68 | } |
| 69 | m_UndoList.push_back(operationEvent); |
| 70 | |
| 71 | InvokeEvent(UndoNotEmptyEvent()); |
| 72 | |
| 73 | return true; |
| 74 | } |
| 75 | |
| 76 | bool mitk::LimitedLinearUndo::Undo(bool fine) |
| 77 | { |