diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.cpp b/3d-viewer/3d_canvas/eda_3d_canvas.cpp index 55d5d49615..998e0b3068 100644 --- a/3d-viewer/3d_canvas/eda_3d_canvas.cpp +++ b/3d-viewer/3d_canvas/eda_3d_canvas.cpp @@ -721,7 +721,7 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event ) reporter.Report( wxString::Format( _( "Net %s\tNetClass %s\tPadName %s" ), pad->GetNet()->GetNetname(), pad->GetNet()->GetNetClassName(), - pad->GetName() ) ); + pad->GetNumber() ) ); } } break; diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 3c244806a5..bc1dc2984d 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -269,7 +269,7 @@ set( PCBNEW_CLASS_SRCS action_plugin.cpp array_creator.cpp - array_pad_name_provider.cpp + array_pad_number_provider.cpp build_BOM_from_board.cpp cleanup_item.cpp convert_drawsegment_list_to_polygon.cpp @@ -294,11 +294,8 @@ set( PCBNEW_CLASS_SRCS load_select_footprint.cpp menubar_footprint_editor.cpp menubar_pcb_editor.cpp - pad_naming.cpp pcb_base_edit_frame.cpp pcb_layer_box_selector.cpp -# pcb_draw_panel_gal.cpp -# pcb_view.cpp pcb_edit_frame.cpp pcbnew_config.cpp pcbnew_printout.cpp diff --git a/pcbnew/array_creator.cpp b/pcbnew/array_creator.cpp index 16e66dce1b..556ebc014f 100644 --- a/pcbnew/array_creator.cpp +++ b/pcbnew/array_creator.cpp @@ -24,11 +24,10 @@ #include "array_creator.h" -#include +#include #include #include -#include - +#include #include /** @@ -69,7 +68,7 @@ void ARRAY_CREATOR::Invoke() BOARD_COMMIT commit( &m_parent ); - ARRAY_PAD_NAME_PROVIDER pad_name_provider( fp, *array_opts ); + ARRAY_PAD_NUMBER_PROVIDER pad_number_provider( fp, *array_opts ); for ( int i = 0; i < m_selection.Size(); ++i ) { @@ -185,10 +184,10 @@ void ARRAY_CREATOR::Invoke() { PAD& pad = static_cast( *this_item ); - if( PAD_NAMING::PadCanHaveName( pad ) ) + if( pad.CanHaveNumber() ) { - wxString newName = pad_name_provider.GetNextPadName(); - pad.SetName( newName ); + wxString newNumber = pad_number_provider.GetNextPadNumber(); + pad.SetNumber( newNumber ); } } } diff --git a/pcbnew/array_pad_name_provider.cpp b/pcbnew/array_pad_number_provider.cpp similarity index 70% rename from pcbnew/array_pad_name_provider.cpp rename to pcbnew/array_pad_number_provider.cpp index afb81b0318..c22af0f241 100644 --- a/pcbnew/array_pad_name_provider.cpp +++ b/pcbnew/array_pad_number_provider.cpp @@ -21,13 +21,13 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include #include -ARRAY_PAD_NAME_PROVIDER::ARRAY_PAD_NAME_PROVIDER( const FOOTPRINT* aFootprint, - const ARRAY_OPTIONS& aArrayOpts ) +ARRAY_PAD_NUMBER_PROVIDER::ARRAY_PAD_NUMBER_PROVIDER( const FOOTPRINT* aFootprint, + const ARRAY_OPTIONS& aArrayOpts ) : m_arrayOpts( aArrayOpts ) { // start by numbering the first new item @@ -46,27 +46,28 @@ ARRAY_PAD_NAME_PROVIDER::ARRAY_PAD_NAME_PROVIDER( const FOOTPRINT* aFootprint, { // reserve the name of each existing pad for( PAD* pad : aFootprint->Pads() ) - m_existing_pad_names.insert( pad->GetName() ); + m_existing_pad_numbers.insert( pad->GetNumber() ); } } } -wxString ARRAY_PAD_NAME_PROVIDER::GetNextPadName() +wxString ARRAY_PAD_NUMBER_PROVIDER::GetNextPadNumber() { - return getNextName( m_current_pad_index, m_existing_pad_names ); + return getNextNumber( m_current_pad_index, m_existing_pad_numbers ); } -wxString ARRAY_PAD_NAME_PROVIDER::getNextName( int& aIndex, const std::set& aExisting ) +wxString ARRAY_PAD_NUMBER_PROVIDER::getNextNumber( int& aIndex, + const std::set& aExisting ) { - wxString next_name; + wxString next_number; do { - next_name = m_arrayOpts.GetItemNumber( aIndex ); + next_number = m_arrayOpts.GetItemNumber( aIndex ); aIndex++; - } while( aExisting.count( next_name ) != 0 ); + } while( aExisting.count( next_number ) != 0 ); - return next_name; + return next_number; } diff --git a/pcbnew/array_pad_name_provider.h b/pcbnew/array_pad_number_provider.h similarity index 65% rename from pcbnew/array_pad_name_provider.h rename to pcbnew/array_pad_number_provider.h index 259afd45cf..5e69a0bb3b 100644 --- a/pcbnew/array_pad_name_provider.h +++ b/pcbnew/array_pad_number_provider.h @@ -29,35 +29,34 @@ #include /** - * Simple class that sequentially provides names from an #ARRAY_OPTIONS - * object, making sure that they do not conflict with names already existing - * in a #FOOTPRINT. + * Simple class that sequentially provides numbers from an #ARRAY_OPTIONS object, making sure + * that they do not conflict with numbers already existing in a #FOOTPRINT. */ -class ARRAY_PAD_NAME_PROVIDER +class ARRAY_PAD_NUMBER_PROVIDER { public: /** - * @param aFootprint the footprint to gather existing names from (nullptr for no footprint) - * @oaram aArrayOpts the array options that provide the candidate names + * @param aFootprint the footprint to gather existing numbers from (nullptr for no footprint) + * @oaram aArrayOpts the array options that provide the candidate numbers */ - ARRAY_PAD_NAME_PROVIDER( const FOOTPRINT* aFootprint, const ARRAY_OPTIONS& aArrayOpts ); + ARRAY_PAD_NUMBER_PROVIDER( const FOOTPRINT* aFootprint, const ARRAY_OPTIONS& aArrayOpts ); /** * Get the next available pad name. */ - wxString GetNextPadName(); + wxString GetNextPadNumber(); private: /** - * Get the next name from a given index/list combo + * Get the next number from a given index/list combo * @param aIndex index to start at, will be updated - * @param aExisting the set of existing names to skip - * @return the first name found that's not in aExisting + * @param aExisting the set of existing numbers to skip + * @return the first number found that's not in aExisting */ - wxString getNextName( int& aIndex, const std::set& aExisting ); + wxString getNextNumber( int& aIndex, const std::set& aExisting ); const ARRAY_OPTIONS& m_arrayOpts; - std::set m_existing_pad_names; + std::set m_existing_pad_numbers; int m_current_pad_index; }; diff --git a/pcbnew/connectivity/from_to_cache.cpp b/pcbnew/connectivity/from_to_cache.cpp index dce9ed4836..6f5e3f814f 100644 --- a/pcbnew/connectivity/from_to_cache.cpp +++ b/pcbnew/connectivity/from_to_cache.cpp @@ -39,7 +39,7 @@ void FROM_TO_CACHE::buildEndpointList( ) for( PAD* pad : footprint->Pads() ) { FT_ENDPOINT ent; - ent.name = footprint->GetReference() + "-" + pad->GetName(); + ent.name = footprint->GetReference() + "-" + pad->GetNumber(); ent.parent = pad; m_ftEndpoints.push_back( ent ); ent.name = footprint->GetReference(); @@ -140,7 +140,7 @@ int FROM_TO_CACHE::cacheFromToPaths( const wxString& aFrom, const wxString& aTo int count = 0; auto netName = path.from->GetNetname(); - wxString fromName = path.from->GetParent()->GetReference() + "-" + path.from->GetName(); + wxString fromName = path.from->GetParent()->GetReference() + "-" + path.from->GetNumber(); const KICAD_T onlyRouting[] = { PCB_PAD_T, PCB_ARC_T, PCB_VIA_T, PCB_TRACE_T, EOT }; @@ -157,7 +157,7 @@ int FROM_TO_CACHE::cacheFromToPaths( const wxString& aFrom, const wxString& aTo const PAD *pad = static_cast( pitem ); - wxString toName = pad->GetParent()->GetReference() + "-" + pad->GetName(); + wxString toName = pad->GetParent()->GetReference() + "-" + pad->GetNumber(); for ( const auto& endpoint : m_ftEndpoints ) diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp index 29ff27b920..ac73ddda77 100644 --- a/pcbnew/cross-probing.cpp +++ b/pcbnew/cross-probing.cpp @@ -159,7 +159,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) footprint = pcb->FindFootprintByReference( modName ); if( footprint ) - pad = footprint->FindPadByName( pinName ); + pad = footprint->FindPadByNumber( pinName ); if( pad ) netcode = pad->GetNetCode(); @@ -434,7 +434,7 @@ std::string FormatProbeItem( BOARD_ITEM* aItem ) case PCB_PAD_T: { footprint = static_cast( aItem->GetParent() ); - wxString pad = static_cast( aItem )->GetName(); + wxString pad = static_cast( aItem )->GetNumber(); return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"", TO_UTF8( footprint->GetReference() ), TO_UTF8( pad ) ); @@ -535,7 +535,7 @@ void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail ) if( !netname.IsEmpty() ) { - component->AddNet( pad->GetName(), netname, pad->GetPinFunction(), + component->AddNet( pad->GetNumber(), netname, pad->GetPinFunction(), pad->GetPinType() ); } } diff --git a/pcbnew/dialogs/dialog_exchange_footprints.cpp b/pcbnew/dialogs/dialog_exchange_footprints.cpp index 40d3149ceb..b9938d5f84 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints.cpp +++ b/pcbnew/dialogs/dialog_exchange_footprints.cpp @@ -520,8 +520,8 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew, if( !pad->IsOnCopperLayer() ) continue; - // Pads with no name are never connected to a net - if( pad->GetName().IsEmpty() ) + // Pads with no numbers are never connected to a net + if( pad->GetNumber().IsEmpty() ) continue; // Search for a similar pad on a copper layer, to reuse net info @@ -529,7 +529,7 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew, while( true ) { - pad_model = aExisting->FindPadByName( pad->GetName(), last_pad ); + pad_model = aExisting->FindPadByNumber( pad->GetNumber(), last_pad ); if( !pad_model ) break; diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 7f06b04924..fdd1f3021c 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -115,7 +115,7 @@ void PCB_BASE_FRAME::ShowPadPropertiesDialog( PAD* aPad ) PAD_TOOL* padTools = m_toolManager->GetTool(); if( padTools ) - padTools->SetLastPadName( aPad->GetName() ); + padTools->SetLastPadNumber( aPad->GetNumber() ); } } } @@ -515,7 +515,7 @@ void DIALOG_PAD_PROPERTIES::initValues() m_FlippedWarningSizer->Show( m_isFlipped ); - m_PadNumCtrl->SetValue( m_dummyPad->GetName() ); + m_PadNumCtrl->SetValue( m_dummyPad->GetNumber() ); m_PadNetSelector->SetSelectedNetcode( m_dummyPad->GetNetCode() ); // Display current pad parameters units: @@ -981,7 +981,7 @@ void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event ) } else if( m_PadNumCtrl->GetValue().IsEmpty() && m_currentPad ) { - m_PadNumCtrl->ChangeValue( m_currentPad->GetName() ); + m_PadNumCtrl->ChangeValue( m_currentPad->GetNumber() ); m_PadNetSelector->SetSelectedNetcode( m_currentPad->GetNetCode() ); } @@ -1583,7 +1583,7 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow() m_currentPad->SetRemoveUnconnected( m_padMaster->GetRemoveUnconnected() ); m_currentPad->SetKeepTopBottom( m_padMaster->GetKeepTopBottom() ); - m_currentPad->SetName( m_padMaster->GetName() ); + m_currentPad->SetNumber( m_padMaster->GetNumber() ); int padNetcode = NETINFO_LIST::UNCONNECTED; @@ -1779,7 +1779,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad ) aPad->SetPadToDieLength( 0 ); aPad->SetOrientation( m_OrientValue * 10.0 ); - aPad->SetName( m_PadNumCtrl->GetValue() ); + aPad->SetNumber( m_PadNumCtrl->GetValue() ); aPad->SetNetCode( m_PadNetSelector->GetSelectedNetcode() ); int chamfers = 0; @@ -1848,7 +1848,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad ) case PAD_ATTRIB::NPTH: // Mechanical purpose only: // no net name, no pad name allowed - aPad->SetName( wxEmptyString ); + aPad->SetNumber( wxEmptyString ); aPad->SetNetCode( NETINFO_LIST::UNCONNECTED ); break; diff --git a/pcbnew/dialogs/dialog_track_via_properties.cpp b/pcbnew/dialogs/dialog_track_via_properties.cpp index 2bff4fd3cc..1f3017de2f 100644 --- a/pcbnew/dialogs/dialog_track_via_properties.cpp +++ b/pcbnew/dialogs/dialog_track_via_properties.cpp @@ -357,7 +357,7 @@ bool DIALOG_TRACK_VIA_PROPERTIES::confirmPadChange( const std::vector& cha PAD* pad = *changingPads.begin(); msg.Printf( _( "Changing the net will also update %s pad %s to %s." ), pad->GetParent()->GetReference(), - pad->GetName(), + pad->GetNumber(), m_netSelector->GetValue() ); } else if( changingPads.size() == 2 ) @@ -366,9 +366,9 @@ bool DIALOG_TRACK_VIA_PROPERTIES::confirmPadChange( const std::vector& cha PAD* pad2 = *( ++changingPads.begin() ); msg.Printf( _( "Changing the net will also update %s pad %s and %s pad %s to %s." ), pad1->GetParent()->GetReference(), - pad1->GetName(), + pad1->GetNumber(), pad2->GetParent()->GetReference(), - pad2->GetName(), + pad2->GetNumber(), m_netSelector->GetValue() ); } else diff --git a/pcbnew/drc/drc_test_provider_lvs.cpp b/pcbnew/drc/drc_test_provider_lvs.cpp index 8579f1ecc7..6f12bf26c2 100644 --- a/pcbnew/drc/drc_test_provider_lvs.cpp +++ b/pcbnew/drc/drc_test_provider_lvs.cpp @@ -132,7 +132,10 @@ void DRC_TEST_PROVIDER_LVS::testFootprints( NETLIST& aNetlist ) if( m_drcEngine->IsErrorLimitExceeded( DRCE_NET_CONFLICT ) ) break; - const COMPONENT_NET& sch_net = component->GetNet( pad->GetName() ); + if( !pad->CanHaveNumber() ) + continue; + + const COMPONENT_NET& sch_net = component->GetNet( pad->GetNumber() ); const wxString& pcb_netname = pad->GetNetname(); if( !pcb_netname.IsEmpty() && sch_net.GetPinName().IsEmpty() ) @@ -174,7 +177,7 @@ void DRC_TEST_PROVIDER_LVS::testFootprints( NETLIST& aNetlist ) const COMPONENT_NET& sch_net = component->GetNet( jj ); - if( !footprint->FindPadByName( sch_net.GetPinName() ) ) + if( !footprint->FindPadByNumber( sch_net.GetPinName() ) ) { m_msg.Printf( _( "No pad found for pin %s in schematic." ), sch_net.GetPinName() ); diff --git a/pcbnew/exporters/export_d356.cpp b/pcbnew/exporters/export_d356.cpp index 14e026409e..f3e54b8742 100644 --- a/pcbnew/exporters/export_d356.cpp +++ b/pcbnew/exporters/export_d356.cpp @@ -108,7 +108,7 @@ static void build_pad_testpoints( BOARD *aPcb, std::vector & aRecor if( rk.access != -1 ) { rk.netname = pad->GetNetname(); - rk.pin = pad->GetName(); + rk.pin = pad->GetNumber(); rk.refdes = footprint->GetReference(); rk.midpoint = false; // XXX MAYBE need to be computed (how?) const wxSize& drill = pad->GetDrillSize(); diff --git a/pcbnew/exporters/export_footprints_placefile.cpp b/pcbnew/exporters/export_footprints_placefile.cpp index a8bb90eaf1..4468d3e680 100644 --- a/pcbnew/exporters/export_footprints_placefile.cpp +++ b/pcbnew/exporters/export_footprints_placefile.cpp @@ -375,12 +375,12 @@ std::string PLACE_FILE_EXPORTER::GenReportData() std::sort( sortedPads.begin(), sortedPads.end(), []( PAD* a, PAD* b ) -> bool { - return StrNumCmp( a->GetName(), b->GetName(), true ) < 0; + return StrNumCmp( a->GetNumber(), b->GetNumber(), true ) < 0; }); for( PAD* pad : sortedPads ) { - sprintf( line, "$PAD \"%s\"\n", TO_UTF8( pad->GetName() ) ); + sprintf( line, "$PAD \"%s\"\n", TO_UTF8( pad->GetNumber() ) ); buffer += line; int layer = 0; diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp index 09eeac1ff2..04013c156e 100644 --- a/pcbnew/exporters/export_gencad.cpp +++ b/pcbnew/exporters/export_gencad.cpp @@ -793,7 +793,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb ) * all pads need to be marked as TOP to use the padstack information correctly. */ layer = "TOP"; - pinname = pad->GetName(); + pinname = pad->GetNumber(); if( pinname.IsEmpty() ) pinname = wxT( "none" ); @@ -944,7 +944,7 @@ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb ) msg.Printf( wxT( "NODE \"%s\" \"%s\"" ), escapeString( footprint->GetReference() ), - escapeString( pad->GetName() ) ); + escapeString( pad->GetNumber() ) ); fputs( TO_UTF8( msg ), aFile ); fputs( "\n", aFile ); diff --git a/pcbnew/exporters/export_hyperlynx.cpp b/pcbnew/exporters/export_hyperlynx.cpp index 2297dd34d6..428a9270fd 100644 --- a/pcbnew/exporters/export_hyperlynx.cpp +++ b/pcbnew/exporters/export_hyperlynx.cpp @@ -448,7 +448,7 @@ bool HYPERLYNX_EXPORTER::writeNetObjects( const std::vector& aObjec if( ref.IsEmpty() ) ref = "EMPTY"; - wxString padName = pad->GetName(); + wxString padName = pad->GetNumber(); if( padName.IsEmpty() ) padName = "1"; diff --git a/pcbnew/exporters/export_idf.cpp b/pcbnew/exporters/export_idf.cpp index 7e52a4fc56..af75c5e8bf 100644 --- a/pcbnew/exporters/export_idf.cpp +++ b/pcbnew/exporters/export_idf.cpp @@ -337,7 +337,7 @@ static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD kplate = IDF3::PTH; // hole type - tstr = TO_UTF8( pad->GetName() ); + tstr = TO_UTF8( pad->GetNumber() ); if( tstr.empty() || !tstr.compare( "0" ) || !tstr.compare( "~" ) || ( kplate == IDF3::NPTH ) diff --git a/pcbnew/exporters/gerber_placefile_writer.cpp b/pcbnew/exporters/gerber_placefile_writer.cpp index 05b02f6189..562a0b6167 100644 --- a/pcbnew/exporters/gerber_placefile_writer.cpp +++ b/pcbnew/exporters/gerber_placefile_writer.cpp @@ -235,7 +235,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_PAD1_POSITION ); - gbr_metadata.SetPadName( pad1->GetName(), allowUtf8, true ); + gbr_metadata.SetPadName( pad1->GetNumber(), allowUtf8, true ); gbr_metadata.SetPadPinFunction( pad1->GetPinFunction(), allowUtf8, true ); @@ -276,7 +276,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER if( !pad->IsOnLayer( aLayer ) ) continue; - gbr_metadata.SetPadName( pad->GetName(), allowUtf8, true ); + gbr_metadata.SetPadName( pad->GetNumber(), allowUtf8, true ); gbr_metadata.SetPadPinFunction( pad->GetPinFunction(), allowUtf8, true ); @@ -336,7 +336,7 @@ void PLACEFILE_GERBER_WRITER::findPads1( std::vector& aPadList, FOOTPRINT* if( !pad->IsOnLayer( m_layer ) ) continue; - if( pad->GetName() == "1" || pad->GetName() == "A1") + if( pad->GetNumber() == "1" || pad->GetNumber() == "A1") aPadList.push_back( pad ); } } diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index ab89cd65de..e93eb978cb 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -1009,7 +1009,7 @@ bool FOOTPRINT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) } -PAD* FOOTPRINT::FindPadByName( const wxString& aPadName, PAD* aSearchAfterMe ) const +PAD* FOOTPRINT::FindPadByNumber( const wxString& aPadNumber, PAD* aSearchAfterMe ) const { bool can_select = aSearchAfterMe ? false : true; @@ -1021,7 +1021,7 @@ PAD* FOOTPRINT::FindPadByName( const wxString& aPadName, PAD* aSearchAfterMe ) c continue; } - if( can_select && pad->GetName() == aPadName ) + if( can_select && pad->GetNumber() == aPadNumber ) return pad; } @@ -1085,7 +1085,7 @@ unsigned FOOTPRINT::GetPadCount( INCLUDE_NPTH_T aIncludeNPTH ) const unsigned FOOTPRINT::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const { - std::set usedNames; + std::set usedNumbers; // Create a set of used pad numbers for( PAD* pad : m_pads ) @@ -1097,22 +1097,20 @@ unsigned FOOTPRINT::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const // Skip pads with no name, because they are usually "mechanical" // pads, not "electrical" pads - if( pad->GetName().IsEmpty() ) + if( pad->GetNumber().IsEmpty() ) continue; if( !aIncludeNPTH ) { // skip NPTH if( pad->GetAttribute() == PAD_ATTRIB::NPTH ) - { continue; - } } - usedNames.insert( pad->GetName() ); + usedNumbers.insert( pad->GetNumber() ); } - return usedNames.size(); + return usedNumbers.size(); } @@ -1760,20 +1758,20 @@ BOARD_ITEM* FOOTPRINT::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootpr } -wxString FOOTPRINT::GetNextPadName( const wxString& aLastPadName ) const +wxString FOOTPRINT::GetNextPadNumber( const wxString& aLastPadNumber ) const { - std::set usedNames; + std::set usedNumbers; // Create a set of used pad numbers for( PAD* pad : m_pads ) - usedNames.insert( pad->GetName() ); + usedNumbers.insert( pad->GetNumber() ); - // Pad names aren't technically reference designators, but the formatting is close enough + // Pad numbers aren't technically reference designators, but the formatting is close enough // for these to give us what we need. - wxString prefix = UTIL::GetRefDesPrefix( aLastPadName ); - int num = GetTrailingInt( aLastPadName ); + wxString prefix = UTIL::GetRefDesPrefix( aLastPadNumber ); + int num = GetTrailingInt( aLastPadNumber ); - while( usedNames.count( wxString::Format( "%s%d", prefix, num ) ) ) + while( usedNumbers.count( wxString::Format( "%s%d", prefix, num ) ) ) num++; return wxString::Format( "%s%d", prefix, num ); @@ -2093,8 +2091,8 @@ bool FOOTPRINT::cmp_drawings::operator()( const BOARD_ITEM* aFirst, bool FOOTPRINT::cmp_pads::operator()( const PAD* aFirst, const PAD* aSecond ) const { - if( aFirst->GetName() != aSecond->GetName() ) - return StrNumCmp( aFirst->GetName(), aSecond->GetName() ) < 0; + if( aFirst->GetNumber() != aSecond->GetNumber() ) + return StrNumCmp( aFirst->GetNumber(), aSecond->GetNumber() ) < 0; if( aFirst->m_Uuid != aSecond->m_Uuid ) // shopuld be always the case foer valid boards return aFirst->m_Uuid < aSecond->m_Uuid; diff --git a/pcbnew/footprint.h b/pcbnew/footprint.h index 07c196fb05..8ce689943d 100644 --- a/pcbnew/footprint.h +++ b/pcbnew/footprint.h @@ -480,15 +480,15 @@ public: void SetProperty( const wxString& aKey, const wxString& aVal ) { m_properties[ aKey ] = aVal; } /** - * Return a #PAD with a matching name. + * Return a #PAD with a matching number. * - * @note Names may not be unique depending on how the footprint was created. + * @note Numbers may not be unique depending on how the footprint was created. * - * @param aPadName the pad name to find. + * @param aPadNumber the pad number to find. * @param aSearchAfterMe = not nullptr to find a pad living after aAfterMe - * @return the first matching named #PAD is returned or NULL if not found. + * @return the first matching numbered #PAD is returned or NULL if not found. */ - PAD* FindPadByName( const wxString& aPadName, PAD* aSearchAfterMe = nullptr ) const; + PAD* FindPadByNumber( const wxString& aPadNumber, PAD* aSearchAfterMe = nullptr ) const; /** * Get a pad at \a aPosition on \a aLayerMask in the footprint. @@ -523,13 +523,13 @@ public: unsigned GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const; /** - * Return the next available pad name in the footprint. + * Return the next available pad number in the footprint. * * @param aFillSequenceGaps true if the numbering should "fill in" gaps in the sequence, * else return the highest value + 1 - * @return the next available pad name + * @return the next available pad number */ - wxString GetNextPadName( const wxString& aLastPadName ) const; + wxString GetNextPadNumber( const wxString& aLastPadName ) const; double GetArea( int aPadding = 0 ) const; diff --git a/pcbnew/microwave/microwave_footprint.cpp b/pcbnew/microwave/microwave_footprint.cpp index f5e33ae54f..27099604c6 100644 --- a/pcbnew/microwave/microwave_footprint.cpp +++ b/pcbnew/microwave/microwave_footprint.cpp @@ -133,7 +133,7 @@ FOOTPRINT* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprint break; case MICROWAVE_FOOTPRINT_SHAPE::STUB: //Stub : - pad->SetName( wxT( "1" ) ); + pad->SetNumber( wxT( "1" ) ); pad = *( it + 1 ); pad->SetY0( -( gap_size + pad->GetSize().y ) / 2 ); pad->SetSize( wxSize( pad->GetSize().x, gap_size ) ); @@ -200,7 +200,6 @@ FOOTPRINT* MICROWAVE_TOOL::createBaseFootprint( const wxString& aValue, // Create 2 pads used in gaps and stubs. The gap is between these 2 pads // the stub is the pad 2 - wxString Line; int pad_num = 1; while( aPadCount-- ) @@ -217,8 +216,7 @@ FOOTPRINT* MICROWAVE_TOOL::createBaseFootprint( const wxString& aValue, pad->SetAttribute( PAD_ATTRIB::SMD ); pad->SetLayerSet( F_Cu ); - Line.Printf( wxT( "%d" ), pad_num ); - pad->SetName( Line ); + pad->SetNumber( wxString::Format( wxT( "%d" ), pad_num ) ); pad_num++; } diff --git a/pcbnew/microwave/microwave_inductor.cpp b/pcbnew/microwave/microwave_inductor.cpp index e81a23da45..23822e2c63 100644 --- a/pcbnew/microwave/microwave_inductor.cpp +++ b/pcbnew/microwave/microwave_inductor.cpp @@ -441,7 +441,7 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN& footprint->Add( pad ); - pad->SetName( "1" ); + pad->SetNumber( "1" ); pad->SetPosition( aInductorPattern.m_End ); pad->SetPos0( pad->GetPosition() - footprint->GetPosition() ); @@ -457,7 +457,7 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN& footprint->Add( newpad ); pad = newpad; - pad->SetName( "2" ); + pad->SetNumber( "2" ); pad->SetPosition( aInductorPattern.m_Start ); pad->SetPos0( pad->GetPosition() - footprint->GetPosition() ); diff --git a/pcbnew/netlist_reader/board_netlist_updater.cpp b/pcbnew/netlist_reader/board_netlist_updater.cpp index 7e8164d2dc..eeecb15d83 100644 --- a/pcbnew/netlist_reader/board_netlist_updater.cpp +++ b/pcbnew/netlist_reader/board_netlist_updater.cpp @@ -412,7 +412,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( FOOTPRINT* aFootprint // At this point, the component footprint is updated. Now update the nets. for( PAD* pad : aFootprint->Pads() ) { - const COMPONENT_NET& net = aNewComponent->GetNet( pad->GetName() ); + const COMPONENT_NET& net = aNewComponent->GetNet( pad->GetNumber() ); wxString pinFunction; wxString pinType; @@ -451,23 +451,23 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( FOOTPRINT* aFootprint { msg.Printf( _( "Disconnect %s pin %s." ), aFootprint->GetReference(), - pad->GetName() ); + pad->GetNumber() ); } else { msg.Printf( _( "Disconnected %s pin %s." ), aFootprint->GetReference(), - pad->GetName() ); + pad->GetNumber() ); } m_reporter->Report( msg, RPT_SEVERITY_ACTION ); } - else if( m_warnForNoNetPads && pad->IsOnCopperLayer() && !pad->GetName().IsEmpty() ) + else if( m_warnForNoNetPads && pad->IsOnCopperLayer() && !pad->GetNumber().IsEmpty() ) { // pad is connectable but has no net found in netlist msg.Printf( _( "No net found for symbol %s pin %s." ), aFootprint->GetReference(), - pad->GetName() ); + pad->GetNumber() ); m_reporter->Report( msg, RPT_SEVERITY_WARNING); } @@ -529,7 +529,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( FOOTPRINT* aFootprint { msg.Printf( _( "Reconnect %s pin %s from %s to %s."), aFootprint->GetReference(), - pad->GetName(), + pad->GetNumber(), UnescapeString( pad->GetNetname() ), UnescapeString( netName ) ); } @@ -537,7 +537,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( FOOTPRINT* aFootprint { msg.Printf( _( "Reconnected %s pin %s from %s to %s."), aFootprint->GetReference(), - pad->GetName(), + pad->GetNumber(), UnescapeString( pad->GetNetname() ), UnescapeString( netName ) ); } @@ -548,15 +548,14 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( FOOTPRINT* aFootprint { msg.Printf( _( "Connect %s pin %s to %s."), aFootprint->GetReference(), - pad->GetName(), + pad->GetNumber(), UnescapeString( netName ) ); } else { msg.Printf( _( "Connected %s pin %s to %s."), - aFootprint->GetReference(), - pad->GetName(), + pad->GetNumber(), UnescapeString( netName ) ); } } @@ -873,7 +872,7 @@ bool BOARD_NETLIST_UPDATER::testConnectivity( NETLIST& aNetlist, // wrong or missing. wxString msg; - wxString padname; + wxString padNumber; for( int i = 0; i < (int) aNetlist.GetCount(); i++ ) { @@ -886,16 +885,15 @@ bool BOARD_NETLIST_UPDATER::testConnectivity( NETLIST& aNetlist, // Explore all pins/pads in component for( unsigned jj = 0; jj < component->GetNetCount(); jj++ ) { - const COMPONENT_NET& net = component->GetNet( jj ); - padname = net.GetPinName(); + padNumber = component->GetNet( jj ).GetPinName(); - if( footprint->FindPadByName( padname ) ) + if( footprint->FindPadByNumber( padNumber ) ) continue; // OK, pad found // not found: bad footprint, report error msg.Printf( _( "%s pad %s not found in %s." ), component->GetReference(), - padname, + padNumber, footprint->GetFPID().Format().wx_str() ); m_reporter->Report( msg, RPT_SEVERITY_ERROR ); ++m_errorCount; diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index e307bdbf24..ef7a04cbfb 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -113,7 +113,7 @@ PAD::PAD( const PAD& aOther ) : SetPadToDieLength( aOther.GetPadToDieLength() ); SetPosition( aOther.GetPosition() ); SetPos0( aOther.GetPos0() ); - SetName( aOther.GetName() ); + SetNumber( aOther.GetNumber() ); SetPinFunction( aOther.GetPinFunction() ); SetSubRatsnest( aOther.GetSubRatsnest() ); m_effectiveBoundingRadius = aOther.m_effectiveBoundingRadius; @@ -131,7 +131,7 @@ PAD& PAD::operator=( const PAD &aOther ) SetPadToDieLength( aOther.GetPadToDieLength() ); SetPosition( aOther.GetPosition() ); SetPos0( aOther.GetPos0() ); - SetName( aOther.GetName() ); + SetNumber( aOther.GetNumber() ); SetPinFunction( aOther.GetPinFunction() ); SetSubRatsnest( aOther.GetSubRatsnest() ); m_effectiveBoundingRadius = aOther.m_effectiveBoundingRadius; @@ -142,6 +142,20 @@ PAD& PAD::operator=( const PAD &aOther ) } +bool PAD::CanHaveNumber() const +{ + // Aperture pads don't get a number + if( IsAperturePad() ) + return false; + + // NPTH pads don't get numbers + if( GetAttribute() == PAD_ATTRIB::NPTH ) + return false; + + return true; +} + + bool PAD::IsLocked() const { if( GetParent() && static_cast( GetParent() )->IsLocked() ) @@ -857,7 +871,7 @@ void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& if( parentFootprint ) aList.emplace_back( _( "Footprint" ), parentFootprint->GetReference() ); - aList.emplace_back( _( "Pad" ), m_name ); + aList.emplace_back( _( "Pad" ), m_number ); if( !GetPinFunction().IsEmpty() ) aList.emplace_back( _( "Pin Name" ), GetPinFunction() ); @@ -1106,7 +1120,7 @@ wxString PAD::ShowPadAttr() const wxString PAD::GetSelectMenuText( EDA_UNITS aUnits ) const { - if( GetName().IsEmpty() ) + if( GetNumber().IsEmpty() ) { if( GetAttribute() == PAD_ATTRIB::SMD || GetAttribute() == PAD_ATTRIB::CONN ) { @@ -1125,14 +1139,14 @@ wxString PAD::GetSelectMenuText( EDA_UNITS aUnits ) const if( GetAttribute() == PAD_ATTRIB::SMD || GetAttribute() == PAD_ATTRIB::CONN ) { return wxString::Format( _( "Pad %s of %s on %s" ), - GetName(), + GetNumber(), GetParent()->GetReference(), layerMaskDescribe() ); } else { return wxString::Format( _( "Through hole pad %s of %s" ), - GetName(), + GetNumber(), GetParent()->GetReference() ); } } @@ -1221,7 +1235,7 @@ void PAD::ViewGetLayers( int aLayers[], int& aCount ) const wxString msg; msg.Printf( wxT( "footprint %s, pad %s: could not find valid layer for pad" ), GetParent() ? GetParent()->GetReference() : "", - GetName().IsEmpty() ? "(unnamed)" : GetName() ); + GetNumber().IsEmpty() ? "(unnumbered)" : GetNumber() ); wxLogWarning( msg ); } #endif @@ -1476,7 +1490,7 @@ static struct PAD_DESC propMgr.AddProperty( shape ); propMgr.AddProperty( new PROPERTY( _HKI( "Pad Number" ), - &PAD::SetName, &PAD::GetName ) ); + &PAD::SetNumber, &PAD::GetNumber ) ); propMgr.AddProperty( new PROPERTY( _HKI( "Pin Name" ), &PAD::SetPinFunction, &PAD::GetPinFunction ) ); propMgr.AddProperty( new PROPERTY( _HKI( "Pin Type" ), diff --git a/pcbnew/pad.h b/pcbnew/pad.h index d8251625ca..7c8151ca17 100644 --- a/pcbnew/pad.h +++ b/pcbnew/pad.h @@ -123,11 +123,15 @@ public: bool IsFlipped() const; /** - * Set the pad name (sometimes called pad number, although it can be an array reference - * like AA12). + * Set the pad number (note that it can be alphanumeric, such as the array reference "AA12"). */ - void SetName( const wxString& aName ) { m_name = aName; } - const wxString& GetName() const { return m_name; } + void SetNumber( const wxString& aNumber ) { m_number = aNumber; } + const wxString& GetNumber() const { return m_number; } + + /** + * Indicates whether or not the pad can have a number. (NPTH and SMD aperture pads can not.) + */ + bool CanHaveNumber() const; /** * Set the pad function (pin name in schematic) @@ -148,7 +152,7 @@ public: bool SameLogicalPadAs( const PAD* other ) const { // hide tricks behind sensible API - return GetParent() == other->GetParent() && m_name == other->m_name; + return GetParent() == other->GetParent() && m_number == other->m_number; } /** @@ -670,7 +674,7 @@ private: ERROR_LOC aErrorLoc ) const; private: - wxString m_name; // Pad name (pin number in schematic) + wxString m_number; // Pad name (pin number in schematic) wxString m_pinFunction; // Pin name in schematic wxString m_pinType; // Pin electrical type in schematic diff --git a/pcbnew/pad_naming.cpp b/pcbnew/pad_naming.cpp deleted file mode 100644 index 331933aa24..0000000000 --- a/pcbnew/pad_naming.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "pad_naming.h" - -bool PAD_NAMING::PadCanHaveName( const PAD& aPad ) -{ - // Aperture pads don't get a number - if( aPad.IsAperturePad() ) - return false; - - // NPTH pads don't get numbers - if( aPad.GetAttribute() == PAD_ATTRIB::NPTH ) - return false; - - return true; -} \ No newline at end of file diff --git a/pcbnew/pad_naming.h b/pcbnew/pad_naming.h deleted file mode 100644 index 070c921775..0000000000 --- a/pcbnew/pad_naming.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef PAD_NAMING_H -#define PAD_NAMING_H - -#include - -/** - * The PAD_NAMING namespace contains helper functions for common operations - * to do with naming of #PAD objects. - */ -namespace PAD_NAMING -{ - -/** - * Check if a pad should be named. - * - * For example, NPTH or paste apertures normally do not have names, as they - * cannot be assigned to a netlist. - * - * @param aPad the pad to check - * @return true if the pad gets a name - */ -bool PadCanHaveName( const PAD& aPad ); - -} // namespace PAD_NAMING - -#endif // PAD_NAMING_H \ No newline at end of file diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index dbf5848151..5b0faa1055 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -989,9 +989,9 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer ) if( m_pcbSettings.m_padNumbers ) { - const wxString& padName = aPad->GetName(); + const wxString& padNumber = aPad->GetNumber(); textpos.y = -textpos.y; - double tsize = 1.5 * padsize.x / padName.Length(); + double tsize = 1.5 * padsize.x / padNumber.Length(); tsize = std::min( tsize, size ); // Use a smaller text size to handle interline, pen size.. @@ -1001,7 +1001,7 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer ) m_gal->SetGlyphSize( numsize ); m_gal->SetLineWidth( numsize.x / 12.0 ); - m_gal->BitmapText( padName, textpos, 0.0 ); + m_gal->BitmapText( padNumber, textpos, 0.0 ); } m_gal->Restore(); diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 4e7e531323..e4a8129792 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -106,9 +106,9 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, const COLOR4D& aColor, OUTLINE_ const bool useUTF8 = false; const bool useQuoting = false; - gbr_metadata.SetPadName( aPad->GetName(), useUTF8, useQuoting ); + gbr_metadata.SetPadName( aPad->GetNumber(), useUTF8, useQuoting ); - if( !aPad->GetName().IsEmpty() ) + if( !aPad->GetNumber().IsEmpty() ) gbr_metadata.SetPadPinFunction( aPad->GetPinFunction(), useUTF8, useQuoting ); gbr_metadata.SetNetName( aPad->GetNetname() ); @@ -116,7 +116,7 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, const COLOR4D& aColor, OUTLINE_ // Some pads are mechanical pads ( through hole or smd ) // when this is the case, they have no pad name and/or are not plated. // In this case gerber files have slightly different attributes. - if( aPad->GetAttribute() == PAD_ATTRIB::NPTH || aPad->GetName().IsEmpty() ) + if( aPad->GetAttribute() == PAD_ATTRIB::NPTH || aPad->GetNumber().IsEmpty() ) gbr_metadata.m_NetlistMetadata.m_NotInNet = true; if( !plotOnExternalCopperLayer ) diff --git a/pcbnew/plugins/altium/altium_pcb.cpp b/pcbnew/plugins/altium/altium_pcb.cpp index 69961b54bc..b047e81e2d 100644 --- a/pcbnew/plugins/altium/altium_pcb.cpp +++ b/pcbnew/plugins/altium/altium_pcb.cpp @@ -2103,7 +2103,7 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader, PAD* pad = new PAD( footprint ); footprint->Add( pad, ADD_MODE::APPEND ); - pad->SetName( elem.name ); + pad->SetNumber( elem.name ); pad->SetNetCode( GetNetCode( elem.net ) ); pad->SetLocked( elem.is_locked ); diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp index 000e72eeb6..b0958c2350 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp @@ -733,7 +733,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers( const SYMDEF_PCB& aComponen PAD* pad = new PAD( aFootprint ); pad->SetAttribute( PAD_ATTRIB::SMD ); pad->SetLayerSet( LSET( 1, copperLayer ) ); - pad->SetName( anchorPad.Identifier.IsEmpty() + pad->SetNumber( anchorPad.Identifier.IsEmpty() ? wxString::Format( wxT( "%ld" ), anchorPad.ID ) : anchorPad.Identifier ); @@ -774,7 +774,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers( const SYMDEF_PCB& aComponen if( associatedPad.PCBonlyPad ) { PAD* assocPad = getPadReference( aFootprint, padID ); - assocPad->SetName( pad->GetName() ); + assocPad->SetNumber( pad->GetNumber() ); ++numRenames; } } @@ -938,8 +938,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad, pad->SetLayerSet( padLayerSet ); - - pad->SetName( aCadstarPad.Identifier.IsEmpty() ? + pad->SetNumber( aCadstarPad.Identifier.IsEmpty() ? wxString::Format( wxT( "%ld" ), aCadstarPad.ID ) : aCadstarPad.Identifier ); @@ -1605,7 +1604,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadComponents() if( pinName.empty() ) pinName = wxString::Format( wxT( "%ld" ), pin.ID ); - getPadReference( footprint, pin.ID )->SetName( pinName ); + getPadReference( footprint, pin.ID )->SetNumber( pinName ); } } } @@ -1634,13 +1633,13 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadComponents() // Find the pad in the footprint definition PAD* kiPad = getPadReference( footprint, padEx.ID ); - wxString padName = kiPad->GetName(); + wxString padNumber = kiPad->GetNumber(); if( kiPad ) delete kiPad; kiPad = getKiCadPad( csPad, footprint ); - kiPad->SetName( padName ); + kiPad->SetNumber( padNumber ); // Change the pointer in the footprint to the newly created pad getPadReference( footprint, padEx.ID ) = kiPad; diff --git a/pcbnew/plugins/eagle/eagle_plugin.cpp b/pcbnew/plugins/eagle/eagle_plugin.cpp index 5b7693a0d7..8dc38d1ae8 100644 --- a/pcbnew/plugins/eagle/eagle_plugin.cpp +++ b/pcbnew/plugins/eagle/eagle_plugin.cpp @@ -1139,7 +1139,7 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements ) // update the nets within the pads of the clone for( PAD* pad : footprint->Pads() ) { - wxString pn_key = makeKey( e.name, pad->GetName() ); + wxString pn_key = makeKey( e.name, pad->GetNumber() ); NET_MAP_CITER ni = m_pads_to_nets.find( pn_key ); if( ni != m_pads_to_nets.end() ) @@ -2247,7 +2247,7 @@ void EAGLE_PLUGIN::packageHole( FOOTPRINT* aFootprint, wxXmlNode* aTree, bool aC // Mechanical purpose only: // no offset, no net name, no pad name allowed // pad->SetOffset( wxPoint( 0, 0 ) ); - // pad->SetName( wxEmptyString ); + // pad->SetNumber( wxEmptyString ); wxPoint padpos( kicad_x( e.x ), kicad_y( e.y ) ); @@ -2347,7 +2347,7 @@ void EAGLE_PLUGIN::packageSMD( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const void EAGLE_PLUGIN::transferPad( const EPAD_COMMON& aEaglePad, PAD* aPad ) const { - aPad->SetName( FROM_UTF8( aEaglePad.name.c_str() ) ); + aPad->SetNumber( FROM_UTF8( aEaglePad.name.c_str() ) ); // pad's "Position" is not relative to the footprint's, // whereas Pos0 is relative to the footprint's but is the unrotated coordinate. diff --git a/pcbnew/plugins/fabmaster/import_fabmaster.cpp b/pcbnew/plugins/fabmaster/import_fabmaster.cpp index b86d621226..b194286778 100644 --- a/pcbnew/plugins/fabmaster/import_fabmaster.cpp +++ b/pcbnew/plugins/fabmaster/import_fabmaster.cpp @@ -2240,7 +2240,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard ) else newpad->SetY( pin->pin_y ); - newpad->SetName( pin->pin_number ); + newpad->SetNumber( pin->pin_number ); if( padstack == pads.end() ) { diff --git a/pcbnew/plugins/geda/gpcb_plugin.cpp b/pcbnew/plugins/geda/gpcb_plugin.cpp index e139ad2843..f7383fb904 100644 --- a/pcbnew/plugins/geda/gpcb_plugin.cpp +++ b/pcbnew/plugins/geda/gpcb_plugin.cpp @@ -558,7 +558,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader ) // and set to the pin name of the netlist on instantiation. Many gEDA // bare footprints use identical strings for name and number, so this // can be a bit confusing. - pad->SetName( parameters[paramCnt-3] ); + pad->SetNumber( parameters[paramCnt-3] ); int x1 = parseInt( parameters[2], conv_unit ); int x2 = parseInt( parameters[4], conv_unit ); @@ -640,7 +640,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader ) // Pcbnew pad name is used for electrical connection calculations. // Accordingly it should be mapped to gEDA's pin/pad number, // which is used for the same purpose. - pad->SetName( parameters[paramCnt-3] ); + pad->SetNumber( parameters[paramCnt-3] ); wxPoint padPos( parseInt( parameters[2], conv_unit ), parseInt( parameters[3], conv_unit ) ); diff --git a/pcbnew/plugins/kicad/kicad_plugin.cpp b/pcbnew/plugins/kicad/kicad_plugin.cpp index 946f895a8c..bc77a6f313 100644 --- a/pcbnew/plugins/kicad/kicad_plugin.cpp +++ b/pcbnew/plugins/kicad/kicad_plugin.cpp @@ -1415,7 +1415,7 @@ void PCB_IO::format( const PAD* aPad, int aNestLevel ) const } m_out->Print( aNestLevel, "(pad %s %s %s", - m_out->Quotew( aPad->GetName() ).c_str(), + m_out->Quotew( aPad->GetNumber() ).c_str(), type, shape ); diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index 8357e2b2a7..793dc5bb78 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -3927,7 +3927,7 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent ) pad->SetKeepTopBottom( false ); NeedSYMBOLorNUMBER(); - pad->SetName( FromUTF8() ); + pad->SetNumber( FromUTF8() ); T token = NextTok(); @@ -4397,6 +4397,13 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent ) } } + if( !pad->CanHaveNumber() ) + { + // At some point it was possible to assign a number to aperture pads so we need to clean + // those out here. + pad->SetNumber( wxEmptyString ); + } + return pad.release(); } diff --git a/pcbnew/plugins/legacy/legacy_plugin.cpp b/pcbnew/plugins/legacy/legacy_plugin.cpp index 5093bbcc03..5fcf32c52b 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.cpp +++ b/pcbnew/plugins/legacy/legacy_plugin.cpp @@ -1344,16 +1344,15 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint ) // e.g. "Sh "A2" C 520 520 0 0 900" // or "Sh "1" R 157 1378 0 0 900" - // mypadname is LATIN1/CRYLIC for BOARD_FORMAT_VERSION 1, - // but for BOARD_FORMAT_VERSION 2, it is UTF8 from disk. - // So we have to go through two code paths. Moving forward - // padnames will be in UTF8 on disk, as are all KiCad strings on disk. - char mypadname[50]; + // mypadnumber is LATIN1/CRYLIC for BOARD_FORMAT_VERSION 1, but for + // BOARD_FORMAT_VERSION 2, it is UTF8 from disk. + // Moving forward padnumbers will be in UTF8 on disk, as are all KiCad strings on disk. + char mypadnumber[50]; data = line + SZ( "Sh" ) + 1; // +1 skips trailing whitespace // +1 trailing whitespace. - data = data + ReadDelimitedText( mypadname, data, sizeof(mypadname) ) + 1; + data = data + ReadDelimitedText( mypadnumber, data, sizeof( mypadnumber ) ) + 1; while( isSpace( *data ) ) ++data; @@ -1381,28 +1380,26 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint ) } // go through a wxString to establish a universal character set properly - wxString padname; + wxString padNumber; if( m_loading_format_version == 1 ) { // add 8 bit bytes, file format 1 was KiCad font type byte, // simply promote those 8 bit bytes up into UNICODE. (subset of LATIN1) - const unsigned char* cp = (unsigned char*) mypadname; + const unsigned char* cp = (unsigned char*) mypadnumber; while( *cp ) - { - padname += *cp++; // unsigned, ls 8 bits only - } + padNumber += *cp++; // unsigned, ls 8 bits only } else { // version 2, which is UTF8. - padname = FROM_UTF8( mypadname ); + padNumber = FROM_UTF8( mypadnumber ); } // chances are both were ASCII, but why take chances? - pad->SetName( padname ); + pad->SetNumber( padNumber ); pad->SetShape( static_cast( padshape ) ); pad->SetSize( wxSize( size_x, size_y ) ); pad->SetDelta( wxSize( delta_x, delta_y ) ); diff --git a/pcbnew/plugins/pcad/pcb_pad.cpp b/pcbnew/plugins/pcad/pcb_pad.cpp index 7076f540b1..485a59e928 100644 --- a/pcbnew/plugins/pcad/pcb_pad.cpp +++ b/pcbnew/plugins/pcad/pcb_pad.cpp @@ -263,7 +263,7 @@ void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncaps // actually this is a thru-hole pad pad->SetLayerSet( LSET::AllCuMask() | LSET( 2, B_Mask, F_Mask ) ); - pad->SetName( m_name.text ); + pad->SetNumber( m_name.text ); if( padShapeName == wxT( "Oval" ) || padShapeName == wxT( "Ellipse" ) diff --git a/pcbnew/python/swig/pad.i b/pcbnew/python/swig/pad.i index 2e9170d532..acf2333f86 100644 --- a/pcbnew/python/swig/pad.i +++ b/pcbnew/python/swig/pad.i @@ -16,12 +16,18 @@ # SetPadName() is the old name for PAD::SetName() # define it for compatibility def SetPadName(self, aName): - return self.SetName(aName) + return self.SetNumber(aName) + + def SetName(self, aName): + return self.SetNumber(aName) # GetPadName() is the old name for PAD::GetName() # define it for compatibility def GetPadName(self): - return self.GetName() + return self.GetNumber() + + def GetName(self): + return self.GetNumber() # AddPrimitive() is the old name for D_PAD::AddPrimitivePoly(), # PAD::AddPrimitiveSegment(), PAD::AddPrimitiveCircle(), diff --git a/pcbnew/specctra_import_export/specctra_export.cpp b/pcbnew/specctra_import_export/specctra_export.cpp index d8daf4f650..6d222d2835 100644 --- a/pcbnew/specctra_import_export/specctra_export.cpp +++ b/pcbnew/specctra_import_export/specctra_export.cpp @@ -612,7 +612,7 @@ typedef std::map PINMAP; IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint ) { PINMAP pinmap; - wxString padName; + wxString padNumber; PCB_TYPE_COLLECTOR fpItems; @@ -676,17 +676,17 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint ) PIN* pin = new PIN( image ); - padName = pad->GetName(); - pin->pin_id = TO_UTF8( padName ); + padNumber = pad->GetNumber(); + pin->pin_id = TO_UTF8( padNumber ); - if( padName != wxEmptyString && pinmap.find( padName ) == pinmap.end() ) + if( padNumber != wxEmptyString && pinmap.find( padNumber ) == pinmap.end() ) { - pinmap[ padName ] = 0; + pinmap[ padNumber ] = 0; } else // pad name is a duplicate within this footprint { char buf[32]; - int duplicates = ++pinmap[ padName ]; + int duplicates = ++pinmap[ padNumber ]; sprintf( buf, "@%d", duplicates ); diff --git a/pcbnew/tools/board_editor_control.cpp b/pcbnew/tools/board_editor_control.cpp index ebe010db61..2b6e3496ba 100644 --- a/pcbnew/tools/board_editor_control.cpp +++ b/pcbnew/tools/board_editor_control.cpp @@ -462,7 +462,7 @@ int BOARD_EDITOR_CONTROL::ExportNetlist( const TOOL_EVENT& aEvent ) if( !netname.IsEmpty() ) { - component->AddNet( pad->GetName(), netname, pad->GetPinFunction(), + component->AddNet( pad->GetNumber(), netname, pad->GetPinFunction(), pad->GetPinType() ); } } diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 79a619941b..eb139efb9b 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -2129,14 +2128,14 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) FOOTPRINT* parentFootprint = editFrame->GetBoard()->GetFirstFootprint(); dupe_item = parentFootprint->DuplicateItem( orig_item ); - if( increment && item->Type() == PCB_PAD_T - && PAD_NAMING::PadCanHaveName( *static_cast( dupe_item ) ) ) + if( increment && dupe_item->Type() == PCB_PAD_T + && static_cast( dupe_item )->CanHaveNumber() ) { PAD_TOOL* padTool = m_toolMgr->GetTool(); - wxString padName = padTool->GetLastPadName(); - padName = parentFootprint->GetNextPadName( padName ); - padTool->SetLastPadName( padName ); - static_cast( dupe_item )->SetName( padName ); + wxString padNumber = padTool->GetLastPadNumber(); + padNumber = parentFootprint->GetNextPadNumber( padNumber ); + padTool->SetLastPadNumber( padNumber ); + static_cast( dupe_item )->SetNumber( padNumber ); } } else if( orig_item->GetParent() && orig_item->GetParent()->Type() == PCB_FOOTPRINT_T ) diff --git a/pcbnew/tools/pad_tool.cpp b/pcbnew/tools/pad_tool.cpp index 9da1973198..bb91b8937a 100644 --- a/pcbnew/tools/pad_tool.cpp +++ b/pcbnew/tools/pad_tool.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2017-2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -40,7 +40,6 @@ #include #include #include -#include #include PAD_TOOL::PAD_TOOL() : @@ -58,7 +57,7 @@ PAD_TOOL::~PAD_TOOL() void PAD_TOOL::Reset( RESET_REASON aReason ) { if( aReason == MODEL_RELOAD ) - m_lastPadName = wxT( "1" ); + m_lastPadNumber = wxT( "1" ); m_padCopied = false; m_editPad = niluuid; @@ -301,7 +300,7 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent ) VECTOR2I oldCursorPos; // store the previous mouse cursor position, during mouse drag std::list selectedPads; BOARD_COMMIT commit( frame() ); - std::map> oldNames; + std::map> oldNumbers; bool isFirstPoint = true; // used to be sure oldCursorPos will be initialized at least once. STATUS_TEXT_POPUP statusPopup( frame() ); @@ -389,10 +388,10 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent ) else newval = seqPadNum++; - wxString newName = wxString::Format( wxT( "%s%d" ), padPrefix, newval ); - oldNames[newName] = { newval, pad->GetName() }; - pad->SetName( newName ); - SetLastPadName( newName ); + wxString newNumber = wxString::Format( wxT( "%s%d" ), padPrefix, newval ); + oldNumbers[newNumber] = { newval, pad->GetNumber() }; + pad->SetNumber( newNumber ); + SetLastPadNumber( newNumber ); pad->SetSelected(); getView()->Update( pad ); @@ -408,15 +407,15 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent ) // ... or restore the old name if it was enumerated and clicked again else if( pad->IsSelected() && evt->IsClick( BUT_LEFT ) ) { - auto it = oldNames.find( pad->GetName() ); - wxASSERT( it != oldNames.end() ); + auto it = oldNumbers.find( pad->GetNumber() ); + wxASSERT( it != oldNumbers.end() ); - if( it != oldNames.end() ) + if( it != oldNumbers.end() ) { storedPadNumbers.push_back( it->second.first ); - pad->SetName( it->second.second ); - SetLastPadName( it->second.second ); - oldNames.erase( it ); + pad->SetNumber( it->second.second ); + SetLastPadNumber( it->second.second ); + oldNumbers.erase( it ); int newval = storedPadNumbers.front(); @@ -484,12 +483,12 @@ int PAD_TOOL::PlacePad( const TOOL_EVENT& aEvent ) pad->ImportSettingsFrom( *(m_frame->GetDesignSettings().m_Pad_Master.get()) ); - if( PAD_NAMING::PadCanHaveName( *pad ) ) + if( pad->CanHaveNumber() ) { - wxString padName = m_padTool->GetLastPadName(); - padName = m_board->GetFirstFootprint()->GetNextPadName( padName ); - pad->SetName( padName ); - m_padTool->SetLastPadName( padName ); + wxString padNumber = m_padTool->GetLastPadNumber(); + padNumber = m_board->GetFirstFootprint()->GetNextPadNumber( padNumber ); + pad->SetNumber( padNumber ); + m_padTool->SetLastPadNumber( padNumber ); } return std::unique_ptr( pad ); diff --git a/pcbnew/tools/pad_tool.h b/pcbnew/tools/pad_tool.h index eda0f965fc..f2cd35c4aa 100644 --- a/pcbnew/tools/pad_tool.h +++ b/pcbnew/tools/pad_tool.h @@ -59,8 +59,8 @@ public: */ int EditPad( const TOOL_EVENT& aEvent ); - wxString GetLastPadName() const { return m_lastPadName; } - void SetLastPadName( const wxString& aPadName ) { m_lastPadName = aPadName; } + wxString GetLastPadNumber() const { return m_lastPadNumber; } + void SetLastPadNumber( const wxString& aPadNumber ) { m_lastPadNumber = aPadNumber; } private: ///< Bind handlers to corresponding TOOL_ACTIONs. @@ -78,7 +78,7 @@ private: PCB_LAYER_ID explodePad( PAD* aPad ); void recombinePad( PAD* aPad ); - wxString m_lastPadName; + wxString m_lastPadNumber; bool m_padCopied; // Indicates there are valid settings in the Master Pad object bool m_wasHighContrast; diff --git a/qa/pcbnew/CMakeLists.txt b/qa/pcbnew/CMakeLists.txt index 1b0b650990..29cd9d52f4 100644 --- a/qa/pcbnew/CMakeLists.txt +++ b/qa/pcbnew/CMakeLists.txt @@ -35,7 +35,7 @@ set( QA_PCBNEW_SRCS test_array_pad_name_provider.cpp test_graphics_import_mgr.cpp test_lset.cpp - test_pad_naming.cpp + test_pad_numbering.cpp test_libeval_compiler.cpp test_tracks_cleaner.cpp test_zone_filler.cpp diff --git a/qa/pcbnew/test_array_pad_name_provider.cpp b/qa/pcbnew/test_array_pad_name_provider.cpp index 274a4ac53b..d91925cb97 100644 --- a/qa/pcbnew/test_array_pad_name_provider.cpp +++ b/qa/pcbnew/test_array_pad_name_provider.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2018-2021 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -21,14 +21,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @file test_array_pad_name_provider.cpp - * Test suite for the #ARRAY_PAD_NAME_PROVIDER class - */ - #include -#include // UUT +#include // UUT #include // make_unique @@ -46,7 +41,7 @@ static std::unique_ptr FootprintWithPads( const std::vector { std::unique_ptr pad = std::make_unique( footprint.get() ); - pad->SetName( name ); + pad->SetNumber( name ); footprint->Add( pad.release() ); } @@ -57,7 +52,7 @@ static std::unique_ptr FootprintWithPads( const std::vector /** * Declare the test suite */ -BOOST_AUTO_TEST_SUITE( ArrayPadNameProv ) +BOOST_AUTO_TEST_SUITE( ArrayPadNumberProv ) struct APNP_CASE @@ -66,7 +61,7 @@ struct APNP_CASE bool m_using_footprint; std::vector m_existing_pads; std::unique_ptr m_arr_opts; - std::vector m_exp_arr_names; + std::vector m_expected_numbers; }; @@ -117,21 +112,20 @@ std::vector GetFootprintAPNPCases() /** - * Check that an #ARRAY_PAD_NAME_PROVIDER provides the right names + * Check that an #ARRAY_PAD_NUMBER_PROVIDER provides the right names * @param aProvider the provider * @param aExpNames ordered list of expected names */ -void CheckPadNameProvider( ARRAY_PAD_NAME_PROVIDER& aProvider, std::vector aExpNames ) +void CheckPadNumberProvider( ARRAY_PAD_NUMBER_PROVIDER& aProvider, + std::vector aExpectedNumbers ) { - std::vector got_names; + std::vector got_numbers; - for( unsigned i = 0; i < aExpNames.size(); ++i ) - { - got_names.push_back( aProvider.GetNextPadName() ); - } + for( unsigned i = 0; i < aExpectedNumbers.size(); ++i ) + got_numbers.push_back( aProvider.GetNextPadNumber() ); - BOOST_CHECK_EQUAL_COLLECTIONS( - aExpNames.begin(), aExpNames.end(), got_names.begin(), got_names.end() ); + BOOST_CHECK_EQUAL_COLLECTIONS( aExpectedNumbers.begin(), aExpectedNumbers.end(), + got_numbers.begin(), got_numbers.end() ); } @@ -146,9 +140,9 @@ BOOST_AUTO_TEST_CASE( FootprintCases ) if( c.m_using_footprint ) footprint = FootprintWithPads( c.m_existing_pads ); - ARRAY_PAD_NAME_PROVIDER apnp( footprint.get(), *c.m_arr_opts ); + ARRAY_PAD_NUMBER_PROVIDER apnp( footprint.get(), *c.m_arr_opts ); - CheckPadNameProvider( apnp, c.m_exp_arr_names ); + CheckPadNumberProvider( apnp, c.m_expected_numbers ); } } } diff --git a/qa/pcbnew/test_pad_naming.cpp b/qa/pcbnew/test_pad_numbering.cpp similarity index 83% rename from qa/pcbnew/test_pad_naming.cpp rename to qa/pcbnew/test_pad_numbering.cpp index 47a8ddfb63..d8ab6518f3 100644 --- a/qa/pcbnew/test_pad_naming.cpp +++ b/qa/pcbnew/test_pad_numbering.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -22,10 +22,9 @@ */ #include - #include #include -#include +#include struct PAD_FIXTURE { @@ -70,21 +69,21 @@ struct PAD_FIXTURE }; -BOOST_FIXTURE_TEST_SUITE( PadNaming, PAD_FIXTURE ) +BOOST_FIXTURE_TEST_SUITE( PadNumbering, PAD_FIXTURE ) /** * Check what gets names and what doesn't */ -BOOST_AUTO_TEST_CASE( CanName ) +BOOST_AUTO_TEST_CASE( CanNumber ) { auto npth = MakeNPTH(); - BOOST_CHECK_EQUAL( false, PAD_NAMING::PadCanHaveName( npth ) ); + BOOST_CHECK_EQUAL( false, npth.CanHaveNumber() ); auto aperture = MakeAperture(); - BOOST_CHECK_EQUAL( false, PAD_NAMING::PadCanHaveName( aperture ) ); + BOOST_CHECK_EQUAL( false, aperture.CanHaveNumber() ); auto smd = MakeSmd(); - BOOST_CHECK_EQUAL( true, PAD_NAMING::PadCanHaveName( smd ) ); + BOOST_CHECK_EQUAL( true, smd.CanHaveNumber() ); } diff --git a/qa/pcbnew/test_zone_filler.cpp b/qa/pcbnew/test_zone_filler.cpp index 86ae350bcb..d293a4503b 100644 --- a/qa/pcbnew/test_zone_filler.cpp +++ b/qa/pcbnew/test_zone_filler.cpp @@ -61,7 +61,7 @@ BOOST_FIXTURE_TEST_CASE( BasicZoneFills, ZONE_FILL_TEST_FIXTURE ) for( PAD* pad : m_board->Footprints()[0]->Pads() ) { - if( pad->GetName() == "2" || pad->GetName() == "4" || pad->GetName() == "6" ) + if( pad->GetNumber() == "2" || pad->GetNumber() == "4" || pad->GetNumber() == "6" ) pad->SetSize( pad->GetSize() + wxSize( delta, delta ) ); } @@ -110,17 +110,17 @@ BOOST_FIXTURE_TEST_CASE( BasicZoneFills, ZONE_FILL_TEST_FIXTURE ) PAD* pad_b = dynamic_cast( item_b ); PCB_TRACK* trk_b = dynamic_cast( item_b ); - if( pad_a && pad_a->GetName() == "2" ) foundPad2Error = true; - else if( pad_a && pad_a->GetName() == "4" ) foundPad4Error = true; - else if( pad_a && pad_a->GetName() == "6" ) foundPad6Error = true; - else if( pad_b && pad_b->GetName() == "2" ) foundPad2Error = true; - else if( pad_b && pad_b->GetName() == "4" ) foundPad4Error = true; - else if( pad_b && pad_b->GetName() == "6" ) foundPad6Error = true; - else if( trk_a && trk_a->m_Uuid == arc8 ) foundArc8Error = true; - else if( trk_a && trk_a->m_Uuid == arc12 ) foundArc12Error = true; - else if( trk_b && trk_b->m_Uuid == arc8 ) foundArc8Error = true; - else if( trk_b && trk_b->m_Uuid == arc12 ) foundArc12Error = true; - else foundOtherError = true; + if( pad_a && pad_a->GetNumber() == "2" ) foundPad2Error = true; + else if( pad_a && pad_a->GetNumber() == "4" ) foundPad4Error = true; + else if( pad_a && pad_a->GetNumber() == "6" ) foundPad6Error = true; + else if( pad_b && pad_b->GetNumber() == "2" ) foundPad2Error = true; + else if( pad_b && pad_b->GetNumber() == "4" ) foundPad4Error = true; + else if( pad_b && pad_b->GetNumber() == "6" ) foundPad6Error = true; + else if( trk_a && trk_a->m_Uuid == arc8 ) foundArc8Error = true; + else if( trk_a && trk_a->m_Uuid == arc12 ) foundArc12Error = true; + else if( trk_b && trk_b->m_Uuid == arc8 ) foundArc8Error = true; + else if( trk_b && trk_b->m_Uuid == arc12 ) foundArc12Error = true; + else foundOtherError = true; } } );