262 } |
262 } |
263 |
263 |
264 // ============================================================================= |
264 // ============================================================================= |
265 // ----------------------------------------------------------------------------- |
265 // ----------------------------------------------------------------------------- |
266 LDObject::~LDObject() |
266 LDObject::~LDObject() |
267 { // Remove this object from the selection array if it is there. |
267 { // If this object was selected, unselect it now |
268 g_win->sel().removeOne (this); |
268 if (selected()) |
|
269 unselect(); |
269 |
270 |
270 // Delete the GL lists |
271 // Delete the GL lists |
271 GL::deleteLists (this); |
272 GL::deleteLists (this); |
272 |
273 |
273 // Remove this object from the list of LDObjects |
274 // Remove this object from the list of LDObjects |
733 return *it; |
734 return *it; |
734 } |
735 } |
735 |
736 |
736 // ============================================================================= |
737 // ============================================================================= |
737 // ----------------------------------------------------------------------------- |
738 // ----------------------------------------------------------------------------- |
738 void LDSharedVertex::addRef(LDObject* a) |
739 void LDSharedVertex::addRef (LDObject* a) |
739 { m_refs << a; |
740 { m_refs << a; |
740 } |
741 } |
741 |
742 |
742 // ============================================================================= |
743 // ============================================================================= |
743 // ----------------------------------------------------------------------------- |
744 // ----------------------------------------------------------------------------- |
747 if (m_refs.empty()) |
748 if (m_refs.empty()) |
748 { g_sharedVerts.remove (m_data); |
749 { g_sharedVerts.remove (m_data); |
749 delete this; |
750 delete this; |
750 } |
751 } |
751 } |
752 } |
|
753 |
|
754 // ============================================================================= |
|
755 // ----------------------------------------------------------------------------- |
|
756 void LDObject::select() |
|
757 { if (!file()) |
|
758 { log ("Warning: Object #%1 cannot be selected as it is not assigned a file!\n", id()); |
|
759 return; |
|
760 } |
|
761 |
|
762 file()->addToSelection (this); |
|
763 } |
|
764 |
|
765 void LDObject::unselect() |
|
766 { if (!file()) |
|
767 { log ("Warning: Object #%1 cannot be unselected as it is not assigned a file!\n", id()); |
|
768 return; |
|
769 } |
|
770 |
|
771 file()->removeFromSelection (this); |
|
772 } |