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();
97
98 return *this;
99}
100
101
105
106
107void PCB_TEXT::CopyFrom( const BOARD_ITEM* aOther )
108{
109 wxCHECK( aOther && aOther->Type() == PCB_TEXT_T, /* void */ );
110 *this = *static_cast<const PCB_TEXT*>( aOther );
111}
112
113
114void PCB_TEXT::Serialize( google::protobuf::Any& aContainer ) const
115{
116 using namespace kiapi::common;
117 kiapi::board::types::BoardText boardText;
118
119 boardText.mutable_id()->set_value( m_Uuid.AsStdString() );
121 boardText.set_knockout( IsKnockout() );
122 boardText.set_locked( IsLocked() ? types::LockedState::LS_LOCKED : types::LockedState::LS_UNLOCKED );
123
124 google::protobuf::Any any;
126 any.UnpackTo( boardText.mutable_text() );
127
128 // Some of the common Text message fields are not stored in EDA_TEXT
129 types::Text* text = boardText.mutable_text();
130
131 PackVector2( *text->mutable_position(), GetPosition() );
132
133 aContainer.PackFrom( boardText );
134}
135
136
137bool PCB_TEXT::Deserialize( const google::protobuf::Any& aContainer )
138{
139 using namespace kiapi::common;
140 kiapi::board::types::BoardText boardText;
141
142 if( !aContainer.UnpackTo( &boardText ) )
143 return false;
144
146 SetUuidDirect( KIID( boardText.id().value() ) );
147 SetIsKnockout( boardText.knockout() );
148 SetLocked( boardText.locked() == types::LockedState::LS_LOCKED );
149
150 google::protobuf::Any any;
151 any.PackFrom( boardText.text() );
153
154 const types::Text& text = boardText.text();
155
156 SetPosition( UnpackVector2( text.position() ) );
157
158 return true;
159}
160
161
162wxString PCB_TEXT::GetShownText( bool aAllowExtraText, int aDepth ) const
163{
164 const FOOTPRINT* parentFootprint = GetParentFootprint();
165 const BOARD* board = GetBoard();
166
167 std::function<bool( wxString* )> resolver = [&]( wxString* token ) -> bool
168 {
169 if( token->IsSameAs( wxT( "LAYER" ) ) )
170 {
171 *token = GetLayerName();
172 return true;
173 }
174
175 if( parentFootprint && parentFootprint->ResolveTextVar( token, aDepth + 1 ) )
176 return true;
177
178 // board can be null in some cases when saving a footprint in FP editor
179 if( board && board->ResolveTextVar( token, aDepth + 1 ) )
180 return true;
181
182 return false;
183 };
184
185 wxString text = EDA_TEXT::GetShownText( aAllowExtraText, aDepth );
186
187 if( HasTextVars() )
188 text = ResolveTextVars( text, &resolver, aDepth );
189
190 // Convert escape markers back to literal ${} and @{} for final display
191 text.Replace( wxT( "<<<ESC_DOLLAR:" ), wxT( "${" ) );
192 text.Replace( wxT( "<<<ESC_AT:" ), wxT( "@{" ) );
193
194 return text;
195}
196
197
198bool PCB_TEXT::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const
199{
200 return BOARD_ITEM::Matches( UnescapeString( GetText() ), aSearchData );
201}
202
203
205{
206 EDA_ANGLE rotation = GetTextAngle();
207
209 {
210 // Keep angle between ]-90..90] deg. Otherwise the text is not easy to read
211 while( rotation > ANGLE_90 )
212 rotation -= ANGLE_180;
213
214 while( rotation <= -ANGLE_90 )
215 rotation += ANGLE_180;
216 }
217 else
218 {
219 rotation.Normalize();
220 }
221
222 return rotation;
223}
224
225
227{
228 return GetBoundingBox();
229}
230
231
232std::vector<int> PCB_TEXT::ViewGetLayers() const
233{
236
237 return { GetLayer() };
238}
239
240
241double PCB_TEXT::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
242{
243 if( !aView )
244 return LOD_SHOW;
245
246 KIGFX::PCB_PAINTER& painter = static_cast<KIGFX::PCB_PAINTER&>( *aView->GetPainter() );
247 KIGFX::PCB_RENDER_SETTINGS& renderSettings = *painter.GetSettings();
248
249 if( !aView->IsLayerVisibleCached( GetLayer() ) )
250 return LOD_HIDE;
251
252 if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
253 {
254 // Hide shadow on dimmed tracks
255 if( renderSettings.GetHighContrast() )
256 {
257 if( m_layer != renderSettings.GetPrimaryHighContrastLayer() )
258 return LOD_HIDE;
259 }
260 }
261
262 if( FOOTPRINT* parentFP = GetParentFootprint() )
263 {
264 // Handle Render tab switches
265 if( GetText() == wxT( "${VALUE}" ) )
266 {
268 return LOD_HIDE;
269 }
270
271 if( GetText() == wxT( "${REFERENCE}" ) )
272 {
274 return LOD_HIDE;
275 }
276
277 PCB_LAYER_ID checkLayer = GetLayer();
278
279 if( !IsFrontLayer( checkLayer ) && !IsBackLayer( checkLayer ) )
280 checkLayer = parentFP->GetLayer();
281
282 if( IsFrontLayer( checkLayer ) && !aView->IsLayerVisibleCached( LAYER_FOOTPRINTS_FR ) )
283 return LOD_HIDE;
284
285 if( IsBackLayer( checkLayer ) && !aView->IsLayerVisibleCached( LAYER_FOOTPRINTS_BK ) )
286 return LOD_HIDE;
287
288 if( !aView->IsLayerVisibleCached( LAYER_FP_TEXT ) )
289 return LOD_HIDE;
290 }
291
292 return LOD_SHOW;
293}
294
295
296void PCB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
297{
298 FOOTPRINT* parentFP = GetParentFootprint();
299
300 if( parentFP && aFrame->GetName() == PCB_EDIT_FRAME_NAME )
301 aList.emplace_back( _( "Footprint" ), parentFP->GetReference() );
302
303 // Don't use GetShownText() here; we want to show the user the variable references
304 wxString value = GetText();
305
306 if( parentFP )
307 {
308 if( PCB_FIELD* field = dynamic_cast<PCB_FIELD*>( this ) )
309 {
310 wxString variant;
311
312 if( BOARD* board = parentFP->GetBoard() )
313 variant = board->GetCurrentVariant();
314
315 value = parentFP->GetFieldValueForVariant( variant, field->GetName() );
316 }
317
318 aList.emplace_back( _( "Text" ), KIUI::EllipsizeStatusText( aFrame, value ) );
319 }
320 else
321 {
322 aList.emplace_back( _( "PCB Text" ), KIUI::EllipsizeStatusText( aFrame, value ) );
323 }
324
325 if( parentFP )
326 aList.emplace_back( _( "Type" ), GetTextTypeDescription() );
327
328 if( aFrame->GetName() == PCB_EDIT_FRAME_NAME && IsLocked() )
329 aList.emplace_back( _( "Status" ), _( "Locked" ) );
330
331 aList.emplace_back( _( "Layer" ), GetLayerName() );
332
333 aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
334
335 aList.emplace_back( _( "Angle" ), wxString::Format( wxT( "%g" ), GetTextAngle().AsDegrees() ) );
336
337 aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
338
339 if( GetTextThickness() )
340 aList.emplace_back( _( "Text Thickness" ), aFrame->MessageTextFromValue( GetEffectiveTextPenWidth() ) );
341 else
342 aList.emplace_back( _( "Text Thickness" ), _( "Auto" ) );
343
344 aList.emplace_back( _( "Width" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
345 aList.emplace_back( _( "Height" ), aFrame->MessageTextFromValue( GetTextHeight() ) );
346}
347
348
353
354
355void PCB_TEXT::StyleFromSettings( const BOARD_DESIGN_SETTINGS& settings, bool aCheckSide )
356{
357 SetTextSize( settings.GetTextSize( GetLayer() ) );
359 SetItalic( settings.GetTextItalic( GetLayer() ) );
360
361 if( GetParentFootprint() )
362 SetKeepUpright( settings.GetTextUpright( GetLayer() ) );
363
364 if( aCheckSide )
365 {
366 if( BOARD* board = GetBoard() )
367 SetMirrored( board->IsBackLayer( GetLayer() ) );
368 else
370 }
371}
372
373
375{
376 if( !IsKeepUpright() )
377 return;
378
379 EDA_ANGLE newAngle = GetTextAngle();
380 newAngle.Normalize();
381
382 bool needsFlipped = newAngle >= ANGLE_180;
383
384 if( needsFlipped )
385 {
387 SetVertJustify( static_cast<GR_TEXT_V_ALIGN_T>( -GetVertJustify() ) );
388 newAngle += ANGLE_180;
389 newAngle.Normalize();
390 SetTextAngle( newAngle );
391 }
392}
393
394
396{
397 EDA_ANGLE angle = GetDrawRotation();
398 BOX2I rect = GetTextBox( nullptr );
399
400 if( IsKnockout() )
401 rect.Inflate( getKnockoutMargin() );
402
403 if( !angle.IsZero() )
404 rect = rect.GetBoundingBoxRotated( GetTextPos(), angle );
405
406 return rect;
407}
408
409
410bool PCB_TEXT::TextHitTest( const VECTOR2I& aPoint, int aAccuracy ) const
411{
412 int accuracy = aAccuracy;
413
414 if( IsKnockout() )
416
417 return EDA_TEXT::TextHitTest( aPoint, accuracy );
418}
419
420
421bool PCB_TEXT::TextHitTest( const BOX2I& aRect, bool aContains, int aAccuracy ) const
422{
423 BOX2I rect = aRect;
424
425 rect.Inflate( aAccuracy );
426
427 if( aContains )
428 return rect.Contains( GetBoundingBox() );
429
430 return rect.Intersects( GetBoundingBox() );
431}
432
433
434bool PCB_TEXT::TextHitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const
435{
436 BOX2I rect = GetTextBox( nullptr );
437
438 if( IsKnockout() )
439 rect.Inflate( getKnockoutMargin() );
440
441 return KIGEOM::BoxHitTest( aPoly, rect, GetDrawRotation(), GetDrawPos(), aContained );
442}
443
444
446{
447 if( const FOOTPRINT* fp = GetParentFootprint() )
448 return fp->GetTransform().Apply( EDA_TEXT::GetTextPos() );
449
450 return EDA_TEXT::GetTextPos();
451}
452
453
455{
457
458 if( const FOOTPRINT* fp = GetParentFootprint() )
459 {
460 const TRANSFORM_TRS& xf = fp->GetTransform();
461 return { KiROUND( libSize.x * std::abs( xf.GetScaleX() ) ), KiROUND( libSize.y * std::abs( xf.GetScaleY() ) ) };
462 }
463
464 return libSize;
465}
466
467
468void PCB_TEXT::SetTextSize( VECTOR2I aNewSize, bool aEnforceMinTextSize )
469{
470 if( const FOOTPRINT* fp = GetParentFootprint() )
471 {
472 const TRANSFORM_TRS& xf = fp->GetTransform();
473 aNewSize = { KiROUND( aNewSize.x / std::abs( xf.GetScaleX() ) ),
474 KiROUND( aNewSize.y / std::abs( xf.GetScaleY() ) ) };
475 }
476
477 EDA_TEXT::SetTextSize( aNewSize, aEnforceMinTextSize );
478}
479
480
482{
483 int libThickness = EDA_TEXT::GetTextThickness();
484
485 if( const FOOTPRINT* fp = GetParentFootprint() )
486 {
487 const TRANSFORM_TRS& xf = fp->GetTransform();
488 const double factor = ( std::abs( xf.GetScaleX() ) + std::abs( xf.GetScaleY() ) ) * 0.5;
489 return KiROUND( libThickness * factor );
490 }
491
492 return libThickness;
493}
494
495
497{
498 if( const FOOTPRINT* fp = GetParentFootprint() )
499 {
500 const TRANSFORM_TRS& xf = fp->GetTransform();
501 const double factor = ( std::abs( xf.GetScaleX() ) + std::abs( xf.GetScaleY() ) ) * 0.5;
502 aWidth = KiROUND( aWidth / factor );
503 }
504
506}
507
508
509void PCB_TEXT::Offset( const VECTOR2I& aOffset )
510{
511 if( const FOOTPRINT* fp = GetParentFootprint() )
512 {
513 VECTOR2I curBoardPos = fp->GetTransform().Apply( EDA_TEXT::GetTextPos() );
514 VECTOR2I newLibPos = fp->GetTransform().InverseApply( curBoardPos + aOffset );
515 VECTOR2I libDelta = newLibPos - EDA_TEXT::GetTextPos();
517 EDA_TEXT::Offset( libDelta );
518 }
519 else
520 {
521 EDA_TEXT::Offset( aOffset );
522 }
523}
524
525
527{
529}
530
531
533{
534 EDA_TEXT::SetTextSize( aSize );
535}
536
537
539{
541}
542
543
545{
546 if( const FOOTPRINT* fp = GetParentFootprint() )
547 return m_libTextAngle + fp->GetOrientation();
548
549 return m_libTextAngle;
550}
551
552
554{
555 if( const FOOTPRINT* fp = GetParentFootprint() )
556 m_libTextAngle = aAngle - fp->GetOrientation();
557 else
558 m_libTextAngle = aAngle;
559
560 m_libTextAngle.Normalize();
561 EDA_TEXT::SetTextAngle( aAngle );
562}
563
564
565void PCB_TEXT::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
566{
567 VECTOR2I pt = GetTextPos();
568 RotatePoint( pt, aRotCentre, aAngle );
569 SetTextPos( pt );
570
571 EDA_ANGLE new_angle = GetTextAngle() + aAngle;
572 new_angle.Normalize();
573 SetTextAngle( new_angle );
574}
575
576
577void PCB_TEXT::Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection )
578{
579 // the position and justification are mirrored, but not the text itself
580
581 if( aFlipDirection == FLIP_DIRECTION::TOP_BOTTOM )
582 {
585
586 SetTextY( MIRRORVAL( GetTextPos().y, aCentre.y ) );
587 }
588 else
589 {
592
593 SetTextX( MIRRORVAL( GetTextPos().x, aCentre.x ) );
594 }
595}
596
597
598void PCB_TEXT::OnFootprintRescaled( double /* aRatioX */, double /* aRatioY */, double /* aLinearFactor */,
599 const VECTOR2I& /* aAnchor */, const EDA_ANGLE& /* aParentRotate */ )
600{
602}
603
604
611
612
613void PCB_TEXT::Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection )
614{
615 if( const FOOTPRINT* fp = GetParentFootprint() )
616 {
617 // Mirror the library-frame position (rotation-independent).
618 const VECTOR2I libAxis = fp->GetTransform().InverseApply( aCentre );
620
621 if( aFlipDirection == FLIP_DIRECTION::LEFT_RIGHT )
622 libPos.x = 2 * libAxis.x - libPos.x;
623 else
624 libPos.y = 2 * libAxis.y - libPos.y;
625
626 SetLibTextPos( libPos );
627 }
628 else if( aFlipDirection == FLIP_DIRECTION::LEFT_RIGHT )
629 {
630 SetTextX( MIRRORVAL( GetTextPos().x, aCentre.x ) );
631 }
632 else
633 {
634 SetTextY( MIRRORVAL( GetTextPos().y, aCentre.y ) );
635 }
636
637 if( aFlipDirection == FLIP_DIRECTION::LEFT_RIGHT )
639 else
641
642 m_libTextAngle.Normalize();
644
646
647 if( IsSideSpecific() )
649}
650
651
653{
654 return _( "Text" );
655}
656
657
658wxString PCB_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
659{
660 wxString content = aFull ? GetShownText( false ) : KIUI::EllipsizeMenuText( GetText() );
661
662 if( FOOTPRINT* parentFP = GetParentFootprint() )
663 {
664 wxString ref = parentFP->GetReference();
665 return wxString::Format( _( "Footprint text of %s (%s)" ), ref, content );
666 }
667
668 return wxString::Format( _( "PCB text '%s' on %s" ), content, GetLayerName() );
669}
670
671
673{
674 return BITMAPS::text;
675}
676
677
679{
680 return new PCB_TEXT( *this );
681}
682
683
685{
686 wxASSERT( aImage->Type() == PCB_TEXT_T );
687
688 std::swap( *( (PCB_TEXT*) this ), *( (PCB_TEXT*) aImage ) );
689}
690
691
692std::shared_ptr<SHAPE> PCB_TEXT::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
693{
694 if( IsKnockout() )
695 {
696 SHAPE_POLY_SET poly;
697
699
700 return std::make_shared<SHAPE_POLY_SET>( std::move( poly ) );
701 }
702
703 return GetEffectiveTextShape();
704}
705
706
707const SHAPE_POLY_SET& PCB_TEXT::GetKnockoutCache( const KIFONT::FONT* aFont, const wxString& forResolvedText,
708 int aMaxError ) const
709{
711 attrs.m_Size = GetTextSize();
712 EDA_ANGLE drawAngle = GetDrawRotation();
713 VECTOR2I drawPos = GetDrawPos();
714
715 if( !m_knockout_cache )
716 m_knockout_cache = std::make_unique<PCB_TEXT_KNOCKOUT_CACHE_DATA>();
717
718 if( m_knockout_cache->cache.IsEmpty() || m_knockout_cache->text_attrs != attrs
719 || m_knockout_cache->text != forResolvedText
720 || m_knockout_cache->angle != drawAngle )
721 {
722 m_knockout_cache->cache.RemoveAllContours();
723
725 m_knockout_cache->cache.Fracture();
726
727 m_knockout_cache->text_attrs = attrs;
728 m_knockout_cache->angle = drawAngle;
729 m_knockout_cache->text = forResolvedText;
730 m_knockout_cache->pos = drawPos;
731 }
732 else if( m_knockout_cache->pos != drawPos )
733 {
734 m_knockout_cache->cache.Move( drawPos - m_knockout_cache->pos );
735 m_knockout_cache->pos = drawPos;
736 }
737
738 return m_knockout_cache->cache;
739}
740
741
742void PCB_TEXT::buildBoundingHull( SHAPE_POLY_SET* aBuffer, const SHAPE_POLY_SET& aRenderedText, int aClearance ) const
743{
744 SHAPE_POLY_SET poly( aRenderedText );
745
746 poly.Rotate( -GetDrawRotation(), GetDrawPos() );
747
748 BOX2I rect = poly.BBox( aClearance );
749 VECTOR2I corners[4];
750
751 corners[0].x = rect.GetOrigin().x;
752 corners[0].y = rect.GetOrigin().y;
753 corners[1].y = corners[0].y;
754 corners[1].x = rect.GetRight();
755 corners[2].x = corners[1].x;
756 corners[2].y = rect.GetBottom();
757 corners[3].y = corners[2].y;
758 corners[3].x = corners[0].x;
759
760 aBuffer->NewOutline();
761
762 for( VECTOR2I& corner : corners )
763 {
764 RotatePoint( corner, GetDrawPos(), GetDrawRotation() );
765 aBuffer->Append( corner.x, corner.y );
766 }
767}
768
769
770void PCB_TEXT::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, int aClearance, int aMaxError,
771 ERROR_LOC aErrorLoc ) const
772{
774 KIFONT::FONT* font = GetDrawFont( nullptr );
775 int penWidth = GetEffectiveTextPenWidth();
777 wxString shownText = GetShownText( true );
778
779 attrs.m_Angle = GetDrawRotation();
780 attrs.m_Size = GetTextSize();
781
782 // The polygonal shape of a text can have many basic shapes, so combining these shapes can
783 // be very useful to create a final shape with a lot less vertices to speedup calculations.
784 // Simplify shapes is not usually always efficient, but in this case it is.
785 SHAPE_POLY_SET textShape;
786
787 CALLBACK_GAL callback_gal(
788 empty_opts,
789 // Stroke callback
790 [&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
791 {
792 TransformOvalToPolygon( textShape, aPt1, aPt2, penWidth, aMaxError, aErrorLoc );
793 },
794 // Triangulation callback
795 [&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
796 {
797 textShape.NewOutline();
798
799 for( const VECTOR2I& point : { aPt1, aPt2, aPt3 } )
800 textShape.Append( point.x, point.y );
801 } );
802
803 if( auto* cache = GetRenderCache( font, shownText ) )
804 callback_gal.DrawGlyphs( *cache );
805 else
806 font->Draw( &callback_gal, shownText, GetTextPos(), attrs, GetFontMetrics() );
807
808 textShape.Simplify();
809
810 if( IsKnockout() )
811 {
812 SHAPE_POLY_SET finalPoly;
813 int margin = GetKnockoutTextMargin( attrs.m_Size, penWidth );
814
815 buildBoundingHull( &finalPoly, textShape, margin + aClearance );
816 finalPoly.BooleanSubtract( textShape );
817
818 aBuffer.Append( finalPoly );
819 }
820 else
821 {
822 if( aClearance > 0 || aErrorLoc == ERROR_OUTSIDE )
823 {
824 if( aErrorLoc == ERROR_OUTSIDE )
825 aClearance += aMaxError;
826
827 textShape.Inflate( aClearance, CORNER_STRATEGY::ROUND_ALL_CORNERS, aMaxError );
828 }
829
830 aBuffer.Append( textShape );
831 }
832}
833
834
835void PCB_TEXT::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError,
836 ERROR_LOC aErrorLoc, bool aIgnoreLineWidth ) const
837{
838 SHAPE_POLY_SET poly;
839
840 TransformTextToPolySet( poly, 0, aMaxError, aErrorLoc );
841
842 buildBoundingHull( &aBuffer, poly, aClearance );
843}
844
845
846bool PCB_TEXT::operator==( const BOARD_ITEM& aBoardItem ) const
847{
848 if( aBoardItem.Type() != Type() )
849 return false;
850
851 const PCB_TEXT& other = static_cast<const PCB_TEXT&>( aBoardItem );
852
853 return *this == other;
854}
855
856
857bool PCB_TEXT::operator==( const PCB_TEXT& aOther ) const
858{
859 return EDA_TEXT::operator==( aOther );
860}
861
862
863double PCB_TEXT::Similarity( const BOARD_ITEM& aOther ) const
864{
865 if( aOther.Type() != Type() )
866 return 0.0;
867
868 const PCB_TEXT& other = static_cast<const PCB_TEXT&>( aOther );
869
870 return EDA_TEXT::Similarity( other );
871}
872
873
875{
876 wxString msg =
877#include "pcb_text_help_md.h"
878 ;
879
880 HTML_MESSAGE_BOX* dlg = new HTML_MESSAGE_BOX( aParentWindow, _( "Syntax Help" ) );
881 wxSize sz( 320, 320 );
882
883 dlg->SetMinSize( dlg->ConvertDialogToPixels( sz ) );
884 dlg->SetDialogSizeInDU( sz.x, sz.y );
885
886 wxString html_txt;
887 ConvertMarkdown2Html( wxGetTranslation( msg ), html_txt );
888 dlg->AddHTML_Text( html_txt );
889 dlg->ShowModeless();
890
891 return dlg;
892}
893
894
895static struct PCB_TEXT_DESC
896{
898 {
905
906 propMgr.Mask( TYPE_HASH( PCB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Color" ) );
907
910 _HKI( "Text Properties" ) );
911
914 _HKI( "Text Properties" ) );
915
916 auto isFootprintText = []( INSPECTABLE* aItem ) -> bool
917 {
918 if( PCB_TEXT* text = dynamic_cast<PCB_TEXT*>( aItem ) )
919 return text->GetParentFootprint();
920
921 return false;
922 };
923
924 propMgr.OverrideAvailability( TYPE_HASH( PCB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Keep Upright" ),
925 isFootprintText );
926
927 propMgr.Mask( TYPE_HASH( PCB_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Hyperlink" ) );
928 }
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:83
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:85
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition board_item.h:295
friend class BOARD
Definition board_item.h:548
void SetUuidDirect(const KIID &aUuid)
Raw UUID assignment.
void SetLocked(bool aLocked) override
Definition board_item.h:386
PCB_LAYER_ID m_layer
Definition board_item.h:540
virtual bool IsKnockout() const
Definition board_item.h:382
bool IsLocked() const override
virtual void SetIsKnockout(bool aKnockout)
Definition board_item.h:383
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition board_item.h:343
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:102
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:420
wxString GetFieldValueForVariant(const wxString &aVariantName, const wxString &aFieldName) const
Get a field value for a specific variant.
const wxString & GetReference() const
Definition footprint.h:857
VECTOR2I GetPosition() const override
Definition footprint.h:406
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:80
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:46
void CopyFrom(const BOARD_ITEM *aOther) override
Definition pcb_text.cpp:107
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:296
void StyleFromSettings(const BOARD_DESIGN_SETTINGS &settings, bool aCheckSide) override
Definition pcb_text.cpp:355
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:863
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:835
void SetTextThickness(int aWidth) override
The TextThickness is that set by the user.
Definition pcb_text.cpp:496
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition pcb_text.cpp:658
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition pcb_text.cpp:226
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition pcb_text.cpp:613
EDA_ANGLE GetTextAngle() const override
Definition pcb_text.cpp:544
virtual void swapData(BOARD_ITEM *aImage) override
Definition pcb_text.cpp:684
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:692
void KeepUpright()
Called when rotating the parent footprint.
Definition pcb_text.cpp:374
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
Definition pcb_text.cpp:198
void Offset(const VECTOR2I &aOffset) override
Definition pcb_text.cpp:509
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition pcb_text.cpp:114
const SHAPE_POLY_SET & GetKnockoutCache(const KIFONT::FONT *aFont, const wxString &forResolvedText, int aMaxError) const
Definition pcb_text.cpp:707
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition pcb_text.cpp:162
void SetLibTextThickness(int aWidth)
Definition pcb_text.cpp:538
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:577
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition pcb_text.cpp:241
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true) override
Definition pcb_text.cpp:468
virtual VECTOR2I GetPosition() const override
Definition pcb_text.h:93
void SetLibTextSize(const VECTOR2I &aSize)
Definition pcb_text.cpp:532
VECTOR2I GetTextPos() const override
Definition pcb_text.cpp:445
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:857
int getKnockoutMargin() const
Definition pcb_text.cpp:349
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:598
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:770
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition pcb_text.cpp:395
virtual wxString GetTextTypeDescription() const
Definition pcb_text.cpp:652
std::vector< int > ViewGetLayers() const override
Definition pcb_text.cpp:232
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:742
bool TextHitTest(const VECTOR2I &aPoint, int aAccuracy=0) const override
Test if aPoint is within the bounds of this object.
Definition pcb_text.cpp:410
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:678
int GetTextThickness() const override
Definition pcb_text.cpp:481
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:605
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
Display a syntax help window for text variables and expressions.
Definition pcb_text.cpp:874
EDA_ANGLE GetDrawRotation() const override
Definition pcb_text.cpp:204
void SetTextAngle(const EDA_ANGLE &aAngle) override
Definition pcb_text.cpp:553
VECTOR2I GetTextSize() const override
Definition pcb_text.cpp:454
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition pcb_text.cpp:137
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition pcb_text.cpp:565
void SetLibTextPos(const VECTOR2I &aPos)
Definition pcb_text.cpp:526
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:672
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:310
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:177
bool IsFrontLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a front layer.
Definition layer_ids.h:786
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:809
@ 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