KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_pin.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) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2015 Wayne Stambaugh <[email protected]>
6 * Copyright (C) 2018 CERN
7 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
8 * @author Jon Evans <[email protected]>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, you may find one here:
22 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
23 * or you may search the http://www.gnu.org website for the version 2 license,
24 * or you may write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26 */
27
28#include "sch_pin.h"
29
30#include <base_units.h>
31#include <pgm_base.h>
32#include <pin_layout_cache.h>
33#include <plotters/plotter.h>
34#include <sch_draw_panel.h>
35#include <sch_edit_frame.h>
36#include <symbol_edit_frame.h>
39#include <trace_helpers.h>
40#include <trigo.h>
41#include <string_utils.h>
42
43wxString FormatStackedPinForDisplay( const wxString& aPinNumber, int aPinLength, int aTextSize, KIFONT::FONT* aFont,
44 const KIFONT::METRICS& aFontMetrics )
45{
46 // Check if this is stacked pin notation: [A,B,C]
47 if( !aPinNumber.StartsWith( "[" ) || !aPinNumber.EndsWith( "]" ) )
48 return aPinNumber;
49
50 const int minPinTextWidth = schIUScale.MilsToIU( 50 );
51 const int maxPinTextWidth = std::max( aPinLength, minPinTextWidth );
52
53 VECTOR2D fontSize( aTextSize, aTextSize );
54 int penWidth = GetPenSizeForNormal( aTextSize );
55 VECTOR2I textExtents = aFont->StringBoundaryLimits( aPinNumber, fontSize, penWidth, false, false, aFontMetrics );
56
57 if( textExtents.x <= maxPinTextWidth )
58 return aPinNumber; // Fits already
59
60 // Strip brackets and split by comma
61 wxString inner = aPinNumber.Mid( 1, aPinNumber.Length() - 2 );
62 wxArrayString parts;
63 wxStringSplit( inner, parts, ',' );
64
65 if( parts.empty() )
66 return aPinNumber; // malformed; fallback
67
68 // Build multi-line representation inside braces, each line trimmed
69 wxString result = "[";
70
71 for( size_t i = 0; i < parts.size(); ++i )
72 {
73 wxString line = parts[i];
74 line.Trim( true ).Trim( false );
75
76 if( i > 0 )
77 result += "\n";
78
79 result += line;
80 }
81
82 result += "]";
83 return result;
84}
85
86
87// small margin in internal units between the pin text and the pin line
88#define PIN_TEXT_MARGIN 4
89
93static int internalPinDecoSize( const RENDER_SETTINGS* aSettings, const SCH_PIN &aPin )
94{
95 const SCH_RENDER_SETTINGS* settings = static_cast<const SCH_RENDER_SETTINGS*>( aSettings );
96
97 if( settings && settings->m_PinSymbolSize )
98 return settings->m_PinSymbolSize;
99
100 return aPin.GetNameTextSize() != 0 ? aPin.GetNameTextSize() / 2 : aPin.GetNumberTextSize() / 2;
101}
102
103
107static int externalPinDecoSize( const RENDER_SETTINGS* aSettings, const SCH_PIN &aPin )
108{
109 const SCH_RENDER_SETTINGS* settings = static_cast<const SCH_RENDER_SETTINGS*>( aSettings );
110
111 if( settings && settings->m_PinSymbolSize )
112 return settings->m_PinSymbolSize;
113
114 return aPin.GetNumberTextSize() / 2;
115}
116
117
118SCH_PIN::SCH_PIN( LIB_SYMBOL* aParentSymbol ) :
119 SCH_ITEM( aParentSymbol, SCH_PIN_T, 0, 0 ),
120 m_libPin( nullptr ),
121 m_position( { 0, 0 } ),
122 m_length( schIUScale.MilsToIU( DEFAULT_PIN_LENGTH ) ),
123 m_orientation( PIN_ORIENTATION::PIN_RIGHT ),
124 m_shape( GRAPHIC_PINSHAPE::LINE ),
126 m_hidden( false ),
127 m_numTextSize( schIUScale.MilsToIU( DEFAULT_PINNUM_SIZE ) ),
128 m_nameTextSize( schIUScale.MilsToIU( DEFAULT_PINNAME_SIZE ) ),
129 m_isDangling( true ),
130 m_layoutCache( std::make_unique<PIN_LAYOUT_CACHE>( *this ) )
131{
133 {
134 m_length = schIUScale.MilsToIU( cfg->m_Defaults.pin_length );
135 m_numTextSize = schIUScale.MilsToIU( cfg->m_Defaults.pin_num_size );
136 m_nameTextSize = schIUScale.MilsToIU( cfg->m_Defaults.pin_name_size );
137 }
138
139 m_layer = LAYER_DEVICE;
140}
141
142
143SCH_PIN::SCH_PIN( LIB_SYMBOL* aParentSymbol, const wxString& aName, const wxString& aNumber,
144 PIN_ORIENTATION aOrientation, ELECTRICAL_PINTYPE aPinType, int aLength,
145 int aNameTextSize, int aNumTextSize, int aBodyStyle, const VECTOR2I& aPos,
146 int aUnit ) :
147 SCH_ITEM( aParentSymbol, SCH_PIN_T, aUnit, aBodyStyle ),
148 m_libPin( nullptr ),
149 m_position( aPos ),
150 m_length( aLength ),
151 m_orientation( aOrientation ),
153 m_type( aPinType ),
154 m_hidden( false ),
155 m_numTextSize( aNumTextSize ),
156 m_nameTextSize( aNameTextSize ),
157 m_isDangling( true ),
158 m_layoutCache( std::make_unique<PIN_LAYOUT_CACHE>( *this ) )
159{
160 SetName( aName );
161 SetNumber( aNumber );
162
164}
165
166
167SCH_PIN::SCH_PIN( SCH_SYMBOL* aParentSymbol, SCH_PIN* aLibPin ) :
168 SCH_ITEM( aParentSymbol, SCH_PIN_T, 0, 0 ),
169 m_libPin( aLibPin ),
173 m_isDangling( true ),
174 m_layoutCache( std::make_unique<PIN_LAYOUT_CACHE>( *this ) )
175{
176 wxASSERT( aParentSymbol );
177
178 SetName( m_libPin->GetName() );
179 SetNumber( m_libPin->GetNumber() );
180 m_position = m_libPin->GetPosition();
181
183}
184
185
186SCH_PIN::SCH_PIN( SCH_SYMBOL* aParentSymbol, const wxString& aNumber, const wxString& aAlt,
187 const KIID& aUuid ) :
188 SCH_ITEM( aParentSymbol, SCH_PIN_T ),
189 m_libPin( nullptr ),
193 m_number( aNumber ),
194 m_alt( aAlt ),
195 m_isDangling( true ),
196 m_layoutCache( std::make_unique<PIN_LAYOUT_CACHE>( *this ) )
197{
198 wxASSERT( aParentSymbol );
199
200 const_cast<KIID&>( m_Uuid ) = aUuid;
202}
203
204
205SCH_PIN::SCH_PIN( const SCH_PIN& aPin ) :
206 SCH_ITEM( aPin ),
207 m_libPin( aPin.m_libPin ),
209 m_position( aPin.m_position ),
210 m_length( aPin.m_length ),
212 m_shape( aPin.m_shape ),
213 m_type( aPin.m_type ),
214 m_hidden( aPin.m_hidden ),
217 m_alt( aPin.m_alt ),
219 m_layoutCache( std::make_unique<PIN_LAYOUT_CACHE>( *this ) )
220{
221 SetName( aPin.m_name );
222 SetNumber( aPin.m_number );
223
224 m_layer = aPin.m_layer;
225}
226
227
231
232
234{
235 SCH_ITEM::operator=( aPin );
236
237 m_libPin = aPin.m_libPin;
239 m_alt = aPin.m_alt;
240 m_name = aPin.m_name;
241 m_number = aPin.m_number;
242 m_position = aPin.m_position;
243 m_length = aPin.m_length;
245 m_shape = aPin.m_shape;
246 m_type = aPin.m_type;
247 m_hidden = aPin.m_hidden;
251
252 return *this;
253}
254
255
257{
258 if( const SCH_SYMBOL* symbol = dynamic_cast<const SCH_SYMBOL*>( GetParentSymbol() ) )
259 return symbol->GetTransform().TransformCoordinate( m_position ) + symbol->GetPosition();
260 else
261 return m_position;
262}
263
265{
267 {
268 if( !m_libPin )
270
271 return m_libPin->GetOrientation();
272 }
273
274 return m_orientation;
275}
276
277
279{
280 if( !m_alt.IsEmpty() )
281 {
282 if( !m_libPin )
284
285 return m_libPin->GetAlt( m_alt ).m_Shape;
286 }
288 {
289 if( !m_libPin )
291
292 return m_libPin->GetShape();
293 }
294
295 return m_shape;
296}
297
298
300{
301 if( !m_length.has_value() )
302 {
303 if( !m_libPin )
304 return 0;
305
306 return m_libPin->GetLength();
307 }
308
309 return m_length.value();
310}
311
312
314{
315 if( !m_alt.IsEmpty() )
316 {
317 if( !m_libPin )
319
320 return m_libPin->GetAlt( m_alt ).m_Type;
321 }
323 {
324 if( !m_libPin )
326
327 return m_libPin->GetType();
328 }
329
330 return m_type;
331}
332
334{
335 if( aType == m_type )
336 return;
337
338 m_type = aType;
340}
341
342
344{
346 return ::GetCanonicalElectricalTypeName( m_type );
347
348 if( !m_libPin )
349 return ::GetCanonicalElectricalTypeName( ELECTRICAL_PINTYPE::PT_UNSPECIFIED );
350
351 return m_libPin->GetCanonicalElectricalTypeName();
352}
353
354
356{
359
360 if( !m_libPin )
362
363 return m_libPin->GetElectricalTypeName();
364}
365
366
368{
370 && ( !IsVisible() || GetParentSymbol()->IsGlobalPower() );
371}
372
373
379
380
382{
383 return IsLocalPower() || IsGlobalPower();
384}
385
386
388{
389 if( !m_hidden.has_value() )
390 {
391 if( !m_libPin )
392 return true;
393
394 return m_libPin->IsVisible();
395 }
396
397 return !m_hidden.value();
398}
399
400
401const wxString& SCH_PIN::GetName() const
402{
403 if( !m_alt.IsEmpty() )
404 return m_alt;
405
406 return GetBaseName();
407}
408
409
410const wxString& SCH_PIN::GetBaseName() const
411{
412 if( m_libPin )
413 return m_libPin->GetBaseName();
414
415 return m_name;
416}
417
418
419void SCH_PIN::SetName( const wxString& aName )
420{
421 if( m_name == aName )
422 return;
423
424 m_name = aName;
425
426 // pin name string does not support spaces
427 m_name.Replace( wxT( " " ), wxT( "_" ) );
428
430}
431
432
433void SCH_PIN::SetAlt( const wxString& aAlt )
434{
435 // Do not set the alternate pin definition to the default pin name. This breaks the library
436 // symbol comparison for the ERC and the library diff tool. It also incorrectly causes the
437 // schematic symbol pin alternate to be set.
438 if( aAlt.IsEmpty() || aAlt == GetBaseName() )
439 {
440 m_alt = wxEmptyString;
441 return;
442 }
443
444 if( !m_libPin )
445 {
446 wxFAIL_MSG( wxString::Format( wxS( "Pin '%s' has no corresponding lib_pin" ), m_number ) );
447 m_alt = wxEmptyString;
448 return;
449 }
450
451 if( !m_libPin->GetAlternates().contains( aAlt ) )
452 {
453 wxFAIL_MSG( wxString::Format( wxS( "Pin '%s' has no alterate '%s'" ), m_number, aAlt ) );
454 m_alt = wxEmptyString;
455 return;
456 }
457
458 m_alt = aAlt;
459}
460
462{
464 return false;
465
466 return m_isDangling;
467}
468
469
470void SCH_PIN::SetIsDangling( bool aIsDangling )
471{
472 m_isDangling = aIsDangling;
473}
474
475
476bool SCH_PIN::IsStacked( const SCH_PIN* aPin ) const
477{
478 const auto isPassiveOrNic = []( ELECTRICAL_PINTYPE t )
479 {
481 };
482
483 const bool sameParent = m_parent == aPin->GetParent();
484 const bool samePos = GetPosition() == aPin->GetPosition();
485 const bool sameName = GetName() == aPin->GetName();
486 const bool typeCompat = GetType() == aPin->GetType()
487 || isPassiveOrNic( GetType() )
488 || isPassiveOrNic( aPin->GetType() );
489
490 wxLogTrace( traceStackedPins,
491 wxString::Format( "IsStacked: this='%s/%s' other='%s/%s' sameParent=%d samePos=%d sameName=%d typeCompat=%d",
492 GetName(), GetNumber(), aPin->GetName(), aPin->GetNumber(), sameParent,
493 samePos, sameName, typeCompat ) );
494
495 return sameParent && samePos && sameName && typeCompat;
496}
497
498
499bool SCH_PIN::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const
500{
501 const SCH_SEARCH_DATA& schSearchData =
502 dynamic_cast<const SCH_SEARCH_DATA&>( aSearchData );
503
504 if( schSearchData.searchAllPins
505 && ( EDA_ITEM::Matches( GetName(), aSearchData )
506 || EDA_ITEM::Matches( GetNumber(), aSearchData ) ) )
507 {
508 return true;
509 }
510
511 SCH_CONNECTION* connection = nullptr;
512 SCH_SHEET_PATH* sheetPath = reinterpret_cast<SCH_SHEET_PATH*>( aAuxData );
513
514 if( schSearchData.searchNetNames && sheetPath && ( connection = Connection( sheetPath ) ) )
515 {
516 wxString netName = connection->GetNetName();
517
518 if( EDA_ITEM::Matches( netName, aSearchData ) )
519 return true;
520 }
521
522 return false;
523}
524
525
526bool SCH_PIN::Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData )
527{
528 bool isReplaced = false;
529
530 if( dynamic_cast<LIB_SYMBOL*>( GetParentSymbol() ) )
531 {
532 isReplaced |= EDA_ITEM::Replace( aSearchData, m_name );
533 isReplaced |= EDA_ITEM::Replace( aSearchData, m_number );
534 }
535 else
536 {
537 /* TODO: waiting on a way to override pins in the schematic...
538 isReplaced |= EDA_ITEM::Replace( aSearchData, m_name );
539 isReplaced |= EDA_ITEM::Replace( aSearchData, m_number );
540 */
541 }
542
543 return isReplaced;
544}
545
546
547bool SCH_PIN::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
548{
549 // When looking for an "exact" hit aAccuracy will be 0 which works poorly if the pin has
550 // no pin number or name. Give it a floor.
551 if( Schematic() )
552 aAccuracy = std::max( aAccuracy, Schematic()->Settings().m_PinSymbolSize / 4 );
553
554 BOX2I rect = GetBoundingBox( false, true, m_flags & SHOW_ELEC_TYPE );
555
556 return rect.Inflate( aAccuracy ).Contains( aPosition );
557}
558
559
560bool SCH_PIN::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
561{
563 return false;
564
565 BOX2I sel = aRect;
566
567 if ( aAccuracy )
568 sel.Inflate( aAccuracy );
569
570 if( aContained )
571 return sel.Contains( GetBoundingBox( false, false, false ) );
572
573 return sel.Intersects( GetBoundingBox( false, true, m_flags & SHOW_ELEC_TYPE ) );
574}
575
576
577wxString SCH_PIN::GetShownName() const
578{
579 if( !m_alt.IsEmpty() )
580 return m_alt;
581 else if( m_libPin )
582 return m_libPin->GetShownName();
583
584 return m_name;
585}
586
587
589{
590 return m_number;
591}
592
593
594std::vector<wxString> SCH_PIN::GetStackedPinNumbers( bool* aValid ) const
595{
596 wxString shown = GetShownNumber();
597 wxLogTrace( traceStackedPins,
598 wxString::Format( "GetStackedPinNumbers: shown='%s'", shown ) );
599
600 std::vector<wxString> numbers = ExpandStackedPinNotation( shown, aValid );
601
602 // Log the expansion for debugging
603 wxLogTrace( traceStackedPins,
604 wxString::Format( "Expanded '%s' to %zu pins", shown, numbers.size() ) );
605 for( const wxString& num : numbers )
606 {
607 wxLogTrace( traceStackedPins, wxString::Format( " -> '%s'", num ) );
608 }
609
610 return numbers;
611}
612
613
614int SCH_PIN::GetStackedPinCount( bool* aValid ) const
615{
616 wxString shown = GetShownNumber();
617 return CountStackedPinNotation( shown, aValid );
618}
619
620
621std::optional<wxString> SCH_PIN::GetSmallestLogicalNumber() const
622{
623 bool valid = false;
624 auto numbers = GetStackedPinNumbers( &valid );
625
626 if( valid && !numbers.empty() )
627 return numbers.front(); // Already in ascending order
628
629 return std::nullopt;
630}
631
632
634{
635 if( auto smallest = GetSmallestLogicalNumber() )
636 return *smallest;
637
638 return GetShownNumber();
639}
640
641
642void SCH_PIN::SetNumber( const wxString& aNumber )
643{
644 if( m_number == aNumber )
645 return;
646
647 m_number = aNumber;
648 // pin number string does not support spaces
649 m_number.Replace( wxT( " " ), wxT( "_" ) );
650
652}
653
654
656{
657 if( !m_nameTextSize.has_value() )
658 {
659 if( !m_libPin )
660 return schIUScale.MilsToIU( DEFAULT_PINNAME_SIZE );
661
662 return m_libPin->GetNameTextSize();
663 }
664
665 return m_nameTextSize.value();
666}
667
668
670{
671 if( aSize == m_nameTextSize )
672 return;
673
674 m_nameTextSize = aSize;
676}
677
678
680{
681 if( !m_numTextSize.has_value() )
682 {
683 if( !m_libPin )
684 return schIUScale.MilsToIU( DEFAULT_PINNUM_SIZE );
685
686 return m_libPin->GetNumberTextSize();
687 }
688
689 return m_numTextSize.value();
690}
691
692
694{
695 if( aSize == m_numTextSize )
696 return;
697
698 m_numTextSize = aSize;
700}
701
702
704{
705 if( const SCH_SYMBOL* symbol = dynamic_cast<const SCH_SYMBOL*>( GetParentSymbol() ) )
706 {
707 const TRANSFORM& t = symbol->GetTransform();
708
709 if( !m_libPin )
710 return GetPosition();
711
712 return t.TransformCoordinate( m_libPin->GetPinRoot() ) + symbol->GetPosition();
713 }
714
715 switch( GetOrientation() )
716 {
717 default:
722 }
723}
724
725
726void SCH_PIN::PlotPinType( PLOTTER *aPlotter, const VECTOR2I &aPosition,
727 PIN_ORIENTATION aOrientation, bool aDimmed ) const
728{
729 int MapX1, MapY1, x1, y1;
730 SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
731 COLOR4D color = renderSettings->GetLayerColor( LAYER_PIN );
732 COLOR4D bg = renderSettings->GetBackgroundColor();
733 int penWidth = GetEffectivePenWidth( renderSettings );
734 int pinLength = GetLength();
735
736 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
737 bg = COLOR4D::WHITE;
738
739 if( color.m_text.has_value() && Schematic() )
740 color = COLOR4D( ResolveText( color.m_text.value(), &Schematic()->CurrentSheet() ) );
741
742 if( aDimmed )
743 {
744 color.Desaturate( );
745 color = color.Mix( bg, 0.5f );
746 }
747
748 aPlotter->SetColor( color );
749 aPlotter->SetCurrentLineWidth( penWidth );
750
751 MapX1 = MapY1 = 0;
752 x1 = aPosition.x; y1 = aPosition.y;
753
754 switch( aOrientation )
755 {
756 case PIN_ORIENTATION::PIN_UP: y1 = aPosition.y - pinLength; MapY1 = 1; break;
757 case PIN_ORIENTATION::PIN_DOWN: y1 = aPosition.y + pinLength; MapY1 = -1; break;
758 case PIN_ORIENTATION::PIN_LEFT: x1 = aPosition.x - pinLength; MapX1 = 1; break;
759 case PIN_ORIENTATION::PIN_RIGHT: x1 = aPosition.x + pinLength; MapX1 = -1; break;
760 case PIN_ORIENTATION::INHERIT: wxFAIL_MSG( wxS( "aOrientation must be resolved!" ) ); break;
761 }
762
764 {
765 const int radius = externalPinDecoSize( aPlotter->RenderSettings(), *this );
766 aPlotter->Circle( VECTOR2I( MapX1 * radius + x1, MapY1 * radius + y1 ), radius * 2,
767 FILL_T::NO_FILL, penWidth );
768
769 aPlotter->MoveTo( VECTOR2I( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 ) );
770 aPlotter->FinishTo( aPosition );
771 }
773 {
774 const int deco_size = internalPinDecoSize( aPlotter->RenderSettings(), *this );
775 if( MapY1 == 0 ) /* MapX1 = +- 1 */
776 {
777 aPlotter->MoveTo( VECTOR2I( x1, y1 + deco_size ) );
778 aPlotter->LineTo( VECTOR2I( x1 + MapX1 * deco_size * 2, y1 ) );
779 aPlotter->FinishTo( VECTOR2I( x1, y1 - deco_size ) );
780 }
781 else /* MapX1 = 0 */
782 {
783 aPlotter->MoveTo( VECTOR2I( x1 + deco_size, y1 ) );
784 aPlotter->LineTo( VECTOR2I( x1, y1 + MapY1 * deco_size * 2 ) );
785 aPlotter->FinishTo( VECTOR2I( x1 - deco_size, y1 ) );
786 }
787
788 aPlotter->MoveTo( VECTOR2I( MapX1 * deco_size * 2 + x1, MapY1 * deco_size * 2 + y1 ) );
789 aPlotter->FinishTo( aPosition );
790 }
791 else
792 {
793 aPlotter->MoveTo( VECTOR2I( x1, y1 ) );
794 aPlotter->FinishTo( aPosition );
795 }
796
800 {
801 const int deco_size = internalPinDecoSize( aPlotter->RenderSettings(), *this );
802
803 if( MapY1 == 0 ) /* MapX1 = +- 1 */
804 {
805 aPlotter->MoveTo( VECTOR2I( x1, y1 + deco_size ) );
806 aPlotter->LineTo( VECTOR2I( x1 - MapX1 * deco_size * 2, y1 ) );
807 aPlotter->FinishTo( VECTOR2I( x1, y1 - deco_size ) );
808 }
809 else /* MapX1 = 0 */
810 {
811 aPlotter->MoveTo( VECTOR2I( x1 + deco_size, y1 ) );
812 aPlotter->LineTo( VECTOR2I( x1, y1 - MapY1 * deco_size * 2 ) );
813 aPlotter->FinishTo( VECTOR2I( x1 - deco_size, y1 ) );
814 }
815 }
816
818 || m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW ) /* IEEE symbol "Active Low Input" */
819 {
820 const int deco_size = externalPinDecoSize( aPlotter->RenderSettings(), *this );
821
822 if( MapY1 == 0 ) /* MapX1 = +- 1 */
823 {
824 aPlotter->MoveTo( VECTOR2I( x1 + MapX1 * deco_size * 2, y1 ) );
825 aPlotter->LineTo( VECTOR2I( x1 + MapX1 * deco_size * 2, y1 - deco_size * 2 ) );
826 aPlotter->FinishTo( VECTOR2I( x1, y1 ) );
827 }
828 else /* MapX1 = 0 */
829 {
830 aPlotter->MoveTo( VECTOR2I( x1, y1 + MapY1 * deco_size * 2 ) );
831 aPlotter->LineTo( VECTOR2I( x1 - deco_size * 2, y1 + MapY1 * deco_size * 2 ) );
832 aPlotter->FinishTo( VECTOR2I( x1, y1 ) );
833 }
834 }
835
836 if( m_shape == GRAPHIC_PINSHAPE::OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
837 {
838 const int symbol_size = externalPinDecoSize( aPlotter->RenderSettings(), *this );
839
840 if( MapY1 == 0 ) /* MapX1 = +- 1 */
841 {
842 aPlotter->MoveTo( VECTOR2I( x1, y1 - symbol_size * 2 ) );
843 aPlotter->FinishTo( VECTOR2I( x1 + MapX1 * symbol_size * 2, y1 ) );
844 }
845 else /* MapX1 = 0 */
846 {
847 aPlotter->MoveTo( VECTOR2I( x1 - symbol_size * 2, y1 ) );
848 aPlotter->FinishTo( VECTOR2I( x1, y1 + MapY1 * symbol_size * 2 ) );
849 }
850 }
851 else if( m_shape == GRAPHIC_PINSHAPE::NONLOGIC ) /* NonLogic pin symbol */
852 {
853 const int deco_size = externalPinDecoSize( aPlotter->RenderSettings(), *this );
854 aPlotter->MoveTo( VECTOR2I( x1 - ( MapX1 + MapY1 ) * deco_size,
855 y1 - ( MapY1 - MapX1 ) * deco_size ) );
856 aPlotter->FinishTo( VECTOR2I( x1 + ( MapX1 + MapY1 ) * deco_size,
857 y1 + ( MapY1 - MapX1 ) * deco_size ) );
858 aPlotter->MoveTo( VECTOR2I( x1 - ( MapX1 - MapY1 ) * deco_size,
859 y1 - ( MapY1 + MapX1 ) * deco_size ) );
860 aPlotter->FinishTo( VECTOR2I( x1 + ( MapX1 - MapY1 ) * deco_size,
861 y1 + ( MapY1 + MapX1 ) * deco_size ) );
862 }
863
864 if( m_type == ELECTRICAL_PINTYPE::PT_NC ) // Draw a N.C. symbol
865 {
866 const int deco_size = TARGET_PIN_RADIUS;
867 const int ex1 = aPosition.x;
868 const int ey1 = aPosition.y;
869 aPlotter->MoveTo( VECTOR2I( ex1 - deco_size, ey1 - deco_size ) );
870 aPlotter->FinishTo( VECTOR2I( ex1 + deco_size, ey1 + deco_size ) );
871 aPlotter->MoveTo( VECTOR2I( ex1 + deco_size, ey1 - deco_size ) );
872 aPlotter->FinishTo( VECTOR2I( ex1 - deco_size, ey1 + deco_size ) );
873 }
874}
875
876
877void SCH_PIN::PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIENTATION aPinOrient,
878 int aTextInside, bool aDrawPinNum, bool aDrawPinName, bool aDimmed ) const
879{
880 RENDER_SETTINGS* settings = aPlotter->RenderSettings();
881 KIFONT::FONT* font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), false, false );
882 wxString name = GetShownName();
883 wxString number = GetShownNumber();
884
885 // Apply stacked pin display formatting (reuse helper from pin_layout_cache)
886 if( aDrawPinNum && !number.IsEmpty() )
887 {
888 const KIFONT::METRICS& metrics = GetFontMetrics();
889 number = FormatStackedPinForDisplay( number, GetLength(), GetNumberTextSize(), font, metrics );
890 }
891
892 if( name.IsEmpty() || m_nameTextSize == 0 )
893 aDrawPinName = false;
894
895 if( number.IsEmpty() || m_numTextSize == 0 )
896 aDrawPinNum = false;
897
898 if( !aDrawPinNum && !aDrawPinName )
899 return;
900
901 int namePenWidth = settings->GetDefaultPenWidth();
902 int numPenWidth = settings->GetDefaultPenWidth();
903 int name_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + namePenWidth;
904 int num_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + numPenWidth;
905
906 COLOR4D nameColor = settings->GetLayerColor( LAYER_PINNAM );
907 COLOR4D numColor = settings->GetLayerColor( LAYER_PINNUM );
908 COLOR4D bg = settings->GetBackgroundColor();
909
910 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
911 bg = COLOR4D::WHITE;
912
913 if( nameColor.m_text.has_value() && Schematic() )
914 nameColor = COLOR4D( ResolveText( nameColor.m_text.value(), &Schematic()->CurrentSheet() ) );
915
916 if( numColor.m_text.has_value() && Schematic() )
917 numColor = COLOR4D( ResolveText( numColor.m_text.value(), &Schematic()->CurrentSheet() ) );
918
919 if( aDimmed )
920 {
921 nameColor.Desaturate();
922 numColor.Desaturate();
923 nameColor = nameColor.Mix( bg, 0.5f );
924 numColor = numColor.Mix( bg, 0.5f );
925 }
926
927 int x1 = aPinPos.x;
928 int y1 = aPinPos.y;
929
930 switch( aPinOrient )
931 {
932 case PIN_ORIENTATION::PIN_UP: y1 -= GetLength(); break;
933 case PIN_ORIENTATION::PIN_DOWN: y1 += GetLength(); break;
934 case PIN_ORIENTATION::PIN_LEFT: x1 -= GetLength(); break;
935 case PIN_ORIENTATION::PIN_RIGHT: x1 += GetLength(); break;
936 default: break;
937 }
938
939 auto plotSimpleText =
940 [&]( int x, int y, const EDA_ANGLE& angle, GR_TEXT_H_ALIGN_T hJustify, GR_TEXT_V_ALIGN_T vJustify,
941 const wxString& txt, int size, int penWidth, const COLOR4D& col )
942 {
943 TEXT_ATTRIBUTES attrs;
944 attrs.m_StrokeWidth = penWidth;
945 attrs.m_Angle = angle;
946 attrs.m_Size = VECTOR2I( size, size );
947 attrs.m_Halign = hJustify;
948 attrs.m_Valign = vJustify;
949 attrs.m_Multiline = false; // we'll manage multi-line manually
950 aPlotter->PlotText( VECTOR2I( x, y ), col, txt, attrs, font, GetFontMetrics() );
951 };
952
953 auto plotMultiLineWithBraces =
954 [&]( int anchorX, int anchorY, EDA_ANGLE angle, GR_TEXT_V_ALIGN_T vAlign, bool /*numberBlock*/ )
955 {
956 // If not multi-line formatted, just plot single line centered.
957 if( !number.StartsWith( "[" ) || !number.EndsWith( "]" ) || !number.Contains( "\n" ) )
958 {
959 plotSimpleText( anchorX, anchorY, angle, GR_TEXT_H_ALIGN_CENTER, vAlign, number,
960 GetNumberTextSize(), numPenWidth, numColor );
961 return;
962 }
963
964 wxString content = number.Mid( 1, number.Length() - 2 );
965 wxArrayString lines;
966 wxStringSplit( content, lines, '\n' );
967
968 if( lines.size() <= 1 )
969 {
970 plotSimpleText( anchorX, anchorY, angle, GR_TEXT_H_ALIGN_CENTER, vAlign, content,
971 GetNumberTextSize(), numPenWidth, numColor );
972 return;
973 }
974
975 int textSize = GetNumberTextSize();
976 int lineSpacing = KiROUND( textSize * 1.3 );
977 const KIFONT::METRICS& metrics = GetFontMetrics();
978
979 // Measure line widths for brace spacing
980 int maxLineWidth = 0;
981 for( const wxString& rawLine : lines )
982 {
983 wxString trimmed = rawLine; trimmed.Trim(true).Trim(false);
984 VECTOR2I ext = font->StringBoundaryLimits( trimmed, VECTOR2D( textSize, textSize ),
985 GetPenSizeForNormal( textSize ), false, false, metrics );
986 if( ext.x > maxLineWidth )
987 maxLineWidth = ext.x;
988 }
989
990 // Determine starting position
991 int startX = anchorX;
992 int startY = anchorY;
993
994 if( angle == ANGLE_VERTICAL )
995 {
996 int totalWidth = ( (int) lines.size() - 1 ) * lineSpacing;
997 startX -= totalWidth;
998 }
999 else
1000 {
1001 int totalHeight = ( (int) lines.size() - 1 ) * lineSpacing;
1002 startY -= totalHeight;
1003 }
1004
1005 for( size_t i = 0; i < lines.size(); ++i )
1006 {
1007 wxString l = lines[i]; l.Trim( true ).Trim( false );
1008 int lx = startX + ( angle == ANGLE_VERTICAL ? (int) i * lineSpacing : 0 );
1009 int ly = startY + ( angle == ANGLE_VERTICAL ? 0 : (int) i * lineSpacing );
1010 plotSimpleText( lx, ly, angle, GR_TEXT_H_ALIGN_CENTER, vAlign, l, textSize, numPenWidth, numColor );
1011 }
1012
1013 // Now draw braces emulating SCH_PAINTER brace geometry
1014 auto plotBrace =
1015 [&]( const VECTOR2I& top, const VECTOR2I& bottom, bool leftOrTop, bool isVerticalText )
1016 {
1017 // Build 4 small segments approximating curly brace
1018 VECTOR2I mid = ( top + bottom ) / 2;
1019 int braceWidth = textSize / 3; // same scale as painter
1020 VECTOR2I p1 = top;
1021 VECTOR2I p5 = bottom;
1022 VECTOR2I p2 = top;
1023 VECTOR2I p3 = mid;
1024 VECTOR2I p4 = bottom;
1025 int offset = leftOrTop ? -braceWidth : braceWidth;
1026
1027 if( isVerticalText )
1028 {
1029 // Text vertical => brace extends in Y (horizontal brace lines across X axis set)
1030 // For vertical orientation we offset Y for p2/p3/p4
1031 p2.y += offset / 2;
1032 p3.y += offset;
1033 p4.y += offset / 2;
1034 }
1035 else
1036 {
1037 // Horizontal text => brace extends in X
1038 p2.x += offset / 2;
1039 p3.x += offset;
1040 p4.x += offset / 2;
1041 }
1042
1043 aPlotter->MoveTo( p1 ); aPlotter->FinishTo( p2 );
1044 aPlotter->MoveTo( p2 ); aPlotter->FinishTo( p3 );
1045 aPlotter->MoveTo( p3 ); aPlotter->FinishTo( p4 );
1046 aPlotter->MoveTo( p4 ); aPlotter->FinishTo( p5 );
1047 };
1048
1049 aPlotter->SetCurrentLineWidth( numPenWidth );
1050 int braceWidth = textSize / 3;
1051 int extraHeight = textSize / 3; // extend beyond text block
1052
1053 if( angle == ANGLE_VERTICAL )
1054 {
1055 // Lines spaced horizontally, braces horizontal (above & below)
1056 int totalWidth = ( (int) lines.size() - 1 ) * lineSpacing;
1057 VECTOR2I braceStart( startX - 2 * extraHeight, anchorY );
1058 VECTOR2I braceEnd( startX + totalWidth + extraHeight, anchorY );
1059 int braceSpacing = maxLineWidth / 2 + braceWidth;
1060
1061 VECTOR2I topStart = braceStart; topStart.y -= braceSpacing;
1062 VECTOR2I topEnd = braceEnd; topEnd.y -= braceSpacing;
1063 VECTOR2I bottomStart = braceStart; bottomStart.y += braceSpacing;
1064 VECTOR2I bottomEnd = braceEnd; bottomEnd.y += braceSpacing;
1065
1066 plotBrace( topStart, topEnd, true, true ); // leftOrTop=true
1067 plotBrace( bottomStart, bottomEnd, false, true );
1068 }
1069 else
1070 {
1071 // Lines spaced vertically, braces vertical (left & right)
1072 int totalHeight = ( (int) lines.size() - 1 ) * lineSpacing;
1073 VECTOR2I braceStart( anchorX, startY - 2 * extraHeight );
1074 VECTOR2I braceEnd( anchorX, startY + totalHeight + extraHeight );
1075 int braceSpacing = maxLineWidth / 2 + braceWidth;
1076
1077 VECTOR2I leftTop = braceStart; leftTop.x -= braceSpacing;
1078 VECTOR2I leftBot = braceEnd; leftBot.x -= braceSpacing;
1079 VECTOR2I rightTop = braceStart; rightTop.x += braceSpacing;
1080 VECTOR2I rightBot = braceEnd; rightBot.x += braceSpacing;
1081
1082 plotBrace( leftTop, leftBot, true, false );
1083 plotBrace( rightTop, rightBot, false, false );
1084 }
1085 };
1086
1087 // Logic largely mirrors original single-line placement but calls multi-line path for numbers
1088 if( aTextInside )
1089 {
1090 if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT ) || ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
1091 {
1092 if( aDrawPinName )
1093 {
1094 if( aPinOrient == PIN_ORIENTATION::PIN_RIGHT )
1095 {
1096 plotSimpleText( x1 + aTextInside, y1, ANGLE_HORIZONTAL, GR_TEXT_H_ALIGN_LEFT,
1097 GR_TEXT_V_ALIGN_CENTER, name, GetNameTextSize(), namePenWidth, nameColor );
1098 }
1099 else
1100 {
1101 plotSimpleText( x1 - aTextInside, y1, ANGLE_HORIZONTAL, GR_TEXT_H_ALIGN_RIGHT,
1102 GR_TEXT_V_ALIGN_CENTER, name, GetNameTextSize(), namePenWidth, nameColor );
1103 }
1104 }
1105
1106 if( aDrawPinNum )
1107 {
1108 plotMultiLineWithBraces( ( x1 + aPinPos.x ) / 2, y1 - num_offset, ANGLE_HORIZONTAL,
1109 GR_TEXT_V_ALIGN_BOTTOM, true );
1110 }
1111 }
1112 else
1113 {
1114 if( aPinOrient == PIN_ORIENTATION::PIN_DOWN )
1115 {
1116 if( aDrawPinName )
1117 {
1118 plotSimpleText( x1, y1 + aTextInside, ANGLE_VERTICAL, GR_TEXT_H_ALIGN_RIGHT,
1119 GR_TEXT_V_ALIGN_CENTER, name, GetNameTextSize(), namePenWidth, nameColor );
1120 }
1121
1122 if( aDrawPinNum )
1123 {
1124 plotMultiLineWithBraces( x1 - num_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
1125 GR_TEXT_V_ALIGN_BOTTOM, true );
1126 }
1127 }
1128 else // PIN_UP
1129 {
1130 if( aDrawPinName )
1131 {
1132 plotSimpleText( x1, y1 - aTextInside, ANGLE_VERTICAL, GR_TEXT_H_ALIGN_LEFT,
1133 GR_TEXT_V_ALIGN_CENTER, name, GetNameTextSize(), namePenWidth, nameColor );
1134 }
1135
1136 if( aDrawPinNum )
1137 {
1138 plotMultiLineWithBraces( x1 - num_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
1139 GR_TEXT_V_ALIGN_BOTTOM, true );
1140 }
1141 }
1142 }
1143 }
1144 else
1145 {
1146 if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT ) || ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
1147 {
1148 if( aDrawPinName && aDrawPinNum )
1149 {
1150 plotSimpleText( ( x1 + aPinPos.x ) / 2, y1 - name_offset, ANGLE_HORIZONTAL,
1152 GetNameTextSize(), namePenWidth, nameColor );
1153 plotMultiLineWithBraces( ( x1 + aPinPos.x ) / 2, y1 + num_offset, ANGLE_HORIZONTAL,
1154 GR_TEXT_V_ALIGN_TOP, true );
1155 }
1156 else if( aDrawPinName )
1157 {
1158 plotSimpleText( ( x1 + aPinPos.x ) / 2, y1 - name_offset, ANGLE_HORIZONTAL,
1160 GetNameTextSize(), namePenWidth, nameColor );
1161 }
1162 else if( aDrawPinNum )
1163 {
1164 plotMultiLineWithBraces( ( x1 + aPinPos.x ) / 2, y1 - name_offset, ANGLE_HORIZONTAL,
1165 GR_TEXT_V_ALIGN_BOTTOM, true );
1166 }
1167 }
1168 else
1169 {
1170 if( aDrawPinName && aDrawPinNum )
1171 {
1172 plotSimpleText( x1 - name_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
1174 GetNameTextSize(), namePenWidth, nameColor );
1175 plotMultiLineWithBraces( x1 + num_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
1176 GR_TEXT_V_ALIGN_TOP, true );
1177 }
1178 else if( aDrawPinName )
1179 {
1180 plotSimpleText( x1 - name_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
1182 GetNameTextSize(), namePenWidth, nameColor );
1183 }
1184 else if( aDrawPinNum )
1185 {
1186 plotMultiLineWithBraces( x1 - num_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
1187 GR_TEXT_V_ALIGN_BOTTOM, true );
1188 }
1189 }
1190 }
1191}
1192
1193
1195{
1196 PIN_ORIENTATION orient;
1197 VECTOR2I end; // position of pin end starting at 0,0 according to its orientation, length = 1
1198
1199 switch( GetOrientation() )
1200 {
1201 default:
1202 case PIN_ORIENTATION::PIN_RIGHT: end.x = 1; break;
1203 case PIN_ORIENTATION::PIN_UP: end.y = -1; break;
1204 case PIN_ORIENTATION::PIN_DOWN: end.y = 1; break;
1205 case PIN_ORIENTATION::PIN_LEFT: end.x = -1; break;
1206 }
1207
1208 // = pos of end point, according to the symbol orientation.
1209 end = aTransform.TransformCoordinate( end );
1210 orient = PIN_ORIENTATION::PIN_UP;
1211
1212 if( end.x == 0 )
1213 {
1214 if( end.y > 0 )
1216 }
1217 else
1218 {
1220
1221 if( end.x < 0 )
1223 }
1224
1225 return orient;
1226}
1227
1228
1230{
1231 //return new SCH_PIN( *this );
1232 SCH_ITEM* newPin = new SCH_PIN( *this );
1233 wxASSERT( newPin->GetUnit() == m_unit && newPin->GetBodyStyle() == m_bodyStyle );
1234 return newPin;
1235}
1236
1237
1238void SCH_PIN::ChangeLength( int aLength )
1239{
1240 int lengthChange = GetLength() - aLength;
1241 int offsetX = 0;
1242 int offsetY = 0;
1243
1244 switch( GetOrientation() )
1245 {
1246 default:
1248 offsetX = lengthChange;
1249 break;
1251 offsetX = -1 * lengthChange;
1252 break;
1254 offsetY = -1 * lengthChange;
1255 break;
1257 offsetY = lengthChange;
1258 break;
1259 }
1260
1261 m_position += VECTOR2I( offsetX, offsetY );
1262 m_length = aLength;
1263}
1264
1265
1266void SCH_PIN::Move( const VECTOR2I& aOffset )
1267{
1268 m_position += aOffset;
1269}
1270
1271
1273{
1274 m_position.x -= aCenter;
1275 m_position.x *= -1;
1276 m_position.x += aCenter;
1277
1282}
1283
1284
1286{
1287 if( dynamic_cast<LIB_SYMBOL*>( GetParentSymbol() ) )
1288 MirrorHorizontallyPin( aCenter );
1289}
1290
1291
1293{
1294 m_position.y -= aCenter;
1295 m_position.y *= -1;
1296 m_position.y += aCenter;
1297
1302}
1303
1304
1305void SCH_PIN::MirrorVertically( int aCenter )
1306{
1307 if( dynamic_cast<LIB_SYMBOL*>( GetParentSymbol() ) )
1308 MirrorVerticallyPin( aCenter );
1309}
1310
1311
1312void SCH_PIN::RotatePin( const VECTOR2I& aCenter, bool aRotateCCW )
1313{
1314 if( aRotateCCW )
1315 {
1316 RotatePoint( m_position, aCenter, ANGLE_90 );
1317
1318 switch( GetOrientation() )
1319 {
1320 default:
1325 }
1326 }
1327 else
1328 {
1329 RotatePoint( m_position, aCenter, -ANGLE_90 );
1330
1331 switch( GetOrientation() )
1332 {
1333 default:
1338 }
1339 }
1340}
1341
1342
1343void SCH_PIN::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
1344{
1345 if( dynamic_cast<LIB_SYMBOL*>( GetParentSymbol() ) )
1346 RotatePin( aCenter, aRotateCCW );
1347}
1348
1349
1350void SCH_PIN::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
1351 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
1352{
1353 if( aBackground )
1354 return;
1355
1356 SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
1357
1358 if( !IsVisible() && !renderSettings->m_ShowHiddenPins )
1359 return;
1360
1361 const SYMBOL* part = GetParentSymbol();
1362 PIN_ORIENTATION orient = PinDrawOrient( renderSettings->m_Transform );
1363 VECTOR2I pos = renderSettings->TransformCoordinate( m_position ) + aOffset;
1364
1365 PlotPinType( aPlotter, pos, orient, aDimmed );
1366 PlotPinTexts( aPlotter, pos, orient, part->GetPinNameOffset(), part->GetShowPinNumbers(),
1367 part->GetShowPinNames(), aDimmed );
1368}
1369
1370
1371void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
1372{
1373 wxString msg;
1374 SYMBOL* symbol = GetParentSymbol();
1375
1376 aList.emplace_back( _( "Type" ), _( "Pin" ) );
1377
1378 SCH_ITEM::GetMsgPanelInfo( aFrame, aList );
1379
1380 aList.emplace_back( _( "Name" ), UnescapeString( GetShownName() ) );
1381 aList.emplace_back( _( "Number" ), GetShownNumber() );
1382 aList.emplace_back( _( "Type" ), ElectricalPinTypeGetText( GetType() ) );
1383 aList.emplace_back( _( "Style" ), PinShapeGetText( GetShape() ) );
1384
1385 aList.emplace_back( _( "Visible" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
1386
1387 // Display pin length
1388 aList.emplace_back( _( "Length" ), aFrame->MessageTextFromValue( GetLength(), true ) );
1389
1390 aList.emplace_back( _( "Orientation" ), PinOrientationName( GetOrientation() ) );
1391
1392 if( dynamic_cast<LIB_SYMBOL*>( symbol ) )
1393 {
1394 aList.emplace_back( _( "Pos X" ), aFrame->MessageTextFromValue( GetPosition().x, true ) );
1395 aList.emplace_back( _( "Pos Y" ), aFrame->MessageTextFromValue( GetPosition().y, true ) );
1396 }
1397 else if( SCH_SYMBOL* schsymbol = dynamic_cast<SCH_SYMBOL*>( symbol ) )
1398 {
1399 SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );
1400 SCH_SHEET_PATH* currentSheet = schframe ? &schframe->GetCurrentSheet() : nullptr;
1401
1402 // Don't use GetShownText(); we want to see the variable references here
1403 aList.emplace_back( symbol->GetRef( currentSheet ),
1404 UnescapeString( schsymbol->GetField( FIELD_T::VALUE )->GetText() ) );
1405 }
1406
1407#if defined(DEBUG)
1408 if( !IsConnectivityDirty() && dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
1409 {
1410 SCH_CONNECTION* conn = Connection();
1411
1412 if( conn )
1413 conn->AppendInfoToMsgPanel( aList );
1414 }
1415#endif
1416}
1417
1418
1420{
1421 std::lock_guard<std::recursive_mutex> lock( m_netmap_mutex );
1422
1423 if( aPath )
1424 m_net_name_map.erase( *aPath );
1425 else
1426 m_net_name_map.clear();
1427}
1428
1429
1430wxString SCH_PIN::GetDefaultNetName( const SCH_SHEET_PATH& aPath, bool aForceNoConnect )
1431{
1432 const SCH_SYMBOL* symbol = static_cast<const SCH_SYMBOL*>( GetParentSymbol() );
1433
1434 // Need to check for parent as power symbol to make sure we aren't dealing
1435 // with legacy global power pins on non-power symbols
1436 if( IsGlobalPower() || IsLocalPower() )
1437 {
1438 SYMBOL* parent = GetLibPin()->GetParentSymbol();
1439
1440 if( parent->IsGlobalPower() || parent->IsLocalPower() )
1441 {
1442 return EscapeString( symbol->GetValue( true, &aPath, false ), CTX_NETNAME );
1443 }
1444 else
1445 {
1446 wxString tmp = m_libPin ? m_libPin->GetName() : wxString( "??" );
1447
1448 return EscapeString( tmp, CTX_NETNAME );
1449 }
1450 }
1451
1452 std::lock_guard<std::recursive_mutex> lock( m_netmap_mutex );
1453
1454 auto it = m_net_name_map.find( aPath );
1455
1456 if( it != m_net_name_map.end() )
1457 {
1458 if( it->second.second == aForceNoConnect )
1459 return it->second.first;
1460 }
1461
1462 wxString name = "Net-(";
1463 bool unconnected = false;
1464
1465 if( aForceNoConnect || GetType() == ELECTRICAL_PINTYPE::PT_NC )
1466 {
1467 unconnected = true;
1468 name = ( "unconnected-(" );
1469 }
1470
1471 bool annotated = true;
1472
1473 std::vector<SCH_PIN*> pins = symbol->GetPins( &aPath );
1474 bool has_multiple = false;
1475
1476 for( SCH_PIN* pin : pins )
1477 {
1478 if( pin->GetShownName() == GetShownName()
1479 && pin->GetShownNumber() != GetShownNumber()
1480 && unconnected == ( pin->GetType() == ELECTRICAL_PINTYPE::PT_NC ) )
1481 {
1482 has_multiple = true;
1483 break;
1484 }
1485 }
1486
1487 wxString libPinShownName = m_libPin ? m_libPin->GetShownName() : wxString( "??" );
1488 wxString libPinShownNumber = m_libPin ? m_libPin->GetShownNumber() : wxString( "??" );
1489 wxString effectivePadNumber = m_libPin ? m_libPin->GetEffectivePadNumber() : libPinShownNumber;
1490
1491 if( effectivePadNumber != libPinShownNumber )
1492 {
1493 wxLogTrace( traceStackedPins,
1494 wxString::Format( "GetDefaultNetName: stacked pin shown='%s' -> using smallest logical='%s'",
1495 libPinShownNumber, effectivePadNumber ) );
1496 }
1497
1498 // Use timestamp for unannotated symbols
1499 if( symbol->GetRef( &aPath, false ).Last() == '?' )
1500 {
1502
1503 wxString libPinNumber = m_libPin ? m_libPin->GetNumber() : wxString( "??" );
1504 // Apply same smallest-logical substitution for unannotated symbols
1505 if( effectivePadNumber != libPinShownNumber && !effectivePadNumber.IsEmpty() )
1506 libPinNumber = effectivePadNumber;
1507
1508 name << "-Pad" << libPinNumber << ")";
1509 annotated = false;
1510 }
1511 else if( !libPinShownName.IsEmpty() && ( libPinShownName != libPinShownNumber ) )
1512 {
1513 // Pin names might not be unique between different units so we must have the
1514 // unit token in the reference designator
1515 name << symbol->GetRef( &aPath, true );
1516 name << "-" << EscapeString( libPinShownName, CTX_NETNAME );
1517
1518 if( unconnected || has_multiple )
1519 {
1520 // Use effective (possibly de-stacked) pad number in net name
1521 name << "-Pad" << EscapeString( effectivePadNumber, CTX_NETNAME );
1522 }
1523
1524 name << ")";
1525 }
1526 else
1527 {
1528 // Pin numbers are unique, so we skip the unit token
1529 name << symbol->GetRef( &aPath, false );
1530 name << "-Pad" << EscapeString( effectivePadNumber, CTX_NETNAME ) << ")";
1531 }
1532
1533 if( annotated )
1534 m_net_name_map[ aPath ] = std::make_pair( name, aForceNoConnect );
1535
1536 return name;
1537}
1538
1539
1541{
1542 return GetBoundingBox( false, true, m_flags & SHOW_ELEC_TYPE );
1543}
1544
1545
1551
1552
1553void SCH_PIN::validateExtentsCache( KIFONT::FONT* aFont, int aSize, const wxString& aText,
1554 EXTENTS_CACHE* aCache ) const
1555{
1556 if( aCache->m_Font == aFont
1557 && aCache->m_FontSize == aSize
1558 && aCache->m_Extents != VECTOR2I() )
1559 {
1560 return;
1561 }
1562
1563 aCache->m_Font = aFont;
1564 aCache->m_FontSize = aSize;
1565
1566 VECTOR2D fontSize( aSize, aSize );
1567 int penWidth = GetPenSizeForNormal( aSize );
1568
1569 aCache->m_Extents = aFont->StringBoundaryLimits( aText, fontSize, penWidth, false, false,
1570 GetFontMetrics() );
1571}
1572
1573
1574BOX2I SCH_PIN::GetBoundingBox( bool aIncludeLabelsOnInvisiblePins, bool aIncludeNameAndNumber,
1575 bool aIncludeElectricalType ) const
1576{
1577 // Just defer to the cache
1578 return m_layoutCache->GetPinBoundingBox( aIncludeLabelsOnInvisiblePins, aIncludeNameAndNumber,
1579 aIncludeElectricalType );
1580}
1581
1582
1584 const SCH_SHEET_PATH* aInstance ) const
1585{
1586 // Do not compare to ourself.
1587 if( aItem == this )
1588 return false;
1589
1590 const SCH_PIN* pin = dynamic_cast<const SCH_PIN*>( aItem );
1591
1592 // Don't compare against a different SCH_ITEM.
1593 wxCHECK( pin, false );
1594
1595 if( GetPosition() != pin->GetPosition() )
1596 return true;
1597
1598 if( GetNumber() != pin->GetNumber() )
1599 return true;
1600
1601 return GetName() != pin->GetName();
1602}
1603
1604
1606{
1608}
1609
1610
1612{
1613 if( m_libPin )
1614 return m_libPin->GetMenuImage();
1615
1617}
1618
1619
1620wxString SCH_PIN::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, ALT* aAlt ) const
1621{
1622 return getItemDescription( aAlt );
1623}
1624
1625
1626wxString SCH_PIN::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
1627{
1628 if( m_libPin )
1629 {
1630 SCH_PIN::ALT localStorage;
1631 SCH_PIN::ALT* alt = nullptr;
1632
1633 if( !m_alt.IsEmpty() )
1634 {
1635 localStorage = m_libPin->GetAlt( m_alt );
1636 alt = &localStorage;
1637 }
1638
1639 wxString itemDesc = m_libPin ? m_libPin->GetItemDescription( aUnitsProvider, alt )
1640 : wxString( wxS( "Undefined library pin." ) );
1641
1642 const SCH_SYMBOL* symbol = static_cast<const SCH_SYMBOL*>( GetParentSymbol() );
1643
1644 return wxString::Format( "Symbol %s %s",
1646 itemDesc );
1647 }
1648
1649 return getItemDescription( nullptr );
1650}
1651
1652
1653wxString SCH_PIN::getItemDescription( ALT* aAlt ) const
1654{
1655 wxString name = UnescapeString( aAlt ? aAlt->m_Name : GetShownName() );
1656 wxString electricalTypeName = ElectricalPinTypeGetText( aAlt ? aAlt->m_Type : m_type );
1657 wxString pinShapeName = PinShapeGetText( aAlt ? aAlt->m_Shape : m_shape );
1658
1659 if( IsVisible() )
1660 {
1661 if ( !name.IsEmpty() )
1662 {
1663 return wxString::Format( _( "Pin %s [%s, %s, %s]" ),
1665 name,
1666 electricalTypeName,
1667 pinShapeName );
1668 }
1669 else
1670 {
1671 return wxString::Format( _( "Pin %s [%s, %s]" ),
1673 electricalTypeName,
1674 pinShapeName );
1675 }
1676 }
1677 else
1678 {
1679 if( !name.IsEmpty() )
1680 {
1681 return wxString::Format( _( "Hidden pin %s [%s, %s, %s]" ),
1683 name,
1684 electricalTypeName,
1685 pinShapeName );
1686 }
1687 else
1688 {
1689 return wxString::Format( _( "Hidden pin %s [%s, %s]" ),
1691 electricalTypeName,
1692 pinShapeName );
1693 }
1694 }
1695}
1696
1697
1698int SCH_PIN::compare( const SCH_ITEM& aOther, int aCompareFlags ) const
1699{
1700 // Ignore the UUID here
1701 // And the position, which we'll do after the number.
1702 int retv = SCH_ITEM::compare( aOther, aCompareFlags | SCH_ITEM::COMPARE_FLAGS::EQUALITY
1704
1705 if( retv )
1706 return retv;
1707
1708 const SCH_PIN* tmp = static_cast<const SCH_PIN*>( &aOther );
1709
1710 wxCHECK( tmp, -1 );
1711
1712 if( m_number != tmp->m_number )
1713 {
1714 // StrNumCmp: sort the same as the pads in the footprint file
1715 return StrNumCmp( m_number, tmp->m_number ) < 0;
1716 }
1717
1718 if( m_position.x != tmp->m_position.x )
1719 return m_position.x - tmp->m_position.x;
1720
1721 if( m_position.y != tmp->m_position.y )
1722 return m_position.y - tmp->m_position.y;
1723
1724 if( dynamic_cast<const SCH_SYMBOL*>( GetParentSymbol() ) )
1725 {
1726 if( ( m_libPin == nullptr ) || ( tmp->m_libPin == nullptr ) )
1727 return -1;
1728
1729 retv = m_libPin->compare( *tmp->m_libPin );
1730
1731 if( retv )
1732 return retv;
1733
1734 retv = m_alt.Cmp( tmp->m_alt );
1735
1736 if( retv )
1737 return retv;
1738 }
1739
1740 if( dynamic_cast<const LIB_SYMBOL*>( GetParentSymbol() ) )
1741 {
1742 if( m_length != tmp->m_length )
1743 return m_length.value_or( 0 ) - tmp->m_length.value_or( 0 );
1744
1745 if( m_orientation != tmp->m_orientation )
1746 return static_cast<int>( m_orientation ) - static_cast<int>( tmp->m_orientation );
1747
1748 if( m_shape != tmp->m_shape )
1749 return static_cast<int>( m_shape ) - static_cast<int>( tmp->m_shape );
1750
1751 if( m_type != tmp->m_type )
1752 return static_cast<int>( m_type ) - static_cast<int>( tmp->m_type );
1753
1754 if( m_hidden != tmp->m_hidden )
1755 return m_hidden.value_or( false ) - tmp->m_hidden.value_or( false );
1756
1757 if( m_numTextSize != tmp->m_numTextSize )
1758 return m_numTextSize.value_or( 0 ) - tmp->m_numTextSize.value_or( 0 );
1759
1760 if( m_nameTextSize != tmp->m_nameTextSize )
1761 return m_nameTextSize.value_or( 0 ) - tmp->m_nameTextSize.value_or( 0 );
1762
1763 if( m_alternates.size() != tmp->m_alternates.size() )
1764 return static_cast<int>( m_alternates.size() - tmp->m_alternates.size() );
1765
1766 auto lhsItem = m_alternates.begin();
1767 auto rhsItem = tmp->m_alternates.begin();
1768
1769 while( lhsItem != m_alternates.end() )
1770 {
1771 const ALT& lhsAlt = lhsItem->second;
1772 const ALT& rhsAlt = rhsItem->second;
1773
1774 retv = lhsAlt.m_Name.Cmp( rhsAlt.m_Name );
1775
1776 if( retv )
1777 return retv;
1778
1779 if( lhsAlt.m_Type != rhsAlt.m_Type )
1780 return static_cast<int>( lhsAlt.m_Type ) - static_cast<int>( rhsAlt.m_Type );
1781
1782 if( lhsAlt.m_Shape != rhsAlt.m_Shape )
1783 return static_cast<int>( lhsAlt.m_Shape ) - static_cast<int>( rhsAlt.m_Shape );
1784
1785 ++lhsItem;
1786 ++rhsItem;
1787 }
1788 }
1789
1790 return 0;
1791}
1792
1793
1794double SCH_PIN::Similarity( const SCH_ITEM& aOther ) const
1795{
1796 if( aOther.m_Uuid == m_Uuid )
1797 return 1.0;
1798
1799 if( aOther.Type() != SCH_PIN_T )
1800 return 0.0;
1801
1802 const SCH_PIN* other = static_cast<const SCH_PIN*>( &aOther );
1803
1804 if( m_libPin )
1805 {
1806 if( m_number != other->m_number )
1807 return 0.0;
1808
1809 if( m_position != other->m_position )
1810 return 0.0;
1811
1812 return m_libPin->Similarity( *other->m_libPin );
1813 }
1814
1815 double similarity = SimilarityBase( aOther );
1816
1817 if( m_name != other->m_name )
1818 similarity *= 0.9;
1819
1820 if( m_number != other->m_number )
1821 similarity *= 0.9;
1822
1823 if( m_position != other->m_position )
1824 similarity *= 0.9;
1825
1826 if( m_length != other->m_length )
1827 similarity *= 0.9;
1828
1829 if( m_orientation != other->m_orientation )
1830 similarity *= 0.9;
1831
1832 if( m_shape != other->m_shape )
1833 similarity *= 0.9;
1834
1835 if( m_type != other->m_type )
1836 similarity *= 0.9;
1837
1838 if( m_hidden != other->m_hidden )
1839 similarity *= 0.9;
1840
1841 if( m_numTextSize != other->m_numTextSize )
1842 similarity *= 0.9;
1843
1844 if( m_nameTextSize != other->m_nameTextSize )
1845 similarity *= 0.9;
1846
1847 if( m_alternates.size() != other->m_alternates.size() )
1848 similarity *= 0.9;
1849
1850 return similarity;
1851}
1852
1853
1854std::ostream& SCH_PIN::operator<<( std::ostream& aStream )
1855{
1856 aStream << "SCH_PIN:" << std::endl
1857 << " Name: \"" << m_name << "\"" << std::endl
1858 << " Number: \"" << m_number << "\"" << std::endl
1859 << " Position: " << m_position << std::endl
1860 << " Length: " << GetLength() << std::endl
1861 << " Orientation: " << PinOrientationName( m_orientation ) << std::endl
1862 << " Shape: " << PinShapeGetText( m_shape ) << std::endl
1863 << " Type: " << ElectricalPinTypeGetText( m_type ) << std::endl
1864 << " Name Text Size: " << GetNameTextSize() << std::endl
1865 << " Number Text Size: " << GetNumberTextSize() << std::endl;
1866
1867 return aStream;
1868}
1869
1870
1871#if defined(DEBUG)
1872
1873void SCH_PIN::Show( int nestLevel, std::ostream& os ) const
1874{
1875 NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
1876 << " num=\"" << m_number.mb_str()
1877 << '"' << "/>\n";
1878}
1879
1880#endif
1881
1882
1883void SCH_PIN::CalcEdit( const VECTOR2I& aPosition )
1884{
1885 if( IsMoving() )
1886 SetPosition( aPosition );
1887}
1888
1889
1890static struct SCH_PIN_DESC
1891{
1893 {
1894 auto& pinTypeEnum = ENUM_MAP<ELECTRICAL_PINTYPE>::Instance();
1895
1896 if( pinTypeEnum.Choices().GetCount() == 0 )
1897 {
1898 pinTypeEnum.Map( ELECTRICAL_PINTYPE::PT_INPUT, _HKI( "Input" ) )
1899 .Map( ELECTRICAL_PINTYPE::PT_OUTPUT, _HKI( "Output" ) )
1900 .Map( ELECTRICAL_PINTYPE::PT_BIDI, _HKI( "Bidirectional" ) )
1901 .Map( ELECTRICAL_PINTYPE::PT_TRISTATE, _HKI( "Tri-state" ) )
1902 .Map( ELECTRICAL_PINTYPE::PT_PASSIVE, _HKI( "Passive" ) )
1903 .Map( ELECTRICAL_PINTYPE::PT_NIC, _HKI( "Free" ) )
1904 .Map( ELECTRICAL_PINTYPE::PT_UNSPECIFIED, _HKI( "Unspecified" ) )
1905 .Map( ELECTRICAL_PINTYPE::PT_POWER_IN, _HKI( "Power input" ) )
1906 .Map( ELECTRICAL_PINTYPE::PT_POWER_OUT, _HKI( "Power output" ) )
1907 .Map( ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR, _HKI( "Open collector" ) )
1908 .Map( ELECTRICAL_PINTYPE::PT_OPENEMITTER, _HKI( "Open emitter" ) )
1909 .Map( ELECTRICAL_PINTYPE::PT_NC, _HKI( "Unconnected" ) );
1910 }
1911
1912 auto& pinShapeEnum = ENUM_MAP<GRAPHIC_PINSHAPE>::Instance();
1913
1914 if( pinShapeEnum.Choices().GetCount() == 0 )
1915 {
1916 pinShapeEnum.Map( GRAPHIC_PINSHAPE::LINE, _HKI( "Line" ) )
1917 .Map( GRAPHIC_PINSHAPE::INVERTED, _HKI( "Inverted" ) )
1918 .Map( GRAPHIC_PINSHAPE::CLOCK, _HKI( "Clock" ) )
1919 .Map( GRAPHIC_PINSHAPE::INVERTED_CLOCK, _HKI( "Inverted clock" ) )
1920 .Map( GRAPHIC_PINSHAPE::INPUT_LOW, _HKI( "Input low" ) )
1921 .Map( GRAPHIC_PINSHAPE::CLOCK_LOW, _HKI( "Clock low" ) )
1922 .Map( GRAPHIC_PINSHAPE::OUTPUT_LOW, _HKI( "Output low" ) )
1923 .Map( GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK, _HKI( "Falling edge clock" ) )
1924 .Map( GRAPHIC_PINSHAPE::NONLOGIC, _HKI( "NonLogic" ) );
1925 }
1926
1927 auto& orientationEnum = ENUM_MAP<PIN_ORIENTATION>::Instance();
1928
1929 if( orientationEnum.Choices().GetCount() == 0 )
1930 {
1931 orientationEnum.Map( PIN_ORIENTATION::PIN_RIGHT, _HKI( "Right" ) )
1932 .Map( PIN_ORIENTATION::PIN_LEFT, _HKI( "Left" ) )
1933 .Map( PIN_ORIENTATION::PIN_UP, _HKI( "Up" ) )
1934 .Map( PIN_ORIENTATION::PIN_DOWN, _HKI( "Down" ) );
1935 }
1936
1937 auto isSymbolEditor =
1938 []( INSPECTABLE* aItem ) -> bool
1939 {
1940 if( SCH_PIN* pin = dynamic_cast<SCH_PIN*>( aItem ) )
1941 return dynamic_cast<LIB_SYMBOL*>( pin->GetParentSymbol() ) != nullptr;
1942
1943 return false;
1944 };
1945
1950
1951 propMgr.AddProperty( new PROPERTY<SCH_PIN, wxString>( _HKI( "Pin Name" ),
1953 .SetWriteableFunc( isSymbolEditor );
1954
1955 propMgr.AddProperty( new PROPERTY<SCH_PIN, wxString>( _HKI( "Pin Number" ),
1957 .SetWriteableFunc( isSymbolEditor );
1958
1959 propMgr.AddProperty( new PROPERTY_ENUM<SCH_PIN, ELECTRICAL_PINTYPE>( _HKI( "Electrical Type" ),
1961 .SetWriteableFunc( isSymbolEditor );
1962
1963 propMgr.AddProperty( new PROPERTY_ENUM<SCH_PIN, GRAPHIC_PINSHAPE>( _HKI( "Graphic Style" ),
1965 .SetWriteableFunc( isSymbolEditor );
1966
1967 propMgr.AddProperty( new PROPERTY<SCH_PIN, int>( _HKI( "Position X" ),
1969 .SetAvailableFunc( isSymbolEditor );
1970
1971 propMgr.AddProperty( new PROPERTY<SCH_PIN, int>( _HKI( "Position Y" ),
1973 .SetAvailableFunc( isSymbolEditor );
1974
1975 propMgr.AddProperty( new PROPERTY_ENUM<SCH_PIN, PIN_ORIENTATION>( _HKI( "Orientation" ),
1977 .SetWriteableFunc( isSymbolEditor );
1978
1979 propMgr.AddProperty( new PROPERTY<SCH_PIN, int>( _HKI( "Length" ),
1982 .SetWriteableFunc( isSymbolEditor );
1983
1984 propMgr.AddProperty( new PROPERTY<SCH_PIN, int>( _HKI( "Name Text Size" ),
1987 .SetAvailableFunc( isSymbolEditor );
1988
1989 propMgr.AddProperty( new PROPERTY<SCH_PIN, int>( _HKI( "Number Text Size" ),
1992 .SetAvailableFunc( isSymbolEditor );
1993
1994 propMgr.AddProperty( new PROPERTY<SCH_PIN, bool>( _HKI( "Visible" ),
1996 .SetAvailableFunc( isSymbolEditor );
1997
1998 }
2000
2001
const char * name
constexpr EDA_IU_SCALE schIUScale
Definition base_units.h:114
BITMAPS
A list of all bitmap identifiers.
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition box2.h:990
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition box2.h:558
constexpr bool Contains(const Vec &aPoint) const
Definition box2.h:168
constexpr bool Intersects(const BOX2< Vec > &aRect) const
Definition box2.h:311
static const COLOR4D WHITE
Definition color4d.h:405
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:402
The base class for create windows for drawing purpose.
const KIID m_Uuid
Definition eda_item.h:516
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
EDA_ITEM_FLAGS m_flags
Definition eda_item.h:527
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition eda_item.h:401
EDA_ITEM * GetParent() const
Definition eda_item.h:112
EDA_ITEM * m_parent
Owner.
Definition eda_item.h:528
static bool Replace(const EDA_SEARCH_DATA &aSearchData, wxString &aText)
Perform a text replace on aText using the find and replace criteria in aSearchData on items that supp...
Definition eda_item.cpp:236
bool IsMoving() const
Definition eda_item.h:125
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:39
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition eda_text.h:98
static ENUM_MAP< T > & Instance()
Definition property.h:721
Class that other classes need to inherit from, in order to be inspectable.
Definition inspectable.h:37
FONT is an abstract base class for both outline and stroke fonts.
Definition font.h:131
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
Definition font.cpp:147
VECTOR2I StringBoundaryLimits(const wxString &aText, const VECTOR2I &aSize, int aThickness, bool aBold, bool aItalic, const METRICS &aFontMetrics) const
Compute the boundary limits of aText (the bounding box of all shapes).
Definition font.cpp:427
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:105
std::optional< wxString > m_text
Definition color4d.h:399
COLOR4D & Desaturate()
Removes color (in HSL model)
Definition color4d.cpp:520
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Definition color4d.h:296
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
const wxString & GetDefaultFont() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
virtual const COLOR4D & GetBackgroundColor() const =0
Return current background color settings.
Definition kiid.h:49
wxString AsString() const
Definition kiid.cpp:246
Define a library symbol object.
Definition lib_symbol.h:83
Definition line.h:36
A pin layout helper is a class that manages the layout of the parts of a pin on a schematic symbol:
Base plotter engine class.
Definition plotter.h:136
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width)=0
void MoveTo(const VECTOR2I &pos)
Definition plotter.h:308
void FinishTo(const VECTOR2I &pos)
Definition plotter.h:318
RENDER_SETTINGS * RenderSettings()
Definition plotter.h:167
bool GetColorMode() const
Definition plotter.h:164
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
void LineTo(const VECTOR2I &pos)
Definition plotter.h:313
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont=nullptr, const KIFONT::METRICS &aFontMetrics=KIFONT::METRICS::Default(), void *aData=nullptr)
Definition plotter.cpp:696
virtual void SetColor(const COLOR4D &color)=0
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
Definition property.h:262
PROPERTY_BASE & SetWriteableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Definition property.h:287
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.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
wxString GetNetName() const
void AppendInfoToMsgPanel(std::vector< MSG_PANEL_ITEM > &aList) const
Adds information about the connection object to aList.
Schematic editor (Eeschema) main window.
SCH_SHEET_PATH & GetCurrentSheet() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:167
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 sch_item.cpp:779
int m_unit
Definition sch_item.h:756
SCH_ITEM & operator=(const SCH_ITEM &aPin)
Definition sch_item.cpp:78
int m_bodyStyle
Definition sch_item.h:757
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
Definition sch_item.h:704
const SYMBOL * GetParentSymbol() const
Definition sch_item.cpp:253
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
Definition sch_item.cpp:247
int GetBodyStyle() const
Definition sch_item.h:247
friend class LIB_SYMBOL
Definition sch_item.h:775
@ SKIP_TST_POS
Definition sch_item.h:687
int GetUnit() const
Definition sch_item.h:238
virtual int compare(const SCH_ITEM &aOther, int aCompareFlags=0) const
Provide the draw object specific comparison called by the == and < operators.
Definition sch_item.cpp:674
bool IsConnectivityDirty() const
Definition sch_item.h:570
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:54
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
Definition sch_item.cpp:449
wxString ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
Definition sch_item.cpp:339
const KIFONT::METRICS & GetFontMetrics() const
Definition sch_item.cpp:735
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
Definition sch_item.cpp:744
SCH_LAYER_ID m_layer
Definition sch_item.h:755
double SimilarityBase(const SCH_ITEM &aItem) const
Calculate the boilerplate similarity for all LIB_ITEMs without preventing the use above of a pure vir...
Definition sch_item.h:362
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW=true) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition sch_pin.cpp:1343
std::ostream & operator<<(std::ostream &aStream)
Definition sch_pin.cpp:1854
void SetAlt(const wxString &aAlt)
Set the name of the alternate pin.
Definition sch_pin.cpp:433
void PlotPinTexts(PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIENTATION aPinOrient, int aTextInside, bool aDrawPinNum, bool aDrawPinName, bool aDimmed) const
Plot the pin name and number.
Definition sch_pin.cpp:877
int GetNumberTextSize() const
Definition sch_pin.cpp:679
int GetLength() const
Definition sch_pin.cpp:299
std::optional< bool > m_hidden
Definition sch_pin.h:399
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
Definition sch_pin.cpp:499
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 sch_pin.cpp:1371
std::unique_ptr< PIN_LAYOUT_CACHE > m_layoutCache
The layout cache for this pin.
Definition sch_pin.h:415
void MirrorVerticallyPin(int aCenter)
Definition sch_pin.cpp:1292
void validateExtentsCache(KIFONT::FONT *aFont, int aSize, const wxString &aText, EXTENTS_CACHE *aCache) const
Definition sch_pin.cpp:1553
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition sch_pin.cpp:1540
std::vector< int > ViewGetLayers() const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition sch_pin.cpp:1546
void CalcEdit(const VECTOR2I &aPosition) override
Calculate the attributes of an item at aPosition when it is being edited.
Definition sch_pin.cpp:1883
void SetNumber(const wxString &aNumber)
Definition sch_pin.cpp:642
std::optional< int > m_nameTextSize
Definition sch_pin.h:403
PIN_ORIENTATION PinDrawOrient(const TRANSFORM &aTransform) const
Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), according to its orientation...
Definition sch_pin.cpp:1194
void SetVisible(bool aVisible)
Definition sch_pin.h:114
int GetX() const
Definition sch_pin.h:254
void ChangeLength(int aLength)
Change the length of a pin and adjust its position based on orientation.
Definition sch_pin.cpp:1238
void SetX(int aX)
Definition sch_pin.h:255
bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const override
Check if aItem has connectivity changes against this object.
Definition sch_pin.cpp:1583
SCH_PIN & operator=(const SCH_PIN &aPin)
Definition sch_pin.cpp:233
wxString GetShownNumber() const
Definition sch_pin.cpp:588
SCH_PIN * m_libPin
Definition sch_pin.h:388
std::optional< wxString > GetSmallestLogicalNumber() const
Return the smallest logical pin number if this pin uses stacked notation and it is valid.
Definition sch_pin.cpp:621
void Move(const VECTOR2I &aOffset) override
Move the item by aMoveVector to a new position.
Definition sch_pin.cpp:1266
std::map< const SCH_SHEET_PATH, std::pair< wxString, bool > > m_net_name_map
Definition sch_pin.h:419
PIN_ORIENTATION m_orientation
Definition sch_pin.h:396
void SetOrientation(PIN_ORIENTATION aOrientation)
Definition sch_pin.h:93
void SetName(const wxString &aName)
Definition sch_pin.cpp:419
bool IsGlobalPower() const
Return whether this pin forms a global power connection: i.e., is part of a power symbol and of type ...
Definition sch_pin.cpp:367
wxString getItemDescription(ALT *aAlt) const
Definition sch_pin.cpp:1653
bool IsVisible() const
Definition sch_pin.cpp:387
bool ConnectionPropagatesTo(const EDA_ITEM *aItem) const override
Return true if this item should propagate connection info to aItem.
Definition sch_pin.cpp:1605
std::optional< int > m_numTextSize
Definition sch_pin.h:402
VECTOR2I GetPinRoot() const
Definition sch_pin.cpp:703
bool IsLocalPower() const
Local power pin is the same except that it is sheet-local and it does not support the legacy hidden p...
Definition sch_pin.cpp:374
ELECTRICAL_PINTYPE m_type
Definition sch_pin.h:398
wxString GetEffectivePadNumber() const
Return the pin number to be used for deterministic operations such as auto‑generated net names.
Definition sch_pin.cpp:633
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition sch_pin.cpp:1305
SCH_PIN * GetLibPin() const
Definition sch_pin.h:89
void SetPosition(const VECTOR2I &aPos) override
Definition sch_pin.h:251
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
Definition sch_pin.cpp:1794
bool m_isDangling
Definition sch_pin.h:408
void SetIsDangling(bool aIsDangling)
Definition sch_pin.cpp:470
wxString GetElectricalTypeName() const
Definition sch_pin.cpp:355
std::vector< wxString > GetStackedPinNumbers(bool *aValid=nullptr) const
Definition sch_pin.cpp:594
std::map< wxString, ALT > m_alternates
Definition sch_pin.h:391
const wxString & GetName() const
Definition sch_pin.cpp:401
int GetStackedPinCount(bool *aValid=nullptr) const
Return the count of logical pins represented by this pin's stacked notation.
Definition sch_pin.cpp:614
bool IsDangling() const override
Definition sch_pin.cpp:461
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
Definition sch_pin.cpp:1350
void MirrorHorizontally(int aCenter) override
These transforms have effect only if the pin has a LIB_SYMBOL as parent.
Definition sch_pin.cpp:1285
std::recursive_mutex m_netmap_mutex
The name that this pin connection will drive onto a net.
Definition sch_pin.h:418
PIN_ORIENTATION GetOrientation() const
Definition sch_pin.cpp:264
wxString GetClass() const override
Return the class name.
Definition sch_pin.h:74
void SetNumberTextSize(int aSize)
Definition sch_pin.cpp:693
void SetShape(GRAPHIC_PINSHAPE aShape)
Definition sch_pin.h:96
void RotatePin(const VECTOR2I &aCenter, bool aRotateCCW=true)
Definition sch_pin.cpp:1312
VECTOR2I GetPosition() const override
Definition sch_pin.cpp:256
wxString GetCanonicalElectricalTypeName() const
Definition sch_pin.cpp:343
bool Replace(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) override
Perform a text replace using the find and replace criteria in aSearchData on items that support text ...
Definition sch_pin.cpp:526
int GetNameTextSize() const
Definition sch_pin.cpp:655
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition sch_pin.cpp:1626
VECTOR2I m_position
Definition sch_pin.h:394
GRAPHIC_PINSHAPE m_shape
Definition sch_pin.h:397
int compare(const SCH_ITEM &aOther, int aCompareFlags=0) const override
The pin specific sort order is as follows:
Definition sch_pin.cpp:1698
wxString GetShownName() const
Definition sch_pin.cpp:577
void MirrorHorizontallyPin(int aCenter)
These transforms have always effects.
Definition sch_pin.cpp:1272
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition sch_pin.cpp:547
wxString m_name
Definition sch_pin.h:400
wxString m_alt
Definition sch_pin.h:404
void SetType(ELECTRICAL_PINTYPE aType)
Definition sch_pin.cpp:333
const wxString & GetBaseName() const
Get the name without any alternates.
Definition sch_pin.cpp:410
void ClearDefaultNetName(const SCH_SHEET_PATH *aPath)
Definition sch_pin.cpp:1419
void SetY(int aY)
Definition sch_pin.h:257
SCH_PIN(LIB_SYMBOL *aParentSymbol)
Definition sch_pin.cpp:118
bool IsStacked(const SCH_PIN *aPin) const
Definition sch_pin.cpp:476
const wxString & GetNumber() const
Definition sch_pin.h:124
wxString m_number
Definition sch_pin.h:401
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition sch_pin.cpp:1229
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition sch_pin.h:215
wxString GetDefaultNetName(const SCH_SHEET_PATH &aPath, bool aForceNoConnect=false)
Definition sch_pin.cpp:1430
std::optional< int > m_length
Definition sch_pin.h:395
GRAPHIC_PINSHAPE GetShape() const
Definition sch_pin.cpp:278
void PlotPinType(PLOTTER *aPlotter, const VECTOR2I &aPosition, PIN_ORIENTATION aOrientation, bool aDimmed) const
Definition sch_pin.cpp:726
int GetY() const
Definition sch_pin.h:256
bool IsPower() const
Check if the pin is either a global or local power pin.
Definition sch_pin.cpp:381
ELECTRICAL_PINTYPE GetType() const
Definition sch_pin.cpp:313
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition sch_pin.cpp:1611
void SetNameTextSize(int aSize)
Definition sch_pin.cpp:669
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
const KIGFX::COLOR4D & GetBackgroundColor() const override
Return current background color settings.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Schematic symbol object.
Definition sch_symbol.h:76
const wxString GetValue(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const override
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
A base class for LIB_SYMBOL and SCH_SYMBOL.
Definition symbol.h:63
virtual bool IsGlobalPower() const =0
virtual bool IsLocalPower() const =0
virtual const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const =0
int GetPinNameOffset() const
Definition symbol.h:160
virtual bool GetShowPinNames() const
Definition symbol.h:166
virtual bool GetShowPinNumbers() const
Definition symbol.h:172
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
for transforming drawing coordinates for a wxDC device context.
Definition transform.h:46
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition transform.cpp:44
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
#define DEFAULT_PINNUM_SIZE
The default pin name size when creating pins(can be changed in preference menu)
#define DEFAULT_PINNAME_SIZE
The default selection highlight thickness (can be changed in preference menu)
#define DEFAULT_PIN_LENGTH
The default pin number size when creating pins(can be changed in preference menu)
#define _(s)
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
#define STRUCT_DELETED
flag indication structures to be erased
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define SHOW_ELEC_TYPE
Show pin electrical type.
@ NO_FILL
Definition eda_shape.h:57
int GetPenSizeForNormal(int aTextSize)
Definition gr_text.cpp:61
const wxChar *const traceStackedPins
Flag to enable debug output for stacked pins handling in symbol/pin code.
@ LAYER_DANGLING
Definition layer_ids.h:477
@ LAYER_PINNUM
Definition layer_ids.h:458
@ LAYER_DEVICE
Definition layer_ids.h:466
@ LAYER_PINNAM
Definition layer_ids.h:459
@ LAYER_PIN
Definition layer_ids.h:470
@ LAYER_OP_CURRENTS
Definition layer_ids.h:502
@ LAYER_SELECTION_SHADOWS
Definition layer_ids.h:495
STL namespace.
#define _HKI(x)
Definition page_info.cpp:44
see class PGM_BASE
static int externalPinDecoSize(const SCHEMATIC_SETTINGS *aSettings, const SCH_PIN &aPin)
static int internalPinDecoSize(const SCHEMATIC_SETTINGS *aSettings, const SCH_PIN &aPin)
wxString FormatStackedPinForDisplay(const wxString &aPinNumber, int aPinLength, int aTextSize, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics)
Definition sch_pin.cpp:43
wxString PinShapeGetText(GRAPHIC_PINSHAPE shape)
Definition pin_type.cpp:235
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
Definition pin_type.h:36
@ PT_INPUT
usual pin input: must be connected
Definition pin_type.h:37
@ PT_NC
not connected (must be left open)
Definition pin_type.h:50
@ PT_OUTPUT
usual output
Definition pin_type.h:38
@ PT_TRISTATE
tri state bus pin
Definition pin_type.h:40
@ PT_NIC
not internally connected (may be connected to anything)
Definition pin_type.h:44
@ PT_BIDI
input or output (like port for a microprocessor)
Definition pin_type.h:39
@ PT_OPENEMITTER
pin type open emitter
Definition pin_type.h:49
@ PT_POWER_OUT
output of a regulator: intended to be connected to power input pins
Definition pin_type.h:47
@ PT_OPENCOLLECTOR
pin type open collector
Definition pin_type.h:48
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.
Definition pin_type.h:46
@ PT_UNSPECIFIED
unknown electrical properties: creates always a warning when connected
Definition pin_type.h:45
@ PT_PASSIVE
pin for passive symbols: must be connected, and can be connected to any pin.
Definition pin_type.h:43
BITMAPS ElectricalPinTypeGetBitmap(ELECTRICAL_PINTYPE)
Definition pin_type.cpp:221
wxString ElectricalPinTypeGetText(ELECTRICAL_PINTYPE)
Definition pin_type.cpp:207
wxString PinOrientationName(PIN_ORIENTATION aOrientation)
Definition pin_type.cpp:263
PIN_ORIENTATION
The symbol library pin object orientations.
Definition pin_type.h:105
@ PIN_UP
The pin extends upwards from the connection point: Probably on the bottom side of the symbol.
Definition pin_type.h:127
@ PIN_RIGHT
The pin extends rightwards from the connection point.
Definition pin_type.h:111
@ PIN_LEFT
The pin extends leftwards from the connection point: Probably on the right side of the symbol.
Definition pin_type.h:118
@ PIN_DOWN
The pin extends downwards from the connection: Probably on the top side of the symbol.
Definition pin_type.h:135
GRAPHIC_PINSHAPE
Definition pin_type.h:84
#define TYPE_HASH(x)
Definition property.h:74
#define ENUM_TO_WXANY(type)
Macro to define read-only fields (no setter method available)
Definition property.h:823
@ PT_COORD
Coordinate expressed in distance units (mm/inch)
Definition property.h:65
@ PT_SIZE
Size expressed in distance units (mm/inch)
Definition property.h:63
#define REGISTER_TYPE(x)
wxString FormatStackedPinForDisplay(const wxString &aPinNumber, int aPinLength, int aTextSize, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics)
Definition sch_pin.cpp:43
static int externalPinDecoSize(const RENDER_SETTINGS *aSettings, const SCH_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius) i.e.
Definition sch_pin.cpp:107
#define PIN_TEXT_MARGIN
Definition sch_pin.cpp:88
static int internalPinDecoSize(const RENDER_SETTINGS *aSettings, const SCH_PIN &aPin)
Utility for getting the size of the 'internal' pin decorators (as a radius) i.e.
Definition sch_pin.cpp:93
static struct SCH_PIN_DESC _SCH_PIN_DESC
#define TARGET_PIN_RADIUS
Definition sch_pin.h:37
T * GetAppSettings(const char *aFilename)
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
std::vector< wxString > ExpandStackedPinNotation(const wxString &aPinName, bool *aValid)
Expand stacked pin notation like [1,2,3], [1-4], [A1-A4], or [AA1-AA3,AB4,CD12-CD14] into individual ...
wxString UnescapeString(const wxString &aSource)
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
int CountStackedPinNotation(const wxString &aPinName, bool *aValid)
Count the number of pins represented by stacked pin notation without allocating strings.
@ CTX_NETNAME
wxString m_Name
Definition sch_pin.h:45
GRAPHIC_PINSHAPE m_Shape
Definition sch_pin.h:46
ELECTRICAL_PINTYPE m_Type
Definition sch_pin.h:47
KIFONT::FONT * m_Font
Definition sch_pin.h:358
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
KIBIS top(path, &reporter)
KIBIS_PIN * pin
int radius
VECTOR2I end
wxString result
Test unit parsing edge cases and error handling.
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
@ GR_TEXT_H_ALIGN_CENTER
@ GR_TEXT_H_ALIGN_RIGHT
@ GR_TEXT_H_ALIGN_LEFT
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
@ GR_TEXT_V_ALIGN_BOTTOM
@ GR_TEXT_V_ALIGN_CENTER
@ GR_TEXT_V_ALIGN_TOP
wxLogTrace helper definitions.
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:229
@ SCH_PIN_T
Definition typeinfo.h:157
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695
VECTOR2< double > VECTOR2D
Definition vector2d.h:694