| 78 LDObject::~LDObject() |
79 LDObject::~LDObject() |
| 79 { |
80 { |
| 80 // Don't bother during program termination |
81 // Don't bother during program termination |
| 81 if (IsExiting() == false) |
82 if (IsExiting() == false) |
| 82 { |
83 { |
| 83 // If this object was selected, unselect it now |
84 deselect(); |
| 84 if (isSelected() and document() != null) |
|
| 85 deselect(); |
|
| 86 |
85 |
| 87 // If this object was associated to a file, remove it off it now |
86 // If this object was associated to a file, remove it off it now |
| 88 if (document() != null) |
87 if (document() != null) |
| 89 document()->forgetObject (this); |
88 document()->forgetObject (this); |
| 90 |
89 |
| 425 |
424 |
| 426 // ============================================================================= |
425 // ============================================================================= |
| 427 // ----------------------------------------------------------------------------- |
426 // ----------------------------------------------------------------------------- |
| 428 long LDObject::lineNumber() const |
427 long LDObject::lineNumber() const |
| 429 { |
428 { |
| 430 assert (document() != null); |
429 if (document() != null) |
| 431 |
430 { |
| 432 for (int i = 0; i < document()->getObjectCount(); ++i) |
431 for (int i = 0; i < document()->getObjectCount(); ++i) |
| 433 { |
432 { |
| 434 if (document()->getObject (i) == this) |
433 if (document()->getObject (i) == this) |
| 435 return i; |
434 return i; |
| |
435 } |
| 436 } |
436 } |
| 437 |
437 |
| 438 return -1; |
438 return -1; |
| 439 } |
439 } |
| 440 |
440 |
| 860 |
860 |
| 861 // ============================================================================= |
861 // ============================================================================= |
| 862 // |
862 // |
| 863 void LDObject::deselect() |
863 void LDObject::deselect() |
| 864 { |
864 { |
| 865 if (document() != null) |
865 if (isSelected() and document() != null) |
| 866 { |
866 { |
| 867 document()->removeFromSelection (this); |
867 document()->removeFromSelection (this); |
| 868 |
868 |
| 869 // If this object is inverted with INVERTNEXT, deselect the INVERTNEXT as well. |
869 // If this object is inverted with INVERTNEXT, deselect the INVERTNEXT as well. |
| 870 LDBFC* invertnext; |
870 LDBFC* invertnext; |