~bidulock/kicad/kicad-brian

« back to all changes in this revision

Viewing changes to eeschema/class_libentry.h

  • Committer: Brian F. G. Bidulock
  • Date: 2010-06-30 12:43:10 UTC
  • mfrom: (2360.3.47 testing)
  • Revision ID: brian@habeascorpus-20100630124310-9p4sig3zj1gqnlqd
mergedĀ upstreamĀ changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    LibrEntryType    type;
50
50
 
51
51
    wxString         description;  /* documentation for info */
52
 
    wxString         keyWords;     /* keyword list (used for search for
53
 
                                    * components by keyword) */
 
52
    wxString         keyWords;     /* keyword list (used for search for components by keyword) */
54
53
    wxString         docFileName;  /* Associate doc file name */
55
54
 
56
55
public:
57
 
    CMP_LIB_ENTRY( LibrEntryType aType, const wxString& aName,
58
 
                   CMP_LIBRARY* aLibrary = NULL );
 
56
    CMP_LIB_ENTRY( LibrEntryType aType, const wxString& aName, CMP_LIBRARY* aLibrary = NULL );
59
57
    CMP_LIB_ENTRY( CMP_LIB_ENTRY& aEntry, CMP_LIBRARY* aLibrary = NULL );
60
58
 
61
59
    virtual ~CMP_LIB_ENTRY();
129
127
/**
130
128
 * Library component object definition.
131
129
 *
132
 
 * Library component object definition.
133
 
 *
134
 
 * A library component object is typically saved and loaded
135
 
 * in a component library file (.lib).
 
130
 * A library component object is typically saved and loaded in a component library file (.lib).
136
131
 * Library components are different from schematic components.
137
132
 */
138
133
class LIB_COMPONENT : public CMP_LIB_ENTRY
142
137
    wxArrayString      m_FootprintList;  /* list of suitable footprint names
143
138
                                          * for the component (wildcard names
144
139
                                          * accepted) */
145
 
    bool               m_UnitSelectionLocked;  /* True if units are different
146
 
                                                * and their selection is
147
 
                                                * locked (i.e. if part A cannot
148
 
                                                * be automatically changed in
149
 
                                                * part B */
150
 
    int                m_TextInside;     /* if 0: pin name drawn on the pin
151
 
                                          * itself if > 0 pin name drawn inside
152
 
                                          * the component, with a distance of
153
 
                                          * m_TextInside in mils */
154
 
    bool               m_DrawPinNum;
155
 
    bool               m_DrawPinName;
156
 
    long               m_LastDate;       // Last change Date
157
 
 
158
 
protected:
159
 
    LibrEntryOptions   m_options;      // special features (i.e. Entry is a POWER)
160
 
    int                unitCount;      /* Units (parts) per package */
161
 
    LIB_DRAW_ITEM_LIST drawings;       /* How to draw this part */
162
 
 
163
 
public:
 
140
 
164
141
    /* Offsets used in editing library component,
165
142
     * for handle aliases data in m_AliasListData array string
166
143
     * when editing a library component, aliases data is stored
178
155
        ALIAS_DOC_FILENAME_IDX = 3,
179
156
        ALIAS_NEXT_IDX         = 4
180
157
    };
 
158
 
181
159
private:
 
160
    int                m_pinNameOffset;  ///< The offset in mils to draw the pin name.  Set to 0
 
161
                                         ///< to draw the pin name above the pin.
 
162
    bool               m_unitsLocked;    ///< True if component has multple parts and changing
 
163
                                         ///< one part does not automatically change another part.
 
164
    bool               m_showPinNames;   ///< Determines if component pin names are visible.
 
165
    bool               m_showPinNumbers; ///< Determines if component pin numbers are visible.
 
166
    long               m_dateModified;   ///< Date the component was last modified.
 
167
    LibrEntryOptions   m_options;        // special features (i.e. Entry is a POWER)
 
168
    int                unitCount;        /* Units (parts) per package */
 
169
    LIB_DRAW_ITEM_LIST drawings;         /* How to draw this part */
182
170
    wxArrayString      m_aliasListData;  /* ALIAS data (name, doc, keywords and doc filename).
183
171
                                          * Used only by the component editor LibEdit
184
172
                                          * to store aliases info during edition
281
269
    bool Save( FILE* aFile );
282
270
 
283
271
    /**
284
 
     * Load component definition from /a aFile.
 
272
     * Load component definition from \a aFile.
285
273
     *
286
274
     * @param aFile - File descriptor of file to load form.
287
275
     * @param aLine - The first line of the component definition.
291
279
     */
292
280
    bool Load( FILE* aFile, char* aLine, int* aLineNum, wxString& aErrorMsg );
293
281
    bool LoadField( char* aLine, wxString& aErrorMsg );
294
 
    bool LoadDrawEntries( FILE* aFile, char* aLine,
295
 
                          int* aLineNum, wxString& aErrorMsg );
 
282
    bool LoadDrawEntries( FILE* aFile, char* aLine, int* aLineNum, wxString& aErrorMsg );
296
283
    bool LoadAliases( char* aLine, wxString& aErrorMsg );
297
 
    bool LoadFootprints( FILE* aFile, char* aLine,
298
 
                         int* aLineNum, wxString& aErrorMsg );
 
284
    bool LoadFootprints( FILE* aFile, char* aLine, int* aLineNum, wxString& aErrorMsg );
299
285
 
300
286
    bool isPower() { return m_options == ENTRY_POWER; }
301
287
    bool isNormal() { return m_options == ENTRY_NORMAL; }
303
289
    void SetPower() { m_options = ENTRY_POWER; }
304
290
    void SetNormal() { m_options = ENTRY_NORMAL; }
305
291
 
 
292
    void LockUnits( bool aLockUnits ) { m_unitsLocked = aLockUnits; }
 
293
    bool UnitsLocked() { return m_unitsLocked; }
 
294
 
306
295
    /**
307
296
     * Function SetFields
308
297
     * overwrites all the existing in this component with fields supplied
381
370
               const int aTransform[2][2] );
382
371
 
383
372
    /**
384
 
     * Add a new draw /a aItem to the draw object list.
 
373
     * Add a new draw \a aItem to the draw object list.
385
374
     *
386
375
     * @param item - New draw object to add to component.
387
376
     */
388
377
    void AddDrawItem( LIB_DRAW_ITEM* aItem );
389
378
 
390
379
    /**
391
 
     * Remove draw /a aItem from list.
 
380
     * Remove draw \a aItem from list.
392
381
     *
393
382
     * @param aItem - Draw item to remove from list.
394
383
     * @param aPanel - Panel to remove part from.
395
384
     * @param aDc - Device context to remove part from.
396
385
     */
397
 
    void RemoveDrawItem( LIB_DRAW_ITEM* aItem,
398
 
                         WinEDA_DrawPanel* aPanel = NULL,
399
 
                         wxDC* aDc = NULL );
 
386
    void RemoveDrawItem( LIB_DRAW_ITEM* aItem, WinEDA_DrawPanel* aPanel = NULL, wxDC* aDc = NULL );
400
387
 
401
388
    /**
402
389
     * Return the next draw object pointer.
407
394
     *                if TYPE_NOT_INIT search for all items types
408
395
     * @return - The next drawing object in the list if found, otherwise NULL.
409
396
     */
410
 
 
411
 
    LIB_DRAW_ITEM* GetNextDrawItem( LIB_DRAW_ITEM* aItem = NULL,
412
 
                                    KICAD_T aType = TYPE_NOT_INIT );
 
397
    LIB_DRAW_ITEM* GetNextDrawItem( LIB_DRAW_ITEM* aItem = NULL, KICAD_T aType = TYPE_NOT_INIT );
413
398
 
414
399
    /**
415
400
     * Return the next pin object from the draw list.
422
407
     */
423
408
    LIB_PIN* GetNextPin( LIB_PIN* aItem = NULL )
424
409
    {
425
 
        return (LIB_PIN*) GetNextDrawItem( (LIB_DRAW_ITEM*) aItem,
426
 
                                           COMPONENT_PIN_DRAW_TYPE );
 
410
        return (LIB_PIN*) GetNextDrawItem( (LIB_DRAW_ITEM*) aItem, COMPONENT_PIN_DRAW_TYPE );
427
411
    }
428
412
 
429
413
 
443
427
    void GetPins( LIB_PIN_LIST& aList, int aUnit = 0, int aConvert = 0 );
444
428
 
445
429
    /**
446
 
     * Return pin object with the requested pin /a aNumber.
 
430
     * Return pin object with the requested pin \a aNumber.
447
431
     *
448
432
     * @param aNumber - Number of the pin to find.
449
433
     * @param aUnit - Unit of the component to find.  Set to 0 if a specific
455
439
    LIB_PIN* GetPin( const wxString& aNumber, int aUnit = 0, int aConvert = 0 );
456
440
 
457
441
    /**
458
 
     * Move the component /a aOffset.
 
442
     * Move the component \a aOffset.
459
443
     *
460
444
     * @param aOffset - Offset displacement.
461
445
     */
474
458
    bool HasConversion() const;
475
459
 
476
460
    /**
477
 
     * Test if alias /a aName is in component alias list.
 
461
     * Test if alias \a aName is in component alias list.
478
462
     *
479
463
     * Alias name comparisons are case insensitive.
480
464
     *
506
490
     * @return The number of draw objects found inside the block select
507
491
     *         rectangle.
508
492
     */
509
 
    int SelectItems( EDA_Rect& aRect, int aUnit, int aConvert,
510
 
                     bool aEditPinByPin );
 
493
    int SelectItems( EDA_Rect& aRect, int aUnit, int aConvert, bool aEditPinByPin );
511
494
 
512
495
    /**
513
496
     * Clears all the draw items marked by a block select.
553
536
     * @param aPoint - Coordinate for hit testing.
554
537
     * @return The draw object if found.  Otherwise NULL.
555
538
     */
556
 
    LIB_DRAW_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType,
557
 
                                   const wxPoint& aPoint );
 
539
    LIB_DRAW_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, const wxPoint& aPoint );
558
540
 
559
541
    /**
560
542
     * Locate a draw object (overlaid)
567
549
     * @return The draw object if found.  Otherwise NULL.
568
550
     */
569
551
    LIB_DRAW_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType,
570
 
                                   const wxPoint& aPoint,
571
 
                                   const int aTransfrom[2][2] );
 
552
                                   const wxPoint& aPoint, const int aTransfrom[2][2] );
572
553
 
573
554
    /**
574
555
     * Return a reference to the draw item list.
617
598
     * @param aSetConvert - Set or clear the component alternate body style.
618
599
     */
619
600
    void SetConversion( bool aSetConvert );
 
601
 
 
602
    /**
 
603
     * Set the offset in mils of the pin name text from the pin symbol.
 
604
     *
 
605
     * Set the offset to 0 to draw the pin name above the pin symbol.
 
606
     *
 
607
     * @param aOffset - The offset in mils.
 
608
     */
 
609
    void SetPinNameOffset( int aOffset ) { m_pinNameOffset = aOffset; }
 
610
 
 
611
    int GetPinNameOffset() { return m_pinNameOffset; }
 
612
 
 
613
    /**
 
614
     * Set or clear the pin name visibility flag.
 
615
     *
 
616
     * @param aShow - True to make the component pin names visible.
 
617
     */
 
618
    void SetShowPinNames( bool aShow ) { m_showPinNames = aShow; }
 
619
 
 
620
    bool ShowPinNames() { return m_showPinNames; }
 
621
 
 
622
    /**
 
623
     * Set or clear the pin number visibility flag.
 
624
     *
 
625
     * @param aShow - True to make the component pin numbers visible.
 
626
     */
 
627
    void SetShowPinNumbers( bool aShow ) { m_showPinNumbers = aShow; }
 
628
 
 
629
    bool ShowPinNumbers() { return m_showPinNumbers; }
620
630
};
621
631
 
622
632