bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist ) { wxString msg; m_errorCount = 0; m_warningCount = 0; if( !m_isDryRun ) { m_board->SetStatus( 0 ); } for( int i = 0; i < (int) aNetlist.GetCount(); i++ ) { COMPONENT* component = aNetlist.GetComponent( i ); MODULE* footprint = NULL; msg.Printf( _( "Processing component \"%s:%s:%s\".\n" ), GetChars( component->GetReference() ), GetChars( component->GetTimeStamp() ), GetChars( component->GetFPID().Format() ) ); m_reporter->Report( msg, REPORTER::RPT_INFO ); if( aNetlist.IsFindByTimeStamp() ) footprint = m_board->FindModule( component->GetTimeStamp(), true ); else footprint = m_board->FindModule( component->GetReference() ); if( footprint ) // An existing footprint. { MODULE* newFootprint = replaceComponent( aNetlist, footprint, component ); if( newFootprint ) footprint = newFootprint; } else { footprint = addNewComponent( component ); } if( footprint ) { updateComponentParameters( footprint, component ); updateComponentPadConnections( footprint, component ); } } //aNetlist.GetDeleteExtraFootprints() if( m_deleteUnusedComponents ) deleteUnusedComponents( aNetlist ); if( m_deleteSinglePadNets ) deleteSinglePadNets(); if( !m_isDryRun ) { m_commit.Push( _( "Update netlist" ) ); m_frame->Compile_Ratsnest( NULL, false ); m_board->GetRatsnest()->ProcessBoard(); testConnectivity( aNetlist ); } // Update the ratsnest m_reporter->Report( wxT( "" ), REPORTER::RPT_ACTION ); m_reporter->Report( wxT( "" ), REPORTER::RPT_ACTION ); msg.Printf( _( "Total warnings: %d, errors: %d." ), m_warningCount, m_errorCount ); m_reporter->Report( msg, REPORTER::RPT_ACTION ); if( m_errorCount ) { m_reporter->Report( _( "Errors occured during the netlist update. Unless you " "fix them, your board will not be consistent with the schematics." ), REPORTER::RPT_ERROR ); return false; } else { m_reporter->Report( _( "Netlist update successful!" ), REPORTER::RPT_ACTION ); } return true; }