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 90 of file pad_edition_functions.cpp.

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

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