95 // ============================================================================= |
95 // ============================================================================= |
96 void DelHistory::undo () { |
96 void DelHistory::undo () { |
97 for (ulong i = 0; i < cache.size(); ++i) { |
97 for (ulong i = 0; i < cache.size(); ++i) { |
98 ulong idx = cache.size() - i - 1; |
98 ulong idx = cache.size() - i - 1; |
99 LDObject* obj = cache[idx]->clone (); |
99 LDObject* obj = cache[idx]->clone (); |
100 g_CurrentFile->objects.insert (g_CurrentFile->objects.begin() + indices[idx], obj); |
100 g_CurrentFile->insertObj (indices[idx], obj); |
101 } |
101 } |
102 |
102 |
103 g_ForgeWindow->refresh (); |
103 g_ForgeWindow->refresh (); |
104 } |
104 } |
105 |
105 |
215 void AddHistory::redo () { |
215 void AddHistory::redo () { |
216 for (ulong i = 0; i < paObjs.size(); ++i) { |
216 for (ulong i = 0; i < paObjs.size(); ++i) { |
217 ulong idx = ulaIndices[i]; |
217 ulong idx = ulaIndices[i]; |
218 LDObject* obj = paObjs[i]->clone (); |
218 LDObject* obj = paObjs[i]->clone (); |
219 |
219 |
220 g_CurrentFile->objects.insert (g_CurrentFile->objects.begin() + idx, obj); |
220 g_CurrentFile->insertObj (idx, obj); |
221 } |
221 } |
222 |
222 |
223 g_ForgeWindow->refresh (); |
223 g_ForgeWindow->refresh (); |
224 } |
224 } |
225 |
225 |
256 |
256 |
257 LDQuad* pQuad = static_cast<LDQuad*> (g_CurrentFile->objects[idx]); |
257 LDQuad* pQuad = static_cast<LDQuad*> (g_CurrentFile->objects[idx]); |
258 std::vector<LDTriangle*> paTriangles = pQuad->splitToTriangles (); |
258 std::vector<LDTriangle*> paTriangles = pQuad->splitToTriangles (); |
259 |
259 |
260 g_CurrentFile->objects[idx] = paTriangles[0]; |
260 g_CurrentFile->objects[idx] = paTriangles[0]; |
261 g_CurrentFile->objects.insert (g_CurrentFile->objects.begin() + idx + 1, paTriangles[1]); |
261 g_CurrentFile->insertObj (idx + 1, paTriangles[1]); |
262 delete pQuad; |
262 delete pQuad; |
263 } |
263 } |
264 |
264 |
265 g_ForgeWindow->refresh (); |
265 g_ForgeWindow->refresh (); |
266 } |
266 } |
290 assert (g_CurrentFile->object (idx)->getType () == OBJ_Subfile); |
290 assert (g_CurrentFile->object (idx)->getType () == OBJ_Subfile); |
291 LDSubfile* ref = static_cast<LDSubfile*> (g_CurrentFile->object (idx)); |
291 LDSubfile* ref = static_cast<LDSubfile*> (g_CurrentFile->object (idx)); |
292 vector<LDObject*> objs = ref->inlineContents (bDeep, false); |
292 vector<LDObject*> objs = ref->inlineContents (bDeep, false); |
293 |
293 |
294 for (LDObject* obj : objs) |
294 for (LDObject* obj : objs) |
295 g_CurrentFile->objects.insert (g_CurrentFile->objects.begin() + idx++, obj); |
295 g_CurrentFile->insertObj (idx++, obj); |
296 |
296 |
297 g_CurrentFile->forgetObject (ref); |
297 g_CurrentFile->forgetObject (ref); |
298 delete ref; |
298 delete ref; |
299 } |
299 } |
300 |
300 |