KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SCH_SHEET_PATH Class Reference

Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened schematic hierarchy. More...

#include <sch_sheet_path.h>

Public Member Functions

 SCH_SHEET_PATH ()
 
 SCH_SHEET_PATH (const SCH_SHEET_PATH &aOther)
 
SCH_SHEET_PATHoperator= (const SCH_SHEET_PATH &aOther)
 
SCH_SHEET_PATH operator+ (const SCH_SHEET_PATH &aOther)
 
 ~SCH_SHEET_PATH ()=default
 
SCH_SHEETat (size_t aIndex) const
 Forwarded method from std::vector.
 
void clear ()
 Forwarded method from std::vector.
 
bool empty () const
 Forwarded method from std::vector.
 
void pop_back ()
 Forwarded method from std::vector.
 
void push_back (SCH_SHEET *aSheet)
 Forwarded method from std::vector.
 
size_t size () const
 Forwarded method from std::vector.
 
std::vector< SCH_SHEET * >::iterator erase (std::vector< SCH_SHEET * >::const_iterator aPosition)
 
void Rehash ()
 
size_t GetCurrentHash () const
 
void SetVirtualPageNumber (int aPageNumber)
 Set the sheet instance virtual page number.
 
int GetVirtualPageNumber () const
 
void SetPageNumber (const wxString &aPageNumber)
 Set the sheet instance user definable page number.
 
wxString GetPageNumber () const
 
const SCH_SHEETGetSheet (unsigned aIndex) const
 
bool IsFullPath () const
 
int Cmp (const SCH_SHEET_PATH &aSheetPathToTest) const
 Compare if this is the same sheet path as aSheetPathToTest.
 
int ComparePageNum (const SCH_SHEET_PATH &aSheetPathToTest) const
 Compare sheets by their page number.
 
bool IsContainedWithin (const SCH_SHEET_PATH &aSheetPathToTest) const
 Check if this path is contained inside aSheetPathToTest.
 
SCH_SHEETLast () const
 Return a pointer to the last SCH_SHEET of the list.
 
SCH_SCREENLastScreen ()
 
SCH_SCREENLastScreen () const
 
SCH_ITEMGetItem (const KIID &aID) const
 Fetch a SCH_ITEM by ID.
 
wxString PathAsString () const
 Return the path of time stamps which do not changes even when editing sheet parameters.
 
KIID_PATH Path () const
 Get the sheet path as an KIID_PATH.
 
wxString PathHumanReadable (bool aUseShortRootName=true, bool aStripTrailingSeparator=false) const
 Return the sheet path in a human readable form made from the sheet names.
 
void UpdateAllScreenReferences () const
 Update all the symbol references for this sheet path.
 
void AppendSymbol (SCH_REFERENCE_LIST &aReferences, SCH_SYMBOL *aSymbol, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
 Append a SCH_REFERENCE object to aReferences based on aSymbol.
 
void GetSymbols (SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
 Adds SCH_REFERENCE object to aReferences for each symbol in the sheet.
 
void AppendMultiUnitSymbol (SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, SCH_SYMBOL *aSymbol, bool aIncludePowerSymbols=true) const
 Append a SCH_REFERENCE_LIST object to aRefList based on aSymbol, storing same-reference set of multi-unit parts together.
 
void GetMultiUnitSymbols (SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, bool aIncludePowerSymbols=true) const
 Add a SCH_REFERENCE_LIST object to aRefList for each same-reference set of multi-unit parts in the sheet.
 
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 sheet stored in file aDestFileName will cause a sheet path recursion.
 
void MakeFilePathRelativeToParentSheet ()
 Make the sheet file name relative to its parent sheet.
 
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.
 
void RemoveSymbolInstances (const SCH_SHEET_PATH &aPrefixSheetPath)
 
bool operator== (const SCH_SHEET_PATH &d1) const
 
bool operator!= (const SCH_SHEET_PATH &d1) const
 
bool operator< (const SCH_SHEET_PATH &d1) const
 

Protected Attributes

std::vector< SCH_SHEET * > m_sheets
 
size_t m_current_hash
 
int m_virtualPageNumber
 
std::map< std::pair< wxString, wxString >, bool > m_recursion_test_cache
 Page numbers are maintained by the sheet load order.
 

Private Member Functions

void initFromOther (const SCH_SHEET_PATH &aOther)
 

Detailed Description

Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened schematic hierarchy.

The SCH_SHEET objects are stored in a list from first (usually the root sheet) to a given sheet in last position. The last sheet is usually the sheet we want to select or reach (which is what the function Last() returns). Others sheets constitute the "path" from the first to the last sheet.

Definition at line 136 of file sch_sheet_path.h.

Constructor & Destructor Documentation

◆ SCH_SHEET_PATH() [1/2]

SCH_SHEET_PATH::SCH_SHEET_PATH ( )

Definition at line 106 of file sch_sheet_path.cpp.

References m_current_hash, and m_virtualPageNumber.

◆ SCH_SHEET_PATH() [2/2]

SCH_SHEET_PATH::SCH_SHEET_PATH ( const SCH_SHEET_PATH aOther)

Definition at line 113 of file sch_sheet_path.cpp.

References initFromOther().

◆ ~SCH_SHEET_PATH()

SCH_SHEET_PATH::~SCH_SHEET_PATH ( )
default

Member Function Documentation

◆ AddNewSymbolInstances()

void SCH_SHEET_PATH::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.

The new symbol instance data will be assigned by the following criteria:

  • If the instance data can be found for this sheet path, use the instance data.
  • If the instance data cannot be found for this sheet path and the instance data cache for the symbol is not empty, use the first instance data in the cache.
  • If the cache is empty and the library symbol link is valid, set the instance data from the library symbol.
  • If all else fails, set the reference to "U?", the unit to 1, and everything else to an empty string.
Parameters
aPrefixSheetPathis the sheet path to prefix to this sheet path for the new symbol instance.
aProjectNameis the name of the project for the new symbol instance data.

Definition at line 554 of file sch_sheet_path.cpp.

References SCH_SYMBOL::AddHierarchicalReference(), SCH_SYMBOL::GetField(), SCH_SYMBOL::GetInstance(), SCH_SYMBOL::GetInstances(), EDA_TEXT::GetText(), SCH_ITEM::GetUnit(), LastScreen(), SCH_SYMBOL_INSTANCE::m_Path, SCH_SYMBOL_INSTANCE::m_ProjectName, SCH_SYMBOL_INSTANCE::m_Reference, SCH_SYMBOL_INSTANCE::m_Unit, Path(), REFERENCE_FIELD, and SCH_SYMBOL_T.

Referenced by SCH_SHEET_LIST::AddNewSymbolInstances().

◆ AppendMultiUnitSymbol()

void SCH_SHEET_PATH::AppendMultiUnitSymbol ( SCH_MULTI_UNIT_REFERENCE_MAP aRefList,
SCH_SYMBOL aSymbol,
bool  aIncludePowerSymbols = true 
) const

Append a SCH_REFERENCE_LIST object to aRefList based on aSymbol, storing same-reference set of multi-unit parts together.

The map key for each element will be the reference designator.

Parameters
aRefListMap of reference designators to reference lists
aSymbolA symbol to add to aRefList
aIncludePowerSymbolsSet to false to only get normal symbols.

Definition at line 413 of file sch_sheet_path.cpp.

References SCH_SYMBOL::GetLibSymbolRef(), SCH_REFERENCE::GetRef(), SCH_SYMBOL::GetRef(), LIB_SYMBOL::GetUnitCount(), m_virtualPageNumber, and SCH_REFERENCE::SetSheetNumber().

Referenced by SCH_EDIT_FRAME::AnnotateSymbols(), GetMultiUnitSymbols(), and TEST_SCH_REFERENCE_LIST_FIXTURE::loadTestCase().

◆ AppendSymbol()

void SCH_SHEET_PATH::AppendSymbol ( SCH_REFERENCE_LIST aReferences,
SCH_SYMBOL aSymbol,
bool  aIncludePowerSymbols = true,
bool  aForceIncludeOrphanSymbols = false 
) const

Append a SCH_REFERENCE object to aReferences based on aSymbol.

Parameters
aReferencesList of references to populate.
aSymbolA symbol to add to aReferences
aIncludePowerSymbolsset to false to only get normal symbols.
aForceIncludeOrphanSymbolsset to true to include symbols having no symbol found in lib. The normal option is false, and set to true only to build the full list of symbols.

Definition at line 381 of file sch_sheet_path.cpp.

References SCH_REFERENCE_LIST::AddItem(), SCH_SYMBOL::GetLibSymbolRef(), SCH_SYMBOL::GetRef(), m_virtualPageNumber, and SCH_REFERENCE::SetSheetNumber().

Referenced by SCH_EDIT_FRAME::AnnotateSymbols(), SCH_EDIT_FRAME::CheckAnnotate(), GetSymbols(), and TEST_SCH_REFERENCE_LIST_FIXTURE::loadTestCase().

◆ at()

◆ clear()

void SCH_SHEET_PATH::clear ( )
inline

Forwarded method from std::vector.

Definition at line 153 of file sch_sheet_path.h.

References m_sheets, and Rehash().

Referenced by SCH_EDIT_FRAME::doCloseWindow(), SCHEMATIC::Reset(), SCHEMATIC::SetRoot(), and HIERARCHY_PANE::UpdateHierarchyTree().

◆ Cmp()

int SCH_SHEET_PATH::Cmp ( const SCH_SHEET_PATH aSheetPathToTest) const

Compare if this is the same sheet path as aSheetPathToTest.

Parameters
aSheetPathToTestis the sheet path to compare.
Returns
1 if this sheet path has more sheets than aSheetPathToTest, -1 if this sheet path has fewer sheets than aSheetPathToTest, or 0 if same

Definition at line 166 of file sch_sheet_path.cpp.

References at(), EDA_ITEM::m_Uuid, and size().

Referenced by HIERARCHY_PANE::renameIdenticalSheets(), HIERARCHY_PANE::setIdenticalSheetsHighlighted(), and SCH_REFERENCE_LIST::sortByTimeStamp().

◆ ComparePageNum()

int SCH_SHEET_PATH::ComparePageNum ( const SCH_SHEET_PATH aSheetPathToTest) const

Compare sheets by their page number.

If the actual page number is equal, use virtual page numbers to compare.

Returns
-1 if aSheetPathToTest is greater than this (should appear later in the sort order) 0 if aSheetPathToTest is equal to this 1 if aSheetPathToTest is less than this (should appear earlier in the sort order)

Definition at line 188 of file sch_sheet_path.cpp.

References SCH_SHEET::ComparePageNum(), GetPageNumber(), and GetVirtualPageNumber().

Referenced by HIERARCHY_TREE::OnCompareItems(), and SCH_SHEET_LIST::SortByPageNumbers().

◆ empty()

bool SCH_SHEET_PATH::empty ( ) const
inline

Forwarded method from std::vector.

Definition at line 160 of file sch_sheet_path.h.

References m_sheets.

Referenced by SCH_SHEET::findSelf(), Last(), SCH_IO_KICAD_SEXPR::loadHierarchy(), DIALOG_ERC::OnERCItemSelected(), and PathHumanReadable().

◆ erase()

std::vector< SCH_SHEET * >::iterator SCH_SHEET_PATH::erase ( std::vector< SCH_SHEET * >::const_iterator  aPosition)
inline

Definition at line 179 of file sch_sheet_path.h.

References m_sheets.

◆ GetCurrentHash()

size_t SCH_SHEET_PATH::GetCurrentHash ( ) const
inline

◆ GetItem()

SCH_ITEM * SCH_SHEET_PATH::GetItem ( const KIID aID) const

◆ GetMultiUnitSymbols()

void SCH_SHEET_PATH::GetMultiUnitSymbols ( SCH_MULTI_UNIT_REFERENCE_MAP aRefList,
bool  aIncludePowerSymbols = true 
) const

Add a SCH_REFERENCE_LIST object to aRefList for each same-reference set of multi-unit parts in the sheet.

The map key for each element will be the reference designator.

Parameters
aRefListMap of reference designators to reference lists
aIncludePowerSymbolsSet to false to only get normal symbols.

Definition at line 402 of file sch_sheet_path.cpp.

References AppendMultiUnitSymbol(), LastScreen(), and SCH_SYMBOL_T.

Referenced by SCH_EDIT_FRAME::AnnotateSymbols().

◆ GetPageNumber()

◆ GetSheet()

◆ GetSymbols()

void SCH_SHEET_PATH::GetSymbols ( SCH_REFERENCE_LIST aReferences,
bool  aIncludePowerSymbols = true,
bool  aForceIncludeOrphanSymbols = false 
) const

Adds SCH_REFERENCE object to aReferences for each symbol in the sheet.

Parameters
aReferencesList of references to populate.
aIncludePowerSymbolsset to false to only get normal symbols.
aForceIncludeOrphanSymbolsset to true to include symbols having no symbol found in lib. The normal option is false, and set to true only to build the full list of symbols.

Definition at line 370 of file sch_sheet_path.cpp.

References AppendSymbol(), LastScreen(), and SCH_SYMBOL_T.

Referenced by SCH_EDIT_FRAME::AnnotateSymbols(), SCH_EDIT_FRAME::CheckAnnotate(), CollectOtherUnits(), findSymbolsAndPins(), SCH_SHEET_LIST::GetSymbols(), SCH_SHEET_LIST::GetSymbolsWithinPath(), sheetContainsOnlyWantedItems(), and SCH_EDITOR_CONTROL::updatePastedSheet().

◆ GetVirtualPageNumber()

◆ initFromOther()

void SCH_SHEET_PATH::initFromOther ( const SCH_SHEET_PATH aOther)
private

Definition at line 139 of file sch_sheet_path.cpp.

References m_current_hash, m_sheets, and m_virtualPageNumber.

Referenced by operator=(), and SCH_SHEET_PATH().

◆ IsContainedWithin()

bool SCH_SHEET_PATH::IsContainedWithin ( const SCH_SHEET_PATH aSheetPathToTest) const

Check if this path is contained inside aSheetPathToTest.

Parameters
aSheetPathToTestis the sheet path to compare against.
Returns
true if this path is contained inside or equal to aSheetPathToTest.

Definition at line 210 of file sch_sheet_path.cpp.

References KIID_PATH::AsString(), at(), EDA_ITEM::m_Uuid, Path(), size(), and traceSchSheetPaths.

Referenced by findSymbolsAndPins(), SCH_SHEET_LIST::GetSheetsWithinPath(), SCH_SHEET_LIST::GetSymbolsWithinPath(), FIELDS_EDITOR_GRID_DATA_MODEL::RebuildRows(), and sheetContainsOnlyWantedItems().

◆ IsFullPath()

bool SCH_SHEET_PATH::IsFullPath ( ) const

◆ Last()

SCH_SHEET * SCH_SHEET_PATH::Last ( ) const

Return a pointer to the last SCH_SHEET of the list.

One can see the others sheet as the "path" to reach this last sheet.

Definition at line 233 of file sch_sheet_path.cpp.

References empty(), and m_sheets.

Referenced by SCH_SHEET::addInstance(), SCH_NAVIGATE_TOOL::CanGoUp(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_EDIT_TOOL::EditPageNumber(), SCH_SHEET::findSelf(), DIALOG_TABLE_PROPERTIES::getContextualTextVars(), DIALOG_TEXT_PROPERTIES::getContextualTextVars(), SCH_SHEET::GetContextualTextVars(), SCH_IO_EAGLE::getCurrentScreen(), SCH_IO_ALTIUM::getCurrentSheet(), SCH_IO_EAGLE::getCurrentSheet(), GetPageNumber(), SCH_SHEET::getPageNumber(), SCH_EDIT_FRAME::GetScreenDesc(), NETLIST_EXPORTER_SPICE::GetSheets(), SCH_TEXT::GetShownText(), SCH_TEXTBOX::GetShownText(), EE_SELECTION_TOOL::Init(), SCH_DRAWING_TOOLS::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), LastScreen(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(), MakeFilePathRelativeToParentSheet(), SCH_EDIT_FRAME::MakeNetNavigatorNode(), NETLIST_EXPORTER_XML::makeSymbols(), SCH_SHEET_LIST::NameExists(), HIERARCHY_PANE::onRightClick(), SCH_FIELD::OnScintillaCharAdded(), HIERARCHY_PANE::onTreeEditFinished(), SCH_IO_ALTIUM::ParseComponent(), SCH_IO_ALTIUM::ParseTemplate(), SCH_EDITOR_CONTROL::Paste(), SCH_PLOTTER::plotOneSheetDXF(), SCH_PLOTTER::plotOneSheetHpgl(), SCH_PLOTTER::plotOneSheetPDF(), SCH_PLOTTER::plotOneSheetPS(), SCH_PLOTTER::plotOneSheetSVG(), HIERARCHY_PANE::renameIdenticalSheets(), SCH_LABEL_BASE::ResolveTextVar(), SCH_SYMBOL::ResolveTextVar(), SCHEMATIC::ResolveTextVar(), SCH_EDITOR_CONTROL::Revert(), SCH_EDITOR_CONTROL::SaveCurrSheetCopyAs(), HIERARCHY_PANE::setIdenticalSheetsHighlighted(), SCH_SHEET::setPageNumber(), SetPageNumber(), CONNECTION_GRAPH::updateItemConnectivity(), and HIERARCHY_PANE::UpdateLabelsHierarchyTree().

◆ LastScreen() [1/2]

SCH_SCREEN * SCH_SHEET_PATH::LastScreen ( )
Returns
the SCH_SCREEN relative to the last sheet in list.
the SCH_SCREEN relative to the last sheet in list.

Definition at line 242 of file sch_sheet_path.cpp.

References SCH_SHEET::GetScreen(), and Last().

Referenced by AddNewSymbolInstances(), SCH_SHEET_LIST::AnnotatePowerSymbols(), SCH_EDIT_FRAME::AnnotateSymbols(), BACK_ANNOTATE::applyChangelist(), SCH_EDITOR_CONTROL::AssignNetclass(), HIERARCHY_PANE::buildHierarchyTree(), SCH_SHEET_LIST::BuildSheetList(), SCH_EDIT_FRAME::CheckAnnotate(), SCH_EDIT_FRAME::CheckSheetForRecursion(), SCH_SHEET_LIST::ClearModifyStatus(), SCH_EDIT_FRAME::CommonSettingsChanged(), SCH_IO_LTSPICE_PARSER::CreateArc(), SCH_IO_LTSPICE_PARSER::CreateBusEntry(), SCH_IO_LTSPICE_PARSER::CreateCircle(), SCH_PLOTTER::createDXFFiles(), SCH_PLOTTER::createHPGLFiles(), SCH_IO_LTSPICE_PARSER::CreateKicadSCH_ITEMs(), SCH_IO_LTSPICE_PARSER::CreateKicadSYMBOLs(), SCH_IO_LTSPICE_PARSER::CreateLine(), SCH_IO_LTSPICE_PARSER::CreateLines(), SCH_PLOTTER::createPDFFile(), SCH_IO_LTSPICE_PARSER::CreatePin(), SCH_PLOTTER::createPSFiles(), SCH_IO_LTSPICE_PARSER::CreateRect(), SCH_PLOTTER::createSVGFiles(), SCH_IO_LTSPICE_PARSER::CreateWire(), SCH_IO_LTSPICE_PARSER::CreateWires(), SCH_EDIT_FRAME::DeleteAnnotation(), SCH_EDIT_FRAME::DisplayCurrentSheet(), SCH_DRAWING_TOOLS::doSyncSheetsPins(), SCH_EDIT_TOOL::EditPageNumber(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckFloatingWires(), CONNECTION_GRAPH::ercCheckLabels(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), CONNECTION_GRAPH::ercCheckNoConnects(), CONNECTION_GRAPH::ercCheckSingleGlobalLabel(), NETLIST_EXPORTER_ALLEGRO::extractComponentsInfo(), SCH_SHEET_LIST::FillItemMap(), SCH_SHEET_LIST::FindAllSheetsForScreen(), findItemsFromSyncSelection(), NETLIST_EXPORTER_BASE::findNextSymbol(), SCH_SHEET_LIST::FindSheetForScreen(), SCHEMATIC::GetContextualTextVars(), SCH_IO_ALTIUM::getCurrentScreen(), GetItem(), GetMultiUnitSymbols(), SCH_EDIT_FRAME::GetScreen(), GetSymbols(), SCH_EDIT_FRAME::HardRedraw(), DIALOG_EDIT_SYMBOLS_LIBID::initDlg(), SCH_SHEET_LIST::IsModified(), SCH_IO_KICAD_SEXPR::loadHierarchy(), MakeFilePathRelativeToParentSheet(), NETLIST_EXPORTER_XML::makeSymbols(), SCH_EDIT_FRAME::onNetNavigatorSelection(), SCH_PRINTOUT::OnPrintPage(), HIERARCHY_PANE::onRightClick(), DIALOG_ERC::OnRunERCClick(), DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged(), SCH_IO_LTSPICE_PARSER::Parse(), SCH_EDITOR_CONTROL::Paste(), SCH_DRAWING_TOOLS::PlaceSymbol(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BACK_ANNOTATE::processNetNameChange(), SCHEMATIC::RecomputeIntersheetRefs(), RemoveSymbolInstances(), SCH_FIND_REPLACE_TOOL::ReplaceAndFindNext(), RESCUER::RESCUER(), SCHEMATIC::ResolveERCExclusionsPostUpdate(), SCHEMATIC::ResolveTextVar(), SCH_EDIT_FRAME::SetCurrentSheet(), SCHEMATIC::SetSheetNumberAndCount(), TestForRecursion(), ERC_TESTER::TestMissingNetclasses(), ERC_TESTER::TestMissingUnits(), ERC_TESTER::TestMultiunitFootprints(), ERC_TESTER::TestMultUnitPinConflicts(), ERC_TESTER::TestPinToPin(), ERC_TESTER::TestSimilarLabels(), DIALOG_SHEET_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_FIELDS_TABLE::TransferDataFromWindow(), SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires(), UpdateAllScreenReferences(), CONNECTION_GRAPH::updateItemConnectivity(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), SCH_SHEET_LIST::UpdateSymbolInstanceData(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().

◆ LastScreen() [2/2]

SCH_SCREEN * SCH_SHEET_PATH::LastScreen ( ) const

Definition at line 253 of file sch_sheet_path.cpp.

References SCH_SHEET::GetScreen(), and Last().

◆ MakeFilePathRelativeToParentSheet()

void SCH_SHEET_PATH::MakeFilePathRelativeToParentSheet ( )

Make the sheet file name relative to its parent sheet.

This should only be called when changing the parent sheet path such performing a save as or a new schematic without a project in stand alone mode. The sheet file name is only made relative if the current file name is relative. Absolute sheet file name paths are a user choice so do not change them.

Sheet file name paths are set according to the following criteria:

  • If the sheet file name path is in the same as the parent sheet file name path, set the sheet file name to just the file name and extension with no path.
  • If the sheet file name path can be made relative to the parent sheet file name path, set the sheet file name using the relative path.
  • If the sheet file name path cannot be converted to a relative path, then fall back to the absolute file name path.

Definition at line 623 of file sch_sheet_path.cpp.

References SCH_SCREEN::GetFileName(), SCH_SHEET::GetFileName(), Last(), LastScreen(), m_sheets, PathHumanReadable(), SCH_SHEET::SetFileName(), and tracePathsAndFiles.

◆ operator!=()

bool SCH_SHEET_PATH::operator!= ( const SCH_SHEET_PATH d1) const
inline

Definition at line 406 of file sch_sheet_path.h.

◆ operator+()

SCH_SHEET_PATH SCH_SHEET_PATH::operator+ ( const SCH_SHEET_PATH aOther)

Definition at line 126 of file sch_sheet_path.cpp.

References at(), push_back(), and size().

◆ operator<()

bool SCH_SHEET_PATH::operator< ( const SCH_SHEET_PATH d1) const
inline

Definition at line 408 of file sch_sheet_path.h.

References m_sheets.

◆ operator=()

SCH_SHEET_PATH & SCH_SHEET_PATH::operator= ( const SCH_SHEET_PATH aOther)

Definition at line 119 of file sch_sheet_path.cpp.

References initFromOther().

◆ operator==()

bool SCH_SHEET_PATH::operator== ( const SCH_SHEET_PATH d1) const

Definition at line 439 of file sch_sheet_path.cpp.

References GetCurrentHash(), and m_current_hash.

◆ Path()

◆ PathAsString()

wxString SCH_SHEET_PATH::PathAsString ( ) const

Return the path of time stamps which do not changes even when editing sheet parameters.

A path is something like / (root) or /34005677 or /34005677/00AE4523.

Definition at line 264 of file sch_sheet_path.cpp.

References KIID::AsString(), at(), EDA_ITEM::m_Uuid, and size().

Referenced by SCH_REFERENCE::GetFullPath(), SCH_REFERENCE::GetPath(), NETLIST_EXPORTER_XML::makeSymbols(), SCH_EDIT_FRAME::SendSelectItemsToPcb(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().

◆ PathHumanReadable()

◆ pop_back()

◆ push_back()

void SCH_SHEET_PATH::push_back ( SCH_SHEET aSheet)
inline

Forwarded method from std::vector.

Definition at line 170 of file sch_sheet_path.h.

References m_sheets, and Rehash().

Referenced by SCH_EDIT_FRAME::AnnotateSymbols(), HIERARCHY_PANE::buildHierarchyTree(), SCH_SHEET_LIST::BuildSheetList(), SCH_EDIT_FRAME::CheckAnnotate(), SCH_EDIT_FRAME::CreateScreens(), SCH_EDIT_FRAME::DeleteAnnotation(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_EDIT_TOOL::EditPageNumber(), SCH_NAVIGATE_TOOL::EnterSheet(), CONNECTION_GRAPH::ercCheckHierSheets(), SCH_SHEET::findSelf(), HIERARCHY_PANE::getRootString(), DIALOG_SYMBOL_FIELDS_TABLE::getSheetSymbolReferences(), LTSPICE_SCHEMATIC::Load(), SCH_IO_KICAD_SEXPR::loadHierarchy(), KI_TEST::SCHEMATIC_TEST_FIXTURE::LoadSchematic(), LoadSchematic(), SCH_IO_EAGLE::loadSchematic(), SCH_IO_ALTIUM::LoadSchematicFile(), SCH_IO_EASYEDAPRO::LoadSchematicFile(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheets(), SCH_SHEET::LocatePathOfScreen(), operator+(), SCH_IO_ALTIUM::ParseAltiumSch(), SCH_IO_ALTIUM::ParseHarnessConnector(), SCH_IO_KICAD_SEXPR_PARSER::parseSchSheetInstances(), SCH_IO_ALTIUM::ParseSheetSymbol(), CONNECTION_GRAPH::propagateToNeighbors(), SCHEMATIC::ResolveCrossReference(), SCH_EDITOR_CONTROL::Revert(), SCHEMATIC::SetRoot(), SCH_DRAWING_TOOLS::SyncAllSheetsPins(), SCH_DRAWING_TOOLS::SyncSheetsPins(), TEST_SCH_SHEET_PATH_FIXTURE::TEST_SCH_SHEET_PATH_FIXTURE(), ERC_TESTER::TestTextVars(), DIALOG_SHEET_PROPERTIES::TransferDataFromWindow(), DIALOG_SHEET_PROPERTIES::TransferDataToWindow(), HIERARCHY_PANE::UpdateHierarchyTree(), and SCH_EDITOR_CONTROL::updatePastedSheet().

◆ Rehash()

void SCH_SHEET_PATH::Rehash ( )

Definition at line 157 of file sch_sheet_path.cpp.

References m_current_hash, and m_sheets.

Referenced by clear(), pop_back(), and push_back().

◆ RemoveSymbolInstances()

void SCH_SHEET_PATH::RemoveSymbolInstances ( const SCH_SHEET_PATH aPrefixSheetPath)

◆ SetPageNumber()

◆ SetVirtualPageNumber()

void SCH_SHEET_PATH::SetVirtualPageNumber ( int  aPageNumber)
inline

Set the sheet instance virtual page number.

Virtual page numbers are incremental integers set automatically when the sheet path hierarchy is created (

See also
SCH_SHEET_LIST::BuildSheetList). The virtual page numbering is ordered by the X and Y position of the sheet in a schematic which mimics the page numbering code prior to the addition of actual user definable page numbers. Virtual page numbers should only be use when annotating schematics.

Definition at line 197 of file sch_sheet_path.h.

References m_virtualPageNumber.

Referenced by SCH_SHEET_LIST::AddNewSheetInstances(), SCH_SHEET_LIST::BuildSheetList(), SCHEMATIC::SetSheetNumberAndCount(), and SCH_SHEET_LIST::SortByPageNumbers().

◆ size()

◆ TestForRecursion()

bool SCH_SHEET_PATH::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 sheet stored in file aDestFileName will cause a sheet path recursion.

Parameters
aSrcFileNameis the source file name of the sheet add to aDestFileName.
aDestFileNameis the file name of the destination sheet for aSrcFileName.
Returns
true if aFileName will cause recursion in the sheet path. Otherwise false.
Todo:
Store sheet file names with full path, either relative to project path or absolute path. The current design always assumes subsheet files are located in the project folder which may or may not be desirable.

Definition at line 445 of file sch_sheet_path.cpp.

References at(), SCH_SHEET::GetFileName(), SCHEMATIC::GetFileName(), LastScreen(), m_recursion_test_cache, SCH_SCREEN::Schematic(), and size().

Referenced by SCH_SHEET_LIST::BuildSheetList().

◆ UpdateAllScreenReferences()

void SCH_SHEET_PATH::UpdateAllScreenReferences ( ) const

Update all the symbol references for this sheet path.

Mandatory in complex hierarchies because sheets may use the same screen (basic schematic) more than once but with different references and units according to the displayed sheet.

Definition at line 322 of file sch_sheet_path.cpp.

References SCH_LABEL_BASE::AutoplaceFields(), SCH_SYMBOL::GetField(), SCH_LABEL_BASE::GetFields(), SCH_FIELD::GetInternalName(), SCH_FIELD::GetPosition(), SCH_SYMBOL::GetRef(), SCH_SYMBOL::GetUnitSelection(), EDA_TEXT::IsVisible(), LastScreen(), SCHEMATIC_SETTINGS::m_IntersheetRefsShow, REFERENCE_FIELD, SCH_GLOBAL_LABEL_T, SCH_SYMBOL_T, SCH_ITEM::Schematic(), SCH_FIELD::SetText(), SCHEMATIC::Settings(), SCH_ITEM::SetUnit(), EDA_TEXT::SetVisible(), EDA_ITEM::Type(), and SCH_SCREEN::Update().

Referenced by SCH_EDIT_FRAME::AnnotateSymbols(), SCH_PLOTTER::createDXFFiles(), SCH_PLOTTER::createHPGLFiles(), SCH_PLOTTER::createPDFFile(), SCH_PLOTTER::createPSFiles(), SCH_PLOTTER::createSVGFiles(), SCH_EDIT_FRAME::DeleteAnnotation(), SCH_EDIT_FRAME::DisplayCurrentSheet(), ERC_TREE_MODEL::GetValue(), SCH_IO_EASYEDA::LoadSchematicFile(), SCH_IO_EASYEDAPRO::LoadSchematicFile(), SCH_IO_LTSPICE::LoadSchematicFile(), DIALOG_MIGRATE_BUSES::onItemSelected(), SCH_PRINTOUT::OnPrintPage(), DIALOG_UPDATE_FROM_PCB::OnUpdateClick(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDITOR_CONTROL::Paste(), SCH_DRAWING_TOOLS::PlaceSymbol(), DIALOG_CHANGE_SYMBOLS::processMatchingSymbols(), SCH_FIND_REPLACE_TOOL::ReplaceAll(), SCH_FIND_REPLACE_TOOL::ReplaceAndFindNext(), and SCH_PLOTTER::restoreEnvironment().

Member Data Documentation

◆ m_current_hash

size_t SCH_SHEET_PATH::m_current_hash
protected

Definition at line 416 of file sch_sheet_path.h.

Referenced by GetCurrentHash(), initFromOther(), operator==(), Rehash(), and SCH_SHEET_PATH().

◆ m_recursion_test_cache

std::map<std::pair<wxString, wxString>, bool> SCH_SHEET_PATH::m_recursion_test_cache
protected

Page numbers are maintained by the sheet load order.

Definition at line 420 of file sch_sheet_path.h.

Referenced by TestForRecursion().

◆ m_sheets

std::vector< SCH_SHEET* > SCH_SHEET_PATH::m_sheets
protected

◆ m_virtualPageNumber

int SCH_SHEET_PATH::m_virtualPageNumber
protected

The documentation for this class was generated from the following files: