KiCad PCB EDA Suite
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=NULL)
 
 ~SCH_SCREENS ()
 
int GetCount () const
 
SCH_SCREENGetFirst ()
 
SCH_SCREENGetNext ()
 
SCH_SCREENGetScreen (unsigned int aIndex) const
 
void ClearAnnotation ()
 Clear the annotation for all components in the hierarchy. More...
 
void ClearAnnotationOfNewSheetPaths (SCH_SHEET_LIST &aInitialSheetPathList)
 Clear the annotation for the components 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. More...
 
int ReplaceDuplicateTimeStamps ()
 Test all sheet and component objects in the schematic for duplicate time stamps and replaces them as necessary. More...
 
void DeleteAllMarkers (enum MARKER_BASE::TYPEMARKER aMarkerType)
 Delete all electronic rules check markers of aMarkerType from all the screens in the list. More...
 
int GetMarkerCount (enum MARKER_BASE::TYPEMARKER aMarkerType, enum MARKER_BASE::MARKER_SEVERITY aSeverity)
 Return the number of ERC markers of aMarkerType from all of the screens in the list. More...
 
void UpdateSymbolLinks (bool aForce=false)
 Initialize or reinitialize the weak reference to the LIB_PART for each SCH_COMPONENT found in the full schematic. More...
 
void TestDanglingEnds ()
 
bool HasNoFullyDefinedLibIds ()
 Test all of the schematic symbols to see if all LIB_ID objects library nickname is not set. More...
 
size_t GetLibNicknames (wxArrayString &aLibNicknames)
 Fetch all of the symbol library nickames into aLibNicknames. More...
 
int ChangeSymbolLibNickname (const wxString &aFrom, const wxString &aTo)
 Change all of the symbol library nicknames. More...
 
bool HasSchematic (const wxString &aSchematicFileName)
 Check if one of the schematics in the list of screens is aSchematicFileName. More...
 
void BuildClientSheetPathList ()
 built the list of sheet paths sharing a screen for each screen in use More...
 
bool CanCauseCaseSensitivityIssue (const wxString &aSchematicFileName) const
 Check aSchematicFileName for a potential file name case sensitivity issue. More...
 

Private Member Functions

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

Private Attributes

std::vector< SCH_SCREEN * > m_screens
 
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.

Definition at line 498 of file sch_screen.h.

Constructor & Destructor Documentation

◆ SCH_SCREENS()

SCH_SCREENS::SCH_SCREENS ( SCH_SHEET aSheet = NULL)

Definition at line 958 of file sch_screen.cpp.

959 {
960  m_index = 0;
961  buildScreenList( ( !aSheet ) ? g_RootSheet : aSheet );
962 }
unsigned int m_index
Definition: sch_screen.h:502
void buildScreenList(SCH_SHEET *aSheet)
SCH_SHEET * g_RootSheet

References buildScreenList(), g_RootSheet, and m_index.

◆ ~SCH_SCREENS()

SCH_SCREENS::~SCH_SCREENS ( )

Definition at line 965 of file sch_screen.cpp.

966 {
967 }

Member Function Documentation

◆ addScreenToList()

void SCH_SCREENS::addScreenToList ( SCH_SCREEN aScreen)
private

Definition at line 999 of file sch_screen.cpp.

1000 {
1001  if( aScreen == NULL )
1002  return;
1003 
1004  for( unsigned int i = 0; i < m_screens.size(); i++ )
1005  {
1006  if( m_screens[i] == aScreen )
1007  return;
1008  }
1009 
1010  m_screens.push_back( aScreen );
1011 }
#define NULL
std::vector< SCH_SCREEN * > m_screens
Definition: sch_screen.h:501

References m_screens, and NULL.

Referenced by buildScreenList().

◆ BuildClientSheetPathList()

void SCH_SCREENS::BuildClientSheetPathList ( )

built the list of sheet paths sharing a screen for each screen in use

Definition at line 1318 of file sch_screen.cpp.

1319 {
1320  SCH_SHEET_LIST sheetList( g_RootSheet );
1321 
1322  for( SCH_SCREEN* curr_screen = GetFirst(); curr_screen; curr_screen = GetNext() )
1323  curr_screen->GetClientSheetPaths().Clear();
1324 
1325  for( SCH_SHEET_PATH& sheetpath: sheetList )
1326  {
1327  SCH_SCREEN* used_screen = sheetpath.LastScreen();
1328 
1329  // SEarch for the used_screen in list and add this unique sheet path:
1330  for( SCH_SCREEN* curr_screen = GetFirst(); curr_screen; curr_screen = GetNext() )
1331  {
1332  if( used_screen == curr_screen )
1333  {
1334  curr_screen->GetClientSheetPaths().Add( sheetpath.Path() );
1335  break;
1336  }
1337  }
1338  }
1339 }
SCH_SHEET_LIST.
SCH_SCREEN * GetNext()
Definition: sch_screen.cpp:981
wxArrayString & GetClientSheetPaths()
Definition: sch_screen.h:181
SCH_SHEET_PATH.
SCH_SCREEN * GetFirst()
Definition: sch_screen.cpp:970
SCH_SHEET * g_RootSheet

References g_RootSheet, SCH_SCREEN::GetClientSheetPaths(), GetFirst(), and GetNext().

Referenced by ClearAnnotationOfNewSheetPaths().

◆ buildScreenList()

void SCH_SCREENS::buildScreenList ( SCH_SHEET aSheet)
private

Definition at line 1014 of file sch_screen.cpp.

1015 {
1016  if( aSheet && aSheet->Type() == SCH_SHEET_T )
1017  {
1018  SCH_SCREEN* screen = aSheet->GetScreen();
1019 
1020  addScreenToList( screen );
1021 
1022  for( auto item : screen->Items().OfType( SCH_SHEET_T ) )
1023  buildScreenList( static_cast<SCH_SHEET*>( item ) );
1024  }
1025 }
EE_TYPE OfType(KICAD_T aType)
Definition: sch_rtree.h:219
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:278
void buildScreenList(SCH_SHEET *aSheet)
void addScreenToList(SCH_SCREEN *aScreen)
Definition: sch_screen.cpp:999
EE_RTREE & Items()
Definition: sch_screen.h:127
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207

References addScreenToList(), SCH_SHEET::GetScreen(), SCH_SCREEN::Items(), EE_RTREE::OfType(), SCH_SHEET_T, and EDA_ITEM::Type().

Referenced by SCH_SCREENS().

◆ CanCauseCaseSensitivityIssue()

bool SCH_SCREENS::CanCauseCaseSensitivityIssue ( const wxString &  aSchematicFileName) const

Check aSchematicFileName for a potential file name case sensitivity issue.

On platforms where file names are case sensitive, it is possible to schematic sheet file names that would cause issues on platforms where file name are case insensitive. File names foo.sch and Foo.sch are unique files on Linux and MacOS but on Windows this would result in a broken schematic.

Parameters
aSchematicFileNameis the absolute path and file name of the file to test.
Returns
true if aSchematicFileName would cause an issue.

Definition at line 1291 of file sch_screen.cpp.

1292 {
1293  wxString lhsLower;
1294  wxString rhsLower;
1295  wxFileName lhs;
1296  wxFileName rhs = aSchematicFileName;
1297 
1298  wxCHECK( rhs.IsAbsolute(), false );
1299 
1300  for( const SCH_SCREEN* screen : m_screens )
1301  {
1302  lhs = screen->GetFileName();
1303 
1304  if( lhs.GetPath() != rhs.GetPath() )
1305  continue;
1306 
1307  lhsLower = lhs.GetFullName().Lower();
1308  rhsLower = rhs.GetFullName().Lower();
1309 
1310  if( lhsLower == rhsLower && lhs.GetFullName() != rhs.GetFullName() )
1311  return true;
1312  }
1313 
1314  return false;
1315 }
YYCODETYPE lhs
std::vector< SCH_SCREEN * > m_screens
Definition: sch_screen.h:501

References numEval::lhs, and m_screens.

Referenced by SCH_EDIT_FRAME::allowCaseSensitiveFileNameClashes().

◆ ChangeSymbolLibNickname()

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

Change all of the symbol library nicknames.

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

Definition at line 1254 of file sch_screen.cpp.

1255 {
1256  SCH_SCREEN* screen;
1257  int cnt = 0;
1258 
1259  for( screen = GetFirst(); screen; screen = GetNext() )
1260  {
1261  for( auto item : screen->Items().OfType( SCH_COMPONENT_T ) )
1262  {
1263  auto symbol = static_cast<SCH_COMPONENT*>( item );
1264 
1265  if( symbol->GetLibId().GetLibNickname() != aFrom )
1266  continue;
1267 
1268  LIB_ID id = symbol->GetLibId();
1269  id.SetLibNickname( aTo );
1270  symbol->SetLibId( id );
1271  cnt++;
1272  }
1273  }
1274 
1275  return cnt;
1276 }
SCH_SCREEN * GetNext()
Definition: sch_screen.cpp:981
EE_TYPE OfType(KICAD_T aType)
Definition: sch_rtree.h:219
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
int SetLibNickname(const UTF8 &aNickname)
Override the logical library name portion of the LIB_ID to aNickname.
Definition: lib_id.cpp:193
EE_RTREE & Items()
Definition: sch_screen.h:127
SCH_SCREEN * GetFirst()
Definition: sch_screen.cpp:970

References GetFirst(), GetNext(), SCH_SCREEN::Items(), EE_RTREE::OfType(), SCH_COMPONENT_T, and LIB_ID::SetLibNickname().

◆ ClearAnnotation()

void SCH_SCREENS::ClearAnnotation ( )

Clear the annotation for all components in the hierarchy.

Definition at line 1028 of file sch_screen.cpp.

1029 {
1030  for( size_t i = 0; i < m_screens.size(); i++ )
1032 }
#define NULL
std::vector< SCH_SCREEN * > m_screens
Definition: sch_screen.h:501
void ClearAnnotation()
Clear the annotation for all components in the hierarchy.

References m_screens, and NULL.

Referenced by SCH_EDIT_FRAME::DeleteAnnotation().

◆ ClearAnnotationOfNewSheetPaths()

void SCH_SCREENS::ClearAnnotationOfNewSheetPaths ( SCH_SHEET_LIST aInitialSheetPathList)

Clear the annotation for the components 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 1035 of file sch_screen.cpp.

1036 {
1037  // Clear the annotation for the components inside new sheetpaths
1038  // not already in aInitialSheetList
1039  SCH_SCREENS screensList( g_RootSheet ); // The list of screens, shared by sheet paths
1040  screensList.BuildClientSheetPathList(); // build the shared by sheet paths, by screen
1041 
1042  // Search for new sheet paths, not existing in aInitialSheetPathList
1043  // and existing in sheetpathList
1044  SCH_SHEET_LIST sheetpathList( g_RootSheet );
1045 
1046  for( SCH_SHEET_PATH& sheetpath: sheetpathList )
1047  {
1048  bool path_exists = false;
1049 
1050  for( const SCH_SHEET_PATH& existing_sheetpath: aInitialSheetPathList )
1051  {
1052  if( existing_sheetpath.Path() == sheetpath.Path() )
1053  {
1054  path_exists = true;
1055  break;
1056  }
1057  }
1058 
1059  if( !path_exists )
1060  {
1061  // A new sheet path is found: clear the annotation corresponding to this new path:
1062  SCH_SCREEN* curr_screen = sheetpath.LastScreen();
1063 
1064  // Clear annotation and create the AR for this path, if not exists,
1065  // when the screen is shared by sheet paths.
1066  // Otherwise ClearAnnotation do nothing, because the F1 field is used as
1067  // reference default value and takes the latest displayed value
1068  curr_screen->EnsureAlternateReferencesExist();
1069  curr_screen->ClearAnnotation( &sheetpath );
1070  }
1071  }
1072 }
SCH_SHEET_LIST.
void EnsureAlternateReferencesExist()
For screens shared by many sheetpaths (complex hierarchies): to be able to clear or modify any refere...
Definition: sch_screen.cpp:759
SCH_SHEET_PATH.
void ClearAnnotation(SCH_SHEET_PATH *aSheetPath)
Clear the annotation for the components in aSheetPath on the screen.
Definition: sch_screen.cpp:742
SCH_SHEET * g_RootSheet
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:498

References BuildClientSheetPathList(), SCH_SCREEN::ClearAnnotation(), SCH_SCREEN::EnsureAlternateReferencesExist(), and g_RootSheet.

Referenced by SCH_EDIT_TOOL::Duplicate(), and SCH_EDIT_TOOL::Properties().

◆ DeleteAllMarkers()

void SCH_SCREENS::DeleteAllMarkers ( enum MARKER_BASE::TYPEMARKER  aMarkerType)

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 1121 of file sch_screen.cpp.

1122 {
1123  for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
1124  {
1125  std::vector<SCH_ITEM*> markers;
1126 
1127  for( auto item : screen->Items().OfType( SCH_MARKER_T ) )
1128  {
1129  if( static_cast<SCH_MARKER*>( item )->GetMarkerType() == aMarkerType )
1130  markers.push_back( item );
1131  }
1132 
1133  for( auto marker : markers )
1134  {
1135  screen->Remove( marker );
1136  delete marker;
1137  }
1138  }
1139 }
SCH_SCREEN * GetNext()
Definition: sch_screen.cpp:981
SCH_SCREEN * GetFirst()
Definition: sch_screen.cpp:970

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

Referenced by DIALOG_ERC::OnEraseDrcMarkersClick(), and DIALOG_ERC::TestErc().

◆ GetCount()

int SCH_SCREENS::GetCount ( ) const
inline

Definition at line 507 of file sch_screen.h.

507 { return m_screens.size(); }
std::vector< SCH_SCREEN * > m_screens
Definition: sch_screen.h:501

References m_screens.

◆ GetFirst()

◆ GetLibNicknames()

size_t SCH_SCREENS::GetLibNicknames ( wxArrayString &  aLibNicknames)

Fetch all of the symbol library nickames into aLibNicknames.

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

Definition at line 1236 of file sch_screen.cpp.

1237 {
1238  for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
1239  {
1240  for( auto item : screen->Items().OfType( SCH_COMPONENT_T ) )
1241  {
1242  auto symbol = static_cast<SCH_COMPONENT*>( item );
1243  auto& nickname = symbol->GetLibId().GetLibNickname();
1244 
1245  if( !nickname.empty() && ( aLibNicknames.Index( nickname ) == wxNOT_FOUND ) )
1246  aLibNicknames.Add( nickname );
1247  }
1248  }
1249 
1250  return aLibNicknames.GetCount();
1251 }
SCH_SCREEN * GetNext()
Definition: sch_screen.cpp:981
SCH_SCREEN * GetFirst()
Definition: sch_screen.cpp:970

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

◆ GetMarkerCount()

int SCH_SCREENS::GetMarkerCount ( enum MARKER_BASE::TYPEMARKER  aMarkerType,
enum MARKER_BASE::MARKER_SEVERITY  aSeverity 
)

Return the number of ERC markers of aMarkerType from all of the screens in the list.

Parameters
aMarkerTypeIndicates the type of marker to count. if MARKER_UNSPEC all markers are counted.
aSeverityIndicates the error level of marker to count. useMARKER_SEVERITY_UNSPEC to count all markersof the specified type
Returns
int count of the markers found.

Definition at line 1142 of file sch_screen.cpp.

1144 {
1145  int count = 0;
1146 
1147  for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
1148  {
1149  for( auto item : screen->Items().OfType( SCH_MARKER_T ) )
1150  {
1151  auto marker = static_cast<SCH_MARKER*>( item );
1152 
1153  if( ( aMarkerType != MARKER_BASE::MARKER_UNSPEC ) &&
1154  ( marker->GetMarkerType() != aMarkerType ) )
1155  continue;
1156 
1157  if( aSeverity == MARKER_BASE::MARKER_SEVERITY_UNSPEC ||
1158  aSeverity == marker->GetErrorLevel() )
1159  count++;
1160  }
1161  }
1162 
1163  return count;
1164 }
SCH_SCREEN * GetNext()
Definition: sch_screen.cpp:981
SCH_SCREEN * GetFirst()
Definition: sch_screen.cpp:970

References GetFirst(), GetNext(), MARKER_BASE::MARKER_SEVERITY_UNSPEC, MARKER_BASE::MARKER_UNSPEC, and SCH_MARKER_T.

Referenced by DIALOG_ERC::updateMarkerCounts().

◆ GetNext()

◆ GetScreen()

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

Definition at line 990 of file sch_screen.cpp.

991 {
992  if( aIndex < m_screens.size() )
993  return m_screens[ aIndex ];
994 
995  return NULL;
996 }
#define NULL
std::vector< SCH_SCREEN * > m_screens
Definition: sch_screen.h:501

References m_screens, and NULL.

Referenced by GetNext().

◆ 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 1215 of file sch_screen.cpp.

1216 {
1217  SCH_SCREEN* screen;
1218  unsigned cnt = 0;
1219 
1220  for( screen = GetFirst(); screen; screen = GetNext() )
1221  {
1222  for( auto item : screen->Items().OfType( SCH_COMPONENT_T ) )
1223  {
1224  cnt++;
1225  auto symbol = static_cast<SCH_COMPONENT*>( item );
1226 
1227  if( !symbol->GetLibId().GetLibNickname().empty() )
1228  return false;
1229  }
1230  }
1231 
1232  return cnt != 0;
1233 }
SCH_SCREEN * GetNext()
Definition: sch_screen.cpp:981
EE_TYPE OfType(KICAD_T aType)
Definition: sch_rtree.h:219
EE_RTREE & Items()
Definition: sch_screen.h:127
SCH_SCREEN * GetFirst()
Definition: sch_screen.cpp:970

References GetFirst(), GetNext(), SCH_SCREEN::Items(), EE_RTREE::OfType(), and SCH_COMPONENT_T.

Referenced by SCH_EDIT_FRAME::checkForNoFullyDefinedLibIds(), SCH_EDIT_FRAME::OnRescueProject(), SCH_EDIT_FRAME::OpenProjectFiles(), and SCH_EDIT_FRAME::ReCreateMenuBar().

◆ 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
aSchematicFileNameis the schematic file name to search.
Returns
true if the a schematic matching the file name has been found.

Definition at line 1279 of file sch_screen.cpp.

1280 {
1281  for( const SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
1282  {
1283  if( screen->GetFileName() == aSchematicFileName )
1284  return true;
1285  }
1286 
1287  return false;
1288 }
SCH_SCREEN * GetNext()
Definition: sch_screen.cpp:981
SCH_SCREEN * GetFirst()
Definition: sch_screen.cpp:970

References GetFirst(), and GetNext().

◆ ReplaceDuplicateTimeStamps()

int SCH_SCREENS::ReplaceDuplicateTimeStamps ( )

Test all sheet and component 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 components go to which sheets.

Returns
The number of duplicate time stamps replaced.

Definition at line 1075 of file sch_screen.cpp.

1076 {
1077  EDA_ITEMS items;
1078  int count = 0;
1079 
1080  auto timestamp_cmp = []( const EDA_ITEM* a, const EDA_ITEM* b ) -> bool
1081  {
1082  return a->GetTimeStamp() < b->GetTimeStamp();
1083  };
1084 
1085  std::set<EDA_ITEM*, decltype( timestamp_cmp )> unique_stamps( timestamp_cmp );
1086 
1087  for( size_t i = 0; i < m_screens.size(); i++ )
1088  m_screens[i]->GetHierarchicalItems( items );
1089 
1090  if( items.size() < 2 )
1091  return 0;
1092 
1093  for( auto item : items )
1094  {
1095  int failed = 0;
1096 
1097  while( !unique_stamps.insert( item ).second )
1098  {
1099  failed = 1;
1100 
1101  // for a component, update its Time stamp and its paths
1102  // (m_PathsAndReferences field)
1103  if( item->Type() == SCH_COMPONENT_T )
1104  static_cast<SCH_COMPONENT*>( item )->SetTimeStamp( GetNewTimeStamp() );
1105 
1106  // for a sheet, update only its time stamp (annotation of its
1107  // components will be lost)
1108  // @todo: see how to change sheet paths for its cmp list (can
1109  // be possible in most cases)
1110  else
1111  item->SetTimeStamp( GetNewTimeStamp() );
1112  }
1113 
1114  count += failed;
1115  }
1116 
1117  return count;
1118 }
timestamp_t GetNewTimeStamp()
Definition: common.cpp:215
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: base_struct.h:601
timestamp_t GetTimeStamp() const
Definition: base_struct.h:213
std::vector< SCH_SCREEN * > m_screens
Definition: sch_screen.h:501
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:163

References GetNewTimeStamp(), EDA_ITEM::GetTimeStamp(), m_screens, and SCH_COMPONENT_T.

Referenced by SCH_EDIT_FRAME::AnnotateComponents(), and SCH_EDIT_FRAME::LoadSheetFromFile().

◆ TestDanglingEnds()

void SCH_SCREENS::TestDanglingEnds ( )

Definition at line 1181 of file sch_screen.cpp.

1182 {
1183  std::vector<SCH_SCREEN*> screens;
1184  for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
1185  screens.push_back( screen );
1186 
1187  size_t parallelThreadCount = std::min<size_t>( std::thread::hardware_concurrency(),
1188  screens.size() );
1189 
1190  std::atomic<size_t> nextScreen( 0 );
1191  std::vector<std::future<size_t>> returns( parallelThreadCount );
1192 
1193  auto update_lambda = [&screens, &nextScreen]() -> size_t
1194  {
1195  for( auto i = nextScreen++; i < screens.size(); i = nextScreen++ )
1196  screens[i]->TestDanglingEnds();
1197 
1198  return 1;
1199  };
1200 
1201  if( parallelThreadCount == 1 )
1202  update_lambda();
1203  else
1204  {
1205  for( size_t ii = 0; ii < parallelThreadCount; ++ii )
1206  returns[ii] = std::async( std::launch::async, update_lambda );
1207 
1208  // Finalize the threads
1209  for( size_t ii = 0; ii < parallelThreadCount; ++ii )
1210  returns[ii].wait();
1211  }
1212 }
SCH_SCREEN * GetNext()
Definition: sch_screen.cpp:981
void TestDanglingEnds()
SCH_SCREEN * GetFirst()
Definition: sch_screen.cpp:970

References GetFirst(), and GetNext().

Referenced by SCH_EDIT_FRAME::AppendSchematic(), SCH_EDIT_FRAME::KiwayMailIn(), and CONNECTION_GRAPH::Recalculate().

◆ UpdateSymbolLinks()

void SCH_SCREENS::UpdateSymbolLinks ( bool  aForce = false)

Initialize or reinitialize the weak reference to the LIB_PART for each SCH_COMPONENT found in the full schematic.

It must be called from:

  • draw functions
  • when loading a schematic file
  • before creating a netlist (in case a library is modified)
  • whenever any of the libraries are modified.
  • whenever the symbol library table is modified.

Definition at line 1167 of file sch_screen.cpp.

1168 {
1169  for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
1170  screen->UpdateSymbolLinks( aForce );
1171 
1172  SCH_SHEET_LIST sheets( g_RootSheet );
1173 
1174  // All of the library symbols have been replaced with copies so the connection graph
1175  // pointer are stale.
1176  if( g_ConnectionGraph )
1177  g_ConnectionGraph->Recalculate( sheets, true );
1178 }
SCH_SHEET_LIST.
SCH_SCREEN * GetNext()
Definition: sch_screen.cpp:981
void Recalculate(const SCH_SHEET_LIST &aSheetList, bool aUnconditional=false)
Updates the connection graph for the given list of sheets.
CONNECTION_GRAPH * g_ConnectionGraph
This also wants to live in the eventual SCHEMATIC object.
SCH_SCREEN * GetFirst()
Definition: sch_screen.cpp:970
SCH_SHEET * g_RootSheet

References g_ConnectionGraph, g_RootSheet, GetFirst(), GetNext(), and CONNECTION_GRAPH::Recalculate().

Referenced by SCH_EDIT_FRAME::CreateArchiveLibraryCacheFile(), SCH_EDIT_FRAME::CreateNetlist(), SCH_EDIT_FRAME::importFile(), InvokeSchEditSymbolLibTable(), SCH_EDIT_FRAME::KiwayMailIn(), SCH_EDIT_FRAME::LoadSheetFromFile(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::prepareForNetlist(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), SCH_EDIT_FRAME::rescueProject(), DIALOG_EDIT_COMPONENTS_LIBID::revertChanges(), DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow(), LEGACY_RESCUER::WriteRescueLibrary(), and SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary().

Member Data Documentation

◆ m_index

unsigned int SCH_SCREENS::m_index
private

Definition at line 502 of file sch_screen.h.

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

◆ m_screens

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

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