KiCad PCB EDA Suite
fp_text.cpp
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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #include <pcb_edit_frame.h>
27 #include <base_units.h>
28 #include <bitmaps.h>
29 #include <board.h>
30 #include <board_design_settings.h>
31 #include <core/mirror.h>
32 #include <footprint.h>
34 #include <trigo.h>
35 #include <kicad_string.h>
36 #include <painter.h>
38 
39 FP_TEXT::FP_TEXT( FOOTPRINT* aParentFootprint, TEXT_TYPE text_type ) :
40  BOARD_ITEM( aParentFootprint, PCB_FP_TEXT_T ),
41  EDA_TEXT()
42 {
43  FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
44 
45  m_Type = text_type;
46  m_keepUpright = true;
47 
48  // Set text thickness to a default value
50  SetLayer( F_SilkS );
51 
52  // Set position and give a default layer if a valid parent footprint exists
53  if( parentFootprint && parentFootprint->Type() == PCB_FOOTPRINT_T )
54  {
55  SetTextPos( parentFootprint->GetPosition() );
56 
57  if( IsBackLayer( parentFootprint->GetLayer() ) )
58  {
59  SetLayer( B_SilkS );
60  SetMirrored( true );
61  }
62  }
63 
64  SetDrawCoord();
65 }
66 
67 
69 {
70 }
71 
72 
73 void FP_TEXT::SetTextAngle( double aAngle )
74 {
76 }
77 
78 
79 bool FP_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
80 {
81  EDA_RECT rect = GetTextBox();
82  wxPoint location = aPoint;
83 
84  rect.Inflate( aAccuracy );
85 
86  RotatePoint( &location, GetTextPos(), -GetDrawRotation() );
87 
88  return rect.Contains( location );
89 }
90 
91 
92 bool FP_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
93 {
94  EDA_RECT rect = aRect;
95 
96  rect.Inflate( aAccuracy );
97 
98  if( aContains )
99  return rect.Contains( GetBoundingBox() );
100  else
101  return rect.Intersects( GetTextBox(), GetDrawRotation() );
102 }
103 
104 
105 void FP_TEXT::KeepUpright( double aOldOrientation, double aNewOrientation )
106 {
107  if( !IsKeepUpright() )
108  return;
109 
110  double newAngle = GetTextAngle() + aNewOrientation;
111  NORMALIZE_ANGLE_POS( newAngle );
112  bool needsFlipped = newAngle >= 1800.0;
113 
114  if( needsFlipped )
115  {
116  SetHorizJustify( static_cast<EDA_TEXT_HJUSTIFY_T>( -GetHorizJustify() ) );
117  SetTextAngle( GetTextAngle() + 1800.0 );
118  SetDrawCoord();
119  }
120 }
121 
122 
123 void FP_TEXT::Rotate( const wxPoint& aRotCentre, double aAngle )
124 {
125  // Used in footprint editing
126  // Note also in footprint editor, m_Pos0 = m_Pos
127 
128  wxPoint pt = GetTextPos();
129  RotatePoint( &pt, aRotCentre, aAngle );
130  SetTextPos( pt );
131 
132  SetTextAngle( GetTextAngle() + aAngle );
133  SetLocalCoord();
134 }
135 
136 
137 void FP_TEXT::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
138 {
139  // flipping the footprint is relative to the X axis
140  if( aFlipLeftRight )
141  {
142  SetTextX( MIRRORVAL( GetTextPos().x, aCentre.x ) );
144  }
145  else
146  {
147  SetTextY( MIRRORVAL( GetTextPos().y, aCentre.y ) );
148  SetTextAngle( 1800 - GetTextAngle() );
149  }
150 
151  SetLayer( FlipLayer( GetLayer(), GetBoard()->GetCopperLayerCount() ) );
153  SetLocalCoord();
154 }
155 
157 {
158  if( GetParent() && GetParent()->GetLayer() == B_Cu )
159  return true;
160  return false;
161 }
162 
163 
164 void FP_TEXT::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
165 {
166  // the position is mirrored, but the text itself is not mirrored
167 
168  if( aMirrorAroundXAxis )
169  SetTextY( ::MIRRORVAL( GetTextPos().y, aCentre.y ) );
170  else
171  SetTextX( ::MIRRORVAL( GetTextPos().x, aCentre.x ) );
172 
173  SetLocalCoord();
174 }
175 
176 
177 void FP_TEXT::Move( const wxPoint& aMoveVector )
178 {
179  Offset( aMoveVector );
180  SetLocalCoord();
181 }
182 
183 
185 {
186  return GetText().Len();
187 }
188 
189 
191 {
192  const FOOTPRINT* parentFootprint = static_cast<const FOOTPRINT*>( m_parent );
193 
194  SetTextPos( m_Pos0 );
195 
196  if( parentFootprint )
197  {
198  double angle = parentFootprint->GetOrientation();
199 
200  wxPoint pt = GetTextPos();
201  RotatePoint( &pt, angle );
202  SetTextPos( pt );
203 
204  Offset( parentFootprint->GetPosition() );
205  }
206 }
207 
208 
210 {
211  const FOOTPRINT* parentFootprint = static_cast<const FOOTPRINT*>( m_parent );
212 
213  if( parentFootprint )
214  {
215  m_Pos0 = GetTextPos() - parentFootprint->GetPosition();
216 
217  double angle = parentFootprint->GetOrientation();
218 
219  RotatePoint( &m_Pos0.x, &m_Pos0.y, -angle );
220  }
221  else
222  {
223  m_Pos0 = GetTextPos();
224  }
225 }
226 
228 {
229  double angle = GetDrawRotation();
230  EDA_RECT text_area = GetTextBox();
231 
232  if( angle )
233  text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
234 
235  return text_area;
236 }
237 
238 
240 {
241  FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
242  double rotation = GetTextAngle();
243 
244  if( parentFootprint )
245  rotation += parentFootprint->GetOrientation();
246 
247  if( m_keepUpright )
248  {
249  // Keep angle between 0 .. 90 deg. Otherwise the text is not easy to read
250  while( rotation > 900 )
251  rotation -= 1800;
252 
253  while( rotation < 0 )
254  rotation += 1800;
255  }
256  else
257  {
258  NORMALIZE_ANGLE_POS( rotation );
259  }
260 
261  return rotation;
262 }
263 
264 
265 void FP_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
266 {
267  FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent );
268  wxString msg;
269 
270  static const wxString text_type_msg[3] =
271  {
272  _( "Ref." ), _( "Value" ), _( "Text" )
273  };
274 
275  aList.emplace_back( _( "Footprint" ), fp ? fp->GetReference() : _( "<invalid>" ) );
276 
277  // Don't use GetShownText() here; we want to show the user the variable references
278  aList.emplace_back( _( "Text" ), UnescapeString( GetText() ) );
279 
280  wxASSERT( m_Type >= TEXT_is_REFERENCE && m_Type <= TEXT_is_DIVERS );
281  aList.emplace_back( _( "Type" ), text_type_msg[m_Type] );
282 
283  if( IsLocked() )
284  aList.emplace_back( _( "Status" ), _( "Locked" ) );
285 
286  aList.emplace_back( _( "Display" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
287 
288  // Display text layer
289  aList.emplace_back( _( "Layer" ), GetLayerName() );
290 
291  aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
292 
293  msg.Printf( wxT( "%g" ), GetTextAngleDegrees() );
294  aList.emplace_back( _( "Angle" ), msg );
295 
296  msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextThickness() );
297  aList.emplace_back( _( "Thickness" ), msg );
298 
299  msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() );
300  aList.emplace_back( _( "Width" ), msg );
301 
302  msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextHeight() );
303  aList.emplace_back( _( "Height" ), msg );
304 }
305 
306 
307 wxString FP_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
308 {
309  switch( m_Type )
310  {
311  case TEXT_is_REFERENCE:
312  return wxString::Format( _( "Reference '%s'" ),
313  static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
314 
315  case TEXT_is_VALUE:
316  return wxString::Format( _( "Value '%s' of %s" ),
317  GetShownText(),
318  static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
319 
320  default:
321  return wxString::Format( _( "Footprint Text '%s' of %s" ),
323  static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
324  }
325 }
326 
327 
329 {
330  return BITMAPS::text;
331 }
332 
333 
335 {
336  return new FP_TEXT( *this );
337 }
338 
339 
341 {
342  double angle = GetDrawRotation();
343  EDA_RECT text_area = GetTextBox();
344 
345  if( angle != 0.0 )
346  text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
347 
348  return BOX2I( text_area.GetPosition(), text_area.GetSize() );
349 }
350 
351 
352 void FP_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
353 {
354  if( IsVisible() )
355  aLayers[0] = GetLayer();
356  else
357  aLayers[0] = LAYER_MOD_TEXT_INVISIBLE;
358 
359  aCount = 1;
360 }
361 
362 
363 double FP_TEXT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
364 {
365  constexpr double HIDE = (double)std::numeric_limits<double>::max();
366 
367  if( !aView )
368  return 0.0;
369 
370  // Hidden text gets put on the LAYER_MOD_TEXT_INVISIBLE for rendering, but
371  // should only render if its native layer is visible.
372  if( !aView->IsLayerVisible( GetLayer() ) )
373  return HIDE;
374 
375  RENDER_SETTINGS* renderSettings = aView->GetPainter()->GetSettings();
376  COLOR4D backgroundColor = renderSettings->GetLayerColor( LAYER_PCB_BACKGROUND );
377 
378  // Handle Render tab switches
379  if( m_Type == TEXT_is_VALUE || GetText() == wxT( "${VALUE}" ) )
380  {
381  if( !aView->IsLayerVisible( LAYER_MOD_VALUES )
382  || renderSettings->GetLayerColor( LAYER_MOD_VALUES ) == backgroundColor )
383  {
384  return HIDE;
385  }
386  }
387 
388  if( m_Type == TEXT_is_REFERENCE || GetText() == wxT( "${REFERENCE}" ) )
389  {
390  if( !aView->IsLayerVisible( LAYER_MOD_REFERENCES )
391  || renderSettings->GetLayerColor( LAYER_MOD_REFERENCES ) == backgroundColor )
392  {
393  return HIDE;
394  }
395  }
396 
397  if( !IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_FR ) )
398  return HIDE;
399 
400  if( IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_BK ) )
401  return HIDE;
402 
404  return HIDE;
405 
406  if( IsBackLayer( m_layer ) && !aView->IsLayerVisible( LAYER_MOD_TEXT_BK ) )
407  return HIDE;
408 
409  // Other layers are shown without any conditions
410  return 0.0;
411 }
412 
413 
414 wxString FP_TEXT::GetShownText( int aDepth ) const
415 {
416  const FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( GetParent() );
417  wxASSERT( parentFootprint );
418  const BOARD* board = parentFootprint->GetBoard();
419 
420  std::function<bool( wxString* )> footprintResolver =
421  [&]( wxString* token ) -> bool
422  {
423  return parentFootprint && parentFootprint->ResolveTextVar( token, aDepth );
424  };
425 
426  std::function<bool( wxString* )> boardTextResolver =
427  [&]( wxString* token ) -> bool
428  {
429  return board->ResolveTextVar( token, aDepth + 1 );
430  };
431 
432  wxString text = EDA_TEXT::GetShownText();
433 
434  if( HasTextVars() )
435  {
436  PROJECT* project = nullptr;
437 
438  if( parentFootprint && parentFootprint->GetParent() )
439  project = static_cast<BOARD*>( parentFootprint->GetParent() )->GetProject();
440 
441  if( aDepth < 10 )
442  text = ExpandTextVars( text, &footprintResolver, &boardTextResolver, project );
443  }
444 
445  return text;
446 }
447 
448 
449 std::shared_ptr<SHAPE> FP_TEXT::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
450 {
451  return GetEffectiveTextShape();
452 }
453 
454 
455 static struct FP_TEXT_DESC
456 {
458  {
465 
466  propMgr.AddProperty( new PROPERTY<FP_TEXT, wxString>( _HKI( "Parent" ),
467  NO_SETTER( FP_TEXT, wxString ), &FP_TEXT::GetParentAsString ) );
468  }
469 } _FP_TEXT_DESC;
void SetMirrored(bool isMirrored)
Definition: eda_text.h:188
virtual double GetDrawRotation() const override
Definition: fp_text.cpp:239
void Offset(const wxPoint &aOffset)
Definition: eda_text.h:252
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: fp_text.cpp:334
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:104
BOX2< VECTOR2I > BOX2I
Definition: box2.h:506
void KeepUpright(double aOldOrientation, double aNewOrientation)
Called when rotating the parent footprint.
Definition: fp_text.cpp:105
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
bool IsMirrored() const
Definition: eda_text.h:189
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
Container for project specific data.
Definition: project.h:62
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Definition: common.cpp:64
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: fp_text.cpp:340
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:192
Implementation of conversion functions that require both schematic and board internal units.
bool IsKeepUpright() const
Definition: fp_text.h:110
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
void Move(const wxPoint &aMoveVector) override
move text in move transform, in footprint editor
Definition: fp_text.cpp:177
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
void SetTextAngle(double aAngle) override
Definition: fp_text.cpp:73
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the component.
Definition: footprint.cpp:436
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Definition: lset.cpp:521
EDA_RECT GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:229
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:246
show footprints on back
double GetOrientation() const
Definition: footprint.h:181
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
double GetTextAngle() const
Definition: eda_text.h:174
void SetDrawCoord()
Set relative coordinates.
Definition: fp_text.cpp:190
show footprints values (when texts are visible)
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: fp_text.cpp:265
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: fp_text.cpp:363
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: fp_text.cpp:449
void Rotate(const wxPoint &aOffset, double aAngle) override
Rotate text, in footprint editor (for instance in footprint rotation transform)
Definition: fp_text.cpp:123
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:228
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:288
int GetTextThickness() const
Definition: eda_text.h:160
The base class for create windows for drawing purpose.
#define NO_SETTER(owner, type)
Definition: property.h:621
virtual bool IsLocked() const
Definition: board_item.cpp:65
#define REGISTER_TYPE(x)
Definition: property_mgr.h:248
void Mirror(const wxPoint &aCentre, bool aMirrorAroundXAxis)
Mirror text position in footprint editing the text itself is not mirrored, and the layer not modified...
Definition: fp_text.cpp:164
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
Definition: fp_text.cpp:352
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:207
int GetTextHeight() const
Definition: eda_text.h:244
void SetTextX(int aX)
Definition: eda_text.h:249
show footprints on front
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:119
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: fp_text.cpp:328
#define DEFAULT_TEXT_WIDTH
PCB_LAYER_ID
A quick note on layer IDs:
wxPoint m_Pos0
text coordinates relative to the footprint anchor, orient 0.
Definition: fp_text.h:242
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:198
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip entity during footprint flip.
Definition: fp_text.cpp:137
static struct FP_TEXT_DESC _FP_TEXT_DESC
FP_TEXT(FOOTPRINT *aParentFootprint, TEXT_TYPE text_type=TEXT_is_DIVERS)
Definition: fp_text.cpp:39
virtual bool IsVisible() const
Definition: eda_text.h:186
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
Definition: eda_text.h:151
const wxPoint GetPosition() const
Definition: eda_rect.h:102
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:51
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
wxString ShortenedShownText() const
Returns a shortened version (max 15 characters) of the shown text.
Definition: eda_text.cpp:208
const wxString & GetReference() const
Definition: footprint.h:421
#define _(s)
bool m_keepUpright
if true, keep rotation angle between -90 .
Definition: fp_text.h:245
int GetLength() const
Definition: fp_text.cpp:184
TEXT_TYPE
Footprint text type: there must be only one (and only one) for each of the reference value texts in o...
Definition: fp_text.h:48
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: fp_text.cpp:307
TEXT_TYPE m_Type
0=ref, 1=val, etc.
Definition: fp_text.h:240
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
bool IsFrontLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a front layer.
EDA_UNITS
Definition: eda_units.h:38
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
const EDA_RECT GetBoundingBox() const override
Set absolute coordinates.
Definition: fp_text.cpp:227
double GetTextAngleDegrees() const
Definition: eda_text.h:176
int GetTextWidth() const
Definition: eda_text.h:241
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:32
std::shared_ptr< SHAPE_COMPOUND > GetEffectiveTextShape() const
Definition: eda_text.cpp:633
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:201
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:222
bool IsParentFlipped() const
Definition: fp_text.cpp:156
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
void AddProperty(PROPERTY_BASE *aProperty)
Register a property.
Handle the component boundary box.
Definition: eda_rect.h:42
void SetLocalCoord()
Definition: fp_text.cpp:209
T MIRRORVAL(T aPoint, T aMirrorRef)
Returns the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:31
wxString GetParentAsString() const
Definition: fp_text.h:81
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
wxPoint GetPosition() const override
Definition: footprint.h:177
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Definition: eda_rect.cpp:150
PCB_LAYER_ID m_layer
Definition: board_item.h:352
const wxPoint & GetTextPos() const
Definition: eda_text.h:247
bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const override
Test if aPoint is within the bounds of this object.
Definition: fp_text.cpp:79
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.h:159
virtual void SetTextAngle(double aAngle)
Definition: eda_text.h:167
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
const EDA_RECT GetBoundingBoxRotated(const wxPoint &aRotCenter, double aAngle) const
Useful to calculate bounding box of rotated items, when rotation if not k*90 degrees.
Definition: eda_rect.cpp:513
T NormalizeAngle360Min(T Angle)
Normalize angle to be > -360.0 and < 360.0 Angle equal to -360 or +360 are set to 0.
Definition: trigo.h:254
bool ResolveTextVar(wxString *token, int aDepth) const
Definition: board.cpp:238
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:166
virtual wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: fp_text.cpp:414
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
Definition: board_item.cpp:74
static constexpr int Millimeter2iu(double mm)
#define _HKI(x)
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:171
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:141
show footprints references (when texts are visible)
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364
void SetTextY(int aY)
Definition: eda_text.h:250
~FP_TEXT()
Definition: fp_text.cpp:68
const wxSize GetSize() const
Definition: eda_rect.h:91
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
Definition: view.h:404
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103