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

Container class that holds multiple SCH_SCREEN objects in a hierarchy. More...

#include <sch_screen.h>

Public Member Functions

 SCH_SCREENS (SCH_SHEET *aSheet)
 
 SCH_SCREENS (SCH_SHEET &aSheet)
 
 ~SCH_SCREENS ()
 
size_t GetCount () const
 
SCH_SCREENGetFirst ()
 
SCH_SCREENGetNext ()
 
SCH_SCREENGetScreen (unsigned int aIndex) const
 
SCH_SHEETGetSheet (unsigned int aIndex) const
 
void ClearAnnotationOfNewSheetPaths (SCH_SHEET_LIST &aInitialSheetPathList)
 Clear the annotation for the symbols inside new sheetpaths when a complex hierarchy is modified and new sheetpaths added when a screen shares more than one sheet path, missing alternate references are added and alternate references of new sheet paths are cleared.
 
int ReplaceDuplicateTimeStamps ()
 Test all sheet and symbol objects in the schematic for duplicate time stamps and replaces them as necessary.
 
void DeleteAllMarkers (enum MARKER_BASE::MARKER_T aMarkerType, bool aIncludeExclusions)
 Delete all electronic rules check markers of aMarkerType from all the screens in the list.
 
void DeleteMarkers (enum MARKER_BASE::MARKER_T aMarkerTyp, int aErrorCode, bool aIncludeExclusions=true)
 Delete all markers of a particular type and error code.
 
void DeleteMarker (SCH_MARKER *aMarker)
 Delete a specific marker.
 
void UpdateSymbolLinks (REPORTER *aReporter=nullptr)
 Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in the full schematic.
 
void ClearEditFlags ()
 
bool HasNoFullyDefinedLibIds ()
 Test all of the schematic symbols to see if all LIB_ID objects library nickname is not set.
 
size_t GetLibNicknames (wxArrayString &aLibNicknames)
 Fetch all of the symbol library nicknames into aLibNicknames.
 
int ChangeSymbolLibNickname (const wxString &aFrom, const wxString &aTo)
 Change all of the symbol library nicknames.
 
bool HasSchematic (const wxString &aSchematicFileName)
 Check if one of the schematics in the list of screens is aSchematicFileName.
 
void BuildClientSheetPathList ()
 built the list of sheet paths sharing a screen for each screen in use
 
void SetLegacySymbolInstanceData ()
 Update the symbol value and footprint instance data for legacy designs.
 
void FixLegacyPowerSymbolMismatches ()
 Fix legacy power symbols that have mismatched value text fields and invisible power pin names.
 
void PruneOrphanedSymbolInstances (const wxString &aProjectName, const SCH_SHEET_LIST &aValidSheetPaths)
 
void PruneOrphanedSheetInstances (const wxString &aProjectName, const SCH_SHEET_LIST &aValidSheetPaths)
 
bool HasSymbolFieldNamesWithWhiteSpace () const
 

Private Member Functions

void addScreenToList (SCH_SCREEN *aScreen, SCH_SHEET *aSheet)
 
void buildScreenList (SCH_SHEET *aSheet)
 

Private Attributes

std::vector< SCH_SCREEN * > m_screens
 
std::vector< SCH_SHEET * > m_sheets
 
unsigned int m_index
 

Detailed Description

Container class that holds multiple SCH_SCREEN objects in a hierarchy.

Individual SCH_SCREEN objects are unique and correspond to .sch files.

NOTE: It may be desirable to fold the functionality of SCH_SCREENS into the new SCHEMATIC class at some point, since SCHEMATIC can also be thought of as owning the collection of all the SCH_SCREEN objects.

Definition at line 711 of file sch_screen.h.

Constructor & Destructor Documentation

◆ SCH_SCREENS() [1/2]

SCH_SCREENS::SCH_SCREENS ( SCH_SHEET aSheet)

Definition at line 1600 of file sch_screen.cpp.

References buildScreenList(), and m_index.

◆ SCH_SCREENS() [2/2]

SCH_SCREENS::SCH_SCREENS ( SCH_SHEET aSheet)
inline

Definition at line 715 of file sch_screen.h.

◆ ~SCH_SCREENS()

SCH_SCREENS::~SCH_SCREENS ( )

Definition at line 1607 of file sch_screen.cpp.

Member Function Documentation

◆ addScreenToList()

void SCH_SCREENS::addScreenToList ( SCH_SCREEN aScreen,
SCH_SHEET aSheet 
)
private

Definition at line 1650 of file sch_screen.cpp.

References m_screens, and m_sheets.

Referenced by buildScreenList().

◆ BuildClientSheetPathList()

void SCH_SCREENS::BuildClientSheetPathList ( )

◆ buildScreenList()

void SCH_SCREENS::buildScreenList ( SCH_SHEET aSheet)
private

◆ ChangeSymbolLibNickname()

int SCH_SCREENS::ChangeSymbolLibNickname ( const wxString &  aFrom,
const wxString &  aTo 
)

Change all of the symbol library nicknames.

Parameters
[in]aFromthe current symbol library name to change.
[in]aTothe new symbol library name.
Returns
the number of symbol library nicknames that were changed.

Definition at line 1887 of file sch_screen.cpp.

References GetFirst(), SCH_SYMBOL::GetLibId(), LIB_ID::GetLibNickname(), GetNext(), SCH_SCREEN::Items(), EE_RTREE::OfType(), SCH_SYMBOL_T, SCH_SYMBOL::SetLibId(), LIB_ID::SetLibNickname(), and UTF8::wx_str().

◆ ClearAnnotationOfNewSheetPaths()

void SCH_SCREENS::ClearAnnotationOfNewSheetPaths ( SCH_SHEET_LIST aInitialSheetPathList)

Clear the annotation for the symbols inside new sheetpaths when a complex hierarchy is modified and new sheetpaths added when a screen shares more than one sheet path, missing alternate references are added and alternate references of new sheet paths are cleared.

Parameters
aInitialSheetPathListis the initial sheet paths list of hierarchy before changes.

Definition at line 1682 of file sch_screen.cpp.

References BuildClientSheetPathList(), SCH_SCREEN::ClearAnnotation(), SCH_SCREEN::EnsureAlternateReferencesExist(), GetFirst(), SCHEMATIC::Hierarchy(), SCHEMATIC::Root(), and SCH_SCREEN::Schematic().

Referenced by SCH_EDIT_TOOL::Properties().

◆ ClearEditFlags()

void SCH_SCREENS::ClearEditFlags ( )

Definition at line 1766 of file sch_screen.cpp.

References GetFirst(), and GetNext().

Referenced by SCH_IO_ALTIUM::LoadSchematicFile().

◆ DeleteAllMarkers()

void SCH_SCREENS::DeleteAllMarkers ( enum MARKER_BASE::MARKER_T  aMarkerType,
bool  aIncludeExclusions 
)

Delete all electronic rules check markers of aMarkerType from all the screens in the list.

Parameters
aMarkerTypeType of markers to be deleted.

Definition at line 1818 of file sch_screen.cpp.

References DeleteMarkers(), and ERCE_UNSPECIFIED.

Referenced by DIALOG_ERC::deleteAllMarkers().

◆ DeleteMarker()

void SCH_SCREENS::DeleteMarker ( SCH_MARKER aMarker)

Delete a specific marker.

Definition at line 1776 of file sch_screen.cpp.

References GetFirst(), GetNext(), and SCH_MARKER_T.

Referenced by SHEETLIST_ERC_ITEMS_PROVIDER::DeleteItem().

◆ DeleteMarkers()

void SCH_SCREENS::DeleteMarkers ( enum MARKER_BASE::MARKER_T  aMarkerTyp,
int  aErrorCode,
bool  aIncludeExclusions = true 
)

Delete all markers of a particular type and error code.

Definition at line 1792 of file sch_screen.cpp.

References ERCE_UNSPECIFIED, GetFirst(), MARKER_BASE::GetMarkerType(), GetNext(), MARKER_BASE::GetRCItem(), MARKER_BASE::IsExcluded(), and SCH_MARKER_T.

Referenced by DeleteAllMarkers(), and DIALOG_ERC::OnERCItemRClick().

◆ FixLegacyPowerSymbolMismatches()

void SCH_SCREENS::FixLegacyPowerSymbolMismatches ( )

Fix legacy power symbols that have mismatched value text fields and invisible power pin names.

Definition at line 1962 of file sch_screen.cpp.

References GetFirst(), and GetNext().

Referenced by EESCHEMA_HELPERS::LoadSchematic(), and KI_TEST::LoadSchematic().

◆ GetCount()

size_t SCH_SCREENS::GetCount ( ) const
inline

◆ GetFirst()

SCH_SCREEN * SCH_SCREENS::GetFirst ( )

Definition at line 1612 of file sch_screen.cpp.

References m_index, and m_screens.

Referenced by SCH_EDIT_FRAME::AskToSaveChanges(), DIALOG_SYMBOL_REMAP::backupProject(), BuildClientSheetPathList(), CONNECTION_GRAPH::buildConnectionGraph(), CONNECTION_GRAPH::buildItemSubGraphs(), ChangeSymbolLibNickname(), ClearAnnotationOfNewSheetPaths(), ClearEditFlags(), SCH_EDIT_FRAME::CreateArchiveLibrary(), DeleteMarker(), DeleteMarkers(), SCH_EDIT_FRAME::doCloseWindow(), SCH_SEARCH_HANDLER::FindAll(), SCH_FIND_REPLACE_TOOL::FindNext(), FixLegacyPowerSymbolMismatches(), SCHEMATIC::FixupJunctions(), GetLibNicknames(), SCHEMATIC::GetSchematicsSharedByMultipleProjects(), getSymbols(), HasNoFullyDefinedLibIds(), HasSchematic(), SCHEMATIC::IsComplexHierarchy(), PANEL_SETUP_BUSES::loadAliases(), EESCHEMA_HELPERS::LoadSchematic(), KI_TEST::LoadSchematic(), SCH_IO_ALTIUM::LoadSchematicFile(), DIALOG_EESCHEMA_PAGE_SETTINGS::onSavePageSettings(), SCH_EDIT_FRAME::OpenProjectFiles(), PruneOrphanedSheetInstances(), PruneOrphanedSymbolInstances(), SCH::readSchematicFromFile(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), SCH_FIND_REPLACE_TOOL::ReplaceAll(), SCH_EDITOR_CONTROL::Revert(), SetLegacySymbolInstanceData(), SCHEMATIC::SetSheetNumberAndCount(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), ERC_TESTER::TestConflictingBusAliases(), ERC_TESTER::TestDuplicateSheetNames(), ERC_TESTER::TestLibSymbolIssues(), ERC_TESTER::TestOffGridEndpoints(), PANEL_SETUP_BUSES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataToWindow(), and UpdateSymbolLinks().

◆ GetLibNicknames()

size_t SCH_SCREENS::GetLibNicknames ( wxArrayString &  aLibNicknames)

Fetch all of the symbol library nicknames into aLibNicknames.

Parameters
[out]aLibNicknamesis the array to populate with all of the unique library nicknames.
Returns
the number of symbol library nicknames found.

Definition at line 1869 of file sch_screen.cpp.

References UTF8::empty(), GetFirst(), SCH_SYMBOL::GetLibId(), LIB_ID::GetLibNickname(), GetNext(), and SCH_SYMBOL_T.

Referenced by SCH_EDIT_FRAME::LoadSheetFromFile().

◆ GetNext()

SCH_SCREEN * SCH_SCREENS::GetNext ( )

Definition at line 1623 of file sch_screen.cpp.

References GetScreen(), m_index, and m_screens.

Referenced by SCH_EDIT_FRAME::AskToSaveChanges(), DIALOG_SYMBOL_REMAP::backupProject(), BuildClientSheetPathList(), CONNECTION_GRAPH::buildConnectionGraph(), CONNECTION_GRAPH::buildItemSubGraphs(), ChangeSymbolLibNickname(), ClearEditFlags(), SCH_EDIT_FRAME::CreateArchiveLibrary(), DeleteMarker(), DeleteMarkers(), SCH_EDIT_FRAME::doCloseWindow(), SCH_SEARCH_HANDLER::FindAll(), SCH_FIND_REPLACE_TOOL::FindNext(), FixLegacyPowerSymbolMismatches(), SCHEMATIC::FixupJunctions(), GetLibNicknames(), SCHEMATIC::GetSchematicsSharedByMultipleProjects(), getSymbols(), HasNoFullyDefinedLibIds(), HasSchematic(), SCHEMATIC::IsComplexHierarchy(), PANEL_SETUP_BUSES::loadAliases(), EESCHEMA_HELPERS::LoadSchematic(), KI_TEST::LoadSchematic(), SCH_IO_ALTIUM::LoadSchematicFile(), DIALOG_EESCHEMA_PAGE_SETTINGS::onSavePageSettings(), SCH_EDIT_FRAME::OpenProjectFiles(), PruneOrphanedSheetInstances(), PruneOrphanedSymbolInstances(), SCH::readSchematicFromFile(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), SCH_FIND_REPLACE_TOOL::ReplaceAll(), SCH_EDITOR_CONTROL::Revert(), SetLegacySymbolInstanceData(), SCHEMATIC::SetSheetNumberAndCount(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), ERC_TESTER::TestConflictingBusAliases(), ERC_TESTER::TestDuplicateSheetNames(), ERC_TESTER::TestLibSymbolIssues(), ERC_TESTER::TestOffGridEndpoints(), PANEL_SETUP_BUSES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataToWindow(), and UpdateSymbolLinks().

◆ GetScreen()

SCH_SCREEN * SCH_SCREENS::GetScreen ( unsigned int  aIndex) const

◆ GetSheet()

SCH_SHEET * SCH_SCREENS::GetSheet ( unsigned int  aIndex) const

Definition at line 1641 of file sch_screen.cpp.

References m_sheets.

Referenced by SCH_EDIT_FRAME::doAutoSave(), and SCH_EDIT_FRAME::SaveProject().

◆ HasNoFullyDefinedLibIds()

bool SCH_SCREENS::HasNoFullyDefinedLibIds ( )

Test all of the schematic symbols to see if all LIB_ID objects library nickname is not set.

If none of the LIB_ID object library nicknames are not set, this indicates that the project was created before the symbol library implementation.

Returns
true in there are any symbols and if all of the LIB_ID object library nicknames are empty, otherwise false.

Definition at line 1848 of file sch_screen.cpp.

References UTF8::empty(), GetFirst(), SCH_SYMBOL::GetLibId(), LIB_ID::GetLibNickname(), GetNext(), and SCH_SYMBOL_T.

Referenced by SCH_EDIT_FRAME::checkForNoFullyDefinedLibIds(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDITOR_CONTROL::RescueSymbols(), and SCH_EDIT_FRAME::setupUIConditions().

◆ HasSchematic()

bool SCH_SCREENS::HasSchematic ( const wxString &  aSchematicFileName)

Check if one of the schematics in the list of screens is aSchematicFileName.

Schematic file names in SCH_SCREEN object are stored with the absolute path to the schematic file.

Parameters
[in]aSchematicFileNameis the schematic file name to search.
Returns
true if the a schematic matching the file name has been found.

Definition at line 1912 of file sch_screen.cpp.

References GetFirst(), and GetNext().

Referenced by SCH_EDIT_FRAME::LoadSheetFromFile().

◆ HasSymbolFieldNamesWithWhiteSpace()

bool SCH_SCREENS::HasSymbolFieldNamesWithWhiteSpace ( ) const

Definition at line 2006 of file sch_screen.cpp.

References m_screens.

Referenced by SCH_EDIT_FRAME::OpenProjectFiles().

◆ PruneOrphanedSheetInstances()

void SCH_SCREENS::PruneOrphanedSheetInstances ( const wxString &  aProjectName,
const SCH_SHEET_LIST aValidSheetPaths 
)

Definition at line 1995 of file sch_screen.cpp.

References GetFirst(), and GetNext().

Referenced by SCH_EDIT_FRAME::OpenProjectFiles(), and SCH_EDITOR_CONTROL::Paste().

◆ PruneOrphanedSymbolInstances()

void SCH_SCREENS::PruneOrphanedSymbolInstances ( const wxString &  aProjectName,
const SCH_SHEET_LIST aValidSheetPaths 
)

Definition at line 1984 of file sch_screen.cpp.

References GetFirst(), and GetNext().

Referenced by SCH_EDIT_FRAME::OpenProjectFiles(), and SCH_EDITOR_CONTROL::Paste().

◆ ReplaceDuplicateTimeStamps()

int SCH_SCREENS::ReplaceDuplicateTimeStamps ( )

Test all sheet and symbol objects in the schematic for duplicate time stamps and replaces them as necessary.

Time stamps must be unique in order for complex hierarchies know which symbols go to which sheets.

Returns
The number of duplicate time stamps replaced.

Definition at line 1728 of file sch_screen.cpp.

References m_screens, and EDA_ITEM::m_Uuid.

Referenced by SCH_EDIT_FRAME::AnnotateSymbols(), SCH_EDIT_FRAME::LoadSheetFromFile(), and SCH_EDIT_FRAME::OpenProjectFiles().

◆ SetLegacySymbolInstanceData()

void SCH_SCREENS::SetLegacySymbolInstanceData ( )

Update the symbol value and footprint instance data for legacy designs.

Definition at line 1955 of file sch_screen.cpp.

References GetFirst(), and GetNext().

Referenced by SCHEMATIC::SetLegacySymbolInstanceData().

◆ UpdateSymbolLinks()

void SCH_SCREENS::UpdateSymbolLinks ( REPORTER aReporter = nullptr)

Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in the full schematic.

Note
This should only be called when the user specifically requests all library symbol links to be update or when the legacy schematic is opened for the last time. All subsequent schematic loads with the new s-expression will contain the library symbols.
Parameters
[in]aReporterAn optional REPORTER object pointer to write warning and error messages into.

Definition at line 1825 of file sch_screen.cpp.

References SCHEMATIC::ConnectionGraph(), GetFirst(), GetNext(), SCHEMATIC::Hierarchy(), CONNECTION_GRAPH::Recalculate(), and SCH_SCREEN::Schematic().

Referenced by SCH_IO_ALTIUM::LoadSchematicFile(), SCH_IO_EAGLE::LoadSchematicFile(), SCH_EDIT_FRAME::OpenProjectFiles(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), SCH_EDITOR_CONTROL::rescueProject(), LEGACY_RESCUER::WriteRescueLibrary(), and SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary().

Member Data Documentation

◆ m_index

unsigned int SCH_SCREENS::m_index
private

Definition at line 848 of file sch_screen.h.

Referenced by GetFirst(), GetNext(), and SCH_SCREENS().

◆ m_screens

std::vector< SCH_SCREEN* > SCH_SCREENS::m_screens
private

◆ m_sheets

std::vector< SCH_SHEET* > SCH_SCREENS::m_sheets
private

Definition at line 847 of file sch_screen.h.

Referenced by addScreenToList(), and GetSheet().


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