2008-12-31 09:27:19 +00:00
|
|
|
/****************************************************************/
|
|
|
|
/* Headers fo lib component (or libentry) definitions */
|
|
|
|
/****************************************************************/
|
|
|
|
|
|
|
|
#ifndef CLASS_LIBENTRY_H
|
|
|
|
#define CLASS_LIBENTRY_H
|
|
|
|
|
2008-12-31 15:01:29 +00:00
|
|
|
#include "dlist.h"
|
|
|
|
|
2008-12-31 09:27:19 +00:00
|
|
|
#include "classes_body_items.h"
|
|
|
|
#include "class_libentry_fields.h"
|
|
|
|
|
|
|
|
/* Types for components in libraries
|
|
|
|
* components can be a true component or an alias of a true component.
|
|
|
|
*/
|
|
|
|
enum LibrEntryType {
|
|
|
|
ROOT, /* This is a true component standard EDA_LibComponentStruct */
|
|
|
|
ALIAS /* This is an alias of a true component */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* values for member .m_Options */
|
|
|
|
enum LibrEntryOptions {
|
|
|
|
ENTRY_NORMAL, // Libentry is a standard component (real or alias)
|
|
|
|
ENTRY_POWER // Libentry is a power symbol
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
/* basic class to describe components in libraries (true component or alias),
|
|
|
|
* non used directly */
|
|
|
|
class LibCmpEntry : public EDA_BaseStruct
|
2008-12-31 09:27:19 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
LibrEntryType Type; /* Type = ROOT;
|
|
|
|
* = ALIAS pour struct LibraryAliasType */
|
|
|
|
LibDrawField m_Name; // name (74LS00 ..) in lib ( = VALUE )
|
|
|
|
wxString m_Doc; /* documentation for info */
|
2009-04-05 20:49:15 +00:00
|
|
|
wxString m_KeyWord; /* keyword list (used to select a group of
|
|
|
|
* components by keyword) */
|
2008-12-31 09:27:19 +00:00
|
|
|
wxString m_DocFile; /* Associed doc filename */
|
|
|
|
LibrEntryOptions m_Options; // special features (i.e. Entry is a POWER)
|
|
|
|
|
|
|
|
public:
|
|
|
|
LibCmpEntry( LibrEntryType CmpType, const wxChar* CmpName );
|
|
|
|
virtual ~LibCmpEntry();
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
|
|
|
return wxT( "LibCmpEntry" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SaveDoc
|
|
|
|
* writes the doc info out to a FILE in "*.dcm" format.
|
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
|
|
|
bool SaveDoc( FILE* aFile );
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************/
|
|
|
|
/* class to handle an usual component in lib */
|
|
|
|
/*********************************************/
|
|
|
|
class EDA_LibComponentStruct : public LibCmpEntry
|
|
|
|
{
|
|
|
|
public:
|
2009-04-05 20:49:15 +00:00
|
|
|
LibDrawField m_Prefix; /* Prefix ( U, IC ... ) = REFERENCE */
|
|
|
|
wxArrayString m_AliasList; /* ALIAS list for the component */
|
|
|
|
wxArrayString m_FootprintList; /* list of suitable footprint names
|
|
|
|
* for the component (wildcard names
|
|
|
|
* accepted) */
|
|
|
|
int m_UnitCount; /* Units (or sections) per package */
|
|
|
|
bool m_UnitSelectionLocked; /* True if units are differents
|
|
|
|
* and their selection is
|
|
|
|
* locked (i.e. if part A cannot
|
|
|
|
* be automatically changed in
|
|
|
|
* part B */
|
|
|
|
int m_TextInside; /* if 0: pin name drawn on the pin
|
|
|
|
* itself if > 0 pin name drawn inside
|
|
|
|
* the component, with a distance of
|
|
|
|
* m_TextInside in mils */
|
2008-12-31 09:27:19 +00:00
|
|
|
bool m_DrawPinNum;
|
|
|
|
bool m_DrawPinName;
|
2009-04-05 20:49:15 +00:00
|
|
|
DLIST<LibDrawField> m_Fields; /* Auxiliairy Field list (id >= 2 ) */
|
|
|
|
LibEDA_BaseStruct* m_Drawings; /* How to draw this part */
|
|
|
|
long m_LastDate; // Last change Date
|
|
|
|
DLIST<LibEDA_BaseStruct> m_DrawItems;
|
2008-12-31 09:27:19 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
|
|
|
return wxT( "EDA_LibComponentStruct" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EDA_LibComponentStruct( const wxChar* CmpName );
|
|
|
|
~EDA_LibComponentStruct();
|
2009-04-05 20:49:15 +00:00
|
|
|
|
|
|
|
EDA_Rect GetBoundaryBox( int Unit, int Convert );
|
|
|
|
|
2008-12-31 09:27:19 +00:00
|
|
|
void SortDrawItems();
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
bool SaveDateAndTime( FILE* ExportFile );
|
|
|
|
bool LoadDateAndTime( char* Line );
|
|
|
|
|
2008-12-31 09:27:19 +00:00
|
|
|
/**
|
|
|
|
* Function Save
|
2009-04-05 20:49:15 +00:00
|
|
|
* writes the data structures for this object out to a FILE in "*.lib"
|
|
|
|
* format.
|
2008-12-31 09:27:19 +00:00
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
2009-04-05 20:49:15 +00:00
|
|
|
bool Save( FILE* aFile );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load component definition from file.
|
|
|
|
*
|
|
|
|
* @param file - File discriptor of file to load form.
|
|
|
|
* @param line - The first line of the component definition.
|
|
|
|
* @param lineNum - The current line number in the file.
|
|
|
|
* @param parent - The parent window for displaying message boxes.
|
|
|
|
*
|
|
|
|
* @return bool - Result of the load, false if there was an error.
|
|
|
|
*/
|
|
|
|
bool Load( FILE* file, char* line, int* lineNum, wxString& errorMsg );
|
|
|
|
bool LoadField( char* line, wxString& errorMsg );
|
|
|
|
bool LoadDrawEntries( FILE* f, char* line,
|
|
|
|
int* lineNum, wxString& errorMsg );
|
|
|
|
bool LoadAliases( char* line, wxString& Error );
|
|
|
|
bool LoadFootprints( FILE* file, char* line,
|
|
|
|
int* lineNum, wxString& errorMsg );
|
2008-12-31 09:27:19 +00:00
|
|
|
|
|
|
|
/** Function SetFields
|
|
|
|
* initialize fields from a vector of fields
|
|
|
|
* @param aFields a std::vector <LibDrawField> to import.
|
|
|
|
*/
|
2009-04-05 20:49:15 +00:00
|
|
|
void SetFields( const std::vector <LibDrawField> aFields );
|
2008-12-31 09:27:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
/* class to handle an alias of an usual component in lib (root component) */
|
|
|
|
/**************************************************************************/
|
2009-04-05 20:49:15 +00:00
|
|
|
class EDA_LibCmpAliasStruct : public LibCmpEntry
|
2008-12-31 09:27:19 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxString m_RootName; /* Root component Part name */
|
|
|
|
|
|
|
|
public:
|
|
|
|
EDA_LibCmpAliasStruct( const wxChar* CmpName, const wxChar* CmpRootName );
|
|
|
|
~EDA_LibCmpAliasStruct();
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
|
|
|
return wxT( "EDA_LibCmpAliasStruct" );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // CLASS_LIBENTRY_H
|