KiCad PCB EDA Suite
dialog_get_component.cpp File Reference
#include <fctsys.h>
#include <common.h>
#include <macros.h>
#include <draw_frame.h>
#include <dialog_get_component.h>

Go to the source code of this file.

Functions

void AddHistoryComponentName (wxArrayString &aHistoryList, const wxString &aName)
 

Variables

static unsigned s_HistoryMaxCount = 8
 

Function Documentation

void AddHistoryComponentName ( wxArrayString &  aHistoryList,
const wxString &  aName 
)

Definition at line 123 of file dialog_get_component.cpp.

References s_HistoryMaxCount.

Referenced by PCB_BASE_FRAME::LoadModuleFromLibrary().

124 {
125  if( ( aHistoryList.GetCount() > 0 ) && ( aName == aHistoryList[0] ) )
126  return;
127 
128  /* remove an old identical name if exists */
129  for( unsigned ii = 1; ii < aHistoryList.GetCount(); ii++ )
130  {
131  if( aName == aHistoryList[ii] )
132  {
133  aHistoryList.RemoveAt( ii );
134  ii--;
135  }
136  }
137 
138  // Add the new name at the beginning of the history list
139  aHistoryList.Insert(aName, 0);
140 
141  // Remove extra names
142  while( aHistoryList.GetCount() >= s_HistoryMaxCount )
143  aHistoryList.RemoveAt( aHistoryList.GetCount()-1 );
144 }
static unsigned s_HistoryMaxCount

Variable Documentation

unsigned s_HistoryMaxCount = 8
static

Definition at line 17 of file dialog_get_component.cpp.

Referenced by AddHistoryComponentName().