2008-12-31 09:27:19 +00:00
|
|
|
/**************************************************************/
|
|
|
|
/* Lib component definitions (libentry) definition of fields */
|
|
|
|
/**************************************************************/
|
|
|
|
|
|
|
|
#ifndef CLASS_LIBENTRY_FIELDS_H
|
|
|
|
#define CLASS_LIBENTRY_FIELDS_H
|
|
|
|
|
|
|
|
|
|
|
|
/* Fields , same as component fields.
|
2009-04-05 20:49:15 +00:00
|
|
|
* can be defined in libraries (mandatory for ref and value, ca be useful for
|
|
|
|
* footprints)
|
2008-12-31 09:27:19 +00:00
|
|
|
* 2 Fields are always defined :
|
|
|
|
* Prefix (U, IC..) with gives the reference in schematic)
|
2009-04-05 20:49:15 +00:00
|
|
|
* Name (74LS00..) used to find the component in libraries, and give the
|
|
|
|
* default value in schematic
|
2008-12-31 09:27:19 +00:00
|
|
|
*/
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
class LibDrawField : public LibEDA_BaseStruct,
|
2008-12-31 15:01:29 +00:00
|
|
|
public EDA_TextStruct
|
2008-12-31 09:27:19 +00:00
|
|
|
{
|
|
|
|
public:
|
2009-04-05 20:49:15 +00:00
|
|
|
int m_FieldId; /* 0 = REFERENCE
|
|
|
|
* 1 = VALUE
|
|
|
|
* 3 = FOOTPRINT (default Footprint)
|
|
|
|
* 4 = DOCUMENTATION (user doc link)
|
|
|
|
* others = free fields
|
|
|
|
*/
|
|
|
|
wxString m_Name; /* Field Name (not the field text itself, that is
|
|
|
|
* .m_Text) */
|
2008-12-31 09:27:19 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
LibDrawField* Next() const { return (LibDrawField*) Pnext; }
|
|
|
|
LibDrawField* Back() const { return (LibDrawField*) Pback; }
|
|
|
|
|
|
|
|
|
|
|
|
LibDrawField( int idfield = 2 );
|
2009-06-18 13:30:52 +00:00
|
|
|
LibDrawField( EDA_LibComponentStruct * aParent, int idfield = 2 );
|
2008-12-31 09:27:19 +00:00
|
|
|
~LibDrawField();
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
|
|
|
return wxT( "LibDrawField" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-30 17:57:27 +00:00
|
|
|
/** Function GetPenSize virtual pure
|
|
|
|
* @return the size of the "pen" that be used to draw or plot this item
|
|
|
|
*/
|
|
|
|
int GetPenSize( );
|
|
|
|
|
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 "*.brd"
|
|
|
|
* 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
|
|
|
virtual bool Save( FILE* aFile ) const;
|
|
|
|
virtual bool Load( char* line, wxString& errorMsg );
|
2008-12-31 09:27:19 +00:00
|
|
|
|
2008-12-31 15:01:29 +00:00
|
|
|
LibDrawField* GenCopy();
|
2008-12-31 09:27:19 +00:00
|
|
|
|
|
|
|
/** Function Copy
|
|
|
|
* copy parameters of this to Target. Pointers are not copied
|
2008-12-31 15:01:29 +00:00
|
|
|
* @param aTarget = the LibDrawField to set with "this" values
|
2008-12-31 09:27:19 +00:00
|
|
|
*/
|
2008-12-31 15:01:29 +00:00
|
|
|
void Copy( LibDrawField* aTarget ) const;
|
2008-12-31 09:27:19 +00:00
|
|
|
|
2008-12-31 15:01:29 +00:00
|
|
|
void SetFields( const std::vector <LibDrawField> aFields );
|
2008-12-31 09:27:19 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
|
|
|
|
int aColor, int aDrawMode, void* aData,
|
|
|
|
const int aTransformMatrix[2][2] );
|
2008-12-31 09:27:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function HitTest
|
|
|
|
* tests if the given wxPoint is within the bounds of this object.
|
|
|
|
* @param refPos A wxPoint to test, in Field coordinate system
|
|
|
|
* @return bool - true if a hit, else false
|
|
|
|
*/
|
2008-12-31 15:01:29 +00:00
|
|
|
bool HitTest( const wxPoint& refPos );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2009-06-13 17:06:07 +00:00
|
|
|
/** Function HitTest
|
|
|
|
* @return true if the point aPosRef is near this object
|
|
|
|
* @param aPosRef = a wxPoint to test
|
|
|
|
* @param aThreshold = max distance to this object (usually the half thickness of a line)
|
|
|
|
* @param aTransMat = the transform matrix
|
|
|
|
*/
|
|
|
|
virtual bool HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] );
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
void operator=( const LibDrawField& field )
|
|
|
|
{
|
|
|
|
m_FieldId = field.m_FieldId;
|
|
|
|
m_Text = field.m_Text;
|
|
|
|
m_Pos = field.m_Pos;
|
|
|
|
m_Size = field.m_Size;
|
|
|
|
m_Width = field.m_Width;
|
|
|
|
m_Orient = field.m_Orient;
|
|
|
|
m_Mirror = field.m_Mirror;
|
|
|
|
m_Attributs = field.m_Attributs;
|
|
|
|
m_Italic = field.m_Italic;
|
2009-05-28 17:39:40 +00:00
|
|
|
m_Bold = field.m_Bold;
|
2009-04-05 20:49:15 +00:00
|
|
|
m_HJustify = field.m_HJustify;
|
|
|
|
m_VJustify = field.m_VJustify;
|
2009-06-18 13:30:52 +00:00
|
|
|
m_Parent = field.m_Parent;
|
2009-04-05 20:49:15 +00:00
|
|
|
}
|
2008-12-31 09:27:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CLASS_LIBENTRY_FIELDS_H
|