src/history.cpp

changeset 252
3f9067022d74
parent 251
c4b96bc41298
child 265
955c0aabfebf
equal deleted inserted replaced
251:c4b96bc41298 252:3f9067022d74
39 for (ulong i = s_pos + 1; i < s_entries.size(); ++i) { 39 for (ulong i = s_pos + 1; i < s_entries.size(); ++i) {
40 delete s_entries[i]; 40 delete s_entries[i];
41 s_entries.erase (i); 41 s_entries.erase (i);
42 } 42 }
43 43
44 s_entries.push_back (entry); 44 s_entries << entry;
45 s_pos++; 45 s_pos++;
46 46
47 updateActions (); 47 updateActions ();
48 } 48 }
49 49
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 () {

mercurial