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 <netlist_object.h>
41 #include <trace_helpers.h>
42 #include <pgm_base.h>
43 
44 
45 const wxString SCH_SHEET::GetDefaultFieldName( int aFieldNdx )
46 {
47  static void* locale = nullptr;
48  static wxString sheetnameDefault;
49  static wxString sheetfilenameDefault;
50  static wxString fieldDefault;
51 
52  // Fetching translations can take a surprising amount of time when loading libraries,
53  // so only do it when necessary.
54  if( Pgm().GetLocale() != locale )
55  {
56  sheetnameDefault = _( "Sheet name" );
57  sheetfilenameDefault = _( "Sheet file" );
58  fieldDefault = _( "Field%d" );
59  locale = Pgm().GetLocale();
60  }
61 
62  // Fixed values for the mandatory fields
63  switch( aFieldNdx )
64  {
65  case SHEETNAME: return sheetnameDefault;
66  case SHEETFILENAME: return sheetfilenameDefault;
67  default: return wxString::Format( fieldDefault, aFieldNdx );
68  }
69 }
70 
71 
72 SCH_SHEET::SCH_SHEET( EDA_ITEM* aParent, const wxPoint& pos ) :
73  SCH_ITEM( aParent, SCH_SHEET_T )
74 {
76  m_pos = pos;
77  m_size = wxSize( Mils2iu( MIN_SHEET_WIDTH ), Mils2iu( MIN_SHEET_HEIGHT ) );
78  m_screen = NULL;
79 
80  for( int i = 0; i < SHEET_MANDATORY_FIELDS; ++i )
81  {
82  m_fields.emplace_back( pos, i, this, GetDefaultFieldName( i ) );
83  m_fields.back().SetVisible( true );
84 
85  if( i == SHEETNAME )
86  m_fields.back().SetLayer( LAYER_SHEETNAME );
87  else if( i == SHEETFILENAME )
88  m_fields.back().SetLayer( LAYER_SHEETFILENAME );
89  else
90  m_fields.back().SetLayer( LAYER_SHEETFIELDS );
91  }
92 
94 
95  m_borderWidth = 0;
96  m_borderColor = COLOR4D::UNSPECIFIED;
97  m_backgroundColor = COLOR4D::UNSPECIFIED;
98 }
99 
100 
101 SCH_SHEET::SCH_SHEET( const SCH_SHEET& aSheet ) :
102  SCH_ITEM( aSheet )
103 {
104  m_pos = aSheet.m_pos;
105  m_size = aSheet.m_size;
106  m_Layer = aSheet.m_Layer;
107  const_cast<KIID&>( m_Uuid ) = aSheet.m_Uuid;
108  m_fields = aSheet.m_fields;
110  m_screen = aSheet.m_screen;
111 
112  for( SCH_SHEET_PIN* pin : aSheet.m_pins )
113  {
114  m_pins.emplace_back( new SCH_SHEET_PIN( *pin ) );
115  m_pins.back()->SetParent( this );
116  }
117 
118  m_borderWidth = aSheet.m_borderWidth;
119  m_borderColor = aSheet.m_borderColor;
121 
122  if( m_screen )
124 }
125 
126 
128 {
129  // also, look at the associated sheet & its reference count
130  // perhaps it should be deleted also.
131  if( m_screen )
132  {
134 
135  if( m_screen->GetRefCount() == 0 )
136  delete m_screen;
137  }
138 
139  // We own our pins; delete them
140  for( SCH_SHEET_PIN* pin : m_pins )
141  delete pin;
142 }
143 
144 
146 {
147  return new SCH_SHEET( *this );
148 }
149 
150 
152 {
153  if( aScreen == m_screen )
154  return;
155 
156  if( m_screen != NULL )
157  {
159 
160  if( m_screen->GetRefCount() == 0 )
161  {
162  delete m_screen;
163  m_screen = NULL;
164  }
165  }
166 
167  m_screen = aScreen;
168 
169  if( m_screen )
171 }
172 
173 
175 {
176  if( m_screen == NULL )
177  return 0;
178 
179  return m_screen->GetRefCount();
180 }
181 
182 
184 {
185  wxCHECK_MSG( Schematic(), false, "Can't call IsRootSheet without setting a schematic" );
186 
187  return &Schematic()->Root() == this;
188 }
189 
190 
191 void SCH_SHEET::GetContextualTextVars( wxArrayString* aVars ) const
192 {
193  for( int i = 0; i < SHEET_MANDATORY_FIELDS; ++i )
194  aVars->push_back( m_fields[i].GetCanonicalName() );
195 
196  aVars->push_back( wxT( "#" ) );
197  aVars->push_back( wxT( "##" ) );
198 }
199 
200 
201 bool SCH_SHEET::ResolveTextVar( wxString* token, int aDepth ) const
202 {
203  for( int i = 0; i < SHEET_MANDATORY_FIELDS; ++i )
204  {
205  if( token->IsSameAs( m_fields[i].GetCanonicalName().Upper() ) )
206  {
207  *token = m_fields[i].GetShownText( aDepth + 1 );
208  return true;
209  }
210  }
211 
212  for( size_t i = SHEET_MANDATORY_FIELDS; i < m_fields.size(); ++i )
213  {
214  if( token->IsSameAs( m_fields[i].GetName() ) )
215  {
216  *token = m_fields[i].GetShownText( aDepth + 1 );
217  return true;
218  }
219  }
220 
221  if( token->IsSameAs( wxT( "#" ) ) )
222  {
223  for( const SCH_SHEET_PATH& sheet : Schematic()->GetSheets() )
224  {
225  if( sheet.Last() == this ) // Current sheet path found
226  {
227  *token = wxString::Format( wxT( "%d" ), sheet.GetPageNumber() );
228  return true;
229  }
230  }
231  }
232  else if( token->IsSameAs( wxT( "##" ) ) )
233  {
234  SCH_SHEET_LIST sheetList = Schematic()->GetSheets();
235  *token = wxString::Format( wxT( "%d" ), (int) sheetList.size() );
236  return true;
237  }
238 
239  return false;
240 }
241 
242 
244 {
245  return m_borderWidth == 0 && m_borderColor == COLOR4D::UNSPECIFIED;
246 }
247 
248 
250 {
251  wxCHECK_RET( aItem->Type() == SCH_SHEET_T,
252  wxString::Format( wxT( "SCH_SHEET object cannot swap data with %s object." ),
253  GetChars( aItem->GetClass() ) ) );
254 
255  SCH_SHEET* sheet = ( SCH_SHEET* ) aItem;
256 
257  std::swap( m_pos, sheet->m_pos );
258  std::swap( m_size, sheet->m_size );
259  m_fields.swap( sheet->m_fields );
260  std::swap( m_fieldsAutoplaced, sheet->m_fieldsAutoplaced );
261  m_pins.swap( sheet->m_pins );
262 
263  // Update parent pointers after swapping.
264  for( SCH_SHEET_PIN* sheetPin : m_pins )
265  sheetPin->SetParent( this );
266 
267  for( SCH_SHEET_PIN* sheetPin : sheet->m_pins )
268  sheetPin->SetParent( sheet );
269 
270  std::swap( m_borderWidth, sheet->m_borderWidth );
271  std::swap( m_borderColor, sheet->m_borderColor );
272  std::swap( m_backgroundColor, sheet->m_backgroundColor );
273 }
274 
275 
277 {
278  wxASSERT( aSheetPin != NULL );
279  wxASSERT( aSheetPin->Type() == SCH_SHEET_PIN_T );
280 
281  aSheetPin->SetParent( this );
282  m_pins.push_back( aSheetPin );
283  renumberPins();
284 }
285 
286 
288 {
289  wxASSERT( aSheetPin != NULL );
290  wxASSERT( aSheetPin->Type() == SCH_SHEET_PIN_T );
291 
292  for( auto i = m_pins.begin(); i < m_pins.end(); ++i )
293  {
294  if( *i == aSheetPin )
295  {
296  m_pins.erase( i );
297  renumberPins();
298  return;
299  }
300  }
301 
302  wxLogDebug( wxT( "Fix me: attempt to remove label %s which is not in sheet %s." ),
303  aSheetPin->GetShownText(), m_fields[ SHEETNAME ].GetText() );
304 }
305 
306 
307 bool SCH_SHEET::HasPin( const wxString& aName )
308 {
309  for( SCH_SHEET_PIN* pin : m_pins )
310  {
311  if( pin->GetText().CmpNoCase( aName ) == 0 )
312  return true;
313  }
314 
315  return false;
316 }
317 
318 
319 bool SCH_SHEET::doIsConnected( const wxPoint& aPosition ) const
320 {
321  for( SCH_SHEET_PIN* sheetPin : m_pins )
322  {
323  if( sheetPin->GetPosition() == aPosition )
324  return true;
325  }
326 
327  return false;
328 }
329 
330 
332 {
333  int leftRight = 0;
334  int topBottom = 0;
335 
336  for( SCH_SHEET_PIN* pin : m_pins )
337  {
338  switch( pin->GetEdge() )
339  {
340  case SHEET_LEFT_SIDE: leftRight++; break;
341  case SHEET_RIGHT_SIDE: leftRight++; break;
342  case SHEET_TOP_SIDE: topBottom++; break;
343  case SHEET_BOTTOM_SIDE: topBottom++; break;
344  default: break;
345  }
346  }
347 
348  return topBottom > 0 && leftRight == 0;
349 }
350 
351 
353 {
354  for( SCH_SHEET_PIN* pin : m_pins )
355  {
356  /* Search the schematic for a hierarchical label corresponding to this sheet label. */
357  const SCH_HIERLABEL* HLabel = nullptr;
358  for( auto aItem : m_screen->Items().OfType( SCH_HIER_LABEL_T ) )
359  {
360  if( !pin->GetText().CmpNoCase( static_cast<SCH_HIERLABEL*>( aItem )->GetText() ) )
361  {
362  HLabel = static_cast<SCH_HIERLABEL*>( aItem );
363  break;
364  }
365  }
366 
367  if( HLabel == nullptr ) // Corresponding hierarchical label not found.
368  return true;
369  }
370 
371  return false;
372 }
373 
374 
376 {
377  int width = Mils2iu( MIN_SHEET_WIDTH );
378 
379  for( size_t i = 0; i < m_pins.size(); i++ )
380  {
381  int edge = m_pins[i]->GetEdge();
382  EDA_RECT pinRect = m_pins[i]->GetBoundingBox();
383 
384  wxASSERT( edge != SHEET_UNDEFINED_SIDE );
385 
386  if( edge == SHEET_TOP_SIDE || edge == SHEET_BOTTOM_SIDE )
387  {
388  if( width < pinRect.GetRight() - m_pos.x )
389  width = pinRect.GetRight() - m_pos.x;
390  }
391  else
392  {
393  if( width < pinRect.GetWidth() )
394  width = pinRect.GetWidth();
395 
396  for( size_t j = 0; j < m_pins.size(); j++ )
397  {
398  // Check for pin directly across from the current pin.
399  if( (i == j) || (m_pins[i]->GetPosition().y != m_pins[j]->GetPosition().y) )
400  continue;
401 
402  if( width < pinRect.GetWidth() + m_pins[j]->GetBoundingBox().GetWidth() )
403  {
404  width = pinRect.GetWidth() + m_pins[j]->GetBoundingBox().GetWidth();
405  break;
406  }
407  }
408  }
409  }
410 
411  return width;
412 }
413 
414 
416 {
417  int height = Mils2iu( MIN_SHEET_HEIGHT );
418 
419  for( size_t i = 0; i < m_pins.size(); i++ )
420  {
421  int edge = m_pins[i]->GetEdge();
422  EDA_RECT pinRect = m_pins[i]->GetBoundingBox();
423 
424  // Make sure pin is on top or bottom side of sheet.
425  if( edge == SHEET_RIGHT_SIDE || edge == SHEET_LEFT_SIDE )
426  {
427  if( height < pinRect.GetBottom() - m_pos.y )
428  height = pinRect.GetBottom() - m_pos.y;
429  }
430  else
431  {
432  if( height < pinRect.GetHeight() )
433  height = pinRect.GetHeight();
434 
435  for( size_t j = 0; j < m_pins.size(); j++ )
436  {
437  // Check for pin directly above or below the current pin.
438  if( (i == j) || (m_pins[i]->GetPosition().x != m_pins[j]->GetPosition().x) )
439  continue;
440 
441  if( height < pinRect.GetHeight() + m_pins[j]->GetBoundingBox().GetHeight() )
442  {
443  height = pinRect.GetHeight() + m_pins[j]->GetBoundingBox().GetHeight();
444  break;
445  }
446  }
447  }
448  }
449 
450  return height;
451 }
452 
453 
455 {
456  auto i = m_pins.begin();
457 
458  while( i != m_pins.end() )
459  {
460  /* Search the schematic for a hierarchical label corresponding to this sheet label. */
461  const SCH_HIERLABEL* HLabel = NULL;
462 
463  for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_HIER_LABEL_T ) )
464  {
465  if( (*i)->GetText().CmpNoCase( static_cast<SCH_HIERLABEL*>( aItem )->GetText() ) == 0 )
466  {
467  HLabel = static_cast<SCH_HIERLABEL*>( aItem );
468  break;
469  }
470  }
471 
472  if( HLabel == NULL ) // Hlabel not found: delete sheet label.
473  i = m_pins.erase( i );
474  else
475  ++i;
476  }
477 }
478 
479 
481 {
482  for( SCH_SHEET_PIN* pin : m_pins )
483  {
484  if( pin->HitTest( aPosition ) )
485  return pin;
486  }
487 
488  return NULL;
489 }
490 
491 
493 {
494  return std::max( GetBorderWidth(), 1 );
495 }
496 
497 
498 void SCH_SHEET::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
499 {
500  wxASSERT_MSG( !aManual, "manual autoplacement not currently supported for sheets" );
501 
502  wxSize textSize = m_fields[ SHEETNAME ].GetTextSize();
503  int borderMargin = KiROUND( GetPenWidth() / 2.0 ) + 4;
504  int margin = borderMargin + KiROUND( std::max( textSize.x, textSize.y ) * 0.5 );
505 
506  if( IsVerticalOrientation() )
507  {
508  m_fields[ SHEETNAME ].SetTextPos( m_pos + wxPoint( -margin, m_size.y ) );
509  m_fields[ SHEETNAME ].SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
510  m_fields[ SHEETNAME ].SetVertJustify(GR_TEXT_VJUSTIFY_BOTTOM );
511  m_fields[ SHEETNAME ].SetTextAngle( TEXT_ANGLE_VERT );
512  }
513  else
514  {
515  m_fields[ SHEETNAME ].SetTextPos( m_pos + wxPoint( 0, -margin ) );
516  m_fields[ SHEETNAME ].SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
517  m_fields[ SHEETNAME ].SetVertJustify(GR_TEXT_VJUSTIFY_BOTTOM );
518  m_fields[ SHEETNAME ].SetTextAngle( TEXT_ANGLE_HORIZ );
519  }
520 
521  textSize = m_fields[ SHEETFILENAME ].GetTextSize();
522  margin = borderMargin + KiROUND( std::max( textSize.x, textSize.y ) * 0.4 );
523 
524  if( IsVerticalOrientation() )
525  {
526  m_fields[ SHEETFILENAME ].SetTextPos( m_pos + wxPoint( m_size.x + margin, m_size.y ) );
527  m_fields[ SHEETFILENAME ].SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
528  m_fields[ SHEETFILENAME ].SetVertJustify(GR_TEXT_VJUSTIFY_TOP );
529  m_fields[ SHEETFILENAME ].SetTextAngle( TEXT_ANGLE_VERT );
530  }
531  else
532  {
533  m_fields[ SHEETFILENAME ].SetTextPos( m_pos + wxPoint( 0, m_size.y + margin ) );
534  m_fields[ SHEETFILENAME ].SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
535  m_fields[ SHEETFILENAME ].SetVertJustify(GR_TEXT_VJUSTIFY_TOP );
536  m_fields[ SHEETFILENAME ].SetTextAngle( TEXT_ANGLE_HORIZ );
537  }
538 
540 }
541 
542 
543 void SCH_SHEET::ViewGetLayers( int aLayers[], int& aCount ) const
544 {
545  aCount = 4;
546  aLayers[0] = LAYER_HIERLABEL;
547  aLayers[1] = LAYER_SHEET;
548  aLayers[2] = LAYER_SHEET_BACKGROUND;
549  aLayers[3] = LAYER_SELECTION_SHADOWS;
550 }
551 
552 
553 void SCH_SHEET::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
554 {
555  wxDC* DC = aSettings->GetPrintDC();
556  wxPoint pos = m_pos + aOffset;
557  int lineWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
559 
560  GRRect( nullptr, DC, pos.x, pos.y, pos.x + m_size.x, pos.y + m_size.y, lineWidth, color );
561 
562  for( SCH_FIELD& field : m_fields )
563  field.Print( aSettings, aOffset );
564 
565  /* Draw text : SheetLabel */
566  for( SCH_SHEET_PIN* sheetPin : m_pins )
567  sheetPin->Print( aSettings, aOffset );
568 }
569 
570 
572 {
573  wxPoint end;
574  EDA_RECT box( m_pos, m_size );
575  int lineWidth = GetPenWidth();
576  int textLength = 0;
577 
578  // Calculate bounding box X size:
579  end.x = std::max( m_size.x, textLength );
580 
581  // Calculate bounding box pos:
582  end.y = m_size.y;
583  end += m_pos;
584 
585  box.SetEnd( end );
586  box.Inflate( lineWidth / 2 );
587 
588  return box;
589 }
590 
591 
593 {
595 
596  for( const SCH_FIELD& field : m_fields )
597  box.Merge( field.GetBoundingBox() );
598 
599  return box;
600 }
601 
602 
604 {
605  EDA_RECT box( m_pos, m_size );
606  return box.GetCenter();
607 }
608 
609 
611 {
612  int n = 0;
613 
614  if( m_screen )
615  {
616  for( auto aItem : m_screen->Items().OfType( SCH_COMPONENT_T ) )
617  {
618  SCH_COMPONENT* Cmp = (SCH_COMPONENT*) aItem;
619 
620  if( Cmp->GetField( VALUE )->GetText().GetChar( 0 ) != '#' )
621  n++;
622  }
623 
624  for( auto aItem : m_screen->Items().OfType( SCH_SHEET_T ) )
625  n += static_cast<const SCH_SHEET*>( aItem )->ComponentCount();
626  }
627 
628  return n;
629 }
630 
631 
632 bool SCH_SHEET::SearchHierarchy( const wxString& aFilename, SCH_SCREEN** aScreen )
633 {
634  if( m_screen )
635  {
636  // Only check the root sheet once and don't recurse.
637  if( !GetParent() )
638  {
639  if( m_screen && m_screen->GetFileName().Cmp( aFilename ) == 0 )
640  {
641  *aScreen = m_screen;
642  return true;
643  }
644  }
645 
646  for( auto aItem : m_screen->Items().OfType( SCH_SHEET_T ) )
647  {
648  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( aItem );
649  SCH_SCREEN* screen = sheet->m_screen;
650 
651  // Must use the screen's path (which is always absolute) rather than the
652  // sheet's (which could be relative).
653  if( screen && screen->GetFileName().Cmp( aFilename ) == 0 )
654  {
655  *aScreen = screen;
656  return true;
657  }
658 
659  if( sheet->SearchHierarchy( aFilename, aScreen ) )
660  return true;
661  }
662  }
663 
664  return false;
665 }
666 
667 
669 {
670  if( m_screen )
671  {
672  aList->push_back( this );
673 
674  if( m_screen == aScreen )
675  return true;
676 
677  for( auto item : m_screen->Items().OfType( SCH_SHEET_T ) )
678  {
679  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
680 
681  if( sheet->LocatePathOfScreen( aScreen, aList ) )
682  {
683  return true;
684  }
685  }
686 
687  aList->pop_back();
688  }
689 
690  return false;
691 }
692 
693 
695 {
696  int count = 1; //1 = this!!
697 
698  if( m_screen )
699  {
700  for( auto aItem : m_screen->Items().OfType( SCH_SHEET_T ) )
701  count += static_cast<SCH_SHEET*>( aItem )->CountSheets();
702  }
703 
704  return count;
705 }
706 
707 
709 {
710  aList.emplace_back( _( "Sheet Name" ), m_fields[ SHEETNAME ].GetText(), CYAN );
711  aList.emplace_back( _( "File Name" ), m_fields[ SHEETFILENAME ].GetText(), BROWN );
712 
713 #if 1 // Set to 1 to display the sheet UUID and hierarchical path
714 
715  if( auto schframe = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
716  {
717  wxString msgU, msgL;
718  msgU << _( "UUID" ) << ": " << m_Uuid.AsString();
719  msgL << _( "Path" ) << ": " << schframe->GetCurrentSheet().PathHumanReadable();
720 
721  aList.push_back( MSG_PANEL_ITEM( msgU, msgL, BLUE ) );
722  }
723 #endif
724 }
725 
726 
727 void SCH_SHEET::Rotate(wxPoint aPosition)
728 {
729  wxPoint prev = m_pos;
730 
731  RotatePoint( &m_pos, aPosition, 900 );
732  RotatePoint( &m_size.x, &m_size.y, 900 );
733 
734  if( m_size.x < 0 )
735  {
736  m_pos.x += m_size.x;
737  m_size.x = -m_size.x;
738  }
739 
740  if( m_size.y < 0 )
741  {
742  m_pos.y += m_size.y;
743  m_size.y = -m_size.y;
744  }
745 
746  // Pins must be rotated first as that's how we determine vertical vs horizontal
747  // orientation for auto-placement
748  for( SCH_SHEET_PIN* sheetPin : m_pins )
749  sheetPin->Rotate( aPosition );
750 
752  {
753  AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
754  }
755  else
756  {
757  // Move the fields to the new position because the component itself has moved.
758  for( SCH_FIELD& field : m_fields )
759  {
760  wxPoint pos = field.GetTextPos();
761  pos.x -= prev.x - m_pos.x;
762  pos.y -= prev.y - m_pos.y;
763  field.SetTextPos( pos );
764  }
765  }
766 }
767 
768 
769 void SCH_SHEET::MirrorX( int aXaxis_position )
770 {
771  MIRROR( m_pos.y, aXaxis_position );
772  m_pos.y -= m_size.y;
773 
774  for( SCH_SHEET_PIN* sheetPin : m_pins )
775  sheetPin->MirrorX( aXaxis_position );
776 }
777 
778 
779 void SCH_SHEET::MirrorY( int aYaxis_position )
780 {
781  MIRROR( m_pos.x, aYaxis_position );
782  m_pos.x -= m_size.x;
783 
784  for( SCH_SHEET_PIN* sheetPin : m_pins )
785  sheetPin->MirrorY( aYaxis_position );
786 }
787 
788 
789 void SCH_SHEET::SetPosition( const wxPoint& aPosition )
790 {
791  // Remember the sheet and all pin sheet positions must be
792  // modified. So use Move function to do that.
793  Move( aPosition - m_pos );
794 }
795 
796 
797 void SCH_SHEET::Resize( const wxSize& aSize )
798 {
799  if( aSize == m_size )
800  return;
801 
802  m_size = aSize;
803 
804  // Move the fields if we're in autoplace mode
806  AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
807 
808  // Move the sheet labels according to the new sheet size.
809  for( SCH_SHEET_PIN* sheetPin : m_pins )
810  sheetPin->ConstrainOnEdge( sheetPin->GetPosition() );
811 }
812 
813 
814 bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
815 {
816  wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
817 
818  // Sheets are searchable via the child field and pin item text.
819  return false;
820 }
821 
822 
824 {
825  int id = 2;
826 
827  for( SCH_SHEET_PIN* pin : m_pins )
828  {
829  pin->SetNumber( id );
830  id++;
831  }
832 }
833 
834 
835 void SCH_SHEET::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
836 {
837  for( SCH_SHEET_PIN* sheetPin : m_pins )
838  {
839  wxCHECK2_MSG( sheetPin->Type() == SCH_SHEET_PIN_T, continue,
840  wxT( "Invalid item in schematic sheet pin list. Bad programmer!" ) );
841 
842  sheetPin->GetEndPoints( aItemList );
843  }
844 }
845 
846 
847 bool SCH_SHEET::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
848  const SCH_SHEET_PATH* aPath )
849 {
850  bool changed = false;
851 
852  for( SCH_SHEET_PIN* sheetPin : m_pins )
853  changed |= sheetPin->UpdateDanglingState( aItemList );
854 
855  return changed;
856 }
857 
858 
859 void SCH_SHEET::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
860 {
861  for( SCH_SHEET_PIN* sheetPin : m_pins )
862  aPoints.push_back( sheetPin->GetPosition() );
863 }
864 
865 
866 SEARCH_RESULT SCH_SHEET::Visit( INSPECTOR aInspector, void* testData, const KICAD_T aFilterTypes[] )
867 {
868  KICAD_T stype;
869 
870  for( const KICAD_T* p = aFilterTypes; (stype = *p) != EOT; ++p )
871  {
872  // If caller wants to inspect my type
873  if( stype == SCH_LOCATE_ANY_T || stype == Type() )
874  {
875  if( SEARCH_RESULT::QUIT == aInspector( this, NULL ) )
876  return SEARCH_RESULT::QUIT;
877  }
878 
879  if( stype == SCH_LOCATE_ANY_T || stype == SCH_FIELD_T )
880  {
881  // Test the sheet fields.
882  for( SCH_FIELD& field : m_fields )
883  {
884  if( SEARCH_RESULT::QUIT == aInspector( &field, this ) )
885  return SEARCH_RESULT::QUIT;
886  }
887  }
888 
889  if( stype == SCH_LOCATE_ANY_T || stype == SCH_SHEET_PIN_T )
890  {
891  // Test the sheet labels.
892  for( SCH_SHEET_PIN* sheetPin : m_pins )
893  {
894  if( SEARCH_RESULT::QUIT == aInspector( sheetPin, this ) )
895  return SEARCH_RESULT::QUIT;
896  }
897  }
898  }
899 
901 }
902 
903 
904 wxString SCH_SHEET::GetSelectMenuText( EDA_UNITS aUnits ) const
905 {
906  return wxString::Format( _( "Hierarchical Sheet %s" ), m_fields[ SHEETNAME ].GetText() );
907 }
908 
909 
911 {
913 }
914 
915 
916 bool SCH_SHEET::HitTest( const wxPoint& aPosition, int aAccuracy ) const
917 {
918  EDA_RECT rect = GetBodyBoundingBox();
919 
920  rect.Inflate( aAccuracy );
921 
922  return rect.Contains( aPosition );
923 }
924 
925 
926 bool SCH_SHEET::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
927 {
928  EDA_RECT rect = aRect;
929 
930  rect.Inflate( aAccuracy );
931 
932  if( aContained )
933  return rect.Contains( GetBodyBoundingBox() );
934 
935  return rect.Intersects( GetBodyBoundingBox() );
936 }
937 
938 
940 {
941  SCH_SHEET_PATH sheetPath = *aSheetPath;
942  sheetPath.push_back( this );
943 
944  for( SCH_SHEET_PIN* sheetPin : m_pins )
945  {
946  NETLIST_OBJECT* item = new NETLIST_OBJECT();
947  item->m_SheetPathInclude = sheetPath;
948  item->m_SheetPath = *aSheetPath;
949  item->m_Comp = sheetPin;
950  item->m_Link = this;
952  item->m_Label = sheetPin->GetText();
953  item->m_Start = item->m_End = sheetPin->GetPosition();
954  aNetListItems.push_back( item );
955 
956  if( SCH_CONNECTION::IsBusLabel( sheetPin->GetShownText() ) )
957  item->ConvertBusToNetListItems( aNetListItems );
958  }
959 }
960 
961 
962 void SCH_SHEET::Plot( PLOTTER* aPlotter )
963 {
964  wxString Text;
965  wxPoint pos;
966 
967  bool override = false;
968 
969  if( KIGFX::SCH_RENDER_SETTINGS* settings =
970  dynamic_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() ) )
971  override = settings->m_OverrideItemColors;
972 
973  COLOR4D borderColor = GetBorderColor();
974  COLOR4D backgroundColor = GetBackgroundColor();
975 
976  if( override || borderColor == COLOR4D::UNSPECIFIED )
977  borderColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_SHEET );
978 
979  if( override || backgroundColor == COLOR4D::UNSPECIFIED )
980  backgroundColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_SHEET_BACKGROUND );
981 
982  aPlotter->SetColor( backgroundColor );
983  aPlotter->Rect( m_pos, m_pos + m_size, FILLED_SHAPE, 1.0 );
984 
985  aPlotter->SetColor( borderColor );
986 
987  int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
988  aPlotter->SetCurrentLineWidth( penWidth );
989 
990  aPlotter->MoveTo( m_pos );
991  pos = m_pos;
992  pos.x += m_size.x;
993 
994  aPlotter->LineTo( pos );
995  pos.y += m_size.y;
996 
997  aPlotter->LineTo( pos );
998  pos = m_pos;
999  pos.y += m_size.y;
1000 
1001  aPlotter->LineTo( pos );
1002  aPlotter->FinishTo( m_pos );
1003 
1004  for( SCH_FIELD field : m_fields )
1005  field.Plot( aPlotter );
1006 
1007  /* Draw texts : SheetLabel */
1008  for( SCH_SHEET_PIN* sheetPin : m_pins )
1009  sheetPin->Plot( aPlotter );
1010 }
1011 
1012 
1014 {
1015  wxLogDebug( wxT( "Sheet assignment operator." ) );
1016 
1017  wxCHECK_MSG( Type() == aItem.Type(), *this,
1018  wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
1019  GetClass() );
1020 
1021  if( &aItem != this )
1022  {
1023  SCH_ITEM::operator=( aItem );
1024 
1025  SCH_SHEET* sheet = (SCH_SHEET*) &aItem;
1026 
1027  m_pos = sheet->m_pos;
1028  m_size = sheet->m_size;
1029  m_fields = sheet->m_fields;
1030 
1031  for( SCH_SHEET_PIN* pin : sheet->m_pins )
1032  {
1033  m_pins.emplace_back( new SCH_SHEET_PIN( *pin ) );
1034  m_pins.back()->SetParent( this );
1035  }
1036  }
1037 
1038  return *this;
1039 }
1040 
1041 
1042 bool SCH_SHEET::operator <( const SCH_ITEM& aItem ) const
1043 {
1044  if( Type() != aItem.Type() )
1045  return Type() < aItem.Type();
1046 
1047  auto sheet = static_cast<const SCH_SHEET*>( &aItem );
1048 
1049  if (m_fields[ SHEETNAME ].GetText() != sheet->m_fields[ SHEETNAME ].GetText())
1050  return m_fields[ SHEETNAME ].GetText() < sheet->m_fields[ SHEETNAME ].GetText();
1051 
1052  if (m_fields[ SHEETFILENAME ].GetText() != sheet->m_fields[ SHEETFILENAME ].GetText())
1053  return m_fields[ SHEETFILENAME ].GetText() < sheet->m_fields[ SHEETFILENAME ].GetText();
1054 
1055  return false;
1056 }
1057 
1058 
1059 #if defined(DEBUG)
1060 
1061 void SCH_SHEET::Show( int nestLevel, std::ostream& os ) const
1062 {
1063  // XML output:
1064  wxString s = GetClass();
1065 
1066  NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">" << " sheet_name=\""
1067  << TO_UTF8( m_fields[ SHEETNAME ].GetText() ) << '"' << ">\n";
1068 
1069  // show all the pins, and check the linked list integrity
1070  for( SCH_SHEET_PIN* sheetPin : m_pins )
1071  sheetPin->Show( nestLevel + 1, os );
1072 
1073  NestedSpace( nestLevel, os ) << "</" << s.Lower().mb_str() << ">\n" << std::flush;
1074 }
1075 
1076 #endif
#define TEXT_ANGLE_HORIZ
void FinishTo(const wxPoint &pos)
Definition: plotter.h:267
EDA_UNITS
Definition: common.h:198
SCH_SHEET_LIST.
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:192
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:543
bool SearchHierarchy(const wxString &aFilename, SCH_SCREEN **aScreen)
Search the existing hierarchy for an instance of screen loaded from aFileName.
Definition: sch_sheet.cpp:632
SCH_SHEET_PIN * GetPin(const wxPoint &aPosition)
Return the sheet pin item found at aPosition in the sheet.
Definition: sch_sheet.cpp:480
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:92
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...
#define TEXT_ANGLE_VERT
The first 2 are mandatory, and must be instantiated in SCH_SHEET.
Definition: sch_sheet.h:70
SCH_SHEET_PATH m_SheetPathInclude
virtual void SetColor(COLOR4D color)=0
static bool IsBusLabel(const wxString &aLabel)
Test if aLabel has a bus notation.
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:835
bool Matches(wxFindReplaceData &aSearchData, void *aAuxData) override
Function Matches compares the item against the search criteria in aSearchData.
Definition: sch_sheet.cpp:814
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:151
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:191
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:319
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:243
SCH_SHEET_PATH m_SheetPath
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:904
bool operator<(const SCH_ITEM &aItem) const override
Definition: sch_sheet.cpp:1042
The base class for create windows for drawing purpose.
wxPoint m_pos
Definition: sch_sheet.h:229
EDA_ITEM * m_Comp
void AddPin(SCH_SHEET_PIN *aSheetPin)
Add aSheetPin to the sheet.
Definition: sch_sheet.cpp:276
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.
NETLIST_OBJECT_LIST is a container holding and owning NETLIST_OBJECTs, which are connected items in a...
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:174
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:823
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:708
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:287
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:592
#define NULL
SCH_SHEET(EDA_ITEM *aParent=nullptr, const wxPoint &pos=wxPoint(0, 0))
Definition: sch_sheet.cpp:72
void MirrorX(int aXaxis_position) override
Mirror item relative to the X axis about aXaxis_position.
Definition: sch_sheet.cpp:769
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:492
bool IsRootSheet() const
Definition: sch_sheet.cpp:183
std::vector< SCH_SHEET_PIN * > m_pins
Definition: sch_sheet.h:224
wxString GetText(GRAPHIC_PINSHAPE aShape)
Definition: pin_shape.cpp:58
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:415
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:866
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:571
Definition: color4d.h:58
wxLogTrace helper definitions.
static const wxString GetDefaultFieldName(int aFieldNdx)
Definition: sch_sheet.cpp:45
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:84
SCH_SHEET_PATH.
void CleanupSheet()
Delete sheet label which do not have a corresponding hierarchical label.
Definition: sch_sheet.cpp:454
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: sch_text.cpp:484
void Rotate(wxPoint aPosition) override
Rotate the item around aPosition 90 degrees in the clockwise direction.
Definition: sch_sheet.cpp:727
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:610
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:694
Field Value of part, i.e. "3.3K".
void GetConnectionPoints(std::vector< wxPoint > &aPoints) const override
Add all the connection points for this item to aPoints.
Definition: sch_sheet.cpp:859
bool HasUndefinedPins()
Check all sheet labels against schematic for undefined hierarchical labels.
Definition: sch_sheet.cpp:352
int GetMinWidth() const
Return the minimum width of the sheet based on the widths of the sheet pin text.
Definition: sch_sheet.cpp:375
void DecRefCount()
Definition: sch_screen.cpp:117
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:668
Base plotter engine class.
Definition: plotter.h:114
Definition: color4d.h:56
SCH_SHEET & Root() const
Definition: schematic.h:97
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:249
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:145
see class PGM_BASE
void Plot(PLOTTER *aPlotter) override
Plot the schematic item to aPlotter.
Definition: sch_sheet.cpp:962
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:205
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:847
void Print(RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Print a schematic item.
Definition: sch_sheet.cpp:553
#define _(s)
Definition: 3d_actions.cpp:33
bool IsVerticalOrientation() const
Definition: sch_sheet.cpp:331
void MirrorY(int aYaxis_position) override
Mirror item relative to the Y axis about aYaxis_position.
Definition: sch_sheet.cpp:779
void SetPosition(const wxPoint &aPosition) override
Set the schematic item position to aPosition.
Definition: sch_sheet.cpp:789
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:88
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 TO_UTF8(wxstring)
#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:214
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
Definition: sch_sheet.cpp:910
int GetDefaultPenWidth() const
bool HasPin(const wxString &aName)
Checks if the sheet already has a sheet pin named aName.
Definition: sch_sheet.cpp:307
wxPoint GetRotationCenter() const
Rotating around the boundingBox's center can cause walking when the sheetname or filename is longer t...
Definition: sch_sheet.cpp:603
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
Definition: sch_sheet.cpp:201
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_sheet.cpp:498
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.
Definition of the NETLIST_OBJECT class.
Message panel definition file.
NETLIST_ITEM m_Type
SCH_ITEM * m_Link
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
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:126
SCH_SHEET & operator=(const SCH_ITEM &aSheet)
Definition: sch_sheet.cpp:1013
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:111
void ConvertBusToNetListItems(NETLIST_OBJECT_LIST &aNetListItems)
Function ConvertBusToNetListItems breaks the text of a bus label type net list object into as many me...
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:797
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:916
void GetNetListItem(NETLIST_OBJECT_LIST &aNetListItems, SCH_SHEET_PATH *aSheetPath) override
Create a new NETLIST_OBJECT for the schematic object and adds it to aNetListItems.
Definition: sch_sheet.cpp:939