#Documentation #Switches the UndoModel to the given Type #if there is no equal Type in List, then return false
| 110 | //##Switches the UndoModel to the given Type |
| 111 | //##if there is no equal Type in List, then return false |
| 112 | bool mitk::UndoController::SwitchUndoModel(UndoType undoType) |
| 113 | { |
| 114 | if (m_CurUndoType == undoType) |
| 115 | { |
| 116 | return true; // already switched, don't need to be switched! |
| 117 | } |
| 118 | |
| 119 | auto undoModelIter = m_UndoModelList.find(undoType); |
| 120 | if (undoModelIter == m_UndoModelList.end()) |
| 121 | { // undoType not found in List |
| 122 | return false; |
| 123 | } |
| 124 | |
| 125 | // found-> switch to UndoModel |
| 126 | m_CurUndoModel = (undoModelIter)->second; |
| 127 | m_CurUndoType = (undoModelIter)->first; |
| 128 | m_CurUndoModel->SetUndoLimit(static_cast<std::size_t>(mitk::UndoRedoPreferenceHelper::GetActiveLimit())); |
| 129 | return true; |
| 130 | } |
| 131 | |
| 132 | //##Documentation |
| 133 | //##adds a new kind of UndoModel to the set of UndoModels |