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 
186  bool aIncludePowerSymbols )
187 {
188  for( SCH_ITEM* item = LastDrawList(); item; item = item->Next() )
189  {
190  if( item->Type() == SCH_COMPONENT_T )
191  {
192  SCH_COMPONENT* component = (SCH_COMPONENT*) item;
193 
194  // Skip pseudo components, which have a reference starting with #. This mainly
195  // affects power symbols.
196  if( !aIncludePowerSymbols && component->GetRef( this )[0] == wxT( '#' ) )
197  continue;
198 
199  LIB_PART* part = component->GetPartRef().lock().get();
200 
201  if( part )
202  {
203  SCH_REFERENCE reference( component, part, *this );
204 
205  reference.SetSheetNumber( m_pageNumber );
206  aReferences.AddItem( reference );
207  }
208  }
209  }
210 }
211 
212 
215  bool aIncludePowerSymbols )
216 {
217 
218  for( SCH_ITEM* item = LastDrawList(); item; item = item->Next() )
219  {
220  if( item->Type() != SCH_COMPONENT_T )
221  continue;
222 
223  SCH_COMPONENT* component = (SCH_COMPONENT*) item;
224 
225  // Skip pseudo components, which have a reference starting with #. This mainly
226  // affects power symbols.
227  if( !aIncludePowerSymbols && component->GetRef( this )[0] == wxT( '#' ) )
228  continue;
229 
230  LIB_PART* part = component->GetPartRef().lock().get();
231 
232  if( part && part->GetUnitCount() > 1 )
233  {
234  SCH_REFERENCE reference = SCH_REFERENCE( component, part, *this );
235  reference.SetSheetNumber( m_pageNumber );
236  wxString reference_str = reference.GetRef();
237 
238  // Never lock unassigned references
239  if( reference_str[reference_str.Len() - 1] == '?' )
240  continue;
241 
242  aRefList[reference_str].AddItem( reference );
243  }
244  }
245 }
246 
247 
248 SCH_ITEM* SCH_SHEET_PATH::FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) const
249 {
250  bool hasWrapped = false;
251  bool firstItemFound = false;
252  SCH_ITEM* drawItem = LastDrawList();
253 
254  while( drawItem )
255  {
256  if( drawItem->Type() == aType )
257  {
258  if( !aLastItem || firstItemFound )
259  {
260  return drawItem;
261  }
262  else if( !firstItemFound && drawItem == aLastItem )
263  {
264  firstItemFound = true;
265  }
266  }
267 
268  drawItem = drawItem->Next();
269 
270  if( !drawItem && aLastItem && aWrap && !hasWrapped )
271  {
272  hasWrapped = true;
273  drawItem = LastDrawList();
274  }
275  }
276 
277  return NULL;
278 }
279 
280 
281 SCH_ITEM* SCH_SHEET_PATH::FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) const
282 {
283  bool hasWrapped = false;
284  bool firstItemFound = false;
285  SCH_ITEM* drawItem = FirstDrawList();
286 
287  while( drawItem )
288  {
289  if( drawItem->Type() == aType )
290  {
291  if( aLastItem == NULL || firstItemFound )
292  {
293  return drawItem;
294  }
295  else if( !firstItemFound && drawItem == aLastItem )
296  {
297  firstItemFound = true;
298  }
299  }
300 
301  drawItem = drawItem->Back();
302 
303  if( drawItem == NULL && aLastItem && aWrap && !hasWrapped )
304  {
305  hasWrapped = true;
306  drawItem = FirstDrawList();
307  }
308  }
309 
310  return NULL;
311 }
312 
313 
314 bool SCH_SHEET_PATH::SetComponentFootprint( const wxString& aReference, const wxString& aFootPrint,
315  bool aSetVisible )
316 {
317  SCH_SCREEN* screen = LastScreen();
318 
319  if( screen == NULL )
320  return false;
321 
322  return screen->SetComponentFootprint( this, aReference, aFootPrint, aSetVisible );
323 }
324 
325 
327 {
328  if( size() != d1.size() )
329  return false;
330 
331  for( unsigned i = 0; i < size(); i++ )
332  {
333  if( at( i ) != d1[i] )
334  return false;
335  }
336 
337  return true;
338 }
339 
340 
341 bool SCH_SHEET_PATH::TestForRecursion( const wxString& aSrcFileName,
342  const wxString& aDestFileName ) const
343 {
344  wxFileName rootFn = g_RootSheet->GetFileName();
345  wxFileName srcFn = aSrcFileName;
346  wxFileName destFn = aDestFileName;
347 
348  if( srcFn.IsRelative() )
349  srcFn.MakeAbsolute( rootFn.GetPath() );
350 
351  if( destFn.IsRelative() )
352  destFn.MakeAbsolute( rootFn.GetPath() );
353 
354 
355  // The source and destination sheet file names cannot be the same.
356  if( srcFn == destFn )
357  return true;
358 
362  unsigned i = 0;
363 
364  while( i < size() )
365  {
366  wxFileName cmpFn = at( i )->GetFileName();
367 
368  if( cmpFn.IsRelative() )
369  cmpFn.MakeAbsolute( rootFn.GetPath() );
370 
371  // Test if the file name of the destination sheet is in anywhere in this sheet path.
372  if( cmpFn == destFn )
373  break;
374 
375  i++;
376  }
377 
378  // The destination sheet file name was not found in the sheet path or the destination
379  // sheet file name is the root sheet so no recursion is possible.
380  if( i >= size() || i == 0 )
381  return false;
382 
383  // Walk back up to the root sheet to see if the source file name is already a parent in
384  // the sheet path. If so, recursion will occur.
385  do
386  {
387  i -= 1;
388 
389  wxFileName cmpFn = at( i )->GetFileName();
390 
391  if( cmpFn.IsRelative() )
392  cmpFn.MakeAbsolute( rootFn.GetPath() );
393 
394  if( cmpFn == srcFn )
395  return true;
396 
397  } while( i != 0 );
398 
399  // The source sheet file name is not a parent of the destination sheet file name.
400  return false;
401 }
402 
403 
404 int SCH_SHEET_PATH::FindSheet( const wxString& aFileName ) const
405 {
406  for( unsigned i = 0; i < size(); i++ )
407  {
408  if( at( i )->GetFileName().CmpNoCase( aFileName ) == 0 )
409  return (int)i;
410  }
411 
412  return SHEET_NOT_FOUND;
413 }
414 
415 
416 SCH_SHEET* SCH_SHEET_PATH::FindSheetByName( const wxString& aSheetName )
417 {
418  for( unsigned i = 0; i < size(); i++ )
419  {
420  if( at( i )->GetName().CmpNoCase( aSheetName ) == 0 )
421  return at( i );
422  }
423 
424  return NULL;
425 }
426 
427 
428 /********************************************************************/
429 /* Class SCH_SHEET_LIST to handle the list of Sheets in a hierarchy */
430 /********************************************************************/
432 {
433  m_isRootSheet = false;
434 
435  if( aSheet != NULL )
436  BuildSheetList( aSheet );
437 }
438 
439 
440 SCH_SHEET_PATH* SCH_SHEET_LIST::GetSheetByPath( const wxString aPath, bool aHumanReadable )
441 {
442  wxString sheetPath;
443 
444  for( unsigned i = 0; i < size(); i++ )
445  {
446  sheetPath = ( aHumanReadable ) ? at( i ).PathHumanReadable() : at( i ).Path();
447 
448  if( sheetPath == aPath )
449  return &at( i );
450  }
451 
452  return NULL;
453 }
454 
455 
457 {
458  wxCHECK_RET( aSheet != NULL, wxT( "Cannot build sheet list from undefined sheet." ) );
459 
460  if( aSheet == g_RootSheet )
461  m_isRootSheet = true;
462 
463  m_currentSheetPath.push_back( aSheet );
464 
470  m_currentSheetPath.SetPageNumber( size() + 1 );
471  push_back( m_currentSheetPath );
472 
473  if( aSheet->GetScreen() )
474  {
476 
477  while( item )
478  {
479  if( item->Type() == SCH_SHEET_T )
480  {
481  SCH_SHEET* sheet = (SCH_SHEET*) item;
482  BuildSheetList( sheet );
483  }
484 
485  item = item->Next();
486  }
487  }
488 
489  m_currentSheetPath.pop_back();
490 }
491 
492 
494 {
495  for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it )
496  {
497  if( (*it).LastScreen() && (*it).LastScreen()->IsModify() )
498  return true;
499  }
500 
501  return false;
502 }
503 
504 
506 {
507  for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it )
508  {
509  if( (*it).LastScreen() && (*it).LastScreen()->IsSave() )
510  return true;
511  }
512 
513  return false;
514 }
515 
516 
518 {
519  for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it )
520  {
521  if( (*it).LastScreen() )
522  (*it).LastScreen()->ClrModify();
523  }
524 }
525 
526 
528 {
529  // List of reference for power symbols
530  SCH_REFERENCE_LIST references;
531 
532  // Map of locked components (not used, but needed by Annotate()
533  SCH_MULTI_UNIT_REFERENCE_MAP lockedComponents;
534 
535  // Build the list of power components:
536  for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it )
537  {
538  SCH_SHEET_PATH& spath = *it;
539 
540  for( EDA_ITEM* item = spath.LastDrawList(); item; item = item->Next() )
541  {
542  if( item->Type() != SCH_COMPONENT_T )
543  continue;
544 
545  SCH_COMPONENT* component = (SCH_COMPONENT*) item;
546  LIB_PART* part = component->GetPartRef().lock().get();
547 
548  if( !part || !part->IsPower() )
549  continue;
550 
551  if( part )
552  {
553  SCH_REFERENCE reference( component, part, spath );
554  references.AddItem( reference );
555  }
556  }
557  }
558 
559  // Find duplicate, and silently clear annotation of duplicate
560  std::map<wxString, int> ref_list; // stores the existing references
561 
562  for( unsigned ii = 0; ii< references.GetCount(); ++ii )
563  {
564  wxString curr_ref = references[ii].GetRef();
565 
566  if( ref_list.find( curr_ref ) == ref_list.end() )
567  {
568  ref_list[curr_ref] = ii;
569  continue;
570  }
571 
572  // Possible duplicate, if the ref ends by a number:
573  if( curr_ref.Last() < '0' && curr_ref.Last() > '9' )
574  continue; // not annotated
575 
576  // Duplicate: clear annotation by removing the number ending the ref
577  while( curr_ref.Last() >= '0' && curr_ref.Last() <= '9' )
578  curr_ref.RemoveLast();
579 
580  references[ii].SetRef( curr_ref );
581  }
582 
583 
584  // Break full components reference in name (prefix) and number:
585  // example: IC1 become IC, and 1
586  references.SplitReferences();
587 
588  // Ensure all power symbols have the reference starting by '#'
589  // (No sure this is really useful)
590  for( unsigned ii = 0; ii< references.GetCount(); ++ii )
591  {
592  if( references[ii].GetRef()[0] != '#' )
593  {
594  wxString new_ref = "#" + references[ii].GetRef();
595  references[ii].SetRef( new_ref );
596  }
597  }
598 
599  // Recalculate and update reference numbers in schematic
600  references.Annotate( false, 100, lockedComponents );
601  references.UpdateAnnotation();
602 }
603 
604 
606  bool aIncludePowerSymbols )
607 {
608  for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it )
609  (*it).GetComponents( aLibs, aReferences, aIncludePowerSymbols );
610 }
611 
614  bool aIncludePowerSymbols )
615 {
616  for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it )
617  {
619  (*it).GetMultiUnitComponents( aLibs, tempMap );
620 
621  for( SCH_MULTI_UNIT_REFERENCE_MAP::value_type& pair : tempMap )
622  {
623  // Merge this list into the main one
624  unsigned n_refs = pair.second.GetCount();
625 
626  for( unsigned thisRef = 0; thisRef < n_refs; ++thisRef )
627  {
628  aRefList[pair.first].AddItem( pair.second[thisRef] );
629  }
630  }
631  }
632 }
633 
634 
636  SCH_ITEM* aLastItem, bool aWrap )
637 {
638  bool hasWrapped = false;
639  bool firstItemFound = false;
640 
641  SCH_ITEM* drawItem = NULL;
642  SCH_SHEET_PATHS_ITER it = begin();
643 
644  while( it != end() )
645  {
646  drawItem = (*it).LastDrawList();
647 
648  while( drawItem )
649  {
650  if( drawItem->Type() == aType )
651  {
652  if( aLastItem == NULL || firstItemFound )
653  {
654  if( aSheetFoundIn )
655  *aSheetFoundIn = &(*it);
656 
657  return drawItem;
658  }
659  else if( !firstItemFound && drawItem == aLastItem )
660  {
661  firstItemFound = true;
662  }
663  }
664 
665  drawItem = drawItem->Next();
666  }
667 
668  ++it;
669 
670  if( it == end() && aLastItem && aWrap && !hasWrapped )
671  {
672  hasWrapped = true;
673  it = begin();
674  }
675  }
676 
677  return NULL;
678 }
679 
680 
682  SCH_ITEM* aLastItem, bool aWrap )
683 {
684  bool hasWrapped = false;
685  bool firstItemFound = false;
686  SCH_ITEM* drawItem = NULL;
687  SCH_SHEET_PATHS_RITER it = rbegin();
688 
689  while( it != rend() )
690  {
691  drawItem = (*it).FirstDrawList();
692 
693  while( drawItem )
694  {
695  if( drawItem->Type() == aType )
696  {
697  if( aLastItem == NULL || firstItemFound )
698  {
699  if( aSheetFoundIn )
700  *aSheetFoundIn = &(*it);
701 
702  return drawItem;
703  }
704  else if( !firstItemFound && drawItem == aLastItem )
705  {
706  firstItemFound = true;
707  }
708  }
709 
710  drawItem = drawItem->Back();
711  }
712 
713  ++it;
714 
715  if( it == rend() && aLastItem && aWrap && !hasWrapped )
716  {
717  hasWrapped = true;
718  it = rbegin();
719  }
720  }
721 
722  return NULL;
723 }
724 
725 
726 bool SCH_SHEET_LIST::SetComponentFootprint( const wxString& aReference,
727  const wxString& aFootPrint, bool aSetVisible )
728 {
729  bool found = false;
730 
731  for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it )
732  found = (*it).SetComponentFootprint( aReference, aFootPrint, aSetVisible );
733 
734  return found;
735 }
736 
737 
739 {
740  wxString fileName;
741 
742  for( unsigned i = 0; i < size(); i++ )
743  {
744  fileName = at( i ).Last()->GetFileName();
745 
746  for( unsigned j = 0; j < size(); j++ )
747  {
748  if( i == j )
749  continue;
750 
751  if( fileName == at( j ).Last()->GetFileName() )
752  return true;
753  }
754  }
755 
756  return false;
757 }
758 
759 
760 bool SCH_SHEET_LIST::TestForRecursion( const SCH_SHEET_LIST& aSrcSheetHierarchy,
761  const wxString& aDestFileName ) const
762 {
763  wxFileName rootFn = g_RootSheet->GetFileName();
764  wxFileName destFn = aDestFileName;
765 
766  if( destFn.IsRelative() )
767  destFn.MakeAbsolute( rootFn.GetPath() );
768 
769  // Test each SCH_SHEET_PATH in this SCH_SHEET_LIST for potential recursion.
770  for( unsigned i = 0; i < size(); i++ )
771  {
772  // Test each SCH_SHEET_PATH in the source sheet.
773  for( unsigned j = 0; j < aSrcSheetHierarchy.size(); j++ )
774  {
775  const SCH_SHEET_PATH* sheetPath = &aSrcSheetHierarchy[j];
776 
777  for( unsigned k = 0; k < sheetPath->size(); k++ )
778  {
779  if( at( i ).TestForRecursion( sheetPath->GetSheet( k )->GetFileName(),
780  aDestFileName ) )
781  return true;
782  }
783  }
784  }
785 
786  // The source sheet file can safely be added to the destination sheet file.
787  return false;
788 }
789 
790 
791 SCH_SHEET* SCH_SHEET_LIST::FindSheetByName( const wxString& aSheetName )
792 {
793  for( unsigned i = 0; i < size(); i++ )
794  {
795  SCH_SHEET* sheet = at( i ).FindSheetByName( aSheetName );
796 
797  if( sheet )
798  return sheet;
799  }
800 
801  return NULL;
802 }
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 Silently annotates the not yet annotated power symbols of the entire hi...
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 number to aUnit without setting any internal flags.
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.
int GetUnitSelection(SCH_SHEET_PATH *aSheet)
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 UpdateAnnotation()
function UpdateAnnotation Updates the reference components for the schematic project (or the current ...
SCH_SHEET * FindSheetByName(const wxString &aSheetName)
Function FindSheetByName.
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:54
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
SCH_SHEET_PATH m_currentSheetPath
void Annotate(bool aUseSheetNum, int aSheetIntervalId, SCH_MULTI_UNIT_REFERENCE_MAP aLockedUnitMap)
Function Annotate set the reference designators in the list that have not been annotated.
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.
const wxString GetRef(const SCH_SHEET_PATH *aSheet)
Return the reference for the given sheet path.
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().
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.
void SplitReferences()
Function SplitReferences attempts to split all reference designators into a name (U) and number (1)...
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.
unsigned GetCount()
Function GetCount.
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...