2011-02-21 18:27:47 +00:00
|
|
|
/*
|
|
|
|
* @file footprint_info.h
|
|
|
|
*/
|
|
|
|
|
2012-03-17 03:01:53 +00:00
|
|
|
#ifndef FOOTPRINT_INFO_H_
|
|
|
|
#define FOOTPRINT_INFO_H_
|
2011-02-21 18:27:47 +00:00
|
|
|
|
2011-02-22 20:59:16 +00:00
|
|
|
#include <boost/ptr_container/ptr_vector.hpp>
|
|
|
|
#include <boost/foreach.hpp>
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <kicad_string.h>
|
2011-02-21 18:27:47 +00:00
|
|
|
|
|
|
|
/*
|
2012-03-17 03:01:53 +00:00
|
|
|
* Class FOOTPRINT_INFO
|
|
|
|
* is a helper class to handle the list of footprints
|
|
|
|
* available in libraries. It stores footprint names, doc and keywords
|
2011-02-21 18:27:47 +00:00
|
|
|
*/
|
|
|
|
class FOOTPRINT_INFO
|
|
|
|
{
|
|
|
|
public:
|
2012-03-17 03:01:53 +00:00
|
|
|
wxString m_Module; ///< Module name.
|
|
|
|
wxString m_LibName; ///< Name of the library containing this module.
|
|
|
|
int m_Num; ///< Order number in the display list.
|
|
|
|
wxString m_Doc; ///< Footprint description.
|
|
|
|
wxString m_KeyWord; ///< Footprint key words.
|
|
|
|
int m_padCount; ///< Number of pads
|
2011-02-21 18:27:47 +00:00
|
|
|
|
|
|
|
FOOTPRINT_INFO()
|
|
|
|
{
|
|
|
|
m_Num = 0;
|
2012-03-15 18:20:22 +00:00
|
|
|
m_padCount = 0;
|
2011-02-21 18:27:47 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-04-16 03:18:41 +00:00
|
|
|
|
2011-02-22 17:59:46 +00:00
|
|
|
class FOOTPRINT_LIST
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
boost::ptr_vector< FOOTPRINT_INFO > m_List;
|
|
|
|
wxString m_filesNotFound;
|
|
|
|
wxString m_filesInvalid;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCount
|
|
|
|
* @return the number of items stored in list
|
|
|
|
*/
|
2011-12-14 04:29:25 +00:00
|
|
|
unsigned GetCount() const { return m_List.size(); }
|
2011-02-22 17:59:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetModuleInfo
|
|
|
|
* @return the item stored in list if found
|
|
|
|
* @param aFootprintName = the name of item
|
|
|
|
*/
|
|
|
|
FOOTPRINT_INFO * GetModuleInfo( const wxString & aFootprintName )
|
|
|
|
{
|
|
|
|
BOOST_FOREACH( FOOTPRINT_INFO& footprint, m_List )
|
|
|
|
{
|
|
|
|
if( aFootprintName.CmpNoCase( footprint.m_Module ) == 0 )
|
|
|
|
return &footprint;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetItem
|
|
|
|
* @return the aIdx item in list
|
|
|
|
* @param aIdx = index of the given item
|
|
|
|
*/
|
|
|
|
FOOTPRINT_INFO & GetItem( unsigned aIdx )
|
|
|
|
{
|
|
|
|
return m_List[aIdx];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function AddItem
|
|
|
|
* add aItem in list
|
|
|
|
* @param aItem = item to add
|
|
|
|
*/
|
|
|
|
void AddItem( FOOTPRINT_INFO* aItem )
|
|
|
|
{
|
|
|
|
m_List.push_back( aItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ReadFootprintFiles
|
2011-11-08 16:37:25 +00:00
|
|
|
* Read the list of libraries (*.mod files) and populates m_List ( list of availaible
|
|
|
|
* modules in libs ).
|
2011-02-22 17:59:46 +00:00
|
|
|
* for each module, are stored
|
|
|
|
* the module name
|
|
|
|
* documentation string
|
|
|
|
* associated keywords
|
|
|
|
* library name
|
|
|
|
* Module description format:
|
|
|
|
* $MODULE c64acmd First line of module description
|
|
|
|
* Li c64acmd DIN connector Library reference
|
|
|
|
* Cd Europe 96 AC male vertical documentation string
|
|
|
|
* Kw PAD_CONN DIN associated keywords
|
|
|
|
* ...... other data (pads, outlines ..)
|
|
|
|
* $Endmodule
|
|
|
|
*
|
|
|
|
* @param aFootprintsLibNames = an array string giving the list of libraries to load
|
|
|
|
*/
|
|
|
|
bool ReadFootprintFiles( wxArrayString & aFootprintsLibNames );
|
|
|
|
};
|
2011-02-21 18:27:47 +00:00
|
|
|
|
2012-03-17 03:01:53 +00:00
|
|
|
/// FOOTPRINT object list sort function.
|
2011-02-21 18:27:47 +00:00
|
|
|
inline bool operator<( const FOOTPRINT_INFO& item1, const FOOTPRINT_INFO& item2 )
|
|
|
|
{
|
2011-11-08 16:37:25 +00:00
|
|
|
return StrNumCmp( item1.m_Module, item2.m_Module, INT_MAX, true ) < 0;
|
2011-02-21 18:27:47 +00:00
|
|
|
}
|
|
|
|
|
2012-03-17 03:01:53 +00:00
|
|
|
#endif // FOOTPRINT_INFO_H_
|