Support long names for pins and pads

This commit is contained in:
Maciej Suminski 2017-09-19 18:34:28 +02:00
commit 76d1365360
53 changed files with 159 additions and 355 deletions

View File

@ -643,7 +643,6 @@ void LIB_PART::GetPins( LIB_PINS& aList, int aUnit, int aConvert )
LIB_PIN* LIB_PART::GetPin( const wxString& aNumber, int aUnit, int aConvert )
{
wxString pNumber;
LIB_PINS pinList;
GetPins( pinList, aUnit, aConvert );
@ -652,9 +651,7 @@ LIB_PIN* LIB_PART::GetPin( const wxString& aNumber, int aUnit, int aConvert )
{
wxASSERT( pinList[i]->Type() == LIB_PIN_T );
pinList[i]->PinStringNum( pNumber );
if( aNumber == pNumber )
if( aNumber == pinList[i]->GetNumber() )
return pinList[i];
}
@ -683,10 +680,7 @@ bool LIB_PART::PinsConflictWith( LIB_PART& aOtherPart, bool aTestNums, bool aTes
continue;
// Same number?
wxString eachThisPinNumber, eachOtherPinNumber;
eachThisPin->PinStringNum( eachThisPinNumber );
eachOtherPin->PinStringNum( eachOtherPinNumber );
if( aTestNums && ( eachThisPinNumber != eachOtherPinNumber ))
if( aTestNums && ( eachThisPin->GetNumber() != eachOtherPin->GetNumber() ))
continue;
// Same name?

View File

@ -53,7 +53,7 @@ class SCH_PLUGIN;
* Part Library version and file header macros.
*/
#define LIB_VERSION_MAJOR 2
#define LIB_VERSION_MINOR 3
#define LIB_VERSION_MINOR 4
/* Must be the first line of part library (.lib) files. */
#define LIBFILE_IDENT "EESchema-LIBRARY Version"

View File

@ -184,7 +184,6 @@ NETLIST_OBJECT::NETLIST_OBJECT()
* from the BUS label ) member number
*/
m_ConnectionType = UNCONNECTED;
m_PinNum = 0; /* pin number ( 1 long = 4 bytes -> 4 ascii codes) */
m_netNameCandidate = NULL; /* a pointer to a NETLIST_OBJECT type label connected to this
* object used to give a name to the net
*/
@ -389,9 +388,7 @@ wxString NETLIST_OBJECT::GetShortNetName( bool adoptTimestamp ) const
if( adoptTimestamp && netName.Last() == '?' )
netName << link->GetTimeStamp();
netName << wxT("-Pad")
<< LIB_PIN::PinStringNum( m_netNameCandidate->m_PinNum )
<< wxT(")");
netName << wxT("-Pad") << m_netNameCandidate->m_PinNum << wxT(")");
}
}
else

View File

@ -33,7 +33,7 @@
#include <sch_sheet_path.h>
#include <lib_pin.h> // LIB_PIN::PinStringNum( m_PinNum )
#include <lib_pin.h>
#include <sch_item_struct.h>
class NETLIST_OBJECT_LIST;
@ -111,7 +111,7 @@ public:
* created from the BUS label ) member number.
*/
NET_CONNECTION_T m_ConnectionType; // Used to store the connection type
long m_PinNum; // pin number ( 1 long = 4 bytes -> 4 ascii codes)
wxString m_PinNum; // pin number
wxString m_Label; // Label text (for labels) or Pin name (for pins)
wxPoint m_Start; // Position of object or for segments: starting point
wxPoint m_End; // For segments (wire and buses): ending point
@ -182,10 +182,9 @@ public:
* returns a pin number in wxString form. Pin numbers are not always
* numbers. \"A23\" would be a valid pin number.
*/
wxString GetPinNumText()
const wxString& GetPinNumText() const
{
// hide the ugliness in here, but do it inline.
return LIB_PIN::PinStringNum( m_PinNum );
return m_PinNum;
}
/** For Pins (NET_PINS):

View File

@ -141,13 +141,9 @@ std::string FormatProbeItem( EDA_ITEM* aItem, SCH_COMPONENT* aPart )
LIB_PIN* pin = (LIB_PIN*) aItem;
if( pin->GetNumber() )
if( !pin->GetNumber().IsEmpty() )
{
wxString pinnum;
pin->PinStringNum( pinnum );
return StrPrintf( "$PIN: %s $PART: %s", TO_UTF8( pinnum ),
return StrPrintf( "$PIN: %s $PART: %s", TO_UTF8( pin->GetNumber() ),
TO_UTF8( aPart->GetField( REFERENCE )->GetText() ) );
}
else

View File

@ -530,7 +530,7 @@ wxString DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Pin::GetString( unsigned int
switch( aCol )
{
case PIN_NUMBER:
return m_Backing->GetNumberString();
return m_Backing->GetNumber();
case PIN_NAME:
if( m_Model.m_UnitCount > 1 )

View File

@ -37,7 +37,7 @@ using KIGFX::COLOR4D;
class TRANSFORM;
class SCH_SHEET;
#define EESCHEMA_VERSION 2
#define EESCHEMA_VERSION 3
#define SCHEMATIC_HEAD_STRING "Schematic File Version"
#define DANGLING_SYMBOL_SIZE 12

View File

@ -149,7 +149,6 @@ LIB_PIN::LIB_PIN( LIB_PART* aParent ) :
m_orientation = PIN_RIGHT; // Pin orient: Up, Down, Left, Right
m_type = PIN_UNSPECIFIED; // electrical type of pin
m_attributes = 0; // bit 0 != 0: pin invisible
m_number = 0; // pin number (i.e. 4 ASCII chars)
m_numTextSize = LIB_EDIT_FRAME::GetPinNumDefaultSize();
m_nameTextSize = LIB_EDIT_FRAME::GetPinNameDefaultSize();
m_width = 0;
@ -211,23 +210,6 @@ void LIB_PIN::SetNameTextSize( int size )
}
void LIB_PIN::SetNumber( const wxString& number )
{
wxString tmp = ( number.IsEmpty() ) ? wxT( "~" ) : number;
tmp.Replace( wxT( " " ), wxT( "_" ) );
long oldNumber = m_number;
SetPinNumFromString( tmp );
if( m_number != oldNumber )
SetFlags( IS_CHANGED );
/* Others pin numbers marked by EnableEditMode() are not modified
* because each pin has its own number
*/
}
void LIB_PIN::SetNumberTextSize( int size )
{
if( size != m_numTextSize )
@ -541,7 +523,6 @@ bool LIB_PIN::HitTest( const wxPoint &aPosition, int aThreshold, const TRANSFORM
bool LIB_PIN::Save( OUTPUTFORMATTER& aFormatter )
{
wxString StringPinNum;
int Etype;
switch( m_type )
@ -592,11 +573,6 @@ bool LIB_PIN::Save( OUTPUTFORMATTER& aFormatter )
break;
}
PinStringNum( StringPinNum );
if( StringPinNum.IsEmpty() )
StringPinNum = wxT( "~" );
if( !m_name.IsEmpty() )
{
if( aFormatter.Print( 0, "X %s", TO_UTF8( m_name ) ) < 0 )
@ -609,7 +585,8 @@ bool LIB_PIN::Save( OUTPUTFORMATTER& aFormatter )
}
if( aFormatter.Print( 0, " %s %d %d %d %c %d %d %d %d %c",
TO_UTF8( StringPinNum ), m_position.x, m_position.y,
TO_UTF8( m_number.IsEmpty() ? wxT( "~" ) : m_number ),
m_position.x, m_position.y,
(int) m_length, (int) m_orientation, m_numTextSize, m_nameTextSize,
m_Unit, m_Convert, Etype ) < 0 )
return false;
@ -716,7 +693,7 @@ bool LIB_PIN::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
// Extract the pinName (UTF8 encoded accepted, but should be only ASCII8.)
tmp = tokenizer.GetNextToken();
SetPinNumFromString( tmp );
SetNumber( tmp );
// Read other parameters, in pure ASCII
char line[1024];
@ -1190,7 +1167,6 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
return;
int x, y;
wxString StringPinNum;
wxSize PinNameSize( m_nameTextSize, m_nameTextSize );
wxSize PinNumSize( m_numTextSize, m_numTextSize );
@ -1218,9 +1194,6 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
COLOR4D NumColor = Color == COLOR4D::UNSPECIFIED ?
GetLayerColor( LAYER_PINNUM ) : Color;
/* Create the pin num string */
PinStringNum( StringPinNum );
int x1 = pin_pos.x;
int y1 = pin_pos.y;
@ -1282,7 +1255,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
DrawGraphicText( clipbox, DC,
wxPoint( (x1 + pin_pos.x) / 2,
y1 - num_offset ), NumColor,
StringPinNum,
m_number,
TEXT_ANGLE_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
@ -1308,7 +1281,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
DrawGraphicText( clipbox, DC,
wxPoint( x1 - num_offset,
(y1 + pin_pos.y) / 2 ), NumColor,
StringPinNum,
m_number,
TEXT_ANGLE_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
@ -1330,7 +1303,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
DrawGraphicText( clipbox, DC,
wxPoint( x1 - num_offset,
(y1 + pin_pos.y) / 2 ), NumColor,
StringPinNum,
m_number,
TEXT_ANGLE_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
@ -1357,7 +1330,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
{
x = (x1 + pin_pos.x) / 2;
DrawGraphicText( clipbox, DC, wxPoint( x, y1 + num_offset ),
NumColor, StringPinNum,
NumColor, m_number,
TEXT_ANGLE_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP, numLineWidth,
@ -1382,7 +1355,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
DrawGraphicText( clipbox, DC,
wxPoint( x1 + num_offset, (y1 + pin_pos.y)
/ 2 ),
NumColor, StringPinNum,
NumColor, m_number,
TEXT_ANGLE_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP, numLineWidth,
@ -1614,11 +1587,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
if( m_name.IsEmpty() || m_name == wxT( "~" ) )
DrawPinName = false;
/* Create the pin num string */
wxString StringPinNum;
PinStringNum( StringPinNum );
if( StringPinNum.IsEmpty() )
if( m_number.IsEmpty() )
DrawPinNum = false;
if( !DrawPinNum && !DrawPinName )
@ -1699,7 +1668,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
{
plotter->Text( wxPoint( (x1 + pin_pos.x) / 2,
y1 - num_offset ),
NumColor, StringPinNum,
NumColor, m_number,
TEXT_ANGLE_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM,
@ -1724,7 +1693,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
{
plotter->Text( wxPoint( x1 - num_offset,
(y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum,
NumColor, m_number,
TEXT_ANGLE_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM,
@ -1747,7 +1716,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
{
plotter->Text( wxPoint( x1 - num_offset,
(y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum,
NumColor, m_number,
TEXT_ANGLE_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM,
@ -1776,7 +1745,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
{
x = ( x1 + pin_pos.x ) / 2;
plotter->Text( wxPoint( x, y1 + num_offset ),
NumColor, StringPinNum,
NumColor, m_number,
TEXT_ANGLE_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP,
@ -1800,7 +1769,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
{
plotter->Text( wxPoint( x1 + num_offset,
( y1 + pin_pos.y ) / 2 ),
NumColor, StringPinNum,
NumColor, m_number,
TEXT_ANGLE_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP,
@ -1883,45 +1852,6 @@ int LIB_PIN::PinDrawOrient( const TRANSFORM& aTransform ) const
}
void LIB_PIN::PinStringNum( wxString& aStringBuffer ) const
{
aStringBuffer = PinStringNum( m_number );
}
wxString LIB_PIN::PinStringNum( long aPinNum )
{
char ascii_buf[5];
memcpy( ascii_buf, &aPinNum, 4 );
ascii_buf[4] = 0;
wxString buffer = FROM_UTF8( ascii_buf );
return buffer;
}
void LIB_PIN::SetPinNumFromString( wxString& buffer )
{
char ascii_buf[4];
unsigned ii, len = buffer.Len();
ascii_buf[0] = ascii_buf[1] = ascii_buf[2] = ascii_buf[3] = 0;
if( len > 4 )
len = 4;
for( ii = 0; ii < len; ii++ )
{
ascii_buf[ii] = buffer.GetChar( ii );
ascii_buf[ii] &= 0xFF;
}
strncpy( (char*) &m_number, ascii_buf, 4 );
}
EDA_ITEM* LIB_PIN::Clone() const
{
return new LIB_PIN( *this );
@ -1935,7 +1865,7 @@ int LIB_PIN::compare( const LIB_ITEM& other ) const
const LIB_PIN* tmp = (LIB_PIN*) &other;
if( m_number != tmp->m_number )
return m_number - tmp->m_number;
return m_number.Cmp( tmp->m_number );
int result = m_name.CmpNoCase( tmp->m_name );
@ -2078,17 +2008,12 @@ void LIB_PIN::SetWidth( int aWidth )
void LIB_PIN::getMsgPanelInfoBase( MSG_PANEL_ITEMS& aList )
{
wxString text;
wxString text = m_number.IsEmpty() ? wxT( "?" ) : m_number;
LIB_ITEM::GetMsgPanelInfo( aList );
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), m_name, DARKCYAN ) );
if( m_number == 0 )
text = wxT( "?" );
else
PinStringNum( text );
aList.push_back( MSG_PANEL_ITEM( _( "Number" ), text, DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ),
@ -2161,7 +2086,7 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles ) const
wxPoint end;
int nameTextOffset = 0;
bool showName = !m_name.IsEmpty() && (m_name != wxT( "~" ));
bool showNum = m_number != 0;
bool showNum = !m_number.IsEmpty();
int minsizeV = TARGET_PIN_RADIUS;
if( !aIncludeInvisibles && !IsVisible() )
@ -2178,7 +2103,7 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles ) const
}
// First, calculate boundary box corners position
int numberTextLength = showNum ? m_numTextSize * GetNumberString().Len() : 0;
int numberTextLength = showNum ? m_numTextSize * m_number.Len() : 0;
// Actual text height is bigger than text size
int numberTextHeight = showNum ? KiROUND( m_numTextSize * 1.1 ) : 0;
@ -2348,10 +2273,8 @@ wxString LIB_PIN::GetSelectMenuText() const
style = GetText( m_shape );
tmp.Printf( _( "Pin %s, %s, %s" ),
GetChars( GetNumberString() ),
GetChars( GetElectricalTypeName() ),
GetChars( style )
);
GetChars( m_number ), GetChars( GetElectricalTypeName() ), GetChars( style ));
return tmp;
}
@ -2368,8 +2291,7 @@ bool LIB_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint*
wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText() );
if( EDA_ITEM::Matches( GetName(), aSearchData )
|| EDA_ITEM::Matches( GetNumberString(), aSearchData ) )
if( EDA_ITEM::Matches( GetName(), aSearchData ) || EDA_ITEM::Matches( m_number, aSearchData ) )
{
if( aFindLocation )
*aFindLocation = GetBoundingBox().Centre();
@ -2386,7 +2308,7 @@ bool LIB_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint*
void LIB_PIN::Show( int nestLevel, std::ostream& os ) const
{
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
<< " num=\"" << GetNumberString().mb_str()
<< " num=\"" << m_number.mb_str()
<< '"' << "/>\n";
// NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";

View File

@ -74,9 +74,7 @@ class LIB_PIN : public LIB_ITEM
ELECTRICAL_PINTYPE m_type; ///< Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
int m_attributes; ///< Set bit 0 to indicate pin is invisible.
wxString m_name;
long m_number; ///< Pin number defined as 4 ASCII characters like "12", "anod",
///< "G6", or "12". It is stored as "12\0\0" and does not
///< depend on endian type.
wxString m_number;
int m_numTextSize;
int m_nameTextSize; ///< Pin num and Pin name sizes
@ -161,36 +159,10 @@ public:
*/
int PinDrawOrient( const TRANSFORM& aTransform ) const;
/**
* Fill a string buffer with pin number.
*
* Pin numbers are coded as a long or 4 ASCII characters. Used to print
* or draw the pin number.
*
* @param aStringBuffer - the wxString to store the pin num as an unicode string
*/
void PinStringNum( wxString& aStringBuffer ) const;
long GetNumber() const { return m_number; }
wxString GetNumberString() const { return PinStringNum( m_number ); }
/**
* Function PinStringNum (static function)
* Pin num is coded as a long or 4 ascii chars
* @param aPinNum = a long containing a pin num
* @return aStringBuffer = the wxString to store the pin num as an
* unicode string
*/
static wxString PinStringNum( long aPinNum );
/**
* Function SetPinNumFromString
* fill the pin number buffer with \a aBuffer.
*/
void SetPinNumFromString( wxString& aBuffer );
wxString GetName() const { return m_name; }
const wxString& GetName() const
{
return m_name;
}
/**
* Set the pin name.
@ -213,6 +185,11 @@ public:
int GetNameTextSize() const { return m_nameTextSize; }
const wxString& GetNumber() const
{
return m_number;
}
/**
* Set the pin number.
*
@ -220,7 +197,10 @@ public:
* because each pin has its own number
* @param aNumber New pin number.
*/
void SetNumber( const wxString& aNumber );
void SetNumber( const wxString& aNumber )
{
m_number = aNumber;
}
/**
* Set the size of the pin number text.

View File

@ -454,7 +454,7 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeLibParts()
XNODE* pin;
pins->AddChild( pin = node( "pin" ) );
pin->AddAttribute( "num", pinList[i]->GetNumberString() );
pin->AddAttribute( "num", pinList[i]->GetNumber() );
pin->AddAttribute( "name", pinList[i]->GetName() );
pin->AddAttribute( "type", pinList[i]->GetCanonicalElectricalTypeName() );
@ -547,5 +547,5 @@ XNODE* NETLIST_EXPORTER_GENERIC::node( const wxString& aName, const wxString& aT
static bool sortPinsByNumber( LIB_PIN* aPin1, LIB_PIN* aPin2 )
{
// return "lhs < rhs"
return RefDesStringCompare( aPin1->GetNumberString(), aPin2->GetNumberString() ) < 0;
return RefDesStringCompare( aPin1->GetNumber(), aPin2->GetNumber() ) < 0;
}

View File

@ -212,7 +212,7 @@ wxString NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SPICE_FIELD aField,
aComponent->GetPins( pins );
for( auto pin : pins )
nodeSeq += pin->GetNumberString() + " ";
nodeSeq += pin->GetNumber() + " ";
nodeSeq.Trim();

View File

@ -113,7 +113,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
dlg.SetPinNameTextSize( StringFromValue( g_UserUnit, pin->GetNameTextSize() ) );
dlg.SetPinPositionX( StringFromValue( g_UserUnit, pin->GetPosition().x ) );
dlg.SetPinPositionY( StringFromValue( g_UserUnit, -pin->GetPosition().y ) );
dlg.SetPadName( pin->GetNumberString() );
dlg.SetPadName( pin->GetNumber() );
dlg.SetPadNameTextSize( StringFromValue( g_UserUnit, pin->GetNumberTextSize() ) );
dlg.SetLength( StringFromValue( g_UserUnit, pin->GetLength() ) );
@ -520,7 +520,7 @@ void LIB_EDIT_FRAME::CreateImagePins( LIB_PIN* aPin, int aUnit, int aConvert, bo
// it does no have the save pin number as the master pin
// Because we do not know the actual number, give it '??'
wxString unknownNum( wxT( "??" ) );
NewPin->SetPinNumFromString( unknownNum );
NewPin->SetNumber( unknownNum );
if( aConvert != 0 )
NewPin->SetConvert( 1 );
@ -535,7 +535,7 @@ void LIB_EDIT_FRAME::CreateImagePins( LIB_PIN* aPin, int aUnit, int aConvert, bo
NewPin->SetConvert( 2 );
// Gives this pin a new pin number
// Because we do not know the actual number, give it '??'
NewPin->SetPinNumFromString( unknownNum );
NewPin->SetNumber( unknownNum );
if( aPin->GetUnit() != 0 )
NewPin->SetUnit( ii );
@ -643,9 +643,9 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
IncrementLabelMember( nextName, GetRepeatDeltaLabel() );
pin->SetName( nextName );
pin->PinStringNum( msg );
msg = pin->GetNumber();
IncrementLabelMember( msg, GetRepeatDeltaLabel() );
pin->SetPinNumFromString( msg );
pin->SetNumber( msg );
m_drawItem = pin;
@ -676,7 +676,7 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
// helper function to sort pins by pin num
bool sort_by_pin_number( const LIB_PIN* ref, const LIB_PIN* tst )
{
int test = ref->GetNumber() - tst->GetNumber();
int test = ref->GetNumber().Cmp( tst->GetNumber() );
if( test == 0 )
{
@ -725,8 +725,6 @@ void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event )
for( unsigned ii = 1; ii < pinList.size(); ii++ )
{
wxString stringPinNum, stringCurrPinNum;
LIB_PIN* curr_pin = pinList[ii];
LIB_PIN* pin = pinList[ii - 1];
@ -736,20 +734,18 @@ void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event )
continue;
dup_error++;
pin->PinStringNum( stringPinNum );
/* TODO I dare someone to find a way to make happy translators on
this thing! Lorenzo */
curr_pin->PinStringNum( stringCurrPinNum );
wxString msg = wxString::Format( _(
"<b>Duplicate pin %s</b> \"%s\" at location <b>(%.3f, %.3f)</b>"
" conflicts with pin %s \"%s\" at location <b>(%.3f, %.3f)</b>" ),
GetChars( stringCurrPinNum ),
GetChars( curr_pin->GetNumber() ),
GetChars( curr_pin->GetName() ),
curr_pin->GetPosition().x / 1000.0,
-curr_pin->GetPosition().y / 1000.0,
GetChars( stringPinNum ),
GetChars( pin->GetNumber() ),
GetChars( pin->GetName() ),
pin->GetPosition().x / 1000.0,
-pin->GetPosition().y / 1000.0
@ -786,12 +782,10 @@ void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event )
// "pin" is off grid here.
offgrid_error++;
wxString stringPinNum;
pin->PinStringNum( stringPinNum );
wxString msg = wxString::Format( _(
"<b>Off grid pin %s</b> \"%s\" at location <b>(%.3f, %.3f)</b>" ),
GetChars( stringPinNum ),
GetChars( pin->GetNumber() ),
GetChars( pin->GetName() ),
pin->GetPosition().x / 1000.0,
-pin->GetPosition().y / 1000.0

View File

@ -3022,7 +3022,7 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr< LIB_PART >& aPart,
parseUnquotedString( number, aReader, line, &line );
pin->SetName( name );
pin->SetPinNumFromString( number );
pin->SetNumber( number );
wxPoint pos;

View File

@ -104,7 +104,7 @@ void ARRAY_CREATOR::Invoke()
if( new_item->Type() == PCB_PAD_T )
{
const wxString padName = array_opts->GetItemNumber( ptN );
static_cast<D_PAD*>( new_item )->SetPadName( padName );
static_cast<D_PAD*>( new_item )->SetName( padName );
}
}
}

View File

@ -321,7 +321,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent
// At this point, the component footprint is updated. Now update the nets.
for( D_PAD* pad = aPcbComponent->PadsList(); pad; pad = pad->Next() )
{
COMPONENT_NET net = aNewComponent->GetNet( pad->GetPadName() );
COMPONENT_NET net = aNewComponent->GetNet( pad->GetName() );
if( !net.IsValid() ) // New footprint pad has no net.
{
@ -329,13 +329,13 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent
{
msg.Printf( _( "Disconnect component %s pin %s.\n" ),
GetChars( aPcbComponent->GetReference() ),
GetChars( pad->GetPadName() ) );
GetChars( pad->GetName() ) );
m_reporter->Report( msg, REPORTER::RPT_ACTION );
msg.Printf( _( "Clearing component \"%s:%s\" pin \"%s\" net name.\n" ),
GetChars( aPcbComponent->GetReference() ),
GetChars( aPcbComponent->GetPath() ),
GetChars( pad->GetPadName() ) );
GetChars( pad->GetName() ) );
m_reporter->Report( msg, REPORTER::RPT_INFO );
}
@ -380,14 +380,14 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent
{
msg.Printf( _( "Reconnect component %s pin %s from net %s to net %s.\n"),
GetChars( aPcbComponent->GetReference() ),
GetChars( pad->GetPadName() ),
GetChars( pad->GetName() ),
GetChars( pad->GetNetname() ),
GetChars( netName ) );
} else {
msg.Printf( _( "Connect component %s pin %s to net %s.\n"),
GetChars( aPcbComponent->GetReference() ),
GetChars( pad->GetPadName() ),
GetChars( pad->GetName() ),
GetChars( netName ) );
}
@ -397,7 +397,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent
"\"%s\" to \"%s\".\n" ),
GetChars( aPcbComponent->GetReference() ),
GetChars( aPcbComponent->GetPath() ),
GetChars( pad->GetPadName() ),
GetChars( pad->GetName() ),
GetChars( pad->GetNetname() ),
GetChars( netName ) );
m_reporter->Report( msg, REPORTER::RPT_INFO );
@ -521,7 +521,7 @@ bool BOARD_NETLIST_UPDATER::deleteSinglePadNets()
msg.Printf( _( "Remove single pad net \"%s\" on \"%s\" pad '%s'\n" ),
GetChars( previouspad->GetNetname() ),
GetChars( previouspad->GetParent()->GetReference() ),
GetChars( previouspad->GetPadName() ) );
GetChars( previouspad->GetName() ) );
m_reporter->Report( msg, REPORTER::RPT_ACTION );
previouspad->SetNetCode( NETINFO_LIST::UNCONNECTED );

View File

@ -2593,7 +2593,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
// At this point, the component footprint is updated. Now update the nets.
for( auto pad : footprint->Pads() )
{
COMPONENT_NET net = component->GetNet( pad->GetPadName() );
COMPONENT_NET net = component->GetNet( pad->GetName() );
if( !net.IsValid() ) // Footprint pad had no net.
{
@ -2602,7 +2602,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
msg.Printf( _( "Clearing component \"%s:%s\" pin \"%s\" net name.\n" ),
GetChars( footprint->GetReference() ),
GetChars( footprint->GetPath() ),
GetChars( pad->GetPadName() ) );
GetChars( pad->GetName() ) );
aReporter->Report( msg, REPORTER::RPT_ACTION );
}
@ -2622,7 +2622,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
"\"%s\" to \"%s\".\n" ),
GetChars( footprint->GetReference() ),
GetChars( footprint->GetPath() ),
GetChars( pad->GetPadName() ),
GetChars( pad->GetName() ),
GetChars( pad->GetNetname() ),
GetChars( net.GetNetName() ) );
aReporter->Report( msg, REPORTER::RPT_ACTION );
@ -2736,7 +2736,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
msg.Printf( _( "Remove single pad net \"%s\" on \"%s\" pad '%s'\n" ),
GetChars( pad->GetNetname() ),
GetChars( pad->GetParent()->GetReference() ),
GetChars( pad->GetPadName() ) );
GetChars( pad->GetName() ) );
aReporter->Report( msg, REPORTER::RPT_ACTION );
}

View File

@ -373,7 +373,7 @@ void MODULE::CopyNetlistSettings( MODULE* aModule, bool aCopyLocalSettings )
// because we copy settings from the first pad found.
// When old and new footprints have very few differences, a better
// algo can be used.
D_PAD* oldPad = FindPadByName( pad->GetPadName() );
D_PAD* oldPad = FindPadByName( pad->GetName() );
if( oldPad )
oldPad->CopyNetlistSettings( pad, aCopyLocalSettings );
@ -642,16 +642,9 @@ bool MODULE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) co
D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const
{
wxString buf;
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{
pad->StringPadName( buf );
#if 1
if( buf.CmpNoCase( aPadName ) == 0 ) // why case insensitive?
#else
if( buf == aPadName )
#endif
if( pad->GetName().CmpNoCase( aPadName ) == 0 ) // why case insensitive?
return pad;
}
@ -716,7 +709,7 @@ unsigned MODULE::GetPadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
unsigned MODULE::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
{
std::set<wxUint32> usedNames;
std::set<wxString> usedNames;
// Create a set of used pad numbers
for( D_PAD* pad = PadsList(); pad; pad = pad->Next() )
@ -728,7 +721,7 @@ unsigned MODULE::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
// Skip pads with no name, because they are usually "mechanical"
// pads, not "electrical" pads
if( pad->GetPadName().IsEmpty() )
if( pad->GetName().IsEmpty() )
continue;
if( !aIncludeNPTH )
@ -740,7 +733,7 @@ unsigned MODULE::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
}
}
usedNames.insert( pad->GetPackedPadName() );
usedNames.insert( pad->GetName() );
}
return usedNames.size();
@ -1215,7 +1208,7 @@ wxString MODULE::GetNextPadName( bool aFillSequenceGaps ) const
// Create a set of used pad numbers
for( D_PAD* pad = PadsList(); pad; pad = pad->Next() )
{
int padNumber = getTrailingInt( pad->GetPadName() );
int padNumber = getTrailingInt( pad->GetName() );
usedNumbers.insert( padNumber );
}

View File

@ -59,7 +59,6 @@ int D_PAD::m_PadSketchModePenSize = 0; // Pen size used to draw pads in ske
D_PAD::D_PAD( MODULE* parent ) :
BOARD_CONNECTED_ITEM( parent, PCB_PAD_T )
{
m_NumPadName = 0;
m_Size.x = m_Size.y = Mils2iu( 60 ); // Default pad size 60 mils.
m_Drill.x = m_Drill.y = Mils2iu( 30 ); // Default drill size 30 mils.
m_Orient = 0; // Pad rotation in 1/10 degrees.
@ -513,54 +512,12 @@ wxPoint D_PAD::ShapePos() const
}
wxString D_PAD::GetPadName() const
{
wxString name;
StringPadName( name );
return name;
}
void D_PAD::StringPadName( wxString& text ) const
{
text.Empty();
for( int ii = 0; ii < PADNAMEZ && m_Padname[ii]; ii++ )
{
// m_Padname is 8 bit KiCad font junk, do not sign extend
text.Append( (unsigned char) m_Padname[ii] );
}
}
// Change pad name
void D_PAD::SetPadName( const wxString& name )
{
int ii, len;
len = name.Length();
if( len > PADNAMEZ )
len = PADNAMEZ;
// m_Padname[] is not UTF8, it is an 8 bit character that matches the KiCad font,
// so only copy the lower 8 bits of each character.
for( ii = 0; ii < len; ii++ )
m_Padname[ii] = (char) name.GetChar( ii );
for( ii = len; ii < PADNAMEZ; ii++ )
m_Padname[ii] = '\0';
}
bool D_PAD::IncrementPadName( bool aSkipUnconnectable, bool aFillSequenceGaps )
{
bool skip = aSkipUnconnectable && ( GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED );
if( !skip )
SetPadName( GetParent()->GetNextPadName( aFillSequenceGaps ) );
SetName( GetParent()->GetNextPadName( aFillSequenceGaps ) );
return !skip;
}
@ -733,10 +690,8 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
if( module )
{
wxString msg = module->GetReference();
aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), msg, DARKCYAN ) );
StringPadName( Line );
aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), Line, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), module->GetReference(), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), m_name, BROWN ) );
}
aList.push_back( MSG_PANEL_ITEM( _( "Net" ), GetNetname(), DARKCYAN ) );
@ -1225,7 +1180,7 @@ wxString D_PAD::GetSelectMenuText() const
{
wxString text;
wxString padlayers( LayerMaskDescribe( GetBoard(), m_layerMask ) );
wxString padname( GetPadName() );
wxString padname( GetName() );
if( padname.IsEmpty() )
{
@ -1236,7 +1191,7 @@ wxString D_PAD::GetSelectMenuText() const
else
{
text.Printf( _( "Pad %s on %s of %s" ),
GetChars(GetPadName() ), GetChars( padlayers ),
GetChars(GetName() ), GetChars( padlayers ),
GetChars(GetParent()->GetReference() ) );
}
@ -1298,7 +1253,7 @@ void D_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() : "<null>",
GetPadName().IsEmpty() ? "(unnamed)" : GetPadName() );
GetName().IsEmpty() ? "(unnamed)" : GetName() );
wxLogWarning( msg );
}
#endif

View File

@ -162,24 +162,20 @@ public:
/**
* Set the pad name (sometimes called pad number, although
* it can be an array ref like AA12
* the pad name is limited to 4 ASCII chars
* it can be an array reference like AA12).
*/
void SetPadName( const wxString& name ); // Change pad name
void SetName( const wxString& aName )
{
m_name = aName;
}
/**
* @return the pad name
* the pad name is limited to 4 ASCII chars
*/
wxString GetPadName() const;
/**
* @return the pad name in a wxUint32 which is possible
* because the pad name is limited to 4 ASCII chars
* The packed pad name should be used only to compare 2
* pad names, not to try to print this name
*/
wxUint32 GetPackedPadName() const { return m_NumPadName; }
const wxString& GetName() const
{
return m_name;
}
/**
* Function IncrementPadName
@ -195,7 +191,7 @@ public:
bool PadNameEqual( const D_PAD* other ) const
{
return m_NumPadName == other->m_NumPadName; // hide tricks behind sensible API
return m_name == other->m_name; // hide tricks behind sensible API
}
/**
@ -564,8 +560,6 @@ public:
int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd,
double aRotation, const wxSize& aMargin ) const;
void StringPadName( wxString& text ) const; // Return pad name as string in a buffer
/**
* Function GetBoundingRadius
* returns the radius of a minimum sized circle which fully encloses this pad.
@ -736,16 +730,7 @@ private: // Private variable members:
// Actually computed and cached on demand by the accessor
mutable int m_boundingRadius; ///< radius of the circle containing the pad shape
#ifndef SWIG
/// Pad name (4 char) or a long identifier (used in pad name
/// comparisons because this is faster than string comparison)
union
{
#define PADNAMEZ 4
char m_Padname[PADNAMEZ]; // zero padded at end to full size
wxUint32 m_NumPadName; // same number of bytes as m_Padname[]
};
#endif
wxString m_name;
wxPoint m_Pos; ///< pad Position on board

View File

@ -669,20 +669,16 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
* chars. Of course, pads numbers and nets names can have less than 3
* chars. but after some tries, i found this is gives the best look
*/
#define MIN_CHAR_COUNT 3
wxString buffer;
constexpr int MIN_CHAR_COUNT = 3;
int tsize;
unsigned int tsize;
EDA_RECT* clipBox = aDrawInfo.m_DrawPanel?
aDrawInfo.m_DrawPanel->GetClipBox() : NULL;
if( aDrawInfo.m_Display_padnum )
{
StringPadName( buffer );
int numpad_len = buffer.Len();
numpad_len = std::max( numpad_len, MIN_CHAR_COUNT );
tsize = std::min( AreaSize.y, AreaSize.x / numpad_len );
int numpad_len = std::max( (int) m_name.Length(), MIN_CHAR_COUNT );
tsize = std::min( (int) AreaSize.y, AreaSize.x / numpad_len );
if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE ) // Not drawable when size too small.
{
@ -690,7 +686,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
tsize = ( tsize * 7 ) / 10;
DrawGraphicHaloText( clipBox, aDC, tpos,
aDrawInfo.m_Color, BLACK, WHITE,
buffer, t_angle,
m_name, t_angle,
wxSize( tsize , tsize ), GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_CENTER, tsize / 7, false, false );

View File

@ -174,7 +174,7 @@ std::string FormatProbeItem( BOARD_ITEM* aItem )
case PCB_PAD_T:
{
module = (MODULE*) aItem->GetParent();
wxString pad = ((D_PAD*)aItem)->GetPadName();
wxString pad = ((D_PAD*)aItem)->GetName();
return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"",
TO_UTF8( module->GetReference() ),

View File

@ -464,7 +464,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
m_staticTextWarningPadFlipped->Show(m_isFlipped);
m_PadNumCtrl->SetValue( m_dummyPad->GetPadName() );
m_PadNumCtrl->SetValue( m_dummyPad->GetName() );
m_PadNetNameCtrl->SetValue( m_dummyPad->GetNetname() );
// Set the unit name in dialog:
@ -1306,7 +1306,7 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
m_currentPad->SetLayerSet( FlipLayerMask( m_currentPad->GetLayerSet() ) );
}
m_currentPad->SetPadName( m_padMaster->GetPadName() );
m_currentPad->SetName( m_padMaster->GetName() );
wxString padNetname;
@ -1513,9 +1513,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
aPad->SetOffset( wxPoint( x, y ) );
aPad->SetOrientation( m_OrientValue * 10.0 );
msg = m_PadNumCtrl->GetValue().Left( 4 );
aPad->SetPadName( msg );
aPad->SetName( m_PadNumCtrl->GetValue() );
// Check if user has set an existing net name
const NETINFO_ITEM* netinfo = m_board->FindNet( m_PadNetNameCtrl->GetValue() );
@ -1595,7 +1593,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
// Mechanical purpose only:
// no offset, no net name, no pad name allowed
aPad->SetOffset( wxPoint( 0, 0 ) );
aPad->SetPadName( wxEmptyString );
aPad->SetName( wxEmptyString );
aPad->SetNetCode( NETINFO_LIST::UNCONNECTED );
break;

View File

@ -858,7 +858,7 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements )
// update the nets within the pads of the clone
for( D_PAD* pad = m->PadsList(); pad; pad = pad->Next() )
{
string pn_key = makeKey( e.name, TO_UTF8( pad->GetPadName() ) );
string pn_key = makeKey( e.name, TO_UTF8( pad->GetName() ) );
NET_MAP_CITER ni = m_pads_to_nets.find( pn_key );
if( ni != m_pads_to_nets.end() )
@ -1255,7 +1255,7 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, wxXmlNode* aTree ) const
D_PAD* pad = new D_PAD( aModule );
aModule->PadsList().PushBack( pad );
pad->SetPadName( FROM_UTF8( e.name.c_str() ) );
pad->SetName( FROM_UTF8( e.name.c_str() ) );
// pad's "Position" is not relative to the module's,
// whereas Pos0 is relative to the module's but is the unrotated coordinate.
@ -1572,7 +1572,7 @@ void EAGLE_PLUGIN::packageHole( MODULE* aModule, wxXmlNode* aTree ) const
// Mechanical purpose only:
// no offset, no net name, no pad name allowed
// pad->SetOffset( wxPoint( 0, 0 ) );
// pad->SetPadName( wxEmptyString );
// pad->SetName( wxEmptyString );
wxPoint padpos( kicad_x( e.x ), kicad_y( e.y ) );
@ -1601,7 +1601,7 @@ void EAGLE_PLUGIN::packageSMD( MODULE* aModule, wxXmlNode* aTree ) const
D_PAD* pad = new D_PAD( aModule );
aModule->PadsList().PushBack( pad );
pad->SetPadName( FROM_UTF8( e.name.c_str() ) );
pad->SetName( FROM_UTF8( e.name.c_str() ) );
pad->SetShape( PAD_SHAPE_RECT );
pad->SetAttribute( PAD_ATTRIB_SMD );

View File

@ -128,8 +128,8 @@ static void build_pad_testpoints( BOARD *aPcb,
if( rk.access != -1 )
{
rk.netname = pad->GetNetname();
rk.pin = pad->GetName();
rk.refdes = module->GetReference();
pad->StringPadName( rk.pin );
rk.midpoint = false; // XXX MAYBE need to be computed (how?)
const wxSize& drill = pad->GetDrillSize();
rk.drill = std::min( drill.x, drill.y );

View File

@ -660,7 +660,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
layer = module->GetFlag() ? "BOTTOM" : "TOP";
}
pad->StringPadName( pinname );
pinname = pad->GetName();
if( pinname.IsEmpty() )
pinname = wxT( "none" );
@ -796,15 +796,12 @@ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb )
{
for( pad = module->PadsList(); pad; pad = pad->Next() )
{
wxString padname;
if( pad->GetNetCode() != net->GetNet() )
continue;
pad->StringPadName( padname );
msg.Printf( wxT( "NODE %s %s" ),
GetChars( module->GetReference() ),
GetChars( padname ) );
GetChars( pad->GetName() ) );
fputs( TO_UTF8( msg ), aFile );
fputs( "\n", aFile );

View File

@ -303,7 +303,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule,
kplate = IDF3::PTH;
// hole type
tstr = TO_UTF8( pad->GetPadName() );
tstr = TO_UTF8( pad->GetName() );
if( tstr.empty() || !tstr.compare( "0" ) || !tstr.compare( "~" )
|| ( kplate == IDF3::NPTH )

View File

@ -719,7 +719,7 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool
for( D_PAD* pad = Module->PadsList(); pad != NULL; pad = pad->Next() )
{
fprintf( rptfile, "$PAD \"%s\"\n", TO_UTF8( pad->GetPadName() ) );
fprintf( rptfile, "$PAD \"%s\"\n", TO_UTF8( pad->GetName() ) );
int layer = 0;
if( pad->GetLayerSet()[B_Cu] )

View File

@ -667,7 +667,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( 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->SetPadName( parameters[paramCnt-3] );
pad->SetName( parameters[paramCnt-3] );
int x1 = parseInt( parameters[2], conv_unit );
int x2 = parseInt( parameters[4], conv_unit );
@ -749,7 +749,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( 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->SetPadName( parameters[paramCnt-3] );
pad->SetName( parameters[paramCnt-3] );
wxPoint padPos( parseInt( parameters[2], conv_unit ),
parseInt( parameters[3], conv_unit ) );

View File

@ -1264,7 +1264,7 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
}
m_out->Print( aNestLevel, "(pad %s %s %s",
m_out->Quotew( aPad->GetPadName() ).c_str(),
m_out->Quotew( aPad->GetName() ).c_str(),
type, shape );
m_out->Print( 0, " (at %s", FMT_IU( aPad->GetPos0() ).c_str() );

View File

@ -43,7 +43,7 @@ class NETINFO_MAPPING;
// // went to 32 Cu layers from 16.
//#define SEXPR_BOARD_FILE_VERSION 20160815 // differential pair settings per net class
//#define SEXPR_BOARD_FILE_VERSION 20170123 // EDA_TEXT refactor, moved 'hide'
#define SEXPR_BOARD_FILE_VERSION 20170919 // custom pad shape
#define SEXPR_BOARD_FILE_VERSION 20170920 // long pad names
#define CTL_STD_LAYER_NAMES (1 << 0) ///< Use English Standard layer names
#define CTL_OMIT_NETS (1 << 1) ///< Omit pads net names (useless in library)

View File

@ -1453,7 +1453,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
}
// chances are both were ASCII, but why take chances?
pad->SetPadName( padname );
pad->SetName( padname );
pad->SetShape( PAD_SHAPE_T( padshape ) );
pad->SetSize( wxSize( size_x, size_y ) );
pad->SetDelta( wxSize( delta_x, delta_y ) );

View File

@ -215,7 +215,7 @@ MODULE* PCB_EDIT_FRAME::CreateMuWaveBaseFootprint( const wxString& aValue,
pad->SetLayerSet( F_Cu );
Line.Printf( wxT( "%d" ), pad_num );
pad->SetPadName( Line );
pad->SetName( Line );
pad_num++;
}
@ -329,7 +329,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
break;
case 1: //Stub :
pad->SetPadName( wxT( "1" ) );
pad->SetName( wxT( "1" ) );
pad = pad->Next();
pad->SetY0( -( gap_size + pad->GetSize().y ) / 2 );
pad->SetSize( wxSize( pad->GetSize().x, gap_size ) );

View File

@ -369,7 +369,7 @@ MODULE* MWAVE::CreateMicrowaveInductor( INDUCTOR_PATTERN& inductorPattern,
module->PadsList().PushFront( pad );
pad->SetPadName( "1" );
pad->SetName( "1" );
pad->SetPosition( inductorPattern.m_End );
pad->SetPos0( pad->GetPosition() - module->GetPosition() );
@ -384,7 +384,7 @@ MODULE* MWAVE::CreateMicrowaveInductor( INDUCTOR_PATTERN& inductorPattern,
module->PadsList().Insert( newpad, pad->Next() );
pad = newpad;
pad->SetPadName( "2" );
pad->SetName( "2" );
pad->SetPosition( inductorPattern.m_Start );
pad->SetPos0( pad->GetPosition() - module->GetPosition() );

View File

@ -142,11 +142,11 @@ void PCB_BASE_FRAME::AddPad( MODULE* aModule, bool draw )
if( pad->GetAttribute() != PAD_ATTRIB_HOLE_NOT_PLATED )
{
padName = GetNextPadName( GetDesignSettings()
.m_Pad_Master.GetPadName() );
.m_Pad_Master.GetName() );
}
pad->SetPadName( padName );
GetDesignSettings().m_Pad_Master.SetPadName( padName );
pad->SetName( padName );
GetDesignSettings().m_Pad_Master.SetName( padName );
aModule->CalculateBoundingBox();
SetMsgPanel( pad );

View File

@ -374,7 +374,7 @@ void PCB::DoPCBComponents( XNODE* aNode,
break;
mNode->GetAttribute( wxT( "Name" ), &propValue );
mc->SetPadName( str, propValue );
mc->SetName( str, propValue );
mNode = mNode->GetNext();
}
else

View File

@ -372,7 +372,7 @@ void PCB_MODULE::DoLayerContentsObjects( XNODE* aNode,
}
void PCB_MODULE::SetPadName( wxString aPin, wxString aName )
void PCB_MODULE::SetName( wxString aPin, wxString aName )
{
int i;
long num;
@ -465,7 +465,7 @@ void PCB_MODULE::Parse( XNODE* aNode, wxStatusBar* aStatusBar,
break;
mNode->GetAttribute( wxT( "Name" ), &propValue );
SetPadName( str, propValue );
SetName( str, propValue );
mNode = mNode->GetNext();
}
else

View File

@ -57,7 +57,7 @@ public:
wxString aDefaultMeasurementUnit,
wxString aActualConversion );
void SetPadName( wxString aPin, wxString aName );
void SetName( wxString aPin, wxString aName );
virtual void Parse( XNODE* aNode, wxStatusBar* aStatusBar,
wxString aDefaultMeasurementUnit, wxString aActualConversion );

View File

@ -245,7 +245,7 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation, bool aEncapsulatedPad
// actually this is a thru-hole pad
pad->SetLayerSet( LSET::AllCuMask() | LSET( 2, B_Mask, F_Mask ) );
pad->SetPadName( m_name.text );
pad->SetName( m_name.text );
if( padShapeName == wxT( "Oval" )
|| padShapeName == wxT( "Ellipse" )

View File

@ -548,7 +548,6 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
PAD_SHAPE_T shape;
double m, n;
double orientation = aPad->GetOrientation();
wxString buffer;
// Draw description layer
if( IsNetnameLayer( aLayer ) )
@ -624,10 +623,9 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
if( m_pcbSettings.m_padNumbers )
{
const wxString& padName = aPad->GetName();
textpos.y = -textpos.y;
aPad->StringPadName( buffer );
int len = buffer.Length();
double tsize = 1.5 * padsize.x / len;
double tsize = 1.5 * padsize.x / padName.Length();
tsize = std::min( tsize, size );
// Use a smaller text size to handle interline, pen size..
tsize *= 0.7;
@ -636,7 +634,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
m_gal->SetGlyphSize( numsize );
m_gal->SetLineWidth( numsize.x / 12.0 );
m_gal->BitmapText( aPad->GetPadName(), textpos, 0.0 );
m_gal->BitmapText( padName, textpos, 0.0 );
}
m_gal->Restore();

View File

@ -2248,7 +2248,7 @@ D_PAD* PCB_PARSER::parseD_PAD( MODULE* aParent )
std::unique_ptr< D_PAD > pad( new D_PAD( aParent ) );
NeedSYMBOLorNUMBER();
pad->SetPadName( FromUTF8() );
pad->SetName( FromUTF8() );
T token = NextTok();

View File

@ -80,7 +80,7 @@ void BRDITEMS_PLOTTER::PlotPad( D_PAD* aPad, COLOR4D aColor, EDA_DRAW_MODE_T aPl
gbr_metadata.SetCopper( true );
if( isOnExternalCopperLayer )
gbr_metadata.SetPadName( aPad->GetPadName() );
gbr_metadata.SetPadName( aPad->GetName() );
gbr_metadata.SetNetName( aPad->GetNetname() );
@ -88,7 +88,7 @@ void BRDITEMS_PLOTTER::PlotPad( D_PAD* aPad, COLOR4D aColor, EDA_DRAW_MODE_T aPl
// 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_HOLE_NOT_PLATED ||
aPad->GetPadName().IsEmpty() )
aPad->GetName().IsEmpty() )
gbr_metadata.m_NetlistMetadata.m_NotInNet = true;
if( !isOnExternalCopperLayer || !isPadOnBoardTechLayers )

View File

@ -27,7 +27,7 @@ def smdRectPad(module,size,pos,name):
pad.SetAttribute(PAD_ATTRIB_SMD)
pad.SetLayerSet(pad.SMDMask())
pad.SetPos0(pos)
pad.SetPadName(name)
pad.SetName(name)
return pad
for n in range (0,pads):

View File

@ -27,7 +27,7 @@ for y in range (0,10):
pt = wxPointMM(1.27*x,1.27*y)
pad.SetPos0(pt);
#pad.SetPosition(pt)
pad.SetPadName(str(n))
pad.SetName(str(n))
module.Add(pad)
n+=1
@ -42,7 +42,7 @@ print map( lambda x: x.GetReference() , list(pcb.GetModules()))
for m in pcb.GetModules():
for p in m.Pads():
print p.GetPadName(), p.GetPosition(), p.GetOffset()
print p.GetName(), p.GetPosition(), p.GetOffset()
# pcb.GetDesignSettings()

View File

@ -51,7 +51,7 @@ class FPC_FootprintWizard(FootprintWizardBase.FootprintWizard):
pad.SetLayerSet( pad.SMDMask() )
pad.SetPos0(pos)
pad.SetPosition(pos)
pad.SetPadName(name)
pad.SetName(name)
return pad
def CheckParameters(self):

View File

@ -165,7 +165,7 @@ class PadGridArray(PadArray):
posY = pin1posY + (self.py * y)
pos = dc.TransformPoint(posX, posY)
pad = self.GetPad(x == 0 and y == 0, pos)
pad.SetPadName(self.GetName(x,y))
pad.SetName(self.GetName(x,y))
self.AddPad(pad)
class EPADGridArray(PadGridArray):
@ -207,7 +207,7 @@ class PadZGridArray(PadArray):
pos = dc.TransformPoint(posX, posY)
pad = self.GetPad(padnum == 0, pos)
pad.SetPadName(self.GetName(padnum))
pad.SetName(self.GetName(padnum))
self.AddPad(pad)
line += 1
@ -255,7 +255,7 @@ class PadCircleArray(PadArray):
pos_y = -math.cos(angle * math.pi / 180) * self.r
pos = dc.TransformPoint(pos_x, pos_y)
pad = self.GetPad(pin == 0, pos)
pad.SetPadName(self.GetName(pin))
pad.SetName(self.GetName(pin))
self.AddPad(pad)
class PadCustomArray(PadArray):
@ -277,5 +277,5 @@ class PadCustomArray(PadArray):
for i in range(len(self.array)):
pos = dc.TransformPoint(self.array[i][0], self.array[i][1])
pad = self.GetPad(i == 0, pos)
pad.SetPadName(self.GetName(i))
pad.SetName(self.GetName(i))
self.AddPad(pad)

View File

@ -74,7 +74,7 @@ class PadStaggeredZGridArray(PA.PadArray):
pos = dc.TransformPoint(posX, posY)
pad = self.GetPad(padnum == 0, pos)
pad.SetPadName(self.GetName(padnum))
pad.SetName(self.GetName(padnum))
self.AddPad(pad)
line += 1

View File

@ -150,7 +150,7 @@ class QFNWizard(FootprintWizardBase.FootprintWizard):
layers = pcbnew.LSET(pcbnew.F_Mask)
layers.AddLayer(pcbnew.F_Cu)
layers.AddLayer(pcbnew.F_Paste)
epad.SetPadName(epad_num)
epad.SetName(epad_num)
array = PA.EPADGridArray( epad, epad_ny, epad_nx, epad_l, epad_w, pcbnew.wxPoint(0,0) )
array.SetFirstPadInArray(epad_num)

View File

@ -86,7 +86,7 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
layerset.AddLayer(pcbnew.F_Mask)
pad.SetLayerSet( layerset )
pad.SetPosition(pcbnew.wxPoint(xposition,yposition))
pad.SetPadName("1")
pad.SetName("1")
self.module.Add(pad)
if self.UseSilkS:
polygon=self.drawSquareArea(pcbnew.F_SilkS, self.X, xposition, yposition)

View File

@ -70,7 +70,7 @@ class TouchSliderWizard(FootprintWizardBase.FootprintWizard):
pad.SetLayerSet(pad.ConnSMDMask())
pad.SetPos0(pos)
pad.SetPosition(pos)
pad.SetPadName(name)
pad.SetName(name)
return pad
@ -82,7 +82,7 @@ class TouchSliderWizard(FootprintWizardBase.FootprintWizard):
pad.SetLayerSet(pad.ConnSMDMask())
pad.SetPos0(pos)
pad.SetPosition(pos)
pad.SetPadName(name)
pad.SetName(name)
pad.SetDelta(wxSize(left_right*size[1],up_down*size[0]))
return pad

View File

@ -562,7 +562,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
PIN* pin = new PIN( image );
padName = pad->GetPadName();
padName = pad->GetName();
pin->pin_id = TO_UTF8( padName );
if( padName!=wxEmptyString && pinmap.find( padName )==pinmap.end() )

View File

@ -5,7 +5,7 @@ pcb = pcbnew.GetBoard()
for m in pcb.GetModules():
print m.GetPosition()
for p in m.Pads():
print "p=>",p.GetPosition(),p.GetPadName()
print "p=>",p.GetPosition(),p.GetName()
print p.GetPosition()

View File

@ -5,4 +5,4 @@ pcb = pcbnew.GetBoard()
for m in pcb.GetModules():
print m.GetReference(),"(",m.GetValue(),") at ", m.GetPosition()
for p in m.Pads():
print " pad",p.GetPadName(), "at",p.GetPosition()
print " pad",p.GetName(), "at",p.GetPosition()

View File

@ -209,8 +209,8 @@ int MODULE_EDITOR_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
// Rename pad and store the old name
wxString newName = wxString::Format( wxT( "%s%d" ), padPrefix.c_str(), padNumber++ );
oldNames[newName] = pad->GetPadName();
pad->SetPadName( newName );
oldNames[newName] = pad->GetName();
pad->SetName( newName );
pad->SetSelected();
getView()->Update( pad );
}
@ -218,12 +218,12 @@ int MODULE_EDITOR_TOOLS::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->GetPadName() );
auto it = oldNames.find( pad->GetName() );
wxASSERT( it != oldNames.end() );
if( it != oldNames.end() )
{
pad->SetPadName( it->second );
pad->SetName( it->second );
oldNames.erase( it );
}