KiCad PCB EDA Suite
dialog_get_component.h File Reference

This file is part of the common libary. More...

Go to the source code of this file.

Classes

class  DIALOG_GET_COMPONENT
 

Functions

void AddHistoryComponentName (wxArrayString &HistoryList, const wxString &Name)
 

Detailed Description

This file is part of the common libary.

Definition in file dialog_get_component.h.

Function Documentation

void AddHistoryComponentName ( wxArrayString &  HistoryList,
const wxString &  Name 
)

Definition at line 119 of file dialog_get_component.cpp.

References s_HistoryMaxCount.

Referenced by PCB_BASE_FRAME::LoadModuleFromLibrary().

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