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