KiCad PCB EDA Suite
sch_text.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
6  * Copyright (C) 1992-2021 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 
31 #include <sch_symbol.h>
32 #include <sch_edit_frame.h>
33 #include <plotter.h>
34 #include <widgets/msgpanel.h>
35 #include <gal/stroke_font.h>
36 #include <bitmaps.h>
37 #include <kicad_string.h>
38 #include <sch_text.h>
39 #include <schematic.h>
41 #include <sch_painter.h>
42 #include <default_values.h>
43 #include <wx/debug.h>
45 #include <project/project_file.h>
46 #include <project/net_settings.h>
47 #include <core/mirror.h>
48 #include <dialog_helpers.h>
49 #include <trigo.h>
50 
52 
53 
54 bool IncrementLabelMember( wxString& name, int aIncrement )
55 {
56  int ii, nn;
57  long number = 0;
58 
59  ii = name.Len() - 1;
60  nn = 0;
61 
62  // No number found, but simply repeating the same label is valid
63 
64  if( !wxIsdigit( name.GetChar( ii ) ) )
65  return true;
66 
67  while( ii >= 0 && wxIsdigit( name.GetChar( ii ) ) )
68  {
69  ii--;
70  nn++;
71  }
72 
73  ii++; /* digits are starting at ii position */
74  wxString litt_number = name.Right( nn );
75 
76  if( litt_number.ToLong( &number ) )
77  {
78  number += aIncrement;
79 
80  // Don't let result go below zero
81 
82  if( number > -1 )
83  {
84  name.Remove( ii );
85  name << number;
86  return true;
87  }
88  }
89  return false;
90 }
91 
92 
93 /* Coding polygons for global symbol graphic shapes.
94  * the first parml is the number of corners
95  * others are the corners coordinates in reduced units
96  * the real coordinate is the reduced coordinate * text half size
97  */
98 static int TemplateIN_HN[] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 };
99 static int TemplateIN_HI[] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 };
100 static int TemplateIN_UP[] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 };
101 static int TemplateIN_BOTTOM[] = { 6, 0, 0, 1, 1, 1, 2, -1, 2, -1, 1, 0, 0 };
102 
103 static int TemplateOUT_HN[] = { 6, -2, 0, -1, 1, 0, 1, 0, -1, -1, -1, -2, 0 };
104 static int TemplateOUT_HI[] = { 6, 2, 0, 1, -1, 0, -1, 0, 1, 1, 1, 2, 0 };
105 static int TemplateOUT_UP[] = { 6, 0, -2, 1, -1, 1, 0, -1, 0, -1, -1, 0, -2 };
106 static int TemplateOUT_BOTTOM[] = { 6, 0, 2, 1, 1, 1, 0, -1, 0, -1, 1, 0, 2 };
107 
108 static int TemplateUNSPC_HN[] = { 5, 0, -1, -2, -1, -2, 1, 0, 1, 0, -1 };
109 static int TemplateUNSPC_HI[] = { 5, 0, -1, 2, -1, 2, 1, 0, 1, 0, -1 };
110 static int TemplateUNSPC_UP[] = { 5, 1, 0, 1, -2, -1, -2, -1, 0, 1, 0 };
111 static int TemplateUNSPC_BOTTOM[] = { 5, 1, 0, 1, 2, -1, 2, -1, 0, 1, 0 };
112 
113 static int TemplateBIDI_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
114 static int TemplateBIDI_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
115 static int TemplateBIDI_UP[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
116 static int TemplateBIDI_BOTTOM[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
117 
118 static int Template3STATE_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
119 static int Template3STATE_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
120 static int Template3STATE_UP[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
121 static int Template3STATE_BOTTOM[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
122 
123 static int* TemplateShape[5][4] =
124 {
130 };
131 
132 
133 SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
134  SCH_ITEM( NULL, aType ),
135  EDA_TEXT( text ),
136  m_shape( PINSHEETLABEL_SHAPE::PS_INPUT ),
137  m_isDangling( false ),
138  m_connectionType( CONNECTION_TYPE::NONE ),
139  m_spin_style( LABEL_SPIN_STYLE::LEFT )
140 {
142 
143  SetTextPos( pos );
144  SetMultilineAllowed( true );
145 }
146 
147 
148 SCH_TEXT::SCH_TEXT( const SCH_TEXT& aText ) :
149  SCH_ITEM( aText ),
150  EDA_TEXT( aText ),
151  m_shape( aText.m_shape ),
152  m_isDangling( aText.m_isDangling ),
153  m_connectionType( aText.m_connectionType ),
154  m_spin_style( aText.m_spin_style )
155 { }
156 
157 
159 {
160  return new SCH_TEXT( *this );
161 }
162 
163 
164 bool SCH_TEXT::IncrementLabel( int aIncrement )
165 {
166  wxString text = GetText();
167  bool ReturnVal = IncrementLabelMember( text, aIncrement );
168 
169  if( ReturnVal )
170  SetText( text );
171 
172  return ReturnVal;
173 }
174 
175 
176 wxPoint SCH_TEXT::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const
177 {
178  wxPoint text_offset;
179 
180  // add an offset to x (or y) position to aid readability of text on a wire or line
181  int dist = GetTextOffset( aSettings ) + GetPenWidth();
182 
183  switch( GetLabelSpinStyle() )
184  {
187  text_offset.x = -dist;
188  break; // Vert Orientation
189  default:
192  text_offset.y = -dist;
193  break; // Horiz Orientation
194  }
195 
196  return text_offset;
197 }
198 
199 
200 void SCH_TEXT::MirrorHorizontally( int aCenter )
201 {
202  // Text is NOT really mirrored; it is moved to a suitable horizontal position
203  SetLabelSpinStyle( GetLabelSpinStyle().MirrorY() );
204 
205  SetTextX( MIRRORVAL( GetTextPos().x, aCenter ) );
206 }
207 
208 
209 void SCH_TEXT::MirrorVertically( int aCenter )
210 {
211  // Text is NOT really mirrored; it is moved to a suitable vertical position
212  SetLabelSpinStyle( GetLabelSpinStyle().MirrorX() );
213 
214  SetTextY( MIRRORVAL( GetTextPos().y, aCenter ) );
215 }
216 
217 
218 void SCH_TEXT::Rotate( wxPoint aPosition )
219 {
220  wxPoint pt = GetTextPos();
221  RotatePoint( &pt, aPosition, 900 );
222  wxPoint offset = pt - GetTextPos();
223 
224  Rotate90( false );
225 
226  SetTextPos( GetTextPos() + offset );
227 }
228 
229 
230 void SCH_TEXT::Rotate90( bool aClockwise )
231 {
232  if( aClockwise )
233  SetLabelSpinStyle( GetLabelSpinStyle().RotateCW() );
234  else
235  SetLabelSpinStyle( GetLabelSpinStyle().RotateCCW() );
236 }
237 
238 
239 void SCH_TEXT::MirrorSpinStyle( bool aLeftRight )
240 {
241  if( aLeftRight )
242  SetLabelSpinStyle( GetLabelSpinStyle().MirrorY() );
243  else
244  SetLabelSpinStyle( GetLabelSpinStyle().MirrorX() );
245 }
246 
247 
249 {
250  m_spin_style = aSpinStyle;
251 
252  // Assume "Right" and Left" mean which side of the anchor the text will be on
253  // Thus we want to left justify text up agaisnt the anchor if we are on the right
254  switch( aSpinStyle )
255  {
256  default:
257  wxASSERT_MSG( 1, "Bad spin style" );
258  break;
259 
260  case LABEL_SPIN_STYLE::RIGHT: // Horiz Normal Orientation
261  //
262  m_spin_style = LABEL_SPIN_STYLE::RIGHT; // Handle the error spin style by resetting
266  break;
267 
268  case LABEL_SPIN_STYLE::UP: // Vert Orientation UP
272  break;
273 
274  case LABEL_SPIN_STYLE::LEFT: // Horiz Orientation - Right justified
278  break;
279 
280  case LABEL_SPIN_STYLE::BOTTOM: // Vert Orientation BOTTOM
284  break;
285  }
286 }
287 
288 
290 {
291  SCH_TEXT* item = (SCH_TEXT*) aItem;
292 
293  std::swap( m_layer, item->m_layer );
294 
295  std::swap( m_shape, item->m_shape );
296  std::swap( m_isDangling, item->m_isDangling );
297  std::swap( m_spin_style, item->m_spin_style );
298 
299  SwapText( *item );
300  SwapEffects( *item );
301 }
302 
303 
304 bool SCH_TEXT::operator<( const SCH_ITEM& aItem ) const
305 {
306  if( Type() != aItem.Type() )
307  return Type() < aItem.Type();
308 
309  auto other = static_cast<const SCH_TEXT*>( &aItem );
310 
311  if( GetLayer() != other->GetLayer() )
312  return GetLayer() < other->GetLayer();
313 
314  if( GetPosition().x != other->GetPosition().x )
315  return GetPosition().x < other->GetPosition().x;
316 
317  if( GetPosition().y != other->GetPosition().y )
318  return GetPosition().y < other->GetPosition().y;
319 
320  return GetText() < other->GetText();
321 }
322 
323 
324 int SCH_TEXT::GetTextOffset( const RENDER_SETTINGS* aSettings ) const
325 {
326  double ratio;
327 
328  if( aSettings )
329  ratio = static_cast<const SCH_RENDER_SETTINGS*>( aSettings )->m_TextOffsetRatio;
330  else if( Schematic() )
331  ratio = Schematic()->Settings().m_TextOffsetRatio;
332  else
333  ratio = DEFAULT_TEXT_OFFSET_RATIO; // For previews (such as in Preferences), etc.
334 
335  return KiROUND( ratio * GetTextSize().y );
336 
337  return 0;
338 }
339 
340 
342 {
343  return GetEffectiveTextPenWidth();
344 }
345 
346 
347 void SCH_TEXT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
348 {
349  COLOR4D color = aSettings->GetLayerColor( m_layer );
350  wxPoint text_offset = aOffset + GetSchematicTextOffset( aSettings );
351 
352  EDA_TEXT::Print( aSettings, text_offset, color );
353 }
354 
355 
356 void SCH_TEXT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
357 {
358  // Normal text labels cannot be tested for dangling ends.
359  if( Type() == SCH_TEXT_T )
360  return;
361 
362  DANGLING_END_ITEM item( LABEL_END, this, GetTextPos() );
363  aItemList.push_back( item );
364 }
365 
366 
367 bool SCH_TEXT::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
368  const SCH_SHEET_PATH* aPath )
369 {
370  // Normal text labels cannot be tested for dangling ends.
371  if( Type() == SCH_TEXT_T )
372  return false;
373 
374  bool previousState = m_isDangling;
375  m_isDangling = true;
377 
378  for( unsigned ii = 0; ii < aItemList.size(); ii++ )
379  {
380  DANGLING_END_ITEM& item = aItemList[ii];
381 
382  if( item.GetItem() == this )
383  continue;
384 
385  switch( item.GetType() )
386  {
387  case PIN_END:
388  case LABEL_END:
389  case SHEET_LABEL_END:
390  case NO_CONNECT_END:
391  if( GetTextPos() == item.GetPosition() )
392  {
393  m_isDangling = false;
394 
395  if( aPath && item.GetType() != PIN_END )
396  m_connected_items[ *aPath ].insert( static_cast<SCH_ITEM*>( item.GetItem() ) );
397  }
398 
399  break;
400 
401 
402  case BUS_START_END:
405 
406  case WIRE_START_END:
407  {
408  // These schematic items have created 2 DANGLING_END_ITEM one per end. But being
409  // a paranoid programmer, I'll check just in case.
410  ii++;
411 
412  wxCHECK_MSG( ii < aItemList.size(), previousState != m_isDangling,
413  wxT( "Dangling end type list overflow. Bad programmer!" ) );
414 
415  int accuracy = 1; // We have rounding issues with an accuracy of 0
416 
417  DANGLING_END_ITEM & nextItem = aItemList[ii];
419  nextItem.GetPosition(), accuracy );
420 
421  if( !m_isDangling )
422  {
425 
426  // Add the line to the connected items, since it won't be picked
427  // up by a search of intersecting connection points
428  if( aPath )
429  {
430  auto sch_item = static_cast<SCH_ITEM*>( item.GetItem() );
431  AddConnectionTo( *aPath, sch_item );
432  sch_item->AddConnectionTo( *aPath, this );
433  }
434  }
435  }
436  break;
437 
438  default:
439  break;
440  }
441 
442  if( !m_isDangling )
443  break;
444  }
445 
446  if( m_isDangling )
448 
449  return previousState != m_isDangling;
450 }
451 
452 
453 std::vector<wxPoint> SCH_TEXT::GetConnectionPoints() const
454 {
455  // Normal text labels do not have connection points. All others do.
456  if( Type() == SCH_TEXT_T )
457  return {};
458 
459  return { GetTextPos() };
460 }
461 
462 
464 {
465  EDA_RECT rect = GetTextBox();
466 
467  if( GetTextAngle() != 0 ) // Rotate rect
468  {
469  wxPoint pos = rect.GetOrigin();
470  wxPoint end = rect.GetEnd();
471 
472  RotatePoint( &pos, GetTextPos(), GetTextAngle() );
473  RotatePoint( &end, GetTextPos(), GetTextAngle() );
474 
475  rect.SetOrigin( pos );
476  rect.SetEnd( end );
477  }
478 
479  rect.Normalize();
480  return rect;
481 }
482 
483 
485 {
486  switch( aType )
487  {
488  case PINSHEETLABEL_SHAPE::PS_INPUT: return _( "Input" );
489  case PINSHEETLABEL_SHAPE::PS_OUTPUT: return _( "Output" );
490  case PINSHEETLABEL_SHAPE::PS_BIDI: return _( "Bidirectional" );
491  case PINSHEETLABEL_SHAPE::PS_TRISTATE: return _( "Tri-State" );
492  case PINSHEETLABEL_SHAPE::PS_UNSPECIFIED: return _( "Passive" );
493  default: return wxT( "???" );
494  }
495 }
496 
497 
498 void SCH_TEXT::GetContextualTextVars( wxArrayString* aVars ) const
499 {
501  aVars->push_back( wxT( "CONNECTION_TYPE" ) );
502 
503  if( Type() == SCH_SHEET_PIN_T && m_parent )
504  static_cast<SCH_SHEET*>( m_parent )->GetContextualTextVars( aVars );
505 }
506 
507 
508 wxString SCH_TEXT::GetShownText( int aDepth ) const
509 {
510  std::function<bool( wxString* )> textResolver =
511  [&]( wxString* token ) -> bool
512  {
513  if( ( Type() == SCH_GLOBAL_LABEL_T
514  || Type() == SCH_HIER_LABEL_T
515  || Type() == SCH_SHEET_PIN_T )
516  && token->IsSameAs( wxT( "CONNECTION_TYPE" ) ) )
517  {
518  *token = getElectricalTypeLabel( GetShape() );
519  return true;
520  }
521 
522  if( Type() == SCH_SHEET_PIN_T && m_parent )
523  {
524  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( m_parent );
525 
526  if( sheet->ResolveTextVar( token, aDepth ) )
527  return true;
528  }
529 
530  if( Type() == SCH_TEXT_T )
531  {
532  if( token->Contains( ':' ) )
533  {
534  if( Schematic()->ResolveCrossReference( token, aDepth ) )
535  return true;
536  }
537  else
538  {
539  SCHEMATIC* schematic = Schematic();
540  SCH_SHEET* sheet = schematic ? schematic->CurrentSheet().Last() : nullptr;
541 
542  if( sheet && sheet->ResolveTextVar( token, aDepth + 1 ) )
543  return true;
544  }
545  }
546 
547  return false;
548  };
549 
550  bool processTextVars = false;
551  wxString text = EDA_TEXT::GetShownText( &processTextVars );
552 
553  if( processTextVars )
554  {
555  wxCHECK_MSG( Schematic(), wxEmptyString, "No parent SCHEMATIC set for SCH_TEXT!" );
556 
557  PROJECT* project = nullptr;
558 
559  if( Schematic() )
560  project = &Schematic()->Prj();
561 
562  if( aDepth < 10 )
563  text = ExpandTextVars( text, &textResolver, nullptr, project );
564  }
565 
566  return text;
567 }
568 
569 
570 wxString SCH_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
571 {
572  return wxString::Format( _( "Graphic Text '%s'" ), ShortenedShownText() );
573 }
574 
575 
577 {
578  return text_xpm;
579 }
580 
581 
582 bool SCH_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
583 {
584  EDA_RECT bBox = GetBoundingBox();
585  bBox.Inflate( aAccuracy );
586  return bBox.Contains( aPosition );
587 }
588 
589 
590 bool SCH_TEXT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
591 {
592  EDA_RECT bBox = GetBoundingBox();
593  bBox.Inflate( aAccuracy );
594 
595  if( aContained )
596  return aRect.Contains( bBox );
597 
598  return aRect.Intersects( bBox );
599 }
600 
601 
602 void SCH_TEXT::Plot( PLOTTER* aPlotter )
603 {
604  static std::vector<wxPoint> s_poly;
605 
606  RENDER_SETTINGS* settings = aPlotter->RenderSettings();
607  SCH_CONNECTION* connection = Connection();
608  int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer;
609  COLOR4D color = settings->GetLayerColor( layer );
610  int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
611 
612  penWidth = std::max( penWidth, settings->GetMinPenWidth() );
613  aPlotter->SetCurrentLineWidth( penWidth );
614 
615  if( IsMultilineAllowed() )
616  {
617  std::vector<wxPoint> positions;
618  wxArrayString strings_list;
619  wxStringSplit( GetShownText(), strings_list, '\n' );
620  positions.reserve( strings_list.Count() );
621 
622  GetLinePositions( positions, (int) strings_list.Count() );
623 
624  for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
625  {
626  wxPoint textpos = positions[ii] + GetSchematicTextOffset( aPlotter->RenderSettings() );
627  wxString& txt = strings_list.Item( ii );
628  aPlotter->Text( textpos, color, txt, GetTextAngle(), GetTextSize(), GetHorizJustify(),
629  GetVertJustify(), penWidth, IsItalic(), IsBold() );
630  }
631  }
632  else
633  {
634  wxPoint textpos = GetTextPos() + GetSchematicTextOffset( aPlotter->RenderSettings() );
635 
636  aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(),
637  GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold() );
638  }
639 
640  // Draw graphic symbol for global or hierarchical labels
641  CreateGraphicShape( aPlotter->RenderSettings(), s_poly, GetTextPos() );
642 
643  if( s_poly.size() )
644  aPlotter->PlotPoly( s_poly, FILL_TYPE::NO_FILL, penWidth );
645 }
646 
647 
649 {
650  wxString msg;
651 
652  switch( Type() )
653  {
654  case SCH_TEXT_T: msg = _( "Graphic Text" ); break;
655  case SCH_LABEL_T: msg = _( "Label" ); break;
656  case SCH_GLOBAL_LABEL_T: msg = _( "Global Label" ); break;
657  case SCH_HIER_LABEL_T: msg = _( "Hierarchical Label" ); break;
658  case SCH_SHEET_PIN_T: msg = _( "Hierarchical Sheet Pin" ); break;
659  default: return;
660  }
661 
662  // Don't use GetShownText() here; we want to show the user the variable references
663  aList.push_back( MSG_PANEL_ITEM( msg, UnescapeString( GetText() ) ) );
664 
665  switch( GetLabelSpinStyle() )
666  {
667  case LABEL_SPIN_STYLE::LEFT: msg = _( "Horizontal left" ); break;
668  case LABEL_SPIN_STYLE::UP: msg = _( "Vertical up" ); break;
669  case LABEL_SPIN_STYLE::RIGHT: msg = _( "Horizontal right" ); break;
670  case LABEL_SPIN_STYLE::BOTTOM: msg = _( "Vertical down" ); break;
671  default: msg = wxT( "???" ); break;
672  }
673 
674  aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), msg, BROWN ) );
675 
676  wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
677  int style = 0;
678 
679  if( IsItalic() )
680  style = 1;
681 
682  if( IsBold() )
683  style += 2;
684 
685  aList.push_back( MSG_PANEL_ITEM( _( "Style" ), textStyle[style] ) );
686 
687  // Display electrical type if it is relevant
689  {
690  msg = getElectricalTypeLabel( GetShape() );
691  aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg ) );
692  }
693 
694  // Display text size (X or Y value, with are the same value in Eeschema)
695  msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() );
696  aList.push_back( MSG_PANEL_ITEM( _( "Size" ), msg ) );
697 
698  SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );
699 
700  if( frame )
701  {
702  if( SCH_CONNECTION* conn = Connection() )
703  {
704  conn->AppendInfoToMsgPanel( aList );
705 
706  NET_SETTINGS& netSettings = Schematic()->Prj().GetProjectFile().NetSettings();
707  const wxString& netname = conn->Name( true );
708 
709  if( netSettings.m_NetClassAssignments.count( netname ) )
710  {
711  const wxString& netclassName = netSettings.m_NetClassAssignments[ netname ];
712  aList.push_back( MSG_PANEL_ITEM( _( "Assigned Netclass" ), netclassName ) );
713  }
714  }
715  }
716 }
717 
718 #if defined(DEBUG)
719 
720 void SCH_TEXT::Show( int nestLevel, std::ostream& os ) const
721 {
722  // XML output:
723  wxString s = GetClass();
724 
725  NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str()
726  << " layer=\"" << m_layer << '"'
727  << " shape=\"" << static_cast<int>( m_shape ) << '"'
728  << " dangling=\"" << m_isDangling << '"'
729  << '>'
730  << TO_UTF8( GetText() )
731  << "</" << s.Lower().mb_str() << ">\n";
732 }
733 
734 #endif
735 
736 
737 SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text )
738  : SCH_TEXT( pos, text, SCH_LABEL_T )
739 {
742  m_isDangling = true;
743  SetMultilineAllowed( false );
744 }
745 
746 
748 {
749  return new SCH_LABEL( *this );
750 }
751 
752 
753 bool SCH_LABEL::IsType( const KICAD_T aScanTypes[] ) const
754 {
755  static KICAD_T wireTypes[] = { SCH_LINE_LOCATE_WIRE_T, SCH_PIN_T, EOT };
756  static KICAD_T busTypes[] = { SCH_LINE_LOCATE_BUS_T, EOT };
757 
758  if( SCH_ITEM::IsType( aScanTypes ) )
759  return true;
760 
761  wxCHECK_MSG( Schematic(), false, "No parent SCHEMATIC set for SCH_LABEL!" );
762 
763  SCH_SHEET_PATH current = Schematic()->CurrentSheet();
764 
765  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
766  {
767  if( *p == SCH_LABEL_LOCATE_WIRE_T )
768  {
769  wxASSERT( m_connected_items.count( current ) );
770 
771  for( SCH_ITEM* connection : m_connected_items.at( current ) )
772  {
773  if( connection->IsType( wireTypes ) )
774  return true;
775  }
776  }
777  else if ( *p == SCH_LABEL_LOCATE_BUS_T )
778  {
779  wxASSERT( m_connected_items.count( current ) );
780 
781  for( SCH_ITEM* connection : m_connected_items.at( current ) )
782  {
783  if( connection->IsType( busTypes ) )
784  return true;
785  }
786  }
787  }
788 
789  return false;
790 }
791 
792 
794 {
795  EDA_RECT rect = GetTextBox();
796 
797  rect.Offset( 0, -GetTextOffset() );
798 
799  if( GetTextAngle() != 0.0 )
800  {
801  // Rotate rect
802  wxPoint pos = rect.GetOrigin();
803  wxPoint end = rect.GetEnd();
804 
805  RotatePoint( &pos, GetTextPos(), GetTextAngle() );
806  RotatePoint( &end, GetTextPos(), GetTextAngle() );
807 
808  rect.SetOrigin( pos );
809  rect.SetEnd( end );
810 
811  rect.Normalize();
812  }
813 
814  // Labels have a position point that is outside of the TextBox
815  rect.Merge( GetPosition() );
816 
817  return rect;
818 }
819 
820 
821 wxString SCH_LABEL::GetSelectMenuText( EDA_UNITS aUnits ) const
822 {
823  return wxString::Format( _( "Label '%s'" ), ShortenedShownText() );
824 }
825 
826 
828 {
829  return add_line_label_xpm;
830 }
831 
832 
833 SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) :
834  SCH_TEXT( pos, text, SCH_GLOBAL_LABEL_T ),
835  m_intersheetRefsField( { 0, 0 }, 0, this )
836 {
837  m_layer = LAYER_GLOBLABEL;
839  m_isDangling = true;
840  SetMultilineAllowed( false );
841 
842  SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
843 
844  m_intersheetRefsField.SetText( wxT( "${INTERSHEET_REFS}" ) );
845  m_intersheetRefsField.SetLayer( LAYER_GLOBLABEL );
846  m_intersheetRefsField.SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
847  m_fieldsAutoplaced = FIELDS_AUTOPLACED_AUTO;
848 }
849 
850 
852  SCH_TEXT( aGlobalLabel ),
853  m_intersheetRefsField( { 0, 0 }, 0, this )
854 {
855  m_intersheetRefsField = aGlobalLabel.m_intersheetRefsField;
856 
857  // Re-parent the fields, which before this had aGlobalLabel as parent
858  m_intersheetRefsField.SetParent( this );
859 
860  m_fieldsAutoplaced = aGlobalLabel.m_fieldsAutoplaced;
861 }
862 
863 
865 {
866  return new SCH_GLOBALLABEL( *this );
867 }
868 
869 
871 {
872  SCH_TEXT::SwapData( aItem );
873 
874  SCH_GLOBALLABEL* globalLabel = static_cast<SCH_GLOBALLABEL*>( aItem );
875 
876  // Swap field data wholesale...
877  std::swap( m_intersheetRefsField, globalLabel->m_intersheetRefsField );
878 
879  // ...and then reset parent pointers.
880  globalLabel->m_intersheetRefsField.SetParent( globalLabel );
882 }
883 
884 
885 SEARCH_RESULT SCH_GLOBALLABEL::Visit( INSPECTOR aInspector, void* testData,
886  const KICAD_T aFilterTypes[] )
887 {
888  KICAD_T stype;
889 
890  for( const KICAD_T* p = aFilterTypes; (stype = *p) != EOT; ++p )
891  {
892  // If caller wants to inspect my type
893  if( stype == SCH_LOCATE_ANY_T || stype == Type() )
894  {
895  if( SEARCH_RESULT::QUIT == aInspector( this, NULL ) )
896  return SEARCH_RESULT::QUIT;
897  }
898 
899  if( stype == SCH_LOCATE_ANY_T || stype == SCH_FIELD_T )
900  {
901  if( SEARCH_RESULT::QUIT == aInspector( GetIntersheetRefs(), this ) )
902  return SEARCH_RESULT::QUIT;
903  }
904  }
905 
907 }
908 
909 
910 void SCH_GLOBALLABEL::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction )
911 {
912  aFunction( &m_intersheetRefsField );
913 }
914 
915 
917 {
918  wxPoint text_offset;
919  int dist = GetTextOffset( aSettings );
920 
921  switch( m_shape )
922  {
926  dist += GetTextHeight() * 3 / 4; // Use three-quarters-height as proxy for triangle size
927  break;
928 
931  default:
932  break;
933  }
934 
935  switch( GetLabelSpinStyle() )
936  {
937  default:
938  case LABEL_SPIN_STYLE::LEFT: text_offset.x -= dist; break;
939  case LABEL_SPIN_STYLE::UP: text_offset.y -= dist; break;
940  case LABEL_SPIN_STYLE::RIGHT: text_offset.x += dist; break;
941  case LABEL_SPIN_STYLE::BOTTOM: text_offset.y += dist; break;
942  }
943 
944  return text_offset;
945 }
946 
947 
949 {
950  m_spin_style = aSpinStyle;
951 
952  switch( aSpinStyle )
953  {
954  default:
955  wxASSERT_MSG( 1, "Bad spin style" );
958 
959  case LABEL_SPIN_STYLE::RIGHT: // Horiz Normal Orientation
962  break;
963 
964  case LABEL_SPIN_STYLE::UP: // Vert Orientation UP
967  break;
968 
969  case LABEL_SPIN_STYLE::LEFT: // Horiz Orientation
972  break;
973 
974  case LABEL_SPIN_STYLE::BOTTOM: // Vert Orientation BOTTOM
977  break;
978  }
979 }
980 
981 
982 void SCH_GLOBALLABEL::Rotate( wxPoint aPosition )
983 {
984  wxPoint pt = GetTextPos();
985  RotatePoint( &pt, aPosition, 900 );
986  wxPoint offset = pt - GetTextPos();
987 
988  Rotate90( false );
989 
990  SetTextPos( GetTextPos() + offset );
992 }
993 
994 
995 void SCH_GLOBALLABEL::Rotate90( bool aClockwise )
996 {
997  SCH_TEXT::Rotate90( aClockwise );
998 
1001  {
1002  if( !aClockwise )
1004 
1006  }
1009  {
1010  if( !aClockwise )
1012 
1014  }
1017  {
1018  if( aClockwise )
1020 
1022  }
1025  {
1026  if( aClockwise )
1028 
1030  }
1031 
1032  wxPoint pos = m_intersheetRefsField.GetTextPos();
1033  RotatePoint( &pos, GetPosition(), aClockwise ? -900 : 900 );
1035 }
1036 
1037 
1038 void SCH_GLOBALLABEL::MirrorSpinStyle( bool aLeftRight )
1039 {
1040  SCH_TEXT::MirrorSpinStyle( aLeftRight );
1041 
1042  if( ( aLeftRight && m_intersheetRefsField.GetTextAngle() == TEXT_ANGLE_HORIZ )
1043  || ( !aLeftRight && m_intersheetRefsField.GetTextAngle() == TEXT_ANGLE_VERT ) )
1044  {
1047  else
1049  }
1050 
1051  wxPoint pos = m_intersheetRefsField.GetTextPos();
1052  wxPoint delta = GetPosition() - pos;
1053 
1054  if( aLeftRight )
1055  pos.x = GetPosition().x + delta.x;
1056  else
1057  pos.y = GetPosition().y + delta.y;
1058 
1060 }
1061 
1062 
1064 {
1065  wxPoint old_pos = GetPosition();
1066  SCH_TEXT::MirrorHorizontally( aCenter );
1067 
1070  else
1072 
1073  wxPoint pos = m_intersheetRefsField.GetTextPos();
1074  wxPoint delta = old_pos - pos;
1075  pos.x = GetPosition().x + delta.x;
1076 
1078 }
1079 
1080 
1082 {
1083  wxPoint old_pos = GetPosition();
1084  SCH_TEXT::MirrorVertically( aCenter );
1085  wxPoint pos = m_intersheetRefsField.GetTextPos();
1086  wxPoint delta = old_pos - pos;
1087  pos.y = GetPosition().y + delta.y;
1088 
1090 }
1091 
1092 
1094 {
1099 
1101  AutoplaceFields( nullptr, false );
1102 }
1103 
1104 
1105 void SCH_GLOBALLABEL::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
1106 {
1107  int margin = GetTextOffset();
1108  int labelLen = GetBoundingBox().GetSizeMax();
1109  int penOffset = GetPenWidth() / 2;
1110 
1111  // Set both axes to penOffset; we're going to overwrite the text axis below
1112  wxPoint offset( -penOffset, -penOffset );
1113 
1114  switch( GetLabelSpinStyle() )
1115  {
1116  default:
1120  offset.x = - ( labelLen + margin / 2 );
1121  break;
1122 
1123  case LABEL_SPIN_STYLE::UP:
1126  offset.y = - ( labelLen + margin / 2 );
1127  break;
1128 
1132  offset.x = labelLen + margin /2 ;
1133  break;
1134 
1138  offset.y = labelLen + margin / 2;
1139  break;
1140  }
1141 
1143 
1145 }
1146 
1147 
1148 bool SCH_GLOBALLABEL::ResolveTextVar( wxString* token, int aDepth ) const
1149 {
1150  if( token->IsSameAs( wxT( "INTERSHEET_REFS" ) ) && Schematic() )
1151  {
1152  auto it = Schematic()->GetPageRefsMap().find( GetText() );
1153 
1154  if( it != Schematic()->GetPageRefsMap().end() )
1155  {
1156  SCHEMATIC_SETTINGS& settings = Schematic()->Settings();
1157  std::vector<wxString> pageListCopy;
1158 
1159  pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() );
1160  std::sort( pageListCopy.begin(), pageListCopy.end() );
1161 
1162  token->Printf( "%s", settings.m_IntersheetRefsPrefix );
1163 
1164  if( ( settings.m_IntersheetRefsFormatShort ) && ( pageListCopy.size() > 2 ) )
1165  {
1166  token->Append( wxString::Format( wxT( "%s..%s" ),
1167  pageListCopy.front(),
1168  pageListCopy.back() ) );
1169  }
1170  else
1171  {
1172  for( const wxString& pageNo : pageListCopy )
1173  token->Append( wxString::Format( wxT( "%s," ), pageNo ) );
1174 
1175  if( !token->IsEmpty() && token->Last() == ',' )
1176  token->RemoveLast();
1177  }
1178 
1179  token->Append( settings.m_IntersheetRefsSuffix );
1180  }
1181 
1182  return true;
1183  }
1184 
1185  return false;
1186 }
1187 
1188 
1189 void SCH_GLOBALLABEL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
1190 {
1191  static std::vector<wxPoint> s_poly;
1192 
1193  SCH_CONNECTION* connection = Connection();
1194  int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer;
1195  wxDC* DC = aSettings->GetPrintDC();
1196  COLOR4D color = aSettings->GetLayerColor( layer );
1197  int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
1198  wxPoint text_offset = aOffset + GetSchematicTextOffset( aSettings );
1199 
1200  EDA_TEXT::Print( aSettings, text_offset, color );
1201 
1202  CreateGraphicShape( aSettings, s_poly, GetTextPos() + aOffset );
1203  GRPoly( nullptr, DC, s_poly.size(), &s_poly[0], false, penWidth, color, color );
1204 
1206  m_intersheetRefsField.Print( aSettings, aOffset );
1207 }
1208 
1210 {
1211  SCH_TEXT::Plot( aPlotter );
1212 
1213  bool show = Schematic()->Settings().m_IntersheetRefsShow;
1214 
1215  if ( show )
1216  m_intersheetRefsField.Plot( aPlotter );
1217 }
1218 
1220  std::vector<wxPoint>& aPoints, const wxPoint& Pos )
1221 {
1222  int margin = GetTextOffset( aRenderSettings );
1223  int halfSize = ( GetTextHeight() / 2 ) + margin;
1224  int linewidth = GetPenWidth();
1225  int symb_len = LenSize( GetShownText(), linewidth ) + 2 * margin;
1226 
1227  int x = symb_len + linewidth + 3;
1228  int y = halfSize + linewidth + 3;
1229 
1230  aPoints.clear();
1231 
1232  // Create outline shape : 6 points
1233  aPoints.emplace_back( wxPoint( 0, 0 ) );
1234  aPoints.emplace_back( wxPoint( 0, -y ) ); // Up
1235  aPoints.emplace_back( wxPoint( -x, -y ) ); // left
1236  aPoints.emplace_back( wxPoint( -x, 0 ) ); // Up left
1237  aPoints.emplace_back( wxPoint( -x, y ) ); // left down
1238  aPoints.emplace_back( wxPoint( 0, y ) ); // down
1239 
1240  int x_offset = 0;
1241 
1242  switch( m_shape )
1243  {
1245  x_offset = -halfSize;
1246  aPoints[0].x += halfSize;
1247  break;
1248 
1250  aPoints[3].x -= halfSize;
1251  break;
1252 
1255  x_offset = -halfSize;
1256  aPoints[0].x += halfSize;
1257  aPoints[3].x -= halfSize;
1258  break;
1259 
1261  default:
1262  break;
1263  }
1264 
1265  int angle = 0;
1266 
1267  switch( GetLabelSpinStyle() )
1268  {
1269  default:
1270  case LABEL_SPIN_STYLE::LEFT: break;
1271  case LABEL_SPIN_STYLE::UP: angle = -900; break;
1272  case LABEL_SPIN_STYLE::RIGHT: angle = 1800; break;
1273  case LABEL_SPIN_STYLE::BOTTOM: angle = 900; break;
1274  }
1275 
1276  // Rotate outlines and move corners in real position
1277  for( wxPoint& aPoint : aPoints )
1278  {
1279  aPoint.x += x_offset;
1280 
1281  if( angle )
1282  RotatePoint( &aPoint, angle );
1283 
1284  aPoint += Pos;
1285  }
1286 
1287  aPoints.push_back( aPoints[0] ); // closing
1288 }
1289 
1290 
1292 {
1293  int x = GetTextPos().x;
1294  int y = GetTextPos().y;
1295  int penWidth = GetEffectiveTextPenWidth();
1296  int margin = GetTextOffset();
1297  int height = ( ( GetTextHeight() * 15 ) / 10 ) + penWidth + margin;
1298  int length = LenSize( GetShownText(), penWidth )
1299  + height // add height for triangular shapes
1300  - margin; // margin added to height not needed here
1301 
1302  int dx, dy;
1303 
1304  switch( GetLabelSpinStyle() ) // respect orientation
1305  {
1306  default:
1308  dx = -length;
1309  dy = height;
1310  y -= height / 2;
1311  break;
1312 
1313  case LABEL_SPIN_STYLE::UP:
1314  dx = height;
1315  dy = -length;
1316  x -= height / 2;
1317  break;
1318 
1320  dx = length;
1321  dy = height;
1322  y -= height / 2;
1323  break;
1324 
1326  dx = height;
1327  dy = length;
1328  x -= height / 2;
1329  break;
1330  }
1331 
1332  EDA_RECT box( wxPoint( x, y ), wxSize( dx, dy ) );
1333  box.Normalize();
1334  return box;
1335 }
1336 
1337 
1339 {
1340  return wxString::Format( _( "Global Label '%s'" ), ShortenedShownText() );
1341 }
1342 
1343 
1345 {
1346  return add_glabel_xpm;
1347 }
1348 
1349 
1350 SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text, KICAD_T aType )
1351  : SCH_TEXT( pos, text, aType )
1352 {
1355  m_isDangling = true;
1356  SetMultilineAllowed( false );
1357 }
1358 
1359 
1361 {
1362  return new SCH_HIERLABEL( *this );
1363 }
1364 
1365 
1367 {
1368  m_spin_style = aSpinStyle;
1369 
1370  // Assume "Right" and Left" mean which side of the port symbol the text will be on
1371  // If we are left of the symbol, we want to right justify to line up with the symbol
1372  switch( aSpinStyle )
1373  {
1374  default:
1375  wxLogWarning( "SetLabelSpinStyle bad spin style" );
1376  break;
1377 
1379  //
1380  m_spin_style = LABEL_SPIN_STYLE::LEFT; // Handle the error spin style by resetting
1384  break;
1385 
1386  case LABEL_SPIN_STYLE::UP:
1390  break;
1391 
1396  break;
1397 
1402  break;
1403  }
1404 }
1405 
1406 
1407 void SCH_HIERLABEL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& offset )
1408 {
1409  wxCHECK_RET( Schematic(), "No parent SCHEMATIC set for SCH_LABEL!" );
1410 
1411  static std::vector <wxPoint> Poly;
1412 
1413  wxDC* DC = aSettings->GetPrintDC();
1414  SCH_CONNECTION* conn = Connection();
1415  bool isBus = conn && conn->IsBus();
1416  COLOR4D color = aSettings->GetLayerColor( isBus ? LAYER_BUS : m_layer );
1417  int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
1418  wxPoint textOffset = offset + GetSchematicTextOffset( aSettings );
1419 
1420  EDA_TEXT::Print( aSettings, textOffset, color );
1421 
1422  CreateGraphicShape( aSettings, Poly, GetTextPos() + offset );
1423  GRPoly( nullptr, DC, Poly.size(), &Poly[0], false, penWidth, color, color );
1424 }
1425 
1426 
1428  std::vector<wxPoint>& aPoints, const wxPoint& Pos )
1429 {
1430  int* Template = TemplateShape[static_cast<int>( m_shape )][static_cast<int>( m_spin_style )];
1431  int halfSize = GetTextHeight() / 2;
1432  int imax = *Template;
1433  Template++;
1434 
1435  aPoints.clear();
1436 
1437  for( int ii = 0; ii < imax; ii++ )
1438  {
1439  wxPoint corner;
1440  corner.x = ( halfSize * (*Template) ) + Pos.x;
1441  Template++;
1442 
1443  corner.y = ( halfSize * (*Template) ) + Pos.y;
1444  Template++;
1445 
1446  aPoints.push_back( corner );
1447  }
1448 }
1449 
1450 
1452 {
1453  int penWidth = GetEffectiveTextPenWidth();
1454  int margin = GetTextOffset();
1455 
1456  int x = GetTextPos().x;
1457  int y = GetTextPos().y;
1458 
1459  int height = GetTextHeight() + penWidth + margin;
1460  int length = LenSize( GetShownText(), penWidth )
1461  + height; // add height for triangular shapes
1462 
1463  int dx, dy;
1464 
1465  switch( GetLabelSpinStyle() )
1466  {
1467  default:
1469  dx = -length;
1470  dy = height;
1471  x += Mils2iu( DANGLING_SYMBOL_SIZE );
1472  y -= height / 2;
1473  break;
1474 
1475  case LABEL_SPIN_STYLE::UP:
1476  dx = height;
1477  dy = -length;
1478  x -= height / 2;
1479  y += Mils2iu( DANGLING_SYMBOL_SIZE );
1480  break;
1481 
1483  dx = length;
1484  dy = height;
1485  x -= Mils2iu( DANGLING_SYMBOL_SIZE );
1486  y -= height / 2;
1487  break;
1488 
1490  dx = height;
1491  dy = length;
1492  x -= height / 2;
1493  y -= Mils2iu( DANGLING_SYMBOL_SIZE );
1494  break;
1495  }
1496 
1497  EDA_RECT box( wxPoint( x, y ), wxSize( dx, dy ) );
1498  box.Normalize();
1499  return box;
1500 }
1501 
1502 
1504 {
1505  wxPoint text_offset;
1506  int dist = GetTextOffset( aSettings );
1507 
1508  dist += GetTextWidth();
1509 
1510  switch( GetLabelSpinStyle() )
1511  {
1512  default:
1513  case LABEL_SPIN_STYLE::LEFT: text_offset.x = -dist; break; // Orientation horiz normale
1514  case LABEL_SPIN_STYLE::UP: text_offset.y = -dist; break; // Orientation vert UP
1515  case LABEL_SPIN_STYLE::RIGHT: text_offset.x = dist; break; // Orientation horiz inverse
1516  case LABEL_SPIN_STYLE::BOTTOM: text_offset.y = dist; break; // Orientation vert BOTTOM
1517  }
1518 
1519  return text_offset;
1520 }
1521 
1522 
1524 {
1525  return wxString::Format( _( "Hierarchical Label '%s'" ), ShortenedShownText() );
1526 }
1527 
1528 
1530 {
1532 }
1533 
1534 
1535 HTML_MESSAGE_BOX* SCH_TEXT::ShowSyntaxHelp( wxWindow* aParentWindow )
1536 {
1537  wxString msg =
1538 #include "sch_text_help_md.h"
1539  ;
1540 
1541  HTML_MESSAGE_BOX* dlg = new HTML_MESSAGE_BOX( nullptr, _( "Syntax Help" ) );
1542  wxSize sz( 320, 320 );
1543 
1544  dlg->SetMinSize( dlg->ConvertDialogToPixels( sz ) );
1545  dlg->SetDialogSizeInDU( sz.x, sz.y );
1546 
1547  wxString html_txt;
1548  ConvertMarkdown2Html( wxGetTranslation( msg ), html_txt );
1549  dlg->m_htmlWindow->AppendToPage( html_txt );
1550  dlg->ShowModeless();
1551 
1552  return dlg;
1553 }
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_text.cpp:209
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
Definition: sch_text.cpp:910
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: eda_text.h:50
bool IsBold() const
Definition: eda_text.h:190
void Offset(int dx, int dy)
Definition: eda_rect.h:152
BITMAP_DEF GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_text.cpp:827
static int Template3STATE_HN[]
Definition: sch_text.cpp:118
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:528
std::map< wxString, wxString > m_NetClassAssignments
Definition: net_settings.h:43
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:125
void SwapEffects(EDA_TEXT &aTradingPartner)
Swap the text effects of the two involved instances.
Definition: eda_text.cpp:151
static int TemplateUNSPC_HN[]
Definition: sch_text.cpp:108
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
wxPoint GetPosition() const
Definition: sch_item.h:142
static int Template3STATE_HI[]
Definition: sch_text.cpp:119
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
static int TemplateUNSPC_HI[]
Definition: sch_text.cpp:109
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: eda_rect.cpp:431
Container for project specific data.
Definition: project.h:62
PNG memory record (file in memory).
Definition: bitmap_def.h:29
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Definition: common.cpp:58
Holds all the data relating to one schematic A schematic may consist of one or more sheets (and one r...
Definition: schematic.h:58
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
static int TemplateOUT_UP[]
Definition: sch_text.cpp:105
void ConvertMarkdown2Html(const wxString &aMarkdownInput, wxString &aHtmlOutput)
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &offset) override
Print a schematic item.
Definition: sch_text.cpp:1189
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Adds a connection link between this item and another.
Definition: sch_item.cpp:170
LABEL_SPIN_STYLE m_spin_style
The orientation of text and any associated drawing elements of derived objects.
Definition: sch_text.h:185
wxPoint GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
Definition: sch_text.cpp:916
bool m_isDangling
True if not connected to another object if the object derive from SCH_TEXT supports connections.
Definition: sch_text.h:172
void GRPoly(EDA_RECT *ClipBox, wxDC *DC, int n, const wxPoint *Points, bool Fill, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:540
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: sch_text.cpp:1338
static int TemplateOUT_HN[]
Definition: sch_text.cpp:103
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:145
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
Definition: sch_text.cpp:582
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:125
void SetItalic(bool isItalic)
Definition: eda_text.h:186
int color
Definition: DXF_plotter.cpp:60
EDA_RECT 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:223
static int TemplateUNSPC_UP[]
Definition: sch_text.cpp:110
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:253
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:97
static int TemplateIN_UP[]
Definition: sch_text.cpp:100
const BITMAP_OPAQUE text_xpm[1]
Definition: text.cpp:17
Definition: color4d.h:61
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
double GetTextAngle() const
Definition: eda_text.h:181
static int TemplateOUT_HI[]
Definition: sch_text.cpp:104
void CreateGraphicShape(const RENDER_SETTINGS *aRenderSettings, std::vector< wxPoint > &aPoints, const wxPoint &aPos) override
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_text.cpp:1219
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:126
NET_SETTINGS & NetSettings()
Definition: project_file.h:92
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_TYPE aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL)=0
Draw a polygon ( filled or not )
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: sch_text.cpp:570
static int TemplateBIDI_HI[]
Definition: sch_text.cpp:114
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: sch_text.cpp:821
Schematic editor (Eeschema) main window.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:244
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:228
CONNECTION_TYPE
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &offset) override
Print a schematic item.
Definition: sch_text.cpp:1407
const BITMAP_OPAQUE add_hierarchical_label_xpm[1]
void Plot(PLOTTER *aPlotter) override
Plot the schematic item to aPlotter.
Definition: sch_text.cpp:1209
SCH_GLOBALLABEL(const wxPoint &aPos=wxPoint(0, 0), const wxString &aText=wxEmptyString)
Definition: sch_text.cpp:833
int GetTextThickness() const
Definition: eda_text.h:167
The base class for create windows for drawing purpose.
CONNECTION_TYPE m_connectionType
Definition: sch_text.h:174
virtual wxPoint GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const
Definition: sch_text.cpp:176
const BITMAP_OPAQUE add_line_label_xpm[1]
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
FIELDS_AUTOPLACED m_fieldsAutoplaced
Definition: sch_item.h:203
static int Template3STATE_BOTTOM[]
Definition: sch_text.cpp:121
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:94
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
void MirrorSpinStyle(bool aLeftRight) override
Definition: sch_text.cpp:1038
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:165
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:157
BITMAP_DEF GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_text.cpp:1344
int GetTextHeight() const
Definition: eda_text.h:251
virtual void Text(const wxPoint &aPos, const COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=NULL)
Draws text with the plotter.
Definition: gr_text.cpp:219
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:131
bool TestSegmentHit(const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
Definition: trigo.cpp:129
static int TemplateIN_BOTTOM[]
Definition: sch_text.cpp:101
int GetPenWidth() const override
Definition: sch_text.cpp:341
void SetTextX(int aX)
Definition: eda_text.h:256
bool IsItalic() const
Definition: eda_text.h:187
No connection to this item.
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:119
void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< wxPoint > &aPoints, const wxPoint &Pos) override
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_text.cpp:1427
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
static int TemplateOUT_BOTTOM[]
Definition: sch_text.cpp:106
void GetContextualTextVars(wxArrayString *aVars) const
Returns the set of contextual text variable tokens for this text item.
Definition: sch_text.cpp:498
const wxPoint GetEnd() const
Definition: eda_rect.h:108
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_text.cpp:747
int LenSize(const wxString &aLine, int aThickness) const
Definition: eda_text.cpp:188
bool ResolveTextVar(wxString *token, int aDepth) const
Definition: sch_text.cpp:1148
SCH_LAYER_ID m_layer
Definition: sch_item.h:201
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_text.cpp:158
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_text.cpp:1360
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:205
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:121
#define NULL
#define DANGLING_SYMBOL_SIZE
wxPoint GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
Definition: sch_text.cpp:1503
const wxPoint GetOrigin() const
Definition: eda_rect.h:106
void SetEnd(int x, int y)
Definition: eda_rect.h:187
static int TemplateIN_HI[]
Definition: sch_text.cpp:99
const wxSize & GetTextSize() const
Definition: eda_text.h:245
void SetVertJustify(EDA_TEXT_VJUSTIFY_T aType)
Definition: eda_text.h:209
static int Template3STATE_UP[]
Definition: sch_text.cpp:120
bool IncrementLabel(int aIncrement)
Increment the label text, if it ends with a number.
Definition: sch_text.cpp:164
bool ResolveCrossReference(wxString *token, int aDepth) const
Resolves text vars that refer to other items.
Definition: schematic.cpp:210
Helper dialog and control classes.
wxString ShortenedShownText() const
Returns a shortened version (max 15 characters) of the shown text.
Definition: eda_text.cpp:202
virtual void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< wxPoint > &aPoints, const wxPoint &Pos)
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_text.h:256
EDA_ITEM * GetItem() const
Definition: sch_item.h:143
static int TemplateBIDI_HN[]
Definition: sch_text.cpp:113
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_text.cpp:200
void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle) override
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:1366
NET_SETTINGS stores various net-related settings in a project context.
Definition: net_settings.h:31
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_text.cpp:1291
virtual bool IsType(const KICAD_T aScanTypes[]) const
Check whether the item is one of the listed types.
Definition: eda_item.h:232
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_text.cpp:356
wxDC * GetPrintDC() const
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_text.cpp:1451
LABEL_SPIN_STYLE GetLabelSpinStyle() const
Definition: sch_text.h:233
int GetTextOffset(const RENDER_SETTINGS *aSettings=nullptr) const
Definition: sch_text.cpp:324
SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const 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_text.cpp:885
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_text.cpp:463
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
HTML_MESSAGE_BOX.
void UpdateIntersheetRefProps()
Definition: sch_text.cpp:1093
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: sch_text.cpp:508
wxPoint GetPosition() const override
Definition: sch_text.h:312
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &offset) override
Print a schematic item.
Definition: sch_text.cpp:347
std::unordered_map< SCH_SHEET_PATH, SCH_ITEM_SET > m_connected_items
Stores pointers to other items that are connected to this one, per sheet.
Definition: sch_item.h:208
void SetMultilineAllowed(bool aAllow)
Definition: eda_text.h:202
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_text.cpp:1081
bool IsMultilineAllowed() const
Definition: eda_text.h:203
static int TemplateBIDI_BOTTOM[]
Definition: sch_text.cpp:116
This item represents a net.
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
Definition: string.cpp:807
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:219
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:99
virtual void Rotate90(bool aClockwise)
Definition: sch_text.cpp:230
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:287
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_text.cpp:1063
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
void ShowModeless()
Show a modeless version of the dialog (without an OK button).
EDA_UNITS
Definition: eda_units.h:38
void SetDialogSizeInDU(int aWidth, int aHeight)
set the dialog size, using a "logical" value.
void Normalize()
Ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
const BITMAP_OPAQUE add_glabel_xpm[1]
Definition: add_glabel.cpp:37
SCH_FIELD * GetIntersheetRefs()
Definition: sch_text.h:442
No updates are required.
Definition: view_item.h:51
Base plotter engine class.
Definition: plotter.h:121
bool operator<(const SCH_ITEM &aItem) const override
Definition: sch_text.cpp:304
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
Definition: sch_text.cpp:1535
void SwapText(EDA_TEXT &aTradingPartner)
Definition: eda_text.cpp:143
void Plot(PLOTTER *aPlotter) override
Plot the schematic item to aPlotter.
Definition: sch_field.cpp:600
PINSHEETLABEL_SHAPE
Definition: sch_text.h:151
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, COLOR4D aColor, OUTLINE_MODE aDisplay_mode=FILLED)
Print this text object to the device context aDC.
Definition: eda_text.cpp:401
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:155
int GetTextWidth() const
Definition: eda_text.h:248
static int TemplateBIDI_UP[]
Definition: sch_text.cpp:115
const char * name
Definition: DXF_plotter.cpp:59
SCH_FIELD m_intersheetRefsField
Definition: sch_text.h:462
void Plot(PLOTTER *aPlotter) override
Plot the schematic item to aPlotter.
Definition: sch_text.cpp:602
std::vector< wxPoint > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
Definition: sch_text.cpp:453
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:208
#define _(s)
Definition: 3d_actions.cpp:33
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_text.cpp:289
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:150
void Rotate(wxPoint aPosition) override
Rotate the item around aPosition 90 degrees in the clockwise direction.
Definition: sch_text.cpp:218
virtual wxString GetClass() const override
Return the class name.
Definition: sch_text.h:206
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
BITMAP_DEF GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_text.cpp:576
Handle the component boundary box.
Definition: eda_rect.h:42
DANGLING_END_T GetType() const
Definition: sch_item.h:145
T MIRRORVAL(T aPoint, T aMirrorRef)
Returns the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:31
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:68
static int * TemplateShape[5][4]
Definition: sch_text.cpp:123
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:149
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_text.cpp:1105
These settings were stored in SCH_BASE_FRAME previously.
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_text.cpp:367
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:97
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Definition: eda_rect.cpp:150
void GetLinePositions(std::vector< wxPoint > &aPositions, int aLineCount) const
Populate aPositions with the position of each line of a multiline text, according to the vertical jus...
Definition: eda_text.cpp:424
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_text.cpp:793
std::map< wxString, std::set< wxString > > & GetPageRefsMap()
Definition: schematic.h:182
SCH_RENDER_SETTINGS Stores schematic-specific render settings.
Definition: sch_painter.h:72
wxString getElectricalTypeLabel(PINSHEETLABEL_SHAPE aType)
Definition: sch_text.cpp:484
int GetDefaultPenWidth() const
const wxPoint & GetTextPos() const
Definition: eda_text.h:254
PINSHEETLABEL_SHAPE m_shape
Definition: sch_text.h:168
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.h:166
virtual void MirrorSpinStyle(bool aLeftRight)
Definition: sch_text.cpp:239
Helper class used to store the state of schematic items that can be connected to other schematic item...
Definition: sch_item.h:87
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
Definition: sch_sheet.cpp:209
#define TEXT_ANGLE_VERT
Definition: eda_text.h:51
virtual void SetTextAngle(double aAngle)
Definition: eda_text.h:174
void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle) override
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:948
bool IsType(const KICAD_T aScanTypes[]) const override
Check whether the item is one of the listed types.
Definition: sch_text.cpp:753
SCH_HIERLABEL(const wxPoint &aPos=wxPoint(0, 0), const wxString &aText=wxEmptyString, KICAD_T aType=SCH_HIER_LABEL_T)
Definition: sch_text.cpp:1350
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_text.cpp:864
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:54
static int TemplateUNSPC_BOTTOM[]
Definition: sch_text.cpp:111
virtual void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:248
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:141
bool IsBus() const
SEARCH_RESULT
Definition: eda_item.h:40
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: sch_text.cpp:1523
Message panel definition file.
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Print a schematic item.
Definition: sch_field.cpp:198
BITMAP_DEF GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_text.cpp:1529
void Rotate90(bool aClockwise) override
Definition: sch_text.cpp:995
SCH_TEXT(const wxPoint &aPos=wxPoint(0, 0), const wxString &aText=wxEmptyString, KICAD_T aType=SCH_TEXT_T)
Definition: sch_text.cpp:133
void SetBold(bool aBold)
Definition: eda_text.h:189
void SetPosition(const wxPoint &aPosition) override
Definition: sch_field.cpp:650
SCH_LABEL(const wxPoint &aPos=wxPoint(0, 0), const wxString &aText=wxEmptyString)
Definition: sch_text.cpp:737
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:196
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
int GetSizeMax() const
Definition: eda_rect.h:101
void Rotate(wxPoint aPosition) override
Rotate the item around aPosition 90 degrees in the clockwise direction.
Definition: sch_text.cpp:982
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:141
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_text.cpp:870
#define DEFAULT_TEXT_OFFSET_RATIO
The offset of the pin name string from the end of the pin in mils.
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
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_text.cpp:648
This item represents a bus vector.
bool IncrementLabelMember(wxString &name, int aIncrement)
Definition: sch_text.cpp:54
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:363
static int TemplateIN_HN[]
Definition: sch_text.cpp:98
void SetTextY(int aY)
Definition: eda_text.h:257
PINSHEETLABEL_SHAPE GetShape() const
Definition: sch_text.h:235
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98