2008-02-21 20:49:15 +00:00
|
|
|
/********************************************/
|
2009-11-03 13:26:31 +00:00
|
|
|
/* Definitions for the EESchema program: */
|
2008-02-21 20:49:15 +00:00
|
|
|
/********************************************/
|
|
|
|
|
|
|
|
#ifndef CLASS_TEXT_LABEL_H
|
|
|
|
#define CLASS_TEXT_LABEL_H
|
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2008-02-21 20:49:15 +00:00
|
|
|
#include "macros.h"
|
2010-11-10 15:30:12 +00:00
|
|
|
#include "sch_item_struct.h"
|
|
|
|
|
|
|
|
|
|
|
|
class LINE_READER;
|
|
|
|
|
2008-02-21 20:49:15 +00:00
|
|
|
|
2009-05-12 12:12:34 +00:00
|
|
|
/* Type of SCH_HIERLABEL and SCH_GLOBALLABEL
|
|
|
|
* mainly used to handle the graphic associated shape
|
2009-11-03 13:26:31 +00:00
|
|
|
*/
|
2008-02-21 20:49:15 +00:00
|
|
|
typedef enum {
|
|
|
|
NET_INPUT,
|
|
|
|
NET_OUTPUT,
|
|
|
|
NET_BIDI,
|
|
|
|
NET_TRISTATE,
|
|
|
|
NET_UNSPECIFIED,
|
2009-05-12 12:12:34 +00:00
|
|
|
NET_TMAX /* Last value */
|
2008-02-21 20:49:15 +00:00
|
|
|
} TypeSheetLabel;
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2009-05-12 12:12:34 +00:00
|
|
|
extern const char* SheetLabelType[]; /* names of types of labels */
|
2009-05-09 21:54:33 +00:00
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
class SCH_TEXT : public SCH_ITEM, public EDA_TextStruct
|
2009-05-12 12:12:34 +00:00
|
|
|
{
|
2008-02-21 20:49:15 +00:00
|
|
|
public:
|
|
|
|
int m_Shape;
|
2009-11-03 13:26:31 +00:00
|
|
|
bool m_IsDangling; // true if not connected (used to draw the "not
|
|
|
|
// connected" symbol
|
2009-05-12 12:12:34 +00:00
|
|
|
protected:
|
2009-11-03 13:26:31 +00:00
|
|
|
int m_SchematicOrientation; /* orientation of texts (comments) and
|
|
|
|
* labels in schematic
|
|
|
|
* 0 = normal (horizontal, left
|
|
|
|
* justified).
|
2009-05-12 12:12:34 +00:00
|
|
|
* 1 = up (vertical)
|
2009-11-03 13:26:31 +00:00
|
|
|
* 2 = (horizontal, right justified).
|
|
|
|
* This can be seen as the mirrored
|
|
|
|
* position of 0
|
|
|
|
* 3 = bottom . This can be seen as the
|
|
|
|
* mirrored position of up
|
|
|
|
* this is perhaps a duplicate of m_Orient
|
|
|
|
* and m_HJustified or m_VJustified,
|
|
|
|
* but is more easy to handle that 3
|
|
|
|
* parameters in editions, Reading and
|
|
|
|
* Saving file
|
2009-05-12 12:12:34 +00:00
|
|
|
*/
|
|
|
|
|
2008-02-21 20:49:15 +00:00
|
|
|
public:
|
2009-11-03 13:26:31 +00:00
|
|
|
SCH_TEXT( const wxPoint& pos = wxPoint( 0, 0 ),
|
|
|
|
const wxString& text = wxEmptyString,
|
2010-12-10 19:47:44 +00:00
|
|
|
KICAD_T aType = SCH_TEXT_T );
|
2010-12-21 15:13:09 +00:00
|
|
|
|
|
|
|
SCH_TEXT( const SCH_TEXT& aText );
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
~SCH_TEXT() { }
|
2008-02-21 20:49:15 +00:00
|
|
|
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
return wxT( "SCH_TEXT" );
|
2008-02-21 20:49:15 +00:00
|
|
|
}
|
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
/**
|
|
|
|
* Function IncrementLabel
|
|
|
|
* increments the label text.
|
|
|
|
*/
|
|
|
|
void IncrementLabel();
|
2008-02-21 20:49:15 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SetTextOrientAndJustifyParmeters
|
2009-05-12 12:12:34 +00:00
|
|
|
* Set m_SchematicOrientation, and initialize
|
2009-11-03 13:26:31 +00:00
|
|
|
* m_orient,m_HJustified and m_VJustified, according to the value of
|
|
|
|
* m_SchematicOrientation (for a text )
|
2009-05-12 12:12:34 +00:00
|
|
|
* must be called after changing m_SchematicOrientation
|
|
|
|
* @param aSchematicOrientation =
|
|
|
|
* 0 = normal (horizontal, left justified).
|
|
|
|
* 1 = up (vertical)
|
2009-11-03 13:26:31 +00:00
|
|
|
* 2 = (horizontal, right justified). This can be seen as the mirrored
|
|
|
|
* position of 0
|
2009-05-12 12:12:34 +00:00
|
|
|
* 3 = bottom . This can be seen as the mirrored position of up
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
|
2009-05-12 12:12:34 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
int GetSchematicTextOrientation() { return m_SchematicOrientation; }
|
2009-05-12 12:12:34 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetSchematicTextOffset (virtual)
|
2009-11-03 13:26:31 +00:00
|
|
|
* @return the offset between the SCH_TEXT position and the text itself
|
|
|
|
* position
|
2009-05-12 12:12:34 +00:00
|
|
|
* This offset depend on orientation, and the type of text
|
2009-11-03 13:26:31 +00:00
|
|
|
* (room to draw an associated graphic symbol, or put the text above a
|
|
|
|
* wire)
|
2009-05-12 12:12:34 +00:00
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
virtual wxPoint GetSchematicTextOffset();
|
2009-05-12 12:12:34 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
SCH_TEXT* GenCopy();
|
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
virtual void Draw( EDA_DRAW_PANEL* panel,
|
|
|
|
wxDC* DC,
|
|
|
|
const wxPoint& offset,
|
|
|
|
int draw_mode,
|
|
|
|
int Color = -1 );
|
2008-02-21 20:49:15 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function CreateGraphicShape
|
2010-09-11 16:33:43 +00:00
|
|
|
* Calculates the graphic shape (a polygon) associated to the text
|
|
|
|
* @param aCorner_list = a buffer to fill with polygon corners coordinates
|
|
|
|
* @param Pos = Postion of the shape
|
|
|
|
* for texts and labels: do nothing
|
|
|
|
* Mainly for derived classes (SCH_SHEET_PIN and Hierarchical labels)
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
virtual void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos )
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
|
|
|
aCorner_list.clear();
|
|
|
|
}
|
2008-02-21 20:49:15 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
void SwapData( SCH_TEXT* copyitem );
|
2009-01-31 18:08:47 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
void Place( SCH_EDIT_FRAME* frame, wxDC* DC );
|
2009-01-31 18:08:47 +00:00
|
|
|
|
2009-11-28 09:24:37 +00:00
|
|
|
/**
|
|
|
|
* Function GetBoundingBox
|
|
|
|
* returns the orthogonal, bounding box of this object for display purposes.
|
|
|
|
* This box should be an enclosing perimeter for visible components of this
|
|
|
|
* object, and the units should be in the pcb or schematic coordinate system.
|
|
|
|
* It is OK to overestimate the size by a few counts.
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
EDA_Rect GetBoundingBox() const;
|
2008-04-15 19:38:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Save
|
2009-11-03 13:26:31 +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.
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
bool Save( FILE* aFile ) const;
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
/**
|
|
|
|
* Load schematic text entry from \a aLine in a .sch file.
|
|
|
|
*
|
|
|
|
* @param aLine - Essentially this is file to read schematic text from.
|
|
|
|
* @param aErrorMsg - Description of the error if an error occurs while loading the
|
|
|
|
* schematic text.
|
|
|
|
* @return True if the schematic text loaded successfully.
|
|
|
|
*/
|
|
|
|
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetPenSize
|
2009-06-30 17:57:27 +00:00
|
|
|
* @return the size of the "pen" that be used to draw or plot this item
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
int GetPenSize() const;
|
2009-06-30 17:57:27 +00:00
|
|
|
|
2009-07-27 14:32:40 +00:00
|
|
|
// Geometric transforms (used in block operations):
|
2009-11-03 13:26:31 +00:00
|
|
|
|
2009-07-27 14:32:40 +00:00
|
|
|
/** virtual function Move
|
|
|
|
* move item to a new position.
|
2009-11-03 13:26:31 +00:00
|
|
|
* @param aMoveVector = the displacement vector
|
2009-07-27 14:32:40 +00:00
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
virtual void Move( const wxPoint& aMoveVector )
|
2009-07-27 14:32:40 +00:00
|
|
|
{
|
|
|
|
m_Pos += aMoveVector;
|
|
|
|
}
|
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
/**
|
|
|
|
* Function Mirror_Y
|
|
|
|
* mirrors the item relative to \a aYaxisPosition.
|
|
|
|
* @param aYaxis_position The y axis coordinate to mirror around.
|
2009-07-27 14:32:40 +00:00
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
virtual void Mirror_Y( int aYaxis_position );
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
virtual void Rotate( wxPoint rotationPoint );
|
|
|
|
|
|
|
|
virtual void Mirror_X( int aXaxis_position );
|
2009-06-30 17:57:27 +00:00
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
/**
|
|
|
|
* Compare schematic text entry against search string.
|
|
|
|
*
|
|
|
|
* @param aSearchData - Criterial to search against.
|
2010-04-01 13:15:48 +00:00
|
|
|
* @param aAuxData - a pointer on auxiliary data, if needed. Can be null
|
2010-10-20 19:43:58 +00:00
|
|
|
* @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
|
2010-03-16 18:22:59 +00:00
|
|
|
* @return True if this schematic text item matches the search criteria.
|
|
|
|
*/
|
2010-11-03 14:13:15 +00:00
|
|
|
virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
|
|
|
|
|
|
|
|
virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList );
|
|
|
|
|
|
|
|
virtual bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList );
|
|
|
|
|
|
|
|
virtual bool IsDangling() const { return m_IsDangling; }
|
|
|
|
|
|
|
|
virtual bool IsSelectStateChanged( const wxRect& aRect );
|
|
|
|
|
|
|
|
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2008-04-22 16:38:23 +00:00
|
|
|
#if defined(DEBUG)
|
2009-05-12 12:12:34 +00:00
|
|
|
void Show( int nestLevel, std::ostream& os );
|
2008-04-22 16:38:23 +00:00
|
|
|
#endif
|
2010-12-10 19:47:44 +00:00
|
|
|
|
|
|
|
private:
|
2010-12-21 15:13:09 +00:00
|
|
|
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const;
|
|
|
|
virtual bool doHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
|
|
|
|
virtual EDA_ITEM* doClone() const;
|
2008-02-21 20:49:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
class SCH_LABEL : public SCH_TEXT
|
2008-02-21 20:49:15 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-12-10 19:47:44 +00:00
|
|
|
SCH_LABEL( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
|
2010-12-21 15:13:09 +00:00
|
|
|
|
|
|
|
SCH_LABEL( const SCH_LABEL& aLabel );
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
~SCH_LABEL() { }
|
2010-12-10 19:47:44 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
virtual void Draw( EDA_DRAW_PANEL* panel,
|
|
|
|
wxDC* DC,
|
|
|
|
const wxPoint& offset,
|
|
|
|
int draw_mode,
|
|
|
|
int Color = -1 );
|
2008-02-21 20:49:15 +00:00
|
|
|
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
2008-03-27 17:05:59 +00:00
|
|
|
return wxT( "SCH_LABEL" );
|
2008-02-21 20:49:15 +00:00
|
|
|
}
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SetTextOrientAndJustifyParmeters
|
2009-05-12 12:12:34 +00:00
|
|
|
* Set m_SchematicOrientation, and initialize
|
2009-11-03 13:26:31 +00:00
|
|
|
* m_orient,m_HJustified and m_VJustified, according to the value of
|
|
|
|
* m_SchematicOrientation (for a label)
|
2009-05-12 12:12:34 +00:00
|
|
|
* must be called after changing m_SchematicOrientation
|
|
|
|
* @param aSchematicOrientation =
|
|
|
|
* 0 = normal (horizontal, left justified).
|
|
|
|
* 1 = up (vertical)
|
2009-11-03 13:26:31 +00:00
|
|
|
* 2 = (horizontal, right justified). This can be seen as the mirrored
|
|
|
|
* position of 0
|
2009-05-12 12:12:34 +00:00
|
|
|
* 3 = bottom . This can be seen as the mirrored position of up
|
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
|
2009-05-12 12:12:34 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetSchematicTextOffset (virtual)
|
2009-11-03 13:26:31 +00:00
|
|
|
* @return the offset between the SCH_TEXT position and the text itself
|
|
|
|
* position
|
2009-05-12 12:12:34 +00:00
|
|
|
* This offset depend on orientation, and the type of text
|
2009-11-03 13:26:31 +00:00
|
|
|
* (room to draw an associated graphic symbol, or put the text above a
|
|
|
|
* wire)
|
2009-05-12 12:12:34 +00:00
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
virtual wxPoint GetSchematicTextOffset();
|
2010-12-21 15:13:09 +00:00
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
virtual void Mirror_X( int aXaxis_position );
|
2010-12-21 15:13:09 +00:00
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
virtual void Rotate( wxPoint rotationPoint );
|
2009-05-12 12:12:34 +00:00
|
|
|
|
2009-11-28 09:24:37 +00:00
|
|
|
/**
|
|
|
|
* Function GetBoundingBox
|
|
|
|
* returns the orthogonal, bounding box of this object for display purposes.
|
|
|
|
* This box should be an enclosing perimeter for visible components of this
|
|
|
|
* object, and the units should be in the pcb or schematic coordinate system.
|
|
|
|
* It is OK to overestimate the size by a few counts.
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
EDA_Rect GetBoundingBox() const;
|
2009-11-28 09:24:37 +00:00
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
/**
|
|
|
|
* Function Save
|
2009-11-03 13:26:31 +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.
|
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
bool Save( FILE* aFile ) const;
|
2010-11-10 15:30:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Load schematic label entry from \a aLine in a .sch file.
|
|
|
|
*
|
|
|
|
* @param aLine - Essentially this is file to read schematic label from.
|
|
|
|
* @param aErrorMsg - Description of the error if an error occurs while loading the
|
|
|
|
* schematic label.
|
|
|
|
* @return True if the schematic label loaded successfully.
|
|
|
|
*/
|
|
|
|
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
|
2010-12-13 15:59:00 +00:00
|
|
|
|
2011-01-07 19:24:24 +00:00
|
|
|
virtual bool IsConnectable() const { return true; }
|
|
|
|
|
2010-12-13 15:59:00 +00:00
|
|
|
private:
|
2010-12-21 15:13:09 +00:00
|
|
|
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const;
|
|
|
|
virtual EDA_ITEM* doClone() const;
|
2008-02-21 20:49:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
class SCH_GLOBALLABEL : public SCH_TEXT
|
2008-02-21 20:49:15 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-12-10 19:47:44 +00:00
|
|
|
SCH_GLOBALLABEL( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
|
2010-12-21 15:13:09 +00:00
|
|
|
|
|
|
|
SCH_GLOBALLABEL( const SCH_GLOBALLABEL& aGlobalLabel );
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
~SCH_GLOBALLABEL() { }
|
2010-12-10 19:47:44 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
virtual void Draw( EDA_DRAW_PANEL* panel,
|
|
|
|
wxDC* DC,
|
|
|
|
const wxPoint& offset,
|
|
|
|
int draw_mode,
|
|
|
|
int Color = -1 );
|
2008-02-21 20:49:15 +00:00
|
|
|
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
2008-03-27 17:05:59 +00:00
|
|
|
return wxT( "SCH_GLOBALLABEL" );
|
2008-02-21 20:49:15 +00:00
|
|
|
}
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SetTextOrientAndJustifyParmeters
|
2009-05-12 12:12:34 +00:00
|
|
|
* Set m_SchematicOrientation, and initialize
|
2009-11-03 13:26:31 +00:00
|
|
|
* m_orient,m_HJustified and m_VJustified, according to the value of
|
|
|
|
* m_SchematicOrientation
|
2009-05-12 12:12:34 +00:00
|
|
|
* must be called after changing m_SchematicOrientation
|
|
|
|
* @param aSchematicOrientation =
|
|
|
|
* 0 = normal (horizontal, left justified).
|
|
|
|
* 1 = up (vertical)
|
2009-11-03 13:26:31 +00:00
|
|
|
* 2 = (horizontal, right justified). This can be seen as the mirrored
|
|
|
|
* position of 0
|
2009-05-12 12:12:34 +00:00
|
|
|
* 3 = bottom . This can be seen as the mirrored position of up
|
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
|
2009-05-12 12:12:34 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetSchematicTextOffset (virtual)
|
2009-11-03 13:26:31 +00:00
|
|
|
* @return the offset between the SCH_TEXT position and the text itself
|
|
|
|
* position
|
2009-05-12 12:12:34 +00:00
|
|
|
* This offset depend on orientation, and the type of text
|
2009-11-03 13:26:31 +00:00
|
|
|
* (room to draw an associated graphic symbol, or put the text above a
|
|
|
|
* wire)
|
2009-05-12 12:12:34 +00:00
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
virtual wxPoint GetSchematicTextOffset();
|
2009-05-12 12:12:34 +00:00
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
/**
|
|
|
|
* Function Save
|
2009-11-03 13:26:31 +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.
|
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
bool Save( FILE* aFile ) const;
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
/**
|
|
|
|
* Load schematic global label entry from \a aLine in a .sch file.
|
|
|
|
*
|
|
|
|
* @param aLine - Essentially this is file to read schematic global label from.
|
|
|
|
* @param aErrorMsg - Description of the error if an error occurs while loading the
|
|
|
|
* schematic global label.
|
|
|
|
* @return True if the schematic global label loaded successfully.
|
|
|
|
*/
|
|
|
|
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
|
|
|
|
|
2009-11-28 09:24:37 +00:00
|
|
|
/**
|
|
|
|
* Function GetBoundingBox
|
|
|
|
* returns the orthogonal, bounding box of this object for display purposes.
|
|
|
|
* This box should be an enclosing perimeter for visible components of this
|
|
|
|
* object, and the units should be in the pcb or schematic coordinate system.
|
|
|
|
* It is OK to overestimate the size by a few counts.
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
EDA_Rect GetBoundingBox() const;
|
2009-05-05 17:32:07 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function CreateGraphicShape (virual)
|
2009-05-12 12:12:34 +00:00
|
|
|
* Calculates the graphic shape (a polygon) associated to the text
|
|
|
|
* @param aCorner_list = a buffer to fill with polygon corners coordinates
|
2010-09-11 16:33:43 +00:00
|
|
|
* @param aPos = Position of the shape
|
2009-05-05 17:32:07 +00:00
|
|
|
*/
|
2010-12-21 15:13:09 +00:00
|
|
|
virtual void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& aPos );
|
2009-07-27 14:32:40 +00:00
|
|
|
|
|
|
|
/** virtual function Mirror_Y
|
|
|
|
* mirror item relative to an Y axis
|
|
|
|
* @param aYaxis_position = the y axis position
|
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
virtual void Mirror_Y( int aYaxis_position );
|
2010-12-14 15:56:30 +00:00
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
virtual void Mirror_X( int aXaxis_position );
|
2010-12-14 15:56:30 +00:00
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
virtual void Rotate( wxPoint rotationPoint );
|
2010-12-13 15:59:00 +00:00
|
|
|
|
2011-01-07 19:24:24 +00:00
|
|
|
virtual bool IsConnectable() const { return true; }
|
|
|
|
|
2010-12-13 15:59:00 +00:00
|
|
|
private:
|
2010-12-21 15:13:09 +00:00
|
|
|
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const;
|
|
|
|
virtual EDA_ITEM* doClone() const;
|
2008-02-21 20:49:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
class SCH_HIERLABEL : public SCH_TEXT
|
2008-02-21 20:49:15 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-03-20 01:50:21 +00:00
|
|
|
SCH_HIERLABEL( const wxPoint& pos = wxPoint( 0, 0 ),
|
2010-12-10 19:47:44 +00:00
|
|
|
const wxString& text = wxEmptyString,
|
|
|
|
KICAD_T aType = SCH_HIERARCHICAL_LABEL_T );
|
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
SCH_HIERLABEL( const SCH_HIERLABEL& aHierLabel );
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
~SCH_HIERLABEL() { }
|
2010-12-21 15:13:09 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
virtual void Draw( EDA_DRAW_PANEL* panel,
|
|
|
|
wxDC* DC,
|
|
|
|
const wxPoint& offset,
|
|
|
|
int draw_mode,
|
|
|
|
int Color = -1 );
|
2008-02-21 20:49:15 +00:00
|
|
|
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
2008-03-27 17:05:59 +00:00
|
|
|
return wxT( "SCH_HIERLABEL" );
|
2008-02-21 20:49:15 +00:00
|
|
|
}
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SetTextOrientAndJustifyParmeters
|
2009-05-12 12:12:34 +00:00
|
|
|
* Set m_SchematicOrientation, and initialize
|
2009-11-03 13:26:31 +00:00
|
|
|
* m_orient,m_HJustified and m_VJustified, according to the value of
|
|
|
|
* m_SchematicOrientation
|
2009-05-12 12:12:34 +00:00
|
|
|
* must be called after changing m_SchematicOrientation
|
|
|
|
* @param aSchematicOrientation =
|
|
|
|
* 0 = normal (horizontal, left justified).
|
|
|
|
* 1 = up (vertical)
|
2009-11-03 13:26:31 +00:00
|
|
|
* 2 = (horizontal, right justified). This can be seen as the mirrored
|
|
|
|
* position of 0
|
2009-05-12 12:12:34 +00:00
|
|
|
* 3 = bottom . This can be seen as the mirrored position of up
|
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
|
2009-05-12 12:12:34 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetSchematicTextOffset (virtual)
|
2009-11-03 13:26:31 +00:00
|
|
|
* @return the offset between the SCH_TEXT position and the text itself
|
|
|
|
* position
|
2009-05-12 12:12:34 +00:00
|
|
|
* This offset depend on orientation, and the type of text
|
2009-11-03 13:26:31 +00:00
|
|
|
* (room to draw an associated graphic symbol, or put the text above a
|
|
|
|
* wire)
|
2009-05-12 12:12:34 +00:00
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
virtual wxPoint GetSchematicTextOffset();
|
2009-05-12 12:12:34 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function CreateGraphicShape
|
2009-05-12 12:12:34 +00:00
|
|
|
* Calculates the graphic shape (a polygon) associated to the text
|
|
|
|
* @param aCorner_list = a buffer to fill with polygon corners coordinates
|
|
|
|
* @param Pos = Postion of the shape
|
|
|
|
*/
|
2010-12-21 15:13:09 +00:00
|
|
|
virtual void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos );
|
2008-03-30 09:27:53 +00:00
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
/**
|
|
|
|
* Function Save
|
2009-11-03 13:26:31 +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.
|
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
bool Save( FILE* aFile ) const;
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
/**
|
|
|
|
* Load schematic hierarchical label entry from \a aLine in a .sch file.
|
|
|
|
*
|
|
|
|
* @param aLine - Essentially this is file to read schematic hierarchical label from.
|
|
|
|
* @param aErrorMsg - Description of the error if an error occurs while loading the
|
|
|
|
* schematic hierarchical label.
|
|
|
|
* @return True if the schematic hierarchical label loaded successfully.
|
|
|
|
*/
|
|
|
|
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
|
|
|
|
|
2009-11-28 09:24:37 +00:00
|
|
|
/**
|
|
|
|
* Function GetBoundingBox
|
|
|
|
* returns the orthogonal, bounding box of this object for display purposes.
|
|
|
|
* This box should be an enclosing perimeter for visible components of this
|
|
|
|
* object, and the units should be in the pcb or schematic coordinate system.
|
|
|
|
* It is OK to overestimate the size by a few counts.
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
EDA_Rect GetBoundingBox() const;
|
2009-01-31 18:08:47 +00:00
|
|
|
|
2009-07-27 14:32:40 +00:00
|
|
|
/** virtual function Mirror_Y
|
|
|
|
* mirror item relative to an Y axis
|
|
|
|
* @param aYaxis_position = the y axis position
|
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
virtual void Mirror_Y( int aYaxis_position );
|
2010-12-14 15:56:30 +00:00
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
virtual void Mirror_X( int aXaxis_position );
|
2010-12-14 15:56:30 +00:00
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
virtual void Rotate( wxPoint rotationPoint );
|
2010-12-13 15:59:00 +00:00
|
|
|
|
2011-01-07 19:24:24 +00:00
|
|
|
virtual bool IsConnectable() const { return true; }
|
|
|
|
|
2010-12-13 15:59:00 +00:00
|
|
|
private:
|
2010-12-21 15:13:09 +00:00
|
|
|
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const;
|
|
|
|
virtual EDA_ITEM* doClone() const;
|
2008-02-21 20:49:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* CLASS_TEXT_LABEL_H */
|