KiCad PCB EDA Suite
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,
5  * Copyright (C) 2004-2020 KiCad Developers, see change_log.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
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  *
20  * or you may search the 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  */
25 #ifndef LIB_TEXT_H
26 #define LIB_TEXT_H
28 #include <eda_text.h>
29 #include <lib_item.h>
40 class LIB_TEXT : public LIB_ITEM, public EDA_TEXT
41 {
42  void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
43  const TRANSFORM& aTransform ) override;
45 public:
46  LIB_TEXT( LIB_PART* aParent );
48  // Do not create a copy constructor. The one generated by the compiler is adequate.
50  ~LIB_TEXT() { }
52  wxString GetClass() const override
53  {
54  return wxT( "LIB_TEXT" );
55  }
57  wxString GetTypeName() override
58  {
59  return _( "Text" );
60  }
62  void ViewGetLayers( int aLayers[], int& aCount ) const override;
64  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
66  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override
67  {
68  return TextHitTest( aRect, aContained, aAccuracy );
69  }
71  int GetPenWidth() const override;
73  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
75  const EDA_RECT GetBoundingBox() const override;
77  void BeginEdit( const wxPoint aStartPoint ) override;
78  void CalcEdit( const wxPoint& aPosition ) override;
80  void Offset( const wxPoint& aOffset ) override;
82  void MoveTo( const wxPoint& aPosition ) override;
84  wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
86  void MirrorHorizontal( const wxPoint& aCenter ) override;
87  void MirrorVertical( const wxPoint& aCenter ) override;
88  void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override;
90  void NormalizeJustification( bool inverse );
92  void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
93  const TRANSFORM& aTransform ) override;
95  int GetWidth() const override { return GetTextThickness(); }
96  void SetWidth( int aWidth ) override { SetTextThickness( aWidth ); }
98  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
100  BITMAP_DEF GetMenuImage() const override;
102  EDA_ITEM* Clone() const override;
104 private:
116  int compare( const LIB_ITEM& aOther,
117  LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override;
118 };
121 #endif // LIB_TEXT_H
void MoveTo(const wxPoint &aPosition) override
Move a draw object to aPosition.
Definition: lib_text.cpp:132
bool HitTest(const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const override
Function HitTest tests if aRect intersects or is contained within the bounding box of an item.
Definition: lib_text.h:66
Definition: common.h:198
void Plot(PLOTTER *aPlotter, const wxPoint &aOffset, bool aFill, const TRANSFORM &aTransform) override
Plot the draw item using the plot object.
Definition: lib_text.cpp:267
PNG memory record (file in memory).
Definition: bitmap_def.h:29
RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surfac...
Define a symbol library graphical text item.
Definition: lib_text.h:40
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
Definition: lib_text.cpp:351
void NormalizeJustification(bool inverse)
Definition: lib_text.cpp:138
void CalcEdit(const wxPoint &aPosition) override
Calculates the attributes of an item at aPosition when it is being edited.
Definition: lib_text.cpp:403
void MirrorHorizontal(const wxPoint &aCenter) override
Mirror the draw object along the horizontal (X) axis about aCenter point.
Definition: lib_text.cpp:175
wxPoint GetPosition() const override
Definition: lib_text.h:84
int compare(const LIB_ITEM &aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags=LIB_ITEM::COMPARE_FLAGS::NORMAL) const override
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_text.cpp:94
int GetTextThickness() const
Definition: eda_text.h:159
The base class for create windows for drawing purpose.
void print(RENDER_SETTINGS *aSettings, const wxPoint &aOffset, void *aData, const TRANSFORM &aTransform) override
Print the item to aDC.
Definition: lib_text.cpp:306
void BeginEdit(const wxPoint aStartPoint) override
Begin drawing a component library draw item at aPosition.
Definition: lib_text.cpp:397
Definition: lib_text.h:50
The base class for drawable items used by schematic library components.
Definition: lib_item.h:61
void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on.
Definition: lib_text.cpp:55
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
Definition: lib_text.cpp:63
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:113
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
The list of flags used by the compare function.
Definition: lib_item.h:116
void Rotate(const wxPoint &aCenter, bool aRotateCCW=true) override
Rotate the object about aCenter point.
Definition: lib_text.cpp:233
Define a library symbol object.
int GetWidth() const override
Definition: lib_text.h:95
void MirrorVertical(const wxPoint &aCenter) override
Mirror the draw object along the MirrorVertical (Y) axis about aCenter point.
Definition: lib_text.cpp:204
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: lib_text.cpp:385
Base plotter engine class.
Definition: plotter.h:114
void Offset(const wxPoint &aOffset) override
Set the drawing object by aOffset from the current position.
Definition: lib_text.cpp:126
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
Definition: lib_text.cpp:391
const EDA_RECT GetBoundingBox() const override
Definition: lib_text.cpp:360
#define _(s)
Definition: 3d_actions.cpp:33
wxString GetClass() const override
Function GetClass returns the class name.
Definition: lib_text.h:52
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:375
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
int GetPenWidth() const override
Definition: lib_text.cpp:300
const wxPoint & GetTextPos() const
Definition: eda_text.h:248
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.h:158
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: lib_text.cpp:79
wxString GetTypeName() override
Provide a user-consumable name of the object type.
Definition: lib_text.h:57
void SetWidth(int aWidth) override
Definition: lib_text.h:96
Definition: lib_text.cpp:47