KiCad PCB EDA Suite
sch_sheet.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) 1992-2020 Kicad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #include <fctsys.h>
26 #include <sch_draw_panel.h>
27 #include <gr_text.h>
28 #include <trigo.h>
29 #include <sch_edit_frame.h>
30 #include <plotter.h>
31 #include <kicad_string.h>
32 #include <msgpanel.h>
33 #include <math/util.h> // for KiROUND
34 #include <sch_sheet.h>
35 #include <sch_sheet_path.h>
36 #include <sch_component.h>
37 #include <sch_painter.h>
38 #include <schematic.h>
40 #include <trace_helpers.h>
41 #include <pgm_base.h>
42 
43 
44 const wxString SCH_SHEET::GetDefaultFieldName( int aFieldNdx )
45 {
46  static void* locale = nullptr;
47  static wxString sheetnameDefault;
48  static wxString sheetfilenameDefault;
49  static wxString fieldDefault;
50 
51  // Fetching translations can take a surprising amount of time when loading libraries,
52  // so only do it when necessary.
53  if( Pgm().GetLocale() != locale )
54  {
55  sheetnameDefault = _( "Sheet name" );
56  sheetfilenameDefault = _( "Sheet file" );
57  fieldDefault = _( "Field%d" );
58  locale = Pgm().GetLocale();
59  }
60 
61  // Fixed values for the mandatory fields
62  switch( aFieldNdx )
63  {
64  case SHEETNAME: return sheetnameDefault;
65  case SHEETFILENAME: return sheetfilenameDefault;
66  default: return wxString::Format( fieldDefault, aFieldNdx );
67  }
68 }
69 
70 
71 SCH_SHEET::SCH_SHEET( EDA_ITEM* aParent, const wxPoint& pos ) :
72  SCH_ITEM( aParent, SCH_SHEET_T )
73 {
75  m_pos = pos;
76  m_size = wxSize( Mils2iu( MIN_SHEET_WIDTH ), Mils2iu( MIN_SHEET_HEIGHT ) );
77  m_screen = NULL;
78 
79  for( int i = 0; i < SHEET_MANDATORY_FIELDS; ++i )
80  {
81  m_fields.emplace_back( pos, i, this, GetDefaultFieldName( i ) );
82  m_fields.back().SetVisible( true );
83 
84  if( i == SHEETNAME )
85  m_fields.back().SetLayer( LAYER_SHEETNAME );
86  else if( i == SHEETFILENAME )
87  m_fields.back().SetLayer( LAYER_SHEETFILENAME );
88  else
89  m_fields.back().SetLayer( LAYER_SHEETFIELDS );
90  }
91 
93 
94  m_borderWidth = 0;
95  m_borderColor = COLOR4D::UNSPECIFIED;
96  m_backgroundColor = COLOR4D::UNSPECIFIED;
97 }
98 
99 
100 SCH_SHEET::SCH_SHEET( const SCH_SHEET& aSheet ) :
101  SCH_ITEM( aSheet )
102 {
103  m_pos = aSheet.m_pos;
104  m_size = aSheet.m_size;
105  m_Layer = aSheet.m_Layer;
106  const_cast<KIID&>( m_Uuid ) = aSheet.m_Uuid;
107  m_fields = aSheet.m_fields;
109  m_screen = aSheet.m_screen;
110 
111  for( SCH_SHEET_PIN* pin : aSheet.m_pins )
112  {
113  m_pins.emplace_back( new SCH_SHEET_PIN( *pin ) );
114  m_pins.back()->SetParent( this );
115  }
116 
117  m_borderWidth = aSheet.m_borderWidth;
118  m_borderColor = aSheet.m_borderColor;
120 
121  if( m_screen )
123 }
124 
125 
127 {
128  // also, look at the associated sheet & its reference count
129  // perhaps it should be deleted also.
130  if( m_screen )
131  {
133 
134  if( m_screen->GetRefCount() == 0 )
135  delete m_screen;
136  }
137 
138  // We own our pins; delete them
139  for( SCH_SHEET_PIN* pin : m_pins )
140  delete pin;
141 }
142 
143 
145 {
146  return new SCH_SHEET( *this );
147 }
148 
149 
151 {
152  if( aScreen == m_screen )
153  return;
154 
155  if( m_screen != NULL )
156  {
158 
159  if( m_screen->GetRefCount() == 0 )
160  {
161  delete m_screen;
162  m_screen = NULL;
163  }
164  }
165 
166  m_screen = aScreen;
167 
168  if( m_screen )
170 }
171 
172 
174 {
175  if( m_screen == NULL )
176  return 0;
177 
178  return m_screen->GetRefCount();
179 }
180 
181 
183 {
184  wxCHECK_MSG( Schematic(), false, "Can't call IsRootSheet without setting a schematic" );
185 
186  return &Schematic()->Root() == this;
187 }
188 
189 
190 void SCH_SHEET::GetContextualTextVars( wxArrayString* aVars ) const
191 {
192  for( int i = 0; i < SHEET_MANDATORY_FIELDS; ++i )
193  aVars->push_back( m_fields[i].GetCanonicalName().Upper() );
194 
195  for( size_t i = SHEET_MANDATORY_FIELDS; i < m_fields.size(); ++i )
196  aVars->push_back( m_fields[i].GetName() );
197 
198  aVars->push_back( wxT( "#" ) );
199  aVars->push_back( wxT( "##" ) );
200 }
201 
202 
203 bool SCH_SHEET::ResolveTextVar( wxString* token, int aDepth ) const
204 {
205  for( int i = 0; i < SHEET_MANDATORY_FIELDS; ++i )
206  {
207  if( token->IsSameAs( m_fields[i].GetCanonicalName().Upper() ) )
208  {
209  *token = m_fields[i].GetShownText( aDepth + 1 );
210  return true;
211  }
212  }
213 
214  for( size_t i = SHEET_MANDATORY_FIELDS; i < m_fields.size(); ++i )
215  {
216  if( token->IsSameAs( m_fields[i].GetName() ) )
217  {
218  *token = m_fields[i].GetShownText( aDepth + 1 );
219  return true;
220  }
221  }
222 
223  if( token->IsSameAs( wxT( "#" ) ) )
224  {
225  for( const SCH_SHEET_PATH& sheet : Schematic()->GetSheets() )
226  {
227  if( sheet.Last() == this ) // Current sheet path found
228  {
229  *token = wxString::Format( wxT( "%d" ), sheet.GetPageNumber() );
230  return true;
231  }
232  }
233  }
234  else if( token->IsSameAs( wxT( "##" ) ) )
235  {
236  SCH_SHEET_LIST sheetList = Schematic()->GetSheets();
237  *token = wxString::Format( wxT( "%d" ), (int) sheetList.size() );
238  return true;
239  }
240 
241  return false;
242 }
243 
244 
246 {
247  return m_borderWidth == 0 && m_borderColor == COLOR4D::UNSPECIFIED;
248 }
249 
250 
252 {
253  wxCHECK_RET( aItem->Type() == SCH_SHEET_T,
254  wxString::Format( wxT( "SCH_SHEET object cannot swap data with %s object." ),
255  GetChars( aItem->GetClass() ) ) );
256 
257  SCH_SHEET* sheet = ( SCH_SHEET* ) aItem;
258 
259  std::swap( m_pos, sheet->m_pos );
260  std::swap( m_size, sheet->m_size );
261  m_fields.swap( sheet->m_fields );
262  std::swap( m_fieldsAutoplaced, sheet->m_fieldsAutoplaced );
263  m_pins.swap( sheet->m_pins );
264 
265  // Update parent pointers after swapping.
266  for( SCH_SHEET_PIN* sheetPin : m_pins )
267  sheetPin->SetParent( this );
268 
269  for( SCH_SHEET_PIN* sheetPin : sheet->m_pins )
270  sheetPin->SetParent( sheet );
271 
272  std::swap( m_borderWidth, sheet->m_borderWidth );
273  std::swap( m_borderColor, sheet->m_borderColor );
274  std::swap( m_backgroundColor, sheet->m_backgroundColor );
275 }
276 
277 
279 {
280  wxASSERT( aSheetPin != NULL );
281  wxASSERT( aSheetPin->Type() == SCH_SHEET_PIN_T );
282 
283  aSheetPin->SetParent( this );
284  m_pins.push_back( aSheetPin );
285  renumberPins();
286 }
287 
288 
290 {
291  wxASSERT( aSheetPin != NULL );
292  wxASSERT( aSheetPin->Type() == SCH_SHEET_PIN_T );
293 
294  for( auto i = m_pins.begin(); i < m_pins.end(); ++i )
295  {
296  if( *i == aSheetPin )
297  {
298  m_pins.erase( i );
299  renumberPins();
300  return;
301  }
302  }
303 }
304 
305 
306 bool SCH_SHEET::HasPin( const wxString& aName )
307 {
308  for( SCH_SHEET_PIN* pin : m_pins )
309  {
310  if( pin->GetText().CmpNoCase( aName ) == 0 )
311  return true;
312  }
313 
314  return false;
315 }
316 
317 
318 bool SCH_SHEET::doIsConnected( const wxPoint& aPosition ) const
319 {
320  for( SCH_SHEET_PIN* sheetPin : m_pins )
321  {
322  if( sheetPin->GetPosition() == aPosition )
323  return true;
324  }
325 
326  return false;
327 }
328 
329 
331 {
332  int leftRight = 0;
333  int topBottom = 0;
334 
335  for( SCH_SHEET_PIN* pin : m_pins )
336  {
337  switch( pin->GetEdge() )
338  {
339  case SHEET_LEFT_SIDE: leftRight++; break;
340  case SHEET_RIGHT_SIDE: leftRight++; break;
341  case SHEET_TOP_SIDE: topBottom++; break;
342  case SHEET_BOTTOM_SIDE: topBottom++; break;
343  default: break;
344  }
345  }
346 
347  return topBottom > 0 && leftRight == 0;
348 }
349 
350 
352 {
353  for( SCH_SHEET_PIN* pin : m_pins )
354  {
355  /* Search the schematic for a hierarchical label corresponding to this sheet label. */
356  const SCH_HIERLABEL* HLabel = nullptr;
357  for( auto aItem : m_screen->Items().OfType( SCH_HIER_LABEL_T ) )
358  {
359  if( !pin->GetText().CmpNoCase( static_cast<SCH_HIERLABEL*>( aItem )->GetText() ) )
360  {
361  HLabel = static_cast<SCH_HIERLABEL*>( aItem );
362  break;
363  }
364  }
365 
366  if( HLabel == nullptr ) // Corresponding hierarchical label not found.
367  return true;
368  }
369 
370  return false;
371 }
372 
373 
375 {
376  int width = Mils2iu( MIN_SHEET_WIDTH );
377 
378  for( size_t i = 0; i < m_pins.size(); i++ )
379  {
380  int edge = m_pins[i]->GetEdge();
381  EDA_RECT pinRect = m_pins[i]->GetBoundingBox();
382 
383  wxASSERT( edge != SHEET_UNDEFINED_SIDE );
384 
385  if( edge == SHEET_TOP_SIDE || edge == SHEET_BOTTOM_SIDE )
386  {
387  if( width < pinRect.GetRight() - m_pos.x )
388  width = pinRect.GetRight() - m_pos.x;
389  }
390  else
391  {
392  if( width < pinRect.GetWidth() )
393  width = pinRect.GetWidth();
394 
395  for( size_t j = 0; j < m_pins.size(); j++ )
396  {
397  // Check for pin directly across from the current pin.
398  if( (i == j) || (m_pins[i]->GetPosition().y != m_pins[j]->GetPosition().y) )
399  continue;
400 
401  if( width < pinRect.GetWidth() + m_pins[j]->GetBoundingBox().GetWidth() )
402  {
403  width = pinRect.GetWidth() + m_pins[j]->GetBoundingBox().GetWidth();
404  break;
405  }
406  }
407  }
408  }
409 
410  return width;
411 }
412 
413 
415 {
416  int height = Mils2iu( MIN_SHEET_HEIGHT );
417 
418  for( size_t i = 0; i < m_pins.size(); i++ )
419  {
420  int edge = m_pins[i]->GetEdge();
421  EDA_RECT pinRect = m_pins[i]->GetBoundingBox();
422 
423  // Make sure pin is on top or bottom side of sheet.
424  if( edge == SHEET_RIGHT_SIDE || edge == SHEET_LEFT_SIDE )
425  {
426  if( height < pinRect.GetBottom() - m_pos.y )
427  height = pinRect.GetBottom() - m_pos.y;
428  }
429  else
430  {
431  if( height < pinRect.GetHeight() )
432  height = pinRect.GetHeight();
433 
434  for( size_t j = 0; j < m_pins.size(); j++ )
435  {
436  // Check for pin directly above or below the current pin.
437  if( (i == j) || (m_pins[i]->GetPosition().x != m_pins[j]->GetPosition().x) )
438  continue;
439 
440  if( height < pinRect.GetHeight() + m_pins[j]->GetBoundingBox().GetHeight() )
441  {
442  height = pinRect.GetHeight() + m_pins[j]->GetBoundingBox().GetHeight();
443  break;
444  }
445  }
446  }
447  }
448 
449  return height;
450 }
451 
452 
454 {
455  auto i = m_pins.begin();
456 
457  while( i != m_pins.end() )
458  {
459  /* Search the schematic for a hierarchical label corresponding to this sheet label. */
460  const SCH_HIERLABEL* HLabel = NULL;
461 
462  for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_HIER_LABEL_T ) )
463  {
464  if( (*i)->GetText().CmpNoCase( static_cast<SCH_HIERLABEL*>( aItem )->GetText() ) == 0 )
465  {
466  HLabel = static_cast<SCH_HIERLABEL*>( aItem );
467  break;
468  }
469  }
470 
471  if( HLabel == NULL ) // Hlabel not found: delete sheet label.
472  i = m_pins.erase( i );
473  else
474  ++i;
475  }
476 }
477 
478 
480 {
481  for( SCH_SHEET_PIN* pin : m_pins )
482  {
483  if( pin->HitTest( aPosition ) )
484  return pin;
485  }
486 
487  return NULL;
488 }
489 
490 
492 {
493  return std::max( GetBorderWidth(), 1 );
494 }
495 
496 
497 void SCH_SHEET::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
498 {
499  wxASSERT_MSG( !aManual, "manual autoplacement not currently supported for sheets" );
500 
501  wxSize textSize = m_fields[ SHEETNAME ].GetTextSize();
502  int borderMargin = KiROUND( GetPenWidth() / 2.0 ) + 4;
503  int margin = borderMargin + KiROUND( std::max( textSize.x, textSize.y ) * 0.5 );
504 
505  if( IsVerticalOrientation() )
506  {
507  m_fields[ SHEETNAME ].SetTextPos( m_pos + wxPoint( -margin, m_size.y ) );
508  m_fields[ SHEETNAME ].SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
509  m_fields[ SHEETNAME ].SetVertJustify(GR_TEXT_VJUSTIFY_BOTTOM );
510  m_fields[ SHEETNAME ].SetTextAngle( TEXT_ANGLE_VERT );
511  }
512  else
513  {
514  m_fields[ SHEETNAME ].SetTextPos( m_pos + wxPoint( 0, -margin ) );
515  m_fields[ SHEETNAME ].SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
516  m_fields[ SHEETNAME ].SetVertJustify(GR_TEXT_VJUSTIFY_BOTTOM );
517  m_fields[ SHEETNAME ].SetTextAngle( TEXT_ANGLE_HORIZ );
518  }
519 
520  textSize = m_fields[ SHEETFILENAME ].GetTextSize();
521  margin = borderMargin + KiROUND( std::max( textSize.x, textSize.y ) * 0.4 );
522 
523  if( IsVerticalOrientation() )
524  {
525  m_fields[ SHEETFILENAME ].SetTextPos( m_pos + wxPoint( m_size.x + margin, m_size.y ) );
526  m_fields[ SHEETFILENAME ].SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
527  m_fields[ SHEETFILENAME ].SetVertJustify(GR_TEXT_VJUSTIFY_TOP );
528  m_fields[ SHEETFILENAME ].SetTextAngle( TEXT_ANGLE_VERT );
529  }
530  else
531  {
532  m_fields[ SHEETFILENAME ].SetTextPos( m_pos + wxPoint( 0, m_size.y + margin ) );
533  m_fields[ SHEETFILENAME ].SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
534  m_fields[ SHEETFILENAME ].SetVertJustify(GR_TEXT_VJUSTIFY_TOP );
535  m_fields[ SHEETFILENAME ].SetTextAngle( TEXT_ANGLE_HORIZ );
536  }
537 
539 }
540 
541 
542 void SCH_SHEET::ViewGetLayers( int aLayers[], int& aCount ) const
543 {
544  aCount = 4;
545  aLayers[0] = LAYER_HIERLABEL;
546  aLayers[1] = LAYER_SHEET;
547  aLayers[2] = LAYER_SHEET_BACKGROUND;
548  aLayers[3] = LAYER_SELECTION_SHADOWS;
549 }
550 
551 
552 void SCH_SHEET::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
553 {
554  wxDC* DC = aSettings->GetPrintDC();
555  wxPoint pos = m_pos + aOffset;
556  int lineWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
558 
559  GRRect( nullptr, DC, pos.x, pos.y, pos.x + m_size.x, pos.y + m_size.y, lineWidth, color );
560 
561  for( SCH_FIELD& field : m_fields )
562  field.Print( aSettings, aOffset );
563 
564  /* Draw text : SheetLabel */
565  for( SCH_SHEET_PIN* sheetPin : m_pins )
566  sheetPin->Print( aSettings, aOffset );
567 }
568 
569 
571 {
572  wxPoint end;
573  EDA_RECT box( m_pos, m_size );
574  int lineWidth = GetPenWidth();
575  int textLength = 0;
576 
577  // Calculate bounding box X size:
578  end.x = std::max( m_size.x, textLength );
579 
580  // Calculate bounding box pos:
581  end.y = m_size.y;
582  end += m_pos;
583 
584  box.SetEnd( end );
585  box.Inflate( lineWidth / 2 );
586 
587  return box;
588 }
589 
590 
592 {
594 
595  for( const SCH_FIELD& field : m_fields )
596  box.Merge( field.GetBoundingBox() );
597 
598  return box;
599 }
600 
601 
603 {
604  EDA_RECT box( m_pos, m_size );
605  return box.GetCenter();
606 }
607 
608 
610 {
611  int n = 0;
612 
613  if( m_screen )
614  {
615  for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_COMPONENT_T ) )
616  {
617  SCH_COMPONENT* comp = (SCH_COMPONENT*) aItem;
618 
619  if( comp->GetField( VALUE )->GetText().GetChar( 0 ) != '#' )
620  n++;
621  }
622 
623  for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_SHEET_T ) )
624  n += static_cast<const SCH_SHEET*>( aItem )->ComponentCount();
625  }
626 
627  return n;
628 }
629 
630 
631 bool SCH_SHEET::SearchHierarchy( const wxString& aFilename, SCH_SCREEN** aScreen )
632 {
633  if( m_screen )
634  {
635  // Only check the root sheet once and don't recurse.
636  if( !GetParent() )
637  {
638  if( m_screen && m_screen->GetFileName().Cmp( aFilename ) == 0 )
639  {
640  *aScreen = m_screen;
641  return true;
642  }
643  }
644 
645  for( auto aItem : m_screen->Items().OfType( SCH_SHEET_T ) )
646  {
647  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( aItem );
648  SCH_SCREEN* screen = sheet->m_screen;
649 
650  // Must use the screen's path (which is always absolute) rather than the
651  // sheet's (which could be relative).
652  if( screen && screen->GetFileName().Cmp( aFilename ) == 0 )
653  {
654  *aScreen = screen;
655  return true;
656  }
657 
658  if( sheet->SearchHierarchy( aFilename, aScreen ) )
659  return true;
660  }
661  }
662 
663  return false;
664 }
665 
666 
668 {
669  if( m_screen )
670  {
671  aList->push_back( this );
672 
673  if( m_screen == aScreen )
674  return true;
675 
676  for( auto item : m_screen->Items().OfType( SCH_SHEET_T ) )
677  {
678  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
679 
680  if( sheet->LocatePathOfScreen( aScreen, aList ) )
681  {
682  return true;
683  }
684  }
685 
686  aList->pop_back();
687  }
688 
689  return false;
690 }
691 
692 
694 {
695  int count = 1; //1 = this!!
696 
697  if( m_screen )
698  {
699  for( auto aItem : m_screen->Items().OfType( SCH_SHEET_T ) )
700  count += static_cast<SCH_SHEET*>( aItem )->CountSheets();
701  }
702 
703  return count;
704 }
705 
706 
708 {
709  aList.emplace_back( _( "Sheet Name" ), m_fields[ SHEETNAME ].GetText(), CYAN );
710  aList.emplace_back( _( "File Name" ), m_fields[ SHEETFILENAME ].GetText(), BROWN );
711 
712 #if 1 // Set to 1 to display the sheet UUID and hierarchical path
713 
714  if( auto schframe = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
715  {
716  wxString msgU, msgL;
717  msgU << _( "UUID" ) << ": " << m_Uuid.AsString();
718  msgL << _( "Path" ) << ": " << schframe->GetCurrentSheet().PathHumanReadable();
719 
720  aList.push_back( MSG_PANEL_ITEM( msgU, msgL, BLUE ) );
721  }
722 #endif
723 }
724 
725 
726 void SCH_SHEET::Rotate(wxPoint aPosition)
727 {
728  wxPoint prev = m_pos;
729 
730  RotatePoint( &m_pos, aPosition, 900 );
731  RotatePoint( &m_size.x, &m_size.y, 900 );
732 
733  if( m_size.x < 0 )
734  {
735  m_pos.x += m_size.x;
736  m_size.x = -m_size.x;
737  }
738 
739  if( m_size.y < 0 )
740  {
741  m_pos.y += m_size.y;
742  m_size.y = -m_size.y;
743  }
744 
745  // Pins must be rotated first as that's how we determine vertical vs horizontal
746  // orientation for auto-placement
747  for( SCH_SHEET_PIN* sheetPin : m_pins )
748  sheetPin->Rotate( aPosition );
749 
751  {
752  AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
753  }
754  else
755  {
756  // Move the fields to the new position because the component itself has moved.
757  for( SCH_FIELD& field : m_fields )
758  {
759  wxPoint pos = field.GetTextPos();
760  pos.x -= prev.x - m_pos.x;
761  pos.y -= prev.y - m_pos.y;
762  field.SetTextPos( pos );
763  }
764  }
765 }
766 
767 
768 void SCH_SHEET::MirrorX( int aXaxis_position )
769 {
770  MIRROR( m_pos.y, aXaxis_position );
771  m_pos.y -= m_size.y;
772 
773  for( SCH_SHEET_PIN* sheetPin : m_pins )
774  sheetPin->MirrorX( aXaxis_position );
775 }
776 
777 
778 void SCH_SHEET::MirrorY( int aYaxis_position )
779 {
780  MIRROR( m_pos.x, aYaxis_position );
781  m_pos.x -= m_size.x;
782 
783  for( SCH_SHEET_PIN* sheetPin : m_pins )
784  sheetPin->MirrorY( aYaxis_position );
785 }
786 
787 
788 void SCH_SHEET::SetPosition( const wxPoint& aPosition )
789 {
790  // Remember the sheet and all pin sheet positions must be
791  // modified. So use Move function to do that.
792  Move( aPosition - m_pos );
793 }
794 
795 
796 void SCH_SHEET::Resize( const wxSize& aSize )
797 {
798  if( aSize == m_size )
799  return;
800 
801  m_size = aSize;
802 
803  // Move the fields if we're in autoplace mode
805  AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
806 
807  // Move the sheet labels according to the new sheet size.
808  for( SCH_SHEET_PIN* sheetPin : m_pins )
809  sheetPin->ConstrainOnEdge( sheetPin->GetPosition() );
810 }
811 
812 
813 bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
814 {
815  wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
816 
817  // Sheets are searchable via the child field and pin item text.
818  return false;
819 }
820 
821 
823 {
824  int id = 2;
825 
826  for( SCH_SHEET_PIN* pin : m_pins )
827  {
828  pin->SetNumber( id );
829  id++;
830  }
831 }
832 
833 
834 void SCH_SHEET::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
835 {
836  for( SCH_SHEET_PIN* sheetPin : m_pins )
837  {
838  wxCHECK2_MSG( sheetPin->Type() == SCH_SHEET_PIN_T, continue,
839  wxT( "Invalid item in schematic sheet pin list. Bad programmer!" ) );
840 
841  sheetPin->GetEndPoints( aItemList );
842  }
843 }
844 
845 
846 bool SCH_SHEET::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
847  const SCH_SHEET_PATH* aPath )
848 {
849  bool changed = false;
850 
851  for( SCH_SHEET_PIN* sheetPin : m_pins )
852  changed |= sheetPin->UpdateDanglingState( aItemList );
853 
854  return changed;
855 }
856 
857 
858 std::vector<wxPoint> SCH_SHEET::GetConnectionPoints() const
859 {
860  std::vector<wxPoint> retval;
861 
862  for( SCH_SHEET_PIN* sheetPin : m_pins )
863  retval.push_back( sheetPin->GetPosition() );
864 
865  return retval;
866 }
867 
868 
869 SEARCH_RESULT SCH_SHEET::Visit( INSPECTOR aInspector, void* testData, const KICAD_T aFilterTypes[] )
870 {
871  KICAD_T stype;
872 
873  for( const KICAD_T* p = aFilterTypes; (stype = *p) != EOT; ++p )
874  {
875  // If caller wants to inspect my type
876  if( stype == SCH_LOCATE_ANY_T || stype == Type() )
877  {
878  if( SEARCH_RESULT::QUIT == aInspector( this, NULL ) )
879  return SEARCH_RESULT::QUIT;
880  }
881 
882  if( stype == SCH_LOCATE_ANY_T || stype == SCH_FIELD_T )
883  {
884  // Test the sheet fields.
885  for( SCH_FIELD& field : m_fields )
886  {
887  if( SEARCH_RESULT::QUIT == aInspector( &field, this ) )
888  return SEARCH_RESULT::QUIT;
889  }
890  }
891 
892  if( stype == SCH_LOCATE_ANY_T || stype == SCH_SHEET_PIN_T )
893  {
894  // Test the sheet labels.
895  for( SCH_SHEET_PIN* sheetPin : m_pins )
896  {
897  if( SEARCH_RESULT::QUIT == aInspector( sheetPin, this ) )
898  return SEARCH_RESULT::QUIT;
899  }
900  }
901  }
902 
904 }
905 
906 
907 wxString SCH_SHEET::GetSelectMenuText( EDA_UNITS aUnits ) const
908 {
909  return wxString::Format( _( "Hierarchical Sheet %s" ),
910  m_fields[ SHEETNAME ].GetText() );
911 }
912 
913 
915 {
917 }
918 
919 
920 bool SCH_SHEET::HitTest( const wxPoint& aPosition, int aAccuracy ) const
921 {
922  EDA_RECT rect = GetBodyBoundingBox();
923 
924  rect.Inflate( aAccuracy );
925 
926  return rect.Contains( aPosition );
927 }
928 
929 
930 bool SCH_SHEET::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
931 {
932  EDA_RECT rect = aRect;
933 
934  rect.Inflate( aAccuracy );
935 
936  if( aContained )
937  return rect.Contains( GetBodyBoundingBox() );
938 
939  return rect.Intersects( GetBodyBoundingBox() );
940 }
941 
942 
943 void SCH_SHEET::Plot( PLOTTER* aPlotter )
944 {
945  wxString Text;
946  wxPoint pos;
947 
948  bool override = false;
949 
950  if( KIGFX::SCH_RENDER_SETTINGS* settings =
951  dynamic_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() ) )
952  override = settings->m_OverrideItemColors;
953 
954  COLOR4D borderColor = GetBorderColor();
955  COLOR4D backgroundColor = GetBackgroundColor();
956 
957  if( override || borderColor == COLOR4D::UNSPECIFIED )
958  borderColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_SHEET );
959 
960  if( override || backgroundColor == COLOR4D::UNSPECIFIED )
961  backgroundColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_SHEET_BACKGROUND );
962 
963  aPlotter->SetColor( backgroundColor );
964  // Do not fill shape in B&W mode, otherwise texts are unreadable
965  bool fill = aPlotter->GetColorMode();
966  aPlotter->Rect( m_pos, m_pos + m_size, fill ? FILLED_SHAPE : NO_FILL, 1.0 );
967 
968  aPlotter->SetColor( borderColor );
969 
970  int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
971  aPlotter->SetCurrentLineWidth( penWidth );
972 
973  aPlotter->MoveTo( m_pos );
974  pos = m_pos;
975  pos.x += m_size.x;
976 
977  aPlotter->LineTo( pos );
978  pos.y += m_size.y;
979 
980  aPlotter->LineTo( pos );
981  pos = m_pos;
982  pos.y += m_size.y;
983 
984  aPlotter->LineTo( pos );
985  aPlotter->FinishTo( m_pos );
986 
987  for( SCH_FIELD field : m_fields )
988  field.Plot( aPlotter );
989 
990  /* Draw texts : SheetLabel */
991  for( SCH_SHEET_PIN* sheetPin : m_pins )
992  sheetPin->Plot( aPlotter );
993 }
994 
995 
997 {
998  wxCHECK_MSG( Type() == aItem.Type(), *this,
999  wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
1000  GetClass() );
1001 
1002  if( &aItem != this )
1003  {
1004  SCH_ITEM::operator=( aItem );
1005 
1006  SCH_SHEET* sheet = (SCH_SHEET*) &aItem;
1007 
1008  m_pos = sheet->m_pos;
1009  m_size = sheet->m_size;
1010  m_fields = sheet->m_fields;
1011 
1012  for( SCH_SHEET_PIN* pin : sheet->m_pins )
1013  {
1014  m_pins.emplace_back( new SCH_SHEET_PIN( *pin ) );
1015  m_pins.back()->SetParent( this );
1016  }
1017  }
1018 
1019  return *this;
1020 }
1021 
1022 
1023 bool SCH_SHEET::operator <( const SCH_ITEM& aItem ) const
1024 {
1025  if( Type() != aItem.Type() )
1026  return Type() < aItem.Type();
1027 
1028  auto sheet = static_cast<const SCH_SHEET*>( &aItem );
1029 
1030  if (m_fields[ SHEETNAME ].GetText() != sheet->m_fields[ SHEETNAME ].GetText())
1031  return m_fields[ SHEETNAME ].GetText() < sheet->m_fields[ SHEETNAME ].GetText();
1032 
1033  if (m_fields[ SHEETFILENAME ].GetText() != sheet->m_fields[ SHEETFILENAME ].GetText())
1034  return m_fields[ SHEETFILENAME ].GetText() < sheet->m_fields[ SHEETFILENAME ].GetText();
1035 
1036  return false;
1037 }
1038 
1039 
1040 #if defined(DEBUG)
1041 
1042 void SCH_SHEET::Show( int nestLevel, std::ostream& os ) const
1043 {
1044  // XML output:
1045  wxString s = GetClass();
1046 
1047  NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">" << " sheet_name=\""
1048  << TO_UTF8( m_fields[ SHEETNAME ].GetText() ) << '"' << ">\n";
1049 
1050  // show all the pins, and check the linked list integrity
1051  for( SCH_SHEET_PIN* sheetPin : m_pins )
1052  sheetPin->Show( nestLevel + 1, os );
1053 
1054  NestedSpace( nestLevel, os ) << "</" << s.Lower().mb_str() << ">\n" << std::flush;
1055 }
1056 
1057 #endif
void FinishTo(const wxPoint &pos)
Definition: plotter.h:267
EDA_UNITS
Definition: common.h:198
SCH_SHEET_LIST.
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: common.h:185
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
SCH_LAYER_ID m_Layer
Definition: sch_item.h:199
const wxString & GetFileName() const
Definition: sch_screen.h:185
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_sheet.cpp:542
bool SearchHierarchy(const wxString &aFilename, SCH_SCREEN **aScreen)
Search the existing hierarchy for an instance of screen loaded from aFileName.
Definition: sch_sheet.cpp:631
SCH_SHEET_PIN * GetPin(const wxPoint &aPosition)
Return the sheet pin item found at aPosition in the sheet.
Definition: sch_sheet.cpp:479
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
PNG memory record (file in memory).
Definition: bitmap_def.h:29
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:89
KIGFX::COLOR4D m_borderColor
Definition: sch_sheet.h:233
RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surfac...
The first 2 are mandatory, and must be instantiated in SCH_SHEET.
Definition: sch_sheet.h:70
virtual void SetColor(COLOR4D color)=0
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_sheet.cpp:834
bool Matches(wxFindReplaceData &aSearchData, void *aAuxData) override
Function Matches compares the item against the search criteria in aSearchData.
Definition: sch_sheet.cpp:813
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
friend class SCH_SHEET_PIN
Definition: sch_sheet.h:218
int color
Definition: DXF_plotter.cpp:61
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
Definition: sch_sheet.cpp:150
EE_TYPE OfType(KICAD_T aType)
Definition: sch_rtree.h:219
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:116
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this sheet.
Definition: sch_sheet.cpp:190
int GetWidth() const
Definition: eda_rect.h:119
wxSize m_size
Definition: sch_sheet.h:230
Definition: color4d.h:61
const COLOR4D & GetLayerColor(int aLayer) const
Function GetLayerColor Returns the color used to draw a layer.
bool doIsConnected(const wxPoint &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_sheet.cpp:318
wxString AsString() const
Definition: common.cpp:165
KIGFX::COLOR4D GetBorderColor() const
Definition: sch_sheet.h:290
bool UsesDefaultStroke() const
Test this sheet to see if the default stroke is used to draw the outline.
Definition: sch_sheet.cpp:245
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: sch_sheet.cpp:907
bool operator<(const SCH_ITEM &aItem) const override
Definition: sch_sheet.cpp:1023
The base class for create windows for drawing purpose.
wxPoint m_pos
Definition: sch_sheet.h:229
void AddPin(SCH_SHEET_PIN *aSheetPin)
Add aSheetPin to the sheet.
Definition: sch_sheet.cpp:278
#define TEXT_ANGLE_VERT
Definition: common.h:186
bool Contains(const wxPoint &aPoint) const
Function Contains.
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
#define MIN_SHEET_WIDTH
Definition: sch_sheet.h:42
virtual void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:196
int GetBottom() const
Definition: eda_rect.h:124
void pop_back()
Forwarded method from std::vector.
KIGFX::COLOR4D GetBackgroundColor() const
Definition: sch_sheet.h:293
const INSPECTOR_FUNC & INSPECTOR
Definition: base_struct.h:105
int GetScreenCount() const
Return the number of times the associated screen for the sheet is being used.
Definition: sch_sheet.cpp:173
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:100
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:175
void LineTo(const wxPoint &pos)
Definition: plotter.h:262
void renumberPins()
Renumber the sheet pins in the sheet.
Definition: sch_sheet.cpp:822
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
Definition: sch_sheet.cpp:707
wxString GetClass() const override
Function GetClass returns the class name.
Definition: sch_sheet.h:252
void RemovePin(SCH_SHEET_PIN *aSheetPin)
Remove aSheetPin from the sheet.
Definition: sch_sheet.cpp:289
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:846
int GetBorderWidth() const
Definition: sch_sheet.h:287
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: sch_sheet.cpp:591
#define NULL
SCH_SHEET(EDA_ITEM *aParent=nullptr, const wxPoint &pos=wxPoint(0, 0))
Definition: sch_sheet.cpp:71
void MirrorX(int aXaxis_position) override
Mirror item relative to the X axis about aXaxis_position.
Definition: sch_sheet.cpp:768
const BITMAP_OPAQUE add_hierarchical_subsheet_xpm[1]
int m_borderWidth
Definition: sch_sheet.h:232
void SetEnd(int x, int y)
Definition: eda_rect.h:192
int GetPenWidth() const override
Definition: sch_sheet.cpp:491
bool IsRootSheet() const
Definition: sch_sheet.cpp:182
std::vector< SCH_SHEET_PIN * > m_pins
Definition: sch_sheet.h:224
int GetRight() const
Definition: eda_rect.h:121
int GetMinHeight() const
Return the minimum height that the sheet can be resized based on the sheet pin positions.
Definition: sch_sheet.cpp:414
SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
Function Visit may be re-implemented for each derived class in order to handle all the types given by...
Definition: sch_sheet.cpp:869
EDA_ITEM * GetParent() const
Definition: base_struct.h:195
const EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the sheet body but not the fields.
Definition: sch_sheet.cpp:570
Definition: color4d.h:58
wxLogTrace helper definitions.
static const wxString GetDefaultFieldName(int aFieldNdx)
Definition: sch_sheet.cpp:44
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:84
SCH_SHEET_PATH.
std::vector< wxPoint > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
Definition: sch_sheet.cpp:858
void CleanupSheet()
Delete sheet label which do not have a corresponding hierarchical label.
Definition: sch_sheet.cpp:453
void Rotate(wxPoint aPosition) override
Rotate the item around aPosition 90 degrees in the clockwise direction.
Definition: sch_sheet.cpp:726
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Operator assignment is used to assign the members of aItem to another object.
int GetHeight() const
Definition: eda_rect.h:120
int ComponentCount() const
Count our own components, without the power components.
Definition: sch_sheet.cpp:609
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:216
const KIID m_Uuid
Definition: base_struct.h:162
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257
std::vector< SCH_FIELD > m_fields
Definition: sch_sheet.h:226
SCH_FIELD * GetField(int aFieldNdx)
Returns a field in this symbol.
int CountSheets() const
Count the number of sheets found in "this" sheet including all of the subsheets.
Definition: sch_sheet.cpp:693
Field Value of part, i.e. "3.3K".
bool HasUndefinedPins()
Check all sheet labels against schematic for undefined hierarchical labels.
Definition: sch_sheet.cpp:351
int GetMinWidth() const
Return the minimum width of the sheet based on the widths of the sheet pin text.
Definition: sch_sheet.cpp:374
void DecRefCount()
Definition: sch_screen.cpp:115
bool LocatePathOfScreen(SCH_SCREEN *aScreen, SCH_SHEET_PATH *aList)
Search the existing hierarchy for an instance of screen loaded from aFileName.
Definition: sch_sheet.cpp:667
Base plotter engine class.
Definition: plotter.h:114
Definition: color4d.h:56
SCH_SHEET & Root() const
Definition: schematic.h:94
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:147
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_sheet.cpp:251
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:153
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: sch_sheet.cpp:144
see class PGM_BASE
void Plot(PLOTTER *aPlotter) override
Plot the schematic item to aPlotter.
Definition: sch_sheet.cpp:943
const wxChar *const traceFindItem
Flag to enable find debug tracing.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:201
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_sheet.cpp:846
void Print(RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Print a schematic item.
Definition: sch_sheet.cpp:552
#define _(s)
Definition: 3d_actions.cpp:33
bool IsVerticalOrientation() const
Definition: sch_sheet.cpp:330
void MirrorY(int aYaxis_position) override
Mirror item relative to the Y axis about aYaxis_position.
Definition: sch_sheet.cpp:778
void SetPosition(const wxPoint &aPosition) override
Definition: sch_sheet.cpp:788
EE_RTREE & Items()
Definition: sch_screen.h:158
KIGFX::COLOR4D m_backgroundColor
Definition: sch_sheet.h:234
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
Schematic symbol object.
Definition: sch_component.h:80
SCH_SCREEN * m_screen
Definition: sch_sheet.h:221
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
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
#define MIN_SHEET_HEIGHT
Definition: sch_sheet.h:43
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
SCH_RENDER_SETTINGS Stores schematic-specific render settings.
Definition: sch_painter.h:70
virtual wxString GetClass() const override
Function GetClass returns the class name.
Definition: sch_item.h:221
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
Definition: sch_sheet.cpp:914
int GetDefaultPenWidth() const
bool HasPin(const wxString &aName)
Checks if the sheet already has a sheet pin named aName.
Definition: sch_sheet.cpp:306
wxPoint GetRotationCenter() const
Rotating around the boundingBox's center can cause walking when the sheetname or filename is longer t...
Definition: sch_sheet.cpp:602
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
Definition: sch_sheet.cpp:203
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_sheet.cpp:497
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
SEARCH_RESULT
Definition: base_struct.h:51
const wxPoint GetCenter() const
Definition: eda_rect.h:117
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
Message panel definition file.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:194
void Move(const wxPoint &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_sheet.h:511
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:127
SCH_SHEET & operator=(const SCH_ITEM &aSheet)
Definition: sch_sheet.cpp:996
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
void IncRefCount()
Definition: sch_screen.cpp:109
int GetRefCount() const
Definition: sch_screen.h:196
FIELDS_AUTOPLACED m_fieldsAutoplaced
Definition: sch_sheet.h:227
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
void Resize(const wxSize &aSize)
Resize this sheet to aSize and adjust all of the labels accordingly.
Definition: sch_sheet.cpp:796
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99
bool HitTest(const wxPoint &aPosition, int aAccuracy) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
Definition: sch_sheet.cpp:920
bool GetColorMode() const
Definition: plotter.h:144