Cache full schematic sheet list sorted by sheet page number.

The sheet list is returned as a copy of the cached list rather than a
reference to prevent external code from changing the list.  While not as
performant, it eliminates the risk of the sheet list being altered in
ways that could break the schematic.  The sheet list should only be
updated by calling SCHEMATIC::RefreshHierarchy() when any appropriate
sheet changes are made.

Note to developers: there is something inherently different about how the
QA tests are loading and handling schematics versus the schematic editor.
Using the cached sheet list for the SCHEMATIC object will cause some QA
test to fail.  This is why SCHEMATIC::Hierarchy() has not replaced
SCHEMATIC::BuildSheetListSortedByPageNumbers() everywhere.
This commit is contained in:
Wayne Stambaugh
2024-10-09 09:58:50 -04:00
parent eae84fd5f3
commit a6923b3de3
44 changed files with 171 additions and 129 deletions
+8 -3
View File
@@ -383,8 +383,13 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
if( itemsChanged.size() > 0 )
schematic->OnItemsChanged( itemsChanged );
if( frame && refreshHierarchy )
frame->UpdateHierarchyNavigator();
if( refreshHierarchy )
{
schematic->RefreshHierarchy();
if( frame )
frame->UpdateHierarchyNavigator();
}
}
if( !( aCommitFlags & SKIP_UNDO ) )
@@ -588,7 +593,7 @@ void SCH_COMMIT::Revert()
{
// Lazy eval of sheet list; this is expensive even when unsorted
if( sheets.empty() )
sheets = schematic->BuildUnorderedSheetList();
sheets = schematic->Hierarchy();
SCH_SHEET_PATH sheet = sheets.FindSheetForScreen( screen );
symbol->SetRef( &sheet, field->GetText() );