228 // ============================================================================= |
228 // ============================================================================= |
229 // ----------------------------------------------------------------------------- |
229 // ----------------------------------------------------------------------------- |
230 void LDObject::swap (LDObject* other) |
230 void LDObject::swap (LDObject* other) |
231 { int i = 0; |
231 { int i = 0; |
232 |
232 |
233 for (LDObject * obj : file()->objects()) |
233 for (LDObject* obj : file()->objects()) |
234 { if (obj == this) |
234 { if (obj == this) |
235 file()->setObject (i, other); |
235 file()->setObject (i, other); |
236 |
|
237 elif (obj == other) |
236 elif (obj == other) |
238 file()->setObject (i, this); |
237 file()->setObject (i, this); |
239 |
238 |
240 ++i; |
239 ++i; |
241 } |
240 } |
242 |
241 |
243 file()->addToHistory (new SwapHistory (id(), other->id())); |
242 file()->addToHistory (new SwapHistory (id(), other->id())); |