KiCad PCB EDA Suite
sch_sheet_path.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) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2011-2017 Wayne Stambaugh <stambaughw@verizon.net>
6  * Copyright (C) 1992-2017 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 <fctsys.h>
32 
33 #include <general.h>
34 #include <dlist.h>
35 #include <class_sch_screen.h>
36 #include <sch_item_struct.h>
37 
38 #include <sch_reference_list.h>
39 #include <class_library.h>
40 #include <sch_sheet_path.h>
41 #include <sch_component.h>
42 #include <template_fieldnames.h>
43 
45 
46 #include <wx/filename.h>
47 
48 
50 {
51  m_pageNumber = 0;
52 }
53 
54 
55 int SCH_SHEET_PATH::Cmp( const SCH_SHEET_PATH& aSheetPathToTest ) const
56 {
57  if( size() > aSheetPathToTest.size() )
58  return 1;
59 
60  if( size() < aSheetPathToTest.size() )
61  return -1;
62 
63  //otherwise, same number of sheets.
64  for( unsigned i = 0; i < size(); i++ )
65  {
66  if( at( i )->GetTimeStamp() > aSheetPathToTest.at( i )->GetTimeStamp() )
67  return 1;
68 
69  if( at( i )->GetTimeStamp() < aSheetPathToTest.at( i )->GetTimeStamp() )
70  return -1;
71  }
72 
73  return 0;
74 }
75 
76 
78 {
79  if( !empty() )
80  return at( size() - 1 );
81 
82  return NULL;
83 }
84 
85 
87 {
88  SCH_SHEET* lastSheet = Last();
89 
90  if( lastSheet )
91  return lastSheet->GetScreen();
92 
93  return NULL;
94 }
95 
96 
98 {
99  SCH_SHEET* lastSheet = Last();
100 
101  if( lastSheet && lastSheet->GetScreen() )
102  return lastSheet->GetScreen()->GetDrawItems();
103 
104  return NULL;
105 }
106 
107 
109 {
110  SCH_ITEM* item = NULL;
111 
112  if( !empty() && at( 0 )->GetScreen() )
113  item = at( 0 )->GetScreen()->GetDrawItems();
114 
115  /* @fixme - These lists really should be one of the boost pointer containers. This
116  * is a brain dead hack to allow reverse iteration of EDA_ITEM linked
117  * list.
118  */
119  SCH_ITEM* lastItem = NULL;
120 
121  while( item )
122  {
123  lastItem = item;
124  item = item->Next();
125  }
126 
127  return lastItem;
128 }
129 
130 
131 wxString SCH_SHEET_PATH::Path() const
132 {
133  wxString s, t;
134 
135  s = wxT( "/" ); // This is the root path
136 
137  // start at 1 to avoid the root sheet,
138  // which does not need to be added to the path
139  // it's timestamp changes anyway.
140  for( unsigned i = 1; i < size(); i++ )
141  {
142  t.Printf( _( "%8.8lX/" ), (long unsigned) at( i )->GetTimeStamp() );
143  s = s + t;
144  }
145 
146  return s;
147 }
148 
149 
151 {
152  wxString s;
153 
154  s = wxT( "/" );
155 
156  // start at 1 to avoid the root sheet, as above.
157  for( unsigned i = 1; i < size(); i++ )
158  {
159  s = s + at( i )->GetName() + wxT( "/" );
160  }
161 
162  return s;
163 }
164 
165 
167 {
168  EDA_ITEM* t = LastDrawList();
169 
170  while( t )
171  {
172  if( t->Type() == SCH_COMPONENT_T )
173  {
174  SCH_COMPONENT* component = (SCH_COMPONENT*) t;
175  component->GetField( REFERENCE )->SetText( component->GetRef( this ) );
176  component->UpdateUnit( component->GetUnitSelection( this ) );
177  }
178 
179  t = t->Next();
180  }
181 }
182 
183 
184 void SCH_SHEET_PATH::AnnotatePowerSymbols( PART_LIBS* aLibs, int* aReference )
185 {
186  int ref = 1;
187 
188  if( aReference )
189  ref = *aReference;
190 
191  for( EDA_ITEM* item = LastDrawList(); item; item = item->Next() )
192  {
193  if( item->Type() != SCH_COMPONENT_T )
194  continue;
195 
196  SCH_COMPONENT* component = (SCH_COMPONENT*) item;
197  LIB_PART* part = component->GetPartRef().lock().get();
198 
199  if( !part || !part->IsPower() )
200  continue;
201 
202  wxString refstr = component->GetPrefix();
203 
204  //str will be "C?" or so after the ClearAnnotation call.
205  while( refstr.Last() == '?' )
206  refstr.RemoveLast();
207 
208  if( !refstr.StartsWith( wxT( "#" ) ) )
209  refstr.insert( refstr.begin(), wxChar( '#' ) );
210 
211  refstr << wxT( "0" ) << ref;
212  component->SetRef( this, refstr );
213  ref++;
214  }
215 
216  if( aReference )
217  *aReference = ref;
218 }
219 
220 
222  bool aIncludePowerSymbols )
223 {
224  for( SCH_ITEM* item = LastDrawList(); item; item = item->Next() )
225  {
226  if( item->Type() == SCH_COMPONENT_T )
227  {
228  SCH_COMPONENT* component = (SCH_COMPONENT*) item;
229 
230  // Skip pseudo components, which have a reference starting with #. This mainly
231  // affects power symbols.
232  if( !aIncludePowerSymbols && component->GetRef( this )[0] == wxT( '#' ) )
233  continue;
234 
235  LIB_PART* part = component->GetPartRef().lock().get();
236 
237  if( part )
238  {
239  SCH_REFERENCE reference( component, part, *this );
240 
241  reference.SetSheetNumber( m_pageNumber );
242  aReferences.AddItem( reference );
243  }
244  }
245  }
246 }
247 
248 
251  bool aIncludePowerSymbols )
252 {
253 
254  for( SCH_ITEM* item = LastDrawList(); item; item = item->Next() )
255  {
256  if( item->Type() != SCH_COMPONENT_T )
257  continue;
258 
259  SCH_COMPONENT* component = (SCH_COMPONENT*) item;
260 
261  // Skip pseudo components, which have a reference starting with #. This mainly
262  // affects power symbols.
263  if( !aIncludePowerSymbols && component->GetRef( this )[0] == wxT( '#' ) )
264  continue;
265 
266  LIB_PART* part = component->GetPartRef().lock().get();
267 
268  if( part && part->GetUnitCount() > 1 )
269  {
270  SCH_REFERENCE reference = SCH_REFERENCE( component, part, *this );
271  reference.SetSheetNumber( m_pageNumber );
272  wxString reference_str = reference.GetRef();
273 
274  // Never lock unassigned references
275  if( reference_str[reference_str.Len() - 1] == '?' )
276  continue;
277 
278  aRefList[reference_str].AddItem( reference );
279  }
280  }
281 }
282 
283 
284 SCH_ITEM* SCH_SHEET_PATH::FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) const
285 {
286  bool hasWrapped = false;
287  bool firstItemFound = false;
288  SCH_ITEM* drawItem = LastDrawList();
289 
290  while( drawItem )
291  {
292  if( drawItem->Type() == aType )
293  {
294  if( !aLastItem || firstItemFound )
295  {
296  return drawItem;
297  }
298  else if( !firstItemFound && drawItem == aLastItem )
299  {
300  firstItemFound = true;
301  }
302  }
303 
304  drawItem = drawItem->Next();
305 
306  if( !drawItem && aLastItem && aWrap && !hasWrapped )
307  {
308  hasWrapped = true;
309  drawItem = LastDrawList();
310  }
311  }
312 
313  return NULL;
314 }
315 
316 
317 SCH_ITEM* SCH_SHEET_PATH::FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) const
318 {
319  bool hasWrapped = false;
320  bool firstItemFound = false;
321  SCH_ITEM* drawItem = FirstDrawList();
322 
323  while( drawItem )
324  {
325  if( drawItem->Type() == aType )
326  {
327  if( aLastItem == NULL || firstItemFound )
328  {
329  return drawItem;
330  }
331  else if( !firstItemFound && drawItem == aLastItem )
332  {
333  firstItemFound = true;
334  }
335  }
336 
337  drawItem = drawItem->Back();
338 
339  if( drawItem == NULL && aLastItem && aWrap && !hasWrapped )
340  {
341  hasWrapped = true;
342  drawItem = FirstDrawList();
343  }
344  }
345 
346  return NULL;
347 }
348 
349 
350 bool SCH_SHEET_PATH::SetComponentFootprint( const wxString& aReference, const wxString& aFootPrint,
351  bool aSetVisible )
352 {
353  SCH_SCREEN* screen = LastScreen();
354 
355  if( screen == NULL )
356  return false;
357 
358  return screen->SetComponentFootprint( this, aReference, aFootPrint, aSetVisible );
359 }
360 
361 
363 {
364  if( size() != d1.size() )
365  return false;
366 
367  for( unsigned i = 0; i < size(); i++ )
368  {
369  if( at( i ) != d1[i] )
370  return false;
371  }
372 
373  return true;
374 }
375 
376 
377 bool SCH_SHEET_PATH::TestForRecursion( const wxString& aSrcFileName,
378  const wxString& aDestFileName ) const
379 {
380  wxFileName rootFn = g_RootSheet->GetFileName();
381  wxFileName srcFn = aSrcFileName;
382  wxFileName destFn = aDestFileName;
383 
384  if( srcFn.IsRelative() )
385  srcFn.MakeAbsolute( rootFn.GetPath() );
386 
387  if( destFn.IsRelative() )
388  destFn.MakeAbsolute( rootFn.GetPath() );
389 
390 
391  // The source and destination sheet file names cannot be the same.
392  if( srcFn == destFn )
393  return true;
394 
398  unsigned i = 0;
399 
400  while( i < size() )
401  {
402  wxFileName cmpFn = at( i )->GetFileName();
403 
404  if( cmpFn.IsRelative() )
405  cmpFn.MakeAbsolute( rootFn.GetPath() );
406 
407  // Test if the file name of the destination sheet is in anywhere in this sheet path.
408  if( cmpFn == destFn )
409  break;
410 
411  i++;
412  }
413 
414  // The destination sheet file name was not found in the sheet path or the destination
415  // sheet file name is the root sheet so no recursion is possible.
416  if( i >= size() || i == 0 )
417  return false;
418 
419  // Walk back up to the root sheet to see if the source file name is already a parent in
420  // the sheet path. If so, recursion will occur.
421  do
422  {
423  i -= 1;
424 
425  wxFileName cmpFn = at( i )->GetFileName();
426 
427  if( cmpFn.IsRelative() )
428  cmpFn.MakeAbsolute( rootFn.GetPath() );
429 
430  if( cmpFn == srcFn )
431  return true;
432 
433  } while( i != 0 );
434 
435  // The source sheet file name is not a parent of the destination sheet file name.
436  return false;
437 }
438 
439 
440 int SCH_SHEET_PATH::FindSheet( const wxString& aFileName ) const
441 {
442  for( unsigned i = 0; i < size(); i++ )
443  {
444  if( at( i )->GetFileName().CmpNoCase( aFileName ) == 0 )
445  return (int)i;
446  }
447 
448  return SHEET_NOT_FOUND;
449 }
450 
451 
452 SCH_SHEET* SCH_SHEET_PATH::FindSheetByName( const wxString& aSheetName )
453 {
454  for( unsigned i = 0; i < size(); i++ )
455  {
456  if( at( i )->GetName().CmpNoCase( aSheetName ) == 0 )
457  return at( i );
458  }
459 
460  return NULL;
461 }
462 
463 
464 /********************************************************************/
465 /* Class SCH_SHEET_LIST to handle the list of Sheets in a hierarchy */
466 /********************************************************************/
468 {
469  m_isRootSheet = false;
470 
471  if( aSheet != NULL )
472  BuildSheetList( aSheet );
473 }
474 
475 
476 SCH_SHEET_PATH* SCH_SHEET_LIST::GetSheetByPath( const wxString aPath, bool aHumanReadable )
477 {
478  wxString sheetPath;
479 
480  for( unsigned i = 0; i < size(); i++ )
481  {
482  sheetPath = ( aHumanReadable ) ? at( i ).PathHumanReadable() : at( i ).Path();
483 
484  if( sheetPath == aPath )
485  return &at( i );
486  }
487 
488  return NULL;
489 }
490 
491 
493 {
494  wxCHECK_RET( aSheet != NULL, wxT( "Cannot build sheet list from undefined sheet." ) );
495 
496  if( aSheet == g_RootSheet )
497  m_isRootSheet = true;
498 
499  m_currentSheetPath.push_back( aSheet );
500 
506  m_currentSheetPath.SetPageNumber( size() + 1 );
507  push_back( m_currentSheetPath );
508 
509  if( aSheet->GetScreen() )
510  {
512 
513  while( item )
514  {
515  if( item->Type() == SCH_SHEET_T )
516  {
517  SCH_SHEET* sheet = (SCH_SHEET*) item;
518  BuildSheetList( sheet );
519  }
520 
521  item = item->Next();
522  }
523  }
524 
525  m_currentSheetPath.pop_back();
526 }
527 
528 
530 {
531  for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it )
532  {
533  if( (*it).LastScreen() && (*it).LastScreen()->IsModify() )
534  return true;
535  }
536 
537  return false;
538 }
539 
540 
542 {
543  for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it )
544  {
545  if( (*it).LastScreen() && (*it).LastScreen()->IsSave() )
546  return true;
547  }
548 
549  return false;
550 }
551 
552 
554 {
555  for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it )
556  {
557  if( (*it).LastScreen() )
558  (*it).LastScreen()->ClrModify();
559  }
560 }
561 
562 
564 {
565  int ref = 1;
566 
567  for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it )
568  (*it).AnnotatePowerSymbols( aLibs, &ref );
569 }
570 
571 
573  bool aIncludePowerSymbols )
574 {
575  for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it )
576  (*it).GetComponents( aLibs, aReferences, aIncludePowerSymbols );
577 }
578 
581  bool aIncludePowerSymbols )
582 {
583  for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it )
584  {
586  (*it).GetMultiUnitComponents( aLibs, tempMap );
587 
588  for( SCH_MULTI_UNIT_REFERENCE_MAP::value_type& pair : tempMap )
589  {
590  // Merge this list into the main one
591  unsigned n_refs = pair.second.GetCount();
592 
593  for( unsigned thisRef = 0; thisRef < n_refs; ++thisRef )
594  {
595  aRefList[pair.first].AddItem( pair.second[thisRef] );
596  }
597  }
598  }
599 }
600 
601 
603  SCH_ITEM* aLastItem, bool aWrap )
604 {
605  bool hasWrapped = false;
606  bool firstItemFound = false;
607 
608  SCH_ITEM* drawItem = NULL;
609  SCH_SHEET_PATHS_ITER it = begin();
610 
611  while( it != end() )
612  {
613  drawItem = (*it).LastDrawList();
614 
615  while( drawItem )
616  {
617  if( drawItem->Type() == aType )
618  {
619  if( aLastItem == NULL || firstItemFound )
620  {
621  if( aSheetFoundIn )
622  *aSheetFoundIn = &(*it);
623 
624  return drawItem;
625  }
626  else if( !firstItemFound && drawItem == aLastItem )
627  {
628  firstItemFound = true;
629  }
630  }
631 
632  drawItem = drawItem->Next();
633  }
634 
635  ++it;
636 
637  if( it == end() && aLastItem && aWrap && !hasWrapped )
638  {
639  hasWrapped = true;
640  it = begin();
641  }
642  }
643 
644  return NULL;
645 }
646 
647 
649  SCH_ITEM* aLastItem, bool aWrap )
650 {
651  bool hasWrapped = false;
652  bool firstItemFound = false;
653  SCH_ITEM* drawItem = NULL;
654  SCH_SHEET_PATHS_RITER it = rbegin();
655 
656  while( it != rend() )
657  {
658  drawItem = (*it).FirstDrawList();
659 
660  while( drawItem )
661  {
662  if( drawItem->Type() == aType )
663  {
664  if( aLastItem == NULL || firstItemFound )
665  {
666  if( aSheetFoundIn )
667  *aSheetFoundIn = &(*it);
668 
669  return drawItem;
670  }
671  else if( !firstItemFound && drawItem == aLastItem )
672  {
673  firstItemFound = true;
674  }
675  }
676 
677  drawItem = drawItem->Back();
678  }
679 
680  ++it;
681 
682  if( it == rend() && aLastItem && aWrap && !hasWrapped )
683  {
684  hasWrapped = true;
685  it = rbegin();
686  }
687  }
688 
689  return NULL;
690 }
691 
692 
693 bool SCH_SHEET_LIST::SetComponentFootprint( const wxString& aReference,
694  const wxString& aFootPrint, bool aSetVisible )
695 {
696  bool found = false;
697 
698  for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it )
699  found = (*it).SetComponentFootprint( aReference, aFootPrint, aSetVisible );
700 
701  return found;
702 }
703 
704 
706 {
707  wxString fileName;
708 
709  for( unsigned i = 0; i < size(); i++ )
710  {
711  fileName = at( i ).Last()->GetFileName();
712 
713  for( unsigned j = 0; j < size(); j++ )
714  {
715  if( i == j )
716  continue;
717 
718  if( fileName == at( j ).Last()->GetFileName() )
719  return true;
720  }
721  }
722 
723  return false;
724 }
725 
726 
727 bool SCH_SHEET_LIST::TestForRecursion( const SCH_SHEET_LIST& aSrcSheetHierarchy,
728  const wxString& aDestFileName ) const
729 {
730  wxFileName rootFn = g_RootSheet->GetFileName();
731  wxFileName destFn = aDestFileName;
732 
733  if( destFn.IsRelative() )
734  destFn.MakeAbsolute( rootFn.GetPath() );
735 
736  // Test each SCH_SHEET_PATH in this SCH_SHEET_LIST for potential recursion.
737  for( unsigned i = 0; i < size(); i++ )
738  {
739  // Test each SCH_SHEET_PATH in the source sheet.
740  for( unsigned j = 0; j < aSrcSheetHierarchy.size(); j++ )
741  {
742  const SCH_SHEET_PATH* sheetPath = &aSrcSheetHierarchy[j];
743 
744  for( unsigned k = 0; k < sheetPath->size(); k++ )
745  {
746  if( at( i ).TestForRecursion( sheetPath->GetSheet( k )->GetFileName(),
747  aDestFileName ) )
748  return true;
749  }
750  }
751  }
752 
753  // The source sheet file can safely be added to the destination sheet file.
754  return false;
755 }
756 
757 
758 SCH_SHEET* SCH_SHEET_LIST::FindSheetByName( const wxString& aSheetName )
759 {
760  for( unsigned i = 0; i < size(); i++ )
761  {
762  SCH_SHEET* sheet = at( i ).FindSheetByName( aSheetName );
763 
764  if( sheet )
765  return sheet;
766  }
767 
768  return NULL;
769 }
SCH_ITEM * LastDrawList() const
Function LastDrawList.
void SetSheetNumber(int aSheetNumber)
Class SCH_SHEET_LIST.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
void AnnotatePowerSymbols(PART_LIBS *aLib)
Function AnnotatePowerSymbols clear and annotates the entire hierarchy of the sheet path list...
bool IsModified()
Function IsModified checks the entire hierarchy for any modifications.
SCH_SHEET * FindSheetByName(const wxString &aSheetName)
Function FindSheetByName.
int FindSheet(const wxString &aFileName) const
void GetComponents(PART_LIBS *aLibs, SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true)
Function GetComponents adds a SCH_REFERENCE() object to aReferences for each component in the sheet...
SCH_ITEM * FindPreviousItem(KICAD_T aType, SCH_SHEET_PATH **aSheetFound=NULL, SCH_ITEM *aLastItem=NULL, bool aWrap=true)
Function FindPreviousItem searches the entire schematic for the previous schematic item...
PART_REF & GetPartRef()
void UpdateUnit(int aUnit)
change the unit id to aUnit has maening only for multiple parts per package Do not change the modifie...
SCH_SHEET_PATHS::iterator SCH_SHEET_PATHS_ITER
bool IsPower() const
const SCH_SHEET * GetSheet(unsigned aIndex) const
Base schematic object class definition.
SCH_ITEM * FindNextItem(KICAD_T aType, SCH_SHEET_PATH **aSheetFound=NULL, SCH_ITEM *aLastItem=NULL, bool aWrap=true)
Function FindNextItem searches the entire schematic for the next schematic object.
void SetPageNumber(int aPageNumber)
void GetMultiUnitComponents(PART_LIBS *aLibs, SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, bool aIncludePowerSymbols=true)
Function GetMultiUnitComponents adds a SCH_REFERENCE_LIST object to aRefList for each same-reference ...
void AddItem(SCH_REFERENCE &aItem)
Function AddItem adds a SCH_REFERENCE object to the list of references.
wxString GetPrefix() const
int GetUnitSelection(SCH_SHEET_PATH *aSheet)
void SetRef(const SCH_SHEET_PATH *sheet, const wxString &ref)
Set the reference, for the given sheet path.
bool operator==(const SCH_SHEET_PATH &d1) const
SCH_SCREEN * LastScreen() const
Function LastScreen.
EDA_ITEM * Next() const
Definition: base_struct.h:206
void UpdateAllScreenReferences()
Function UpdateAllScreenReferences updates the reference and the m_Multi parameter (part selection) f...
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:286
SCH_ITEM * Next() const
Field Reference of part, i.e. "IC21".
#define SHEET_NOT_FOUND
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:90
SCH_SHEET_LIST(SCH_SHEET *aSheet=NULL)
Constructor build a flattened list of SCH_SHEET_PATH objects from aSheet.
Class SCH_REFERENCE_LIST is used to create a flattened list of components because in a complex hierar...
SCH_ITEM * Back() const
wxString Path() const
Function Path the path uses the time stamps which do not changes even when editing sheet parameters a...
void AnnotatePowerSymbols(PART_LIBS *aLibs, int *aReference)
Function AnnotatePowerSymbols annotates the power symbols only starting at aReference in the sheet pa...
SCH_SHEET * FindSheetByName(const wxString &aSheetName)
Function FindSheetByName.
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:54
SCH_FIELD * GetField(int aFieldNdx) const
Function GetField returns a field.
SCH_SHEET_PATH m_currentSheetPath
SCH_ITEM * FirstDrawList() const
Get the last schematic item relative to the first sheet in the list.
Definitions for the Eeschema program SCH_SCREEN class.
Subclass of DIALOG_SCH_FIND_BASE, which is generated by wxFormBuilder.
bool SetComponentFootprint(const wxString &aReference, const wxString &aFootPrint, bool aSetVisible)
Function SetFootprintField searches all the sheets for a component with aReference and set the footpr...
bool IsComplexHierarchy() const
Function IsComplexHierarchy searches all of the sheets for duplicate files names which indicates a co...
wxString PathHumanReadable() const
Function PathHumanReadable returns the sheet path in a human readable form, i.e.
bool SetComponentFootprint(const wxString &aReference, const wxString &aFootPrint, bool aSetVisible)
Function SetFootprintField searches last sheet in the path for a component with aReference and set th...
Class LIB_PART defines a library part object.
SCH_ITEM * FindPreviousItem(KICAD_T aType, SCH_ITEM *aLastItem=NULL, bool aWrap=false) const
Find the previous schematic item in this sheet path object.
SCH_SHEET_PATH()
Page numbers are maintained by the sheet load order.
Class SCH_SHEET_PATH.
SCH_SHEET * Last() const
Function Last returns a pointer to the last sheet of the list One can see the others sheet as the "pa...
void BuildSheetList(SCH_SHEET *aSheet)
Function BuildSheetList builds the list of sheets and their sheet path from aSheet.
wxString GetFileName(void) const
Function GetFileName return the filename corresponding to this sheet.
Definition: sch_sheet.cpp:849
std::map< wxString, SCH_REFERENCE_LIST > SCH_MULTI_UNIT_REFERENCE_MAP
Type SCH_MULTI_UNIT_REFERENCE_MAP is used to create a map of reference designators for multi-unit par...
SCH_ITEM * FindNextItem(KICAD_T aType, SCH_ITEM *aLastItem=NULL, bool aWrap=false) const
Find the next schematic item in this sheet object.
time_t GetTimeStamp() const
Definition: base_struct.h:204
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
int GetUnitCount() const
Class PART_LIBS is a collection of PART_LIBs.
wxString GetRef() const
bool TestForRecursion(const wxString &aSrcFileName, const wxString &aDestFileName) const
Function TestForRecursion.
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
const wxString GetRef(const SCH_SHEET_PATH *sheet)
Function GetRef returns the reference, for the given sheet path.
Definition the SCH_COMPONENT class for Eeschema.
SCH_SHEET_PATH * GetSheetByPath(const wxString aPath, bool aHumanReadable=true)
Function GetSheetByPath returns a sheet matching the path name in aPath.
SCH_SHEET_PATHS::reverse_iterator SCH_SHEET_PATHS_RITER
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
static bool empty(const wxTextEntryBase *aCtrl)
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
void GetComponents(PART_LIBS *aLibs, SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true)
Function GetComponents adds a SCH_REFERENCE() object to aReferences for each component in the list of...
int Cmp(const SCH_SHEET_PATH &aSheetPathToTest) const
Function Cmp Compare if this is the same sheet path as aSheetPathToTest.
void GetMultiUnitComponents(PART_LIBS *aLibs, SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, bool aIncludePowerSymbols=true)
Function GetMultiUnitComponents adds a SCH_REFERENCE_LIST object to aRefList for each same-reference ...
bool IsAutoSaveRequired()
Function IsAutoSaveRequired checks the entire hierarchy for any modifications that require auto save...
Definition for part library class.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
Class SCH_REFERENCE is used as a helper to define a component's reference designator in a schematic...
bool TestForRecursion(const SCH_SHEET_LIST &aSrcSheetHierarchy, const wxString &aDestFileName) const
Function TestForRecursion.
virtual void SetText(const wxString &aText)
Definition: eda_text.h:141
bool SetComponentFootprint(SCH_SHEET_PATH *aSheetPath, const wxString &aReference, const wxString &aFootPrint, bool aSetVisible)
Function SetFootprintField searches screen for a component with aReference and set the footprint fiel...