#Documentation #adds a new kind of UndoModel to the set of UndoModels #and switches to that UndoModel #if the UndoModel exists already in the List, then nothing is done
| 134 | //##and switches to that UndoModel |
| 135 | //##if the UndoModel exists already in the List, then nothing is done |
| 136 | bool mitk::UndoController::AddUndoModel(UndoType undoType) |
| 137 | { |
| 138 | if (m_UndoModelList.find(undoType) != m_UndoModelList.end()) |
| 139 | { // UndoModel already exists |
| 140 | return false; |
| 141 | } |
| 142 | // doesn't already exist in list |
| 143 | switch (undoType) |
| 144 | { |
| 145 | case LIMITEDLINEARUNDO: |
| 146 | m_CurUndoModel = LimitedLinearUndo::New(); |
| 147 | m_CurUndoType = undoType; |
| 148 | m_UndoModelList.insert(UndoModelMap::value_type(undoType, m_CurUndoModel)); |
| 149 | break; |
| 150 | case VERBOSE_LIMITEDLINEARUNDO: |
| 151 | m_CurUndoModel = VerboseLimitedLinearUndo::New(); |
| 152 | m_CurUndoType = undoType; |
| 153 | m_UndoModelList.insert(UndoModelMap::value_type(undoType, m_CurUndoModel)); |
| 154 | break; |
| 155 | default: |
| 156 | // that undoType is not implemented! |
| 157 | return false; |
| 158 | } |
| 159 | return true; |
| 160 | } |
| 161 | |
| 162 | //##Documentation |
| 163 | //##Removes an UndoModel from the set of UndoModels |