MCPcopy Create free account
hub / github.com/MITK/MITK / AddUndoModel

Method AddUndoModel

Modules/Core/src/Controllers/mitkUndoController.cpp:136–160  ·  view source on GitHub ↗

#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

Source from the content-addressed store, hash-verified

134//##and switches to that UndoModel
135//##if the UndoModel exists already in the List, then nothing is done
136bool 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

Callers 1

mitkUndoControllerTestFunction · 0.80

Calls 3

NewFunction · 0.50
findMethod · 0.45
endMethod · 0.45

Tested by 1

mitkUndoControllerTestFunction · 0.64