667 |
667 |
668 // ============================================================================= |
668 // ============================================================================= |
669 // Hook the set accessors of certain properties to this changeProperty function. |
669 // Hook the set accessors of certain properties to this changeProperty function. |
670 // It takes care of history management so we can capture low-level changes, this |
670 // It takes care of history management so we can capture low-level changes, this |
671 // makes history stuff work out of the box. |
671 // makes history stuff work out of the box. |
672 // |
|
673 // TODO: use new PROPERTY-callbacks |
|
674 // ----------------------------------------------------------------------------- |
672 // ----------------------------------------------------------------------------- |
675 template<class T> static void changeProperty (LDObject* obj, T* ptr, const T& val) |
673 template<class T> static void changeProperty (LDObject* obj, T* ptr, const T& val) |
676 { long idx; |
674 { long idx; |
677 |
675 |
678 if (*ptr == val) |
676 if (*ptr == val) |
699 // ----------------------------------------------------------------------------- |
697 // ----------------------------------------------------------------------------- |
700 const vertex& LDObject::getVertex (int i) const |
698 const vertex& LDObject::getVertex (int i) const |
701 { return m_coords[i]->data(); |
699 { return m_coords[i]->data(); |
702 } |
700 } |
703 |
701 |
|
702 // ============================================================================= |
|
703 // ----------------------------------------------------------------------------- |
704 void LDObject::setVertex (int i, const vertex& vert) |
704 void LDObject::setVertex (int i, const vertex& vert) |
705 { changeProperty (this, &m_coords[i], LDSharedVertex::getSharedVertex (vert)); |
705 { changeProperty (this, &m_coords[i], LDSharedVertex::getSharedVertex (vert)); |
706 } |
706 } |
707 |
707 |
708 // ============================================================================= |
708 // ============================================================================= |
709 // ----------------------------------------------------------------------------- |
709 // ----------------------------------------------------------------------------- |
710 void LDMatrixObject::setPosition (const vertex& a) |
710 void LDMatrixObject::setPosition (const vertex& a) |
711 { changeProperty (getLinkPointer(), &m_position, LDSharedVertex::getSharedVertex (a)); |
711 { changeProperty (getLinkPointer(), &m_Position, LDSharedVertex::getSharedVertex (a)); |
712 } |
712 } |
713 |
713 |
714 // ============================================================================= |
714 // ============================================================================= |
715 // ----------------------------------------------------------------------------- |
715 // ----------------------------------------------------------------------------- |
716 void LDMatrixObject::setTransform (const matrix& val) |
716 void LDMatrixObject::setTransform (const matrix& val) |