2008-04-14 19:22:48 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* sch_item_struct.h : Basic classes for most eeschema items descriptions */
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef SCH_ITEM_STRUCT_H
|
|
|
|
#define SCH_ITEM_STRUCT_H
|
|
|
|
|
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
class WinEDA_SchematicFrame;
|
2010-03-16 18:22:59 +00:00
|
|
|
class wxFindReplaceData;
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class SCH_ITEM
|
|
|
|
* is a base class for any item which can be embedded within the SCHEMATIC
|
|
|
|
* container class, and therefore instances of derived classes should only be
|
|
|
|
* found in EESCHEMA or other programs that use class SCHEMATIC and its contents.
|
|
|
|
* The corresponding class in PCBNEW is BOARD_ITEM.
|
|
|
|
*/
|
|
|
|
class SCH_ITEM : public EDA_BaseStruct
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
int m_Layer;
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
2008-04-15 19:38:19 +00:00
|
|
|
SCH_ITEM( EDA_BaseStruct* aParent, KICAD_T aType );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
~SCH_ITEM();
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
|
|
|
return wxT( "SCH_ITEM" );
|
|
|
|
}
|
|
|
|
|
|
|
|
SCH_ITEM* Next() { return (SCH_ITEM*) Pnext; }
|
2010-03-16 18:22:59 +00:00
|
|
|
SCH_ITEM* Back() { return (SCH_ITEM*) Pback; }
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetLayer
|
|
|
|
* returns the layer this item is on.
|
|
|
|
*/
|
|
|
|
int GetLayer() const { return m_Layer; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetLayer
|
|
|
|
* sets the layer this item is on.
|
|
|
|
* @param aLayer The layer number.
|
|
|
|
*/
|
|
|
|
void SetLayer( int aLayer ) { m_Layer = aLayer; }
|
|
|
|
|
2009-06-30 19:21:41 +00:00
|
|
|
/** Function GetPenSize virtual pure
|
|
|
|
* @return the size of the "pen" that be used to draw or plot this item
|
|
|
|
*/
|
|
|
|
virtual int GetPenSize( ) = 0;
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
/**
|
|
|
|
* Function Draw
|
|
|
|
*/
|
|
|
|
virtual void Draw( WinEDA_DrawPanel* panel,
|
|
|
|
wxDC* DC,
|
|
|
|
const wxPoint& offset,
|
|
|
|
int draw_mode,
|
|
|
|
int Color = -1 ) = 0;
|
|
|
|
|
|
|
|
|
2009-07-27 14:32:40 +00:00
|
|
|
/* Place function */
|
2008-04-17 16:25:29 +00:00
|
|
|
virtual void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-07-27 14:32:40 +00:00
|
|
|
// Geometric transforms (used in block operations):
|
|
|
|
/** virtual function Move
|
|
|
|
* move item to a new position.
|
|
|
|
* @param aMoveVector = the deplacement vector
|
|
|
|
*/
|
|
|
|
virtual void Move(const wxPoint& aMoveVector) = 0;
|
|
|
|
|
|
|
|
/** 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) = 0;
|
|
|
|
|
2008-04-15 19:38: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 "*.sch"
|
|
|
|
* format.
|
2008-04-15 19:38:19 +00:00
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
|
|
|
virtual bool Save( FILE* aFile ) const = 0;
|
2010-03-16 18:22:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Compare schematic item against search string.
|
|
|
|
*
|
|
|
|
* The base class returns false since many of the objects derived from
|
|
|
|
* SCH_ITEM do not have any text to search.
|
|
|
|
*
|
|
|
|
* @todo - This should probably be pushed down to EDA_BaseStruct so that
|
|
|
|
* searches can be done on all of the Kicad applications that use
|
|
|
|
* objects derived from EDA_BaseStruct.
|
|
|
|
*
|
|
|
|
* @param aSearchData - The search criteria.
|
2010-04-01 13:15:48 +00:00
|
|
|
* @param aAuxData - a pointer on auxiliary data, if needed (NULL if not used).
|
|
|
|
* When searching string in REFERENCE field we must know the sheet path
|
|
|
|
* This param is used in such cases
|
2010-03-16 18:22:59 +00:00
|
|
|
* @return True if this schematic text item matches the search criteria.
|
|
|
|
*/
|
2010-04-01 13:15:48 +00:00
|
|
|
virtual bool Matches( wxFindReplaceData& aSearchData, void * aAuxData )
|
|
|
|
{ return false; }
|
2010-03-16 18:22:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Compare schematic item against search string.
|
|
|
|
*
|
|
|
|
* @param aText - String test.
|
|
|
|
* @param aSearchData - The criteria to search against.
|
|
|
|
* @return True if this item matches the search criteria.
|
|
|
|
*/
|
|
|
|
bool Matches( const wxString& aText, wxFindReplaceData& aSearchData );
|
2008-04-14 19:22:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* SCH_ITEM_STRUCT_H */
|