← Back to team overview

kicad-developers team mailing list archive

[RFC] Long pin numbers/pad names support

 

Hi,

TL;DR: I seek your input regarding support for long pin numbers and pad
names. Perhaps it might not be perceived as a frequently used feature,
but the four characters restriction for names is an obstacle for import
plugins.

As I understand, the decision to use an union of integer and char[4] for
pin numbers and pad names was to speed up comparisons. On the other
hand, there are many places that copy a pin number/pad name to a
temporary wxString (e.g. LIB_PIN::PinStringNum(),
D_PAD::StringPadName()), instead of referencing the names directly, so
the fast comparison benefit might be reduced in other places. Another
minor thing is IMHO the code in the current form is more concise and
easier to read.

I decided to instrument the code to see the change impact. I picked the
parts that perform many comparisons: for pins it is loading a library,
as on every LIB_PART::AddDrawItem() the items are sorted, and for boards
it is reloading a netlist that calls MODULE::FindPadByName() frequently.

* Loading libraries (time to load a subset of standard KiCad libraries;
benchmarking LIB_PIN::compare()):
    w/o long pin number support: ~8 s
    with long pin number support: ~9 s

You can notice a ~12% penalty for the long pin number support. Later I
am going to investigate whether we need to sort LIB_ITEMs as often as we
do currently, but it is another topic.

* Importing a netlist to an empty board (time to import c4puter
motherboard [1] netlist; benchmarking MODULE::FindPadByName()):
    with long pin number support: ~3.2 s
    w/o long pin number support: ~3.3 s

In this case the performance drop is ~3%, but the time difference is so
low that the profile timer resolution can be at play.

The price to pay for the feature is a file format version bump, both for
eeschema and pcbnew. Are we okay with that?

Patch 0003 changes D_PAD::{S,G}etPadName() to D_PAD::{S,G}etName(), as
it seems a bit clearer to me. The drawback is the risk of breaking a
number of Python plugins that use the old method names. Any thoughts?

Regards,
Orson

1. https://github.com/c4puter/motherboard.git
>From b3eb8eae861518a31111b0119f40b35fa83b8ce1 Mon Sep 17 00:00:00 2001
From: Maciej Suminski <maciej.suminski@xxxxxxx>
Date: Thu, 10 Aug 2017 17:00:28 +0200
Subject: [PATCH 1/4] Enable long names for pin numbers and pads

- pad names are stored as wxString instead of a char[4] & integer union
- removed pad name to string conversion functions
- fixed pad & pin properties dialog restrictions regarding the name
length
---
 eeschema/class_libentry.cpp                        |  10 +-
 eeschema/class_netlist_object.cpp                  |   5 +-
 eeschema/class_netlist_object.h                    |   9 +-
 eeschema/cross-probing.cpp                         |   8 +-
 eeschema/dialogs/dialog_lib_edit_pin_table.cpp     |   2 +-
 eeschema/lib_pin.cpp                               | 124 ++++-----------------
 eeschema/lib_pin.h                                 |  48 +++-----
 .../netlist_exporters/netlist_exporter_generic.cpp |   4 +-
 .../netlist_exporters/netlist_exporter_pspice.cpp  |   2 +-
 eeschema/pinedit.cpp                               |  24 ++--
 eeschema/sch_legacy_plugin.cpp                     |   2 +-
 pcbnew/class_module.cpp                            |  13 +--
 pcbnew/class_pad.cpp                               |  49 +-------
 pcbnew/class_pad.h                                 |  37 ++----
 pcbnew/class_pad_draw_functions.cpp                |  14 +--
 pcbnew/dialogs/dialog_pad_properties.cpp           |   4 +-
 pcbnew/exporters/export_d356.cpp                   |   2 +-
 pcbnew/exporters/export_gencad.cpp                 |   7 +-
 pcbnew/pcb_painter.cpp                             |   8 +-
 19 files changed, 88 insertions(+), 284 deletions(-)

diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp
index fd01fff55..f6204a5ea 100644
--- a/eeschema/class_libentry.cpp
+++ b/eeschema/class_libentry.cpp
@@ -645,7 +645,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 );
@@ -654,9 +653,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];
     }
 
@@ -685,10 +682,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?
diff --git a/eeschema/class_netlist_object.cpp b/eeschema/class_netlist_object.cpp
index 2403d8bf2..b7c776319 100644
--- a/eeschema/class_netlist_object.cpp
+++ b/eeschema/class_netlist_object.cpp
@@ -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
diff --git a/eeschema/class_netlist_object.h b/eeschema/class_netlist_object.h
index 772b5fdff..0fea054a8 100644
--- a/eeschema/class_netlist_object.h
+++ b/eeschema/class_netlist_object.h
@@ -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):
diff --git a/eeschema/cross-probing.cpp b/eeschema/cross-probing.cpp
index cf8930720..3175038ae 100644
--- a/eeschema/cross-probing.cpp
+++ b/eeschema/cross-probing.cpp
@@ -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
diff --git a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp
index f087ac557..2a063c3aa 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp
@@ -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 )
diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp
index 6a7cd337b..f3213cc7a 100644
--- a/eeschema/lib_pin.cpp
+++ b/eeschema/lib_pin.cpp
@@ -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,11 +2291,10 @@ 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();
+            *aFindLocation = GetBoundingBox().Centre();
 
         return true;
     }
@@ -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";
diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h
index 5134e34d9..ff8b9a275 100644
--- a/eeschema/lib_pin.h
+++ b/eeschema/lib_pin.h
@@ -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.
diff --git a/eeschema/netlist_exporters/netlist_exporter_generic.cpp b/eeschema/netlist_exporters/netlist_exporter_generic.cpp
index 99424a0fa..1c3a349b8 100644
--- a/eeschema/netlist_exporters/netlist_exporter_generic.cpp
+++ b/eeschema/netlist_exporters/netlist_exporter_generic.cpp
@@ -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;
 }
diff --git a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp
index 093bd17f5..badb91e98 100644
--- a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp
+++ b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp
@@ -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();
 
diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp
index 1f40a39cf..ab4a2ba1d 100644
--- a/eeschema/pinedit.cpp
+++ b/eeschema/pinedit.cpp
@@ -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
diff --git a/eeschema/sch_legacy_plugin.cpp b/eeschema/sch_legacy_plugin.cpp
index 21def36a5..c184d89df 100644
--- a/eeschema/sch_legacy_plugin.cpp
+++ b/eeschema/sch_legacy_plugin.cpp
@@ -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;
 
diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp
index fe4750509..7f4a58f71 100644
--- a/pcbnew/class_module.cpp
+++ b/pcbnew/class_module.cpp
@@ -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->GetPadName().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() )
@@ -740,7 +733,7 @@ unsigned MODULE::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
             }
         }
 
-        usedNames.insert( pad->GetPackedPadName() );
+        usedNames.insert( pad->GetPadName() );
     }
 
     return usedNames.size();
diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp
index fc1dd927b..bced87077 100644
--- a/pcbnew/class_pad.cpp
+++ b/pcbnew/class_pad.cpp
@@ -60,7 +60,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.
@@ -430,48 +429,6 @@ 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 );
@@ -650,10 +607,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 ) );
diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h
index af78eff11..537b67401 100644
--- a/pcbnew/class_pad.h
+++ b/pcbnew/class_pad.h
@@ -123,24 +123,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 SetPadName( 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& GetPadName() const
+    {
+        return m_name;
+    }
 
     /**
      * Function IncrementPadName
@@ -156,7 +152,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
     }
 
     /**
@@ -418,8 +414,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.
@@ -590,16 +584,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
 
diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp
index 050df2216..ec5ec1a4b 100644
--- a/pcbnew/class_pad_draw_functions.cpp
+++ b/pcbnew/class_pad_draw_functions.cpp
@@ -582,20 +582,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.
         {
@@ -603,7 +599,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 );
 
diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp
index 7a184cbb9..e738a9826 100644
--- a/pcbnew/dialogs/dialog_pad_properties.cpp
+++ b/pcbnew/dialogs/dialog_pad_properties.cpp
@@ -1211,9 +1211,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->SetPadName( m_PadNumCtrl->GetValue() );
 
     // Check if user has set an existing net name
     const NETINFO_ITEM* netinfo = m_board->FindNet( m_PadNetNameCtrl->GetValue() );
diff --git a/pcbnew/exporters/export_d356.cpp b/pcbnew/exporters/export_d356.cpp
index 23c0ca7d5..df5781a64 100644
--- a/pcbnew/exporters/export_d356.cpp
+++ b/pcbnew/exporters/export_d356.cpp
@@ -128,8 +128,8 @@ static void build_pad_testpoints( BOARD *aPcb,
             if( rk.access != -1 )
             {
                 rk.netname = pad->GetNetname();
+                rk.pin = pad->GetPadName();
                 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 );
diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp
index 5cb567e50..4cfd82583 100644
--- a/pcbnew/exporters/export_gencad.cpp
+++ b/pcbnew/exporters/export_gencad.cpp
@@ -660,7 +660,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
                 layer = module->GetFlag() ? "BOTTOM" : "TOP";
             }
 
-            pad->StringPadName( pinname );
+            pinname = pad->GetPadName();
 
             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->GetPadName() ) );
 
                 fputs( TO_UTF8( msg ), aFile );
                 fputs( "\n", aFile );
diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp
index 5cffa2f47..bbc2dbec6 100644
--- a/pcbnew/pcb_painter.cpp
+++ b/pcbnew/pcb_painter.cpp
@@ -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->GetPadName();
                 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();
-- 
2.13.1

>From 1258746034b9aebaac027a8db4b1b9a632761eef Mon Sep 17 00:00:00 2001
From: Maciej Suminski <maciej.suminski@xxxxxxx>
Date: Fri, 11 Aug 2017 10:41:21 +0200
Subject: [PATCH 2/4] File format version bump

---
 eeschema/class_library.h | 2 +-
 eeschema/general.h       | 2 +-
 pcbnew/kicad_plugin.h    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/eeschema/class_library.h b/eeschema/class_library.h
index bd1b3482d..fb6a88ac6 100644
--- a/eeschema/class_library.h
+++ b/eeschema/class_library.h
@@ -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"
diff --git a/eeschema/general.h b/eeschema/general.h
index 994337314..4b072069f 100644
--- a/eeschema/general.h
+++ b/eeschema/general.h
@@ -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
diff --git a/pcbnew/kicad_plugin.h b/pcbnew/kicad_plugin.h
index 4993b6eb9..2f6fa8654 100644
--- a/pcbnew/kicad_plugin.h
+++ b/pcbnew/kicad_plugin.h
@@ -42,7 +42,7 @@ class NETINFO_MAPPING;
 //#define SEXPR_BOARD_FILE_VERSION    4         // reversed cu stack, changed Inner* to In* in reverse order
 //                                              // 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    20170811    // 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)
-- 
2.13.1

>From c8a9db0c4dafb9e07dae37f94f1885763aef128b Mon Sep 17 00:00:00 2001
From: Maciej Suminski <maciej.suminski@xxxxxxx>
Date: Fri, 11 Aug 2017 11:22:13 +0200
Subject: [PATCH 3/4] Renamed D_PAD::{Set,Get}PadName() to
 D_PAD::{Set,Get}Name()

---
 pcbnew/array_creator.cpp                         |  2 +-
 pcbnew/board_netlist_updater.cpp                 | 14 +++++++-------
 pcbnew/class_board.cpp                           |  8 ++++----
 pcbnew/class_module.cpp                          | 10 +++++-----
 pcbnew/class_pad.cpp                             |  8 ++++----
 pcbnew/class_pad.h                               |  4 ++--
 pcbnew/cross-probing.cpp                         |  2 +-
 pcbnew/dialogs/dialog_pad_properties.cpp         |  8 ++++----
 pcbnew/eagle_plugin.cpp                          |  8 ++++----
 pcbnew/exporters/export_d356.cpp                 |  2 +-
 pcbnew/exporters/export_gencad.cpp               |  4 ++--
 pcbnew/exporters/export_idf.cpp                  |  2 +-
 pcbnew/exporters/gen_modules_placefile.cpp       |  2 +-
 pcbnew/gpcb_plugin.cpp                           |  4 ++--
 pcbnew/kicad_plugin.cpp                          |  2 +-
 pcbnew/legacy_plugin.cpp                         |  2 +-
 pcbnew/microwave/microwave_inductor.cpp          |  4 ++--
 pcbnew/muonde.cpp                                |  4 ++--
 pcbnew/pad_edition_functions.cpp                 |  6 +++---
 pcbnew/pcad2kicadpcb_plugin/pcb.cpp              |  2 +-
 pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp       |  4 ++--
 pcbnew/pcad2kicadpcb_plugin/pcb_module.h         |  2 +-
 pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp          |  2 +-
 pcbnew/pcb_painter.cpp                           |  2 +-
 pcbnew/pcb_parser.cpp                            |  2 +-
 pcbnew/plot_brditems_plotter.cpp                 |  4 ++--
 pcbnew/python/examples/createFPC40.py            |  2 +-
 pcbnew/python/examples/createPcb.py              |  4 ++--
 pcbnew/python/plugins/FPC_wizard.py              |  2 +-
 pcbnew/python/plugins/PadArray.py                |  8 ++++----
 pcbnew/python/plugins/microMatch_connectors.py   |  2 +-
 pcbnew/python/plugins/qfn_wizard.py              |  2 +-
 pcbnew/python/plugins/qrcode_footprint_wizard.py |  2 +-
 pcbnew/python/plugins/touch_slider_wizard.py     |  4 ++--
 pcbnew/specctra_export.cpp                       |  2 +-
 pcbnew/swig/tests/test1.py                       |  2 +-
 pcbnew/swig/tests/test2.py                       |  2 +-
 pcbnew/tools/module_editor_tools.cpp             |  8 ++++----
 38 files changed, 77 insertions(+), 77 deletions(-)

diff --git a/pcbnew/array_creator.cpp b/pcbnew/array_creator.cpp
index 41c9a5b89..1941bfa6c 100644
--- a/pcbnew/array_creator.cpp
+++ b/pcbnew/array_creator.cpp
@@ -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 );
                 }
             }
         }
diff --git a/pcbnew/board_netlist_updater.cpp b/pcbnew/board_netlist_updater.cpp
index e1854dcca..c3b705ae8 100644
--- a/pcbnew/board_netlist_updater.cpp
+++ b/pcbnew/board_netlist_updater.cpp
@@ -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 );
diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp
index 0eda751be..eaa4e5e40 100644
--- a/pcbnew/class_board.cpp
+++ b/pcbnew/class_board.cpp
@@ -2569,7 +2569,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.
             {
@@ -2578,7 +2578,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 );
                 }
 
@@ -2598,7 +2598,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 );
@@ -2712,7 +2712,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 );
                     }
 
diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp
index 7f4a58f71..a23ef28a9 100644
--- a/pcbnew/class_module.cpp
+++ b/pcbnew/class_module.cpp
@@ -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 );
@@ -644,7 +644,7 @@ D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const
 {
     for( D_PAD* pad = m_Pads;  pad;  pad = pad->Next() )
     {
-        if( pad->GetPadName().CmpNoCase( aPadName ) == 0 )    // why case insensitive?
+        if( pad->GetName().CmpNoCase( aPadName ) == 0 )    // why case insensitive?
             return pad;
     }
 
@@ -721,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 )
@@ -733,7 +733,7 @@ unsigned MODULE::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
             }
         }
 
-        usedNames.insert( pad->GetPadName() );
+        usedNames.insert( pad->GetName() );
     }
 
     return usedNames.size();
@@ -1208,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 );
     }
 
diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp
index bced87077..56245c90d 100644
--- a/pcbnew/class_pad.cpp
+++ b/pcbnew/class_pad.cpp
@@ -434,7 +434,7 @@ 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;
 }
@@ -1083,7 +1083,7 @@ wxString D_PAD::GetSelectMenuText() const
 {
     wxString text;
     wxString padlayers( LayerMaskDescribe( GetBoard(), m_layerMask ) );
-    wxString padname( GetPadName() );
+    wxString padname( GetName() );
 
     if( padname.IsEmpty() )
     {
@@ -1094,7 +1094,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() ) );
     }
 
@@ -1156,7 +1156,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
diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h
index 537b67401..40d62f5c1 100644
--- a/pcbnew/class_pad.h
+++ b/pcbnew/class_pad.h
@@ -125,7 +125,7 @@ public:
      * Set the pad name (sometimes called pad number, although
      * it can be an array reference like AA12).
      */
-    void SetPadName( const wxString& aName )
+    void SetName( const wxString& aName )
     {
         m_name = aName;
     }
@@ -133,7 +133,7 @@ public:
     /**
      * @return the pad name
      */
-    const wxString& GetPadName() const
+    const wxString& GetName() const
     {
         return m_name;
     }
diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp
index 8c47fa6db..4c5170629 100644
--- a/pcbnew/cross-probing.cpp
+++ b/pcbnew/cross-probing.cpp
@@ -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() ),
diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp
index e738a9826..895641922 100644
--- a/pcbnew/dialogs/dialog_pad_properties.cpp
+++ b/pcbnew/dialogs/dialog_pad_properties.cpp
@@ -380,7 +380,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:
@@ -1015,7 +1015,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;
 
@@ -1211,7 +1211,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
     aPad->SetOffset( wxPoint( x, y ) );
 
     aPad->SetOrientation( m_OrientValue * 10.0 );
-    aPad->SetPadName( m_PadNumCtrl->GetValue() );
+    aPad->SetName( m_PadNumCtrl->GetValue() );
 
     // Check if user has set an existing net name
     const NETINFO_ITEM* netinfo = m_board->FindNet( m_PadNetNameCtrl->GetValue() );
@@ -1270,7 +1270,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;
 
diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp
index f90540407..2497b45c4 100644
--- a/pcbnew/eagle_plugin.cpp
+++ b/pcbnew/eagle_plugin.cpp
@@ -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 );
 
diff --git a/pcbnew/exporters/export_d356.cpp b/pcbnew/exporters/export_d356.cpp
index df5781a64..25d0293b4 100644
--- a/pcbnew/exporters/export_d356.cpp
+++ b/pcbnew/exporters/export_d356.cpp
@@ -128,7 +128,7 @@ static void build_pad_testpoints( BOARD *aPcb,
             if( rk.access != -1 )
             {
                 rk.netname = pad->GetNetname();
-                rk.pin = pad->GetPadName();
+                rk.pin = pad->GetName();
                 rk.refdes = module->GetReference();
                 rk.midpoint = false; // XXX MAYBE need to be computed (how?)
                 const wxSize& drill = pad->GetDrillSize();
diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp
index 4cfd82583..05a32b172 100644
--- a/pcbnew/exporters/export_gencad.cpp
+++ b/pcbnew/exporters/export_gencad.cpp
@@ -660,7 +660,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
                 layer = module->GetFlag() ? "BOTTOM" : "TOP";
             }
 
-            pinname = pad->GetPadName();
+            pinname = pad->GetName();
 
             if( pinname.IsEmpty() )
                 pinname = wxT( "none" );
@@ -801,7 +801,7 @@ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb )
 
                 msg.Printf( wxT( "NODE %s %s" ),
                             GetChars( module->GetReference() ),
-                            GetChars( pad->GetPadName() ) );
+                            GetChars( pad->GetName() ) );
 
                 fputs( TO_UTF8( msg ), aFile );
                 fputs( "\n", aFile );
diff --git a/pcbnew/exporters/export_idf.cpp b/pcbnew/exporters/export_idf.cpp
index 4a8ee898c..eaac99033 100644
--- a/pcbnew/exporters/export_idf.cpp
+++ b/pcbnew/exporters/export_idf.cpp
@@ -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 )
diff --git a/pcbnew/exporters/gen_modules_placefile.cpp b/pcbnew/exporters/gen_modules_placefile.cpp
index d3858954a..3ef278321 100644
--- a/pcbnew/exporters/gen_modules_placefile.cpp
+++ b/pcbnew/exporters/gen_modules_placefile.cpp
@@ -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] )
diff --git a/pcbnew/gpcb_plugin.cpp b/pcbnew/gpcb_plugin.cpp
index b40ab4877..9c621e07f 100644
--- a/pcbnew/gpcb_plugin.cpp
+++ b/pcbnew/gpcb_plugin.cpp
@@ -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 ) );
diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp
index 76829302f..4d90f38ff 100644
--- a/pcbnew/kicad_plugin.cpp
+++ b/pcbnew/kicad_plugin.cpp
@@ -1263,7 +1263,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() );
 
diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp
index 1bf5f3242..8bf1f9c9a 100644
--- a/pcbnew/legacy_plugin.cpp
+++ b/pcbnew/legacy_plugin.cpp
@@ -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 ) );
diff --git a/pcbnew/microwave/microwave_inductor.cpp b/pcbnew/microwave/microwave_inductor.cpp
index e6f4f17be..dae59713c 100644
--- a/pcbnew/microwave/microwave_inductor.cpp
+++ b/pcbnew/microwave/microwave_inductor.cpp
@@ -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() );
 
diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp
index c183555fc..8cb6b146a 100644
--- a/pcbnew/muonde.cpp
+++ b/pcbnew/muonde.cpp
@@ -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 ) );
diff --git a/pcbnew/pad_edition_functions.cpp b/pcbnew/pad_edition_functions.cpp
index 47038369b..44b913f2a 100644
--- a/pcbnew/pad_edition_functions.cpp
+++ b/pcbnew/pad_edition_functions.cpp
@@ -138,11 +138,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 );
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb.cpp
index f98abaed7..67a360899 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb.cpp
@@ -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
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp
index 2f6416d09..be3304ac0 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp
@@ -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
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_module.h b/pcbnew/pcad2kicadpcb_plugin/pcb_module.h
index b3757d6ee..356e36b32 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_module.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_module.h
@@ -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 );
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp
index 72476251b..f42e2004f 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp
@@ -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" )
diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp
index bbc2dbec6..bace56653 100644
--- a/pcbnew/pcb_painter.cpp
+++ b/pcbnew/pcb_painter.cpp
@@ -623,7 +623,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
 
             if( m_pcbSettings.m_padNumbers )
             {
-                const wxString& padName = aPad->GetPadName();
+                const wxString& padName = aPad->GetName();
                 textpos.y = -textpos.y;
                 double tsize = 1.5 * padsize.x / padName.Length();
                 tsize = std::min( tsize, size );
diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp
index d19ee3969..41bcac04d 100644
--- a/pcbnew/pcb_parser.cpp
+++ b/pcbnew/pcb_parser.cpp
@@ -2249,7 +2249,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();
 
diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp
index 2d0d4b1b8..1905028ba 100644
--- a/pcbnew/plot_brditems_plotter.cpp
+++ b/pcbnew/plot_brditems_plotter.cpp
@@ -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 )
diff --git a/pcbnew/python/examples/createFPC40.py b/pcbnew/python/examples/createFPC40.py
index 247511a13..9db68191b 100644
--- a/pcbnew/python/examples/createFPC40.py
+++ b/pcbnew/python/examples/createFPC40.py
@@ -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):
diff --git a/pcbnew/python/examples/createPcb.py b/pcbnew/python/examples/createPcb.py
index 21c38036c..1c32670a0 100644
--- a/pcbnew/python/examples/createPcb.py
+++ b/pcbnew/python/examples/createPcb.py
@@ -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()
diff --git a/pcbnew/python/plugins/FPC_wizard.py b/pcbnew/python/plugins/FPC_wizard.py
index 6e0e6491d..96d7ace89 100644
--- a/pcbnew/python/plugins/FPC_wizard.py
+++ b/pcbnew/python/plugins/FPC_wizard.py
@@ -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):
diff --git a/pcbnew/python/plugins/PadArray.py b/pcbnew/python/plugins/PadArray.py
index 732f17bf4..3d7c0821d 100644
--- a/pcbnew/python/plugins/PadArray.py
+++ b/pcbnew/python/plugins/PadArray.py
@@ -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)
diff --git a/pcbnew/python/plugins/microMatch_connectors.py b/pcbnew/python/plugins/microMatch_connectors.py
index 1637a3b32..fbf07fee9 100644
--- a/pcbnew/python/plugins/microMatch_connectors.py
+++ b/pcbnew/python/plugins/microMatch_connectors.py
@@ -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
diff --git a/pcbnew/python/plugins/qfn_wizard.py b/pcbnew/python/plugins/qfn_wizard.py
index f36165bc5..fbdd60fdf 100644
--- a/pcbnew/python/plugins/qfn_wizard.py
+++ b/pcbnew/python/plugins/qfn_wizard.py
@@ -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)
diff --git a/pcbnew/python/plugins/qrcode_footprint_wizard.py b/pcbnew/python/plugins/qrcode_footprint_wizard.py
index 319787627..0d277e578 100644
--- a/pcbnew/python/plugins/qrcode_footprint_wizard.py
+++ b/pcbnew/python/plugins/qrcode_footprint_wizard.py
@@ -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)
diff --git a/pcbnew/python/plugins/touch_slider_wizard.py b/pcbnew/python/plugins/touch_slider_wizard.py
index 7fc300aed..e0086e427 100644
--- a/pcbnew/python/plugins/touch_slider_wizard.py
+++ b/pcbnew/python/plugins/touch_slider_wizard.py
@@ -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
 
diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp
index f9bc7e7aa..273a94bfb 100644
--- a/pcbnew/specctra_export.cpp
+++ b/pcbnew/specctra_export.cpp
@@ -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() )
diff --git a/pcbnew/swig/tests/test1.py b/pcbnew/swig/tests/test1.py
index b1f7cffbf..fbcb9deb3 100644
--- a/pcbnew/swig/tests/test1.py
+++ b/pcbnew/swig/tests/test1.py
@@ -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()
 
 
diff --git a/pcbnew/swig/tests/test2.py b/pcbnew/swig/tests/test2.py
index e925f8825..b27ea14a7 100644
--- a/pcbnew/swig/tests/test2.py
+++ b/pcbnew/swig/tests/test2.py
@@ -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()
diff --git a/pcbnew/tools/module_editor_tools.cpp b/pcbnew/tools/module_editor_tools.cpp
index 01c825780..7c02ad565 100644
--- a/pcbnew/tools/module_editor_tools.cpp
+++ b/pcbnew/tools/module_editor_tools.cpp
@@ -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 );
                     }
 
-- 
2.13.1


Follow ups