Loading eeschema/component_class.cpp +21 −17 Original line number Diff line number Diff line Loading @@ -60,6 +60,26 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) : m_PrefixString = wxString( _( "U" ) ); } SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aTemplate ) : SCH_ITEM( NULL, TYPE_SCH_COMPONENT ) { // assignment of all fields, including field vector elements, and linked list pointers *this = aTemplate; // set linked list pointers to null, before this they were copies of aTemplate's Pback = NULL; Pnext = NULL; m_Son = NULL; // Re-parent the fields, which before this were aTemplate's parent for( int i=0; i<GetFieldCount(); ++i ) { GetField( i )->m_Parent = this; } } /** * Function AddHierarchicalReference * adds a full hierachical reference (path + local reference) Loading Loading @@ -401,7 +421,7 @@ void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem ) m_Fields.swap( copyitem->m_Fields ); // std::vector's swap() // Reparent items after copying data // (after swap(), m_Parent member does not points the right parent): // (after swap(), m_Parent member does not point to the right parent): for( int ii = 0; ii < copyitem->GetFieldCount(); ++ii ) { copyitem->GetField(ii)->m_Parent = copyitem; Loading Loading @@ -502,22 +522,6 @@ void SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet ) } /**************************************************************/ SCH_COMPONENT* SCH_COMPONENT::GenCopy() /**************************************************************/ { SCH_COMPONENT* new_item = new SCH_COMPONENT( *this ); // Reset chain pointers: new_item->Pback = new_item->Pnext = new_item->m_Son = NULL; // Reparent items after copy: for( int ii = 0; ii < new_item->GetFieldCount(); ++ii ) { new_item->GetField(ii)->m_Parent = new_item; } return new_item; } /*****************************************************************/ void SCH_COMPONENT::SetRotationMiroir( int type_rotate ) /******************************************************************/ Loading eeschema/component_class.h +21 −1 Original line number Diff line number Diff line Loading @@ -98,6 +98,16 @@ private: public: SCH_COMPONENT( const wxPoint& pos = wxPoint( 0, 0 ), SCH_ITEM* aParent = NULL ); /** * Copy Constructor * clones \a aTemplate into this object. All fields are copied as is except * for the linked list management pointers which are set to NULL, and the * SCH_CMP_FIELD's m_Parent pointers which are set to the new parent, * i.e. this new object. */ SCH_COMPONENT( const SCH_COMPONENT& aTemplate ); ~SCH_COMPONENT() { } virtual wxString GetClass() const Loading Loading @@ -125,7 +135,17 @@ public: void Load( FILE* aFile ) throw( Error ); */ SCH_COMPONENT* GenCopy(); /** * Function GenCopy * returns a copy of this object but with the linked list pointers * set to NULL. * @return SCH_COMPONENT* - a copy of me. */ SCH_COMPONENT* GenCopy() { return new SCH_COMPONENT( *this ); } void SetRotationMiroir( int type ); int GetRotationMiroir(); wxPoint GetScreenCoord( const wxPoint& coord ); Loading Loading
eeschema/component_class.cpp +21 −17 Original line number Diff line number Diff line Loading @@ -60,6 +60,26 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) : m_PrefixString = wxString( _( "U" ) ); } SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aTemplate ) : SCH_ITEM( NULL, TYPE_SCH_COMPONENT ) { // assignment of all fields, including field vector elements, and linked list pointers *this = aTemplate; // set linked list pointers to null, before this they were copies of aTemplate's Pback = NULL; Pnext = NULL; m_Son = NULL; // Re-parent the fields, which before this were aTemplate's parent for( int i=0; i<GetFieldCount(); ++i ) { GetField( i )->m_Parent = this; } } /** * Function AddHierarchicalReference * adds a full hierachical reference (path + local reference) Loading Loading @@ -401,7 +421,7 @@ void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem ) m_Fields.swap( copyitem->m_Fields ); // std::vector's swap() // Reparent items after copying data // (after swap(), m_Parent member does not points the right parent): // (after swap(), m_Parent member does not point to the right parent): for( int ii = 0; ii < copyitem->GetFieldCount(); ++ii ) { copyitem->GetField(ii)->m_Parent = copyitem; Loading Loading @@ -502,22 +522,6 @@ void SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet ) } /**************************************************************/ SCH_COMPONENT* SCH_COMPONENT::GenCopy() /**************************************************************/ { SCH_COMPONENT* new_item = new SCH_COMPONENT( *this ); // Reset chain pointers: new_item->Pback = new_item->Pnext = new_item->m_Son = NULL; // Reparent items after copy: for( int ii = 0; ii < new_item->GetFieldCount(); ++ii ) { new_item->GetField(ii)->m_Parent = new_item; } return new_item; } /*****************************************************************/ void SCH_COMPONENT::SetRotationMiroir( int type_rotate ) /******************************************************************/ Loading
eeschema/component_class.h +21 −1 Original line number Diff line number Diff line Loading @@ -98,6 +98,16 @@ private: public: SCH_COMPONENT( const wxPoint& pos = wxPoint( 0, 0 ), SCH_ITEM* aParent = NULL ); /** * Copy Constructor * clones \a aTemplate into this object. All fields are copied as is except * for the linked list management pointers which are set to NULL, and the * SCH_CMP_FIELD's m_Parent pointers which are set to the new parent, * i.e. this new object. */ SCH_COMPONENT( const SCH_COMPONENT& aTemplate ); ~SCH_COMPONENT() { } virtual wxString GetClass() const Loading Loading @@ -125,7 +135,17 @@ public: void Load( FILE* aFile ) throw( Error ); */ SCH_COMPONENT* GenCopy(); /** * Function GenCopy * returns a copy of this object but with the linked list pointers * set to NULL. * @return SCH_COMPONENT* - a copy of me. */ SCH_COMPONENT* GenCopy() { return new SCH_COMPONENT( *this ); } void SetRotationMiroir( int type ); int GetRotationMiroir(); wxPoint GetScreenCoord( const wxPoint& coord ); Loading