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-2022 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>
31#include <core/mirror.h>
32#include <footprint.h>
34#include <trigo.h>
35#include <string_utils.h>
36#include <painter.h>
38#include <callback_gal.h>
40
41FP_TEXT::FP_TEXT( FOOTPRINT* aParentFootprint, TEXT_TYPE text_type ) :
42 BOARD_ITEM( aParentFootprint, PCB_FP_TEXT_T ),
44{
45 FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
46
47 m_Type = text_type;
48 SetKeepUpright( true );
49
50 // Set text thickness to a default value
53
54 // Set position and give a default layer if a valid parent footprint exists
55 if( parentFootprint && parentFootprint->Type() == PCB_FOOTPRINT_T )
56 {
57 SetTextPos( parentFootprint->GetPosition() );
58
59 if( IsBackLayer( parentFootprint->GetLayer() ) )
60 {
62 SetMirrored( true );
63 }
64 }
65
67}
68
69
71{
72}
73
74
75bool FP_TEXT::TextHitTest( const VECTOR2I& aPoint, int aAccuracy ) const
76{
77 BOX2I rect = GetTextBox();
78 VECTOR2I location = aPoint;
79
80 rect.Inflate( aAccuracy );
81
82 RotatePoint( location, GetTextPos(), -GetDrawRotation() );
83
84 return rect.Contains( location );
85}
86
87
88bool FP_TEXT::TextHitTest( const BOX2I& aRect, bool aContains, int aAccuracy ) const
89{
90 BOX2I rect = aRect;
91
92 rect.Inflate( aAccuracy );
93
94 if( aContains )
95 return rect.Contains( GetBoundingBox() );
96 else
97 return rect.Intersects( GetTextBox(), GetDrawRotation() );
98}
99
100
101void FP_TEXT::KeepUpright( const EDA_ANGLE& aOldOrientation, const EDA_ANGLE& aNewOrientation )
102{
103 if( !IsKeepUpright() )
104 return;
105
106 EDA_ANGLE newAngle = GetTextAngle() + aNewOrientation;
107 newAngle.Normalize();
108
109 bool needsFlipped = newAngle >= ANGLE_180;
110
111 if( needsFlipped )
112 {
115 SetDrawCoord();
116 }
117}
118
119
120void FP_TEXT::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
121{
122 // Used in footprint editing
123 // Note also in footprint editor, m_Pos0 = m_Pos
124
125 VECTOR2I pt = GetTextPos();
126 RotatePoint( pt, aRotCentre, aAngle );
127 SetTextPos( pt );
128
129 EDA_ANGLE new_angle = GetTextAngle() + aAngle;
130 new_angle.Normalize180();
131 SetTextAngle( new_angle );
132
134}
135
136
137void FP_TEXT::Flip( const VECTOR2I& 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 ) );
149 }
150
151 SetLayer( FlipLayer( GetLayer(), GetBoard()->GetCopperLayerCount() ) );
152
153 if( ( GetLayerSet() & LSET::SideSpecificMask() ).any() )
155
157}
158
160{
161 if( GetParent() && GetParent()->GetLayer() == B_Cu )
162 return true;
163 return false;
164}
165
166
167void FP_TEXT::Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis )
168{
169 // the position and justification are mirrored, but not the text itself
170
171 if( aMirrorAroundXAxis )
172 {
175
176 SetTextY( ::MIRRORVAL( GetTextPos().y, aCentre.y ) );
177 }
178 else
179 {
182
183 SetTextX( ::MIRRORVAL( GetTextPos().x, aCentre.x ) );
184 }
185
187}
188
189
190void FP_TEXT::Move( const VECTOR2I& aMoveVector )
191{
192 Offset( aMoveVector );
194}
195
196
198{
199 return GetText().Len();
200}
201
202
204{
205 const FOOTPRINT* parentFootprint = static_cast<const FOOTPRINT*>( m_parent );
206
208
209 if( parentFootprint )
210 {
211 VECTOR2I pt = GetTextPos();
212 RotatePoint( pt, parentFootprint->GetOrientation() );
213 SetTextPos( pt );
214
215 Offset( parentFootprint->GetPosition() );
216 }
217}
218
219
221{
222 const FOOTPRINT* parentFootprint = static_cast<const FOOTPRINT*>( m_parent );
223
224 if( parentFootprint )
225 {
226 m_Pos0 = GetTextPos() - parentFootprint->GetPosition();
227 RotatePoint( &m_Pos0.x, &m_Pos0.y, - parentFootprint->GetOrientation() );
228 }
229 else
230 {
231 m_Pos0 = GetTextPos();
232 }
233}
234
236{
238 BOX2I bbox = GetTextBox();
239
240 if( !angle.IsZero() )
241 bbox = bbox.GetBoundingBoxRotated( GetTextPos(), angle );
242
243 return bbox;
244}
245
246
248{
249 FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
250 EDA_ANGLE rotation = GetTextAngle();
251
252 if( parentFootprint )
253 rotation += parentFootprint->GetOrientation();
254
255 if( IsKeepUpright() )
256 {
257 // Keep angle between ]-90 .. 90 deg]. Otherwise the text is not easy to read
258 while( rotation > ANGLE_90 )
259 rotation -= ANGLE_180;
260
261 while( rotation <= -ANGLE_90 )
262 rotation += ANGLE_180;
263 }
264 else
265 {
266 rotation.Normalize();
267 }
268
269 return rotation;
270}
271
272
273void FP_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
274{
275 wxString msg;
276
277 static const wxString text_type_msg[3] =
278 {
279 _( "Reference" ), _( "Value" ), _( "Text" )
280 };
281
282 if( aFrame->GetName() == PCB_EDIT_FRAME_NAME )
283 {
284 FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent );
285
286 if( fp )
287 aList.emplace_back( _( "Footprint" ), fp->GetReference() );
288 }
289
290 // Don't use GetShownText() here; we want to show the user the variable references
291 aList.emplace_back( _( "Text" ), UnescapeString( GetText() ) );
292
293 wxASSERT( m_Type >= TEXT_is_REFERENCE && m_Type <= TEXT_is_DIVERS );
294 aList.emplace_back( _( "Type" ), text_type_msg[m_Type] );
295
296 if( aFrame->GetName() == PCB_EDIT_FRAME_NAME && IsLocked() )
297 aList.emplace_back( _( "Status" ), _( "Locked" ) );
298
299 aList.emplace_back( _( "Display" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
300
301 // Display text layer
302 aList.emplace_back( _( "Layer" ), GetLayerName() );
303
304 aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
305
306 msg.Printf( wxT( "%g" ), GetTextAngle().AsDegrees() );
307 aList.emplace_back( _( "Angle" ), msg );
308
309 aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
310 aList.emplace_back( _( "Thickness" ), aFrame->MessageTextFromValue( GetTextThickness() ) );
311 aList.emplace_back( _( "Width" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
312 aList.emplace_back( _( "Height" ), aFrame->MessageTextFromValue( GetTextHeight() ) );
313}
314
315
316wxString FP_TEXT::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
317{
318 switch( m_Type )
319 {
321 return wxString::Format( _( "Reference '%s'" ),
322 static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
323
324 case TEXT_is_VALUE:
325 return wxString::Format( _( "Value '%s' of %s" ),
326 GetShownText(),
327 static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
328
329 default:
330 return wxString::Format( _( "Footprint Text '%s' of %s" ),
332 static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
333 }
334}
335
336
338{
339 return BITMAPS::text;
340}
341
342
344{
345 return new FP_TEXT( *this );
346}
347
348
350{
352 BOX2I text_area = GetTextBox();
353
354 if( !angle.IsZero() )
355 text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
356
357 return BOX2I( text_area.GetPosition(), text_area.GetSize() );
358}
359
360
361void FP_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
362{
363 if( IsVisible() )
364 aLayers[0] = GetLayer();
365 else
366 aLayers[0] = LAYER_MOD_TEXT_INVISIBLE;
367
368 aCount = 1;
369}
370
371
372double FP_TEXT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
373{
374 constexpr double HIDE = (double)std::numeric_limits<double>::max();
375
376 if( !aView )
377 return 0.0;
378
379 // Hidden text gets put on the LAYER_MOD_TEXT_INVISIBLE for rendering, but
380 // should only render if its native layer is visible.
381 if( !aView->IsLayerVisible( GetLayer() ) )
382 return HIDE;
383
384 // Handle Render tab switches
385 if( m_Type == TEXT_is_VALUE || GetText() == wxT( "${VALUE}" ) )
386 {
387 if( !aView->IsLayerVisible( LAYER_MOD_VALUES ) )
388 {
389 return HIDE;
390 }
391 }
392
393 if( m_Type == TEXT_is_REFERENCE || GetText() == wxT( "${REFERENCE}" ) )
394 {
395 if( !aView->IsLayerVisible( LAYER_MOD_REFERENCES ) )
396 {
397 return HIDE;
398 }
399 }
400
401 if( !IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_FR ) )
402 return HIDE;
403
404 if( IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_BK ) )
405 return HIDE;
406
407 if( !aView->IsLayerVisible( LAYER_MOD_TEXT ) )
408 return HIDE;
409
410 // Other layers are shown without any conditions
411 return 0.0;
412}
413
414
415wxString FP_TEXT::GetShownText( int aDepth, bool aAllowExtraText ) const
416{
417 const FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( GetParent() );
418 wxASSERT( parentFootprint );
419 const BOARD* board = parentFootprint->GetBoard();
420
421 std::function<bool( wxString* )> footprintResolver =
422 [&]( wxString* token ) -> bool
423 {
424 return parentFootprint && parentFootprint->ResolveTextVar( token, aDepth );
425 };
426
427 std::function<bool( wxString* )> boardTextResolver =
428 [&]( wxString* token ) -> bool
429 {
430 return board->ResolveTextVar( token, aDepth + 1 );
431 };
432
433 wxString text = EDA_TEXT::GetShownText();
434
435 if( HasTextVars() )
436 {
437 PROJECT* project = nullptr;
438
439 if( parentFootprint && parentFootprint->GetParent() )
440 project = static_cast<BOARD*>( parentFootprint->GetParent() )->GetProject();
441
442 if( aDepth < 10 )
443 text = ExpandTextVars( text, &footprintResolver, &boardTextResolver, project );
444 }
445
446 return text;
447}
448
449
450std::shared_ptr<SHAPE> FP_TEXT::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
451{
452 return GetEffectiveTextShape();
453}
454
455
456void FP_TEXT::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
457 int aError, ERROR_LOC aErrorLoc ) const
458{
460 KIFONT::FONT* font = getDrawFont();
461 int penWidth = GetEffectiveTextPenWidth();
462
463 // Note: this function is mainly used in 3D viewer.
464 // the polygonal shape of a text can have many basic shapes,
465 // so combining these shapes can be very useful to create a final shape
466 // swith a lot less vertices to speedup calculations using this final shape
467 // Simplify shapes is not usually always efficient, but in this case it is.
468 SHAPE_POLY_SET buffer;
469
470 CALLBACK_GAL callback_gal( empty_opts,
471 // Stroke callback
472 [&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
473 {
474 TransformOvalToPolygon( buffer, aPt1, aPt2, penWidth + ( 2 * aClearance ), aError,
475 ERROR_INSIDE );
476 },
477 // Triangulation callback
478 [&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
479 {
480 buffer.NewOutline();
481
482 for( const VECTOR2I& point : { aPt1, aPt2, aPt3 } )
483 buffer.Append( point.x, point.y );
484 } );
485
487 attrs.m_Angle = GetDrawRotation();
488
489 font->Draw( &callback_gal, GetShownText(), GetTextPos(), attrs );
490
492 aBuffer.Append( buffer );
493}
494
495
496void FP_TEXT::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
497 int aError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth ) const
498{
499 SHAPE_POLY_SET buffer;
500
501 EDA_TEXT::TransformBoundingBoxToPolygon( &buffer, aClearance );
502 aBuffer.Append( buffer );
503}
504
505
506static struct FP_TEXT_DESC
507{
509 {
516
517 propMgr.AddProperty( new PROPERTY<FP_TEXT, wxString>( _HKI( "Parent" ),
519 }
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
#define DEFAULT_TEXT_WIDTH
BOX2< VECTOR2I > BOX2I
Definition: box2.h:847
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:58
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:180
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:214
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:43
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:185
virtual bool IsLocked() const
Definition: board_item.cpp:71
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:163
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
Definition: board_item.cpp:94
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
bool ResolveTextVar(wxString *token, int aDepth) const
Definition: board.cpp:307
const Vec & GetPosition() const
Definition: box2.h:184
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:269
bool Contains(const Vec &aPoint) const
Definition: box2.h:141
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:506
const Vec & GetSize() const
Definition: box2.h:179
const BOX2< Vec > GetBoundingBoxRotated(const VECTOR2I &aRotCenter, const EDA_ANGLE &aAngle) const
Useful to calculate bounding box of rotated items, when rotation is not cardinal.
Definition: box2.h:650
EDA_ANGLE Normalize()
Definition: eda_angle.h:249
EDA_ANGLE Normalize180()
Definition: eda_angle.h:271
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:496
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:72
void TransformBoundingBoxToPolygon(SHAPE_POLY_SET *aBuffer, int aClearance) const
Convert the text bounding box to a rectangular polygon depending on the text orientation,...
Definition: eda_text.cpp:945
int GetTextHeight() const
Definition: eda_text.h:195
BOX2I 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:503
const VECTOR2I & GetTextPos() const
Definition: eda_text.h:201
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:120
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
bool IsKeepUpright() const
Definition: eda_text.h:148
virtual bool IsVisible() const
Definition: eda_text.h:129
void SetTextPos(const VECTOR2I &aPoint)
Definition: eda_text.cpp:371
void SetTextX(int aX)
Definition: eda_text.cpp:377
KIFONT::FONT * GetFont() const
Definition: eda_text.h:181
void SetMirrored(bool isMirrored)
Definition: eda_text.cpp:224
void SetTextY(int aY)
Definition: eda_text.cpp:383
int GetTextWidth() const
Definition: eda_text.h:192
void Offset(const VECTOR2I &aOffset)
Definition: eda_text.cpp:389
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:142
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
Definition: eda_text.h:103
virtual KIFONT::FONT * getDrawFont() const
Definition: eda_text.cpp:426
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.cpp:185
const TEXT_ATTRIBUTES & GetAttributes() const
Definition: eda_text.h:165
bool IsMirrored() const
Definition: eda_text.h:132
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
Definition: eda_text.cpp:297
std::shared_ptr< SHAPE_COMPOUND > GetEffectiveTextShape(bool aTriangulate=true, bool aUseTextRotation=true) const
build a list of segments (SHAPE_SEGMENT) to describe a text shape.
Definition: eda_text.cpp:853
void SetKeepUpright(bool aKeepUpright)
Definition: eda_text.cpp:256
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:193
int GetTextThickness() const
Definition: eda_text.h:112
virtual wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:98
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Definition: eda_text.cpp:240
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the component.
Definition: footprint.cpp:488
EDA_ANGLE GetOrientation() const
Definition: footprint.h:191
const wxString & GetReference() const
Definition: footprint.h:510
VECTOR2I GetPosition() const override
Definition: footprint.h:188
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:361
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: fp_text.cpp:337
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: fp_text.cpp:372
void TransformTextToPolySet(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc) const
Definition: fp_text.cpp:456
virtual EDA_ANGLE GetDrawRotation() const override
Definition: fp_text.cpp:247
~FP_TEXT()
Definition: fp_text.cpp:70
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:273
const BOX2I GetBoundingBox() const override
Set absolute coordinates.
Definition: fp_text.cpp:235
void Mirror(const VECTOR2I &aCentre, bool aMirrorAroundXAxis)
Mirror text position.
Definition: fp_text.cpp:167
bool TextHitTest(const VECTOR2I &aPoint, int aAccuracy=0) const override
Test if aPoint is within the bounds of this object.
Definition: fp_text.cpp:75
VECTOR2I m_Pos0
text coordinates relative to the footprint anchor, orient 0.
Definition: fp_text.h:195
void SetLocalCoord()
Definition: fp_text.cpp:220
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: fp_text.cpp:349
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, 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:496
bool IsParentFlipped() const
Definition: fp_text.cpp:159
void SetDrawCoord()
Set relative coordinates.
Definition: fp_text.cpp:203
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
@ TEXT_is_REFERENCE
Definition: fp_text.h:49
@ TEXT_is_DIVERS
Definition: fp_text.h:51
@ TEXT_is_VALUE
Definition: fp_text.h:50
TEXT_TYPE m_Type
0=ref, 1=val, etc.
Definition: fp_text.h:193
void KeepUpright(const EDA_ANGLE &aOldOrientation, const EDA_ANGLE &aNewOrientation)
Called when rotating the parent footprint.
Definition: fp_text.cpp:101
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: fp_text.cpp:343
FP_TEXT(FOOTPRINT *aParentFootprint, TEXT_TYPE text_type=TEXT_is_DIVERS)
Definition: fp_text.cpp:41
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip entity during footprint flip.
Definition: fp_text.cpp:137
void Rotate(const VECTOR2I &aOffset, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: fp_text.cpp:120
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: fp_text.cpp:190
wxString GetSelectMenuText(UNITS_PROVIDER *aUnitsProvider) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: fp_text.cpp:316
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:450
wxString GetParentAsString() const
Definition: fp_text.h:80
virtual wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const override
Return the string actually shown after processing of the base text.
Definition: fp_text.cpp:415
int GetLength() const
Definition: fp_text.cpp:197
FONT is an abstract base class for both outline and stroke fonts.
Definition: font.h:105
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttrs) const
Draw a string.
Definition: font.cpp:159
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
Definition: view.h:410
static LSET SideSpecificMask()
Definition: lset.cpp:908
Container for project specific data.
Definition: project.h:63
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:64
void AddProperty(PROPERTY_BASE *aProperty)
Register a property.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:66
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
Represent a set of closed polygons.
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...
void Simplify(POLYGON_MODE aFastMode)
int NewOutline()
Creates a new hole in a given outline.
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Definition: common.cpp:57
void TransformOvalToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a oblong shape to a polygon, using multiple segments.
#define _HKI(x)
#define _(s)
static constexpr EDA_ANGLE & ANGLE_180
Definition: eda_angle.h:416
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
Definition: eda_angle.h:408
static constexpr EDA_ANGLE & ANGLE_VERTICAL
Definition: eda_angle.h:409
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:414
#define PCB_EDIT_FRAME_NAME
static struct FP_TEXT_DESC _FP_TEXT_DESC
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
@ ERROR_INSIDE
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition: layer_ids.h:147
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
Definition: layer_ids.h:922
@ LAYER_MOD_TEXT_INVISIBLE
text marked as invisible
Definition: layer_ids.h:200
@ LAYER_MOD_TEXT
Definition: layer_ids.h:198
@ LAYER_MOD_FR
show footprints on front
Definition: layer_ids.h:208
@ LAYER_MOD_VALUES
show footprints values (when texts are visible)
Definition: layer_ids.h:210
@ LAYER_MOD_BK
show footprints on back
Definition: layer_ids.h:209
@ LAYER_MOD_REFERENCES
show footprints references (when texts are visible)
Definition: layer_ids.h:211
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ B_Cu
Definition: layer_ids.h:95
@ F_SilkS
Definition: layer_ids.h:104
@ B_SilkS
Definition: layer_ids.h:103
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Definition: lset.cpp:544
T MIRRORVAL(T aPoint, T aMirrorRef)
Returns the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:31
wxString EllipsizeMenuText(const wxString &aString)
Ellipsize text (at the end) to be no more than 36 characters.
Definition: ui_common.cpp:203
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
#define TYPE_HASH(x)
Definition: property.h:61
#define NO_SETTER(owner, type)
Definition: property.h:632
#define REGISTER_TYPE(x)
Definition: property_mgr.h:256
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
wxString UnescapeString(const wxString &aSource)
constexpr int mmToIU(double mm) const
Definition: base_units.h:89
GR_TEXT_H_ALIGN_T
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
@ PCB_FP_TEXT_T
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92