KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_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) 2012 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
6 * Copyright The 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, see <https://www.gnu.org/licenses/>.
20 */
21
22#include <google/protobuf/any.pb.h>
23
24#include <advanced_config.h>
25#include <common.h>
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>
33#include <pcb_text.h>
34#include <pcb_painter.h>
35#include <trigo.h>
36#include <string_utils.h>
40#include <callback_gal.h>
42#include <api/api_enums.h>
43#include <api/api_utils.h>
44#include <api/board/board_types.pb.h>
45#include <properties/property.h>
47
48
50 BOARD_ITEM( parent, idtype ),
53{
54 SetMultilineAllowed( true );
55}
56
57
59 BOARD_ITEM( aParent, idtype ),
62{
63 SetKeepUpright( true );
64
65 // N.B. Do not automatically set text effects
66 // These are optional in the file format and so need to be defaulted to off.
67
69
70 if( aParent )
71 {
72 SetTextPos( aParent->GetPosition() );
73
74 if( IsBackLayer( aParent->GetLayer() ) )
76 }
77}
78
79
80PCB_TEXT::PCB_TEXT( const PCB_TEXT& aOther ) :
81 BOARD_ITEM( aOther ),
82 EDA_TEXT( aOther ),
84{
85}
86
87
89{
90 if( this == &aOther )
91 return *this;
92
93 BOARD_ITEM::operator=( aOther );
94 EDA_TEXT::operator=( aOther );
95 m_knockout_cache.reset();
96
97 return *this;
98}
99
100
104
105
106void PCB_TEXT::CopyFrom( const BOARD_ITEM* aOther )
107{
108 wxCHECK( aOther && aOther->Type() == PCB_TEXT_T, /* void */ );
109 *this = *static_cast<const PCB_TEXT*>( aOther );
110}
111
112
113void PCB_TEXT::Serialize( google::protobuf::Any& aContainer ) const
114{
115 using namespace kiapi::common;
116 kiapi::board::types::BoardText boardText;
117
118 boardText.mutable_id()->set_value( m_Uuid.AsStdString() );
120 boardText.set_knockout( IsKnockout() );
121 boardText.set_locked( IsLocked() ? types::LockedState::LS_LOCKED : types::LockedState::LS_UNLOCKED );
122
123 google::protobuf::Any any;
125 any.UnpackTo( boardText.mutable_text() );
126
127 // Some of the common Text message fields are not stored in EDA_TEXT
128 types::Text* text = boardText.mutable_text();
129
130 PackVector2( *text->mutable_position(), GetPosition() );
131
132 aContainer.PackFrom( boardText );
133}
134
135
136bool PCB_TEXT::Deserialize( const google::protobuf::Any& aContainer )
137{
138 using namespace kiapi::common;
139 kiapi::board::types::BoardText boardText;
140
141 if( !aContainer.UnpackTo( &boardText ) )
142 return false;
143
145 SetUuidDirect( KIID( boardText.id().value() ) );
146 SetIsKnockout( boardText.knockout() );
147 SetLocked( boardText.locked() == types::LockedState::LS_LOCKED );
148
149 google::protobuf::Any any;
150 any.PackFrom( boardText.text() );
152
153 const types::Text& text = boardText.text();
154
155 SetPosition( UnpackVector2( text.position() ) );
156
157 return true;
158}
159
160
161wxString PCB_TEXT::GetShownText( bool aAllowExtraText, int aDepth ) const
162{
163 const FOOTPRINT* parentFootprint = GetParentFootprint();
164 const BOARD* board = GetBoard();
165
166 std::function<bool( wxString* )> resolver = [&]( wxString* token ) -> bool
167 {
168 if( token->IsSameAs( wxT( "LAYER" ) ) )
169 {
170 *token = GetLayerName();
171 return true;
172 }
173
174 if( parentFootprint && parentFootprint->ResolveTextVar( token, aDepth + 1 ) )
175 return true;
176
177 // board can be null in some cases when saving a footprint in FP editor
178 if( board && board->ResolveTextVar( token, aDepth + 1 ) )
179 return true;
180
181 return false;
182 };
183
184 wxString text = EDA_TEXT::GetShownText( aAllowExtraText, aDepth );
185
186 if( HasTextVars() )
187 text = ResolveTextVars( text, &resolver, aDepth );
188
189 // Convert escape markers back to literal ${} and @{} for final display
190 text.Replace( wxT( "<<<ESC_DOLLAR:" ), wxT( "${" ) );
191 text.Replace( wxT( "<<<ESC_AT:" ), wxT( "@{" ) );
192
193 return text;
194}
195
196
197bool PCB_TEXT::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const
198{
199 return BOARD_ITEM::Matches( UnescapeString( GetText() ), aSearchData );
200}
201
202
204{
205 EDA_ANGLE rotation = GetTextAngle();
206
208 {
209 // Keep angle between ]-90..90] deg. Otherwise the text is not easy to read
210 while( rotation > ANGLE_90 )
211 rotation -= ANGLE_180;
212
213 while( rotation <= -ANGLE_90 )
214 rotation += ANGLE_180;
215 }
216 else
217 {
218 rotation.Normalize();
219 }
220
221 return rotation;
222}
223
224
226{
227 return GetBoundingBox();
228}
229
230
231std::vector<int> PCB_TEXT::ViewGetLayers() const
232{
235
236 return { GetLayer() };
237}
238
239
240double PCB_TEXT::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
241{
242 if( !aView )
243 return LOD_SHOW;
244
245 KIGFX::PCB_PAINTER& painter = static_cast<KIGFX::PCB_PAINTER&>( *aView->GetPainter() );
246 KIGFX::PCB_RENDER_SETTINGS& renderSettings = *painter.GetSettings();
247
248 if( !aView->IsLayerVisibleCached( GetLayer() ) )
249 return LOD_HIDE;
250
251 if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
252 {
253 // Hide shadow on dimmed tracks
254 if( renderSettings.GetHighContrast() )
255 {
256 if( m_layer != renderSettings.GetPrimaryHighContrastLayer() )
257 return LOD_HIDE;
258 }
259 }
260
261 if( FOOTPRINT* parentFP = GetParentFootprint() )
262 {
263 // Handle Render tab switches
264 if( GetText() == wxT( "${VALUE}" ) )
265 {
267 return LOD_HIDE;
268 }
269
270 if( GetText() == wxT( "${REFERENCE}" ) )
271 {
273 return LOD_HIDE;
274 }
275
276 PCB_LAYER_ID checkLayer = GetLayer();
277
278 if( !IsFrontLayer( checkLayer ) && !IsBackLayer( checkLayer ) )
279 checkLayer = parentFP->GetLayer();
280
281 if( IsFrontLayer( checkLayer ) && !aView->IsLayerVisibleCached( LAYER_FOOTPRINTS_FR ) )
282 return LOD_HIDE;
283
284 if( IsBackLayer( checkLayer ) && !aView->IsLayerVisibleCached( LAYER_FOOTPRINTS_BK ) )
285 return LOD_HIDE;
286
287 if( !aView->IsLayerVisibleCached( LAYER_FP_TEXT ) )
288 return LOD_HIDE;
289 }
290
291 return LOD_SHOW;
292}
293
294
295void PCB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
296{
297 FOOTPRINT* parentFP = GetParentFootprint();
298
299 if( parentFP && aFrame->GetName() == PCB_EDIT_FRAME_NAME )
300 aList.emplace_back( _( "Footprint" ), parentFP->GetReference() );
301
302 // Don't use GetShownText() here; we want to show the user the variable references
303 wxString value = GetText();
304
305 if( parentFP )
306 {
307 if( PCB_FIELD* field = dynamic_cast<PCB_FIELD*>( this ) )
308 {
309 wxString variant;
310
311 if( BOARD* board = parentFP->GetBoard() )
312 variant = board->GetCurrentVariant();
313
314 value = parentFP->GetFieldValueForVariant( variant, field->GetName() );
315 }
316
317 aList.emplace_back( _( "Text" ), KIUI::EllipsizeStatusText( aFrame, value ) );
318 }
319 else
320 {
321 aList.emplace_back( _( "PCB Text" ), KIUI::EllipsizeStatusText( aFrame, value ) );
322 }
323
324 if( parentFP )
325 aList.emplace_back( _( "Type" ), GetTextTypeDescription() );
326
327 if( aFrame->GetName() == PCB_EDIT_FRAME_NAME && IsLocked() )
328 aList.emplace_back( _( "Status" ), _( "Locked" ) );
329
330 aList.emplace_back( _( "Layer" ), GetLayerName() );
331
332 aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
333
334 aList.emplace_back( _( "Angle" ), wxString::Format( wxT( "%g" ), GetTextAngle().AsDegrees() ) );
335
336 aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
337
338 if( GetTextThickness() )
339 aList.emplace_back( _( "Text Thickness" ), aFrame->MessageTextFromValue( GetEffectiveTextPenWidth() ) );
340 else
341 aList.emplace_back( _( "Text Thickness" ), _( "Auto" ) );
342
343 aList.emplace_back( _( "Width" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
344 aList.emplace_back( _( "Height" ), aFrame->MessageTextFromValue( GetTextHeight() ) );
345}
346
347
352
353
354void PCB_TEXT::StyleFromSettings( const BOARD_DESIGN_SETTINGS& settings, bool aCheckSide )
355{
356 SetTextSize( settings.GetTextSize( GetLayer() ) );
358 SetItalic( settings.GetTextItalic( GetLayer() ) );
359
360 if( GetParentFootprint() )
361 SetKeepUpright( settings.GetTextUpright( GetLayer() ) );
362
363 if( aCheckSide )
364 {
365 if( BOARD* board = GetBoard() )
366 SetMirrored( board->IsBackLayer( GetLayer() ) );
367 else
369 }
370}
371
372
374{
375 if( !IsKeepUpright() )
376 return;
377
378 EDA_ANGLE newAngle = GetTextAngle();
379 newAngle.Normalize();
380
381 bool needsFlipped = newAngle >= ANGLE_180;
382
383 if( needsFlipped )
384 {
386 SetVertJustify( static_cast<GR_TEXT_V_ALIGN_T>( -GetVertJustify() ) );
387 newAngle += ANGLE_180;
388 newAngle.Normalize();
389 SetTextAngle( newAngle );
390 }
391}
392
393
395{
396 EDA_ANGLE angle = GetDrawRotation();
397 BOX2I rect = GetTextBox( nullptr );
398
399 if( IsKnockout() )
400 rect.Inflate( getKnockoutMargin() );
401
402 if( !angle.IsZero() )
403 rect = rect.GetBoundingBoxRotated( GetTextPos(), angle );
404
405 return rect;
406}
407
408
409bool PCB_TEXT::TextHitTest( const VECTOR2I& aPoint, int aAccuracy ) const
410{
411 int accuracy = aAccuracy;
412
413 if( IsKnockout() )
415
416 return EDA_TEXT::TextHitTest( aPoint, accuracy );
417}
418
419
420bool PCB_TEXT::TextHitTest( const BOX2I& aRect, bool aContains, int aAccuracy ) const
421{
422 BOX2I rect = aRect;
423
424 rect.Inflate( aAccuracy );
425
426 if( aContains )
427 return rect.Contains( GetBoundingBox() );
428
429 return rect.Intersects( GetBoundingBox() );
430}
431
432
433bool PCB_TEXT::TextHitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const
434{
435 BOX2I rect = GetTextBox( nullptr );
436
437 if( IsKnockout() )
438 rect.Inflate( getKnockoutMargin() );
439
440 return KIGEOM::BoxHitTest( aPoly, rect, GetDrawRotation(), GetDrawPos(), aContained );
441}
442
443
445{
446 if( const FOOTPRINT* fp = GetParentFootprint() )
447 return fp->GetTransform().Apply( EDA_TEXT::GetTextPos() );
448
449 return EDA_TEXT::GetTextPos();
450}
451
452
454{
456
457 if( const FOOTPRINT* fp = GetParentFootprint() )
458 {
459 const TRANSFORM_TRS& xf = fp->GetTransform();
460 return { KiROUND( libSize.x * std::abs( xf.GetScaleX() ) ), KiROUND( libSize.y * std::abs( xf.GetScaleY() ) ) };
461 }
462
463 return libSize;
464}
465
466
467void PCB_TEXT::SetTextSize( VECTOR2I aNewSize, bool aEnforceMinTextSize )
468{
469 if( const FOOTPRINT* fp = GetParentFootprint() )
470 {
471 const TRANSFORM_TRS& xf = fp->GetTransform();
472 aNewSize = { KiROUND( aNewSize.x / std::abs( xf.GetScaleX() ) ),
473 KiROUND( aNewSize.y / std::abs( xf.GetScaleY() ) ) };
474 }
475
476 EDA_TEXT::SetTextSize( aNewSize, aEnforceMinTextSize );
477}
478
479
481{
482 int libThickness = EDA_TEXT::GetTextThickness();
483
484 if( const FOOTPRINT* fp = GetParentFootprint() )
485 {
486 const TRANSFORM_TRS& xf = fp->GetTransform();
487 const double factor = ( std::abs( xf.GetScaleX() ) + std::abs( xf.GetScaleY() ) ) * 0.5;
488 return KiROUND( libThickness * factor );
489 }
490
491 return libThickness;
492}
493
494
496{
497 if( const FOOTPRINT* fp = GetParentFootprint() )
498 {
499 const TRANSFORM_TRS& xf = fp->GetTransform();
500 const double factor = ( std::abs( xf.GetScaleX() ) + std::abs( xf.GetScaleY() ) ) * 0.5;
501 aWidth = KiROUND( aWidth / factor );
502 }
503
505}
506
507
508void PCB_TEXT::Offset( const VECTOR2I& aOffset )
509{
510 if( const FOOTPRINT* fp = GetParentFootprint() )
511 {
512 VECTOR2I curBoardPos = fp->GetTransform().Apply( EDA_TEXT::GetTextPos() );
513 VECTOR2I newLibPos = fp->GetTransform().InverseApply( curBoardPos + aOffset );
514 VECTOR2I libDelta = newLibPos - EDA_TEXT::GetTextPos();
516 EDA_TEXT::Offset( libDelta );
517 }
518 else
519 {
520 EDA_TEXT::Offset( aOffset );
521 }
522}
523
524
526{
528}
529
530
532{
533 EDA_TEXT::SetTextSize( aSize );
534}
535
536
538{
540}
541
542
544{
545 if( const FOOTPRINT* fp = GetParentFootprint() )
546 return m_libTextAngle + fp->GetOrientation();
547
548 return m_libTextAngle;
549}
550
551
553{
554 if( const FOOTPRINT* fp = GetParentFootprint() )
555 m_libTextAngle = aAngle - fp->GetOrientation();
556 else
557 m_libTextAngle = aAngle;
558
559 m_libTextAngle.Normalize();
560 EDA_TEXT::SetTextAngle( aAngle );
561}
562
563
564void PCB_TEXT::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
565{
566 VECTOR2I pt = GetTextPos();
567 RotatePoint( pt, aRotCentre, aAngle );
568 SetTextPos( pt );
569
570 EDA_ANGLE new_angle = GetTextAngle() + aAngle;
571 new_angle.Normalize();
572 SetTextAngle( new_angle );
573}
574
575
576void PCB_TEXT::Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection )
577{
578 // the position and justification are mirrored, but not the text itself
579
580 if( aFlipDirection == FLIP_DIRECTION::TOP_BOTTOM )
581 {
584
585 SetTextY( MIRRORVAL( GetTextPos().y, aCentre.y ) );
586 }
587 else
588 {
591
592 SetTextX( MIRRORVAL( GetTextPos().x, aCentre.x ) );
593 }
594}
595
596
597void PCB_TEXT::OnFootprintRescaled( double /* aRatioX */, double /* aRatioY */, double /* aLinearFactor */,
598 const VECTOR2I& /* aAnchor */, const EDA_ANGLE& /* aParentRotate */ )
599{
601}
602
603
610
611
612void PCB_TEXT::Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection )
613{
614 if( const FOOTPRINT* fp = GetParentFootprint() )
615 {
616 // Mirror the library-frame position (rotation-independent).
617 const VECTOR2I libAxis = fp->GetTransform().InverseApply( aCentre );
619
620 if( aFlipDirection == FLIP_DIRECTION::LEFT_RIGHT )
621 libPos.x = 2 * libAxis.x - libPos.x;
622 else
623 libPos.y = 2 * libAxis.y - libPos.y;
624
625 SetLibTextPos( libPos );
626 }
627 else if( aFlipDirection == FLIP_DIRECTION::LEFT_RIGHT )
628 {
629 SetTextX( MIRRORVAL( GetTextPos().x, aCentre.x ) );
630 }
631 else
632 {
633 SetTextY( MIRRORVAL( GetTextPos().y, aCentre.y ) );
634 }
635
636 if( aFlipDirection == FLIP_DIRECTION::LEFT_RIGHT )
638 else
640
641 m_libTextAngle.Normalize();
643
645
646 if( IsSideSpecific() )
648}
649
650
652{
653 return _( "Text" );
654}
655
656
657wxString PCB_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
658{
659 wxString content = aFull ? GetShownText( false ) : KIUI::EllipsizeMenuText( GetText() );
660
661 if( FOOTPRINT* parentFP = GetParentFootprint() )
662 {
663 wxString ref = parentFP->GetReference();
664 return wxString::Format( _( "Footprint text of %s (%s)" ), ref, content );
665 }
666
667 return wxString::Format( _( "PCB text '%s' on %s" ), content, GetLayerName() );
668}
669
670
672{
673 return BITMAPS::text;
674}
675
676
678{
679 return new PCB_TEXT( *this );
680}
681
682
684{
685 wxASSERT( aImage->Type() == PCB_TEXT_T );
686
687 std::swap( *( (PCB_TEXT*) this ), *( (PCB_TEXT*) aImage ) );
688}
689
690
691std::shared_ptr<SHAPE> PCB_TEXT::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
692{
693 if( IsKnockout() )
694 {
695 SHAPE_POLY_SET poly;
696
698
699 return std::make_shared<SHAPE_POLY_SET>( std::move( poly ) );
700 }
701
702 return GetEffectiveTextShape();
703}
704
705
706const SHAPE_POLY_SET& PCB_TEXT::GetKnockoutCache( const KIFONT::FONT* aFont, const wxString& forResolvedText,
707 int aMaxError ) const
708{
710 attrs.m_Size = GetTextSize();
711 EDA_ANGLE drawAngle = GetDrawRotation();
712 VECTOR2I drawPos = GetDrawPos();
713
714 if( !m_knockout_cache )
715 m_knockout_cache = std::make_unique<PCB_TEXT_KNOCKOUT_CACHE_DATA>();
716
717 if( m_knockout_cache->cache.IsEmpty() || m_knockout_cache->text_attrs != attrs
718 || m_knockout_cache->text != forResolvedText
719 || m_knockout_cache->angle != drawAngle )
720 {
721 m_knockout_cache->cache.RemoveAllContours();
722
724 m_knockout_cache->cache.Fracture();
725
726 m_knockout_cache->text_attrs = attrs;
727 m_knockout_cache->angle = drawAngle;
728 m_knockout_cache->text = forResolvedText;
729 m_knockout_cache->pos = drawPos;
730 }
731 else if( m_knockout_cache->pos != drawPos )
732 {
733 m_knockout_cache->cache.Move( drawPos - m_knockout_cache->pos );
734 m_knockout_cache->pos = drawPos;
735 }
736
737 return m_knockout_cache->cache;
738}
739
740
741void PCB_TEXT::buildBoundingHull( SHAPE_POLY_SET* aBuffer, const SHAPE_POLY_SET& aRenderedText, int aClearance ) const
742{
743 SHAPE_POLY_SET poly( aRenderedText );
744
745 poly.Rotate( -GetDrawRotation(), GetDrawPos() );
746
747 BOX2I rect = poly.BBox( aClearance );
748 VECTOR2I corners[4];
749
750 corners[0].x = rect.GetOrigin().x;
751 corners[0].y = rect.GetOrigin().y;
752 corners[1].y = corners[0].y;
753 corners[1].x = rect.GetRight();
754 corners[2].x = corners[1].x;
755 corners[2].y = rect.GetBottom();
756 corners[3].y = corners[2].y;
757 corners[3].x = corners[0].x;
758
759 aBuffer->NewOutline();
760
761 for( VECTOR2I& corner : corners )
762 {
763 RotatePoint( corner, GetDrawPos(), GetDrawRotation() );
764 aBuffer->Append( corner.x, corner.y );
765 }
766}
767
768
769void PCB_TEXT::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, int aClearance, int aMaxError,
770 ERROR_LOC aErrorLoc ) const
771{
773 KIFONT::FONT* font = GetDrawFont( nullptr );
774 int penWidth = GetEffectiveTextPenWidth();
776 wxString shownText = GetShownText( true );
777
778 attrs.m_Angle = GetDrawRotation();
779 attrs.m_Size = GetTextSize();
780
781 // The polygonal shape of a text can have many basic shapes, so combining these shapes can
782 // be very useful to create a final shape with a lot less vertices to speedup calculations.
783 // Simplify shapes is not usually always efficient, but in this case it is.
784 SHAPE_POLY_SET textShape;
785
786 CALLBACK_GAL callback_gal(
787 empty_opts,
788 // Stroke callback
789 [&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
790 {
791 TransformOvalToPolygon( textShape, aPt1, aPt2, penWidth, aMaxError, aErrorLoc );
792 },
793 // Triangulation callback
794 [&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
795 {
796 textShape.NewOutline();
797
798 for( const VECTOR2I& point : { aPt1, aPt2, aPt3 } )
799 textShape.Append( point.x, point.y );
800 } );
801
802 if( auto* cache = GetRenderCache( font, shownText ) )
803 callback_gal.DrawGlyphs( *cache );
804 else
805 font->Draw( &callback_gal, shownText, GetTextPos(), attrs, GetFontMetrics() );
806
807 textShape.Simplify();
808
809 if( IsKnockout() )
810 {
811 SHAPE_POLY_SET finalPoly;
812 int margin = GetKnockoutTextMargin( attrs.m_Size, penWidth );
813
814 buildBoundingHull( &finalPoly, textShape, margin + aClearance );
815 finalPoly.BooleanSubtract( textShape );
816
817 aBuffer.Append( finalPoly );
818 }
819 else
820 {
821 if( aClearance > 0 || aErrorLoc == ERROR_OUTSIDE )
822 {
823 if( aErrorLoc == ERROR_OUTSIDE )
824 aClearance += aMaxError;
825
826 textShape.Inflate( aClearance, CORNER_STRATEGY::ROUND_ALL_CORNERS, aMaxError );
827 }
828
829 aBuffer.Append( textShape );
830 }
831}
832
833
834void PCB_TEXT::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError,
835 ERROR_LOC aErrorLoc, bool aIgnoreLineWidth ) const
836{
837 SHAPE_POLY_SET poly;
838
839 TransformTextToPolySet( poly, 0, aMaxError, aErrorLoc );
840
841 buildBoundingHull( &aBuffer, poly, aClearance );
842}
843
844
845bool PCB_TEXT::operator==( const BOARD_ITEM& aBoardItem ) const
846{
847 if( aBoardItem.Type() != Type() )
848 return false;
849
850 const PCB_TEXT& other = static_cast<const PCB_TEXT&>( aBoardItem );
851
852 return *this == other;
853}
854
855
856bool PCB_TEXT::operator==( const PCB_TEXT& aOther ) const
857{
858 return EDA_TEXT::operator==( aOther );
859}
860
861
862double PCB_TEXT::Similarity( const BOARD_ITEM& aOther ) const
863{
864 if( aOther.Type() != Type() )
865 return 0.0;
866
867 const PCB_TEXT& other = static_cast<const PCB_TEXT&>( aOther );
868
869 return EDA_TEXT::Similarity( other );
870}
871
872
874{
875 wxString msg =
876#include "pcb_text_help_md.h"
877 ;
878
879 HTML_MESSAGE_BOX* dlg = new HTML_MESSAGE_BOX( aParentWindow, _( "Syntax Help" ) );
880 wxSize sz( 320, 320 );
881
882 dlg->SetMinSize( dlg->ConvertDialogToPixels( sz ) );
883 dlg->SetDialogSizeInDU( sz.x, sz.y );
884
885 wxString html_txt;
886 ConvertMarkdown2Html( wxGetTranslation( msg ), html_txt );
887 dlg->AddHTML_Text( html_txt );
888 dlg->ShowModeless();
889
890 return dlg;
891}
892
893
894static struct PCB_TEXT_DESC
895{
897 {
904
905 propMgr.Mask( TYPE_HASH( PCB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Color" ) );
906
909 _HKI( "Text Properties" ) );
910
913 _HKI( "Text Properties" ) );
914
915 auto isFootprintText = []( INSPECTABLE* aItem ) -> bool
916 {
917 if( PCB_TEXT* text = dynamic_cast<PCB_TEXT*>( aItem ) )
918 return text->GetParentFootprint();
919
920 return false;
921 };
922
923 propMgr.OverrideAvailability( TYPE_HASH( PCB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Keep Upright" ),
924 isFootprintText );
925
926 propMgr.Mask( TYPE_HASH( PCB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Hyperlink" ) );
927 }
types::KiCadObjectType ToProtoEnum(KICAD_T aValue)
KICAD_T FromProtoEnum(types::KiCadObjectType aValue)
Definition api_enums.cpp:47
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
@ ERROR_OUTSIDE
@ ERROR_INSIDE
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:121
BITMAPS
A list of all bitmap identifiers.
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition box2.h:986
Container for design settings for a BOARD object.
bool GetTextUpright(PCB_LAYER_ID aLayer) const
int GetTextThickness(PCB_LAYER_ID aLayer) const
Return the default text thickness from the layer class for the given layer.
bool GetTextItalic(PCB_LAYER_ID aLayer) const
VECTOR2I GetTextSize(PCB_LAYER_ID aLayer) const
Return the default text size from the layer class for the given layer.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:81
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:83
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition board_item.h:265
friend class BOARD
Definition board_item.h:512
void SetUuidDirect(const KIID &aUuid)
Raw UUID assignment.
void SetLocked(bool aLocked) override
Definition board_item.h:356
PCB_LAYER_ID m_layer
Definition board_item.h:508
virtual bool IsKnockout() const
Definition board_item.h:352
bool IsLocked() const override
virtual void SetIsKnockout(bool aKnockout)
Definition board_item.h:353
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition board_item.h:313
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
FOOTPRINT * GetParentFootprint() const
const KIFONT::METRICS & GetFontMetrics() const
BOARD_ITEM & operator=(const BOARD_ITEM &aOther)
Definition board_item.h:100
bool IsSideSpecific() const
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
int GetMaxError() const
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition box2.h:554
constexpr bool Contains(const Vec &aPoint) const
Definition box2.h:164
constexpr const Vec & GetOrigin() const
Definition box2.h:206
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:716
constexpr coord_type GetRight() const
Definition box2.h:213
constexpr bool Intersects(const BOX2< Vec > &aRect) const
Definition box2.h:307
constexpr coord_type GetBottom() const
Definition box2.h:218
EDA_ANGLE Normalize()
Definition eda_angle.h:229
bool IsZero() const
Definition eda_angle.h:136
The base class for create windows for drawing purpose.
const KIID m_Uuid
Definition eda_item.h:531
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:108
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition eda_item.h:416
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:37
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition eda_text.h:89
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition eda_text.cpp:165
virtual VECTOR2I GetTextSize() const
Definition eda_text.h:282
virtual VECTOR2I GetTextPos() const
Definition eda_text.h:294
virtual void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
Definition eda_text.cpp:532
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition eda_text.h:110
bool IsKeepUpright() const
Definition eda_text.h:227
virtual void SetTextPos(const VECTOR2I &aPoint)
Definition eda_text.cpp:576
virtual void SetTextX(int aX)
Definition eda_text.cpp:583
virtual int GetTextHeight() const
Definition eda_text.h:288
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition eda_text.cpp:208
KIFONT::FONT * GetFont() const
Definition eda_text.h:268
void SetMirrored(bool isMirrored)
Definition eda_text.cpp:388
virtual void SetTextY(int aY)
Definition eda_text.cpp:589
std::vector< std::unique_ptr< KIFONT::GLYPH > > * GetRenderCache(const KIFONT::FONT *aFont, const wxString &forResolvedText, const VECTOR2I &aOffset={ 0, 0 }) const
Definition eda_text.cpp:703
virtual VECTOR2I GetDrawPos() const
Definition eda_text.h:401
EDA_TEXT & operator=(const EDA_TEXT &aItem)
Definition eda_text.cpp:138
BOX2I GetTextBox(const RENDER_SETTINGS *aSettings, int aLine=-1) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition eda_text.cpp:773
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition eda_text.cpp:412
virtual void Offset(const VECTOR2I &aOffset)
Definition eda_text.cpp:595
virtual int GetTextWidth() const
Definition eda_text.h:285
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition eda_text.h:221
virtual KIFONT::FONT * GetDrawFont(const RENDER_SETTINGS *aSettings) const
Definition eda_text.cpp:667
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
Definition eda_text.h:129
EDA_TEXT(const EDA_IU_SCALE &aIuScale, const wxString &aText=wxEmptyString)
Definition eda_text.cpp:98
virtual void ClearBoundingBoxCache()
Definition eda_text.cpp:695
double Similarity(const EDA_TEXT &aOther) const
virtual void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition eda_text.cpp:279
virtual bool TextHitTest(const VECTOR2I &aPoint, int aAccuracy=0) const
Test if aPoint is within the bounds of this object.
Definition eda_text.cpp:902
virtual void ClearRenderCache()
Definition eda_text.cpp:689
const TEXT_ATTRIBUTES & GetAttributes() const
Definition eda_text.h:252
bool IsMirrored() const
Definition eda_text.h:211
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
Definition eda_text.cpp:461
std::shared_ptr< SHAPE_COMPOUND > GetEffectiveTextShape(bool aTriangulate=true, const BOX2I &aBBox=BOX2I(), const EDA_ANGLE &aAngle=ANGLE_0) const
build a list of segments (SHAPE_SEGMENT) to describe a text shape.
void SetKeepUpright(bool aKeepUpright)
Definition eda_text.cpp:420
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition eda_text.h:224
virtual wxString GetShownText(bool aAllowExtraText, int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition eda_text.h:121
virtual int GetTextThickness() const
Definition eda_text.h:149
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition eda_text.cpp:294
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
Definition eda_text.cpp:302
bool operator==(const EDA_TEXT &aRhs) const
Definition eda_text.h:419
void SetMultilineAllowed(bool aAllow)
Definition eda_text.cpp:396
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Definition eda_text.cpp:404
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the component.
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition footprint.h:417
wxString GetFieldValueForVariant(const wxString &aVariantName, const wxString &aFieldName) const
Get a field value for a specific variant.
const wxString & GetReference() const
Definition footprint.h:841
VECTOR2I GetPosition() const override
Definition footprint.h:403
void SetDialogSizeInDU(int aWidth, int aHeight)
Set the dialog size, using a "logical" value.
void AddHTML_Text(const wxString &message)
Add HTML text (without any change) to message list.
void ShowModeless()
Show a modeless version of the dialog (without an OK button).
Class that other classes need to inherit from, in order to be inspectable.
Definition inspectable.h:38
FONT is an abstract base class for both outline and stroke fonts.
Definition font.h:94
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttributes, const METRICS &aFontMetrics, std::optional< VECTOR2I > aMousePos=std::nullopt, wxString *aActiveUrl=nullptr) const
Draw a string.
Definition font.cpp:246
virtual void DrawGlyphs(const std::vector< std::unique_ptr< KIFONT::GLYPH > > &aGlyphs)
Draw polygons representing font glyphs.
Contains methods for drawing PCB-specific items.
virtual PCB_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
PCB specific render settings.
Definition pcb_painter.h:78
PCB_LAYER_ID GetPrimaryHighContrastLayer() const
Return the board layer which is in high-contrast mode.
static constexpr double LOD_HIDE
Return this constant from ViewGetLOD() to hide the item unconditionally.
Definition view_item.h:176
static constexpr double LOD_SHOW
Return this constant from ViewGetLOD() to show the item unconditionally.
Definition view_item.h:181
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:63
bool IsLayerVisibleCached(int aLayer) const
Definition view.h:437
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition view.h:225
Definition kiid.h:44
void CopyFrom(const BOARD_ITEM *aOther) override
Definition pcb_text.cpp:106
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 pcb_text.cpp:295
void StyleFromSettings(const BOARD_DESIGN_SETTINGS &settings, bool aCheckSide) override
Definition pcb_text.cpp:354
double Similarity(const BOARD_ITEM &aBoardItem) const override
Return a measure of how likely the other object is to represent the same object.
Definition pcb_text.cpp:862
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth=false) const override
Convert the item shape to a closed polygon.
Definition pcb_text.cpp:834
void SetTextThickness(int aWidth) override
The TextThickness is that set by the user.
Definition pcb_text.cpp:495
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition pcb_text.cpp:657
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition pcb_text.cpp:225
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition pcb_text.cpp:612
EDA_ANGLE GetTextAngle() const override
Definition pcb_text.cpp:543
virtual void swapData(BOARD_ITEM *aImage) override
Definition pcb_text.cpp:683
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 pcb_text.cpp:691
void KeepUpright()
Called when rotating the parent footprint.
Definition pcb_text.cpp:373
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
Definition pcb_text.cpp:197
void Offset(const VECTOR2I &aOffset) override
Definition pcb_text.cpp:508
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition pcb_text.cpp:113
const SHAPE_POLY_SET & GetKnockoutCache(const KIFONT::FONT *aFont, const wxString &forResolvedText, int aMaxError) const
Definition pcb_text.cpp:706
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition pcb_text.cpp:161
void SetLibTextThickness(int aWidth)
Definition pcb_text.cpp:537
void Mirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Mirror this object relative to a given horizontal axis the layer is not changed.
Definition pcb_text.cpp:576
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition pcb_text.cpp:240
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true) override
Definition pcb_text.cpp:467
virtual VECTOR2I GetPosition() const override
Definition pcb_text.h:93
void SetLibTextSize(const VECTOR2I &aSize)
Definition pcb_text.cpp:531
VECTOR2I GetTextPos() const override
Definition pcb_text.cpp:444
PCB_TEXT(BOARD_ITEM *parent, KICAD_T idtype=PCB_TEXT_T)
Definition pcb_text.cpp:49
std::unique_ptr< PCB_TEXT_KNOCKOUT_CACHE_DATA > m_knockout_cache
Definition pcb_text.h:234
bool operator==(const PCB_TEXT &aOther) const
Definition pcb_text.cpp:856
int getKnockoutMargin() const
Definition pcb_text.cpp:348
void OnFootprintRescaled(double aRatioX, double aRatioY, double aLinearFactor, const VECTOR2I &aAnchor, const EDA_ANGLE &aParentRotate) override
Apply a parent footprint scale to this item.
Definition pcb_text.cpp:597
void TransformTextToPolySet(SHAPE_POLY_SET &aBuffer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc) const
Function TransformTextToPolySet Convert the text to a polygonSet describing the actual character stro...
Definition pcb_text.cpp:769
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition pcb_text.cpp:394
virtual wxString GetTextTypeDescription() const
Definition pcb_text.cpp:651
std::vector< int > ViewGetLayers() const override
Definition pcb_text.cpp:231
void buildBoundingHull(SHAPE_POLY_SET *aBuffer, const SHAPE_POLY_SET &aRenderedText, int aClearance) const
Build a nominally rectangular bounding box for the rendered text.
Definition pcb_text.cpp:741
bool TextHitTest(const VECTOR2I &aPoint, int aAccuracy=0) const override
Test if aPoint is within the bounds of this object.
Definition pcb_text.cpp:409
virtual void SetPosition(const VECTOR2I &aPos) override
Definition pcb_text.h:95
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition pcb_text.cpp:677
int GetTextThickness() const override
Definition pcb_text.cpp:480
EDA_ANGLE m_libTextAngle
Definition pcb_text.h:236
void OnFootprintTransformed() override
Hook for items inside a footprint to refresh after the FP transform changes (translate,...
Definition pcb_text.cpp:604
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
Display a syntax help window for text variables and expressions.
Definition pcb_text.cpp:873
EDA_ANGLE GetDrawRotation() const override
Definition pcb_text.cpp:203
void SetTextAngle(const EDA_ANGLE &aAngle) override
Definition pcb_text.cpp:552
VECTOR2I GetTextSize() const override
Definition pcb_text.cpp:453
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition pcb_text.cpp:136
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition pcb_text.cpp:564
void SetLibTextPos(const VECTOR2I &aPos)
Definition pcb_text.cpp:525
PCB_TEXT & operator=(const PCB_TEXT &aOther)
Definition pcb_text.cpp:88
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition pcb_text.cpp:671
Provide class metadata.Helper macro to map type hashes to names.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
void Mask(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName)
Sets a base class property as masked in a derived class.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void OverrideAvailability(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName, std::function< bool(INSPECTABLE *)> aFunc)
Sets an override availability functor for a base class property of a given derived class.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
void Inflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError, bool aSimplify=false)
Perform outline inflation/deflation.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
void Simplify()
Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections)
int NewOutline()
Creates a new empty polygon in the set and returns its index.
void BooleanSubtract(const SHAPE_POLY_SET &b)
Perform boolean polyset difference.
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
double GetScaleX() const
double GetScaleY() const
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
A type-safe container of any type.
Definition ki_any.h:92
wxString ResolveTextVars(const wxString &aSource, const std::function< bool(wxString *)> *aResolver, int &aDepth)
Multi-pass text variable expansion and math expression evaluation.
Definition common.cpp:296
The common library.
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.
@ ROUND_ALL_CORNERS
All angles are rounded.
#define _(s)
static constexpr EDA_ANGLE ANGLE_0
Definition eda_angle.h:411
static constexpr EDA_ANGLE ANGLE_90
Definition eda_angle.h:413
static constexpr EDA_ANGLE ANGLE_VERTICAL
Definition eda_angle.h:408
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
Definition eda_angle.h:407
static constexpr EDA_ANGLE ANGLE_180
Definition eda_angle.h:415
#define PCB_EDIT_FRAME_NAME
static FILENAME_RESOLVER * resolver
a few functions useful in geometry calculations.
int GetKnockoutTextMargin(const VECTOR2I &aSize, int aThickness)
Return the margin for knocking out text.
Definition gr_text.h:91
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Definition layer_id.cpp:173
bool IsFrontLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a front layer.
Definition layer_ids.h:778
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition layer_ids.h:180
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
Definition layer_ids.h:801
@ LAYER_LOCKED_ITEM_SHADOW
Shadow layer for locked items.
Definition layer_ids.h:303
@ LAYER_FOOTPRINTS_FR
Show footprints on front.
Definition layer_ids.h:255
@ LAYER_FP_REFERENCES
Show footprints references (when texts are visible).
Definition layer_ids.h:262
@ LAYER_FP_TEXT
Definition layer_ids.h:236
@ LAYER_FOOTPRINTS_BK
Show footprints on back.
Definition layer_ids.h:256
@ LAYER_FP_VALUES
Show footprints values (when texts are visible).
Definition layer_ids.h:259
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
@ F_SilkS
Definition layer_ids.h:96
@ B_SilkS
Definition layer_ids.h:97
constexpr T MIRRORVAL(T aPoint, T aMirrorRef)
Returns the mirror of aPoint relative to the aMirrorRef.
Definition mirror.h:32
FLIP_DIRECTION
Definition mirror.h:23
@ LEFT_RIGHT
Flip left to right (around the Y axis)
Definition mirror.h:24
@ TOP_BOTTOM
Flip top to bottom (around the X axis)
Definition mirror.h:25
bool BoxHitTest(const VECTOR2I &aHitPoint, const BOX2I &aHittee, int aAccuracy)
Perform a point-to-box hit test.
KICOMMON_API wxString EllipsizeMenuText(const wxString &aString)
Ellipsize text (at the end) to be no more than 36 characters.
KICOMMON_API wxString EllipsizeStatusText(wxWindow *aWindow, const wxString &aString)
Ellipsize text (at the end) to be no more than 1/3 of the window width.
KICOMMON_API VECTOR2I UnpackVector2(const types::Vector2 &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void PackVector2(types::Vector2 &aOutput, const VECTOR2I &aInput, const EDA_IU_SCALE &aScale)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition eda_angle.h:400
#define _HKI(x)
Definition page_info.cpp:40
static struct PCB_TEXT_DESC _PCB_TEXT_DESC
#define TYPE_HASH(x)
Definition property.h:74
#define REGISTER_TYPE(x)
wxString UnescapeString(const wxString &aSource)
void ConvertMarkdown2Html(const wxString &aMarkdownInput, wxString &aHtmlOutput)
const int accuracy
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
Definition trigo.cpp:225
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition typeinfo.h:71
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition typeinfo.h:85
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683