173 void EditHistory::addEntry (LDObject* const oldObj, LDObject* const newObj) { |
173 void EditHistory::addEntry (LDObject* const oldObj, LDObject* const newObj) { |
174 addEntry (oldObj, newObj, oldObj->getIndex (g_curfile)); |
174 addEntry (oldObj, newObj, oldObj->getIndex (g_curfile)); |
175 } |
175 } |
176 |
176 |
177 void EditHistory::addEntry (LDObject* const oldObj, LDObject* const newObj, const ulong idx) { |
177 void EditHistory::addEntry (LDObject* const oldObj, LDObject* const newObj, const ulong idx) { |
178 ulaIndices.push_back (idx); |
178 ulaIndices << idx; |
179 paOldObjs.push_back (oldObj->clone ()); |
179 paOldObjs << oldObj->clone (); |
180 paNewObjs.push_back (newObj->clone ()); |
180 paNewObjs << newObj->clone (); |
181 } |
181 } |
182 |
182 |
183 EditHistory::~EditHistory () { |
183 EditHistory::~EditHistory () { |
184 for (LDObject* obj : paOldObjs) |
184 for (LDObject* obj : paOldObjs) |
185 delete obj; |
185 delete obj; |
193 // ============================================================================= |
193 // ============================================================================= |
194 vector<LDObject*> ListMoveHistory::getObjects (short ofs) { |
194 vector<LDObject*> ListMoveHistory::getObjects (short ofs) { |
195 vector<LDObject*> objs; |
195 vector<LDObject*> objs; |
196 |
196 |
197 for (ulong idx : ulaIndices) |
197 for (ulong idx : ulaIndices) |
198 objs.push_back (g_curfile->object (idx + ofs)); |
198 objs << g_curfile->object (idx + ofs); |
199 |
199 |
200 return objs; |
200 return objs; |
201 } |
201 } |
202 |
202 |
203 void ListMoveHistory::undo () { |
203 void ListMoveHistory::undo () { |