2007-08-04 20:05:54 +00:00
|
|
|
|
/***************************************************/
|
|
|
|
|
/* class_text_module.h : texts module description */
|
|
|
|
|
/***************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-14 19:24:48 +00:00
|
|
|
|
|
|
|
|
|
#ifndef TEXT_MODULE_H
|
|
|
|
|
#define TEXT_MODULE_H
|
|
|
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/* Description des Textes sur Modules : */
|
|
|
|
|
#define TEXT_is_REFERENCE 0
|
2007-08-04 20:05:54 +00:00
|
|
|
|
#define TEXT_is_VALUE 1
|
|
|
|
|
#define TEXT_is_DIVERS 2
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
|
class TEXTE_MODULE : public BOARD_ITEM
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2008-03-15 10:24:32 +00:00
|
|
|
|
wxPoint m_Pos; // Real (physical)coord
|
2007-12-01 03:42:52 +00:00
|
|
|
|
int m_Width;
|
2008-03-15 10:24:32 +00:00
|
|
|
|
wxPoint m_Pos0; // text coordinates relatives to the footprint ancre, orient 0
|
2008-04-01 05:21:50 +00:00
|
|
|
|
// Text coordinate ref point is the text centre
|
2007-08-04 20:05:54 +00:00
|
|
|
|
char m_Unused; // unused (reserved for future extensions)
|
2008-03-15 10:24:32 +00:00
|
|
|
|
char m_Miroir; // Show normal / mirror
|
2007-08-04 20:05:54 +00:00
|
|
|
|
char m_NoShow; // 0: visible 1: invisible (bool)
|
2008-03-15 10:24:32 +00:00
|
|
|
|
char m_Type; // 0: ref,1: val, others = 2..255
|
|
|
|
|
int m_Orient; // orientation in 1/10 deg relative to the footprint
|
2008-04-01 05:21:50 +00:00
|
|
|
|
// Physical orient is m_Orient + m_Parent->m_Orient
|
2008-03-15 10:24:32 +00:00
|
|
|
|
wxSize m_Size; // text size
|
2007-08-04 20:05:54 +00:00
|
|
|
|
wxString m_Text;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
~TEXTE_MODULE();
|
2007-08-04 20:05:54 +00:00
|
|
|
|
|
2007-12-01 03:42:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Function GetPosition
|
|
|
|
|
* returns the position of this object.
|
|
|
|
|
* Required by pure virtual BOARD_ITEM::GetPosition()
|
|
|
|
|
* @return const wxPoint& - The position of this object.
|
|
|
|
|
*/
|
|
|
|
|
wxPoint& GetPosition()
|
|
|
|
|
{
|
|
|
|
|
return m_Pos;
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
2007-08-04 20:05:54 +00:00
|
|
|
|
/* supprime du chainage la structure Struct */
|
2008-08-09 08:05:42 +00:00
|
|
|
|
void UnLink();
|
2007-08-04 20:05:54 +00:00
|
|
|
|
|
2008-08-09 08:05:42 +00:00
|
|
|
|
void Copy( TEXTE_MODULE* source ); // copy structure
|
2007-08-04 20:05:54 +00:00
|
|
|
|
|
|
|
|
|
/* Gestion du texte */
|
2008-08-09 08:05:42 +00:00
|
|
|
|
void SetWidth( int new_width );
|
|
|
|
|
int GetLength(); /* text length */
|
|
|
|
|
int Pitch(); /* retourne le pas entre 2 caracteres */
|
|
|
|
|
int GetDrawRotation(); // Return text rotation for drawings and plotting
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
|
|
|
|
/** Function GetTextRect
|
|
|
|
|
* @return an EDA_Rect which gives the position and size of the text area (for the 0 orient text and footprint)
|
|
|
|
|
*/
|
2008-08-09 08:05:42 +00:00
|
|
|
|
EDA_Rect GetTextRect( void );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2008-03-15 10:24:32 +00:00
|
|
|
|
/**
|
|
|
|
|
* Function GetBoundingBox
|
|
|
|
|
* returns the bounding box of this Text (according to text and footprint orientation)
|
|
|
|
|
*/
|
|
|
|
|
EDA_Rect GetBoundingBox();
|
|
|
|
|
|
2008-08-09 08:05:42 +00:00
|
|
|
|
void SetDrawCoord(); // mise a jour des coordonn<6E>s absolues de trac<61>
|
2007-08-04 20:05:54 +00:00
|
|
|
|
|
2008-08-09 08:05:42 +00:00
|
|
|
|
// a partir des coord relatives
|
|
|
|
|
|
|
|
|
|
void SetLocalCoord(); // mise a jour des coordonn<6E>s relatives
|
2007-08-04 20:05:54 +00:00
|
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
|
/**
|
|
|
|
|
* Function Save
|
2007-10-31 14:14:21 +00:00
|
|
|
|
* writes the data structures for this object out to a FILE in "*.brd" format.
|
2007-10-30 21:30:58 +00:00
|
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
|
* @return bool - true if success writing else false.
|
2008-04-01 05:21:50 +00:00
|
|
|
|
*/
|
2008-08-09 08:05:42 +00:00
|
|
|
|
bool Save( FILE* aFile ) const;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
2008-08-09 08:05:42 +00:00
|
|
|
|
/**
|
|
|
|
|
* Function ReadLineDescr
|
|
|
|
|
* Read description from a given line in "*.brd" format.
|
|
|
|
|
* @param aLine The current line which contains the first line of description.
|
|
|
|
|
* @param aLine The FILE to read next lines (currently not used).
|
|
|
|
|
* @param LineNum a point to the line count (currently not used).
|
|
|
|
|
* @return int - > 0 if success reading else 0.
|
|
|
|
|
*/
|
|
|
|
|
int ReadDescr( char* aLine, FILE* aFile, int* aLineNum = NULL );
|
2007-08-04 20:05:54 +00:00
|
|
|
|
|
|
|
|
|
/* drawing functions */
|
2008-08-09 08:05:42 +00:00
|
|
|
|
void Draw( WinEDA_DrawPanel* panel,
|
|
|
|
|
wxDC* DC,
|
|
|
|
|
int aDrawMode,
|
|
|
|
|
const wxPoint& offset = ZeroOffset );
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
2007-08-04 20:05:54 +00:00
|
|
|
|
|
2007-08-20 19:33:15 +00:00
|
|
|
|
/**
|
|
|
|
|
* Function Display_Infos
|
|
|
|
|
* has knowledge about the frame and how and where to put status information
|
|
|
|
|
* about this object into the frame's message panel.
|
|
|
|
|
* Is virtual from EDA_BaseStruct.
|
2007-08-30 22:20:52 +00:00
|
|
|
|
* @param frame A WinEDA_DrawFrame in which to print status information.
|
2008-04-01 05:21:50 +00:00
|
|
|
|
*/
|
2008-08-09 08:05:42 +00:00
|
|
|
|
void Display_Infos( WinEDA_DrawFrame* frame );
|
2007-08-20 19:33:15 +00:00
|
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
2007-08-04 20:05:54 +00:00
|
|
|
|
/**
|
|
|
|
|
* Function HitTest
|
|
|
|
|
* tests if the given wxPoint is within the bounds of this object.
|
|
|
|
|
* @param posref A wxPoint to test
|
|
|
|
|
* @return bool - true if a hit, else false
|
|
|
|
|
*/
|
2008-08-09 08:05:42 +00:00
|
|
|
|
bool HitTest( const wxPoint& posref );
|
2007-08-24 03:40:04 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function IsOnLayer
|
|
|
|
|
* tests to see if this object is on the given layer. Is virtual so
|
|
|
|
|
* objects like D_PAD, which reside on multiple layers can do their own
|
|
|
|
|
* form of testing.
|
|
|
|
|
* virtual inheritance from BOARD_ITEM.
|
|
|
|
|
* @param aLayer The layer to test for.
|
|
|
|
|
* @return bool - true if on given layer, else false.
|
|
|
|
|
*/
|
|
|
|
|
bool IsOnLayer( int aLayer ) const;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
2007-08-24 03:40:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* Function IsOnOneOfTheseLayers
|
|
|
|
|
* returns true if this object is on one of the given layers. Is virtual so
|
|
|
|
|
* objects like D_PAD, which reside on multiple layers, can do their own
|
|
|
|
|
* form of testing.
|
|
|
|
|
* virtual inheritance from BOARD_ITEM.
|
|
|
|
|
* @param aLayerMask The bit-mapped set of layers to test for.
|
|
|
|
|
* @return bool - true if on one of the given layers, else false.
|
2008-08-09 08:05:42 +00:00
|
|
|
|
* bool IsOnOneOfTheseLayers( int aLayerMask ) const;
|
2007-08-24 03:40:04 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2007-08-07 06:21:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* Function GetClass
|
|
|
|
|
* returns the class name.
|
|
|
|
|
* @return wxString
|
|
|
|
|
*/
|
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
|
{
|
|
|
|
|
return wxT( "MTEXT" );
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-09 08:05:42 +00:00
|
|
|
|
|
|
|
|
|
#if defined (DEBUG)
|
|
|
|
|
|
2007-08-06 20:26:59 +00:00
|
|
|
|
/**
|
|
|
|
|
* Function Show
|
|
|
|
|
* is used to output the object tree, currently for debugging only.
|
2008-04-01 05:21:50 +00:00
|
|
|
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
2007-08-06 20:26:59 +00:00
|
|
|
|
* of nesting of this object within the overall tree.
|
|
|
|
|
* @param os The ostream& to output to.
|
|
|
|
|
*/
|
|
|
|
|
virtual void Show( int nestLevel, std::ostream& os );
|
2008-08-09 08:05:42 +00:00
|
|
|
|
|
2007-08-06 20:26:59 +00:00
|
|
|
|
#endif
|
2007-08-04 20:05:54 +00:00
|
|
|
|
};
|
2007-08-14 19:24:48 +00:00
|
|
|
|
|
|
|
|
|
#endif // TEXT_MODULE_H
|