2008-02-21 20:49:15 +00:00
|
|
|
/********************************************/
|
|
|
|
/* Definitions for the EESchema program: */
|
|
|
|
/********************************************/
|
|
|
|
|
|
|
|
#ifndef CLASS_TEXT_LABEL_H
|
|
|
|
#define CLASS_TEXT_LABEL_H
|
|
|
|
|
|
|
|
#include "macros.h"
|
|
|
|
#include "base_struct.h"
|
|
|
|
|
2009-05-12 12:12:34 +00:00
|
|
|
/* Type of SCH_HIERLABEL and SCH_GLOBALLABEL
|
|
|
|
* mainly used to handle the graphic associated shape
|
|
|
|
*/
|
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
|
|
|
|
2009-05-12 12:12:34 +00:00
|
|
|
class SCH_TEXT : public SCH_ITEM,
|
|
|
|
public EDA_TextStruct
|
|
|
|
{
|
2008-02-21 20:49:15 +00:00
|
|
|
public:
|
|
|
|
int m_Layer;
|
|
|
|
int m_Shape;
|
2009-05-12 12:12:34 +00:00
|
|
|
bool m_IsDangling; // true if not connected (used to draw the "not connected" symbol
|
|
|
|
protected:
|
|
|
|
int m_SchematicOrientation; /* orientation of texts (comments) and labels in schematic
|
|
|
|
* 0 = normal (horizontal, left justified).
|
|
|
|
* 1 = up (vertical)
|
|
|
|
* 2 = (horizontal, rignt 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 parmeters in editions, Reading and Saving file
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2008-02-21 20:49:15 +00:00
|
|
|
public:
|
2008-03-20 01:50:21 +00:00
|
|
|
SCH_TEXT( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
|
2009-05-12 12:12:34 +00:00
|
|
|
KICAD_T aType = TYPE_SCH_TEXT );
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-12 12:12:34 +00:00
|
|
|
/** function SetTextOrientAndJustifyParmeters
|
|
|
|
* Set m_SchematicOrientation, and initialize
|
|
|
|
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation (for a text )
|
|
|
|
* must be called after changing m_SchematicOrientation
|
|
|
|
* @param aSchematicOrientation =
|
|
|
|
* 0 = normal (horizontal, left justified).
|
|
|
|
* 1 = up (vertical)
|
|
|
|
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
|
|
|
|
* 3 = bottom . This can be seen as the mirrored position of up
|
|
|
|
*/
|
|
|
|
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
|
|
|
|
|
|
|
|
int GetSchematicTextOrientation() { return m_SchematicOrientation;}
|
|
|
|
|
|
|
|
/** function GetSchematicTextOffset (virtual)
|
|
|
|
* @return the offset between the SCH_TEXT position and the text itself position
|
|
|
|
* This offset depend on orientation, and the type of text
|
|
|
|
* (room to draw an associated graphic symbol, or put the text above a wire)
|
|
|
|
*/
|
|
|
|
virtual wxPoint GetSchematicTextOffset( );
|
|
|
|
|
|
|
|
SCH_TEXT* GenCopy();
|
|
|
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
|
|
|
|
int Color = -1 );
|
2008-02-21 20:49:15 +00:00
|
|
|
|
2009-05-12 12:12:34 +00:00
|
|
|
void SwapData( SCH_TEXT* copyitem );
|
2008-02-21 20:49:15 +00:00
|
|
|
|
2009-05-12 12:12:34 +00:00
|
|
|
void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
|
2009-01-31 18:08:47 +00:00
|
|
|
|
|
|
|
/** Function HitTest
|
|
|
|
* @return true if the point aPosRef is within item area
|
|
|
|
* @param aPosRef = a wxPoint to test
|
|
|
|
*/
|
2009-05-12 12:12:34 +00:00
|
|
|
bool HitTest( const wxPoint& aPosRef );
|
2009-01-31 18:08:47 +00:00
|
|
|
|
2009-05-12 12:12:34 +00:00
|
|
|
EDA_Rect GetBoundingBox();
|
2008-04-15 19:38:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Save
|
|
|
|
* writes the data structures for this object out to a FILE in "*.brd" format.
|
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
2009-05-12 12:12:34 +00:00
|
|
|
bool Save( FILE* aFile ) const;
|
2008-04-15 19:38:19 +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
|
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:
|
2008-03-20 01:50:21 +00:00
|
|
|
SCH_LABEL( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
|
|
|
|
~SCH_LABEL() { }
|
2009-05-12 12:12:34 +00:00
|
|
|
virtual void Draw( WinEDA_DrawPanel* 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
|
|
|
|
2009-05-12 12:12:34 +00:00
|
|
|
|
|
|
|
/** function SetTextOrientAndJustifyParmeters
|
|
|
|
* Set m_SchematicOrientation, and initialize
|
|
|
|
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation (for a label)
|
|
|
|
* must be called after changing m_SchematicOrientation
|
|
|
|
* @param aSchematicOrientation =
|
|
|
|
* 0 = normal (horizontal, left justified).
|
|
|
|
* 1 = up (vertical)
|
|
|
|
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
|
|
|
|
* 3 = bottom . This can be seen as the mirrored position of up
|
|
|
|
*/
|
|
|
|
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
|
|
|
|
|
|
|
|
/** function GetSchematicTextOffset (virtual)
|
|
|
|
* @return the offset between the SCH_TEXT position and the text itself position
|
|
|
|
* This offset depend on orientation, and the type of text
|
|
|
|
* (room to draw an associated graphic symbol, or put the text above a wire)
|
|
|
|
*/
|
|
|
|
virtual wxPoint GetSchematicTextOffset( );
|
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
/**
|
|
|
|
* Function Save
|
|
|
|
* writes the data structures for this object out to a FILE in "*.brd" format.
|
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
2009-05-12 12:12:34 +00:00
|
|
|
bool Save( FILE* aFile ) 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:
|
2008-03-20 01:50:21 +00:00
|
|
|
SCH_GLOBALLABEL( const wxPoint& pos = wxPoint( 0, 0 ),
|
2009-05-12 12:12:34 +00:00
|
|
|
const wxString& text = wxEmptyString );
|
2008-03-20 01:50:21 +00:00
|
|
|
~SCH_GLOBALLABEL() { }
|
2009-05-12 12:12:34 +00:00
|
|
|
virtual void Draw( WinEDA_DrawPanel* 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
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-12 12:12:34 +00:00
|
|
|
/** function SetTextOrientAndJustifyParmeters
|
|
|
|
* Set m_SchematicOrientation, and initialize
|
|
|
|
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation
|
|
|
|
* must be called after changing m_SchematicOrientation
|
|
|
|
* @param aSchematicOrientation =
|
|
|
|
* 0 = normal (horizontal, left justified).
|
|
|
|
* 1 = up (vertical)
|
|
|
|
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
|
|
|
|
* 3 = bottom . This can be seen as the mirrored position of up
|
|
|
|
*/
|
|
|
|
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
|
|
|
|
|
|
|
|
/** function GetSchematicTextOffset (virtual)
|
|
|
|
* @return the offset between the SCH_TEXT position and the text itself position
|
|
|
|
* This offset depend on orientation, and the type of text
|
|
|
|
* (room to draw an associated graphic symbol, or put the text above a wire)
|
|
|
|
*/
|
|
|
|
virtual wxPoint GetSchematicTextOffset( );
|
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
/**
|
|
|
|
* Function Save
|
|
|
|
* writes the data structures for this object out to a FILE in "*.brd" format.
|
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
2009-05-12 12:12:34 +00:00
|
|
|
bool Save( FILE* aFile ) const;
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2009-01-31 18:08:47 +00:00
|
|
|
/** Function HitTest
|
|
|
|
* @return true if the point aPosRef is within item area
|
|
|
|
* @param aPosRef = a wxPoint to test
|
|
|
|
*/
|
2009-05-12 12:12:34 +00:00
|
|
|
bool HitTest( const wxPoint& aPosRef );
|
2009-01-31 18:08:47 +00:00
|
|
|
|
2009-05-12 12:12:34 +00:00
|
|
|
EDA_Rect GetBoundingBox();
|
2009-05-05 17:32:07 +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 = Position of the shape
|
2009-05-05 17:32:07 +00:00
|
|
|
*/
|
2009-05-12 12:12:34 +00:00
|
|
|
void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, const wxPoint& Pos );
|
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 ),
|
2009-05-12 12:12:34 +00:00
|
|
|
const wxString& text = wxEmptyString );
|
2008-03-20 01:50:21 +00:00
|
|
|
~SCH_HIERLABEL() { }
|
2009-05-12 12:12:34 +00:00
|
|
|
virtual void Draw( WinEDA_DrawPanel* 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
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-12 12:12:34 +00:00
|
|
|
/** function SetTextOrientAndJustifyParmeters
|
|
|
|
* Set m_SchematicOrientation, and initialize
|
|
|
|
* m_orient,m_HJustified and m_VJustified, according to the value of m_SchematicOrientation
|
|
|
|
* must be called after changing m_SchematicOrientation
|
|
|
|
* @param aSchematicOrientation =
|
|
|
|
* 0 = normal (horizontal, left justified).
|
|
|
|
* 1 = up (vertical)
|
|
|
|
* 2 = (horizontal, rignt justified). This can be seen as the mirrored position of 0
|
|
|
|
* 3 = bottom . This can be seen as the mirrored position of up
|
|
|
|
*/
|
|
|
|
virtual void SetSchematicTextOrientation( int aSchematicOrientation );
|
|
|
|
|
|
|
|
/** function GetSchematicTextOffset (virtual)
|
|
|
|
* @return the offset between the SCH_TEXT position and the text itself position
|
|
|
|
* This offset depend on orientation, and the type of text
|
|
|
|
* (room to draw an associated graphic symbol, or put the text above a wire)
|
|
|
|
*/
|
|
|
|
virtual wxPoint GetSchematicTextOffset( );
|
|
|
|
|
2008-02-21 20:49:15 +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
|
|
|
|
*/
|
|
|
|
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
|
|
|
|
* writes the data structures for this object out to a FILE in "*.brd" format.
|
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
2009-05-12 12:12:34 +00:00
|
|
|
bool Save( FILE* aFile ) const;
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2009-01-31 18:08:47 +00:00
|
|
|
/** Function HitTest
|
|
|
|
* @return true if the point aPosRef is within item area
|
|
|
|
* @param aPosRef = a wxPoint to test
|
|
|
|
*/
|
2009-05-12 12:12:34 +00:00
|
|
|
bool HitTest( const wxPoint& aPosRef );
|
2009-01-31 18:08:47 +00:00
|
|
|
|
2009-05-12 12:12:34 +00:00
|
|
|
EDA_Rect GetBoundingBox();
|
2008-02-21 20:49:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* CLASS_TEXT_LABEL_H */
|