From ab8428bd6847f31558bd0018cba68de91e21508c Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 23 May 2021 22:21:34 +0100 Subject: [PATCH] Naming conventions. --- pcbnew/cross-probing.cpp | 2 +- pcbnew/dialogs/dialog_netlist.cpp | 2 +- pcbnew/dialogs/dialog_update_pcb.cpp | 2 +- .../netlist_reader/board_netlist_updater.cpp | 28 ++++----- pcbnew/netlist_reader/board_netlist_updater.h | 61 +++++-------------- pcbnew/netlist_reader/netlist.cpp | 2 +- 6 files changed, 33 insertions(+), 64 deletions(-) diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp index 35a35a0261..1b6c1c05b7 100644 --- a/pcbnew/cross-probing.cpp +++ b/pcbnew/cross-probing.cpp @@ -546,7 +546,7 @@ void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail ) BOARD_NETLIST_UPDATER updater( this, GetBoard() ); updater.SetLookupByTimestamp( false ); - updater.SetDeleteUnusedComponents ( false ); + updater.SetDeleteUnusedFootprints( false ); updater.SetReplaceFootprints( false ); updater.SetDeleteSinglePadNets( false ); updater.SetWarnPadNoNetInNetlist( false ); diff --git a/pcbnew/dialogs/dialog_netlist.cpp b/pcbnew/dialogs/dialog_netlist.cpp index c42de850c0..16cecc22d8 100644 --- a/pcbnew/dialogs/dialog_netlist.cpp +++ b/pcbnew/dialogs/dialog_netlist.cpp @@ -247,7 +247,7 @@ void DIALOG_NETLIST::loadNetlist( bool aDryRun ) updater.SetReporter ( &reporter ); updater.SetIsDryRun( aDryRun ); updater.SetLookupByTimestamp( m_matchByUUID ); - updater.SetDeleteUnusedComponents ( m_cbDeleteExtraFootprints->GetValue() ); + updater.SetDeleteUnusedFootprints( m_cbDeleteExtraFootprints->GetValue()); updater.SetReplaceFootprints( m_cbUpdateFootprints->GetValue() ); updater.SetDeleteSinglePadNets( m_cbDeleteSinglePadNets->GetValue() ); m_warnForNoNetPads = m_cbWarnNoNetPad->GetValue(); diff --git a/pcbnew/dialogs/dialog_update_pcb.cpp b/pcbnew/dialogs/dialog_update_pcb.cpp index f0e87b63bd..bc08fce9ae 100644 --- a/pcbnew/dialogs/dialog_update_pcb.cpp +++ b/pcbnew/dialogs/dialog_update_pcb.cpp @@ -110,7 +110,7 @@ void DIALOG_UPDATE_PCB::PerformUpdate( bool aDryRun ) updater.SetReporter ( &reporter ); updater.SetIsDryRun( aDryRun ); updater.SetLookupByTimestamp( !m_cbRelinkFootprints->GetValue() ); - updater.SetDeleteUnusedComponents ( m_cbDeleteExtraFootprints->GetValue() ); + updater.SetDeleteUnusedFootprints( m_cbDeleteExtraFootprints->GetValue()); updater.SetReplaceFootprints( m_cbUpdateFootprints->GetValue() ); updater.SetDeleteSinglePadNets( m_cbDeleteSinglePadNets->GetValue() ); updater.SetWarnPadNoNetInNetlist( m_warnForNoNetPads ); diff --git a/pcbnew/netlist_reader/board_netlist_updater.cpp b/pcbnew/netlist_reader/board_netlist_updater.cpp index 9a7e65c1ac..11b4d3feaa 100644 --- a/pcbnew/netlist_reader/board_netlist_updater.cpp +++ b/pcbnew/netlist_reader/board_netlist_updater.cpp @@ -53,7 +53,7 @@ BOARD_NETLIST_UPDATER::BOARD_NETLIST_UPDATER( PCB_EDIT_FRAME* aFrame, BOARD* aBo m_reporter = &NULL_REPORTER::GetInstance(); m_deleteSinglePadNets = true; - m_deleteUnusedComponents = false; + m_deleteUnusedFootprints = false; m_isDryRun = false; m_replaceFootprints = true; m_lookupByTimestamp = false; @@ -103,7 +103,7 @@ wxString BOARD_NETLIST_UPDATER::getPinFunction( PAD* aPad ) } -wxPoint BOARD_NETLIST_UPDATER::estimateComponentInsertionPosition() +wxPoint BOARD_NETLIST_UPDATER::estimateFootprintInsertionPosition() { wxPoint bestPosition; @@ -131,7 +131,7 @@ wxPoint BOARD_NETLIST_UPDATER::estimateComponentInsertionPosition() } -FOOTPRINT* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent ) +FOOTPRINT* BOARD_NETLIST_UPDATER::addNewFootprint( COMPONENT* aComponent ) { wxString msg; @@ -178,9 +178,9 @@ FOOTPRINT* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent ) } footprint->SetParent( m_board ); - footprint->SetPosition( estimateComponentInsertionPosition( ) ); + footprint->SetPosition( estimateFootprintInsertionPosition() ); - m_addedComponents.push_back( footprint ); + m_addedFootprints.push_back( footprint ); m_commit.Add( footprint ); msg.Printf( _( "Added %s (footprint \"%s\")." ), @@ -194,7 +194,7 @@ FOOTPRINT* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent ) } -FOOTPRINT* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, FOOTPRINT* aPcbComponent, +FOOTPRINT* BOARD_NETLIST_UPDATER::replaceFootprint( NETLIST& aNetlist, FOOTPRINT* aFootprint, COMPONENT* aNewComponent ) { wxString msg; @@ -224,8 +224,8 @@ FOOTPRINT* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, FOOTPRINT if( m_isDryRun ) { msg.Printf( _( "Change %s footprint from '%s' to '%s'."), - aPcbComponent->GetReference(), - aPcbComponent->GetFPID().Format().wx_str(), + aFootprint->GetReference(), + aFootprint->GetFPID().Format().wx_str(), aNewComponent->GetFPID().Format().wx_str() ); delete newFootprint; @@ -233,11 +233,11 @@ FOOTPRINT* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, FOOTPRINT } else { - m_frame->ExchangeFootprint( aPcbComponent, newFootprint, m_commit ); + m_frame->ExchangeFootprint( aFootprint, newFootprint, m_commit ); msg.Printf( _( "Changed %s footprint from '%s' to '%s'."), - aPcbComponent->GetReference(), - aPcbComponent->GetFPID().Format().wx_str(), + aFootprint->GetReference(), + aFootprint->GetFPID().Format().wx_str(), aNewComponent->GetFPID().Format().wx_str() ); } @@ -972,7 +972,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist ) FOOTPRINT* tmp = footprint; if( m_replaceFootprints && component->GetFPID() != footprint->GetFPID() ) - tmp = replaceComponent( aNetlist, footprint, component ); + tmp = replaceFootprint( aNetlist, footprint, component ); if( tmp ) { @@ -994,7 +994,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist ) if( matchCount == 0 ) { - FOOTPRINT* footprint = addNewComponent( component ); + FOOTPRINT* footprint = addNewFootprint( component ); if( footprint ) { @@ -1019,7 +1019,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist ) // for( FOOTPRINT* footprint : m_board->Footprints() ) { - bool doDelete = m_deleteUnusedComponents; + bool doDelete = m_deleteUnusedFootprints; if( ( footprint->GetAttributes() & FP_BOARD_ONLY ) > 0 ) doDelete = false; diff --git a/pcbnew/netlist_reader/board_netlist_updater.h b/pcbnew/netlist_reader/board_netlist_updater.h index d6b2d931ed..7ac90ea8ff 100644 --- a/pcbnew/netlist_reader/board_netlist_updater.h +++ b/pcbnew/netlist_reader/board_netlist_updater.h @@ -84,53 +84,24 @@ public: */ bool UpdateNetlist( NETLIST& aNetlist ); - ///< Set the reporter object. - void SetReporter( REPORTER* aReporter ) - { - m_reporter = aReporter; - } + void SetReporter( REPORTER* aReporter ) { m_reporter = aReporter; } - ///< Enable "delete single pad nets" option. - void SetDeleteSinglePadNets( bool aEnabled ) - { - m_deleteSinglePadNets = aEnabled; - } + ///< Enable dry run mode (just report, no changes to PCB). + void SetIsDryRun( bool aEnabled ) { m_isDryRun = aEnabled; } + + void SetDeleteSinglePadNets( bool aEnabled ) { m_deleteSinglePadNets = aEnabled; } ///< Enable warning option if a connectable pad is not found in netlist ///< connectable = pad with a name and on a copper layer. - void SetWarnPadNoNetInNetlist( bool aEnabled ) - { - m_warnForNoNetPads = aEnabled; - } + void SetWarnPadNoNetInNetlist( bool aEnabled ) { m_warnForNoNetPads = aEnabled; } - ///< Enable dry run mode (just report, no changes to PCB). - void SetIsDryRun( bool aEnabled ) - { - m_isDryRun = aEnabled; - } + void SetReplaceFootprints( bool aEnabled ) { m_replaceFootprints = aEnabled; } - ///< Enable replacing footprints with new ones. - void SetReplaceFootprints( bool aEnabled ) - { - m_replaceFootprints = aEnabled; - } + void SetDeleteUnusedFootprints( bool aEnabled ) { m_deleteUnusedFootprints = aEnabled; } - ///< Enable removing unused components. - void SetDeleteUnusedComponents( bool aEnabled ) - { - m_deleteUnusedComponents = aEnabled; - } + void SetLookupByTimestamp( bool aEnabled ) { m_lookupByTimestamp = aEnabled; } - ///< Enable component lookup by timestamp instead of reference. - void SetLookupByTimestamp( bool aEnabled ) - { - m_lookupByTimestamp = aEnabled; - } - - std::vector GetAddedComponents() const - { - return m_addedComponents; - } + std::vector GetAddedFootprints() const { return m_addedFootprints; } private: void cacheNetname( PAD* aPad, const wxString& aNetname ); @@ -139,11 +110,11 @@ private: void cachePinFunction( PAD* aPad, const wxString& aPinFunction ); wxString getPinFunction( PAD* aPad ); - wxPoint estimateComponentInsertionPosition(); + wxPoint estimateFootprintInsertionPosition(); - FOOTPRINT* addNewComponent( COMPONENT* aComponent ); + FOOTPRINT* addNewFootprint( COMPONENT* aComponent ); - FOOTPRINT* replaceComponent( NETLIST& aNetlist, FOOTPRINT* aPcbComponent, + FOOTPRINT* replaceFootprint( NETLIST& aNetlist, FOOTPRINT* aFootprint, COMPONENT* aNewComponent ); bool updateFootprintParameters( FOOTPRINT* aPcbFootprint, COMPONENT* aNetlistComponent ); @@ -154,8 +125,6 @@ private: bool updateCopperZoneNets( NETLIST& aNetlist ); - bool deleteUnusedComponents( NETLIST& aNetlist ); - bool deleteSinglePadNets(); bool testConnectivity( NETLIST& aNetlist, std::map& aFootprintMap ); @@ -169,11 +138,11 @@ private: std::map m_oldToNewNets; std::map m_padNets; std::map m_padPinFunctions; - std::vector m_addedComponents; + std::vector m_addedFootprints; std::map m_addedNets; bool m_deleteSinglePadNets; - bool m_deleteUnusedComponents; + bool m_deleteUnusedFootprints; bool m_isDryRun; bool m_replaceFootprints; bool m_lookupByTimestamp; diff --git a/pcbnew/netlist_reader/netlist.cpp b/pcbnew/netlist_reader/netlist.cpp index 17c3efdf8f..b55ba865bf 100644 --- a/pcbnew/netlist_reader/netlist.cpp +++ b/pcbnew/netlist_reader/netlist.cpp @@ -99,7 +99,7 @@ void PCB_EDIT_FRAME::OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, bool* aR for( auto track : board->Tracks() ) GetCanvas()->GetView()->Update( track ); - std::vector newFootprints = aUpdater.GetAddedComponents(); + std::vector newFootprints = aUpdater.GetAddedFootprints(); // Spread new footprints. wxPoint areaPosition = (wxPoint) GetCanvas()->GetViewControls()->GetCursorPosition();