Naming conventions.

This commit is contained in:
Jeff Young 2021-05-23 22:21:34 +01:00
parent 9554aaee7f
commit ab8428bd68
6 changed files with 33 additions and 64 deletions

View File

@ -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 );

View File

@ -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();

View File

@ -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 );

View File

@ -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;

View File

@ -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<FOOTPRINT*> GetAddedComponents() const
{
return m_addedComponents;
}
std::vector<FOOTPRINT*> 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<COMPONENT*, FOOTPRINT*>& aFootprintMap );
@ -169,11 +138,11 @@ private:
std::map<wxString, wxString> m_oldToNewNets;
std::map<PAD*, wxString> m_padNets;
std::map<PAD*, wxString> m_padPinFunctions;
std::vector<FOOTPRINT*> m_addedComponents;
std::vector<FOOTPRINT*> m_addedFootprints;
std::map<wxString, NETINFO_ITEM*> m_addedNets;
bool m_deleteSinglePadNets;
bool m_deleteUnusedComponents;
bool m_deleteUnusedFootprints;
bool m_isDryRun;
bool m_replaceFootprints;
bool m_lookupByTimestamp;

View File

@ -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<FOOTPRINT*> newFootprints = aUpdater.GetAddedComponents();
std::vector<FOOTPRINT*> newFootprints = aUpdater.GetAddedFootprints();
// Spread new footprints.
wxPoint areaPosition = (wxPoint) GetCanvas()->GetViewControls()->GetCursorPosition();