38#include <wx/filename.h>
56 return _(
"(Deleted Item)" );
61 return wxT(
"DELETED_SHEET_ITEM" );
92 void Show(
int , std::ostream& )
const override {}
125 return path.GetCurrentHash();
153 m_sheets = std::move( aOther.m_sheets );
173 for(
size_t i = 0; i <
size; i++ )
206 if(
size() > aSheetPathToTest.
size() )
209 if(
size() < aSheetPathToTest.
size() )
213 for(
unsigned i = 0; i <
size(); i++ )
215 if(
at( i )->m_Uuid < aSheetPathToTest.
at( i )->
m_Uuid )
218 if(
at( i )->m_Uuid != aSheetPathToTest.
at( i )->
m_Uuid )
233 if( pageNumComp == 0 )
238 if( virtualPageA > virtualPageB )
240 else if( virtualPageA < virtualPageB )
250 if( aSheetPathToTest.
size() >
size() )
253 for(
size_t i = 0; i < aSheetPathToTest.
size(); ++i )
255 if(
at( i )->m_Uuid != aSheetPathToTest.
at( i )->
m_Uuid )
306 if( sheet->GetExcludedFromSim() )
316 if( aVariantName.IsEmpty() )
321 while( !
copy.empty() )
338 if( sheet->GetExcludedFromBOM() )
348 if( aVariantName.IsEmpty() )
353 while( !
copy.empty() )
370 if( sheet->GetExcludedFromBoard() )
380 if( aVariantName.IsEmpty() )
385 while( !
copy.empty() )
402 if( sheet->GetDNP() )
412 if( aVariantName.IsEmpty() )
417 while( !
copy.empty() )
438 for(
unsigned i = 1; i <
size(); i++ )
470 for(
size_t i = 1; i <
size; i++ )
479 bool aStripTrailingSeparator,
480 bool aEscapeSheetNames )
const
487 if( !
empty() &&
at( 0 )->IsVirtualRootSheet() )
490 if( aUseShortRootName )
498 if(
size() > startIdx &&
at( startIdx )->GetScreen() )
501 wxFileName fn = fileName;
503 s = fn.GetName() + wxS(
"/" );
510 size_t loopStart = startIdx + 1;
512 if( aUseShortRootName &&
size() > startIdx )
518 loopStart = startIdx;
521 for(
unsigned i = loopStart; i <
size(); i++ )
525 if( aEscapeSheetNames )
528 s << sheetName << wxS(
"/" );
531 if( aStripTrailingSeparator && s.EndsWith(
"/" ) )
532 s = s.Left( s.length() - 1 );
540 std::vector<SCH_ITEM*> items;
543 std::back_inserter( items ),
590 bool isPowerSymbol = !aReference.IsEmpty() && aReference[0] == wxT(
'#' );
592 switch( aSymbolFilter )
599 default:
return !isPowerSymbol;
605 bool aForceIncludeOrphanSymbols )
const
610 AppendSymbol( aReferences, symbol, aSymbolFilter, aForceIncludeOrphanSymbols );
616 bool aForceIncludeOrphanSymbols )
const
627 aReferences.
AddItem( schReference );
657 wxString reference_str = schReference.
GetRef();
660 if( reference_str[reference_str.Len() - 1] ==
'?' )
663 aRefList[reference_str].AddItem( schReference );
676 auto pair = std::make_pair( aSrcFileName, aDestFileName );
683 wxCHECK_MSG( sch,
false,
"No SCHEMATIC found in SCH_SHEET_PATH::TestForRecursion!" );
686 wxFileName srcFn = aSrcFileName;
687 wxFileName destFn = aDestFileName;
689 if( srcFn.IsRelative() )
690 srcFn.MakeAbsolute( rootFn.GetPath() );
692 if( destFn.IsRelative() )
693 destFn.MakeAbsolute( rootFn.GetPath() );
696 if( srcFn == destFn )
711 if( cmpFn.IsRelative() )
712 cmpFn.MakeAbsolute( rootFn.GetPath() );
715 if( cmpFn == destFn )
723 if( i >=
size() || i == 0 )
737 if( cmpFn.IsRelative() )
738 cmpFn.MakeAbsolute( rootFn.GetPath() );
758 wxCHECK( sheet, wxEmptyString );
762 if( !tmpPath.empty() )
765 return wxEmptyString;
775 if( pageStr.ToLong( &page ) )
790 if( !tmpPath.empty() )
796 wxCHECK_MSG(
false, , wxS(
"Sheet paths must have a least one valid sheet." ) );
805 const wxString& aProjectName )
807 wxCHECK( !aProjectName.IsEmpty(), );
813 newSheetPath = newSheetPath + currentSheetPath;
819 wxCHECK2( symbol,
continue );
828 newSymbolInstance.
m_Path = newSheetPath.
Path();
837 newSymbolInstance.
m_Path = newSheetPath.
Path();
846 newSymbolInstance.
m_Path = newSheetPath.
Path();
861 wxCHECK2( symbol,
continue );
867 fullSheetPath = fullSheetPath + currentSheetPath;
879 wxLogTrace(
traceSchSheetPaths,
"CheckForMissingSymbolInstances for path: %s (project: %s)",
888 wxCHECK2( symbol,
continue );
907 " Legacy format: Using reference '%s' from field, unit %d",
916 const std::vector<SCH_SYMBOL_INSTANCE>& instances = symbol->
GetInstances();
918 auto sourceIt = std::find_if( instances.begin(), instances.end(),
921 return aInstance.m_ProjectName == aProjectName;
924 if( sourceIt == instances.end() )
925 sourceIt = instances.begin();
927 symbolInstance = *sourceIt;
930 " Using available instance (project '%s'): ref=%s, unit=%d, variants=%zu",
931 sourceIt->m_ProjectName, symbolInstance.
m_Reference,
942 " No instance data: Using reference '%s' from field, unit %d",
951 " Created instance: ref=%s, path=%s",
957 " Symbol %s already has instance: ref=%s, path=%s",
973 if( sheetFileName.IsAbsolute() )
979 wxCHECK( screen && parentScreen, );
982 wxFileName parentFileName = parentScreen->
GetFileName();
986 wxCHECK( fileName.IsAbsolute() && parentFileName.IsAbsolute(), );
988 if( fileName.GetPath() == parentFileName.GetPath() )
992 else if( fileName.MakeRelativeTo( parentFileName.GetPath() ) )
1002 wxT(
"\n File name: '%s'"
1003 "\n parent file name '%s',"
1004 "\n sheet '%s' file name '%s'." ),
1006 Last()->GetFileName() );
1014 while( !tmp.
empty() )
1030 if( aSheet !=
nullptr )
1041 "BuildSheetList called with sheet '%s' (UUID=%s, isVirtualRoot=%d)",
1049 wxLogTrace(
traceSchSheetPaths,
" Skipping virtual root, processing children only" );
1053 std::vector<SCH_ITEM*> childSheets;
1056 for(
SCH_ITEM* item : childSheets )
1066 std::vector<SCH_SHEET*> badSheets;
1075 std::vector<SCH_ITEM*> childSheets;
1078 for(
SCH_ITEM* item : childSheets )
1082 if( aCheckIntegrity )
1087 badSheets.push_back( sheet );
1094 wxT(
"Recursion prevented in SCH_SHEET_LIST::BuildSheetList" ) );
1101 if( aCheckIntegrity )
1117 path.CachePageNumber();
1119 std::sort( begin(),
end(),
1123 size_t common_len = 0;
1124 size_t min_len = std::min( a.
size(), b.
size() );
1126 while( common_len < min_len && a.
at( common_len )->
m_Uuid == b.
at( common_len )->
m_Uuid )
1131 if( common_len == a.
size() )
1133 if( common_len == b.
size() )
1144 for(
size_t i = 0; i < common_len; i++ )
1145 ancestor.push_back( a.
at( i )->
m_Uuid );
1166 if( aUpdateVirtualPageNums )
1168 int virtualPageNum = 1;
1179 path.CachePageNumber();
1181 std::sort( begin(),
end(),
1189 else if( retval > 0 )
1201 if( aUpdateVirtualPageNums )
1203 int virtualPageNum = 1;
1237 auto it = std::remove_if( begin(),
end(),
1240 return std::find( aPageInclusions.begin(),
1241 aPageInclusions.end(),
1251 wxString pageNumber;
1254 std::set<int> usedPageNumbers;
1258 wxString existingPageNum =
path.GetPageNumber();
1261 if( existingPageNum.ToLong( &pageNum ) && pageNum > 0 )
1262 usedPageNumbers.insert(
static_cast<int>( pageNum ) );
1266 int nextAvailable = 1;
1268 while( usedPageNumbers.count( nextAvailable ) > 0 )
1271 pageNumber.Printf( wxT(
"%d" ), nextAvailable );
1314 if( aAllowNullptrReturn )
1325 if( aItem->m_Uuid == aID )
1333 if( aChild->
m_Uuid == aID )
1334 childMatch = aChild;
1354 aMap[ aItem->m_Uuid ] = aItem;
1356 aItem->RunOnChildren(
1359 aMap[ aChild->
m_Uuid ] = aChild;
1383 if( libSymbol && libSymbol->
IsPower() )
1386 references.
AddItem( schReference );
1392 std::map<wxString, int> ref_list;
1394 for(
unsigned ii = 0; ii< references.
GetCount(); ++ii )
1396 wxString curr_ref = references[ii].GetRef();
1398 if( curr_ref.IsEmpty() )
1401 if( ref_list.find( curr_ref ) == ref_list.end() )
1403 ref_list[curr_ref] = ii;
1408 if( curr_ref.Last() <
'0' && curr_ref.Last() >
'9' )
1412 while( !curr_ref.IsEmpty() && curr_ref.Last() >=
'0' && curr_ref.Last() <=
'9' )
1413 curr_ref.RemoveLast();
1415 references[ii].SetRef( curr_ref );
1424 for(
unsigned ii = 0; ii< references.
GetCount(); ++ii )
1428 if( ref_unit.
GetRef()[0] !=
'#' )
1430 wxString new_ref =
"#" + ref_unit.
GetRef();
1431 ref_unit.
SetRef( new_ref );
1439 bool aForceIncludeOrphanSymbols )
const
1442 sheet.
GetSymbols( aReferences, aSymbolFilter, aForceIncludeOrphanSymbols );
1447 SYMBOL_FILTER aSymbolFilter,
bool aForceIncludeOrphanSymbols )
const
1452 sheet.
GetSymbols( aReferences, aSymbolFilter, aForceIncludeOrphanSymbols );
1463 aSheets.push_back( sheet );
1469 bool aIncludeLastSheet )
const
1475 if( !aIncludeLastSheet )
1476 testPath.pop_back();
1478 if( testPath == aPath )
1482 return std::nullopt;
1488 for(
auto it = begin(); it !=
end(); ++it )
1491 ( *it ).GetMultiUnitSymbols( tempMap, aSymbolFilter );
1493 for( SCH_MULTI_UNIT_REFERENCE_MAP::value_type& pair : tempMap )
1496 unsigned n_refs = pair.second.GetCount();
1498 for(
unsigned thisRef = 0; thisRef < n_refs; ++thisRef )
1499 aRefList[pair.first].AddItem( pair.second[thisRef] );
1506 const wxString& aDestFileName )
1511 SCHEMATIC* sch = at( 0 ).LastScreen()->Schematic();
1513 wxCHECK_MSG( sch,
false,
"No SCHEMATIC found in SCH_SHEET_LIST::TestForRecursion!" );
1516 wxFileName destFn = aDestFileName;
1518 if( destFn.IsRelative() )
1519 destFn.MakeAbsolute( rootFn.GetPath() );
1522 for(
unsigned i = 0; i < size(); i++ )
1525 for(
unsigned j = 0; j < aSrcSheetHierarchy.size(); j++ )
1529 for(
unsigned k = 0; k < sheetPath->
size(); k++ )
1576 retval.push_back( sheetpath );
1584 const std::vector<SCH_SYMBOL_INSTANCE>& aSymbolInstances )
1592 wxCHECK2( symbol,
continue );
1595 sheetPathWithSymbolUuid.push_back( symbol->
m_Uuid );
1597 auto it = std::find_if( aSymbolInstances.begin(), aSymbolInstances.end(),
1600 return sheetPathWithSymbolUuid == r.m_Path;
1603 if( it == aSymbolInstances.end() )
1606 sheetPathWithSymbolUuid.
AsString() );
1615 if( !it->m_Value.IsEmpty() )
1618 if( !it->m_Footprint.IsEmpty() )
1634 wxCHECK2( sheet &&
path.Last(),
continue );
1636 auto it = std::find_if( aSheetInstances.begin(), aSheetInstances.end(),
1639 return path.Path() == r.m_Path;
1642 if( it == aSheetInstances.end() )
1645 path.Path().AsString() );
1650 ( sheet->
GetName().IsEmpty() ) ? wxString( wxT(
"root" ) ) : sheet->
GetName(),
1651 path.Path().AsString(), it->m_PageNumber );
1652 path.SetPageNumber( it->m_PageNumber );
1659 std::vector<KIID_PATH> paths;
1662 paths.emplace_back( sheetPath.
Path() );
1670 std::vector<SCH_SHEET_INSTANCE> retval;
1676 wxCHECK2( sheet,
continue );
1685 retval.push_back( std::move( instance ) );
1717 tmp.Printf(
"%d", pageNumber );
1732 std::set<wxString> reservedPageIds;
1741 if( !pageNumber.IsEmpty() )
1742 reservedPageIds.insert( pageNumber );
1745 std::set<wxString> assignedPageIds;
1746 bool modified =
false;
1757 if( !pageNumber.IsEmpty() && assignedPageIds.insert( pageNumber ).second )
1760 wxString pageStr = wxString::Format( wxT(
"%ld" ), nextPage );
1762 while( reservedPageIds.count( pageStr ) || assignedPageIds.count( pageStr ) )
1765 pageStr = wxString::Format( wxT(
"%ld" ), nextPage );
1769 assignedPageIds.insert( pageStr );
1779 const wxString& aProjectName )
1794 int aLastVirtualPageNumber )
1796 wxString pageNumber;
1797 int lastUsedPageNumber = 1;
1798 int nextVirtualPageNumber = aLastVirtualPageNumber;
1801 std::vector< wxString > usedPageNumbers;
1803 if( aPrefixSheetPath.
size() )
1809 pageNumber =
path.GetPageNumber();
1811 if( !pageNumber.IsEmpty() )
1812 usedPageNumbers.emplace_back( pageNumber );
1822 newSheetPath = newSheetPath + sheetPath;
1829 wxCHECK2( sheet,
continue );
1831 nextVirtualPageNumber += 1;
1848 pageNumber.Printf( wxT(
"%d" ), lastUsedPageNumber );
1849 lastUsedPageNumber += 1;
1850 }
while( std::find( usedPageNumbers.begin(), usedPageNumbers.end(), pageNumber ) !=
1851 usedPageNumbers.end() );
1866 "SCH_SHEET_LIST::CheckForMissingSymbolInstances: Processing %zu sheet paths",
1872 " Processing sheet path: '%s' (size=%zu, KIID_PATH='%s')",
1883 int lastVirtualPageNumber = 1;
1891 return lastVirtualPageNumber;
1899 if(
path.Path() == aPath )
1911 for(
size_t i = 0; i <
path.size(); i++ )
1913 if(
path.at( i ) == aSheet )
1926 return std::nullopt;
1930 if(
path.LastScreen() == aScreen )
1931 return std::optional<SCH_SHEET_PATH>(
path );
1934 return std::nullopt;
bool IsContentModified() const
void SetContentModified(bool aModified=true)
wxString GetClass() const override
Return the class name.
void SetPosition(const VECTOR2I &) override
static DELETED_SHEET_ITEM * GetInstance()
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
bool operator==(const SCH_ITEM &aOther) const override
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
KICAD_T Type() const
Returns the type of object.
virtual void UpdateHatching() const
virtual bool IsVisible() const
virtual void SetVisible(bool aVisible)
EE_TYPE OfType(KICAD_T aType) const
wxString AsString() const
wxString AsString() const
Define a library symbol object.
bool IsPower() const override
int GetUnitCount() const override
bool m_IntersheetRefsShow
Holds all the data relating to one schematic.
wxString GetFileName() const
Helper to retrieve the filename from the root sheet screen.
SCHEMATIC_SETTINGS & Settings() const
std::vector< SCH_SHEET * > GetTopLevelSheets() const
Get the list of top-level sheets.
VECTOR2I GetPosition() const override
virtual const wxString & GetText() const override
Return the string associated with the text object.
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0, const wxString &aVariantName=wxEmptyString) const
void SetText(const wxString &aText) override
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this label.
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode)
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
virtual void SetUnit(int aUnit)
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo) override
std::vector< SCH_FIELD > & GetFields()
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
void SplitReferences()
Attempt to split all reference designators into a name (U) and number (1).
void AddItem(const SCH_REFERENCE &aItem)
A helper to define a symbol's reference designator in a schematic.
void SetRef(const wxString &aReference)
void SetSheetNumber(int aSheetNumber)
EE_RTREE & Items()
Get the full RTree, usually for iterating.
const wxString & GetFileName() const
SCHEMATIC * Schematic() const
void Update(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Update aItem's bounding box in the tree.
void GetSheets(std::vector< SCH_ITEM * > *aItems) const
Similar to Items().OfType( SCH_SHEET_T ), but return the sheets in a deterministic order (L-R,...
std::optional< SCH_SHEET_PATH > GetSheetPathByKIIDPath(const KIID_PATH &aPath, bool aIncludeLastSheet=true) const
Finds a SCH_SHEET_PATH that matches the provided KIID_PATH.
SCH_ITEM * ResolveItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr, bool aAllowNullptrReturn=false) const
Fetch a SCH_ITEM by ID.
std::optional< SCH_SHEET_PATH > GetOrdinalPath(const SCH_SCREEN *aScreen) const
Return the ordinal sheet path of aScreen.
void FillItemMap(std::map< KIID, EDA_ITEM * > &aMap)
Fill an item cache for temporary use when many items need to be fetched.
SCH_SHEET_PATH m_currentSheetPath
void TrimToPageNumbers(const std::vector< wxString > &aPageInclusions)
Truncates the list by removing sheet's with page numbers not in the given list.
void SortByPageNumbers(bool aUpdateVirtualPageNums=true)
Sort the list of sheets by page number.
void AddNewSymbolInstances(const SCH_SHEET_PATH &aPrefixSheetPath, const wxString &aProjectName)
Attempt to add new symbol instances for all symbols in this list of sheet paths prefixed with aPrefix...
bool NameExists(const wxString &aSheetName) const
void GetSymbolsWithinPath(SCH_REFERENCE_LIST &aReferences, const SCH_SHEET_PATH &aSheetPath, SYMBOL_FILTER aSymbolFilter, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets that are contained wi...
std::vector< SCH_SHEET_INSTANCE > GetSheetInstances() const
Fetch the instance information for all of the sheets in the hierarchy.
void UpdateSheetInstanceData(const std::vector< SCH_SHEET_INSTANCE > &aSheetInstances)
Update all of the sheet instance information using aSheetInstances.
void SetInitialPageNumbers()
Set initial sheet page numbers.
void RemoveSymbolInstances(const SCH_SHEET_PATH &aPrefixSheetPath)
SCH_SHEET_LIST FindAllSheetsForScreen(const SCH_SCREEN *aScreen) const
Return a SCH_SHEET_LIST with a copy of all the SCH_SHEET_PATH using a particular screen.
wxString GetNextPageNumber() const
bool AllSheetPageNumbersEmpty() const
Check all of the sheet instance for empty page numbers.
bool IsModified() const
Check the entire hierarchy for any modifications.
SCH_SHEET_LIST(SCH_SHEET *aSheet=nullptr)
Construct a flattened list of SCH_SHEET_PATH objects from aSheet.
void AnnotatePowerSymbols()
Silently annotate the not yet annotated power symbols of the entire hierarchy of the sheet path list.
int GetLastVirtualPageNumber() const
void UpdateSymbolInstanceData(const std::vector< SCH_SYMBOL_INSTANCE > &aSymbolInstances)
Update all of the symbol instance information using aSymbolInstances.
void GetSheetsWithinPath(std::vector< SCH_SHEET_PATH > &aSheets, const SCH_SHEET_PATH &aSheetPath) const
Add a SCH_SHEET_PATH object to aSheets for each sheet in the list that are contained within aSheetPat...
bool PageNumberExists(const wxString &aPageNumber) const
void SortByHierarchicalPageNumbers(bool aUpdateVirtualPageNums=true)
This works like SortByPageNumbers, but it sorts the sheets first by their hierarchical depth and then...
void AddNewSheetInstances(const SCH_SHEET_PATH &aPrefixSheetPath, int aLastVirtualPageNumber)
void GetMultiUnitSymbols(SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, SYMBOL_FILTER aSymbolFilter) const
Add a SCH_REFERENCE_LIST object to aRefList for each same-reference set of multi-unit parts in the li...
bool ContainsSheet(const SCH_SHEET *aSheet) const
bool RepairPageNumbers()
Assign valid page numbers to sheet paths whose stored page number is missing or collides with an earl...
std::vector< KIID_PATH > GetPaths() const
void BuildSheetList(SCH_SHEET *aSheet, bool aCheckIntegrity)
Build the list of sheets and their sheet path from aSheet.
SCH_SHEET_PATH FindSheetForScreen(const SCH_SCREEN *aScreen)
Return the first SCH_SHEET_PATH object (not necessarily the only one) using a particular screen.
void CheckForMissingSymbolInstances(const wxString &aProjectName)
bool HasPath(const KIID_PATH &aPath) const
SCH_SHEET_PATH * FindSheetForPath(const SCH_SHEET_PATH *aPath)
Return a pointer to the first SCH_SHEET_PATH object (not necessarily the only one) matching the provi...
void GetSymbols(SCH_REFERENCE_LIST &aReferences, SYMBOL_FILTER aSymbolFilter, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets.
bool TestForRecursion(const SCH_SHEET_LIST &aSrcSheetHierarchy, const wxString &aDestFileName)
Test every SCH_SHEET_PATH in this SCH_SHEET_LIST to verify if adding the sheets stored in aSrcSheetHi...
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void AppendSymbol(SCH_REFERENCE_LIST &aReferences, SCH_SYMBOL *aSymbol, SYMBOL_FILTER aSymbolFilter, bool aForceIncludeOrphanSymbols=false) const
Append a SCH_REFERENCE object to aReferences based on aSymbol.
bool IsSharedPath() const
Determine if this sheet path is shared in a complex hierarchy.
bool GetExcludedFromBOM() const
const SCH_SHEET * GetSheet(unsigned aIndex) const
bool empty() const
Forwarded method from std::vector.
int ComparePageNum(const SCH_SHEET_PATH &aSheetPathToTest) const
Compare sheets by their page number.
size_t GetCurrentHash() const
void GetMultiUnitSymbols(SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, SYMBOL_FILTER aSymbolFilter) const
Add a SCH_REFERENCE_LIST object to aRefList for each same-reference set of multi-unit parts in the sh...
void GetSymbols(SCH_REFERENCE_LIST &aReferences, SYMBOL_FILTER aSymbolFilter, bool aForceIncludeOrphanSymbols=false) const
Adds SCH_REFERENCE object to aReferences for each symbol in the sheet.
bool operator==(const SCH_SHEET_PATH &d1) const
void AddNewSymbolInstances(const SCH_SHEET_PATH &aPrefixSheetPath, const wxString &aProjectName)
Attempt to add new symbol instances for all symbols in this sheet path prefixed with aPrefixSheetPath...
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
bool TestForRecursion(const wxString &aSrcFileName, const wxString &aDestFileName)
Test the SCH_SHEET_PATH file names to check adding the sheet stored in the file aSrcFileName to the s...
void UpdateAllScreenReferences() const
Update all the symbol references for this sheet path.
void MakeFilePathRelativeToParentSheet()
Make the sheet file name relative to its parent sheet.
SCH_ITEM * ResolveItem(const KIID &aID) const
Fetch a SCH_ITEM by ID.
wxString GetCachedPageNumber() const
std::vector< SCH_SHEET * > m_sheets
SCH_SCREEN * LastScreen()
int Cmp(const SCH_SHEET_PATH &aSheetPathToTest) const
Compare if this is the same sheet path as aSheetPathToTest.
void initFromOther(const SCH_SHEET_PATH &aOther)
wxString m_cached_page_number
wxString GetPageNumber() const
void RemoveSymbolInstances(const SCH_SHEET_PATH &aPrefixSheetPath)
void CheckForMissingSymbolInstances(const wxString &aProjectName)
bool IsContainedWithin(const SCH_SHEET_PATH &aSheetPathToTest) const
Check if this path is contained inside aSheetPathToTest.
SCH_SHEET * at(size_t aIndex) const
Forwarded method from std::vector.
void SetVirtualPageNumber(int aPageNumber)
Set the sheet instance virtual page number.
wxString PathHumanReadable(bool aUseShortRootName=true, bool aStripTrailingSeparator=false, bool aEscapeSheetNames=false) const
Return the sheet path in a human readable form made from the sheet names.
std::map< std::pair< wxString, wxString >, bool > m_recursion_test_cache
bool GetExcludedFromSim() const
wxString PathAsString() const
Return the path of time stamps which do not changes even when editing sheet parameters.
void AppendMultiUnitSymbol(SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, SCH_SYMBOL *aSymbol, SYMBOL_FILTER aSymbolFilter) const
Append a SCH_REFERENCE_LIST object to aRefList based on aSymbol, storing same-reference set of multi-...
bool GetExcludedFromBoard() const
void SetPageNumber(const wxString &aPageNumber)
Set the sheet instance user definable page number.
SCH_SHEET_PATH & operator=(const SCH_SHEET_PATH &aOther)
int GetPageNumberAsInt() const
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
SCH_SHEET_PATH operator+(const SCH_SHEET_PATH &aOther)
int m_virtualPageNumber
Page numbers are maintained by the sheet load order.
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
size_t size() const
Forwarded method from std::vector.
int GetVirtualPageNumber() const
void pop_back()
Forwarded method from std::vector.
void InitializeAttributes(const SCH_SHEET &aSheet)
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void SetFileName(const wxString &aFilename)
wxString GetFileName() const
Return the filename corresponding to this sheet.
bool getInstance(SCH_SHEET_INSTANCE &aInstance, const KIID_PATH &aSheetPath, bool aTestFromEnd=false) const
bool addInstance(const KIID_PATH &aInstance)
Add a new instance aSheetPath to the instance list.
wxString getPageNumber(const KIID_PATH &aParentPath) const
Return the sheet page number for aParentPath.
bool IsTopLevelSheet() const
Check if this sheet is a top-level sheet.
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this sheet.
bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
SCH_SCREEN * GetScreen() const
static int ComparePageNum(const wxString &aPageNumberA, const wxString &aPageNumberB)
Compare page numbers of schematic sheets.
void setPageNumber(const KIID_PATH &aInstance, const wxString &aPageNumber)
Set the page number for the sheet instance aInstance.
bool IsVirtualRootSheet() const
bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
Set or clear the 'Do Not Populate' flags.
bool GetExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
PIN_MAP_INSTANCE_OVERRIDE m_PinMapOverride
Per-instance pin-to-pad map override for this variant (issue #2282).
void InitializeAttributes(const SCH_SYMBOL &aSymbol)
void UpdatePrefix()
Set the prefix based on the current reference designator.
bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
const std::vector< SCH_SYMBOL_INSTANCE > & GetInstances() const
void RemoveInstance(const SCH_SHEET_PATH &aInstancePath)
PIN_MAP_INSTANCE_OVERRIDE GetPinMapOverride(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
void SetFootprintFieldText(const wxString &aFootprint)
void AddHierarchicalReference(const KIID_PATH &aPath, const wxString &aRef, int aUnit)
Add a full hierarchical reference to this symbol.
void SetValueFieldText(const wxString &aValue, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
bool GetExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
bool GetInstance(SCH_SYMBOL_INSTANCE &aInstance, const KIID_PATH &aSheetPath, bool aTestFromEnd=false) const
bool GetExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
virtual bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
Set or clear the 'Do Not Populate' flag.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
bool m_ExcludedFromPosFiles
static bool empty(const wxTextEntryBase *aCtrl)
const wxChar *const tracePathsAndFiles
Flag to enable path and file name debug output.
const wxChar *const traceSchSheetPaths
Flag to enable debug output of schematic symbol sheet path manipulation code.
static constexpr void hash_combine(std::size_t &seed)
This is a dummy function to take the final case of hash_combine below.
Collection of utility functions for component reference designators (refdes)
static bool matchesSymbolFilter(const wxString &aReference, SYMBOL_FILTER aSymbolFilter)
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
std::map< wxString, SCH_REFERENCE_LIST > SCH_MULTI_UNIT_REFERENCE_MAP
Container to map reference designators for multi-unit parts.
@ SYMBOL_FILTER_NON_POWER
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
A simple container for sheet instance information.
A simple container for schematic symbol instance information.
std::map< wxString, SCH_SYMBOL_VARIANT > m_Variants
A list of symbol variants.
size_t operator()(const SCH_SHEET_PATH &path) const
@ INTERSHEET_REFS
Global label cross-reference page numbers.
@ REFERENCE
Field Reference of part, i.e. "IC21".
table push_back({ "Source", "Layer", "Vertices", "Strategy", "Build(us)", "ns/query", "Mquery/s", "Inside" })
wxLogTrace helper definitions.
@ NOT_USED
the 3d code uses this value
VECTOR2< int32_t > VECTOR2I