Loading pcbnew/class_module.cpp +68 −9 Original line number Original line Diff line number Diff line Loading @@ -295,6 +295,72 @@ void MODULE::Copy( MODULE* aModule ) } } void MODULE::Add( BOARD_ITEM* aBoardItem, bool doAppend ) { switch( aBoardItem->Type() ) { case PCB_MODULE_TEXT_T: // Only common texts can be added this way. Reference and value are not hold in the DLIST. assert( static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS ); /* no break */ case PCB_MODULE_EDGE_T: if( doAppend ) m_Drawings.PushBack( static_cast<BOARD_ITEM*>( aBoardItem ) ); else m_Drawings.PushFront( static_cast<BOARD_ITEM*>( aBoardItem ) ); break; case PCB_PAD_T: if( doAppend ) m_Pads.PushBack( static_cast<D_PAD*>( aBoardItem ) ); else m_Pads.PushFront( static_cast<D_PAD*>( aBoardItem ) ); break; default: { wxString msg; msg.Printf( wxT( "MODULE::Add() needs work: BOARD_ITEM type (%d) not handled" ), aBoardItem->Type() ); wxFAIL_MSG( msg ); return; } } aBoardItem->SetParent( this ); } BOARD_ITEM* MODULE::Remove( BOARD_ITEM* aBoardItem ) { switch( aBoardItem->Type() ) { case PCB_MODULE_TEXT_T: // Only common texts can be added this way. Reference and value are not hold in the DLIST. assert( static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS ); /* no break */ case PCB_MODULE_EDGE_T: return m_Drawings.Remove( static_cast<BOARD_ITEM*>( aBoardItem ) ); case PCB_PAD_T: return m_Pads.Remove( static_cast<D_PAD*>( aBoardItem ) ); default: { wxString msg; msg.Printf( wxT( "MODULE::Remove() needs work: BOARD_ITEM type (%d) not handled" ), aBoardItem->Type() ); wxFAIL_MSG( msg ); } } return NULL; } void MODULE::CopyNetlistSettings( MODULE* aModule ) void MODULE::CopyNetlistSettings( MODULE* aModule ) { { // Don't do anything foolish like trying to copy to yourself. // Don't do anything foolish like trying to copy to yourself. Loading Loading @@ -636,13 +702,6 @@ void MODULE::Add3DModel( S3D_MASTER* a3DModel ) } } void MODULE::AddPad( D_PAD* aPad ) { aPad->SetParent( this ); m_Pads.PushBack( aPad ); } // see class_module.h // see class_module.h SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, const KICAD_T scanTypes[] ) const KICAD_T scanTypes[] ) Loading Loading @@ -738,10 +797,10 @@ EDA_ITEM* MODULE::Clone() const void MODULE::RunOnChildren( boost::function<void (BOARD_ITEM*)> aFunction ) void MODULE::RunOnChildren( boost::function<void (BOARD_ITEM*)> aFunction ) { { for( D_PAD* pad = m_Pads.GetFirst(); pad; pad = pad->Next() ) for( D_PAD* pad = m_Pads; pad; pad = pad->Next() ) aFunction( static_cast<BOARD_ITEM*>( pad ) ); aFunction( static_cast<BOARD_ITEM*>( pad ) ); for( BOARD_ITEM* drawing = m_Drawings.GetFirst(); drawing; drawing = drawing->Next() ) for( BOARD_ITEM* drawing = m_Drawings; drawing; drawing = drawing->Next() ) aFunction( drawing ); aFunction( drawing ); aFunction( static_cast<BOARD_ITEM*>( m_Reference ) ); aFunction( static_cast<BOARD_ITEM*>( m_Reference ) ); Loading pcbnew/class_module.h +24 −10 Original line number Original line Diff line number Diff line Loading @@ -91,9 +91,31 @@ public: * Function Add * Function Add * adds the given item to this MODULE and takes ownership of its memory. * adds the given item to this MODULE and takes ownership of its memory. * @param aBoardItem The item to add to this board. * @param aBoardItem The item to add to this board. * @param doInsert If true, then insert, else append * @param doAppend If true, then append, else insert. * void Add( BOARD_ITEM* aBoardItem, bool doInsert = true ); */ */ void Add( BOARD_ITEM* aBoardItem, bool doAppend = true ); /** * Function Delete * removes the given single item from this MODULE and deletes its memory. * @param aBoardItem The item to remove from this module and delete */ void Delete( BOARD_ITEM* aBoardItem ) { // developers should run DEBUG versions and fix such calls with NULL wxASSERT( aBoardItem ); if( aBoardItem ) delete Remove( aBoardItem ); } /** * Function Remove * removes \a aBoardItem from this MODULE and returns it to caller without deleting it. * @param aBoardItem The item to remove from this module. * @return BOARD_ITEM* \a aBoardItem which was passed in. */ BOARD_ITEM* Remove( BOARD_ITEM* aBoardItem ); /** /** * Function CalculateBoundingBox * Function CalculateBoundingBox Loading Loading @@ -436,14 +458,6 @@ public: */ */ void Add3DModel( S3D_MASTER* a3DModel ); void Add3DModel( S3D_MASTER* a3DModel ); /** * Function AddPad * adds \a aPad to the end of the pad list. * * @param aPad A pointer to a #D_PAD to add to the list. */ void AddPad( D_PAD* aPad ); SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, const KICAD_T scanTypes[] ); const KICAD_T scanTypes[] ); Loading pcbnew/gpcb_plugin.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -637,7 +637,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) throw( IO_ERROR, pad->SetShape( PAD_OVAL ); pad->SetShape( PAD_OVAL ); } } module->AddPad( pad ); module->Add( pad ); continue; continue; } } Loading Loading @@ -701,7 +701,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) throw( IO_ERROR, if( pad->GetShape() == PAD_ROUND && pad->GetSize().x != pad->GetSize().y ) if( pad->GetShape() == PAD_ROUND && pad->GetSize().x != pad->GetSize().y ) pad->SetShape( PAD_OVAL ); pad->SetShape( PAD_OVAL ); module->AddPad( pad ); module->Add( pad ); continue; continue; } } } } Loading pcbnew/pcb_parser.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1856,7 +1856,7 @@ MODULE* PCB_PARSER::parseMODULE( wxArrayString* aInitialComments ) throw( IO_ERR RotatePoint( &pt, module->GetOrientation() ); RotatePoint( &pt, module->GetOrientation() ); pad->SetPosition( pt + module->GetPosition() ); pad->SetPosition( pt + module->GetPosition() ); module->AddPad( pad ); module->Add( pad ); } } break; break; Loading pcbnew/tools/edit_tool.cpp +3 −0 Original line number Original line Diff line number Diff line Loading @@ -464,6 +464,9 @@ void EDIT_TOOL::remove( BOARD_ITEM* aItem ) case TEXTE_MODULE::TEXT_is_VALUE: case TEXTE_MODULE::TEXT_is_VALUE: DisplayError( getEditFrame<PCB_BASE_FRAME>(), _( "Cannot delete VALUE!" ) ); DisplayError( getEditFrame<PCB_BASE_FRAME>(), _( "Cannot delete VALUE!" ) ); return; return; default: // suppress warnings break; } } } } } } Loading Loading
pcbnew/class_module.cpp +68 −9 Original line number Original line Diff line number Diff line Loading @@ -295,6 +295,72 @@ void MODULE::Copy( MODULE* aModule ) } } void MODULE::Add( BOARD_ITEM* aBoardItem, bool doAppend ) { switch( aBoardItem->Type() ) { case PCB_MODULE_TEXT_T: // Only common texts can be added this way. Reference and value are not hold in the DLIST. assert( static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS ); /* no break */ case PCB_MODULE_EDGE_T: if( doAppend ) m_Drawings.PushBack( static_cast<BOARD_ITEM*>( aBoardItem ) ); else m_Drawings.PushFront( static_cast<BOARD_ITEM*>( aBoardItem ) ); break; case PCB_PAD_T: if( doAppend ) m_Pads.PushBack( static_cast<D_PAD*>( aBoardItem ) ); else m_Pads.PushFront( static_cast<D_PAD*>( aBoardItem ) ); break; default: { wxString msg; msg.Printf( wxT( "MODULE::Add() needs work: BOARD_ITEM type (%d) not handled" ), aBoardItem->Type() ); wxFAIL_MSG( msg ); return; } } aBoardItem->SetParent( this ); } BOARD_ITEM* MODULE::Remove( BOARD_ITEM* aBoardItem ) { switch( aBoardItem->Type() ) { case PCB_MODULE_TEXT_T: // Only common texts can be added this way. Reference and value are not hold in the DLIST. assert( static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS ); /* no break */ case PCB_MODULE_EDGE_T: return m_Drawings.Remove( static_cast<BOARD_ITEM*>( aBoardItem ) ); case PCB_PAD_T: return m_Pads.Remove( static_cast<D_PAD*>( aBoardItem ) ); default: { wxString msg; msg.Printf( wxT( "MODULE::Remove() needs work: BOARD_ITEM type (%d) not handled" ), aBoardItem->Type() ); wxFAIL_MSG( msg ); } } return NULL; } void MODULE::CopyNetlistSettings( MODULE* aModule ) void MODULE::CopyNetlistSettings( MODULE* aModule ) { { // Don't do anything foolish like trying to copy to yourself. // Don't do anything foolish like trying to copy to yourself. Loading Loading @@ -636,13 +702,6 @@ void MODULE::Add3DModel( S3D_MASTER* a3DModel ) } } void MODULE::AddPad( D_PAD* aPad ) { aPad->SetParent( this ); m_Pads.PushBack( aPad ); } // see class_module.h // see class_module.h SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, const KICAD_T scanTypes[] ) const KICAD_T scanTypes[] ) Loading Loading @@ -738,10 +797,10 @@ EDA_ITEM* MODULE::Clone() const void MODULE::RunOnChildren( boost::function<void (BOARD_ITEM*)> aFunction ) void MODULE::RunOnChildren( boost::function<void (BOARD_ITEM*)> aFunction ) { { for( D_PAD* pad = m_Pads.GetFirst(); pad; pad = pad->Next() ) for( D_PAD* pad = m_Pads; pad; pad = pad->Next() ) aFunction( static_cast<BOARD_ITEM*>( pad ) ); aFunction( static_cast<BOARD_ITEM*>( pad ) ); for( BOARD_ITEM* drawing = m_Drawings.GetFirst(); drawing; drawing = drawing->Next() ) for( BOARD_ITEM* drawing = m_Drawings; drawing; drawing = drawing->Next() ) aFunction( drawing ); aFunction( drawing ); aFunction( static_cast<BOARD_ITEM*>( m_Reference ) ); aFunction( static_cast<BOARD_ITEM*>( m_Reference ) ); Loading
pcbnew/class_module.h +24 −10 Original line number Original line Diff line number Diff line Loading @@ -91,9 +91,31 @@ public: * Function Add * Function Add * adds the given item to this MODULE and takes ownership of its memory. * adds the given item to this MODULE and takes ownership of its memory. * @param aBoardItem The item to add to this board. * @param aBoardItem The item to add to this board. * @param doInsert If true, then insert, else append * @param doAppend If true, then append, else insert. * void Add( BOARD_ITEM* aBoardItem, bool doInsert = true ); */ */ void Add( BOARD_ITEM* aBoardItem, bool doAppend = true ); /** * Function Delete * removes the given single item from this MODULE and deletes its memory. * @param aBoardItem The item to remove from this module and delete */ void Delete( BOARD_ITEM* aBoardItem ) { // developers should run DEBUG versions and fix such calls with NULL wxASSERT( aBoardItem ); if( aBoardItem ) delete Remove( aBoardItem ); } /** * Function Remove * removes \a aBoardItem from this MODULE and returns it to caller without deleting it. * @param aBoardItem The item to remove from this module. * @return BOARD_ITEM* \a aBoardItem which was passed in. */ BOARD_ITEM* Remove( BOARD_ITEM* aBoardItem ); /** /** * Function CalculateBoundingBox * Function CalculateBoundingBox Loading Loading @@ -436,14 +458,6 @@ public: */ */ void Add3DModel( S3D_MASTER* a3DModel ); void Add3DModel( S3D_MASTER* a3DModel ); /** * Function AddPad * adds \a aPad to the end of the pad list. * * @param aPad A pointer to a #D_PAD to add to the list. */ void AddPad( D_PAD* aPad ); SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, const KICAD_T scanTypes[] ); const KICAD_T scanTypes[] ); Loading
pcbnew/gpcb_plugin.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -637,7 +637,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) throw( IO_ERROR, pad->SetShape( PAD_OVAL ); pad->SetShape( PAD_OVAL ); } } module->AddPad( pad ); module->Add( pad ); continue; continue; } } Loading Loading @@ -701,7 +701,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) throw( IO_ERROR, if( pad->GetShape() == PAD_ROUND && pad->GetSize().x != pad->GetSize().y ) if( pad->GetShape() == PAD_ROUND && pad->GetSize().x != pad->GetSize().y ) pad->SetShape( PAD_OVAL ); pad->SetShape( PAD_OVAL ); module->AddPad( pad ); module->Add( pad ); continue; continue; } } } } Loading
pcbnew/pcb_parser.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1856,7 +1856,7 @@ MODULE* PCB_PARSER::parseMODULE( wxArrayString* aInitialComments ) throw( IO_ERR RotatePoint( &pt, module->GetOrientation() ); RotatePoint( &pt, module->GetOrientation() ); pad->SetPosition( pt + module->GetPosition() ); pad->SetPosition( pt + module->GetPosition() ); module->AddPad( pad ); module->Add( pad ); } } break; break; Loading
pcbnew/tools/edit_tool.cpp +3 −0 Original line number Original line Diff line number Diff line Loading @@ -464,6 +464,9 @@ void EDIT_TOOL::remove( BOARD_ITEM* aItem ) case TEXTE_MODULE::TEXT_is_VALUE: case TEXTE_MODULE::TEXT_is_VALUE: DisplayError( getEditFrame<PCB_BASE_FRAME>(), _( "Cannot delete VALUE!" ) ); DisplayError( getEditFrame<PCB_BASE_FRAME>(), _( "Cannot delete VALUE!" ) ); return; return; default: // suppress warnings break; } } } } } } Loading