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 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