KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_label.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) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#include <base_units.h>
27#include <pgm_base.h>
28#include <sch_edit_frame.h>
29#include <plotters/plotter.h>
30#include <widgets/msgpanel.h>
31#include <bitmaps.h>
32#include <string_utils.h>
33#include <schematic.h>
35#include <sch_painter.h>
36#include <default_values.h>
37#include <wx/debug.h>
38#include <wx/log.h>
42#include <core/kicad_algo.h>
43#include <core/mirror.h>
44#include <trigo.h>
45#include <sch_label.h>
46
48
49
50bool IncrementLabelMember( wxString& name, int aIncrement )
51{
52 if( name.IsEmpty() )
53 return true;
54
55 wxString suffix;
56 wxString digits;
57 wxString outputFormat;
58 wxString outputNumber;
59 int ii = name.Len() - 1;
60 int dCount = 0;
61
62 while( ii >= 0 && !wxIsdigit( name.GetChar( ii ) ) )
63 {
64 suffix = name.GetChar( ii ) + suffix;
65 ii--;
66 }
67
68 while( ii >= 0 && wxIsdigit( name.GetChar( ii ) ) )
69 {
70 digits = name.GetChar( ii ) + digits;
71 ii--;
72 dCount++;
73 }
74
75 if( digits.IsEmpty() )
76 return true;
77
78 long number = 0;
79
80 if( digits.ToLong( &number ) )
81 {
82 number += aIncrement;
83
84 // Don't let result go below zero
85
86 if( number > -1 )
87 {
88 name.Remove( ii + 1 );
89 //write out a format string with correct number of leading zeroes
90 outputFormat.Printf( wxS( "%%0%dld" ), dCount );
91 //write out the number using the format string
92 outputNumber.Printf( outputFormat, number );
93 name << outputNumber << suffix;
94 return true;
95 }
96 }
97
98 return false;
99}
100
101
102/* Coding polygons for global symbol graphic shapes.
103 * the first parml is the number of corners
104 * others are the corners coordinates in reduced units
105 * the real coordinate is the reduced coordinate * text half size
106 */
107static int TemplateIN_HN[] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 };
108static int TemplateIN_HI[] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 };
109static int TemplateIN_UP[] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 };
110static int TemplateIN_BOTTOM[] = { 6, 0, 0, 1, 1, 1, 2, -1, 2, -1, 1, 0, 0 };
111
112static int TemplateOUT_HN[] = { 6, -2, 0, -1, 1, 0, 1, 0, -1, -1, -1, -2, 0 };
113static int TemplateOUT_HI[] = { 6, 2, 0, 1, -1, 0, -1, 0, 1, 1, 1, 2, 0 };
114static int TemplateOUT_UP[] = { 6, 0, -2, 1, -1, 1, 0, -1, 0, -1, -1, 0, -2 };
115static int TemplateOUT_BOTTOM[] = { 6, 0, 2, 1, 1, 1, 0, -1, 0, -1, 1, 0, 2 };
116
117static int TemplateUNSPC_HN[] = { 5, 0, -1, -2, -1, -2, 1, 0, 1, 0, -1 };
118static int TemplateUNSPC_HI[] = { 5, 0, -1, 2, -1, 2, 1, 0, 1, 0, -1 };
119static int TemplateUNSPC_UP[] = { 5, 1, 0, 1, -2, -1, -2, -1, 0, 1, 0 };
120static int TemplateUNSPC_BOTTOM[] = { 5, 1, 0, 1, 2, -1, 2, -1, 0, 1, 0 };
121
122static int TemplateBIDI_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
123static int TemplateBIDI_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
124static int TemplateBIDI_UP[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
125static int TemplateBIDI_BOTTOM[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
126
127static int Template3STATE_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
128static int Template3STATE_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
129static int Template3STATE_UP[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
130static int Template3STATE_BOTTOM[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
131
132static int* TemplateShape[5][4] =
133{
139};
140
141
143{
144 switch( aType )
145 {
146 case LABEL_FLAG_SHAPE::L_INPUT: return _( "Input" );
147 case LABEL_FLAG_SHAPE::L_OUTPUT: return _( "Output" );
148 case LABEL_FLAG_SHAPE::L_BIDI: return _( "Bidirectional" );
149 case LABEL_FLAG_SHAPE::L_TRISTATE: return _( "Tri-State" );
150 case LABEL_FLAG_SHAPE::L_UNSPECIFIED: return _( "Passive" );
151 default: return wxT( "???" );
152 }
153}
154
155
157{
158 SPIN newSpin = m_spin;
159
160 switch( m_spin )
161 {
162 case SPIN_STYLE::LEFT: newSpin = SPIN_STYLE::BOTTOM; break;
163 case SPIN_STYLE::BOTTOM: newSpin = SPIN_STYLE::RIGHT; break;
164 case SPIN_STYLE::RIGHT: newSpin = SPIN_STYLE::UP; break;
165 case SPIN_STYLE::UP: newSpin = SPIN_STYLE::LEFT; break;
166 }
167
168 return SPIN_STYLE( newSpin );
169}
170
171
173{
174 SPIN newSpin = m_spin;
175
176 switch( m_spin )
177 {
178 case SPIN_STYLE::UP: newSpin = SPIN_STYLE::BOTTOM; break;
179 case SPIN_STYLE::BOTTOM: newSpin = SPIN_STYLE::UP; break;
180 case SPIN_STYLE::LEFT: break;
181 case SPIN_STYLE::RIGHT: break;
182 }
183
184 return SPIN_STYLE( newSpin );
185}
186
187
189{
190 SPIN newSpin = m_spin;
191
192 switch( m_spin )
193 {
194 case SPIN_STYLE::LEFT: newSpin = SPIN_STYLE::RIGHT; break;
195 case SPIN_STYLE::RIGHT: newSpin = SPIN_STYLE::LEFT; break;
196 case SPIN_STYLE::UP: break;
197 case SPIN_STYLE::BOTTOM: break;
198 }
199
200 return SPIN_STYLE( newSpin );
201}
202
203
204SCH_LABEL_BASE::SCH_LABEL_BASE( const VECTOR2I& aPos, const wxString& aText, KICAD_T aType ) :
205 SCH_TEXT( aPos, aText, aType ),
206 m_shape( L_UNSPECIFIED ),
207 m_connectionType( CONNECTION_TYPE::NONE ),
208 m_isDangling( true ),
209 m_lastResolvedColor( COLOR4D::UNSPECIFIED )
210{
211 SetMultilineAllowed( false );
212 ClearFieldsAutoplaced(); // fields are not yet autoplaced.
213
214 if( !HasTextVars() )
216}
217
218
220 SCH_TEXT( aLabel ),
221 m_shape( aLabel.m_shape ),
222 m_connectionType( aLabel.m_connectionType ),
223 m_isDangling( aLabel.m_isDangling ),
224 m_lastResolvedColor( aLabel.m_lastResolvedColor ),
225 m_cached_driver_name( aLabel.m_cached_driver_name )
226{
227 SetMultilineAllowed( false );
228
229 m_fields = aLabel.m_fields;
230
231 for( SCH_FIELD& field : m_fields )
232 field.SetParent( this );
233}
234
235
237{
238 SCH_TEXT::operator=( aLabel );
239
241
242 return *this;
243}
244
245
246const wxString SCH_LABEL_BASE::GetDefaultFieldName( const wxString& aName, bool aUseDefaultName )
247{
248 if( aName == wxT( "Intersheetrefs" ) )
249 return _( "Sheet References" );
250 else if( aName == wxT( "Netclass" ) )
251 return _( "Net Class" );
252 else if( aName.IsEmpty() && aUseDefaultName )
253 return _( "Field" );
254 else
255 return aName;
256}
257
258
259bool SCH_LABEL_BASE::IsType( const std::vector<KICAD_T>& aScanTypes ) const
260{
261 if( SCH_TEXT::IsType( aScanTypes ) )
262 return true;
263
264 for( KICAD_T scanType : aScanTypes )
265 {
266 if( scanType == SCH_LABEL_LOCATE_ANY_T )
267 return true;
268 }
269
270 wxCHECK_MSG( Schematic(), false, wxT( "No parent SCHEMATIC set for SCH_LABEL!" ) );
271
272 // Ensure m_connected_items for Schematic()->CurrentSheet() exists.
273 // Can be not the case when "this" is living in clipboard
274 if( m_connected_items.find( Schematic()->CurrentSheet() ) == m_connected_items.end() )
275 return false;
276
277 const SCH_ITEM_SET& item_set = m_connected_items.at( Schematic()->CurrentSheet() );
278
279 for( KICAD_T scanType : aScanTypes )
280 {
281 if( scanType == SCH_LABEL_LOCATE_WIRE_T )
282 {
283 for( SCH_ITEM* connection : item_set )
284 {
285 if( connection->IsType( { SCH_ITEM_LOCATE_WIRE_T, SCH_PIN_T } ) )
286 return true;
287 }
288 }
289
290 if ( scanType == SCH_LABEL_LOCATE_BUS_T )
291 {
292 for( SCH_ITEM* connection : item_set )
293 {
294 if( connection->IsType( { SCH_ITEM_LOCATE_BUS_T } ) )
295 return true;
296 }
297 }
298 }
299
300 return false;
301}
302
303
305{
306 SCH_TEXT::SwapData( aItem );
307
308 SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( aItem );
309
310 m_fields.swap( label->m_fields );
311 std::swap( m_fieldsAutoplaced, label->m_fieldsAutoplaced );
312
313 for( SCH_FIELD& field : m_fields )
314 field.SetParent( this );
315
316 for( SCH_FIELD& field : label->m_fields )
317 field.SetParent( label );
318
319 std::swap( m_shape, label->m_shape );
320 std::swap( m_connectionType, label->m_connectionType );
321 std::swap( m_isDangling, label->m_isDangling );
322 std::swap( m_lastResolvedColor, label->m_lastResolvedColor );
323}
324
325
327{
328 if( GetTextColor() != COLOR4D::UNSPECIFIED )
330 else if( !IsConnectivityDirty() )
331 m_lastResolvedColor = GetEffectiveNetClass()->GetSchematicColor();
332
333 return m_lastResolvedColor;
334}
335
336
338{
339 // Assume "Right" and Left" mean which side of the anchor the text will be on
340 // Thus we want to left justify text up against the anchor if we are on the right
341 switch( aSpinStyle )
342 {
343 default:
344 wxFAIL_MSG( "Bad spin style" );
346
347 case SPIN_STYLE::RIGHT: // Horiz Normal Orientation
350 break;
351
352 case SPIN_STYLE::UP: // Vert Orientation UP
355 break;
356
357 case SPIN_STYLE::LEFT: // Horiz Orientation - Right justified
360 break;
361
362 case SPIN_STYLE::BOTTOM: // Vert Orientation BOTTOM
365 break;
366 }
367
369}
370
371
373{
375 {
377 return SPIN_STYLE::BOTTOM;
378 else
379 return SPIN_STYLE::UP;
380 }
381 else
382 {
384 return SPIN_STYLE::LEFT;
385 else
386 return SPIN_STYLE::RIGHT;
387 }
388}
389
390
392{
393 VECTOR2I text_offset;
394
395 // add an offset to x (or y) position to aid readability of text on a wire or line
396 int dist = GetTextOffset( aSettings ) + GetPenWidth();
397
398 switch( GetSpinStyle() )
399 {
400 case SPIN_STYLE::UP:
401 case SPIN_STYLE::BOTTOM: text_offset.x = -dist; break; // Vert Orientation
402 default:
403 case SPIN_STYLE::LEFT:
404 case SPIN_STYLE::RIGHT: text_offset.y = -dist; break; // Horiz Orientation
405 }
406
407 return text_offset;
408}
409
410void SCH_LABEL_BASE::SetPosition( const VECTOR2I& aPosition )
411{
412 VECTOR2I offset = aPosition - GetTextPos();
413 Move( offset );
414}
415
416
417void SCH_LABEL_BASE::Move( const VECTOR2I& aMoveVector )
418{
419 SCH_TEXT::Move( aMoveVector );
420
421 for( SCH_FIELD& field : m_fields )
422 field.Offset( aMoveVector );
423}
424
425
426void SCH_LABEL_BASE::Rotate( const VECTOR2I& aCenter )
427{
428 VECTOR2I pt = GetTextPos();
429 RotatePoint( pt, aCenter, ANGLE_90 );
430 VECTOR2I offset = pt - GetTextPos();
431
432 Rotate90( false );
433
434 SetTextPos( GetTextPos() + offset );
435
436 for( SCH_FIELD& field : m_fields )
437 field.SetTextPos( field.GetTextPos() + offset );
438}
439
440
441void SCH_LABEL_BASE::Rotate90( bool aClockwise )
442{
443 SCH_TEXT::Rotate90( aClockwise );
444
446 {
447 AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
448 }
449 else
450 {
451 for( SCH_FIELD& field : m_fields )
452 {
453 if( field.GetTextAngle().IsVertical()
454 && field.GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT )
455 {
456 if( !aClockwise )
457 field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
458
459 field.SetTextAngle( ANGLE_HORIZONTAL );
460 }
461 else if( field.GetTextAngle().IsVertical()
462 && field.GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
463 {
464 if( !aClockwise )
465 field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
466
467 field.SetTextAngle( ANGLE_HORIZONTAL );
468 }
469 else if( field.GetTextAngle().IsHorizontal()
470 && field.GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT )
471 {
472 if( aClockwise )
473 field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
474
475 field.SetTextAngle( ANGLE_VERTICAL );
476 }
477 else if( field.GetTextAngle().IsHorizontal()
478 && field.GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
479 {
480 if( aClockwise )
481 field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
482
483 field.SetTextAngle( ANGLE_VERTICAL );
484 }
485
486 VECTOR2I pos = field.GetTextPos();
487 RotatePoint( pos, GetPosition(), aClockwise ? -ANGLE_90 : ANGLE_90 );
488 field.SetTextPos( pos );
489 }
490 }
491}
492
493
494void SCH_LABEL_BASE::MirrorSpinStyle( bool aLeftRight )
495{
496 SCH_TEXT::MirrorSpinStyle( aLeftRight );
497
498 for( SCH_FIELD& field : m_fields )
499 {
500 if( ( aLeftRight && field.GetTextAngle().IsHorizontal() )
501 || ( !aLeftRight && field.GetTextAngle().IsVertical() ) )
502 {
503 if( field.GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT )
504 field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
505 else
506 field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
507 }
508
509 VECTOR2I pos = field.GetTextPos();
511
512 if( aLeftRight )
513 pos.x = GetPosition().x + delta.x;
514 else
515 pos.y = GetPosition().y + delta.y;
516
517 field.SetTextPos( pos );
518 }
519}
520
521
523{
524 VECTOR2I old_pos = GetPosition();
526
527 for( SCH_FIELD& field : m_fields )
528 {
529 switch( field.GetHorizJustify() )
530 {
532 field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
533 break;
534
536 break;
537
539 field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
540 break;
541 }
542
543 VECTOR2I pos = field.GetTextPos();
544 VECTOR2I delta = old_pos - pos;
545 pos.x = GetPosition().x + delta.x;
546
547 field.SetPosition( pos );
548 }
549}
550
551
553{
554 VECTOR2I old_pos = GetPosition();
556
557 for( SCH_FIELD& field : m_fields )
558 {
559 VECTOR2I pos = field.GetTextPos();
560 VECTOR2I delta = old_pos - pos;
561 pos.y = GetPosition().y + delta.y;
562
563 field.SetPosition( pos );
564 }
565}
566
567
568bool SCH_LABEL_BASE::IncrementLabel( int aIncrement )
569{
570 wxString text = GetText();
571
572 if( IncrementLabelMember( text, aIncrement ) )
573 {
574 SetText( text );
575 return true;
576 }
577
578 return false;
579}
580
581
582void SCH_LABEL_BASE::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
583{
584 int margin = GetTextOffset() * 2;
585 int labelLen = GetBodyBoundingBox().GetSizeMax();
586 int accumulated = GetTextHeight() / 2;
587
588 if( Type() == SCH_GLOBAL_LABEL_T )
589 accumulated += margin + GetPenWidth() + margin;
590
591 for( SCH_FIELD& field : m_fields )
592 {
593 VECTOR2I offset( 0, 0 );
594
595 switch( GetSpinStyle() )
596 {
597 default:
598 case SPIN_STYLE::LEFT:
599 field.SetTextAngle( ANGLE_HORIZONTAL );
600 field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
601
602 if( field.GetCanonicalName() == wxT( "Intersheetrefs" ) )
603 offset.x = - ( labelLen + margin );
604 else
605 offset.y = accumulated + field.GetTextHeight() / 2;
606
607 break;
608
609 case SPIN_STYLE::UP:
610 field.SetTextAngle( ANGLE_VERTICAL );
611 field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
612
613 if( field.GetCanonicalName() == wxT( "Intersheetrefs" ) )
614 offset.y = - ( labelLen + margin );
615 else
616 offset.x = accumulated + field.GetTextHeight() / 2;
617
618 break;
619
621 field.SetTextAngle( ANGLE_HORIZONTAL );
622 field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
623
624 if( field.GetCanonicalName() == wxT( "Intersheetrefs" ) )
625 offset.x = labelLen + margin;
626 else
627 offset.y = accumulated + field.GetTextHeight() / 2;
628
629 break;
630
632 field.SetTextAngle( ANGLE_VERTICAL );
633 field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
634
635 if( field.GetCanonicalName() == wxT( "Intersheetrefs" ) )
636 offset.y = labelLen + margin;
637 else
638 offset.x = accumulated + field.GetTextHeight() / 2;
639
640 break;
641 }
642
643 field.SetTextPos( GetTextPos() + offset );
644
645 if( field.GetCanonicalName() != wxT( "Intersheetrefs" ) )
646 accumulated += field.GetTextHeight() + margin;
647 }
648
650}
651
652
653void SCH_LABEL_BASE::GetIntersheetRefs( std::vector<std::pair<wxString, wxString>>* pages )
654{
655 wxCHECK( pages, /* void */ );
656
657 if( Schematic() )
658 {
659 auto it = Schematic()->GetPageRefsMap().find( GetText() );
660
661 if( it != Schematic()->GetPageRefsMap().end() )
662 {
663 std::vector<int> pageListCopy;
664
665 pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() );
666
667 if( !Schematic()->Settings().m_IntersheetRefsListOwnPage )
668 {
669 int currentPage = Schematic()->CurrentSheet().GetVirtualPageNumber();
670 alg::delete_matching( pageListCopy, currentPage );
671
672 if( pageListCopy.empty() )
673 return;
674 }
675
676 std::sort( pageListCopy.begin(), pageListCopy.end() );
677
678 std::map<int, wxString> sheetPages = Schematic()->GetVirtualPageToSheetPagesMap();
679 std::map<int, wxString> sheetNames = Schematic()->GetVirtualPageToSheetNamesMap();
680
681 for( int pageNum : pageListCopy )
682 pages->push_back( { sheetPages[ pageNum ], sheetNames[ pageNum ] } );
683 }
684 }
685}
686
687
688void SCH_LABEL_BASE::GetContextualTextVars( wxArrayString* aVars ) const
689{
690 for( const SCH_FIELD& field : m_fields )
691 aVars->push_back( field.GetCanonicalName().Upper() );
692
693 aVars->push_back( wxT( "OP" ) );
694 aVars->push_back( wxT( "CONNECTION_TYPE" ) );
695 aVars->push_back( wxT( "SHORT_NET_NAME" ) );
696 aVars->push_back( wxT( "NET_NAME" ) );
697 aVars->push_back( wxT( "NET_CLASS" ) );
698}
699
700
701bool SCH_LABEL_BASE::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token,
702 int aDepth ) const
703{
704 static wxRegEx operatingPoint( wxT( "^"
705 "OP"
706 "(.([0-9])?([a-zA-Z]*))?"
707 "$" ) );
708
709 if( !Schematic() )
710 return false;
711
712 if( operatingPoint.Matches( *token ) )
713 {
714 int precision = 3;
715 wxString precisionStr( operatingPoint.GetMatch( *token, 2 ) );
716 wxString range( operatingPoint.GetMatch( *token, 3 ) );
717
718 if( !precisionStr.IsEmpty() )
719 precision = precisionStr[0] - '0';
720
721 if( range.IsEmpty() )
722 range = wxS( "~V" );
723
724 const SCH_CONNECTION* connection = Connection();
725 *token = wxS( "?" );
726
727 if( connection )
728 *token = Schematic()->GetOperatingPoint( connection->Name( false ), precision, range );
729
730 return true;
731 }
732
733 if( token->Contains( ':' ) )
734 {
735 if( Schematic()->ResolveCrossReference( token, aDepth + 1 ) )
736 return true;
737 }
738
740 && token->IsSameAs( wxT( "CONNECTION_TYPE" ) ) )
741 {
742 const SCH_LABEL_BASE* label = static_cast<const SCH_LABEL_BASE*>( this );
743 *token = getElectricalTypeLabel( label->GetShape() );
744 return true;
745 }
746 else if( token->IsSameAs( wxT( "SHORT_NET_NAME" ) ) )
747 {
748 const SCH_CONNECTION* connection = Connection();
749 *token = wxEmptyString;
750
751 if( connection )
752 *token = connection->LocalName();
753
754 return true;
755 }
756 else if( token->IsSameAs( wxT( "NET_NAME" ) ) )
757 {
758 const SCH_CONNECTION* connection = Connection();
759 *token = wxEmptyString;
760
761 if( connection )
762 *token = connection->Name();
763
764 return true;
765 }
766 else if( token->IsSameAs( wxT( "NET_CLASS" ) ) )
767 {
768 const SCH_CONNECTION* connection = Connection();
769 *token = wxEmptyString;
770
771 if( connection )
772 *token = GetEffectiveNetClass()->GetName();
773
774 return true;
775 }
776
777 for( const SCH_FIELD& field : m_fields)
778 {
779 if( token->IsSameAs( field.GetName() ) )
780 {
781 *token = field.GetShownText( false, aDepth + 1 );
782 return true;
783 }
784 }
785
786 // See if parent can resolve it (these will recurse to ancestors)
787
788 if( Type() == SCH_SHEET_PIN_T && m_parent )
789 {
790 SCH_SHEET* sheet = static_cast<SCH_SHEET*>( m_parent );
791
792 if( sheet->ResolveTextVar( token, aDepth + 1 ) )
793 return true;
794 }
795 else if( aPath && aPath->Last() )
796 {
797 if( aPath->Last()->ResolveTextVar( aPath, token, aDepth + 1 ) )
798 return true;
799 }
800 else if( SCH_SHEET* sheet = Schematic()->CurrentSheet().Last() )
801 {
802 if( sheet->ResolveTextVar( aPath, token, aDepth + 1 ) )
803 return true;
804 }
805
806 return false;
807}
808
809
811{
812 return !HasTextVars();
813}
814
815
817{
819}
820
821
823{
825
826 if( !HasTextVars() )
828}
829
830
831wxString SCH_LABEL_BASE::GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
832 int aDepth ) const
833{
834 std::function<bool( wxString* )> textResolver =
835 [&]( wxString* token ) -> bool
836 {
837 return ResolveTextVar( aPath, token, aDepth );
838 };
839
840 wxString text = EDA_TEXT::GetShownText( aAllowExtraText, aDepth );
841
842 if( text == wxS( "~" ) ) // Legacy placeholder for empty string
843 {
844 text = wxS( "" );
845 }
846 else if( HasTextVars() )
847 {
848 if( aDepth < 10 )
849 text = ExpandTextVars( text, &textResolver );
850 }
851
852 return text;
853}
854
855
856void SCH_LABEL_BASE::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction )
857{
858 for( SCH_FIELD& field : m_fields )
859 aFunction( &field );
860}
861
862
863bool SCH_LABEL_BASE::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const
864{
865 return SCH_ITEM::Matches( UnescapeString( GetText() ), aSearchData );
866}
867
868
869bool SCH_LABEL_BASE::Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData )
870{
871 EDA_SEARCH_DATA localSearchData( aSearchData );
872 localSearchData.findString = EscapeString( aSearchData.findString, CTX_NETNAME );
873 localSearchData.replaceString = EscapeString( aSearchData.replaceString, CTX_NETNAME );
874
875 return EDA_TEXT::Replace( localSearchData );
876}
877
878
880 const std::vector<KICAD_T>& aScanTypes )
881{
882 if( IsType( aScanTypes ) )
883 {
884 if( INSPECT_RESULT::QUIT == aInspector( this, nullptr ) )
885 return INSPECT_RESULT::QUIT;
886 }
887
888 for( KICAD_T scanType : aScanTypes )
889 {
890 if( scanType == SCH_LOCATE_ANY_T || scanType == SCH_FIELD_T )
891 {
892 for( SCH_FIELD& field : m_fields )
893 {
894 if( INSPECT_RESULT::QUIT == aInspector( &field, this ) )
895 return INSPECT_RESULT::QUIT;
896 }
897 }
898 }
899
900 return INSPECT_RESULT::CONTINUE;
901}
902
903
904void SCH_LABEL_BASE::GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList )
905{
906 DANGLING_END_ITEM item( LABEL_END, this, GetTextPos() );
907 aItemList.push_back( item );
908}
909
910
911std::vector<VECTOR2I> SCH_LABEL_BASE::GetConnectionPoints() const
912{
913 return { GetTextPos() };
914}
915
916
917void SCH_LABEL_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
918{
919 aCount = 5;
920 aLayers[0] = LAYER_DANGLING;
921 aLayers[1] = LAYER_DEVICE;
922 aLayers[2] = LAYER_NETCLASS_REFS;
923 aLayers[3] = LAYER_FIELDS;
924 aLayers[4] = LAYER_SELECTION_SHADOWS;
925}
926
927
929{
930 double ratio;
931
932 if( aSettings )
933 ratio = static_cast<const SCH_RENDER_SETTINGS*>( aSettings )->m_LabelSizeRatio;
934 else if( Schematic() )
936 else
937 ratio = DEFAULT_LABEL_SIZE_RATIO; // For previews (such as in Preferences), etc.
938
939 return KiROUND( ratio * GetTextSize().y );
940}
941
942
944{
945 // build the bounding box of the label only, without taking into account its fields
946
947 BOX2I box;
948 std::vector<VECTOR2I> pts;
949
950 CreateGraphicShape( nullptr, pts, GetTextPos() );
951
952 for( const VECTOR2I& pt : pts )
953 box.Merge( pt );
954
956 box.Normalize();
957 return box;
958}
959
960
962{
963 // build the bounding box of the entire label, including its fields
964
966
967 for( const SCH_FIELD& field : m_fields )
968 {
969 if( field.IsVisible() )
970 {
971 BOX2I fieldBBox = field.GetBoundingBox();
972
973 if( Type() == SCH_LABEL_T || Type() == SCH_GLOBAL_LABEL_T )
974 fieldBBox.Offset( GetSchematicTextOffset( nullptr ) );
975
976 box.Merge( fieldBBox );
977 }
978 }
979
980 box.Normalize();
981
982 return box;
983}
984
985
986bool SCH_LABEL_BASE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
987{
988 BOX2I bbox = GetBodyBoundingBox();
989 bbox.Inflate( aAccuracy );
990
991 if( bbox.Contains( aPosition ) )
992 return true;
993
994 for( const SCH_FIELD& field : m_fields )
995 {
996 if( field.IsVisible() )
997 {
998 BOX2I fieldBBox = field.GetBoundingBox();
999 fieldBBox.Inflate( aAccuracy );
1000
1001 if( Type() == SCH_LABEL_T || Type() == SCH_GLOBAL_LABEL_T )
1002 fieldBBox.Offset( GetSchematicTextOffset( nullptr ) );
1003
1004 if( fieldBBox.Contains( aPosition ) )
1005 return true;
1006 }
1007 }
1008
1009 return false;
1010}
1011
1012
1013bool SCH_LABEL_BASE::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
1014{
1015 BOX2I rect = aRect;
1016
1017 rect.Inflate( aAccuracy );
1018
1019 if( aContained )
1020 {
1021 return rect.Contains( GetBoundingBox() );
1022 }
1023 else
1024 {
1025 if( rect.Intersects( GetBodyBoundingBox() ) )
1026 return true;
1027
1028 for( const SCH_FIELD& field : m_fields )
1029 {
1030 if( field.IsVisible() )
1031 {
1032 BOX2I fieldBBox = field.GetBoundingBox();
1033
1034 if( Type() == SCH_LABEL_T || Type() == SCH_GLOBAL_LABEL_T )
1035 fieldBBox.Offset( GetSchematicTextOffset( nullptr ) );
1036
1037 if( rect.Intersects( fieldBBox ) )
1038 return true;
1039 }
1040 }
1041
1042 return false;
1043 }
1044}
1045
1046
1047bool SCH_LABEL_BASE::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
1048 const SCH_SHEET_PATH* aPath )
1049{
1050 bool previousState = m_isDangling;
1051 m_isDangling = true;
1052 m_connectionType = CONNECTION_TYPE::NONE;
1053
1054 for( unsigned ii = 0; ii < aItemList.size(); ii++ )
1055 {
1056 DANGLING_END_ITEM& item = aItemList[ii];
1057
1058 if( item.GetItem() == this )
1059 continue;
1060
1061 switch( item.GetType() )
1062 {
1063 case PIN_END:
1064 case LABEL_END:
1065 case SHEET_LABEL_END:
1066 case NO_CONNECT_END:
1067 if( GetTextPos() == item.GetPosition() )
1068 {
1069 m_isDangling = false;
1070
1071 if( aPath && item.GetType() != PIN_END )
1072 AddConnectionTo( *aPath, static_cast<SCH_ITEM*>( item.GetItem() ) );
1073 }
1074
1075 break;
1076
1077 case BUS_END:
1078 m_connectionType = CONNECTION_TYPE::BUS;
1080
1081 case WIRE_END:
1082 {
1083 DANGLING_END_ITEM& nextItem = aItemList[++ii];
1084
1085 int accuracy = 1; // We have rounding issues with an accuracy of 0
1086
1088 nextItem.GetPosition(), accuracy );
1089
1090 if( !m_isDangling )
1091 {
1092 if( m_connectionType != CONNECTION_TYPE::BUS )
1093 m_connectionType = CONNECTION_TYPE::NET;
1094
1095 // Add the line to the connected items, since it won't be picked
1096 // up by a search of intersecting connection points
1097 if( aPath )
1098 {
1099 auto sch_item = static_cast<SCH_ITEM*>( item.GetItem() );
1100 AddConnectionTo( *aPath, sch_item );
1101 sch_item->AddConnectionTo( *aPath, this );
1102 }
1103 }
1104 }
1105 break;
1106
1107 default:
1108 break;
1109 }
1110
1111 if( !m_isDangling )
1112 break;
1113 }
1114
1115 if( m_isDangling )
1116 m_connectionType = CONNECTION_TYPE::NONE;
1117
1118 return previousState != m_isDangling;
1119}
1120
1121
1122void SCH_LABEL_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
1123{
1124 wxString msg;
1125
1126 switch( Type() )
1127 {
1128 case SCH_LABEL_T: msg = _( "Label" ); break;
1129 case SCH_DIRECTIVE_LABEL_T: msg = _( "Directive Label" ); break;
1130 case SCH_GLOBAL_LABEL_T: msg = _( "Global Label" ); break;
1131 case SCH_HIER_LABEL_T: msg = _( "Hierarchical Label" ); break;
1132 case SCH_SHEET_PIN_T: msg = _( "Hierarchical Sheet Pin" ); break;
1133 default: return;
1134 }
1135
1136 // Don't use GetShownText() here; we want to show the user the variable references
1137 aList.emplace_back( msg, UnescapeString( GetText() ) );
1138
1139 // Display electrical type if it is relevant
1141 aList.emplace_back( _( "Type" ), getElectricalTypeLabel( GetShape() ) );
1142
1143 aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
1144
1145 wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
1146 int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
1147 aList.emplace_back( _( "Style" ), textStyle[style] );
1148
1149 aList.emplace_back( _( "Text Size" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
1150
1151 switch( GetSpinStyle() )
1152 {
1153 case SPIN_STYLE::LEFT: msg = _( "Align right" ); break;
1154 case SPIN_STYLE::UP: msg = _( "Align bottom" ); break;
1155 case SPIN_STYLE::RIGHT: msg = _( "Align left" ); break;
1156 case SPIN_STYLE::BOTTOM: msg = _( "Align top" ); break;
1157 default: msg = wxT( "???" ); break;
1158 }
1159
1160 aList.emplace_back( _( "Justification" ), msg );
1161
1162 SCH_CONNECTION* conn = nullptr;
1163
1164 if( !IsConnectivityDirty() && dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
1165 conn = Connection();
1166
1167 if( conn )
1168 {
1169 conn->AppendInfoToMsgPanel( aList );
1170
1171 if( !conn->IsBus() )
1172 {
1173 aList.emplace_back( _( "Resolved Netclass" ),
1174 UnescapeString( GetEffectiveNetClass()->GetName() ) );
1175 }
1176 }
1177}
1178
1179
1180void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground ) const
1181{
1182 static std::vector<VECTOR2I> s_poly;
1183
1184 RENDER_SETTINGS* settings = aPlotter->RenderSettings();
1185 SCH_CONNECTION* connection = Connection();
1186 int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer;
1187 COLOR4D color = settings->GetLayerColor( layer );
1188 int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
1189
1190 if( aPlotter->GetColorMode() && GetTextColor() != COLOR4D::UNSPECIFIED )
1191 color = GetTextColor();
1192
1193 penWidth = std::max( penWidth, settings->GetMinPenWidth() );
1194 aPlotter->SetCurrentLineWidth( penWidth );
1195
1196 KIFONT::FONT* font = GetFont();
1197
1198 if( !font )
1199 font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), IsBold(), IsItalic() );
1200
1201 VECTOR2I textpos = GetTextPos() + GetSchematicTextOffset( aPlotter->RenderSettings() );
1202 CreateGraphicShape( aPlotter->RenderSettings(), s_poly, GetTextPos() );
1203
1205 attrs.m_StrokeWidth = penWidth;
1206 attrs.m_Multiline = false;
1207
1208 if( aBackground )
1209 {
1210 // No filled shapes (yet)
1211 }
1212 else
1213 {
1214 aPlotter->PlotText( textpos, color, GetShownText( true ), attrs, font, GetFontMetrics() );
1215
1216 if( GetShape() == LABEL_FLAG_SHAPE::F_DOT )
1217 {
1218 aPlotter->MoveTo( s_poly[0] );
1219 aPlotter->LineTo( s_poly[1] );
1220 aPlotter->PenFinish();
1221
1222 int diameter = ( s_poly[2] - s_poly[1] ).EuclideanNorm() * 2;
1223 aPlotter->FilledCircle( s_poly[2], diameter , FILLED, nullptr );
1224 }
1225 else if( GetShape() == LABEL_FLAG_SHAPE::F_ROUND )
1226 {
1227 aPlotter->MoveTo( s_poly[0] );
1228 aPlotter->LineTo( s_poly[1] );
1229 aPlotter->PenFinish();
1230
1231 int diameter = ( s_poly[2] - s_poly[1] ).EuclideanNorm() * 2;
1232 aPlotter->ThickCircle( s_poly[2], diameter, penWidth, FILLED, nullptr );
1233 }
1234 else
1235 {
1236 if( !s_poly.empty() )
1237 aPlotter->PlotPoly( s_poly, FILL_T::NO_FILL, penWidth );
1238 }
1239
1240 // Plot attributes to a hypertext menu
1241 std::vector<wxString> properties;
1242
1243 if( connection )
1244 {
1245 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ), _( "Net" ),
1246 connection->Name() ) );
1247
1248 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ), _( "Resolved netclass" ),
1249 GetEffectiveNetClass()->GetName() ) );
1250 }
1251
1252 for( const SCH_FIELD& field : GetFields() )
1253 {
1254 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ), field.GetName(),
1255 field.GetShownText( false ) ) );
1256 }
1257
1258 if( !properties.empty() )
1259 aPlotter->HyperlinkMenu( GetBodyBoundingBox(), properties );
1260
1261 if( Type() == SCH_HIER_LABEL_T )
1262 {
1263 aPlotter->Bookmark( GetBodyBoundingBox(), GetShownText( false ),
1264 _( "Hierarchical Labels" ) );
1265 }
1266 }
1267
1268 for( const SCH_FIELD& field : m_fields )
1269 field.Plot( aPlotter, aBackground );
1270}
1271
1272
1273void SCH_LABEL_BASE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
1274{
1275 static std::vector<VECTOR2I> s_poly;
1276
1277 SCH_CONNECTION* connection = Connection();
1278 int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer;
1279 wxDC* DC = aSettings->GetPrintDC();
1280 COLOR4D color = aSettings->GetLayerColor( layer );
1281 bool blackAndWhiteMode = GetGRForceBlackPenState();
1282 int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
1283 VECTOR2I text_offset = aOffset + GetSchematicTextOffset( aSettings );
1284
1285 if( !blackAndWhiteMode && GetTextColor() != COLOR4D::UNSPECIFIED )
1286 color = GetTextColor();
1287
1288 EDA_TEXT::Print( aSettings, text_offset, color );
1289
1290 CreateGraphicShape( aSettings, s_poly, GetTextPos() + aOffset );
1291
1292 if( GetShape() == LABEL_FLAG_SHAPE::F_DOT )
1293 {
1294 GRLine( DC, s_poly[0], s_poly[1], penWidth, color );
1295
1296 int radius = ( s_poly[2] - s_poly[1] ).EuclideanNorm();
1297 GRFilledCircle( DC, s_poly[2], radius, penWidth, color, color );
1298 }
1299 else if( GetShape() == LABEL_FLAG_SHAPE::F_ROUND )
1300 {
1301 GRLine( DC, s_poly[0], s_poly[1], penWidth, color );
1302
1303 int radius = ( s_poly[2] - s_poly[1] ).EuclideanNorm();
1304 GRCircle( DC, s_poly[2], radius, penWidth, color );
1305 }
1306 else
1307 {
1308 if( !s_poly.empty() )
1309 GRPoly( DC, s_poly.size(), &s_poly[0], false, penWidth, color, color );
1310 }
1311
1312 for( SCH_FIELD& field : m_fields )
1313 field.Print( aSettings, aOffset );
1314}
1315
1317{
1319}
1320
1322{
1323 m_autoRotateOnPlacement = autoRotate;
1324}
1325
1326SCH_LABEL::SCH_LABEL( const VECTOR2I& pos, const wxString& text ) :
1328{
1330 m_shape = LABEL_FLAG_SHAPE::L_INPUT;
1331 m_isDangling = true;
1332}
1333
1334
1336{
1337 BOX2I rect = GetTextBox();
1338
1339 rect.Offset( 0, -GetTextOffset() );
1341
1342 if( !GetTextAngle().IsZero() )
1343 {
1344 // Rotate rect
1345 VECTOR2I pos = rect.GetOrigin();
1346 VECTOR2I end = rect.GetEnd();
1347
1348 RotatePoint( pos, GetTextPos(), GetTextAngle() );
1349 RotatePoint( end, GetTextPos(), GetTextAngle() );
1350
1351 rect.SetOrigin( pos );
1352 rect.SetEnd( end );
1353
1354 rect.Normalize();
1355 }
1356
1357 // Labels have a position point that is outside of the TextBox
1358 rect.Merge( GetPosition() );
1359
1360 return rect;
1361}
1362
1363
1364wxString SCH_LABEL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
1365{
1366 return wxString::Format( _( "Label '%s'" ), KIUI::EllipsizeMenuText( GetText() ) );
1367}
1368
1369
1371{
1372 return BITMAPS::add_line_label;
1373}
1374
1375
1377 SCH_LABEL_BASE( pos, wxEmptyString, SCH_DIRECTIVE_LABEL_T )
1378{
1380 m_shape = LABEL_FLAG_SHAPE::F_ROUND;
1383 m_isDangling = true;
1384}
1385
1386
1388{
1389 SCH_LABEL_BASE::SwapData( aItem );
1390
1391 SCH_DIRECTIVE_LABEL* label = static_cast<SCH_DIRECTIVE_LABEL*>( aItem );
1392
1393 std::swap( m_pinLength, label->m_pinLength );
1394 std::swap( m_symbolSize, label->m_symbolSize );
1395}
1396
1397
1399 SCH_LABEL_BASE( aClassLabel )
1400{
1401 m_pinLength = aClassLabel.m_pinLength;
1402 m_symbolSize = aClassLabel.m_symbolSize;
1403}
1404
1405
1407{
1408 int pen = 0;
1409
1410 if( Schematic() )
1412
1413 return GetEffectiveTextPenWidth( pen );
1414}
1415
1416
1418{
1419 // The "text" is in fact a graphic shape. For a horizontal "text", it looks like a
1420 // vertical shape (like a text reduced to only "I" letter).
1421 // So the mirroring is not exactly similar to a SCH_TEXT item
1422 SCH_TEXT::MirrorSpinStyle( !aLeftRight );
1423
1424 for( SCH_FIELD& field : m_fields )
1425 {
1426 if( ( aLeftRight && field.GetTextAngle().IsHorizontal() )
1427 || ( !aLeftRight && field.GetTextAngle().IsVertical() ) )
1428 {
1429 if( field.GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT )
1430 field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
1431 else
1432 field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
1433 }
1434
1435 VECTOR2I pos = field.GetTextPos();
1437
1438 if( aLeftRight )
1439 pos.x = GetPosition().x + delta.x;
1440 else
1441 pos.y = GetPosition().y + delta.y;
1442
1443 field.SetTextPos( pos );
1444 }
1445}
1446
1447
1449{
1450 VECTOR2I old_pos = GetPosition();
1451 // The "text" is in fact a graphic shape. For a horizontal "text", it looks like a
1452 // vertical shape (like a text reduced to only "I" letter).
1453 // So the mirroring is not exactly similar to a SCH_TEXT item
1454 // Text is NOT really mirrored; it is moved to a suitable horizontal position
1455 SetSpinStyle( GetSpinStyle().MirrorX() );
1456
1457 SetTextX( MIRRORVAL( GetTextPos().x, aCenter ) );
1458
1459 for( SCH_FIELD& field : m_fields )
1460 {
1461 switch( field.GetHorizJustify() )
1462 {
1464 field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
1465 break;
1466
1468 break;
1469
1471 field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
1472 break;
1473 }
1474
1475 VECTOR2I pos = field.GetTextPos();
1476 VECTOR2I delta = old_pos - pos;
1477 pos.x = GetPosition().x + delta.x;
1478
1479 field.SetPosition( pos );
1480 }
1481}
1482
1483
1485{
1486 VECTOR2I old_pos = GetPosition();
1487 // The "text" is in fact a graphic shape. For a horizontal "text", it looks like a
1488 // vertical shape (like a text reduced to only "I" letter).
1489 // So the mirroring is not exactly similar to a SCH_TEXT item
1490 // Text is NOT really mirrored; it is moved to a suitable vertical position
1491 SetSpinStyle( GetSpinStyle().MirrorY() );
1492
1493 SetTextY( MIRRORVAL( GetTextPos().y, aCenter ) );
1494
1495 for( SCH_FIELD& field : m_fields )
1496 {
1497 VECTOR2I pos = field.GetTextPos();
1498 VECTOR2I delta = old_pos - pos;
1499 pos.y = GetPosition().y + delta.y;
1500
1501 field.SetPosition( pos );
1502 }
1503}
1504
1505
1507 std::vector<VECTOR2I>& aPoints,
1508 const VECTOR2I& aPos ) const
1509{
1510 int symbolSize = m_symbolSize;
1511
1512 aPoints.clear();
1513
1514 switch( m_shape )
1515 {
1516 case LABEL_FLAG_SHAPE::F_DOT:
1517 symbolSize = KiROUND( symbolSize * 0.7 );
1519
1520 case LABEL_FLAG_SHAPE::F_ROUND:
1521 // First 3 points are used for generating shape
1522 aPoints.emplace_back( VECTOR2I( 0, 0 ) );
1523 aPoints.emplace_back( VECTOR2I( 0, m_pinLength - symbolSize ) );
1524 aPoints.emplace_back( VECTOR2I( 0, m_pinLength ) );
1525 // These points are just used to bulk out the bounding box
1526 aPoints.emplace_back( VECTOR2I( -m_symbolSize, m_pinLength ) );
1527 aPoints.emplace_back( VECTOR2I( 0, m_pinLength ) );
1528 aPoints.emplace_back( VECTOR2I( m_symbolSize, m_pinLength + symbolSize ) );
1529 break;
1530
1531 case LABEL_FLAG_SHAPE::F_DIAMOND:
1532 aPoints.emplace_back( VECTOR2I( 0, 0 ) );
1533 aPoints.emplace_back( VECTOR2I( 0, m_pinLength - symbolSize ) );
1534 aPoints.emplace_back( VECTOR2I( -2 * m_symbolSize, m_pinLength ) );
1535 aPoints.emplace_back( VECTOR2I( 0, m_pinLength + symbolSize ) );
1536 aPoints.emplace_back( VECTOR2I( 2 * m_symbolSize, m_pinLength ) );
1537 aPoints.emplace_back( VECTOR2I( 0, m_pinLength - symbolSize ) );
1538 aPoints.emplace_back( VECTOR2I( 0, 0 ) );
1539 break;
1540
1541 case LABEL_FLAG_SHAPE::F_RECTANGLE:
1542 symbolSize = KiROUND( symbolSize * 0.8 );
1543
1544 aPoints.emplace_back( VECTOR2I( 0, 0 ) );
1545 aPoints.emplace_back( VECTOR2I( 0, m_pinLength - symbolSize ) );
1546 aPoints.emplace_back( VECTOR2I( -2 * symbolSize, m_pinLength - symbolSize ) );
1547 aPoints.emplace_back( VECTOR2I( -2 * symbolSize, m_pinLength + symbolSize ) );
1548 aPoints.emplace_back( VECTOR2I( 2 * symbolSize, m_pinLength + symbolSize ) );
1549 aPoints.emplace_back( VECTOR2I( 2 * symbolSize, m_pinLength - symbolSize ) );
1550 aPoints.emplace_back( VECTOR2I( 0, m_pinLength - symbolSize ) );
1551 aPoints.emplace_back( VECTOR2I( 0, 0 ) );
1552 break;
1553
1554 default:
1555 break;
1556 }
1557
1558 // Rotate outlines and move corners to real position
1559 for( VECTOR2I& aPoint : aPoints )
1560 {
1561 switch( GetSpinStyle() )
1562 {
1563 default:
1564 case SPIN_STYLE::LEFT: break;
1565 case SPIN_STYLE::UP: RotatePoint( aPoint, -ANGLE_90 ); break;
1566 case SPIN_STYLE::RIGHT: RotatePoint( aPoint, ANGLE_180 ); break;
1567 case SPIN_STYLE::BOTTOM: RotatePoint( aPoint, ANGLE_90 ); break;
1568 }
1569
1570 aPoint += aPos;
1571 }
1572}
1573
1574
1576{
1577 int margin = GetTextOffset();
1578 int symbolWidth = m_symbolSize;
1579 int origin = m_pinLength;
1580
1581 if( m_shape == LABEL_FLAG_SHAPE::F_DIAMOND || m_shape == LABEL_FLAG_SHAPE::F_RECTANGLE )
1582 symbolWidth *= 2;
1583
1584 if( IsItalic() )
1585 margin = KiROUND( margin * 1.5 );
1586
1587 VECTOR2I offset;
1588
1589 for( SCH_FIELD& field : m_fields )
1590 {
1591 switch( GetSpinStyle() )
1592 {
1593 default:
1594 case SPIN_STYLE::LEFT:
1595 field.SetTextAngle( ANGLE_HORIZONTAL );
1596 offset = { symbolWidth + margin, origin };
1597 break;
1598
1599 case SPIN_STYLE::UP:
1600 field.SetTextAngle( ANGLE_VERTICAL );
1601 offset = { -origin, -( symbolWidth + margin ) };
1602 break;
1603
1604 case SPIN_STYLE::RIGHT:
1605 field.SetTextAngle( ANGLE_HORIZONTAL );
1606 offset = { symbolWidth + margin, -origin };
1607 break;
1608
1609 case SPIN_STYLE::BOTTOM:
1610 field.SetTextAngle( ANGLE_VERTICAL );
1611 offset = { origin, -( symbolWidth + margin ) };
1612 break;
1613 }
1614
1615 field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
1616 field.SetTextPos( GetPosition() + offset );
1617
1618 origin -= field.GetTextHeight() + margin;
1619 }
1620
1622}
1623
1624
1626{
1627 if( m_fields.empty() )
1628 {
1629 return _( "Directive Label" );
1630 }
1631 else
1632 {
1633 return wxString::Format( _( "Directive Label [%s %s]" ),
1634 UnescapeString( m_fields[0].GetName() ),
1636 }
1637}
1638
1639
1640SCH_GLOBALLABEL::SCH_GLOBALLABEL( const VECTOR2I& pos, const wxString& text ) :
1642{
1644 m_shape = LABEL_FLAG_SHAPE::L_BIDI;
1645 m_isDangling = true;
1646
1648
1649 m_fields.emplace_back( SCH_FIELD( pos, 0, this, wxT( "Sheet References" ) ) );
1650 m_fields[0].SetText( wxT( "${INTERSHEET_REFS}" ) );
1651 m_fields[0].SetVisible( false );
1652 m_fields[0].SetLayer( LAYER_INTERSHEET_REFS );
1653 m_fields[0].SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
1654}
1655
1656
1658 SCH_LABEL_BASE( aGlobalLabel )
1659{
1660}
1661
1662
1664{
1665 int horiz = GetLabelBoxExpansion( aSettings );
1666
1667 // Center the text on the center line of "E" instead of "R" to make room for an overbar
1668 int vert = GetTextHeight() * 0.0715;
1669
1670 switch( m_shape )
1671 {
1672 case LABEL_FLAG_SHAPE::L_INPUT:
1673 case LABEL_FLAG_SHAPE::L_BIDI:
1674 case LABEL_FLAG_SHAPE::L_TRISTATE:
1675 horiz += GetTextHeight() * 3 / 4; // Use three-quarters-height as proxy for triangle size
1676 break;
1677
1678 case LABEL_FLAG_SHAPE::L_OUTPUT:
1679 case LABEL_FLAG_SHAPE::L_UNSPECIFIED:
1680 default:
1681 break;
1682 }
1683
1684 switch( GetSpinStyle() )
1685 {
1686 default:
1687 case SPIN_STYLE::LEFT: return VECTOR2I( -horiz, vert );
1688 case SPIN_STYLE::UP: return VECTOR2I( vert, -horiz );
1689 case SPIN_STYLE::RIGHT: return VECTOR2I( horiz, vert );
1690 case SPIN_STYLE::BOTTOM: return VECTOR2I( vert, horiz );
1691 }
1692}
1693
1694
1696{
1697 SCH_LABEL_BASE::SetSpinStyle( aSpinStyle );
1699}
1700
1701
1702bool SCH_GLOBALLABEL::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token,
1703 int aDepth ) const
1704{
1705 if( token->IsSameAs( wxT( "INTERSHEET_REFS" ) ) && Schematic() )
1706 {
1707 SCHEMATIC_SETTINGS& settings = Schematic()->Settings();
1708 wxString ref;
1709 auto it = Schematic()->GetPageRefsMap().find( GetText() );
1710
1711 if( it == Schematic()->GetPageRefsMap().end() )
1712 {
1713 ref = "?";
1714 }
1715 else
1716 {
1717 std::vector<int> pageListCopy;
1718
1719 pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() );
1720 std::sort( pageListCopy.begin(), pageListCopy.end() );
1721
1722 if( !settings.m_IntersheetRefsListOwnPage )
1723 {
1724 int currentPage = Schematic()->CurrentSheet().GetVirtualPageNumber();
1725 alg::delete_matching( pageListCopy, currentPage );
1726 }
1727
1728 std::map<int, wxString> sheetPages = Schematic()->GetVirtualPageToSheetPagesMap();
1729
1730 if( ( settings.m_IntersheetRefsFormatShort ) && ( pageListCopy.size() > 2 ) )
1731 {
1732 ref.Append( wxString::Format( wxT( "%s..%s" ),
1733 sheetPages[pageListCopy.front()],
1734 sheetPages[pageListCopy.back()] ) );
1735 }
1736 else
1737 {
1738 for( const int& pageNo : pageListCopy )
1739 ref.Append( wxString::Format( wxT( "%s," ), sheetPages[pageNo] ) );
1740
1741 if( !ref.IsEmpty() && ref.Last() == ',' )
1742 ref.RemoveLast();
1743 }
1744 }
1745
1746 *token = settings.m_IntersheetRefsPrefix + ref + settings.m_IntersheetRefsSuffix;
1747 return true;
1748 }
1749
1750 return SCH_LABEL_BASE::ResolveTextVar( aPath, token, aDepth );
1751}
1752
1753
1754void SCH_GLOBALLABEL::ViewGetLayers( int aLayers[], int& aCount ) const
1755{
1756 aCount = 6;
1757 aLayers[0] = LAYER_DANGLING;
1758 aLayers[1] = LAYER_DEVICE;
1759 aLayers[2] = LAYER_INTERSHEET_REFS;
1760 aLayers[3] = LAYER_NETCLASS_REFS;
1761 aLayers[4] = LAYER_FIELDS;
1762 aLayers[5] = LAYER_SELECTION_SHADOWS;
1763}
1764
1765
1767 std::vector<VECTOR2I>& aPoints,
1768 const VECTOR2I& aPos ) const
1769{
1770 int margin = GetLabelBoxExpansion( aRenderSettings );
1771 int halfSize = ( GetTextHeight() / 2 ) + margin;
1772 int linewidth = GetPenWidth();
1773 int symb_len = GetTextBox().GetWidth() + 2 * margin;
1774
1775 int x = symb_len + linewidth + 3;
1776 int y = halfSize + linewidth + 3;
1777
1778 aPoints.clear();
1779
1780 // Create outline shape : 6 points
1781 aPoints.emplace_back( VECTOR2I( 0, 0 ) );
1782 aPoints.emplace_back( VECTOR2I( 0, -y ) ); // Up
1783 aPoints.emplace_back( VECTOR2I( -x, -y ) ); // left
1784 aPoints.emplace_back( VECTOR2I( -x, 0 ) ); // Up left
1785 aPoints.emplace_back( VECTOR2I( -x, y ) ); // left down
1786 aPoints.emplace_back( VECTOR2I( 0, y ) ); // down
1787
1788 int x_offset = 0;
1789
1790 switch( m_shape )
1791 {
1792 case LABEL_FLAG_SHAPE::L_INPUT:
1793 x_offset = -halfSize;
1794 aPoints[0].x += halfSize;
1795 break;
1796
1797 case LABEL_FLAG_SHAPE::L_OUTPUT:
1798 aPoints[3].x -= halfSize;
1799 break;
1800
1801 case LABEL_FLAG_SHAPE::L_BIDI:
1802 case LABEL_FLAG_SHAPE::L_TRISTATE:
1803 x_offset = -halfSize;
1804 aPoints[0].x += halfSize;
1805 aPoints[3].x -= halfSize;
1806 break;
1807
1808 case LABEL_FLAG_SHAPE::L_UNSPECIFIED:
1809 default:
1810 break;
1811 }
1812
1813 // Rotate outlines and move corners in real position
1814 for( VECTOR2I& aPoint : aPoints )
1815 {
1816 aPoint.x += x_offset;
1817
1818 switch( GetSpinStyle() )
1819 {
1820 default:
1821 case SPIN_STYLE::LEFT: break;
1822 case SPIN_STYLE::UP: RotatePoint( aPoint, -ANGLE_90 ); break;
1823 case SPIN_STYLE::RIGHT: RotatePoint( aPoint, ANGLE_180 ); break;
1824 case SPIN_STYLE::BOTTOM: RotatePoint( aPoint, ANGLE_90 ); break;
1825 }
1826
1827 aPoint += aPos;
1828 }
1829
1830 aPoints.push_back( aPoints[0] ); // closing
1831}
1832
1833
1835{
1836 return wxString::Format( _( "Global Label '%s'" ), KIUI::EllipsizeMenuText( GetText() ) );
1837}
1838
1839
1841{
1842 return BITMAPS::add_glabel;
1843}
1844
1845
1846SCH_HIERLABEL::SCH_HIERLABEL( const VECTOR2I& pos, const wxString& text, KICAD_T aType ) :
1847 SCH_LABEL_BASE( pos, text, aType )
1848{
1850 m_shape = LABEL_FLAG_SHAPE::L_INPUT;
1851 m_isDangling = true;
1852}
1853
1854
1856{
1857 SCH_LABEL_BASE::SetSpinStyle( aSpinStyle );
1859}
1860
1861
1863 std::vector<VECTOR2I>& aPoints, const VECTOR2I& aPos ) const
1864{
1865 CreateGraphicShape( aSettings, aPoints, aPos, m_shape );
1866}
1867
1868
1870 std::vector<VECTOR2I>& aPoints, const VECTOR2I& aPos,
1871 LABEL_FLAG_SHAPE aShape ) const
1872{
1873 int* Template = TemplateShape[static_cast<int>( aShape )][static_cast<int>( GetSpinStyle() )];
1874 int halfSize = GetTextHeight() / 2;
1875 int imax = *Template;
1876 Template++;
1877
1878 aPoints.clear();
1879
1880 for( int ii = 0; ii < imax; ii++ )
1881 {
1882 VECTOR2I corner;
1883 corner.x = ( halfSize * (*Template) ) + aPos.x;
1884 Template++;
1885
1886 corner.y = ( halfSize * (*Template) ) + aPos.y;
1887 Template++;
1888
1889 aPoints.push_back( corner );
1890 }
1891}
1892
1893
1895{
1896 int penWidth = GetEffectiveTextPenWidth();
1897 int margin = GetTextOffset();
1898
1899 int x = GetTextPos().x;
1900 int y = GetTextPos().y;
1901
1902 int height = GetTextHeight() + penWidth + margin;
1903 int length = GetTextBox().GetWidth();
1904
1905 length += height; // add height for triangular shapes
1906
1907 int dx, dy;
1908
1909 switch( GetSpinStyle() )
1910 {
1911 default:
1912 case SPIN_STYLE::LEFT:
1913 dx = -length;
1914 dy = height;
1916 y -= height / 2;
1917 break;
1918
1919 case SPIN_STYLE::UP:
1920 dx = height;
1921 dy = -length;
1922 x -= height / 2;
1924 break;
1925
1926 case SPIN_STYLE::RIGHT:
1927 dx = length;
1928 dy = height;
1930 y -= height / 2;
1931 break;
1932
1933 case SPIN_STYLE::BOTTOM:
1934 dx = height;
1935 dy = length;
1936 x -= height / 2;
1938 break;
1939 }
1940
1941 BOX2I box( VECTOR2I( x, y ), VECTOR2I( dx, dy ) );
1942 box.Normalize();
1943 return box;
1944}
1945
1946
1948{
1949 VECTOR2I text_offset;
1950 int dist = GetTextOffset( aSettings );
1951
1952 dist += GetTextWidth();
1953
1954 switch( GetSpinStyle() )
1955 {
1956 default:
1957 case SPIN_STYLE::LEFT: text_offset.x = -dist; break; // Orientation horiz normale
1958 case SPIN_STYLE::UP: text_offset.y = -dist; break; // Orientation vert UP
1959 case SPIN_STYLE::RIGHT: text_offset.x = dist; break; // Orientation horiz inverse
1960 case SPIN_STYLE::BOTTOM: text_offset.y = dist; break; // Orientation vert BOTTOM
1961 }
1962
1963 return text_offset;
1964}
1965
1966
1967wxString SCH_HIERLABEL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
1968{
1969 return wxString::Format( _( "Hierarchical Label '%s'" ),
1971}
1972
1973
1975{
1976 return BITMAPS::add_hierarchical_label;
1977}
1978
1979
1981{
1982 wxString msg =
1983#include "sch_text_help_md.h"
1984 ;
1985
1986 HTML_MESSAGE_BOX* dlg = new HTML_MESSAGE_BOX( nullptr, _( "Syntax Help" ) );
1987 wxSize sz( 320, 320 );
1988
1989 dlg->SetMinSize( dlg->ConvertDialogToPixels( sz ) );
1990 dlg->SetDialogSizeInDU( sz.x, sz.y );
1991
1992 wxString html_txt;
1993 ConvertMarkdown2Html( wxGetTranslation( msg ), html_txt );
1994 dlg->AddHTML_Text( html_txt );
1995 dlg->ShowModeless();
1996
1997 return dlg;
1998}
1999
2000
2001static struct SCH_LABEL_DESC
2002{
2004 {
2011
2016
2021
2026
2032
2033 propMgr.Mask( TYPE_HASH( SCH_LABEL_BASE ), TYPE_HASH( EDA_TEXT ), _HKI( "Hyperlink" ) );
2034 }
int color
Definition: DXF_plotter.cpp:58
const char * name
Definition: DXF_plotter.cpp:57
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
void SetOrigin(const Vec &pos)
Definition: box2.h:203
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
Definition: box2.h:120
int GetSizeMax() const
Definition: box2.h:201
const Vec & GetOrigin() const
Definition: box2.h:184
void Offset(coord_type dx, coord_type dy)
Definition: box2.h:225
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:270
coord_type GetWidth() const
Definition: box2.h:188
const Vec GetEnd() const
Definition: box2.h:186
bool Contains(const Vec &aPoint) const
Definition: box2.h:142
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:507
void SetEnd(coord_type x, coord_type y)
Definition: box2.h:256
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:589
Helper class used to store the state of schematic items that can be connected to other schematic item...
Definition: sch_item.h:85
DANGLING_END_T GetType() const
Definition: sch_item.h:129
EDA_ITEM * GetItem() const
Definition: sch_item.h:127
VECTOR2I GetPosition() const
Definition: sch_item.h:126
The base class for create windows for drawing purpose.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition: eda_item.h:372
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:100
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:485
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:80
int GetTextHeight() const
Definition: eda_text.h:213
BOX2I GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:546
const VECTOR2I & GetTextPos() const
Definition: eda_text.h:219
COLOR4D GetTextColor() const
Definition: eda_text.h:216
bool IsItalic() const
Definition: eda_text.h:141
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:131
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:95
void SetTextPos(const VECTOR2I &aPoint)
Definition: eda_text.cpp:398
void SetTextX(int aX)
Definition: eda_text.cpp:404
KIFONT::FONT * GetFont() const
Definition: eda_text.h:199
void SetTextY(int aY)
Definition: eda_text.cpp:410
int GetTextWidth() const
Definition: eda_text.h:210
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
Definition: eda_text.cpp:257
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:160
bool Replace(const EDA_SEARCH_DATA &aSearchData)
Helper function used in search and replace dialog.
Definition: eda_text.cpp:326
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
Definition: eda_text.h:114
virtual void cacheShownText()
Definition: eda_text.cpp:443
const TEXT_ATTRIBUTES & GetAttributes() const
Definition: eda_text.h:183
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
Definition: eda_text.cpp:305
bool IsBold() const
Definition: eda_text.h:144
virtual wxString GetShownText(bool aAllowExtraText, int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:106
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:180
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:202
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, const COLOR4D &aColor, OUTLINE_MODE aDisplay_mode=FILLED)
Print this text object to the device context aDC.
Definition: eda_text.cpp:702
void SetMultilineAllowed(bool aAllow)
Definition: eda_text.cpp:241
VECTOR2I GetTextSize() const
Definition: eda_text.h:207
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Definition: eda_text.cpp:249
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).
FONT is an abstract base class for both outline and stroke fonts.
Definition: font.h:130
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false)
Definition: font.cpp:146
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
int GetDefaultPenWidth() const
const wxString & GetDefaultFont() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
wxDC * GetPrintDC() const
Store schematic specific render settings.
Definition: sch_painter.h:71
Base plotter engine class.
Definition: plotter.h:104
virtual void ThickCircle(const VECTOR2I &pos, int diametre, int width, OUTLINE_MODE tracemode, void *aData)
Definition: plotter.cpp:646
virtual void FilledCircle(const VECTOR2I &pos, int diametre, OUTLINE_MODE tracemode, void *aData)
Definition: plotter.cpp:662
void MoveTo(const VECTOR2I &pos)
Definition: plotter.h:242
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:135
virtual void Bookmark(const BOX2I &aBox, const wxString &aName, const wxString &aGroupName=wxEmptyString)
Create a bookmark to a symbol.
Definition: plotter.h:474
bool GetColorMode() const
Definition: plotter.h:132
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:247
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr)=0
Draw a polygon ( filled or not ).
void PenFinish()
Definition: plotter.h:258
virtual void HyperlinkMenu(const BOX2I &aBox, const std::vector< wxString > &aDestURLs)
Create a clickable hyperlink menu with a rectangular click area.
Definition: plotter.h:463
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr)
Definition: plotter.cpp:753
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:74
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()
Definition: property_mgr.h:76
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
These settings were stored in SCH_BASE_FRAME previously.
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:136
wxString GetOperatingPoint(const wxString &aNetName, int aPrecision, const wxString &aRange)
Definition: schematic.cpp:634
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:209
std::map< wxString, std::set< int > > & GetPageRefsMap()
Definition: schematic.h:177
std::map< int, wxString > GetVirtualPageToSheetPagesMap() const
Definition: schematic.cpp:378
std::map< int, wxString > GetVirtualPageToSheetNamesMap() const
Definition: schematic.cpp:362
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
wxString LocalName() const
wxString Name(bool aIgnoreSheet=false) const
bool IsBus() const
void AppendInfoToMsgPanel(std::vector< MSG_PANEL_ITEM > &aList) const
Adds information about the connection object to aList.
void MirrorSpinStyle(bool aLeftRight) override
Definition: sch_label.cpp:1417
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_label.cpp:1387
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_label.cpp:1484
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_label.cpp:1448
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_label.cpp:1575
SCH_DIRECTIVE_LABEL(const VECTOR2I &aPos=VECTOR2I(0, 0))
Definition: sch_label.cpp:1376
void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_label.cpp:1506
int GetPenWidth() const override
Definition: sch_label.cpp:1406
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:1625
Schematic editor (Eeschema) main window.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:52
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_label.cpp:1754
void CreateGraphicShape(const RENDER_SETTINGS *aRenderSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_label.cpp:1766
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth) const override
Resolve any references to system tokens supported by the label.
Definition: sch_label.cpp:1702
VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
This offset depends on the orientation, the type of text, and the area required to draw the associate...
Definition: sch_label.cpp:1663
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
Definition: sch_label.cpp:1695
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:1834
SCH_GLOBALLABEL(const VECTOR2I &aPos=VECTOR2I(0, 0), const wxString &aText=wxEmptyString)
Definition: sch_label.cpp:1640
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_label.cpp:1840
const BOX2I GetBodyBoundingBox() const override
Return the bounding box of the label only, without taking in account its fields.
Definition: sch_label.cpp:1894
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
Definition: sch_label.cpp:1855
void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_label.cpp:1862
SCH_HIERLABEL(const VECTOR2I &aPos=VECTOR2I(0, 0), const wxString &aText=wxEmptyString, KICAD_T aType=SCH_HIER_LABEL_T)
Definition: sch_label.cpp:1846
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_label.cpp:1974
VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
This offset depends on the orientation, the type of text, and the area required to draw the associate...
Definition: sch_label.cpp:1947
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:1967
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:150
SCH_ITEM & operator=(const SCH_ITEM &aPin)
Definition: sch_item.cpp:71
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:113
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Add a connection link between this item and another.
Definition: sch_item.cpp:203
std::map< SCH_SHEET_PATH, SCH_ITEM_SET, SHEET_PATH_CMP > m_connected_items
Store pointers to other items that are connected to this one, per sheet.
Definition: sch_item.h:517
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition: sch_item.cpp:176
void ClearFieldsAutoplaced()
Definition: sch_item.h:446
FIELDS_AUTOPLACED m_fieldsAutoplaced
Definition: sch_item.h:512
bool IsConnectivityDirty() const
Definition: sch_item.h:426
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:147
const KIFONT::METRICS & GetFontMetrics() const
Definition: sch_item.cpp:331
SCH_LAYER_ID m_layer
Definition: sch_item.h:510
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: sch_item.h:165
const wxString & GetCachedDriverName() const override
Definition: sch_label.cpp:816
SCH_LABEL_BASE(const VECTOR2I &aPos, const wxString &aText, KICAD_T aType)
Definition: sch_label.cpp:204
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_label.cpp:917
COLOR4D m_lastResolvedColor
Definition: sch_label.h:326
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const override
Definition: sch_label.cpp:831
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_label.cpp:417
bool m_isDangling
Definition: sch_label.h:323
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: sch_label.cpp:879
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
Definition: sch_label.cpp:863
bool HasCachedDriverName() const override
Definition: sch_label.cpp:810
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: sch_label.cpp:986
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
Definition: sch_label.cpp:904
bool AutoRotateOnPlacement() const
autoRotateOnPlacement
Definition: sch_label.cpp:1316
void Rotate(const VECTOR2I &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: sch_label.cpp:426
SCH_LABEL_BASE & operator=(const SCH_LABEL_BASE &aLabel)
Definition: sch_label.cpp:236
std::vector< SCH_FIELD > m_fields
Definition: sch_label.h:318
CONNECTION_TYPE m_connectionType
Definition: sch_label.h:322
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_label.cpp:522
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_label.cpp:304
SPIN_STYLE GetSpinStyle() const
Definition: sch_label.cpp:372
void GetIntersheetRefs(std::vector< std::pair< wxString, wxString > > *pages)
Builds an array of { pageNumber, pageName } pairs.
Definition: sch_label.cpp:653
void MirrorSpinStyle(bool aLeftRight) override
Definition: sch_label.cpp:494
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
Definition: sch_label.cpp:911
COLOR4D GetLabelColor() const
Definition: sch_label.cpp:326
LABEL_FLAG_SHAPE GetShape() const
Definition: sch_label.h:147
const BOX2I GetBoundingBox() const override
Return the bounding box of the label including its fields.
Definition: sch_label.cpp:961
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: sch_label.cpp:259
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_label.cpp:552
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_label.cpp:410
virtual bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth) const
Resolve any references to system tokens supported by the label.
Definition: sch_label.cpp:701
bool m_autoRotateOnPlacement
Definition: sch_label.h:324
wxString m_cached_driver_name
Definition: sch_label.h:328
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &offset) override
Print a schematic item.
Definition: sch_label.cpp:1273
int GetLabelBoxExpansion(const RENDER_SETTINGS *aSettings=nullptr) const
Definition: sch_label.cpp:928
bool IncrementLabel(int aIncrement)
Increment the label text, if it ends with a number.
Definition: sch_label.cpp:568
void SetAutoRotateOnPlacement(bool autoRotate=true)
setAutoRotateOnPlacement
Definition: sch_label.cpp:1321
void cacheShownText() override
Definition: sch_label.cpp:822
void Rotate90(bool aClockwise) override
Definition: sch_label.cpp:441
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemList, const SCH_SHEET_PATH *aPath=nullptr) override
Test the schematic item to aItemList to check if it's dangling state has changed.
Definition: sch_label.cpp:1047
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_label.cpp:1122
static const wxString GetDefaultFieldName(const wxString &aName, bool aUseDefaultName)
Definition: sch_label.cpp:246
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_label.cpp:582
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
Definition: sch_label.cpp:856
LABEL_FLAG_SHAPE m_shape
Definition: sch_label.h:320
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this label.
Definition: sch_label.cpp:688
virtual const BOX2I GetBodyBoundingBox() const
Return the bounding box of the label only, without taking in account its fields.
Definition: sch_label.cpp:943
virtual void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &Pos) const
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_label.h:255
std::vector< SCH_FIELD > & GetFields()
Definition: sch_label.h:167
VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
This offset depends on the orientation, the type of text, and the area required to draw the associate...
Definition: sch_label.cpp:391
virtual void SetSpinStyle(SPIN_STYLE aSpinStyle)
Definition: sch_label.cpp:337
void Plot(PLOTTER *aPlotter, bool aBackground) const override
Plot the schematic item to aPlotter.
Definition: sch_label.cpp:1180
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_label.cpp:869
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:1364
SCH_LABEL(const VECTOR2I &aPos=VECTOR2I(0, 0), const wxString &aText=wxEmptyString)
Definition: sch_label.cpp:1326
const BOX2I GetBodyBoundingBox() const override
Return the bounding box of the label only, without taking in account its fields.
Definition: sch_label.cpp:1335
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_label.cpp:1370
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
int GetVirtualPageNumber() const
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:57
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
Definition: sch_sheet.cpp:236
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_text.h:95
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_text.cpp:100
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
Definition: sch_label.cpp:1980
VECTOR2I GetPosition() const override
Definition: sch_text.h:126
virtual void Rotate90(bool aClockwise)
Definition: sch_text.cpp:124
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_text.cpp:88
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_text.cpp:146
int GetPenWidth() const override
Definition: sch_text.cpp:197
virtual void MirrorSpinStyle(bool aLeftRight)
Definition: sch_text.cpp:136
int GetTextOffset(const RENDER_SETTINGS *aSettings=nullptr) const
Definition: sch_text.cpp:182
SPIN_STYLE MirrorX()
Mirror the label spin style across the X axis or simply swaps up and bottom.
Definition: sch_label.cpp:172
SPIN m_spin
Definition: sch_label.h:83
SPIN_STYLE()=default
SPIN_STYLE MirrorY()
Mirror the label spin style across the Y axis or simply swaps left and right.
Definition: sch_label.cpp:188
SPIN_STYLE RotateCCW()
Definition: sch_label.cpp:156
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Definition: common.cpp:58
#define DEFAULT_LABEL_SIZE_RATIO
The offset of the pin name string from the end of the pin in mils.
#define DANGLING_SYMBOL_SIZE
< The size of the rectangle indicating an unconnected wire or label
#define _HKI(x)
#define _(s)
static constexpr EDA_ANGLE & ANGLE_180
Definition: eda_angle.h:441
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
Definition: eda_angle.h:433
static constexpr EDA_ANGLE & ANGLE_VERTICAL
Definition: eda_angle.h:434
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:439
INSPECT_RESULT
Definition: eda_item.h:42
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:78
void GRCircle(wxDC *aDC, const VECTOR2I &aPos, int aRadius, int aWidth, const COLOR4D &aColor)
Definition: gr_basic.cpp:357
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:171
static const bool FILLED
Definition: gr_basic.cpp:30
void GRPoly(wxDC *DC, int n, const VECTOR2I *Points, bool Fill, int width, const COLOR4D &Color, const COLOR4D &BgColor)
Draw a new polyline and fill it if Fill, in drawing space.
Definition: gr_basic.cpp:341
bool GetGRForceBlackPenState(void)
Definition: gr_basic.cpp:165
void GRFilledCircle(wxDC *aDC, const VECTOR2I &aPos, int aRadius, int aWidth, const COLOR4D &aStrokeColor, const COLOR4D &aFillColor)
Draw a circle onto the drawing context aDC centered at the user coordinates (x,y).
Definition: gr_basic.cpp:369
@ NONE
Definition: kibis.h:54
@ LAYER_DANGLING
Definition: layer_ids.h:373
@ LAYER_DEVICE
Definition: layer_ids.h:362
@ LAYER_HIERLABEL
Definition: layer_ids.h:354
@ LAYER_GLOBLABEL
Definition: layer_ids.h:353
@ LAYER_BUS
Definition: layer_ids.h:350
@ LAYER_FIELDS
Definition: layer_ids.h:359
@ LAYER_LOCLABEL
Definition: layer_ids.h:352
@ LAYER_NETCLASS_REFS
Definition: layer_ids.h:361
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:387
@ LAYER_INTERSHEET_REFS
Definition: layer_ids.h:360
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83
T MIRRORVAL(T aPoint, T aMirrorRef)
Returns the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:31
Message panel definition file.
wxString EllipsizeMenuText(const wxString &aString)
Ellipsize text (at the end) to be no more than 36 characters.
Definition: ui_common.cpp:219
void delete_matching(_Container &__c, _Value __value)
Covers for the horrifically named std::remove and std::remove_if (neither of which remove anything).
Definition: kicad_algo.h:164
see class PGM_BASE
#define TYPE_HASH(x)
Definition: property.h:64
#define REGISTER_TYPE(x)
Definition: property_mgr.h:356
CONNECTION_TYPE
@ NO_CONNECT_END
Definition: sch_item.h:76
@ SHEET_LABEL_END
Definition: sch_item.h:75
@ LABEL_END
Definition: sch_item.h:72
@ BUS_END
Definition: sch_item.h:69
@ PIN_END
Definition: sch_item.h:71
@ WIRE_END
Definition: sch_item.h:68
std::vector< SCH_ITEM * > SCH_ITEM_SET
Definition: sch_item.h:139
@ FIELDS_AUTOPLACED_AUTO
Definition: sch_item.h:60
static int TemplateIN_HI[]
Definition: sch_label.cpp:108
static int TemplateUNSPC_HI[]
Definition: sch_label.cpp:118
static int TemplateOUT_HN[]
Definition: sch_label.cpp:112
static int Template3STATE_HN[]
Definition: sch_label.cpp:127
static int TemplateBIDI_HN[]
Definition: sch_label.cpp:122
static int * TemplateShape[5][4]
Definition: sch_label.cpp:132
bool IncrementLabelMember(wxString &name, int aIncrement)
Definition: sch_label.cpp:50
static int TemplateIN_HN[]
Definition: sch_label.cpp:107
static int TemplateIN_BOTTOM[]
Definition: sch_label.cpp:110
static int TemplateUNSPC_HN[]
Definition: sch_label.cpp:117
static int Template3STATE_BOTTOM[]
Definition: sch_label.cpp:130
static int TemplateBIDI_BOTTOM[]
Definition: sch_label.cpp:125
static struct SCH_LABEL_DESC _SCH_LABEL_DESC
static int Template3STATE_UP[]
Definition: sch_label.cpp:129
static int TemplateOUT_UP[]
Definition: sch_label.cpp:114
static int TemplateOUT_HI[]
Definition: sch_label.cpp:113
static int TemplateUNSPC_UP[]
Definition: sch_label.cpp:119
static int TemplateUNSPC_BOTTOM[]
Definition: sch_label.cpp:120
static int TemplateOUT_BOTTOM[]
Definition: sch_label.cpp:115
static int Template3STATE_HI[]
Definition: sch_label.cpp:128
static int TemplateIN_UP[]
Definition: sch_label.cpp:109
wxString getElectricalTypeLabel(LABEL_FLAG_SHAPE aType)
Definition: sch_label.cpp:142
static int TemplateBIDI_UP[]
Definition: sch_label.cpp:124
static int TemplateBIDI_HI[]
Definition: sch_label.cpp:123
LABEL_FLAG_SHAPE
Definition: sch_label.h:91
@ L_BIDI
Definition: sch_label.h:94
@ L_TRISTATE
Definition: sch_label.h:95
@ L_UNSPECIFIED
Definition: sch_label.h:96
@ L_OUTPUT
Definition: sch_label.h:93
@ L_INPUT
Definition: sch_label.h:92
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
@ CTX_NETNAME
Definition: string_utils.h:53
void ConvertMarkdown2Html(const wxString &aMarkdownInput, wxString &aHtmlOutput)
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94
wxString replaceString
constexpr int delta
@ GR_TEXT_H_ALIGN_CENTER
@ GR_TEXT_H_ALIGN_RIGHT
@ GR_TEXT_H_ALIGN_LEFT
@ GR_TEXT_V_ALIGN_BOTTOM
@ GR_TEXT_V_ALIGN_CENTER
bool TestSegmentHit(const VECTOR2I &aRefPoint, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
Definition: trigo.cpp:129
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183
double EuclideanNorm(const VECTOR2I &vector)
Definition: trigo.h:129
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_FIELD_T
Definition: typeinfo.h:154
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:153
@ SCH_LABEL_T
Definition: typeinfo.h:150
@ SCH_LOCATE_ANY_T
Definition: typeinfo.h:182
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:152
@ SCH_LABEL_LOCATE_ANY_T
Definition: typeinfo.h:174
@ SCH_LABEL_LOCATE_WIRE_T
Definition: typeinfo.h:175
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:156
@ SCH_LABEL_LOCATE_BUS_T
Definition: typeinfo.h:176
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:151
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588