Clear numbers from non-numberable pads and don't run DRC on them.
This was also the last straw on the misnamed PAD::GetName() and PAD::SetName(), which are now PAD::GetNumber() and PAD::SetNumber(). Fixes https://gitlab.com/kicad/code/kicad/issues/9017
This commit is contained in:
parent
baab2e6119
commit
e6ca9837a2
|
@ -721,7 +721,7 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
|
||||||
reporter.Report( wxString::Format( _( "Net %s\tNetClass %s\tPadName %s" ),
|
reporter.Report( wxString::Format( _( "Net %s\tNetClass %s\tPadName %s" ),
|
||||||
pad->GetNet()->GetNetname(),
|
pad->GetNet()->GetNetname(),
|
||||||
pad->GetNet()->GetNetClassName(),
|
pad->GetNet()->GetNetClassName(),
|
||||||
pad->GetName() ) );
|
pad->GetNumber() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -269,7 +269,7 @@ set( PCBNEW_CLASS_SRCS
|
||||||
|
|
||||||
action_plugin.cpp
|
action_plugin.cpp
|
||||||
array_creator.cpp
|
array_creator.cpp
|
||||||
array_pad_name_provider.cpp
|
array_pad_number_provider.cpp
|
||||||
build_BOM_from_board.cpp
|
build_BOM_from_board.cpp
|
||||||
cleanup_item.cpp
|
cleanup_item.cpp
|
||||||
convert_drawsegment_list_to_polygon.cpp
|
convert_drawsegment_list_to_polygon.cpp
|
||||||
|
@ -294,11 +294,8 @@ set( PCBNEW_CLASS_SRCS
|
||||||
load_select_footprint.cpp
|
load_select_footprint.cpp
|
||||||
menubar_footprint_editor.cpp
|
menubar_footprint_editor.cpp
|
||||||
menubar_pcb_editor.cpp
|
menubar_pcb_editor.cpp
|
||||||
pad_naming.cpp
|
|
||||||
pcb_base_edit_frame.cpp
|
pcb_base_edit_frame.cpp
|
||||||
pcb_layer_box_selector.cpp
|
pcb_layer_box_selector.cpp
|
||||||
# pcb_draw_panel_gal.cpp
|
|
||||||
# pcb_view.cpp
|
|
||||||
pcb_edit_frame.cpp
|
pcb_edit_frame.cpp
|
||||||
pcbnew_config.cpp
|
pcbnew_config.cpp
|
||||||
pcbnew_printout.cpp
|
pcbnew_printout.cpp
|
||||||
|
|
|
@ -24,11 +24,10 @@
|
||||||
|
|
||||||
#include "array_creator.h"
|
#include "array_creator.h"
|
||||||
|
|
||||||
#include <array_pad_name_provider.h>
|
#include <array_pad_number_provider.h>
|
||||||
#include <board_commit.h>
|
#include <board_commit.h>
|
||||||
#include <pcb_group.h>
|
#include <pcb_group.h>
|
||||||
#include <pad_naming.h>
|
#include <pad.h>
|
||||||
|
|
||||||
#include <dialogs/dialog_create_array.h>
|
#include <dialogs/dialog_create_array.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,7 +68,7 @@ void ARRAY_CREATOR::Invoke()
|
||||||
|
|
||||||
BOARD_COMMIT commit( &m_parent );
|
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 )
|
for ( int i = 0; i < m_selection.Size(); ++i )
|
||||||
{
|
{
|
||||||
|
@ -185,10 +184,10 @@ void ARRAY_CREATOR::Invoke()
|
||||||
{
|
{
|
||||||
PAD& pad = static_cast<PAD&>( *this_item );
|
PAD& pad = static_cast<PAD&>( *this_item );
|
||||||
|
|
||||||
if( PAD_NAMING::PadCanHaveName( pad ) )
|
if( pad.CanHaveNumber() )
|
||||||
{
|
{
|
||||||
wxString newName = pad_name_provider.GetNextPadName();
|
wxString newNumber = pad_number_provider.GetNextPadNumber();
|
||||||
pad.SetName( newName );
|
pad.SetNumber( newNumber );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,13 +21,13 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <array_pad_name_provider.h>
|
#include <array_pad_number_provider.h>
|
||||||
|
|
||||||
#include <pad.h>
|
#include <pad.h>
|
||||||
|
|
||||||
|
|
||||||
ARRAY_PAD_NAME_PROVIDER::ARRAY_PAD_NAME_PROVIDER( const FOOTPRINT* aFootprint,
|
ARRAY_PAD_NUMBER_PROVIDER::ARRAY_PAD_NUMBER_PROVIDER( const FOOTPRINT* aFootprint,
|
||||||
const ARRAY_OPTIONS& aArrayOpts )
|
const ARRAY_OPTIONS& aArrayOpts )
|
||||||
: m_arrayOpts( aArrayOpts )
|
: m_arrayOpts( aArrayOpts )
|
||||||
{
|
{
|
||||||
// start by numbering the first new item
|
// 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
|
// reserve the name of each existing pad
|
||||||
for( PAD* pad : aFootprint->Pads() )
|
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<wxString>& aExisting )
|
wxString ARRAY_PAD_NUMBER_PROVIDER::getNextNumber( int& aIndex,
|
||||||
|
const std::set<wxString>& aExisting )
|
||||||
{
|
{
|
||||||
wxString next_name;
|
wxString next_number;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
next_name = m_arrayOpts.GetItemNumber( aIndex );
|
next_number = m_arrayOpts.GetItemNumber( aIndex );
|
||||||
aIndex++;
|
aIndex++;
|
||||||
} while( aExisting.count( next_name ) != 0 );
|
} while( aExisting.count( next_number ) != 0 );
|
||||||
|
|
||||||
return next_name;
|
return next_number;
|
||||||
}
|
}
|
|
@ -29,35 +29,34 @@
|
||||||
#include <footprint.h>
|
#include <footprint.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple class that sequentially provides names from an #ARRAY_OPTIONS
|
* Simple class that sequentially provides numbers from an #ARRAY_OPTIONS object, making sure
|
||||||
* object, making sure that they do not conflict with names already existing
|
* that they do not conflict with numbers already existing in a #FOOTPRINT.
|
||||||
* in a #FOOTPRINT.
|
|
||||||
*/
|
*/
|
||||||
class ARRAY_PAD_NAME_PROVIDER
|
class ARRAY_PAD_NUMBER_PROVIDER
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @param aFootprint the footprint to gather existing names from (nullptr for no footprint)
|
* @param aFootprint the footprint to gather existing numbers from (nullptr for no footprint)
|
||||||
* @oaram aArrayOpts the array options that provide the candidate names
|
* @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.
|
* Get the next available pad name.
|
||||||
*/
|
*/
|
||||||
wxString GetNextPadName();
|
wxString GetNextPadNumber();
|
||||||
|
|
||||||
private:
|
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 aIndex index to start at, will be updated
|
||||||
* @param aExisting the set of existing names to skip
|
* @param aExisting the set of existing numbers to skip
|
||||||
* @return the first name found that's not in aExisting
|
* @return the first number found that's not in aExisting
|
||||||
*/
|
*/
|
||||||
wxString getNextName( int& aIndex, const std::set<wxString>& aExisting );
|
wxString getNextNumber( int& aIndex, const std::set<wxString>& aExisting );
|
||||||
|
|
||||||
const ARRAY_OPTIONS& m_arrayOpts;
|
const ARRAY_OPTIONS& m_arrayOpts;
|
||||||
std::set<wxString> m_existing_pad_names;
|
std::set<wxString> m_existing_pad_numbers;
|
||||||
int m_current_pad_index;
|
int m_current_pad_index;
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,7 +39,7 @@ void FROM_TO_CACHE::buildEndpointList( )
|
||||||
for( PAD* pad : footprint->Pads() )
|
for( PAD* pad : footprint->Pads() )
|
||||||
{
|
{
|
||||||
FT_ENDPOINT ent;
|
FT_ENDPOINT ent;
|
||||||
ent.name = footprint->GetReference() + "-" + pad->GetName();
|
ent.name = footprint->GetReference() + "-" + pad->GetNumber();
|
||||||
ent.parent = pad;
|
ent.parent = pad;
|
||||||
m_ftEndpoints.push_back( ent );
|
m_ftEndpoints.push_back( ent );
|
||||||
ent.name = footprint->GetReference();
|
ent.name = footprint->GetReference();
|
||||||
|
@ -140,7 +140,7 @@ int FROM_TO_CACHE::cacheFromToPaths( const wxString& aFrom, const wxString& aTo
|
||||||
int count = 0;
|
int count = 0;
|
||||||
auto netName = path.from->GetNetname();
|
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 };
|
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<const PAD*>( pitem );
|
const PAD *pad = static_cast<const PAD*>( pitem );
|
||||||
|
|
||||||
wxString toName = pad->GetParent()->GetReference() + "-" + pad->GetName();
|
wxString toName = pad->GetParent()->GetReference() + "-" + pad->GetNumber();
|
||||||
|
|
||||||
|
|
||||||
for ( const auto& endpoint : m_ftEndpoints )
|
for ( const auto& endpoint : m_ftEndpoints )
|
||||||
|
|
|
@ -159,7 +159,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
||||||
footprint = pcb->FindFootprintByReference( modName );
|
footprint = pcb->FindFootprintByReference( modName );
|
||||||
|
|
||||||
if( footprint )
|
if( footprint )
|
||||||
pad = footprint->FindPadByName( pinName );
|
pad = footprint->FindPadByNumber( pinName );
|
||||||
|
|
||||||
if( pad )
|
if( pad )
|
||||||
netcode = pad->GetNetCode();
|
netcode = pad->GetNetCode();
|
||||||
|
@ -434,7 +434,7 @@ std::string FormatProbeItem( BOARD_ITEM* aItem )
|
||||||
case PCB_PAD_T:
|
case PCB_PAD_T:
|
||||||
{
|
{
|
||||||
footprint = static_cast<FOOTPRINT*>( aItem->GetParent() );
|
footprint = static_cast<FOOTPRINT*>( aItem->GetParent() );
|
||||||
wxString pad = static_cast<PAD*>( aItem )->GetName();
|
wxString pad = static_cast<PAD*>( aItem )->GetNumber();
|
||||||
|
|
||||||
return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"", TO_UTF8( footprint->GetReference() ),
|
return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"", TO_UTF8( footprint->GetReference() ),
|
||||||
TO_UTF8( pad ) );
|
TO_UTF8( pad ) );
|
||||||
|
@ -535,7 +535,7 @@ void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
||||||
|
|
||||||
if( !netname.IsEmpty() )
|
if( !netname.IsEmpty() )
|
||||||
{
|
{
|
||||||
component->AddNet( pad->GetName(), netname, pad->GetPinFunction(),
|
component->AddNet( pad->GetNumber(), netname, pad->GetPinFunction(),
|
||||||
pad->GetPinType() );
|
pad->GetPinType() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -520,8 +520,8 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew,
|
||||||
if( !pad->IsOnCopperLayer() )
|
if( !pad->IsOnCopperLayer() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Pads with no name are never connected to a net
|
// Pads with no numbers are never connected to a net
|
||||||
if( pad->GetName().IsEmpty() )
|
if( pad->GetNumber().IsEmpty() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Search for a similar pad on a copper layer, to reuse net info
|
// 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 )
|
while( true )
|
||||||
{
|
{
|
||||||
pad_model = aExisting->FindPadByName( pad->GetName(), last_pad );
|
pad_model = aExisting->FindPadByNumber( pad->GetNumber(), last_pad );
|
||||||
|
|
||||||
if( !pad_model )
|
if( !pad_model )
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -115,7 +115,7 @@ void PCB_BASE_FRAME::ShowPadPropertiesDialog( PAD* aPad )
|
||||||
PAD_TOOL* padTools = m_toolManager->GetTool<PAD_TOOL>();
|
PAD_TOOL* padTools = m_toolManager->GetTool<PAD_TOOL>();
|
||||||
|
|
||||||
if( padTools )
|
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_FlippedWarningSizer->Show( m_isFlipped );
|
||||||
|
|
||||||
m_PadNumCtrl->SetValue( m_dummyPad->GetName() );
|
m_PadNumCtrl->SetValue( m_dummyPad->GetNumber() );
|
||||||
m_PadNetSelector->SetSelectedNetcode( m_dummyPad->GetNetCode() );
|
m_PadNetSelector->SetSelectedNetcode( m_dummyPad->GetNetCode() );
|
||||||
|
|
||||||
// Display current pad parameters units:
|
// Display current pad parameters units:
|
||||||
|
@ -981,7 +981,7 @@ void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
else if( m_PadNumCtrl->GetValue().IsEmpty() && m_currentPad )
|
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() );
|
m_PadNetSelector->SetSelectedNetcode( m_currentPad->GetNetCode() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1583,7 +1583,7 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
|
||||||
m_currentPad->SetRemoveUnconnected( m_padMaster->GetRemoveUnconnected() );
|
m_currentPad->SetRemoveUnconnected( m_padMaster->GetRemoveUnconnected() );
|
||||||
m_currentPad->SetKeepTopBottom( m_padMaster->GetKeepTopBottom() );
|
m_currentPad->SetKeepTopBottom( m_padMaster->GetKeepTopBottom() );
|
||||||
|
|
||||||
m_currentPad->SetName( m_padMaster->GetName() );
|
m_currentPad->SetNumber( m_padMaster->GetNumber() );
|
||||||
|
|
||||||
int padNetcode = NETINFO_LIST::UNCONNECTED;
|
int padNetcode = NETINFO_LIST::UNCONNECTED;
|
||||||
|
|
||||||
|
@ -1779,7 +1779,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad )
|
||||||
aPad->SetPadToDieLength( 0 );
|
aPad->SetPadToDieLength( 0 );
|
||||||
|
|
||||||
aPad->SetOrientation( m_OrientValue * 10.0 );
|
aPad->SetOrientation( m_OrientValue * 10.0 );
|
||||||
aPad->SetName( m_PadNumCtrl->GetValue() );
|
aPad->SetNumber( m_PadNumCtrl->GetValue() );
|
||||||
aPad->SetNetCode( m_PadNetSelector->GetSelectedNetcode() );
|
aPad->SetNetCode( m_PadNetSelector->GetSelectedNetcode() );
|
||||||
|
|
||||||
int chamfers = 0;
|
int chamfers = 0;
|
||||||
|
@ -1848,7 +1848,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad )
|
||||||
case PAD_ATTRIB::NPTH:
|
case PAD_ATTRIB::NPTH:
|
||||||
// Mechanical purpose only:
|
// Mechanical purpose only:
|
||||||
// no net name, no pad name allowed
|
// no net name, no pad name allowed
|
||||||
aPad->SetName( wxEmptyString );
|
aPad->SetNumber( wxEmptyString );
|
||||||
aPad->SetNetCode( NETINFO_LIST::UNCONNECTED );
|
aPad->SetNetCode( NETINFO_LIST::UNCONNECTED );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -357,7 +357,7 @@ bool DIALOG_TRACK_VIA_PROPERTIES::confirmPadChange( const std::vector<PAD*>& cha
|
||||||
PAD* pad = *changingPads.begin();
|
PAD* pad = *changingPads.begin();
|
||||||
msg.Printf( _( "Changing the net will also update %s pad %s to %s." ),
|
msg.Printf( _( "Changing the net will also update %s pad %s to %s." ),
|
||||||
pad->GetParent()->GetReference(),
|
pad->GetParent()->GetReference(),
|
||||||
pad->GetName(),
|
pad->GetNumber(),
|
||||||
m_netSelector->GetValue() );
|
m_netSelector->GetValue() );
|
||||||
}
|
}
|
||||||
else if( changingPads.size() == 2 )
|
else if( changingPads.size() == 2 )
|
||||||
|
@ -366,9 +366,9 @@ bool DIALOG_TRACK_VIA_PROPERTIES::confirmPadChange( const std::vector<PAD*>& cha
|
||||||
PAD* pad2 = *( ++changingPads.begin() );
|
PAD* pad2 = *( ++changingPads.begin() );
|
||||||
msg.Printf( _( "Changing the net will also update %s pad %s and %s pad %s to %s." ),
|
msg.Printf( _( "Changing the net will also update %s pad %s and %s pad %s to %s." ),
|
||||||
pad1->GetParent()->GetReference(),
|
pad1->GetParent()->GetReference(),
|
||||||
pad1->GetName(),
|
pad1->GetNumber(),
|
||||||
pad2->GetParent()->GetReference(),
|
pad2->GetParent()->GetReference(),
|
||||||
pad2->GetName(),
|
pad2->GetNumber(),
|
||||||
m_netSelector->GetValue() );
|
m_netSelector->GetValue() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -132,7 +132,10 @@ void DRC_TEST_PROVIDER_LVS::testFootprints( NETLIST& aNetlist )
|
||||||
if( m_drcEngine->IsErrorLimitExceeded( DRCE_NET_CONFLICT ) )
|
if( m_drcEngine->IsErrorLimitExceeded( DRCE_NET_CONFLICT ) )
|
||||||
break;
|
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();
|
const wxString& pcb_netname = pad->GetNetname();
|
||||||
|
|
||||||
if( !pcb_netname.IsEmpty() && sch_net.GetPinName().IsEmpty() )
|
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 );
|
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." ),
|
m_msg.Printf( _( "No pad found for pin %s in schematic." ),
|
||||||
sch_net.GetPinName() );
|
sch_net.GetPinName() );
|
||||||
|
|
|
@ -108,7 +108,7 @@ static void build_pad_testpoints( BOARD *aPcb, std::vector <D356_RECORD>& aRecor
|
||||||
if( rk.access != -1 )
|
if( rk.access != -1 )
|
||||||
{
|
{
|
||||||
rk.netname = pad->GetNetname();
|
rk.netname = pad->GetNetname();
|
||||||
rk.pin = pad->GetName();
|
rk.pin = pad->GetNumber();
|
||||||
rk.refdes = footprint->GetReference();
|
rk.refdes = footprint->GetReference();
|
||||||
rk.midpoint = false; // XXX MAYBE need to be computed (how?)
|
rk.midpoint = false; // XXX MAYBE need to be computed (how?)
|
||||||
const wxSize& drill = pad->GetDrillSize();
|
const wxSize& drill = pad->GetDrillSize();
|
||||||
|
|
|
@ -375,12 +375,12 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
|
||||||
std::sort( sortedPads.begin(), sortedPads.end(),
|
std::sort( sortedPads.begin(), sortedPads.end(),
|
||||||
[]( PAD* a, PAD* b ) -> bool
|
[]( 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 )
|
for( PAD* pad : sortedPads )
|
||||||
{
|
{
|
||||||
sprintf( line, "$PAD \"%s\"\n", TO_UTF8( pad->GetName() ) );
|
sprintf( line, "$PAD \"%s\"\n", TO_UTF8( pad->GetNumber() ) );
|
||||||
buffer += line;
|
buffer += line;
|
||||||
|
|
||||||
int layer = 0;
|
int layer = 0;
|
||||||
|
|
|
@ -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.
|
* all pads need to be marked as TOP to use the padstack information correctly.
|
||||||
*/
|
*/
|
||||||
layer = "TOP";
|
layer = "TOP";
|
||||||
pinname = pad->GetName();
|
pinname = pad->GetNumber();
|
||||||
|
|
||||||
if( pinname.IsEmpty() )
|
if( pinname.IsEmpty() )
|
||||||
pinname = wxT( "none" );
|
pinname = wxT( "none" );
|
||||||
|
@ -944,7 +944,7 @@ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb )
|
||||||
|
|
||||||
msg.Printf( wxT( "NODE \"%s\" \"%s\"" ),
|
msg.Printf( wxT( "NODE \"%s\" \"%s\"" ),
|
||||||
escapeString( footprint->GetReference() ),
|
escapeString( footprint->GetReference() ),
|
||||||
escapeString( pad->GetName() ) );
|
escapeString( pad->GetNumber() ) );
|
||||||
|
|
||||||
fputs( TO_UTF8( msg ), aFile );
|
fputs( TO_UTF8( msg ), aFile );
|
||||||
fputs( "\n", aFile );
|
fputs( "\n", aFile );
|
||||||
|
|
|
@ -448,7 +448,7 @@ bool HYPERLYNX_EXPORTER::writeNetObjects( const std::vector<BOARD_ITEM*>& aObjec
|
||||||
if( ref.IsEmpty() )
|
if( ref.IsEmpty() )
|
||||||
ref = "EMPTY";
|
ref = "EMPTY";
|
||||||
|
|
||||||
wxString padName = pad->GetName();
|
wxString padName = pad->GetNumber();
|
||||||
|
|
||||||
if( padName.IsEmpty() )
|
if( padName.IsEmpty() )
|
||||||
padName = "1";
|
padName = "1";
|
||||||
|
|
|
@ -337,7 +337,7 @@ static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD
|
||||||
kplate = IDF3::PTH;
|
kplate = IDF3::PTH;
|
||||||
|
|
||||||
// hole type
|
// hole type
|
||||||
tstr = TO_UTF8( pad->GetName() );
|
tstr = TO_UTF8( pad->GetNumber() );
|
||||||
|
|
||||||
if( tstr.empty() || !tstr.compare( "0" ) || !tstr.compare( "~" )
|
if( tstr.empty() || !tstr.compare( "0" ) || !tstr.compare( "~" )
|
||||||
|| ( kplate == IDF3::NPTH )
|
|| ( kplate == IDF3::NPTH )
|
||||||
|
|
|
@ -235,7 +235,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
|
||||||
gbr_metadata.SetApertureAttrib(
|
gbr_metadata.SetApertureAttrib(
|
||||||
GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_PAD1_POSITION );
|
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 );
|
gbr_metadata.SetPadPinFunction( pad1->GetPinFunction(), allowUtf8, true );
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
|
||||||
if( !pad->IsOnLayer( aLayer ) )
|
if( !pad->IsOnLayer( aLayer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
gbr_metadata.SetPadName( pad->GetName(), allowUtf8, true );
|
gbr_metadata.SetPadName( pad->GetNumber(), allowUtf8, true );
|
||||||
|
|
||||||
gbr_metadata.SetPadPinFunction( pad->GetPinFunction(), allowUtf8, true );
|
gbr_metadata.SetPadPinFunction( pad->GetPinFunction(), allowUtf8, true );
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ void PLACEFILE_GERBER_WRITER::findPads1( std::vector<PAD*>& aPadList, FOOTPRINT*
|
||||||
if( !pad->IsOnLayer( m_layer ) )
|
if( !pad->IsOnLayer( m_layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( pad->GetName() == "1" || pad->GetName() == "A1")
|
if( pad->GetNumber() == "1" || pad->GetNumber() == "A1")
|
||||||
aPadList.push_back( pad );
|
aPadList.push_back( pad );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
bool can_select = aSearchAfterMe ? false : true;
|
||||||
|
|
||||||
|
@ -1021,7 +1021,7 @@ PAD* FOOTPRINT::FindPadByName( const wxString& aPadName, PAD* aSearchAfterMe ) c
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( can_select && pad->GetName() == aPadName )
|
if( can_select && pad->GetNumber() == aPadNumber )
|
||||||
return pad;
|
return pad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1085,7 +1085,7 @@ unsigned FOOTPRINT::GetPadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
|
||||||
|
|
||||||
unsigned FOOTPRINT::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
|
unsigned FOOTPRINT::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
|
||||||
{
|
{
|
||||||
std::set<wxString> usedNames;
|
std::set<wxString> usedNumbers;
|
||||||
|
|
||||||
// Create a set of used pad numbers
|
// Create a set of used pad numbers
|
||||||
for( PAD* pad : m_pads )
|
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"
|
// Skip pads with no name, because they are usually "mechanical"
|
||||||
// pads, not "electrical" pads
|
// pads, not "electrical" pads
|
||||||
if( pad->GetName().IsEmpty() )
|
if( pad->GetNumber().IsEmpty() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( !aIncludeNPTH )
|
if( !aIncludeNPTH )
|
||||||
{
|
{
|
||||||
// skip NPTH
|
// skip NPTH
|
||||||
if( pad->GetAttribute() == PAD_ATTRIB::NPTH )
|
if( pad->GetAttribute() == PAD_ATTRIB::NPTH )
|
||||||
{
|
|
||||||
continue;
|
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<wxString> usedNames;
|
std::set<wxString> usedNumbers;
|
||||||
|
|
||||||
// Create a set of used pad numbers
|
// Create a set of used pad numbers
|
||||||
for( PAD* pad : m_pads )
|
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.
|
// for these to give us what we need.
|
||||||
wxString prefix = UTIL::GetRefDesPrefix( aLastPadName );
|
wxString prefix = UTIL::GetRefDesPrefix( aLastPadNumber );
|
||||||
int num = GetTrailingInt( aLastPadName );
|
int num = GetTrailingInt( aLastPadNumber );
|
||||||
|
|
||||||
while( usedNames.count( wxString::Format( "%s%d", prefix, num ) ) )
|
while( usedNumbers.count( wxString::Format( "%s%d", prefix, num ) ) )
|
||||||
num++;
|
num++;
|
||||||
|
|
||||||
return wxString::Format( "%s%d", prefix, 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
|
bool FOOTPRINT::cmp_pads::operator()( const PAD* aFirst, const PAD* aSecond ) const
|
||||||
{
|
{
|
||||||
if( aFirst->GetName() != aSecond->GetName() )
|
if( aFirst->GetNumber() != aSecond->GetNumber() )
|
||||||
return StrNumCmp( aFirst->GetName(), aSecond->GetName() ) < 0;
|
return StrNumCmp( aFirst->GetNumber(), aSecond->GetNumber() ) < 0;
|
||||||
|
|
||||||
if( aFirst->m_Uuid != aSecond->m_Uuid ) // shopuld be always the case foer valid boards
|
if( aFirst->m_Uuid != aSecond->m_Uuid ) // shopuld be always the case foer valid boards
|
||||||
return aFirst->m_Uuid < aSecond->m_Uuid;
|
return aFirst->m_Uuid < aSecond->m_Uuid;
|
||||||
|
|
|
@ -480,15 +480,15 @@ public:
|
||||||
void SetProperty( const wxString& aKey, const wxString& aVal ) { m_properties[ aKey ] = aVal; }
|
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
|
* @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.
|
* 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;
|
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,
|
* @param aFillSequenceGaps true if the numbering should "fill in" gaps in the sequence,
|
||||||
* else return the highest value + 1
|
* 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;
|
double GetArea( int aPadding = 0 ) const;
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ FOOTPRINT* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprint
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MICROWAVE_FOOTPRINT_SHAPE::STUB: //Stub :
|
case MICROWAVE_FOOTPRINT_SHAPE::STUB: //Stub :
|
||||||
pad->SetName( wxT( "1" ) );
|
pad->SetNumber( wxT( "1" ) );
|
||||||
pad = *( it + 1 );
|
pad = *( it + 1 );
|
||||||
pad->SetY0( -( gap_size + pad->GetSize().y ) / 2 );
|
pad->SetY0( -( gap_size + pad->GetSize().y ) / 2 );
|
||||||
pad->SetSize( wxSize( pad->GetSize().x, gap_size ) );
|
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
|
// Create 2 pads used in gaps and stubs. The gap is between these 2 pads
|
||||||
// the stub is the pad 2
|
// the stub is the pad 2
|
||||||
wxString Line;
|
|
||||||
int pad_num = 1;
|
int pad_num = 1;
|
||||||
|
|
||||||
while( aPadCount-- )
|
while( aPadCount-- )
|
||||||
|
@ -217,8 +216,7 @@ FOOTPRINT* MICROWAVE_TOOL::createBaseFootprint( const wxString& aValue,
|
||||||
pad->SetAttribute( PAD_ATTRIB::SMD );
|
pad->SetAttribute( PAD_ATTRIB::SMD );
|
||||||
pad->SetLayerSet( F_Cu );
|
pad->SetLayerSet( F_Cu );
|
||||||
|
|
||||||
Line.Printf( wxT( "%d" ), pad_num );
|
pad->SetNumber( wxString::Format( wxT( "%d" ), pad_num ) );
|
||||||
pad->SetName( Line );
|
|
||||||
pad_num++;
|
pad_num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -441,7 +441,7 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN&
|
||||||
|
|
||||||
footprint->Add( pad );
|
footprint->Add( pad );
|
||||||
|
|
||||||
pad->SetName( "1" );
|
pad->SetNumber( "1" );
|
||||||
pad->SetPosition( aInductorPattern.m_End );
|
pad->SetPosition( aInductorPattern.m_End );
|
||||||
pad->SetPos0( pad->GetPosition() - footprint->GetPosition() );
|
pad->SetPos0( pad->GetPosition() - footprint->GetPosition() );
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN&
|
||||||
footprint->Add( newpad );
|
footprint->Add( newpad );
|
||||||
|
|
||||||
pad = newpad;
|
pad = newpad;
|
||||||
pad->SetName( "2" );
|
pad->SetNumber( "2" );
|
||||||
pad->SetPosition( aInductorPattern.m_Start );
|
pad->SetPosition( aInductorPattern.m_Start );
|
||||||
pad->SetPos0( pad->GetPosition() - footprint->GetPosition() );
|
pad->SetPos0( pad->GetPosition() - footprint->GetPosition() );
|
||||||
|
|
||||||
|
|
|
@ -412,7 +412,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( FOOTPRINT* aFootprint
|
||||||
// At this point, the component footprint is updated. Now update the nets.
|
// At this point, the component footprint is updated. Now update the nets.
|
||||||
for( PAD* pad : aFootprint->Pads() )
|
for( PAD* pad : aFootprint->Pads() )
|
||||||
{
|
{
|
||||||
const COMPONENT_NET& net = aNewComponent->GetNet( pad->GetName() );
|
const COMPONENT_NET& net = aNewComponent->GetNet( pad->GetNumber() );
|
||||||
|
|
||||||
wxString pinFunction;
|
wxString pinFunction;
|
||||||
wxString pinType;
|
wxString pinType;
|
||||||
|
@ -451,23 +451,23 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( FOOTPRINT* aFootprint
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Disconnect %s pin %s." ),
|
msg.Printf( _( "Disconnect %s pin %s." ),
|
||||||
aFootprint->GetReference(),
|
aFootprint->GetReference(),
|
||||||
pad->GetName() );
|
pad->GetNumber() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Disconnected %s pin %s." ),
|
msg.Printf( _( "Disconnected %s pin %s." ),
|
||||||
aFootprint->GetReference(),
|
aFootprint->GetReference(),
|
||||||
pad->GetName() );
|
pad->GetNumber() );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_reporter->Report( msg, RPT_SEVERITY_ACTION );
|
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
|
// pad is connectable but has no net found in netlist
|
||||||
msg.Printf( _( "No net found for symbol %s pin %s." ),
|
msg.Printf( _( "No net found for symbol %s pin %s." ),
|
||||||
aFootprint->GetReference(),
|
aFootprint->GetReference(),
|
||||||
pad->GetName() );
|
pad->GetNumber() );
|
||||||
m_reporter->Report( msg, RPT_SEVERITY_WARNING);
|
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."),
|
msg.Printf( _( "Reconnect %s pin %s from %s to %s."),
|
||||||
aFootprint->GetReference(),
|
aFootprint->GetReference(),
|
||||||
pad->GetName(),
|
pad->GetNumber(),
|
||||||
UnescapeString( pad->GetNetname() ),
|
UnescapeString( pad->GetNetname() ),
|
||||||
UnescapeString( netName ) );
|
UnescapeString( netName ) );
|
||||||
}
|
}
|
||||||
|
@ -537,7 +537,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( FOOTPRINT* aFootprint
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Reconnected %s pin %s from %s to %s."),
|
msg.Printf( _( "Reconnected %s pin %s from %s to %s."),
|
||||||
aFootprint->GetReference(),
|
aFootprint->GetReference(),
|
||||||
pad->GetName(),
|
pad->GetNumber(),
|
||||||
UnescapeString( pad->GetNetname() ),
|
UnescapeString( pad->GetNetname() ),
|
||||||
UnescapeString( netName ) );
|
UnescapeString( netName ) );
|
||||||
}
|
}
|
||||||
|
@ -548,15 +548,14 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( FOOTPRINT* aFootprint
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Connect %s pin %s to %s."),
|
msg.Printf( _( "Connect %s pin %s to %s."),
|
||||||
aFootprint->GetReference(),
|
aFootprint->GetReference(),
|
||||||
pad->GetName(),
|
pad->GetNumber(),
|
||||||
UnescapeString( netName ) );
|
UnescapeString( netName ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Connected %s pin %s to %s."),
|
msg.Printf( _( "Connected %s pin %s to %s."),
|
||||||
|
|
||||||
aFootprint->GetReference(),
|
aFootprint->GetReference(),
|
||||||
pad->GetName(),
|
pad->GetNumber(),
|
||||||
UnescapeString( netName ) );
|
UnescapeString( netName ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -873,7 +872,7 @@ bool BOARD_NETLIST_UPDATER::testConnectivity( NETLIST& aNetlist,
|
||||||
// wrong or missing.
|
// wrong or missing.
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxString padname;
|
wxString padNumber;
|
||||||
|
|
||||||
for( int i = 0; i < (int) aNetlist.GetCount(); i++ )
|
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
|
// Explore all pins/pads in component
|
||||||
for( unsigned jj = 0; jj < component->GetNetCount(); jj++ )
|
for( unsigned jj = 0; jj < component->GetNetCount(); jj++ )
|
||||||
{
|
{
|
||||||
const COMPONENT_NET& net = component->GetNet( jj );
|
padNumber = component->GetNet( jj ).GetPinName();
|
||||||
padname = net.GetPinName();
|
|
||||||
|
|
||||||
if( footprint->FindPadByName( padname ) )
|
if( footprint->FindPadByNumber( padNumber ) )
|
||||||
continue; // OK, pad found
|
continue; // OK, pad found
|
||||||
|
|
||||||
// not found: bad footprint, report error
|
// not found: bad footprint, report error
|
||||||
msg.Printf( _( "%s pad %s not found in %s." ),
|
msg.Printf( _( "%s pad %s not found in %s." ),
|
||||||
component->GetReference(),
|
component->GetReference(),
|
||||||
padname,
|
padNumber,
|
||||||
footprint->GetFPID().Format().wx_str() );
|
footprint->GetFPID().Format().wx_str() );
|
||||||
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
|
m_reporter->Report( msg, RPT_SEVERITY_ERROR );
|
||||||
++m_errorCount;
|
++m_errorCount;
|
||||||
|
|
|
@ -113,7 +113,7 @@ PAD::PAD( const PAD& aOther ) :
|
||||||
SetPadToDieLength( aOther.GetPadToDieLength() );
|
SetPadToDieLength( aOther.GetPadToDieLength() );
|
||||||
SetPosition( aOther.GetPosition() );
|
SetPosition( aOther.GetPosition() );
|
||||||
SetPos0( aOther.GetPos0() );
|
SetPos0( aOther.GetPos0() );
|
||||||
SetName( aOther.GetName() );
|
SetNumber( aOther.GetNumber() );
|
||||||
SetPinFunction( aOther.GetPinFunction() );
|
SetPinFunction( aOther.GetPinFunction() );
|
||||||
SetSubRatsnest( aOther.GetSubRatsnest() );
|
SetSubRatsnest( aOther.GetSubRatsnest() );
|
||||||
m_effectiveBoundingRadius = aOther.m_effectiveBoundingRadius;
|
m_effectiveBoundingRadius = aOther.m_effectiveBoundingRadius;
|
||||||
|
@ -131,7 +131,7 @@ PAD& PAD::operator=( const PAD &aOther )
|
||||||
SetPadToDieLength( aOther.GetPadToDieLength() );
|
SetPadToDieLength( aOther.GetPadToDieLength() );
|
||||||
SetPosition( aOther.GetPosition() );
|
SetPosition( aOther.GetPosition() );
|
||||||
SetPos0( aOther.GetPos0() );
|
SetPos0( aOther.GetPos0() );
|
||||||
SetName( aOther.GetName() );
|
SetNumber( aOther.GetNumber() );
|
||||||
SetPinFunction( aOther.GetPinFunction() );
|
SetPinFunction( aOther.GetPinFunction() );
|
||||||
SetSubRatsnest( aOther.GetSubRatsnest() );
|
SetSubRatsnest( aOther.GetSubRatsnest() );
|
||||||
m_effectiveBoundingRadius = aOther.m_effectiveBoundingRadius;
|
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
|
bool PAD::IsLocked() const
|
||||||
{
|
{
|
||||||
if( GetParent() && static_cast<FOOTPRINT*>( GetParent() )->IsLocked() )
|
if( GetParent() && static_cast<FOOTPRINT*>( GetParent() )->IsLocked() )
|
||||||
|
@ -857,7 +871,7 @@ void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
|
||||||
if( parentFootprint )
|
if( parentFootprint )
|
||||||
aList.emplace_back( _( "Footprint" ), parentFootprint->GetReference() );
|
aList.emplace_back( _( "Footprint" ), parentFootprint->GetReference() );
|
||||||
|
|
||||||
aList.emplace_back( _( "Pad" ), m_name );
|
aList.emplace_back( _( "Pad" ), m_number );
|
||||||
|
|
||||||
if( !GetPinFunction().IsEmpty() )
|
if( !GetPinFunction().IsEmpty() )
|
||||||
aList.emplace_back( _( "Pin Name" ), GetPinFunction() );
|
aList.emplace_back( _( "Pin Name" ), GetPinFunction() );
|
||||||
|
@ -1106,7 +1120,7 @@ wxString PAD::ShowPadAttr() const
|
||||||
|
|
||||||
wxString PAD::GetSelectMenuText( EDA_UNITS aUnits ) const
|
wxString PAD::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||||
{
|
{
|
||||||
if( GetName().IsEmpty() )
|
if( GetNumber().IsEmpty() )
|
||||||
{
|
{
|
||||||
if( GetAttribute() == PAD_ATTRIB::SMD || GetAttribute() == PAD_ATTRIB::CONN )
|
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 )
|
if( GetAttribute() == PAD_ATTRIB::SMD || GetAttribute() == PAD_ATTRIB::CONN )
|
||||||
{
|
{
|
||||||
return wxString::Format( _( "Pad %s of %s on %s" ),
|
return wxString::Format( _( "Pad %s of %s on %s" ),
|
||||||
GetName(),
|
GetNumber(),
|
||||||
GetParent()->GetReference(),
|
GetParent()->GetReference(),
|
||||||
layerMaskDescribe() );
|
layerMaskDescribe() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return wxString::Format( _( "Through hole pad %s of %s" ),
|
return wxString::Format( _( "Through hole pad %s of %s" ),
|
||||||
GetName(),
|
GetNumber(),
|
||||||
GetParent()->GetReference() );
|
GetParent()->GetReference() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1221,7 +1235,7 @@ void PAD::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( wxT( "footprint %s, pad %s: could not find valid layer for pad" ),
|
msg.Printf( wxT( "footprint %s, pad %s: could not find valid layer for pad" ),
|
||||||
GetParent() ? GetParent()->GetReference() : "<null>",
|
GetParent() ? GetParent()->GetReference() : "<null>",
|
||||||
GetName().IsEmpty() ? "(unnamed)" : GetName() );
|
GetNumber().IsEmpty() ? "(unnumbered)" : GetNumber() );
|
||||||
wxLogWarning( msg );
|
wxLogWarning( msg );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1476,7 +1490,7 @@ static struct PAD_DESC
|
||||||
propMgr.AddProperty( shape );
|
propMgr.AddProperty( shape );
|
||||||
|
|
||||||
propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Pad Number" ),
|
propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Pad Number" ),
|
||||||
&PAD::SetName, &PAD::GetName ) );
|
&PAD::SetNumber, &PAD::GetNumber ) );
|
||||||
propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Pin Name" ),
|
propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Pin Name" ),
|
||||||
&PAD::SetPinFunction, &PAD::GetPinFunction ) );
|
&PAD::SetPinFunction, &PAD::GetPinFunction ) );
|
||||||
propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Pin Type" ),
|
propMgr.AddProperty( new PROPERTY<PAD, wxString>( _HKI( "Pin Type" ),
|
||||||
|
|
16
pcbnew/pad.h
16
pcbnew/pad.h
|
@ -123,11 +123,15 @@ public:
|
||||||
bool IsFlipped() const;
|
bool IsFlipped() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the pad name (sometimes called pad number, although it can be an array reference
|
* Set the pad number (note that it can be alphanumeric, such as the array reference "AA12").
|
||||||
* like AA12).
|
|
||||||
*/
|
*/
|
||||||
void SetName( const wxString& aName ) { m_name = aName; }
|
void SetNumber( const wxString& aNumber ) { m_number = aNumber; }
|
||||||
const wxString& GetName() const { return m_name; }
|
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)
|
* Set the pad function (pin name in schematic)
|
||||||
|
@ -148,7 +152,7 @@ public:
|
||||||
bool SameLogicalPadAs( const PAD* other ) const
|
bool SameLogicalPadAs( const PAD* other ) const
|
||||||
{
|
{
|
||||||
// hide tricks behind sensible API
|
// 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;
|
ERROR_LOC aErrorLoc ) const;
|
||||||
|
|
||||||
private:
|
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_pinFunction; // Pin name in schematic
|
||||||
wxString m_pinType; // Pin electrical type in schematic
|
wxString m_pinType; // Pin electrical type in schematic
|
||||||
|
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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 <pad.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
|
@ -989,9 +989,9 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
|
||||||
|
|
||||||
if( m_pcbSettings.m_padNumbers )
|
if( m_pcbSettings.m_padNumbers )
|
||||||
{
|
{
|
||||||
const wxString& padName = aPad->GetName();
|
const wxString& padNumber = aPad->GetNumber();
|
||||||
textpos.y = -textpos.y;
|
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 );
|
tsize = std::min( tsize, size );
|
||||||
|
|
||||||
// Use a smaller text size to handle interline, pen 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->SetGlyphSize( numsize );
|
||||||
m_gal->SetLineWidth( numsize.x / 12.0 );
|
m_gal->SetLineWidth( numsize.x / 12.0 );
|
||||||
m_gal->BitmapText( padName, textpos, 0.0 );
|
m_gal->BitmapText( padNumber, textpos, 0.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_gal->Restore();
|
m_gal->Restore();
|
||||||
|
|
|
@ -106,9 +106,9 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, const COLOR4D& aColor, OUTLINE_
|
||||||
|
|
||||||
const bool useUTF8 = false;
|
const bool useUTF8 = false;
|
||||||
const bool useQuoting = 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.SetPadPinFunction( aPad->GetPinFunction(), useUTF8, useQuoting );
|
||||||
|
|
||||||
gbr_metadata.SetNetName( aPad->GetNetname() );
|
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 )
|
// Some pads are mechanical pads ( through hole or smd )
|
||||||
// when this is the case, they have no pad name and/or are not plated.
|
// when this is the case, they have no pad name and/or are not plated.
|
||||||
// In this case gerber files have slightly different attributes.
|
// 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;
|
gbr_metadata.m_NetlistMetadata.m_NotInNet = true;
|
||||||
|
|
||||||
if( !plotOnExternalCopperLayer )
|
if( !plotOnExternalCopperLayer )
|
||||||
|
|
|
@ -2103,7 +2103,7 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader,
|
||||||
PAD* pad = new PAD( footprint );
|
PAD* pad = new PAD( footprint );
|
||||||
footprint->Add( pad, ADD_MODE::APPEND );
|
footprint->Add( pad, ADD_MODE::APPEND );
|
||||||
|
|
||||||
pad->SetName( elem.name );
|
pad->SetNumber( elem.name );
|
||||||
pad->SetNetCode( GetNetCode( elem.net ) );
|
pad->SetNetCode( GetNetCode( elem.net ) );
|
||||||
pad->SetLocked( elem.is_locked );
|
pad->SetLocked( elem.is_locked );
|
||||||
|
|
||||||
|
|
|
@ -733,7 +733,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers( const SYMDEF_PCB& aComponen
|
||||||
PAD* pad = new PAD( aFootprint );
|
PAD* pad = new PAD( aFootprint );
|
||||||
pad->SetAttribute( PAD_ATTRIB::SMD );
|
pad->SetAttribute( PAD_ATTRIB::SMD );
|
||||||
pad->SetLayerSet( LSET( 1, copperLayer ) );
|
pad->SetLayerSet( LSET( 1, copperLayer ) );
|
||||||
pad->SetName( anchorPad.Identifier.IsEmpty()
|
pad->SetNumber( anchorPad.Identifier.IsEmpty()
|
||||||
? wxString::Format( wxT( "%ld" ), anchorPad.ID )
|
? wxString::Format( wxT( "%ld" ), anchorPad.ID )
|
||||||
: anchorPad.Identifier );
|
: anchorPad.Identifier );
|
||||||
|
|
||||||
|
@ -774,7 +774,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers( const SYMDEF_PCB& aComponen
|
||||||
if( associatedPad.PCBonlyPad )
|
if( associatedPad.PCBonlyPad )
|
||||||
{
|
{
|
||||||
PAD* assocPad = getPadReference( aFootprint, padID );
|
PAD* assocPad = getPadReference( aFootprint, padID );
|
||||||
assocPad->SetName( pad->GetName() );
|
assocPad->SetNumber( pad->GetNumber() );
|
||||||
++numRenames;
|
++numRenames;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -938,8 +938,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
|
||||||
|
|
||||||
pad->SetLayerSet( padLayerSet );
|
pad->SetLayerSet( padLayerSet );
|
||||||
|
|
||||||
|
pad->SetNumber( aCadstarPad.Identifier.IsEmpty() ?
|
||||||
pad->SetName( aCadstarPad.Identifier.IsEmpty() ?
|
|
||||||
wxString::Format( wxT( "%ld" ), aCadstarPad.ID ) :
|
wxString::Format( wxT( "%ld" ), aCadstarPad.ID ) :
|
||||||
aCadstarPad.Identifier );
|
aCadstarPad.Identifier );
|
||||||
|
|
||||||
|
@ -1605,7 +1604,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadComponents()
|
||||||
if( pinName.empty() )
|
if( pinName.empty() )
|
||||||
pinName = wxString::Format( wxT( "%ld" ), pin.ID );
|
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
|
// Find the pad in the footprint definition
|
||||||
PAD* kiPad = getPadReference( footprint, padEx.ID );
|
PAD* kiPad = getPadReference( footprint, padEx.ID );
|
||||||
wxString padName = kiPad->GetName();
|
wxString padNumber = kiPad->GetNumber();
|
||||||
|
|
||||||
if( kiPad )
|
if( kiPad )
|
||||||
delete kiPad;
|
delete kiPad;
|
||||||
|
|
||||||
kiPad = getKiCadPad( csPad, footprint );
|
kiPad = getKiCadPad( csPad, footprint );
|
||||||
kiPad->SetName( padName );
|
kiPad->SetNumber( padNumber );
|
||||||
|
|
||||||
// Change the pointer in the footprint to the newly created pad
|
// Change the pointer in the footprint to the newly created pad
|
||||||
getPadReference( footprint, padEx.ID ) = kiPad;
|
getPadReference( footprint, padEx.ID ) = kiPad;
|
||||||
|
|
|
@ -1139,7 +1139,7 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements )
|
||||||
// update the nets within the pads of the clone
|
// update the nets within the pads of the clone
|
||||||
for( PAD* pad : footprint->Pads() )
|
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 );
|
NET_MAP_CITER ni = m_pads_to_nets.find( pn_key );
|
||||||
if( ni != m_pads_to_nets.end() )
|
if( ni != m_pads_to_nets.end() )
|
||||||
|
@ -2247,7 +2247,7 @@ void EAGLE_PLUGIN::packageHole( FOOTPRINT* aFootprint, wxXmlNode* aTree, bool aC
|
||||||
// Mechanical purpose only:
|
// Mechanical purpose only:
|
||||||
// no offset, no net name, no pad name allowed
|
// no offset, no net name, no pad name allowed
|
||||||
// pad->SetOffset( wxPoint( 0, 0 ) );
|
// pad->SetOffset( wxPoint( 0, 0 ) );
|
||||||
// pad->SetName( wxEmptyString );
|
// pad->SetNumber( wxEmptyString );
|
||||||
|
|
||||||
wxPoint padpos( kicad_x( e.x ), kicad_y( e.y ) );
|
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
|
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,
|
// pad's "Position" is not relative to the footprint's,
|
||||||
// whereas Pos0 is relative to the footprint's but is the unrotated coordinate.
|
// whereas Pos0 is relative to the footprint's but is the unrotated coordinate.
|
||||||
|
|
|
@ -2240,7 +2240,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
||||||
else
|
else
|
||||||
newpad->SetY( pin->pin_y );
|
newpad->SetY( pin->pin_y );
|
||||||
|
|
||||||
newpad->SetName( pin->pin_number );
|
newpad->SetNumber( pin->pin_number );
|
||||||
|
|
||||||
if( padstack == pads.end() )
|
if( padstack == pads.end() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -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
|
// and set to the pin name of the netlist on instantiation. Many gEDA
|
||||||
// bare footprints use identical strings for name and number, so this
|
// bare footprints use identical strings for name and number, so this
|
||||||
// can be a bit confusing.
|
// can be a bit confusing.
|
||||||
pad->SetName( parameters[paramCnt-3] );
|
pad->SetNumber( parameters[paramCnt-3] );
|
||||||
|
|
||||||
int x1 = parseInt( parameters[2], conv_unit );
|
int x1 = parseInt( parameters[2], conv_unit );
|
||||||
int x2 = parseInt( parameters[4], 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.
|
// Pcbnew pad name is used for electrical connection calculations.
|
||||||
// Accordingly it should be mapped to gEDA's pin/pad number,
|
// Accordingly it should be mapped to gEDA's pin/pad number,
|
||||||
// which is used for the same purpose.
|
// which is used for the same purpose.
|
||||||
pad->SetName( parameters[paramCnt-3] );
|
pad->SetNumber( parameters[paramCnt-3] );
|
||||||
|
|
||||||
wxPoint padPos( parseInt( parameters[2], conv_unit ),
|
wxPoint padPos( parseInt( parameters[2], conv_unit ),
|
||||||
parseInt( parameters[3], conv_unit ) );
|
parseInt( parameters[3], conv_unit ) );
|
||||||
|
|
|
@ -1415,7 +1415,7 @@ void PCB_IO::format( const PAD* aPad, int aNestLevel ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
m_out->Print( aNestLevel, "(pad %s %s %s",
|
m_out->Print( aNestLevel, "(pad %s %s %s",
|
||||||
m_out->Quotew( aPad->GetName() ).c_str(),
|
m_out->Quotew( aPad->GetNumber() ).c_str(),
|
||||||
type,
|
type,
|
||||||
shape );
|
shape );
|
||||||
|
|
||||||
|
|
|
@ -3927,7 +3927,7 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
|
||||||
pad->SetKeepTopBottom( false );
|
pad->SetKeepTopBottom( false );
|
||||||
|
|
||||||
NeedSYMBOLorNUMBER();
|
NeedSYMBOLorNUMBER();
|
||||||
pad->SetName( FromUTF8() );
|
pad->SetNumber( FromUTF8() );
|
||||||
|
|
||||||
T token = NextTok();
|
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();
|
return pad.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1344,16 +1344,15 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint )
|
||||||
// e.g. "Sh "A2" C 520 520 0 0 900"
|
// e.g. "Sh "A2" C 520 520 0 0 900"
|
||||||
// or "Sh "1" R 157 1378 0 0 900"
|
// or "Sh "1" R 157 1378 0 0 900"
|
||||||
|
|
||||||
// mypadname is LATIN1/CRYLIC for BOARD_FORMAT_VERSION 1,
|
// mypadnumber is LATIN1/CRYLIC for BOARD_FORMAT_VERSION 1, but for
|
||||||
// but for BOARD_FORMAT_VERSION 2, it is UTF8 from disk.
|
// BOARD_FORMAT_VERSION 2, it is UTF8 from disk.
|
||||||
// So we have to go through two code paths. Moving forward
|
// Moving forward padnumbers will be in UTF8 on disk, as are all KiCad strings on disk.
|
||||||
// padnames will be in UTF8 on disk, as are all KiCad strings on disk.
|
char mypadnumber[50];
|
||||||
char mypadname[50];
|
|
||||||
|
|
||||||
data = line + SZ( "Sh" ) + 1; // +1 skips trailing whitespace
|
data = line + SZ( "Sh" ) + 1; // +1 skips trailing whitespace
|
||||||
|
|
||||||
// +1 trailing whitespace.
|
// +1 trailing whitespace.
|
||||||
data = data + ReadDelimitedText( mypadname, data, sizeof(mypadname) ) + 1;
|
data = data + ReadDelimitedText( mypadnumber, data, sizeof( mypadnumber ) ) + 1;
|
||||||
|
|
||||||
while( isSpace( *data ) )
|
while( isSpace( *data ) )
|
||||||
++data;
|
++data;
|
||||||
|
@ -1381,28 +1380,26 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint )
|
||||||
}
|
}
|
||||||
|
|
||||||
// go through a wxString to establish a universal character set properly
|
// go through a wxString to establish a universal character set properly
|
||||||
wxString padname;
|
wxString padNumber;
|
||||||
|
|
||||||
if( m_loading_format_version == 1 )
|
if( m_loading_format_version == 1 )
|
||||||
{
|
{
|
||||||
// add 8 bit bytes, file format 1 was KiCad font type byte,
|
// add 8 bit bytes, file format 1 was KiCad font type byte,
|
||||||
// simply promote those 8 bit bytes up into UNICODE. (subset of LATIN1)
|
// 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 )
|
while( *cp )
|
||||||
{
|
padNumber += *cp++; // unsigned, ls 8 bits only
|
||||||
padname += *cp++; // unsigned, ls 8 bits only
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// version 2, which is UTF8.
|
// version 2, which is UTF8.
|
||||||
padname = FROM_UTF8( mypadname );
|
padNumber = FROM_UTF8( mypadnumber );
|
||||||
}
|
}
|
||||||
|
|
||||||
// chances are both were ASCII, but why take chances?
|
// chances are both were ASCII, but why take chances?
|
||||||
|
|
||||||
pad->SetName( padname );
|
pad->SetNumber( padNumber );
|
||||||
pad->SetShape( static_cast<PAD_SHAPE>( padshape ) );
|
pad->SetShape( static_cast<PAD_SHAPE>( padshape ) );
|
||||||
pad->SetSize( wxSize( size_x, size_y ) );
|
pad->SetSize( wxSize( size_x, size_y ) );
|
||||||
pad->SetDelta( wxSize( delta_x, delta_y ) );
|
pad->SetDelta( wxSize( delta_x, delta_y ) );
|
||||||
|
|
|
@ -263,7 +263,7 @@ void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncaps
|
||||||
// actually this is a thru-hole pad
|
// actually this is a thru-hole pad
|
||||||
pad->SetLayerSet( LSET::AllCuMask() | LSET( 2, B_Mask, F_Mask ) );
|
pad->SetLayerSet( LSET::AllCuMask() | LSET( 2, B_Mask, F_Mask ) );
|
||||||
|
|
||||||
pad->SetName( m_name.text );
|
pad->SetNumber( m_name.text );
|
||||||
|
|
||||||
if( padShapeName == wxT( "Oval" )
|
if( padShapeName == wxT( "Oval" )
|
||||||
|| padShapeName == wxT( "Ellipse" )
|
|| padShapeName == wxT( "Ellipse" )
|
||||||
|
|
|
@ -16,12 +16,18 @@
|
||||||
# SetPadName() is the old name for PAD::SetName()
|
# SetPadName() is the old name for PAD::SetName()
|
||||||
# define it for compatibility
|
# define it for compatibility
|
||||||
def SetPadName(self, aName):
|
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()
|
# GetPadName() is the old name for PAD::GetName()
|
||||||
# define it for compatibility
|
# define it for compatibility
|
||||||
def GetPadName(self):
|
def GetPadName(self):
|
||||||
return self.GetName()
|
return self.GetNumber()
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return self.GetNumber()
|
||||||
|
|
||||||
# AddPrimitive() is the old name for D_PAD::AddPrimitivePoly(),
|
# AddPrimitive() is the old name for D_PAD::AddPrimitivePoly(),
|
||||||
# PAD::AddPrimitiveSegment(), PAD::AddPrimitiveCircle(),
|
# PAD::AddPrimitiveSegment(), PAD::AddPrimitiveCircle(),
|
||||||
|
|
|
@ -612,7 +612,7 @@ typedef std::map<wxString, int> PINMAP;
|
||||||
IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
|
IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
|
||||||
{
|
{
|
||||||
PINMAP pinmap;
|
PINMAP pinmap;
|
||||||
wxString padName;
|
wxString padNumber;
|
||||||
|
|
||||||
PCB_TYPE_COLLECTOR fpItems;
|
PCB_TYPE_COLLECTOR fpItems;
|
||||||
|
|
||||||
|
@ -676,17 +676,17 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
|
||||||
|
|
||||||
PIN* pin = new PIN( image );
|
PIN* pin = new PIN( image );
|
||||||
|
|
||||||
padName = pad->GetName();
|
padNumber = pad->GetNumber();
|
||||||
pin->pin_id = TO_UTF8( padName );
|
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
|
else // pad name is a duplicate within this footprint
|
||||||
{
|
{
|
||||||
char buf[32];
|
char buf[32];
|
||||||
int duplicates = ++pinmap[ padName ];
|
int duplicates = ++pinmap[ padNumber ];
|
||||||
|
|
||||||
sprintf( buf, "@%d", duplicates );
|
sprintf( buf, "@%d", duplicates );
|
||||||
|
|
||||||
|
|
|
@ -462,7 +462,7 @@ int BOARD_EDITOR_CONTROL::ExportNetlist( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
if( !netname.IsEmpty() )
|
if( !netname.IsEmpty() )
|
||||||
{
|
{
|
||||||
component->AddNet( pad->GetName(), netname, pad->GetPinFunction(),
|
component->AddNet( pad->GetNumber(), netname, pad->GetPinFunction(),
|
||||||
pad->GetPinType() );
|
pad->GetPinType() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
#include <tools/tool_event_utils.h>
|
#include <tools/tool_event_utils.h>
|
||||||
#include <tools/pcb_grid_helper.h>
|
#include <tools/pcb_grid_helper.h>
|
||||||
#include <tools/pad_tool.h>
|
#include <tools/pad_tool.h>
|
||||||
#include <pad_naming.h>
|
|
||||||
#include <view/view_controls.h>
|
#include <view/view_controls.h>
|
||||||
#include <connectivity/connectivity_algo.h>
|
#include <connectivity/connectivity_algo.h>
|
||||||
#include <connectivity/connectivity_items.h>
|
#include <connectivity/connectivity_items.h>
|
||||||
|
@ -2129,14 +2128,14 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
||||||
FOOTPRINT* parentFootprint = editFrame->GetBoard()->GetFirstFootprint();
|
FOOTPRINT* parentFootprint = editFrame->GetBoard()->GetFirstFootprint();
|
||||||
dupe_item = parentFootprint->DuplicateItem( orig_item );
|
dupe_item = parentFootprint->DuplicateItem( orig_item );
|
||||||
|
|
||||||
if( increment && item->Type() == PCB_PAD_T
|
if( increment && dupe_item->Type() == PCB_PAD_T
|
||||||
&& PAD_NAMING::PadCanHaveName( *static_cast<PAD*>( dupe_item ) ) )
|
&& static_cast<PAD*>( dupe_item )->CanHaveNumber() )
|
||||||
{
|
{
|
||||||
PAD_TOOL* padTool = m_toolMgr->GetTool<PAD_TOOL>();
|
PAD_TOOL* padTool = m_toolMgr->GetTool<PAD_TOOL>();
|
||||||
wxString padName = padTool->GetLastPadName();
|
wxString padNumber = padTool->GetLastPadNumber();
|
||||||
padName = parentFootprint->GetNextPadName( padName );
|
padNumber = parentFootprint->GetNextPadNumber( padNumber );
|
||||||
padTool->SetLastPadName( padName );
|
padTool->SetLastPadNumber( padNumber );
|
||||||
static_cast<PAD*>( dupe_item )->SetName( padName );
|
static_cast<PAD*>( dupe_item )->SetNumber( padNumber );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( orig_item->GetParent() && orig_item->GetParent()->Type() == PCB_FOOTPRINT_T )
|
else if( orig_item->GetParent() && orig_item->GetParent()->Type() == PCB_FOOTPRINT_T )
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -40,7 +40,6 @@
|
||||||
#include <tools/pcb_selection_conditions.h>
|
#include <tools/pcb_selection_conditions.h>
|
||||||
#include <tools/edit_tool.h>
|
#include <tools/edit_tool.h>
|
||||||
#include <dialogs/dialog_enum_pads.h>
|
#include <dialogs/dialog_enum_pads.h>
|
||||||
#include <pad_naming.h>
|
|
||||||
#include <widgets/infobar.h>
|
#include <widgets/infobar.h>
|
||||||
|
|
||||||
PAD_TOOL::PAD_TOOL() :
|
PAD_TOOL::PAD_TOOL() :
|
||||||
|
@ -58,7 +57,7 @@ PAD_TOOL::~PAD_TOOL()
|
||||||
void PAD_TOOL::Reset( RESET_REASON aReason )
|
void PAD_TOOL::Reset( RESET_REASON aReason )
|
||||||
{
|
{
|
||||||
if( aReason == MODEL_RELOAD )
|
if( aReason == MODEL_RELOAD )
|
||||||
m_lastPadName = wxT( "1" );
|
m_lastPadNumber = wxT( "1" );
|
||||||
|
|
||||||
m_padCopied = false;
|
m_padCopied = false;
|
||||||
m_editPad = niluuid;
|
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
|
VECTOR2I oldCursorPos; // store the previous mouse cursor position, during mouse drag
|
||||||
std::list<PAD*> selectedPads;
|
std::list<PAD*> selectedPads;
|
||||||
BOARD_COMMIT commit( frame() );
|
BOARD_COMMIT commit( frame() );
|
||||||
std::map<wxString, std::pair<int, wxString>> oldNames;
|
std::map<wxString, std::pair<int, wxString>> oldNumbers;
|
||||||
bool isFirstPoint = true; // used to be sure oldCursorPos will be initialized at least once.
|
bool isFirstPoint = true; // used to be sure oldCursorPos will be initialized at least once.
|
||||||
|
|
||||||
STATUS_TEXT_POPUP statusPopup( frame() );
|
STATUS_TEXT_POPUP statusPopup( frame() );
|
||||||
|
@ -389,10 +388,10 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
|
||||||
else
|
else
|
||||||
newval = seqPadNum++;
|
newval = seqPadNum++;
|
||||||
|
|
||||||
wxString newName = wxString::Format( wxT( "%s%d" ), padPrefix, newval );
|
wxString newNumber = wxString::Format( wxT( "%s%d" ), padPrefix, newval );
|
||||||
oldNames[newName] = { newval, pad->GetName() };
|
oldNumbers[newNumber] = { newval, pad->GetNumber() };
|
||||||
pad->SetName( newName );
|
pad->SetNumber( newNumber );
|
||||||
SetLastPadName( newName );
|
SetLastPadNumber( newNumber );
|
||||||
pad->SetSelected();
|
pad->SetSelected();
|
||||||
getView()->Update( pad );
|
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
|
// ... or restore the old name if it was enumerated and clicked again
|
||||||
else if( pad->IsSelected() && evt->IsClick( BUT_LEFT ) )
|
else if( pad->IsSelected() && evt->IsClick( BUT_LEFT ) )
|
||||||
{
|
{
|
||||||
auto it = oldNames.find( pad->GetName() );
|
auto it = oldNumbers.find( pad->GetNumber() );
|
||||||
wxASSERT( it != oldNames.end() );
|
wxASSERT( it != oldNumbers.end() );
|
||||||
|
|
||||||
if( it != oldNames.end() )
|
if( it != oldNumbers.end() )
|
||||||
{
|
{
|
||||||
storedPadNumbers.push_back( it->second.first );
|
storedPadNumbers.push_back( it->second.first );
|
||||||
pad->SetName( it->second.second );
|
pad->SetNumber( it->second.second );
|
||||||
SetLastPadName( it->second.second );
|
SetLastPadNumber( it->second.second );
|
||||||
oldNames.erase( it );
|
oldNumbers.erase( it );
|
||||||
|
|
||||||
int newval = storedPadNumbers.front();
|
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()) );
|
pad->ImportSettingsFrom( *(m_frame->GetDesignSettings().m_Pad_Master.get()) );
|
||||||
|
|
||||||
if( PAD_NAMING::PadCanHaveName( *pad ) )
|
if( pad->CanHaveNumber() )
|
||||||
{
|
{
|
||||||
wxString padName = m_padTool->GetLastPadName();
|
wxString padNumber = m_padTool->GetLastPadNumber();
|
||||||
padName = m_board->GetFirstFootprint()->GetNextPadName( padName );
|
padNumber = m_board->GetFirstFootprint()->GetNextPadNumber( padNumber );
|
||||||
pad->SetName( padName );
|
pad->SetNumber( padNumber );
|
||||||
m_padTool->SetLastPadName( padName );
|
m_padTool->SetLastPadNumber( padNumber );
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::unique_ptr<BOARD_ITEM>( pad );
|
return std::unique_ptr<BOARD_ITEM>( pad );
|
||||||
|
|
|
@ -59,8 +59,8 @@ public:
|
||||||
*/
|
*/
|
||||||
int EditPad( const TOOL_EVENT& aEvent );
|
int EditPad( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
wxString GetLastPadName() const { return m_lastPadName; }
|
wxString GetLastPadNumber() const { return m_lastPadNumber; }
|
||||||
void SetLastPadName( const wxString& aPadName ) { m_lastPadName = aPadName; }
|
void SetLastPadNumber( const wxString& aPadNumber ) { m_lastPadNumber = aPadNumber; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///< Bind handlers to corresponding TOOL_ACTIONs.
|
///< Bind handlers to corresponding TOOL_ACTIONs.
|
||||||
|
@ -78,7 +78,7 @@ private:
|
||||||
PCB_LAYER_ID explodePad( PAD* aPad );
|
PCB_LAYER_ID explodePad( PAD* aPad );
|
||||||
void recombinePad( 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_padCopied; // Indicates there are valid settings in the Master Pad object
|
||||||
|
|
||||||
bool m_wasHighContrast;
|
bool m_wasHighContrast;
|
||||||
|
|
|
@ -35,7 +35,7 @@ set( QA_PCBNEW_SRCS
|
||||||
test_array_pad_name_provider.cpp
|
test_array_pad_name_provider.cpp
|
||||||
test_graphics_import_mgr.cpp
|
test_graphics_import_mgr.cpp
|
||||||
test_lset.cpp
|
test_lset.cpp
|
||||||
test_pad_naming.cpp
|
test_pad_numbering.cpp
|
||||||
test_libeval_compiler.cpp
|
test_libeval_compiler.cpp
|
||||||
test_tracks_cleaner.cpp
|
test_tracks_cleaner.cpp
|
||||||
test_zone_filler.cpp
|
test_zone_filler.cpp
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* 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
|
* 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 <qa_utils/wx_utils/unit_test_utils.h>
|
#include <qa_utils/wx_utils/unit_test_utils.h>
|
||||||
|
|
||||||
#include <array_pad_name_provider.h> // UUT
|
#include <array_pad_number_provider.h> // UUT
|
||||||
|
|
||||||
#include <common.h> // make_unique
|
#include <common.h> // make_unique
|
||||||
|
|
||||||
|
@ -46,7 +41,7 @@ static std::unique_ptr<FOOTPRINT> FootprintWithPads( const std::vector<wxString>
|
||||||
{
|
{
|
||||||
std::unique_ptr<PAD> pad = std::make_unique<PAD>( footprint.get() );
|
std::unique_ptr<PAD> pad = std::make_unique<PAD>( footprint.get() );
|
||||||
|
|
||||||
pad->SetName( name );
|
pad->SetNumber( name );
|
||||||
|
|
||||||
footprint->Add( pad.release() );
|
footprint->Add( pad.release() );
|
||||||
}
|
}
|
||||||
|
@ -57,7 +52,7 @@ static std::unique_ptr<FOOTPRINT> FootprintWithPads( const std::vector<wxString>
|
||||||
/**
|
/**
|
||||||
* Declare the test suite
|
* Declare the test suite
|
||||||
*/
|
*/
|
||||||
BOOST_AUTO_TEST_SUITE( ArrayPadNameProv )
|
BOOST_AUTO_TEST_SUITE( ArrayPadNumberProv )
|
||||||
|
|
||||||
|
|
||||||
struct APNP_CASE
|
struct APNP_CASE
|
||||||
|
@ -66,7 +61,7 @@ struct APNP_CASE
|
||||||
bool m_using_footprint;
|
bool m_using_footprint;
|
||||||
std::vector<wxString> m_existing_pads;
|
std::vector<wxString> m_existing_pads;
|
||||||
std::unique_ptr<ARRAY_OPTIONS> m_arr_opts;
|
std::unique_ptr<ARRAY_OPTIONS> m_arr_opts;
|
||||||
std::vector<wxString> m_exp_arr_names;
|
std::vector<wxString> m_expected_numbers;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,21 +112,20 @@ std::vector<APNP_CASE> 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 aProvider the provider
|
||||||
* @param aExpNames ordered list of expected names
|
* @param aExpNames ordered list of expected names
|
||||||
*/
|
*/
|
||||||
void CheckPadNameProvider( ARRAY_PAD_NAME_PROVIDER& aProvider, std::vector<wxString> aExpNames )
|
void CheckPadNumberProvider( ARRAY_PAD_NUMBER_PROVIDER& aProvider,
|
||||||
|
std::vector<wxString> aExpectedNumbers )
|
||||||
{
|
{
|
||||||
std::vector<wxString> got_names;
|
std::vector<wxString> got_numbers;
|
||||||
|
|
||||||
for( unsigned i = 0; i < aExpNames.size(); ++i )
|
for( unsigned i = 0; i < aExpectedNumbers.size(); ++i )
|
||||||
{
|
got_numbers.push_back( aProvider.GetNextPadNumber() );
|
||||||
got_names.push_back( aProvider.GetNextPadName() );
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
BOOST_CHECK_EQUAL_COLLECTIONS( aExpectedNumbers.begin(), aExpectedNumbers.end(),
|
||||||
aExpNames.begin(), aExpNames.end(), got_names.begin(), got_names.end() );
|
got_numbers.begin(), got_numbers.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,9 +140,9 @@ BOOST_AUTO_TEST_CASE( FootprintCases )
|
||||||
if( c.m_using_footprint )
|
if( c.m_using_footprint )
|
||||||
footprint = FootprintWithPads( c.m_existing_pads );
|
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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -22,10 +22,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <qa_utils/wx_utils/unit_test_utils.h>
|
#include <qa_utils/wx_utils/unit_test_utils.h>
|
||||||
|
|
||||||
#include <board.h>
|
#include <board.h>
|
||||||
#include <footprint.h>
|
#include <footprint.h>
|
||||||
#include <pad_naming.h>
|
#include <pad.h>
|
||||||
|
|
||||||
struct PAD_FIXTURE
|
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
|
* Check what gets names and what doesn't
|
||||||
*/
|
*/
|
||||||
BOOST_AUTO_TEST_CASE( CanName )
|
BOOST_AUTO_TEST_CASE( CanNumber )
|
||||||
{
|
{
|
||||||
auto npth = MakeNPTH();
|
auto npth = MakeNPTH();
|
||||||
BOOST_CHECK_EQUAL( false, PAD_NAMING::PadCanHaveName( npth ) );
|
BOOST_CHECK_EQUAL( false, npth.CanHaveNumber() );
|
||||||
|
|
||||||
auto aperture = MakeAperture();
|
auto aperture = MakeAperture();
|
||||||
BOOST_CHECK_EQUAL( false, PAD_NAMING::PadCanHaveName( aperture ) );
|
BOOST_CHECK_EQUAL( false, aperture.CanHaveNumber() );
|
||||||
|
|
||||||
auto smd = MakeSmd();
|
auto smd = MakeSmd();
|
||||||
BOOST_CHECK_EQUAL( true, PAD_NAMING::PadCanHaveName( smd ) );
|
BOOST_CHECK_EQUAL( true, smd.CanHaveNumber() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ BOOST_FIXTURE_TEST_CASE( BasicZoneFills, ZONE_FILL_TEST_FIXTURE )
|
||||||
|
|
||||||
for( PAD* pad : m_board->Footprints()[0]->Pads() )
|
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 ) );
|
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<PAD*>( item_b );
|
PAD* pad_b = dynamic_cast<PAD*>( item_b );
|
||||||
PCB_TRACK* trk_b = dynamic_cast<PCB_TRACK*>( item_b );
|
PCB_TRACK* trk_b = dynamic_cast<PCB_TRACK*>( item_b );
|
||||||
|
|
||||||
if( pad_a && pad_a->GetName() == "2" ) foundPad2Error = true;
|
if( pad_a && pad_a->GetNumber() == "2" ) foundPad2Error = true;
|
||||||
else if( pad_a && pad_a->GetName() == "4" ) foundPad4Error = true;
|
else if( pad_a && pad_a->GetNumber() == "4" ) foundPad4Error = true;
|
||||||
else if( pad_a && pad_a->GetName() == "6" ) foundPad6Error = true;
|
else if( pad_a && pad_a->GetNumber() == "6" ) foundPad6Error = true;
|
||||||
else if( pad_b && pad_b->GetName() == "2" ) foundPad2Error = true;
|
else if( pad_b && pad_b->GetNumber() == "2" ) foundPad2Error = true;
|
||||||
else if( pad_b && pad_b->GetName() == "4" ) foundPad4Error = true;
|
else if( pad_b && pad_b->GetNumber() == "4" ) foundPad4Error = true;
|
||||||
else if( pad_b && pad_b->GetName() == "6" ) foundPad6Error = 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 == arc8 ) foundArc8Error = true;
|
||||||
else if( trk_a && trk_a->m_Uuid == arc12 ) foundArc12Error = 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 == arc8 ) foundArc8Error = true;
|
||||||
else if( trk_b && trk_b->m_Uuid == arc12 ) foundArc12Error = true;
|
else if( trk_b && trk_b->m_Uuid == arc12 ) foundArc12Error = true;
|
||||||
else foundOtherError = true;
|
else foundOtherError = true;
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue