2008-09-20 17:20:40 +00:00
|
|
|
/*************************************************************/
|
|
|
|
/* Definitions for the component fields classes for EESchema */
|
|
|
|
/*************************************************************/
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
#ifndef CLASS_SCH_FIELD_H
|
|
|
|
#define CLASS_SCH_FIELD_H
|
2008-09-20 17:20:40 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
/* Fields are texts attached to a component, having a special meaning
|
2008-10-06 05:44:29 +00:00
|
|
|
* Fields 0 and 1 are very important: reference and value
|
|
|
|
* Field 2 is used as default footprint name.
|
|
|
|
* Field 3 is reserved (not currently used
|
2008-12-31 15:01:29 +00:00
|
|
|
* Fields 4 and more are user fields.
|
2008-10-06 05:44:29 +00:00
|
|
|
* They can be renamed and can appear in reports
|
2008-09-20 17:20:40 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2008-10-06 05:44:29 +00:00
|
|
|
class SCH_COMPONENT;
|
2009-10-08 13:19:28 +00:00
|
|
|
class LIB_FIELD;
|
2008-10-06 05:44:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-12-02 21:44:03 +00:00
|
|
|
* Class SCH_FIELD
|
|
|
|
* instances are attached to a component and provide a place for the
|
|
|
|
* component's value,
|
2008-10-06 05:44:29 +00:00
|
|
|
* reference designator, footprint, and user definable name-value pairs of
|
|
|
|
* arbitrary purpose.
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
class SCH_FIELD : public SCH_ITEM, public EDA_TextStruct
|
2008-09-20 17:20:40 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-06-17 16:30:10 +00:00
|
|
|
int m_FieldId; ///< Field index, @see enum NumFieldType
|
2008-10-06 05:44:29 +00:00
|
|
|
|
|
|
|
|
2010-06-17 16:30:10 +00:00
|
|
|
wxString m_Name;
|
|
|
|
|
|
|
|
bool m_AddExtraText; /**< for REFERENCE, add extra info
|
2009-12-02 21:44:03 +00:00
|
|
|
* (for REFERENCE: add part selection text */
|
2008-09-20 17:20:40 +00:00
|
|
|
|
|
|
|
public:
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT* aParent,
|
|
|
|
wxString aName = wxEmptyString );
|
2010-06-17 16:30:10 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
~SCH_FIELD();
|
2008-09-20 17:20:40 +00:00
|
|
|
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
2009-12-02 21:44:03 +00:00
|
|
|
return wxT( "SCH_FIELD" );
|
2008-09-20 17:20:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
|
|
|
|
|
|
|
|
EDA_Rect GetBoundaryBox() const;
|
|
|
|
bool IsVoid();
|
2009-12-02 21:44:03 +00:00
|
|
|
void SwapData( SCH_FIELD* copyitem );
|
2008-09-20 17:20:40 +00:00
|
|
|
|
2008-12-31 15:01:29 +00:00
|
|
|
/** Function ImportValues
|
|
|
|
* copy parameters from a source.
|
|
|
|
* Pointers and specific values (position) are not copied
|
2009-10-08 13:19:28 +00:00
|
|
|
* @param aSource = the LIB_FIELD to read
|
2008-12-31 15:01:29 +00:00
|
|
|
*/
|
2009-10-08 13:19:28 +00:00
|
|
|
void ImportValues( const LIB_FIELD& aSource );
|
2008-12-31 15:01:29 +00:00
|
|
|
|
2009-06-30 17:57:27 +00:00
|
|
|
/** Function GetPenSize
|
|
|
|
* @return the size of the "pen" that be used to draw or plot this item
|
|
|
|
*/
|
|
|
|
int GetPenSize( );
|
|
|
|
|
2009-12-30 18:06:12 +00:00
|
|
|
/** Function IsVisible
|
|
|
|
* @return true is this field is visible, false if flagged invisible
|
|
|
|
*/
|
|
|
|
bool IsVisible()
|
|
|
|
{
|
|
|
|
return (m_Attributs & TEXT_NO_VISIBLE) == 0 ? true : false;
|
|
|
|
}
|
|
|
|
|
2008-09-20 17:20:40 +00:00
|
|
|
/**
|
|
|
|
* Function Draw
|
|
|
|
*/
|
|
|
|
void Draw( WinEDA_DrawPanel* panel,
|
|
|
|
wxDC* DC,
|
|
|
|
const wxPoint& offset,
|
|
|
|
int draw_mode,
|
|
|
|
int Color = -1 );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Save
|
2009-12-02 21:44:03 +00:00
|
|
|
* writes the data structures for this object out to a FILE in "*.sch"
|
|
|
|
* format.
|
2008-09-20 17:20:40 +00:00
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
|
|
|
bool Save( FILE* aFile ) const;
|
2009-07-27 14:32:40 +00:00
|
|
|
|
|
|
|
// Geometric transforms (used in block operations):
|
|
|
|
/** virtual function Move
|
|
|
|
* move item to a new position.
|
2009-12-02 21:44:03 +00:00
|
|
|
* @param aMoveVector = the displacement vector
|
2009-07-27 14:32:40 +00:00
|
|
|
*/
|
|
|
|
virtual void Move(const wxPoint& aMoveVector)
|
|
|
|
{
|
|
|
|
m_Pos += aMoveVector;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** virtual function Mirror_Y
|
|
|
|
* mirror item relative to an Y axis
|
|
|
|
* @param aYaxis_position = the y axis position
|
|
|
|
*/
|
|
|
|
virtual void Mirror_Y(int aYaxis_position)
|
|
|
|
{
|
|
|
|
/* Do Nothing: fields are never mirrored alone.
|
|
|
|
* they are moved when the parent component is mirrored
|
2009-12-02 21:44:03 +00:00
|
|
|
* this function is only needed by the virtual pure function of the
|
|
|
|
* master class */
|
2009-07-27 14:32:40 +00:00
|
|
|
}
|
2010-03-16 18:22:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Compare schematic field text against search string.
|
|
|
|
*
|
|
|
|
* @param aSearchData - Criteria to search against.
|
2010-04-01 13:15:48 +00:00
|
|
|
* @param aAuxData - a pointer on auxiliary data, if needed.
|
|
|
|
* the sheet path is needed for REFERENCE field because m_Text
|
|
|
|
* value is just the valeur displayed, and in complex hierarchies
|
|
|
|
* this is only one of all references (one per sheet path)
|
2010-03-16 18:22:59 +00:00
|
|
|
* @return True if this field text matches the search criteria.
|
|
|
|
*/
|
2010-04-01 13:15:48 +00:00
|
|
|
virtual bool Matches( wxFindReplaceData& aSearchData, void * aAuxData );
|
2008-09-20 17:20:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
#endif /* CLASS_SCH_FIELD_H */
|