class_sch_cmp_field.h 2.43 KB
Newer Older
charras's avatar
charras committed
1 2 3 4 5 6 7
/*************************************************************/
/* Definitions for the component fields classes for EESchema */
/*************************************************************/

#ifndef CLASS_SCH_CMP_FIELD_H
#define CLASS_SCH_CMP_FIELD_H

8 9 10 11
/* Fields are texts attached to a component, having a specuial meaning
 * 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
12
 * Fields 4 and more are user fields.
13
 * They can be renamed and can appear in reports
charras's avatar
charras committed
14 15 16
 */


17 18 19 20 21 22 23 24 25
class SCH_COMPONENT;


/**
 * Class SCH_CMP_FIELD
 * instances are attached to a component and provide a place for the component's value,
 * reference designator, footprint, and user definable name-value pairs of
 * arbitrary purpose.
 */
charras's avatar
charras committed
26 27 28 29
class SCH_CMP_FIELD :  public SCH_ITEM, public EDA_TextStruct
{
public:
    int      m_FieldId;         // Field indicator type (REFERENCE, VALUE or other id)
30 31 32 33 34 35

    wxString m_Name;            /* Field name (ref, value,pcb, sheet, filed 1..
                                 *  and for fields 1 to 8 the name is editable
                                 */

    bool     m_AddExtraText;    // Mainly for REFERENCE, add extra info (for REFERENCE: add part selection text
charras's avatar
charras committed
36 37

public:
38
    SCH_CMP_FIELD( const wxPoint& aPos,  int aFieldId, SCH_COMPONENT* aParent, wxString aName = wxEmptyString );
charras's avatar
charras committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52
    ~SCH_CMP_FIELD();

    virtual wxString GetClass() const
    {
        return wxT( "SCH_CMP_FIELD" );
    }


    void     Place( WinEDA_SchematicFrame* frame, wxDC* DC );

    EDA_Rect GetBoundaryBox() const;
    bool     IsVoid();
    void     SwapData( SCH_CMP_FIELD* copyitem );

53 54 55 56 57 58 59
    /** Function ImportValues
     * copy parameters from a source.
     * Pointers and specific values (position) are not copied
     * @param aSource = the LibDrawField to read
     */
    void     ImportValues( const LibDrawField& aSource );

charras's avatar
charras committed
60 61 62 63 64 65 66 67 68 69 70
    /**
     * Function Draw
     */
    void     Draw( WinEDA_DrawPanel* panel,
                   wxDC*             DC,
                   const wxPoint&    offset,
                   int               draw_mode,
                   int               Color = -1 );

    /**
     * Function Save
71
     * writes the data structures for this object out to a FILE in "*.sch" format.
charras's avatar
charras committed
72 73 74 75 76 77 78 79
     * @param aFile The FILE to write to.
     * @return bool - true if success writing else false.
     */
    bool Save( FILE* aFile ) const;
};


#endif /* CLASS_SCH_CMP_FIELD_H */