KiCad PCB EDA Suite
class_pcb_text.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
5  * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
30 #ifndef CLASS_PCB_TEXT_H
31 #define CLASS_PCB_TEXT_H
32 
33 #include <eda_text.h>
34 #include <class_board_item.h>
35 
36 
37 class LINE_READER;
38 class MSG_PANEL_ITEM;
39 
40 
41 class TEXTE_PCB : public BOARD_ITEM, public EDA_TEXT
42 {
43 public:
44  TEXTE_PCB( BOARD_ITEM* parent );
45 
46  // Do not create a copy constructor & operator=.
47  // The ones generated by the compiler are adequate.
48 
49  ~TEXTE_PCB();
50 
51  static inline bool ClassOf( const EDA_ITEM* aItem )
52  {
53  return aItem && PCB_TEXT_T == aItem->Type();
54  }
55 
56  bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override
57  {
58  return BOARD_ITEM::Matches( GetShownText(), aSearchData );
59  }
60 
61  virtual const wxPoint GetPosition() const override
62  {
63  return EDA_TEXT::GetTextPos();
64  }
65 
66  virtual void SetPosition( const wxPoint& aPos ) override
67  {
68  EDA_TEXT::SetTextPos( aPos );
69  }
70 
71  void Move( const wxPoint& aMoveVector ) override
72  {
73  EDA_TEXT::Offset( aMoveVector );
74  }
75 
76  void SetTextAngle( double aAngle );
77 
78  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
79 
80  void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
81 
82  void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset = ZeroOffset ) override;
83 
84  void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
85 
86  bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override
87  {
88  return TextHitTest( aPosition, aAccuracy );
89  }
90 
94  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override
95  {
96  return TextHitTest( aRect, aContained, aAccuracy );
97  }
98 
99  wxString GetClass() const override
100  {
101  return wxT( "PTEXT" );
102  }
103 
114  SHAPE_POLY_SET& aCornerBuffer, int aClearanceValue, int aError = ARC_HIGH_DEF ) const;
115 
116  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
117 
118  BITMAP_DEF GetMenuImage() const override;
119 
120  // Virtual function
121  const EDA_RECT GetBoundingBox() const override;
122 
123  EDA_ITEM* Clone() const override;
124 
125  virtual void SwapData( BOARD_ITEM* aImage ) override;
126 
127 #if defined(DEBUG)
128  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
129 #endif
130 };
131 
132 #endif // #define CLASS_PCB_TEXT_H
EDA_UNITS
Definition: common.h:184
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
void Offset(const wxPoint &aOffset)
Definition: eda_text.h:237
void SetTextAngle(double aAngle)
LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived to re...
Definition: richio.h:81
bool HitTest(const wxPoint &aPosition, int aAccuracy) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
static bool ClassOf(const EDA_ITEM *aItem)
PNG memory record (file in memory).
Definition: bitmap_def.h:29
wxString GetClass() const override
Function GetClass returns the class name.
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Function Flip Flip this object, i.e.
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:231
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
static wxPoint ZeroOffset
A value of wxPoint(0,0) which can be passed to the Draw() functions.
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:109
void TransformShapeWithClearanceToPolygonSet(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aError=ARC_HIGH_DEF) const
Function TransformShapeWithClearanceToPolygonSet Convert the text shape to a set of polygons (one by ...
void GetMsgPanelInfo(EDA_UNITS aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
SHAPE_POLY_SET.
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
bool HitTest(const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const override
virtual const wxPoint GetPosition() const override
void Print(PCB_BASE_FRAME *aFrame, wxDC *DC, const wxPoint &offset=ZeroOffset) override
Function Print BOARD_ITEMs have their own color information.
virtual void SetPosition(const wxPoint &aPos) override
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
virtual bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const
Test if aPoint is within the bounds of this object.
Definition: eda_text.cpp:336
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:166
void Move(const wxPoint &aMoveVector) override
Function Move move this object.
const wxPoint & GetTextPos() const
Definition: eda_text.h:232
virtual wxString GetShownText() const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:129
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
bool Matches(wxFindReplaceData &aSearchData, void *aAuxData) override
Function Matches compares the item against the search criteria in aSearchData.
virtual bool Matches(wxFindReplaceData &aSearchData, void *aAuxData)
Function Matches compares the item against the search criteria in aSearchData.
Definition: base_struct.h:473
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
TEXTE_PCB(BOARD_ITEM *parent)
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212