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 <[email protected]>
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 <string_utils.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  wxString msg;
268 
269  static const wxString text_type_msg[3] =
270  {
271  _( "Reference" ), _( "Value" ), _( "Text" )
272  };
273 
274  if( aFrame->GetName() == PCB_EDIT_FRAME_NAME )
275  {
276  FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent );
277 
278  if( fp )
279  aList.emplace_back( _( "Footprint" ), fp->GetReference() );
280  }
281 
282  // Don't use GetShownText() here; we want to show the user the variable references
283  aList.emplace_back( _( "Text" ), UnescapeString( GetText() ) );
284 
285  wxASSERT( m_Type >= TEXT_is_REFERENCE && m_Type <= TEXT_is_DIVERS );
286  aList.emplace_back( _( "Type" ), text_type_msg[m_Type] );
287 
288  if( aFrame->GetName() == PCB_EDIT_FRAME_NAME && IsLocked() )
289  aList.emplace_back( _( "Status" ), _( "Locked" ) );
290 
291  aList.emplace_back( _( "Display" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
292 
293  // Display text layer
294  aList.emplace_back( _( "Layer" ), GetLayerName() );
295 
296  aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
297 
298  msg.Printf( wxT( "%g" ), GetTextAngleDegrees() );
299  aList.emplace_back( _( "Angle" ), msg );
300 
301  msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextThickness() );
302  aList.emplace_back( _( "Thickness" ), msg );
303 
304  msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() );
305  aList.emplace_back( _( "Width" ), msg );
306 
307  msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextHeight() );
308  aList.emplace_back( _( "Height" ), msg );
309 }
310 
311 
312 wxString FP_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
313 {
314  switch( m_Type )
315  {
316  case TEXT_is_REFERENCE:
317  return wxString::Format( _( "Reference '%s'" ),
318  static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
319 
320  case TEXT_is_VALUE:
321  return wxString::Format( _( "Value '%s' of %s" ),
322  GetShownText(),
323  static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
324 
325  default:
326  return wxString::Format( _( "Footprint Text '%s' of %s" ),
328  static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
329  }
330 }
331 
332 
334 {
335  return BITMAPS::text;
336 }
337 
338 
340 {
341  return new FP_TEXT( *this );
342 }
343 
344 
346 {
347  double angle = GetDrawRotation();
348  EDA_RECT text_area = GetTextBox();
349 
350  if( angle != 0.0 )
351  text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
352 
353  return BOX2I( text_area.GetPosition(), text_area.GetSize() );
354 }
355 
356 
357 void FP_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
358 {
359  if( IsVisible() )
360  aLayers[0] = GetLayer();
361  else
362  aLayers[0] = LAYER_MOD_TEXT_INVISIBLE;
363 
364  aCount = 1;
365 }
366 
367 
368 double FP_TEXT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
369 {
370  constexpr double HIDE = (double)std::numeric_limits<double>::max();
371 
372  if( !aView )
373  return 0.0;
374 
375  // Hidden text gets put on the LAYER_MOD_TEXT_INVISIBLE for rendering, but
376  // should only render if its native layer is visible.
377  if( !aView->IsLayerVisible( GetLayer() ) )
378  return HIDE;
379 
380  // Handle Render tab switches
381  if( m_Type == TEXT_is_VALUE || GetText() == wxT( "${VALUE}" ) )
382  {
383  if( !aView->IsLayerVisible( LAYER_MOD_VALUES ) )
384  {
385  return HIDE;
386  }
387  }
388 
389  if( m_Type == TEXT_is_REFERENCE || GetText() == wxT( "${REFERENCE}" ) )
390  {
391  if( !aView->IsLayerVisible( LAYER_MOD_REFERENCES ) )
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 
403  if( !aView->IsLayerVisible( LAYER_MOD_TEXT ) )
404  return HIDE;
405 
406  // Other layers are shown without any conditions
407  return 0.0;
408 }
409 
410 
411 wxString FP_TEXT::GetShownText( int aDepth ) const
412 {
413  const FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( GetParent() );
414  wxASSERT( parentFootprint );
415  const BOARD* board = parentFootprint->GetBoard();
416 
417  std::function<bool( wxString* )> footprintResolver =
418  [&]( wxString* token ) -> bool
419  {
420  return parentFootprint && parentFootprint->ResolveTextVar( token, aDepth );
421  };
422 
423  std::function<bool( wxString* )> boardTextResolver =
424  [&]( wxString* token ) -> bool
425  {
426  return board->ResolveTextVar( token, aDepth + 1 );
427  };
428 
429  wxString text = EDA_TEXT::GetShownText();
430 
431  if( HasTextVars() )
432  {
433  PROJECT* project = nullptr;
434 
435  if( parentFootprint && parentFootprint->GetParent() )
436  project = static_cast<BOARD*>( parentFootprint->GetParent() )->GetProject();
437 
438  if( aDepth < 10 )
439  text = ExpandTextVars( text, &footprintResolver, &boardTextResolver, project );
440  }
441 
442  return text;
443 }
444 
445 
446 std::shared_ptr<SHAPE> FP_TEXT::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
447 {
448  return GetEffectiveTextShape();
449 }
450 
451 
453  PCB_LAYER_ID aLayer, int aClearance,
454  int aError, ERROR_LOC aErrorLoc ) const
455 {
456  struct TSEGM_2_POLY_PRMS prms;
457 
458  prms.m_cornerBuffer = &aCornerBuffer;
459  prms.m_textWidth = GetEffectiveTextPenWidth() + ( 2 * aClearance );
460  prms.m_error = aError;
461  wxSize size = GetTextSize();
462  int penWidth = GetEffectiveTextPenWidth();
463 
464  if( IsMirrored() )
465  size.x = -size.x;
466 
467  GRText( nullptr, GetTextPos(), BLACK, GetShownText(), GetDrawRotation(), size,
468  GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold(),
469  addTextSegmToPoly, &prms );
470 }
471 
472 
474  PCB_LAYER_ID aLayer, int aClearance,
475  int aError, ERROR_LOC aErrorLoc,
476  bool aIgnoreLineWidth ) const
477 {
478  SHAPE_POLY_SET buffer;
479  FP_TEXT dummy( *this );
480 
481  // Take parent footprint in account:
482  const FOOTPRINT* parentFootprint = static_cast<const FOOTPRINT*>( m_parent );
483 
484  if( parentFootprint )
485  dummy.SetTextAngle( GetTextAngle() + parentFootprint->GetOrientation() );
486 
487  dummy.EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( &buffer, aClearance );
488 
489  aCornerBuffer.Append( buffer );
490 }
491 
492 
493 static struct FP_TEXT_DESC
494 {
496  {
503 
504  propMgr.AddProperty( new PROPERTY<FP_TEXT, wxString>( _HKI( "Parent" ),
505  NO_SETTER( FP_TEXT, wxString ), &FP_TEXT::GetParentAsString ) );
506  }
507 } _FP_TEXT_DESC;
void SetMirrored(bool isMirrored)
Definition: eda_text.h:209
virtual double GetDrawRotation() const override
Definition: fp_text.cpp:239
bool IsBold() const
Definition: eda_text.h:204
void Offset(const wxPoint &aOffset)
Definition: eda_text.h:273
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: fp_text.cpp:339
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:478
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
void TransformTextShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc) const
Definition: fp_text.cpp:452
#define TYPE_HASH(x)
Definition: property.h:59
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:220
bool IsMirrored() const
Definition: eda_text.h:210
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
Container for project specific data.
Definition: project.h:62
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Definition: common.cpp:57
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: fp_text.cpp:345
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:164
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:49
void Move(const wxPoint &aMoveVector) override
move text in move transform, in footprint editor
Definition: fp_text.cpp:177
show footprints values (when texts are visible)
Definition: layer_ids.h:217
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:477
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Definition: lset.cpp:530
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:239
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:267
SHAPE_POLY_SET * m_cornerBuffer
Definition: eda_text.h:50
double GetOrientation() const
Definition: footprint.h:191
double GetTextAngle() const
Definition: eda_text.h:195
void SetDrawCoord()
Set relative coordinates.
Definition: fp_text.cpp:190
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
void GRText(wxDC *aDC, const wxPoint &aPos, const COLOR4D &aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, void(*aCallback)(int x0, int y0, int xf, int yf, void *aData), void *aCallbackData, PLOTTER *aPlotter)
Draw a graphic text (like footprint texts).
Definition: gr_text.cpp:129
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: fp_text.cpp:368
show footprints on back
Definition: layer_ids.h:216
void Rotate(const wxPoint &aOffset, double aAngle) override
Rotate text, in footprint editor (for instance in footprint rotation transform)
Definition: fp_text.cpp:123
A helper for the text to polygon callback function.
Definition: eda_text.h:46
Definition: color4d.h:44
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:290
int GetTextThickness() const
Definition: eda_text.h:181
The base class for create windows for drawing purpose.
void addTextSegmToPoly(int x0, int y0, int xf, int yf, void *aData)
Callback function used to convert text segments to polygons.
Definition: eda_text.cpp:65
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth) const override
Convert the item shape to a closed polygon.
Definition: fp_text.cpp:473
#define NO_SETTER(owner, type)
Definition: property.h:621
virtual bool IsLocked() const
Definition: board_item.cpp:64
#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:357
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:159
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
int GetTextHeight() const
Definition: eda_text.h:265
void SetTextX(int aX)
Definition: eda_text.h:270
bool IsItalic() const
Definition: eda_text.h:201
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:140
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: fp_text.cpp:333
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72
#define DEFAULT_TEXT_WIDTH
wxPoint m_Pos0
text coordinates relative to the footprint anchor, orient 0.
Definition: fp_text.h:243
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:219
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
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
Definition: layer_ids.h:907
FP_TEXT(FOOTPRINT *aParentFootprint, TEXT_TYPE text_type=TEXT_is_DIVERS)
Definition: fp_text.cpp:39
Represent a set of closed polygons.
virtual bool IsVisible() const
Definition: eda_text.h:207
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
Definition: eda_text.h:172
const wxSize & GetTextSize() const
Definition: eda_text.h:259
const wxPoint GetPosition() const
Definition: eda_rect.h:111
text marked as invisible
Definition: layer_ids.h:207
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
show footprints on front
Definition: layer_ids.h:215
wxString ShortenedShownText() const
Returns a shortened version (max 15 characters) of the shown text.
Definition: eda_text.cpp:218
const wxString & GetReference() const
Definition: footprint.h:466
#define _(s)
bool m_keepUpright
if true, keep rotation angle between -90 .
Definition: fp_text.h:246
int GetLength() const
Definition: fp_text.cpp:184
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: fp_text.cpp:446
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:312
TEXT_TYPE m_Type
0=ref, 1=val, etc.
Definition: fp_text.h:241
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition: layer_ids.h:153
wxString UnescapeString(const wxString &aSource)
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
EDA_UNITS
Definition: eda_units.h:38
show footprints references (when texts are visible)
Definition: layer_ids.h:218
const EDA_RECT GetBoundingBox() const override
Set absolute coordinates.
Definition: fp_text.cpp:227
double GetTextAngleDegrees() const
Definition: eda_text.h:197
int GetTextWidth() const
Definition: eda_text.h:262
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:32
std::shared_ptr< SHAPE_COMPOUND > GetEffectiveTextShape() const
Definition: eda_text.cpp:646
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:222
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
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:99
wxPoint GetPosition() const override
Definition: footprint.h:187
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Definition: eda_rect.cpp:150
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
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
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
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:180
#define PCB_EDIT_FRAME_NAME
virtual void SetTextAngle(double aAngle)
Definition: eda_text.h:188
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
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:240
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:136
virtual wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: fp_text.cpp:411
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
Definition: board_item.cpp:75
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:143
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:154
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:162
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:271
~FP_TEXT()
Definition: fp_text.cpp:68
const wxSize GetSize() const
Definition: eda_rect.h:100
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
Definition: view.h:405
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...