2011-09-23 13:57:12 +00:00
|
|
|
/**
|
|
|
|
* @file class_text_mod.h
|
|
|
|
* @brief Footprint text class 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
|
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
|
|
|
|
#include "class_board_item.h"
|
|
|
|
|
|
|
|
|
|
|
|
class LINE_READER;
|
|
|
|
class EDA_RECT;
|
|
|
|
class EDA_DRAW_PANEL;
|
|
|
|
class EDA_DRAW_FRAME;
|
|
|
|
class MODULE;
|
|
|
|
|
2007-08-14 19:24:48 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#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
|
|
|
|
2010-11-18 13:38:08 +00:00
|
|
|
#define UMBILICAL_COLOR LIGHTBLUE
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2011-03-29 19:33:07 +00:00
|
|
|
class TEXTE_MODULE : public BOARD_ITEM, public EDA_TEXT
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-12-12 08:37:05 +00:00
|
|
|
// @todo eliminate these friends, make them use accessors
|
|
|
|
friend class MODULE;
|
|
|
|
friend class FOOTPRINT_EDIT_FRAME;
|
|
|
|
|
|
|
|
/* Note: orientation in 1/10 deg relative to the footprint
|
|
|
|
* Physical orient is m_Orient + m_Parent->m_Orient
|
|
|
|
*/
|
|
|
|
|
|
|
|
int m_Type; ///< 0=ref, 1=val, etc.
|
|
|
|
bool m_NoShow; ///< true = invisible
|
|
|
|
|
|
|
|
wxPoint m_Pos0; ///< text coordinates relatives to the footprint anchor, orient 0.
|
|
|
|
///< text coordinate ref point is the text centre
|
2007-08-04 20:05:54 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
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
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
TEXTE_MODULE* Next() const { return (TEXTE_MODULE*) Pnext; }
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
TEXTE_MODULE* Back() const { return (TEXTE_MODULE*) Pback; }
|
|
|
|
|
2011-12-12 08:37:05 +00:00
|
|
|
void SetPosition( const wxPoint& aPos ) // overload a base
|
|
|
|
{
|
|
|
|
m_Pos = aPos; // in EDA_TEXT
|
|
|
|
}
|
|
|
|
|
2011-11-29 17:25:30 +00:00
|
|
|
const wxPoint GetPosition() const // overload a base
|
2007-12-01 03:42:52 +00:00
|
|
|
{
|
2011-11-29 17:25:30 +00:00
|
|
|
return m_Pos; // from EDA_TEXT
|
2007-12-01 03:42:52 +00:00
|
|
|
}
|
|
|
|
|
2011-12-02 21:56:47 +00:00
|
|
|
/// @deprecated it seems
|
|
|
|
void SetType( int aType ) { m_Type = aType; }
|
2011-12-12 08:37:05 +00:00
|
|
|
int GetType() const { return m_Type; }
|
2009-11-12 15:43:38 +00:00
|
|
|
|
2011-12-02 21:56:47 +00:00
|
|
|
void SetVisible( bool isVisible ) { m_NoShow = !isVisible; }
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
bool IsVisible() const { return !m_NoShow; }
|
2011-12-02 21:56:47 +00:00
|
|
|
|
|
|
|
void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; }
|
2011-12-12 08:37:05 +00:00
|
|
|
const wxPoint& GetPos0() const { return m_Pos0; }
|
2011-12-02 21:56:47 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
void Copy( TEXTE_MODULE* source ); // copy structure
|
2007-08-04 20:05:54 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
int GetLength() const; /* text length */
|
2010-12-10 19:47:44 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
int GetDrawRotation() const; // Return text rotation for drawings and plotting
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetTextRect
|
2011-03-29 19:33:07 +00:00
|
|
|
* @return an EDA_RECT which gives the position and size of the text area
|
2009-11-12 15:43:38 +00:00
|
|
|
* (for the 0 orient text and footprint)
|
2008-04-01 05:21:50 +00:00
|
|
|
*/
|
2011-03-29 19:33:07 +00:00
|
|
|
EDA_RECT GetTextRect( void ) const;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-03-15 10:24:32 +00:00
|
|
|
/**
|
|
|
|
* Function GetBoundingBox
|
2009-11-12 15:43:38 +00:00
|
|
|
* returns the bounding box of this Text (according to text and footprint
|
|
|
|
* orientation)
|
2008-03-15 10:24:32 +00:00
|
|
|
*/
|
2011-03-29 19:33:07 +00:00
|
|
|
EDA_RECT GetBoundingBox() const;
|
2008-03-15 10:24:32 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
void SetDrawCoord(); // Set absolute coordinates.
|
2008-08-09 08:05:42 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
void SetLocalCoord(); // Set relative coordinates.
|
2007-08-04 20:05:54 +00:00
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
/**
|
|
|
|
* Function Save
|
2009-11-12 15:43:38 +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
|
|
|
*/
|
2011-09-23 13:57:12 +00:00
|
|
|
bool Save( FILE* aFile ) const;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2008-08-09 08:05:42 +00:00
|
|
|
/**
|
2010-12-29 17:47:32 +00:00
|
|
|
* Function ReadDescr
|
2008-08-09 08:05:42 +00:00
|
|
|
* Read description from a given line in "*.brd" format.
|
2011-01-14 17:43:30 +00:00
|
|
|
* @param aReader is a pointer to a LINE_READER to read from.
|
2008-08-09 08:05:42 +00:00
|
|
|
* @return int - > 0 if success reading else 0.
|
|
|
|
*/
|
2011-09-23 13:57:12 +00:00
|
|
|
int ReadDescr( LINE_READER* aReader );
|
2007-08-04 20:05:54 +00:00
|
|
|
|
|
|
|
/* drawing functions */
|
2011-09-23 13:57:12 +00:00
|
|
|
void Draw( EDA_DRAW_PANEL* panel,
|
|
|
|
wxDC* DC,
|
|
|
|
int aDrawMode,
|
|
|
|
const wxPoint& offset = ZeroOffset );
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2010-11-18 13:38:08 +00:00
|
|
|
/**
|
|
|
|
* Function DrawUmbilical
|
|
|
|
* draws a line from the TEXTE_MODULE origin
|
|
|
|
* to parent MODULE origin.
|
|
|
|
* @param aPanel = the current DrawPanel
|
|
|
|
* @param aDC = the current device context
|
|
|
|
* @param aDrawMode = drawing mode, typically GR_XOR
|
|
|
|
* @param aOffset = offset for TEXTE_MODULE
|
|
|
|
*/
|
2011-09-23 13:57:12 +00:00
|
|
|
void DrawUmbilical( EDA_DRAW_PANEL* aPanel,
|
|
|
|
wxDC* aDC,
|
|
|
|
int aDrawMode,
|
|
|
|
const wxPoint& aOffset = ZeroOffset );
|
2007-08-04 20:05:54 +00:00
|
|
|
|
2007-08-20 19:33:15 +00:00
|
|
|
/**
|
2009-04-17 08:51:02 +00:00
|
|
|
* Function DisplayInfo
|
2009-11-12 15:43:38 +00:00
|
|
|
* has knowledge about the frame and how and where to put status
|
|
|
|
* information about this object into the frame's message panel.
|
2010-12-08 20:12:46 +00:00
|
|
|
* Is virtual from EDA_ITEM.
|
2011-01-21 19:30:59 +00:00
|
|
|
* @param frame A EDA_DRAW_FRAME in which to print status information.
|
2008-04-01 05:21:50 +00:00
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void DisplayInfo( EDA_DRAW_FRAME* 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.
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aRefPos A wxPoint to test
|
2007-08-04 20:05:54 +00:00
|
|
|
* @return bool - true if a hit, else false
|
|
|
|
*/
|
2010-12-29 17:47:32 +00:00
|
|
|
bool HitTest( const wxPoint& aRefPos );
|
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
|
|
|
|
2010-12-29 17:47:32 +00:00
|
|
|
/*
|
2007-08-24 03:40:04 +00:00
|
|
|
* Function IsOnOneOfTheseLayers
|
2009-11-12 15:43:38 +00:00
|
|
|
* 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
|
2007-08-24 03:40:04 +00:00
|
|
|
* form of testing.
|
2010-12-29 17:47:32 +00:00
|
|
|
* virtual inheritance from BOARD_ITEM. (not yet written)
|
2007-08-24 03:40:04 +00:00
|
|
|
* @param aLayerMask The bit-mapped set of layers to test for.
|
|
|
|
* @return bool - true if on one of the given layers, else false.
|
2009-11-12 15:43:38 +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.
|
2010-12-28 11:24:42 +00:00
|
|
|
* @return wxString = "MTEXT"
|
2007-08-07 06:21:19 +00:00
|
|
|
*/
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
|
|
|
return wxT( "MTEXT" );
|
|
|
|
}
|
|
|
|
|
2008-08-09 08:05:42 +00:00
|
|
|
|
2011-07-14 15:42:44 +00:00
|
|
|
virtual wxString GetSelectMenuText() const;
|
|
|
|
|
2011-08-29 03:04:59 +00:00
|
|
|
virtual BITMAP_DEF GetMenuImage() const { return footprint_text_xpm; }
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
#if defined(DEBUG)
|
2008-08-09 08:05:42 +00:00
|
|
|
|
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
|
2011-09-23 13:57:12 +00:00
|
|
|
* of nesting of this object within the overall tree.
|
2007-08-06 20:26:59 +00:00
|
|
|
* @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
|