KiCad PCB EDA Suite
pad_edition_functions.cpp File Reference
#include <fctsys.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <trigo.h>
#include <macros.h>
#include <wxBasePcbFrame.h>
#include <pcbnew.h>
#include <class_board.h>
#include <class_module.h>
#include <class_pad.h>
#include <class_board_design_settings.h>

Go to the source code of this file.

Functions

static wxString GetNextPadName (wxString aPadName)
 Compute the 'next' pad number for autoincrement aPadName is the last pad name used. More...
 

Function Documentation

static wxString GetNextPadName ( wxString  aPadName)
static

Compute the 'next' pad number for autoincrement aPadName is the last pad name used.

Definition at line 86 of file pad_edition_functions.cpp.

Referenced by PCB_BASE_FRAME::AddPad(), and D_PAD::IncrementPadName().

87 {
88  // Automatically increment the current pad number.
89  int num = 0;
90  int ponder = 1;
91 
92  // Trim and extract the trailing numeric part
93  while( aPadName.Len()
94  && aPadName.Last() >= '0'
95  && aPadName.Last() <= '9' )
96  {
97  num += ( aPadName.Last() - '0' ) * ponder;
98  aPadName.RemoveLast();
99  ponder *= 10;
100  }
101 
102  num++; // Use next number for the new pad
103  aPadName << num;
104 
105  return aPadName;
106 }