Make it clear that GetSheets() is heavy.
Also removes the side-effect that SCH_SHEET_LIST's c'tor would sort the list (and write virtual page numbers) anytime the starting sheet was the root. Also, definitely don't build a SHEET_LIST (sorted or otherwise) if you're not even going to use it. Also don't build SCH_SHEET_LISTs on idle events. Better to just always have the Next Sheet button enabled (we already beep if you click it and there's no next sheet). Also, use a SCREEN_LIST when you can. It's much cheaper to create.
This commit is contained in:
parent
616510aca2
commit
edc7603d2a
|
@ -39,8 +39,7 @@
|
|||
void SCH_EDIT_FRAME::mapExistingAnnotation( std::map<wxString, wxString>& aMap )
|
||||
{
|
||||
SCH_REFERENCE_LIST references;
|
||||
|
||||
Schematic().GetSheets().GetSymbols( references );
|
||||
Schematic().BuildUnorderedSheetList().GetSymbols( references );
|
||||
|
||||
for( size_t i = 0; i < references.GetCount(); i++ )
|
||||
{
|
||||
|
@ -62,7 +61,7 @@ void SCH_EDIT_FRAME::DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRe
|
|||
REPORTER& aReporter )
|
||||
{
|
||||
|
||||
SCH_SHEET_LIST sheets = Schematic().GetSheets();
|
||||
SCH_SHEET_LIST sheets = Schematic().BuildUnorderedSheetList();
|
||||
SCH_SCREEN* screen = GetScreen();
|
||||
SCH_SHEET_PATH currentSheet = GetCurrentSheet();
|
||||
SCH_COMMIT commit( this );
|
||||
|
@ -220,7 +219,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( SCH_COMMIT* aCommit, ANNOTATE_SCOPE_T aAn
|
|||
|
||||
SCH_REFERENCE_LIST references;
|
||||
SCH_SCREENS screens( Schematic().Root() );
|
||||
SCH_SHEET_LIST sheets = Schematic().GetSheets();
|
||||
SCH_SHEET_LIST sheets = Schematic().BuildSheetListSortedByPageNumbers();
|
||||
SCH_SHEET_PATH currentSheet = GetCurrentSheet();
|
||||
|
||||
|
||||
|
@ -464,14 +463,14 @@ int SCH_EDIT_FRAME::CheckAnnotate( ANNOTATION_ERROR_HANDLER aErrorHandler,
|
|||
{
|
||||
SCH_REFERENCE_LIST referenceList;
|
||||
constexpr bool includePowerSymbols = false;
|
||||
SCH_SHEET_LIST sheets = Schematic().GetSheets();
|
||||
SCH_SHEET_LIST sheets = Schematic().BuildSheetListSortedByPageNumbers();
|
||||
SCH_SHEET_PATH currentSheet = GetCurrentSheet();
|
||||
|
||||
// Build the list of symbols
|
||||
switch( aAnnotateScope )
|
||||
{
|
||||
case ANNOTATE_ALL:
|
||||
Schematic().GetSheets().GetSymbols( referenceList );
|
||||
sheets.GetSymbols( referenceList );
|
||||
break;
|
||||
|
||||
case ANNOTATE_CURRENT_SHEET:
|
||||
|
|
|
@ -1367,10 +1367,12 @@ void CONNECTION_GRAPH::buildItemSubGraphs()
|
|||
// Recache all bus aliases for later use
|
||||
wxCHECK_RET( m_schematic, wxS( "Connection graph cannot be built without schematic pointer" ) );
|
||||
|
||||
for( const SCH_SHEET_PATH& sheet : m_schematic->GetUnorderedSheets() )
|
||||
SCH_SCREENS screens( m_schematic->Root() );
|
||||
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
|
||||
{
|
||||
for( const std::shared_ptr<BUS_ALIAS>& alias : sheet.LastScreen()->GetBusAliases() )
|
||||
m_bus_alias_cache[ alias->GetName() ] = alias;
|
||||
for( const std::shared_ptr<BUS_ALIAS>& alias : screen->GetBusAliases() )
|
||||
m_bus_alias_cache[alias->GetName()] = alias;
|
||||
}
|
||||
|
||||
// Build subgraphs from items (on a per-sheet basis)
|
||||
|
@ -2084,10 +2086,12 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
|
|||
// Recache all bus aliases for later use
|
||||
wxCHECK_RET( m_schematic, wxT( "Connection graph cannot be built without schematic pointer" ) );
|
||||
|
||||
for( const SCH_SHEET_PATH& sheet : m_schematic->GetUnorderedSheets() )
|
||||
SCH_SCREENS screens( m_schematic->Root() );
|
||||
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
|
||||
{
|
||||
for( const std::shared_ptr<BUS_ALIAS>& alias : sheet.LastScreen()->GetBusAliases() )
|
||||
m_bus_alias_cache[ alias->GetName() ] = alias;
|
||||
for( const std::shared_ptr<BUS_ALIAS>& alias : screen->GetBusAliases() )
|
||||
m_bus_alias_cache[alias->GetName()] = alias;
|
||||
}
|
||||
|
||||
PROF_TIMER sub_graph( "buildItemSubGraphs" );
|
||||
|
|
|
@ -52,7 +52,7 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString* aPath, const wx
|
|||
if( !aSearchHierarchy )
|
||||
sheetList.push_back( m_frame->GetCurrentSheet() );
|
||||
else
|
||||
sheetList = m_frame->Schematic().GetSheets();
|
||||
sheetList = m_frame->Schematic().BuildSheetListSortedByPageNumbers();
|
||||
|
||||
for( SCH_SHEET_PATH& sheet : sheetList )
|
||||
{
|
||||
|
@ -460,13 +460,8 @@ bool findSymbolsAndPins(
|
|||
if( aRecursive )
|
||||
{
|
||||
// Iterate over children
|
||||
for( const SCH_SHEET_PATH& candidate : aSchematic.GetSheets() )
|
||||
{
|
||||
if( candidate == aSheetPath || !candidate.IsContainedWithin( aSheetPath ) )
|
||||
continue;
|
||||
|
||||
findSymbolsAndPins( aSchematic, candidate, aSyncSymMap, aSyncPinMap, aRecursive );
|
||||
}
|
||||
for( const SCH_SHEET_PATH& sheet : SCH_SHEET_LIST( aSheetPath.Last() ) )
|
||||
findSymbolsAndPins( aSchematic, sheet, aSyncSymMap, aSyncPinMap, aRecursive );
|
||||
}
|
||||
|
||||
SCH_REFERENCE_LIST references;
|
||||
|
@ -542,12 +537,9 @@ bool sheetContainsOnlyWantedItems(
|
|||
return cacheIt->second;
|
||||
|
||||
// Iterate over children
|
||||
for( const SCH_SHEET_PATH& candidate : aSchematic.GetSheets() )
|
||||
for( const SCH_SHEET_PATH& sheet : SCH_SHEET_LIST( aSheetPath.Last() ) )
|
||||
{
|
||||
if( candidate == aSheetPath || !candidate.IsContainedWithin( aSheetPath ) )
|
||||
continue;
|
||||
|
||||
bool childRet = sheetContainsOnlyWantedItems( aSchematic, candidate, aSyncSymMap,
|
||||
bool childRet = sheetContainsOnlyWantedItems( aSchematic, sheet, aSyncSymMap,
|
||||
aSyncPinMap, aCache );
|
||||
|
||||
if( !childRet )
|
||||
|
@ -617,7 +609,7 @@ findItemsFromSyncSelection( const SCHEMATIC& aSchematic, const std::string aSync
|
|||
std::optional<std::pair<wxString, wxString>> focusPin;
|
||||
std::unordered_map<SCH_SHEET_PATH, std::vector<SCH_ITEM*>> focusItemResults;
|
||||
|
||||
const SCH_SHEET_LIST allSheetsList = aSchematic.GetSheets();
|
||||
const SCH_SHEET_LIST allSheetsList = aSchematic.BuildSheetListSortedByPageNumbers();
|
||||
|
||||
// In orderedSheets, the current sheet comes first.
|
||||
std::vector<SCH_SHEET_PATH> orderedSheets;
|
||||
|
|
|
@ -289,7 +289,7 @@ void DIALOG_CHANGE_SYMBOLS::updateFieldsList()
|
|||
std::vector<SCH_FIELD*> libFields;
|
||||
std::set<wxString> fieldNames;
|
||||
|
||||
for( SCH_SHEET_PATH& instance : frame->Schematic().GetUnorderedSheets() )
|
||||
for( SCH_SHEET_PATH& instance : frame->Schematic().BuildUnorderedSheetList() )
|
||||
{
|
||||
SCH_SCREEN* screen = instance.LastScreen();
|
||||
|
||||
|
@ -483,7 +483,6 @@ int DIALOG_CHANGE_SYMBOLS::processMatchingSymbols( SCH_COMMIT* aCommit )
|
|||
wxString msg;
|
||||
int matchesProcessed = 0;
|
||||
SCH_SYMBOL* symbol = nullptr;
|
||||
SCH_SHEET_LIST hierarchy = frame->Schematic().GetSheets();
|
||||
|
||||
if( m_mode == MODE::CHANGE )
|
||||
{
|
||||
|
@ -495,7 +494,7 @@ int DIALOG_CHANGE_SYMBOLS::processMatchingSymbols( SCH_COMMIT* aCommit )
|
|||
|
||||
std::map<SCH_SYMBOL*, SYMBOL_CHANGE_INFO> symbols;
|
||||
|
||||
for( SCH_SHEET_PATH& instance : hierarchy )
|
||||
for( SCH_SHEET_PATH& instance : frame->Schematic().BuildSheetListSortedByPageNumbers() )
|
||||
{
|
||||
SCH_SCREEN* screen = instance.LastScreen();
|
||||
|
||||
|
@ -796,7 +795,7 @@ wxString DIALOG_CHANGE_SYMBOLS::getSymbolReferences( SCH_SYMBOL& aSymbol,
|
|||
|
||||
wxCHECK( parent, msg );
|
||||
|
||||
SCH_SHEET_LIST sheets = parent->Schematic().GetUnorderedSheets();
|
||||
SCH_SHEET_LIST sheets = parent->Schematic().BuildUnorderedSheetList();
|
||||
|
||||
for( const SCH_SYMBOL_INSTANCE& instance : aSymbol.GetInstances() )
|
||||
{
|
||||
|
|
|
@ -391,13 +391,13 @@ void DIALOG_EDIT_SYMBOLS_LIBID::initDlg()
|
|||
// In complex hierarchies, the same symbol is in fact duplicated, but
|
||||
// it is listed with different references (one by sheet instance)
|
||||
// the list is larger and looks like it contains all symbols.
|
||||
const SCH_SHEET_LIST& sheets = GetParent()->Schematic().GetSheets();
|
||||
SCH_REFERENCE_LIST references;
|
||||
|
||||
// build the full list of symbols including symbol having no symbol in loaded libs
|
||||
// (orphan symbols)
|
||||
sheets.GetSymbols( references, /* include power symbols */ true,
|
||||
/* include orphan symbols */ true );
|
||||
GetParent()->Schematic().BuildUnorderedSheetList().GetSymbols( references,
|
||||
true /* include power symbols */,
|
||||
true /* include orphan symbols */ );
|
||||
|
||||
for( unsigned ii = 0; ii < references.GetCount(); ii++ )
|
||||
{
|
||||
|
|
|
@ -430,8 +430,6 @@ void DIALOG_ERC::OnRunERCClick( wxCommandEvent& event )
|
|||
m_deleteAllMarkers->Enable( false );
|
||||
m_saveReport->Enable( false );
|
||||
|
||||
sch->GetSheets().AnnotatePowerSymbols();
|
||||
|
||||
int itemsNotAnnotated = m_parent->CheckAnnotate(
|
||||
[]( ERCE_T aType, const wxString& aMsg, SCH_REFERENCE* aItemA, SCH_REFERENCE* aItemB )
|
||||
{
|
||||
|
|
|
@ -672,7 +672,7 @@ void DIALOG_FIELD_PROPERTIES::UpdateField( SCH_COMMIT* aCommit, SCH_FIELD* aFiel
|
|||
int unit = symbol->GetUnit();
|
||||
LIB_ID libId = symbol->GetLibId();
|
||||
|
||||
for( SCH_SHEET_PATH& sheet : editFrame->Schematic().GetUnorderedSheets() )
|
||||
for( SCH_SHEET_PATH& sheet : editFrame->Schematic().BuildUnorderedSheetList() )
|
||||
{
|
||||
SCH_SCREEN* screen = sheet.LastScreen();
|
||||
std::vector<SCH_SYMBOL*> otherUnits;
|
||||
|
|
|
@ -580,7 +580,7 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
|
|||
SCH_COMMIT commit( m_parent );
|
||||
|
||||
// Go through sheets
|
||||
for( const SCH_SHEET_PATH& sheetPath : m_parent->Schematic().GetUnorderedSheets() )
|
||||
for( const SCH_SHEET_PATH& sheetPath : m_parent->Schematic().BuildUnorderedSheetList() )
|
||||
{
|
||||
SCH_SCREEN* screen = sheetPath.LastScreen();
|
||||
|
||||
|
|
|
@ -363,7 +363,8 @@ bool DIALOG_SHEET_PROPERTIES::TransferDataFromWindow()
|
|||
currentScreen->SetFileName( wxEmptyString );
|
||||
|
||||
// One last validity check (and potential repair) just to be sure to be sure
|
||||
SCH_SHEET_LIST repairedList( &m_frame->Schematic().Root(), true );
|
||||
SCH_SHEET_LIST repairedList;
|
||||
repairedList.BuildSheetList( &m_frame->Schematic().Root(), true );
|
||||
}
|
||||
|
||||
wxString newSheetname = m_fields->at( SHEETNAME ).GetText();
|
||||
|
|
|
@ -176,7 +176,7 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent )
|
|||
m_schSettings( parent->Schematic().Settings() )
|
||||
{
|
||||
// Get all symbols from the list of schematic sheets
|
||||
m_parent->Schematic().GetUnorderedSheets().GetSymbols( m_symbolsList, false );
|
||||
m_parent->Schematic().BuildUnorderedSheetList().GetSymbols( m_symbolsList, false );
|
||||
|
||||
m_bRefresh->SetBitmap( KiBitmapBundle( BITMAPS::small_refresh ) );
|
||||
m_bRefreshPreview->SetBitmap( KiBitmapBundle( BITMAPS::small_refresh ) );
|
||||
|
@ -2211,10 +2211,8 @@ void DIALOG_SYMBOL_FIELDS_TABLE::savePresetsToSchematic()
|
|||
void DIALOG_SYMBOL_FIELDS_TABLE::OnSchItemsAdded( SCHEMATIC& aSch,
|
||||
std::vector<SCH_ITEM*>& aSchItem )
|
||||
{
|
||||
SCH_SHEET_LIST allSheets = m_parent->Schematic().GetUnorderedSheets();
|
||||
SCH_REFERENCE_LIST allRefs;
|
||||
|
||||
allSheets.GetSymbols( allRefs );
|
||||
m_parent->Schematic().BuildUnorderedSheetList().GetSymbols( allRefs );
|
||||
|
||||
for( SCH_ITEM* item : aSchItem )
|
||||
{
|
||||
|
@ -2282,10 +2280,8 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnSchItemsRemoved( SCHEMATIC& aSch
|
|||
void DIALOG_SYMBOL_FIELDS_TABLE::OnSchItemsChanged( SCHEMATIC& aSch,
|
||||
std::vector<SCH_ITEM*>& aSchItem )
|
||||
{
|
||||
SCH_SHEET_LIST allSheets = m_parent->Schematic().GetUnorderedSheets();
|
||||
SCH_REFERENCE_LIST allRefs;
|
||||
|
||||
allSheets.GetSymbols( allRefs );
|
||||
m_parent->Schematic().BuildUnorderedSheetList().GetSymbols( allRefs );
|
||||
|
||||
for( SCH_ITEM* item : aSchItem )
|
||||
{
|
||||
|
@ -2363,7 +2359,6 @@ SCH_REFERENCE_LIST
|
|||
DIALOG_SYMBOL_FIELDS_TABLE::getSymbolReferences( SCH_SYMBOL* aSymbol,
|
||||
SCH_REFERENCE_LIST& aCachedRefs )
|
||||
{
|
||||
SCH_SHEET_LIST allSheets = m_parent->Schematic().GetUnorderedSheets();
|
||||
SCH_REFERENCE_LIST symbolRefs;
|
||||
|
||||
for( size_t i = 0; i < aCachedRefs.GetCount(); i++ )
|
||||
|
@ -2383,7 +2378,7 @@ DIALOG_SYMBOL_FIELDS_TABLE::getSymbolReferences( SCH_SYMBOL* aSymbol,
|
|||
|
||||
SCH_REFERENCE_LIST DIALOG_SYMBOL_FIELDS_TABLE::getSheetSymbolReferences( SCH_SHEET& aSheet )
|
||||
{
|
||||
SCH_SHEET_LIST allSheets = m_parent->Schematic().GetUnorderedSheets();
|
||||
SCH_SHEET_LIST allSheets = m_parent->Schematic().BuildUnorderedSheetList();
|
||||
SCH_REFERENCE_LIST sheetRefs;
|
||||
|
||||
// We need to operate on all instances of the sheet
|
||||
|
|
|
@ -785,7 +785,7 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
|||
int unit = m_symbol->GetUnit();
|
||||
LIB_ID libId = m_symbol->GetLibId();
|
||||
|
||||
for( SCH_SHEET_PATH& sheet : GetParent()->Schematic().GetUnorderedSheets() )
|
||||
for( SCH_SHEET_PATH& sheet : GetParent()->Schematic().BuildUnorderedSheetList() )
|
||||
{
|
||||
SCH_SCREEN* screen = sheet.LastScreen();
|
||||
std::vector<SCH_SYMBOL*> otherUnits;
|
||||
|
|
|
@ -242,7 +242,7 @@ void DIALOG_TABLE_PROPERTIES::getContextualTextVars( const wxString& aCrossRef,
|
|||
SCH_REFERENCE_LIST refs;
|
||||
SCH_SYMBOL* refSymbol = nullptr;
|
||||
|
||||
m_frame->Schematic().GetUnorderedSheets().GetSymbols( refs );
|
||||
m_frame->Schematic().BuildUnorderedSheetList().GetSymbols( refs );
|
||||
|
||||
for( int jj = 0; jj < (int) refs.GetCount(); jj++ )
|
||||
{
|
||||
|
|
|
@ -164,9 +164,9 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_BASE_FRAME* aParent, SCH_ITE
|
|||
|
||||
if( SCH_EDIT_FRAME* schematicEditor = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
||||
{
|
||||
SCH_SHEET_LIST sheetList = schematicEditor->Schematic().GetSheets();
|
||||
const SCHEMATIC& schematic = schematicEditor->Schematic();
|
||||
|
||||
for( const SCH_SHEET_PATH& sheet : sheetList )
|
||||
for( const SCH_SHEET_PATH& sheet : schematic.BuildSheetListSortedByPageNumbers() )
|
||||
{
|
||||
wxString sheetPageNum = sheet.GetPageNumber();
|
||||
wxString sheetName = sheet.size() == 1 ? _( "<root sheet>" )
|
||||
|
@ -229,10 +229,8 @@ void DIALOG_TEXT_PROPERTIES::getContextualTextVars( const wxString& aCrossRef,
|
|||
|
||||
if( schematic )
|
||||
{
|
||||
SCH_SHEET_LIST sheets = m_currentItem->Schematic()->GetSheets();
|
||||
SCH_REFERENCE_LIST refs;
|
||||
|
||||
sheets.GetSymbols( refs );
|
||||
schematic->BuildUnorderedSheetList().GetSymbols( refs );
|
||||
|
||||
for( int jj = 0; jj < (int) refs.GetCount(); jj++ )
|
||||
{
|
||||
|
|
|
@ -91,14 +91,16 @@ static std::unique_ptr<SCHEMATIC> readSchematicFromFile( const std::string& aFil
|
|||
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
|
||||
screen->UpdateLocalLibSymbolLinks();
|
||||
|
||||
SCH_SHEET_LIST sheets = schematic->GetSheets();
|
||||
SCH_SHEET_LIST sheets = schematic->BuildSheetListSortedByPageNumbers();
|
||||
|
||||
// Restore all of the loaded symbol instances from the root sheet screen.
|
||||
sheets.UpdateSymbolInstanceData( schematic->RootScreen()->GetSymbolInstances() );
|
||||
|
||||
if( schematic->RootScreen()->GetFileFormatVersionAtLoad() < 20230221 )
|
||||
{
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
|
||||
screen->FixLegacyPowerSymbolMismatches();
|
||||
}
|
||||
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
|
||||
screen->MigrateSimModels();
|
||||
|
|
|
@ -151,7 +151,7 @@ SCHEMATIC* EESCHEMA_HELPERS::LoadSchematic( wxString& aFileName, SCH_IO_MGR::SCH
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
SCH_SHEET_LIST sheetList = schematic->GetSheets();
|
||||
SCH_SHEET_LIST sheetList = schematic->BuildSheetListSortedByPageNumbers();
|
||||
SCH_SCREENS screens( schematic->Root() );
|
||||
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
|
||||
|
|
|
@ -249,7 +249,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportNetlist( JOB* aJob )
|
|||
|
||||
// Annotation warning check
|
||||
SCH_REFERENCE_LIST referenceList;
|
||||
sch->GetSheets().GetSymbols( referenceList );
|
||||
sch->BuildUnorderedSheetList().GetSymbols( referenceList );
|
||||
|
||||
if( referenceList.GetCount() > 0 )
|
||||
{
|
||||
|
@ -362,7 +362,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportBom( JOB* aJob )
|
|||
|
||||
// Annotation warning check
|
||||
SCH_REFERENCE_LIST referenceList;
|
||||
sch->GetSheets().GetSymbols( referenceList, false, false );
|
||||
sch->BuildUnorderedSheetList().GetSymbols( referenceList, false, false );
|
||||
|
||||
if( referenceList.GetCount() > 0 )
|
||||
{
|
||||
|
@ -618,7 +618,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportPythonBom( JOB* aJob )
|
|||
|
||||
// Annotation warning check
|
||||
SCH_REFERENCE_LIST referenceList;
|
||||
sch->GetSheets().GetSymbols( referenceList );
|
||||
sch->BuildUnorderedSheetList().GetSymbols( referenceList );
|
||||
|
||||
if( referenceList.GetCount() > 0 )
|
||||
{
|
||||
|
|
|
@ -1363,11 +1363,11 @@ int ERC_TESTER::TestRuleAreaOverlappingRuleAreasERC(
|
|||
void ERC_TESTER::RunTests( DS_PROXY_VIEW_ITEM* aDrawingSheet, SCH_EDIT_FRAME* aEditFrame,
|
||||
KIFACE* aCvPcb, PROJECT* aProject, PROGRESS_REPORTER* aProgressReporter )
|
||||
{
|
||||
ERC_SETTINGS& settings = m_schematic->ErcSettings();
|
||||
m_sheetList.AnnotatePowerSymbols();
|
||||
|
||||
// Test duplicate sheet names inside a given sheet. While one can have multiple references
|
||||
// to the same file, each must have a unique name.
|
||||
if( settings.IsTestEnabled( ERCE_DUPLICATE_SHEET_NAME ) )
|
||||
if( m_settings.IsTestEnabled( ERCE_DUPLICATE_SHEET_NAME ) )
|
||||
{
|
||||
if( aProgressReporter )
|
||||
aProgressReporter->AdvancePhase( _( "Checking sheet names..." ) );
|
||||
|
@ -1375,7 +1375,7 @@ void ERC_TESTER::RunTests( DS_PROXY_VIEW_ITEM* aDrawingSheet, SCH_EDIT_FRAME* aE
|
|||
TestDuplicateSheetNames( true );
|
||||
}
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_BUS_ALIAS_CONFLICT ) )
|
||||
if( m_settings.IsTestEnabled( ERCE_BUS_ALIAS_CONFLICT ) )
|
||||
{
|
||||
if( aProgressReporter )
|
||||
aProgressReporter->AdvancePhase( _( "Checking bus conflicts..." ) );
|
||||
|
@ -1401,7 +1401,7 @@ void ERC_TESTER::RunTests( DS_PROXY_VIEW_ITEM* aDrawingSheet, SCH_EDIT_FRAME* aE
|
|||
if( aProgressReporter )
|
||||
aProgressReporter->AdvancePhase( _( "Checking rule areas..." ) );
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_OVERLAPPING_RULE_AREAS ) )
|
||||
if( m_settings.IsTestEnabled( ERCE_OVERLAPPING_RULE_AREAS ) )
|
||||
{
|
||||
RunRuleAreaERC();
|
||||
}
|
||||
|
@ -1410,7 +1410,7 @@ void ERC_TESTER::RunTests( DS_PROXY_VIEW_ITEM* aDrawingSheet, SCH_EDIT_FRAME* aE
|
|||
aProgressReporter->AdvancePhase( _( "Checking units..." ) );
|
||||
|
||||
// Test is all units of each multiunit symbol have the same footprint assigned.
|
||||
if( settings.IsTestEnabled( ERCE_DIFFERENT_UNIT_FP ) )
|
||||
if( m_settings.IsTestEnabled( ERCE_DIFFERENT_UNIT_FP ) )
|
||||
{
|
||||
if( aProgressReporter )
|
||||
aProgressReporter->AdvancePhase( _( "Checking footprints..." ) );
|
||||
|
@ -1418,10 +1418,10 @@ void ERC_TESTER::RunTests( DS_PROXY_VIEW_ITEM* aDrawingSheet, SCH_EDIT_FRAME* aE
|
|||
TestMultiunitFootprints();
|
||||
}
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_MISSING_UNIT )
|
||||
|| settings.IsTestEnabled( ERCE_MISSING_INPUT_PIN )
|
||||
|| settings.IsTestEnabled( ERCE_MISSING_POWER_INPUT_PIN )
|
||||
|| settings.IsTestEnabled( ERCE_MISSING_BIDI_PIN ) )
|
||||
if( m_settings.IsTestEnabled( ERCE_MISSING_UNIT )
|
||||
|| m_settings.IsTestEnabled( ERCE_MISSING_INPUT_PIN )
|
||||
|| m_settings.IsTestEnabled( ERCE_MISSING_POWER_INPUT_PIN )
|
||||
|| m_settings.IsTestEnabled( ERCE_MISSING_BIDI_PIN ) )
|
||||
{
|
||||
TestMissingUnits();
|
||||
}
|
||||
|
@ -1429,20 +1429,20 @@ void ERC_TESTER::RunTests( DS_PROXY_VIEW_ITEM* aDrawingSheet, SCH_EDIT_FRAME* aE
|
|||
if( aProgressReporter )
|
||||
aProgressReporter->AdvancePhase( _( "Checking pins..." ) );
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_DIFFERENT_UNIT_NET ) )
|
||||
if( m_settings.IsTestEnabled( ERCE_DIFFERENT_UNIT_NET ) )
|
||||
TestMultUnitPinConflicts();
|
||||
|
||||
// Test pins on each net against the pin connection table
|
||||
if( settings.IsTestEnabled( ERCE_PIN_TO_PIN_ERROR )
|
||||
|| settings.IsTestEnabled( ERCE_POWERPIN_NOT_DRIVEN )
|
||||
|| settings.IsTestEnabled( ERCE_PIN_NOT_DRIVEN ) )
|
||||
if( m_settings.IsTestEnabled( ERCE_PIN_TO_PIN_ERROR )
|
||||
|| m_settings.IsTestEnabled( ERCE_POWERPIN_NOT_DRIVEN )
|
||||
|| m_settings.IsTestEnabled( ERCE_PIN_NOT_DRIVEN ) )
|
||||
{
|
||||
TestPinToPin();
|
||||
}
|
||||
|
||||
// Test similar labels (i;e. labels which are identical when
|
||||
// using case insensitive comparisons)
|
||||
if( settings.IsTestEnabled( ERCE_SIMILAR_LABELS ) )
|
||||
if( m_settings.IsTestEnabled( ERCE_SIMILAR_LABELS ) )
|
||||
{
|
||||
if( aProgressReporter )
|
||||
aProgressReporter->AdvancePhase( _( "Checking labels..." ) );
|
||||
|
@ -1450,7 +1450,7 @@ void ERC_TESTER::RunTests( DS_PROXY_VIEW_ITEM* aDrawingSheet, SCH_EDIT_FRAME* aE
|
|||
TestSimilarLabels();
|
||||
}
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_UNRESOLVED_VARIABLE ) )
|
||||
if( m_settings.IsTestEnabled( ERCE_UNRESOLVED_VARIABLE ) )
|
||||
{
|
||||
if( aProgressReporter )
|
||||
aProgressReporter->AdvancePhase( _( "Checking for unresolved variables..." ) );
|
||||
|
@ -1458,7 +1458,7 @@ void ERC_TESTER::RunTests( DS_PROXY_VIEW_ITEM* aDrawingSheet, SCH_EDIT_FRAME* aE
|
|||
TestTextVars( aDrawingSheet );
|
||||
}
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_SIMULATION_MODEL ) )
|
||||
if( m_settings.IsTestEnabled( ERCE_SIMULATION_MODEL ) )
|
||||
{
|
||||
if( aProgressReporter )
|
||||
aProgressReporter->AdvancePhase( _( "Checking SPICE models..." ) );
|
||||
|
@ -1466,7 +1466,7 @@ void ERC_TESTER::RunTests( DS_PROXY_VIEW_ITEM* aDrawingSheet, SCH_EDIT_FRAME* aE
|
|||
TestSimModelIssues();
|
||||
}
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_NOCONNECT_CONNECTED ) )
|
||||
if( m_settings.IsTestEnabled( ERCE_NOCONNECT_CONNECTED ) )
|
||||
{
|
||||
if( aProgressReporter )
|
||||
aProgressReporter->AdvancePhase( _( "Checking no connect pins for connections..." ) );
|
||||
|
@ -1474,8 +1474,8 @@ void ERC_TESTER::RunTests( DS_PROXY_VIEW_ITEM* aDrawingSheet, SCH_EDIT_FRAME* aE
|
|||
TestNoConnectPins();
|
||||
}
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_LIB_SYMBOL_ISSUES )
|
||||
|| settings.IsTestEnabled( ERCE_LIB_SYMBOL_MISMATCH ) )
|
||||
if( m_settings.IsTestEnabled( ERCE_LIB_SYMBOL_ISSUES )
|
||||
|| m_settings.IsTestEnabled( ERCE_LIB_SYMBOL_MISMATCH ) )
|
||||
{
|
||||
if( aProgressReporter )
|
||||
aProgressReporter->AdvancePhase( _( "Checking for library symbol issues..." ) );
|
||||
|
@ -1483,7 +1483,7 @@ void ERC_TESTER::RunTests( DS_PROXY_VIEW_ITEM* aDrawingSheet, SCH_EDIT_FRAME* aE
|
|||
TestLibSymbolIssues();
|
||||
}
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_FOOTPRINT_LINK_ISSUES ) && aCvPcb )
|
||||
if( m_settings.IsTestEnabled( ERCE_FOOTPRINT_LINK_ISSUES ) && aCvPcb )
|
||||
{
|
||||
if( aProgressReporter )
|
||||
aProgressReporter->AdvancePhase( _( "Checking for footprint link issues..." ) );
|
||||
|
@ -1491,7 +1491,7 @@ void ERC_TESTER::RunTests( DS_PROXY_VIEW_ITEM* aDrawingSheet, SCH_EDIT_FRAME* aE
|
|||
TestFootprintLinkIssues( aCvPcb, aProject );
|
||||
}
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_ENDPOINT_OFF_GRID ) )
|
||||
if( m_settings.IsTestEnabled( ERCE_ENDPOINT_OFF_GRID ) )
|
||||
{
|
||||
if( aProgressReporter )
|
||||
aProgressReporter->AdvancePhase( _( "Checking for off grid pins and wires..." ) );
|
||||
|
@ -1499,7 +1499,7 @@ void ERC_TESTER::RunTests( DS_PROXY_VIEW_ITEM* aDrawingSheet, SCH_EDIT_FRAME* aE
|
|||
TestOffGridEndpoints();
|
||||
}
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_FOUR_WAY_JUNCTION ) )
|
||||
if( m_settings.IsTestEnabled( ERCE_FOUR_WAY_JUNCTION ) )
|
||||
{
|
||||
if( aProgressReporter )
|
||||
aProgressReporter->AdvancePhase( _( "Checking for four way junctions..." ) );
|
||||
|
@ -1507,7 +1507,7 @@ void ERC_TESTER::RunTests( DS_PROXY_VIEW_ITEM* aDrawingSheet, SCH_EDIT_FRAME* aE
|
|||
TestFourWayJunction();
|
||||
}
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_UNDEFINED_NETCLASS ) )
|
||||
if( m_settings.IsTestEnabled( ERCE_UNDEFINED_NETCLASS ) )
|
||||
{
|
||||
if( aProgressReporter )
|
||||
aProgressReporter->AdvancePhase( _( "Checking for undefined netclasses..." ) );
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
ERC_TESTER( SCHEMATIC* aSchematic ) :
|
||||
m_schematic( aSchematic ),
|
||||
m_settings( aSchematic->ErcSettings() ),
|
||||
m_sheetList( aSchematic->GetSheets() ),
|
||||
m_sheetList( aSchematic->BuildSheetListSortedByPageNumbers() ),
|
||||
m_screens( aSchematic->Root() ),
|
||||
m_nets( aSchematic->ConnectionGraph()->GetNetMap() )
|
||||
{
|
||||
|
|
|
@ -53,7 +53,7 @@ wxString ERC_REPORT::GetTextReport()
|
|||
int err_count = 0;
|
||||
int warn_count = 0;
|
||||
int total_count = 0;
|
||||
SCH_SHEET_LIST sheetList = m_sch->GetSheets();
|
||||
SCH_SHEET_LIST sheetList = m_sch->BuildSheetListSortedByPageNumbers();
|
||||
|
||||
sheetList.FillItemMap( itemMap );
|
||||
|
||||
|
@ -124,7 +124,7 @@ bool ERC_REPORT::WriteJsonReport( const wxString& aFullFileName )
|
|||
int err_count = 0;
|
||||
int warn_count = 0;
|
||||
int total_count = 0;
|
||||
SCH_SHEET_LIST sheetList = m_sch->GetSheets();
|
||||
SCH_SHEET_LIST sheetList = m_sch->BuildSheetListSortedByPageNumbers();
|
||||
sheetList.FillItemMap( itemMap );
|
||||
|
||||
ERC_SETTINGS& settings = m_sch->ErcSettings();
|
||||
|
|
|
@ -292,7 +292,7 @@ void SHEETLIST_ERC_ITEMS_PROVIDER::visitMarkers( std::function<void( SCH_MARKER*
|
|||
{
|
||||
std::set<SCH_SCREEN*> seenScreens;
|
||||
|
||||
for( const SCH_SHEET_PATH& sheet : m_schematic->GetUnorderedSheets() )
|
||||
for( const SCH_SHEET_PATH& sheet : m_schematic->BuildUnorderedSheetList() )
|
||||
{
|
||||
bool firstTime = seenScreens.count( sheet.LastScreen() ) == 0;
|
||||
|
||||
|
|
|
@ -329,7 +329,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
|
||||
// It's possible the schematic parser fixed errors due to bugs so warn the user
|
||||
// that the schematic has been fixed (modified).
|
||||
SCH_SHEET_LIST sheetList = Schematic().GetSheets();
|
||||
SCH_SHEET_LIST sheetList = Schematic().BuildSheetListSortedByPageNumbers();
|
||||
|
||||
if( sheetList.IsModified() )
|
||||
{
|
||||
|
@ -513,8 +513,8 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
}
|
||||
}
|
||||
|
||||
schematic.PruneOrphanedSymbolInstances( Prj().GetProjectName(), Schematic().GetSheets() );
|
||||
schematic.PruneOrphanedSheetInstances( Prj().GetProjectName(), Schematic().GetSheets() );
|
||||
schematic.PruneOrphanedSymbolInstances( Prj().GetProjectName(), sheetList );
|
||||
schematic.PruneOrphanedSheetInstances( Prj().GetProjectName(), sheetList );
|
||||
|
||||
Schematic().ConnectionGraph()->Reset();
|
||||
|
||||
|
@ -1074,7 +1074,7 @@ bool SCH_EDIT_FRAME::SaveProject( bool aSaveAs )
|
|||
}
|
||||
|
||||
// Attempt to make sheet file name paths relative to the new root schematic path.
|
||||
for( SCH_SHEET_PATH& sheet : Schematic().GetUnorderedSheets() )
|
||||
for( SCH_SHEET_PATH& sheet : Schematic().BuildUnorderedSheetList() )
|
||||
{
|
||||
if( !sheet.Last()->IsRootSheet() )
|
||||
sheet.MakeFilePathRelativeToParentSheet();
|
||||
|
@ -1237,7 +1237,7 @@ bool SCH_EDIT_FRAME::SaveProject( bool aSaveAs )
|
|||
std::vector<FILE_INFO_PAIR>& sheets = Prj().GetProjectFile().GetSheets();
|
||||
sheets.clear();
|
||||
|
||||
for( SCH_SHEET_PATH& sheetPath : Schematic().GetSheets() )
|
||||
for( SCH_SHEET_PATH& sheetPath : Schematic().BuildUnorderedSheetList() )
|
||||
{
|
||||
SCH_SHEET* sheet = sheetPath.Last();
|
||||
|
||||
|
@ -1365,7 +1365,6 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType,
|
|||
{
|
||||
wxFileName filename( aFileName );
|
||||
wxFileName newfilename;
|
||||
SCH_SHEET_LIST sheetList = Schematic().GetSheets();
|
||||
SCH_IO_MGR::SCH_FILE_T fileType = (SCH_IO_MGR::SCH_FILE_T) aFileType;
|
||||
|
||||
wxCommandEvent changingEvt( EDA_EVT_SCHEMATIC_CHANGING );
|
||||
|
|
|
@ -267,7 +267,7 @@ void SCH_EDIT_FRAME::RefreshNetNavigator( const NET_NAVIGATOR_ITEM_DATA* aSelect
|
|||
if( !m_netNavigator->IsShown() )
|
||||
return;
|
||||
|
||||
bool singleSheetSchematic = m_schematic->GetUnorderedSheets().size() == 1;
|
||||
bool singleSheetSchematic = m_schematic->BuildUnorderedSheetList().size() == 1;
|
||||
size_t nodeCnt = 0;
|
||||
|
||||
m_netNavigator->Freeze();
|
||||
|
|
|
@ -136,14 +136,12 @@ void NETLIST_EXPORTER_ALLEGRO::extractComponentsInfo()
|
|||
m_referencesAlreadyFound.Clear();
|
||||
m_libParts.clear();
|
||||
|
||||
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
|
||||
|
||||
for( unsigned ii = 0; ii < sheetList.size(); ii++ )
|
||||
for( const SCH_SHEET_PATH& sheet : m_schematic->BuildSheetListSortedByPageNumbers() )
|
||||
{
|
||||
SCH_SHEET_PATH sheet = sheetList[ii];
|
||||
m_schematic->SetCurrentSheet( sheet );
|
||||
|
||||
auto cmp = [sheet]( SCH_SYMBOL* a, SCH_SYMBOL* b )
|
||||
auto cmp =
|
||||
[sheet]( SCH_SYMBOL* a, SCH_SYMBOL* b )
|
||||
{
|
||||
return ( StrNumCmp( a->GetRef( &sheet, false ),
|
||||
b->GetRef( &sheet, false ), true ) < 0 );
|
||||
|
@ -174,7 +172,7 @@ void NETLIST_EXPORTER_ALLEGRO::extractComponentsInfo()
|
|||
|
||||
for( EDA_ITEM* item : ordered_symbols )
|
||||
{
|
||||
SCH_SYMBOL* symbol = findNextSymbol( item, &sheet );
|
||||
SCH_SYMBOL* symbol = findNextSymbol( item, sheet );
|
||||
|
||||
if( !symbol || symbol->GetExcludedFromBoard() )
|
||||
continue;
|
||||
|
|
|
@ -79,10 +79,10 @@ wxString NETLIST_EXPORTER_BASE::MakeCommandLine( const wxString& aFormatString,
|
|||
}
|
||||
|
||||
|
||||
SCH_SYMBOL* NETLIST_EXPORTER_BASE::findNextSymbol( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheetPath )
|
||||
SCH_SYMBOL* NETLIST_EXPORTER_BASE::findNextSymbol( EDA_ITEM* aItem,
|
||||
const SCH_SHEET_PATH& aSheetPath )
|
||||
{
|
||||
wxCHECK( aItem, nullptr );
|
||||
wxCHECK( aSheetPath, nullptr );
|
||||
|
||||
wxString ref;
|
||||
|
||||
|
@ -94,12 +94,12 @@ SCH_SYMBOL* NETLIST_EXPORTER_BASE::findNextSymbol( EDA_ITEM* aItem, SCH_SHEET_PA
|
|||
|
||||
// Power symbols and other symbols which have the reference starting with "#" are not
|
||||
// included in netlist (pseudo or virtual symbols)
|
||||
ref = symbol->GetRef( aSheetPath );
|
||||
ref = symbol->GetRef( &aSheetPath );
|
||||
|
||||
if( ref[0] == wxChar( '#' ) )
|
||||
return nullptr;
|
||||
|
||||
SCH_SCREEN* screen = aSheetPath->LastScreen();
|
||||
SCH_SCREEN* screen = aSheetPath.LastScreen();
|
||||
|
||||
wxCHECK( screen, nullptr );
|
||||
|
||||
|
@ -126,14 +126,14 @@ SCH_SYMBOL* NETLIST_EXPORTER_BASE::findNextSymbol( EDA_ITEM* aItem, SCH_SHEET_PA
|
|||
|
||||
|
||||
std::vector<PIN_INFO> NETLIST_EXPORTER_BASE::CreatePinList( SCH_SYMBOL* aSymbol,
|
||||
SCH_SHEET_PATH* aSheetPath,
|
||||
const SCH_SHEET_PATH& aSheetPath,
|
||||
bool aKeepUnconnectedPins )
|
||||
{
|
||||
std::vector<PIN_INFO> pins;
|
||||
|
||||
wxCHECK( aSymbol, pins );
|
||||
|
||||
wxString ref( aSymbol->GetRef( aSheetPath ) );
|
||||
wxString ref( aSymbol->GetRef( &aSheetPath ) );
|
||||
|
||||
// Power symbols and other symbols which have the reference starting with "#" are not
|
||||
// included in netlist (pseudo or virtual symbols)
|
||||
|
@ -161,15 +161,15 @@ std::vector<PIN_INFO> NETLIST_EXPORTER_BASE::CreatePinList( SCH_SYMBOL* aSymbol,
|
|||
{
|
||||
CONNECTION_GRAPH* graph = m_schematic->ConnectionGraph();
|
||||
|
||||
for( const SCH_PIN* pin : aSymbol->GetPins( aSheetPath ) )
|
||||
for( const SCH_PIN* pin : aSymbol->GetPins( &aSheetPath ) )
|
||||
{
|
||||
if( SCH_CONNECTION* conn = pin->Connection( aSheetPath ) )
|
||||
if( SCH_CONNECTION* conn = pin->Connection( &aSheetPath ) )
|
||||
{
|
||||
const wxString& netName = conn->Name();
|
||||
|
||||
if( !aKeepUnconnectedPins ) // Skip unconnected pins if requested
|
||||
{
|
||||
CONNECTION_SUBGRAPH* sg = graph->FindSubgraphByName( netName, *aSheetPath );
|
||||
CONNECTION_SUBGRAPH* sg = graph->FindSubgraphByName( netName, aSheetPath );
|
||||
|
||||
if( !sg || sg->GetNoConnect() || sg->GetItems().size() < 2 )
|
||||
continue;
|
||||
|
@ -231,21 +231,18 @@ void NETLIST_EXPORTER_BASE::eraseDuplicatePins( std::vector<PIN_INFO>& aPins )
|
|||
|
||||
|
||||
void NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol( SCH_SYMBOL* aSchSymbol,
|
||||
SCH_SHEET_PATH* aSheetPath,
|
||||
const SCH_SHEET_PATH& aSheetPath,
|
||||
std::vector<PIN_INFO>& aPins,
|
||||
bool aKeepUnconnectedPins )
|
||||
{
|
||||
wxString ref = aSchSymbol->GetRef( aSheetPath );
|
||||
wxString ref = aSchSymbol->GetRef( &aSheetPath );
|
||||
wxString ref2;
|
||||
|
||||
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
|
||||
CONNECTION_GRAPH* graph = m_schematic->ConnectionGraph();
|
||||
|
||||
for( unsigned i = 0; i < sheetList.size(); i++ )
|
||||
for( const SCH_SHEET_PATH& sheet : m_schematic->BuildSheetListSortedByPageNumbers() )
|
||||
{
|
||||
SCH_SHEET_PATH& sheet = sheetList[i];
|
||||
|
||||
for( SCH_ITEM* item : sheetList[i].LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||
{
|
||||
SCH_SYMBOL* comp2 = static_cast<SCH_SYMBOL*>( item );
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ protected:
|
|||
* if aKeepUnconnectedPins = false, unconnected pins will be removed from list
|
||||
* but usually we need all pins in netlists.
|
||||
*/
|
||||
std::vector<PIN_INFO> CreatePinList( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aSheetPath,
|
||||
std::vector<PIN_INFO> CreatePinList( SCH_SYMBOL* aSymbol, const SCH_SHEET_PATH& aSheetPath,
|
||||
bool aKeepUnconnectedPins );
|
||||
|
||||
/**
|
||||
|
@ -159,7 +159,7 @@ protected:
|
|||
* @param aSheetPath is the sheet to check the symbol for
|
||||
* @return the symbol if it should be processed, or nullptr
|
||||
*/
|
||||
SCH_SYMBOL* findNextSymbol( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheetPath );
|
||||
SCH_SYMBOL* findNextSymbol( EDA_ITEM* aItem, const SCH_SHEET_PATH& aSheetPath );
|
||||
|
||||
/**
|
||||
* Erase duplicate pins.
|
||||
|
@ -181,7 +181,7 @@ protected:
|
|||
* if aKeepUnconnectedPins = false, unconnected pins will be removed from list
|
||||
* but usually we need all pins in netlists.
|
||||
*/
|
||||
void findAllUnitsOfSymbol( SCH_SYMBOL* aSchSymbol, SCH_SHEET_PATH* aSheetPath,
|
||||
void findAllUnitsOfSymbol( SCH_SYMBOL* aSchSymbol, const SCH_SHEET_PATH& aSheetPath,
|
||||
std::vector<PIN_INFO>& aPins, bool aKeepUnconnectedPins );
|
||||
|
||||
/// Used for "multiple symbols per package" symbols to avoid processing a lib symbol more than
|
||||
|
|
|
@ -65,13 +65,11 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName,
|
|||
// Create netlist footprints section
|
||||
m_referencesAlreadyFound.Clear();
|
||||
|
||||
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
|
||||
|
||||
for( unsigned i = 0; i < sheetList.size(); i++ )
|
||||
for( const SCH_SHEET_PATH& sheet : m_schematic->BuildSheetListSortedByPageNumbers() )
|
||||
{
|
||||
for( SCH_ITEM* item : sheetList[i].LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||
{
|
||||
symbol = findNextSymbol( item, &sheetList[ i ] );
|
||||
symbol = findNextSymbol( item, sheet );
|
||||
|
||||
if( !symbol )
|
||||
continue;
|
||||
|
@ -79,16 +77,16 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName,
|
|||
if( symbol->GetExcludedFromBoard() )
|
||||
continue;
|
||||
|
||||
footprint = symbol->GetFootprintFieldText( true, &sheetList[ i ], false );
|
||||
footprint = symbol->GetFootprintFieldText( true, &sheet, false );
|
||||
|
||||
if( footprint.IsEmpty() )
|
||||
footprint = "$noname";
|
||||
|
||||
msg = symbol->GetRef( &sheetList[i] );
|
||||
msg = symbol->GetRef( &sheet );
|
||||
ret |= fprintf( f, "%s ", TO_UTF8( StartCmpDesc ) );
|
||||
ret |= fprintf( f, "%s", TO_UTF8( msg ) );
|
||||
|
||||
msg = symbol->GetValue( true, &sheetList[ i ], false );
|
||||
msg = symbol->GetValue( true, &sheet, false );
|
||||
msg.Replace( wxT( " " ), wxT( "_" ) );
|
||||
ret |= fprintf( f, " \"%s\"", TO_UTF8( msg ) );
|
||||
ret |= fprintf( f, " \"%s\"", TO_UTF8( footprint ) );
|
||||
|
|
|
@ -62,16 +62,12 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
|
|||
// Create netlist footprints section
|
||||
m_referencesAlreadyFound.Clear();
|
||||
|
||||
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
|
||||
|
||||
for( unsigned i = 0; i < sheetList.size(); i++ )
|
||||
for( const SCH_SHEET_PATH& sheet : m_schematic->BuildSheetListSortedByPageNumbers() )
|
||||
{
|
||||
SCH_SHEET_PATH sheet = sheetList[i];
|
||||
|
||||
// Process symbol attributes
|
||||
for( EDA_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||
{
|
||||
SCH_SYMBOL* symbol = findNextSymbol( item, &sheet );
|
||||
SCH_SYMBOL* symbol = findNextSymbol( item, sheet );
|
||||
|
||||
if( !symbol )
|
||||
continue;
|
||||
|
@ -79,7 +75,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
|
|||
if( symbol->GetExcludedFromBoard() )
|
||||
continue;
|
||||
|
||||
std::vector<PIN_INFO> pins = CreatePinList( symbol, &sheet, true );
|
||||
std::vector<PIN_INFO> pins = CreatePinList( symbol, sheet, true );
|
||||
|
||||
if( symbol->GetLibSymbolRef()
|
||||
&& symbol->GetLibSymbolRef()->GetFPFilters().GetCount() != 0 )
|
||||
|
|
|
@ -55,13 +55,11 @@ bool NETLIST_EXPORTER_PADS::WriteNetlist( const wxString& aOutFileName,
|
|||
// Create netlist footprints section
|
||||
m_referencesAlreadyFound.Clear();
|
||||
|
||||
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
|
||||
|
||||
for( unsigned i = 0; i < sheetList.size(); i++ )
|
||||
for( const SCH_SHEET_PATH& sheet : m_schematic->BuildSheetListSortedByPageNumbers() )
|
||||
{
|
||||
for( SCH_ITEM* item : sheetList[i].LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||
{
|
||||
symbol = findNextSymbol( item, &sheetList[ i ] );
|
||||
symbol = findNextSymbol( item, sheet );
|
||||
|
||||
if( !symbol )
|
||||
continue;
|
||||
|
@ -69,7 +67,7 @@ bool NETLIST_EXPORTER_PADS::WriteNetlist( const wxString& aOutFileName,
|
|||
if( symbol->GetExcludedFromBoard() )
|
||||
continue;
|
||||
|
||||
footprint = symbol->GetFootprintFieldText( true, &sheetList[ i ], false );
|
||||
footprint = symbol->GetFootprintFieldText( true, &sheet, false );
|
||||
|
||||
footprint = footprint.Trim( true );
|
||||
footprint = footprint.Trim( false );
|
||||
|
@ -78,13 +76,13 @@ bool NETLIST_EXPORTER_PADS::WriteNetlist( const wxString& aOutFileName,
|
|||
if( footprint.IsEmpty() )
|
||||
{
|
||||
// fall back to value field
|
||||
footprint = symbol->GetValue( true, &sheetList[i], false );
|
||||
footprint = symbol->GetValue( true, &sheet, false );
|
||||
footprint.Replace( wxT( " " ), wxT( "_" ) );
|
||||
footprint = footprint.Trim( true );
|
||||
footprint = footprint.Trim( false );
|
||||
}
|
||||
|
||||
msg = symbol->GetRef( &sheetList[i] );
|
||||
msg = symbol->GetRef( &sheet );
|
||||
ret |= fprintf( f, "%-16s %s\n", TO_UTF8( msg ), TO_UTF8( footprint ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,17 +202,17 @@ bool NETLIST_EXPORTER_SPICE::ReadSchematicAndLibraries( unsigned aNetlistOptions
|
|||
wxRemoveFile( thisFile.GetFullPath() );
|
||||
}
|
||||
|
||||
for( SCH_SHEET_PATH& sheet : GetSheets( aNetlistOptions ) )
|
||||
for( SCH_SHEET_PATH& sheet : BuildSheetList( aNetlistOptions ) )
|
||||
{
|
||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||
{
|
||||
SCH_SYMBOL* symbol = findNextSymbol( item, &sheet );
|
||||
SCH_SYMBOL* symbol = findNextSymbol( item, sheet );
|
||||
|
||||
if( !symbol || symbol->GetExcludedFromSim() )
|
||||
continue;
|
||||
|
||||
SPICE_ITEM spiceItem;
|
||||
std::vector<PIN_INFO> pins = CreatePinList( symbol, &sheet, true );
|
||||
std::vector<PIN_INFO> pins = CreatePinList( symbol, sheet, true );
|
||||
|
||||
for( const SCH_FIELD& field : symbol->GetFields() )
|
||||
{
|
||||
|
@ -324,7 +324,7 @@ void NETLIST_EXPORTER_SPICE::ReadDirectives( unsigned aNetlistOptions )
|
|||
|
||||
m_directives.clear();
|
||||
|
||||
for( const SCH_SHEET_PATH& sheet : GetSheets( aNetlistOptions ) )
|
||||
for( const SCH_SHEET_PATH& sheet : BuildSheetList( aNetlistOptions ) )
|
||||
{
|
||||
for( SCH_ITEM* item : sheet.LastScreen()->Items() )
|
||||
{
|
||||
|
@ -725,14 +725,14 @@ std::string NETLIST_EXPORTER_SPICE::GenerateItemPinNetName( const std::string& a
|
|||
}
|
||||
|
||||
|
||||
SCH_SHEET_LIST NETLIST_EXPORTER_SPICE::GetSheets( unsigned aNetlistOptions ) const
|
||||
SCH_SHEET_LIST NETLIST_EXPORTER_SPICE::BuildSheetList( unsigned aNetlistOptions ) const
|
||||
{
|
||||
SCH_SHEET_LIST sheets;
|
||||
|
||||
if( aNetlistOptions & OPTION_CUR_SHEET_AS_ROOT )
|
||||
sheets = SCH_SHEET_LIST( m_schematic->CurrentSheet().Last() );
|
||||
else
|
||||
sheets = SCH_SHEET_LIST( m_schematic->GetSheets() );
|
||||
sheets = m_schematic->BuildSheetListSortedByPageNumbers();
|
||||
|
||||
alg::delete_if( sheets,
|
||||
[&]( const SCH_SHEET_PATH& sheet )
|
||||
|
|
|
@ -143,7 +143,7 @@ protected:
|
|||
/**
|
||||
* Return the paths of exported sheets (either all or the current one).
|
||||
*/
|
||||
SCH_SHEET_LIST GetSheets( unsigned aNetlistOptions = 0 ) const;
|
||||
SCH_SHEET_LIST BuildSheetList( unsigned aNetlistOptions = 0 ) const;
|
||||
|
||||
private:
|
||||
void readRefName( SCH_SHEET_PATH& aSheet, SCH_SYMBOL& aSymbol, SPICE_ITEM& aItem,
|
||||
|
|
|
@ -89,7 +89,7 @@ std::string NETLIST_EXPORTER_SPICE_MODEL::GenerateItemPinNetName( const std::str
|
|||
|
||||
void NETLIST_EXPORTER_SPICE_MODEL::readPorts( unsigned aNetlistOptions )
|
||||
{
|
||||
for( const SCH_SHEET_PATH& sheet : GetSheets( aNetlistOptions ) )
|
||||
for( const SCH_SHEET_PATH& sheet : BuildSheetList( aNetlistOptions ) )
|
||||
{
|
||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_HIER_LABEL_T ) )
|
||||
{
|
||||
|
|
|
@ -93,7 +93,8 @@ XNODE* NETLIST_EXPORTER_XML::makeRoot( unsigned aCtl )
|
|||
|
||||
|
||||
void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol,
|
||||
SCH_SHEET_PATH* aSheet )
|
||||
const SCH_SHEET_PATH& aSheet,
|
||||
const SCH_SHEET_LIST& aSheetList )
|
||||
{
|
||||
wxString value;
|
||||
wxString footprint;
|
||||
|
@ -111,41 +112,40 @@ void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol,
|
|||
// any non blank fields in all units and use the first non-blank field
|
||||
// for each unique field name.
|
||||
|
||||
wxString ref = aSymbol->GetRef( aSheet );
|
||||
wxString ref = aSymbol->GetRef( &aSheet );
|
||||
|
||||
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
|
||||
int minUnit = aSymbol->GetUnitSelection( aSheet );
|
||||
int minUnit = aSymbol->GetUnitSelection( &aSheet );
|
||||
|
||||
for( unsigned i = 0; i < sheetList.size(); i++ )
|
||||
for( const SCH_SHEET_PATH& sheet : aSheetList )
|
||||
{
|
||||
for( SCH_ITEM* item : sheetList[i].LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||
{
|
||||
SCH_SYMBOL* symbol2 = static_cast<SCH_SYMBOL*>( item );
|
||||
|
||||
wxString ref2 = symbol2->GetRef( &sheetList[i] );
|
||||
wxString ref2 = symbol2->GetRef( &sheet );
|
||||
|
||||
if( ref2.CmpNoCase( ref ) != 0 )
|
||||
continue;
|
||||
|
||||
int unit = symbol2->GetUnitSelection( aSheet );
|
||||
int unit = symbol2->GetUnitSelection( &aSheet );
|
||||
|
||||
// The lowest unit number wins. User should only set fields in any one unit.
|
||||
|
||||
// Value
|
||||
candidate = symbol2->GetValue( m_resolveTextVars, &sheetList[i], false );
|
||||
candidate = symbol2->GetValue( m_resolveTextVars, &sheet, false );
|
||||
|
||||
if( !candidate.IsEmpty() && ( unit < minUnit || value.IsEmpty() ) )
|
||||
value = candidate;
|
||||
|
||||
// Footprint
|
||||
candidate = symbol2->GetFootprintFieldText( m_resolveTextVars, &sheetList[i], false );
|
||||
candidate = symbol2->GetFootprintFieldText( m_resolveTextVars, &sheet, false );
|
||||
|
||||
if( !candidate.IsEmpty() && ( unit < minUnit || footprint.IsEmpty() ) )
|
||||
footprint = candidate;
|
||||
|
||||
// Datasheet
|
||||
candidate = m_resolveTextVars
|
||||
? symbol2->GetField( DATASHEET_FIELD )->GetShownText( &sheetList[i], false )
|
||||
? symbol2->GetField( DATASHEET_FIELD )->GetShownText( &sheet, false )
|
||||
: symbol2->GetField( DATASHEET_FIELD )->GetText();
|
||||
|
||||
if( !candidate.IsEmpty() && ( unit < minUnit || datasheet.IsEmpty() ) )
|
||||
|
@ -153,7 +153,7 @@ void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol,
|
|||
|
||||
// Description
|
||||
candidate = m_resolveTextVars
|
||||
? symbol2->GetField( DESCRIPTION_FIELD )->GetShownText( &sheetList[i], false )
|
||||
? symbol2->GetField( DESCRIPTION_FIELD )->GetShownText( &sheet, false )
|
||||
: symbol2->GetField( DESCRIPTION_FIELD )->GetText();
|
||||
|
||||
if( !candidate.IsEmpty() && ( unit < minUnit || description.IsEmpty() ) )
|
||||
|
@ -167,7 +167,7 @@ void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol,
|
|||
if( unit < minUnit || fields.count( f.GetName() ) == 0 )
|
||||
{
|
||||
if( m_resolveTextVars )
|
||||
fields[f.GetName()] = f.GetShownText( aSheet, false );
|
||||
fields[f.GetName()] = f.GetShownText( &aSheet, false );
|
||||
else
|
||||
fields[f.GetName()] = f.GetText();
|
||||
}
|
||||
|
@ -179,21 +179,21 @@ void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol,
|
|||
}
|
||||
else
|
||||
{
|
||||
value = aSymbol->GetValue( m_resolveTextVars, aSheet, false );
|
||||
footprint = aSymbol->GetFootprintFieldText( m_resolveTextVars, aSheet, false );
|
||||
value = aSymbol->GetValue( m_resolveTextVars, &aSheet, false );
|
||||
footprint = aSymbol->GetFootprintFieldText( m_resolveTextVars, &aSheet, false );
|
||||
|
||||
SCH_FIELD* datasheetField = aSymbol->GetField( DATASHEET_FIELD );
|
||||
SCH_FIELD* descriptionField = aSymbol->GetField( DESCRIPTION_FIELD );
|
||||
|
||||
// Datasheet
|
||||
if( m_resolveTextVars )
|
||||
datasheet = datasheetField->GetShownText( aSheet, false );
|
||||
datasheet = datasheetField->GetShownText( &aSheet, false );
|
||||
else
|
||||
datasheet = datasheetField->GetText();
|
||||
|
||||
// Description
|
||||
if( m_resolveTextVars )
|
||||
description = descriptionField->GetShownText( aSheet, false );
|
||||
description = descriptionField->GetShownText( &aSheet, false );
|
||||
else
|
||||
description = descriptionField->GetText();
|
||||
|
||||
|
@ -202,7 +202,7 @@ void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol,
|
|||
const SCH_FIELD& f = aSymbol->GetFields()[ ii ];
|
||||
|
||||
if( m_resolveTextVars )
|
||||
fields[f.GetName()] = f.GetShownText( aSheet, false );
|
||||
fields[f.GetName()] = f.GetShownText( &aSheet, false );
|
||||
else
|
||||
fields[f.GetName()] = f.GetText();
|
||||
}
|
||||
|
@ -246,21 +246,20 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
|
|||
m_referencesAlreadyFound.Clear();
|
||||
m_libParts.clear();
|
||||
|
||||
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
|
||||
SCH_SHEET_PATH currentSheet = m_schematic->CurrentSheet();
|
||||
SCH_SHEET_LIST sheetList = m_schematic->BuildSheetListSortedByPageNumbers();
|
||||
|
||||
// Output is xml, so there is no reason to remove spaces from the field values.
|
||||
// And XML element names need not be translated to various languages.
|
||||
|
||||
for( unsigned ii = 0; ii < sheetList.size(); ii++ )
|
||||
for( const SCH_SHEET_PATH& sheet : sheetList )
|
||||
{
|
||||
SCH_SHEET_PATH sheet = sheetList[ii];
|
||||
|
||||
// Change schematic CurrentSheet in each iteration to allow hierarchical
|
||||
// resolution of text variables in sheet fields.
|
||||
m_schematic->SetCurrentSheet( sheet );
|
||||
|
||||
auto cmp = [sheet]( SCH_SYMBOL* a, SCH_SYMBOL* b )
|
||||
auto cmp =
|
||||
[sheet]( SCH_SYMBOL* a, SCH_SYMBOL* b )
|
||||
{
|
||||
return ( StrNumCmp( a->GetRef( &sheet, false ),
|
||||
b->GetRef( &sheet, false ), true ) < 0 );
|
||||
|
@ -291,7 +290,7 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
|
|||
|
||||
for( EDA_ITEM* item : ordered_symbols )
|
||||
{
|
||||
SCH_SYMBOL* symbol = findNextSymbol( item, &sheet );
|
||||
SCH_SYMBOL* symbol = findNextSymbol( item, sheet );
|
||||
bool forBOM = aCtl & GNL_OPT_BOM;
|
||||
bool forBoard = aCtl & GNL_OPT_KICAD;
|
||||
|
||||
|
@ -312,7 +311,7 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
|
|||
xcomps->AddChild( xcomp = node( wxT( "comp" ) ) );
|
||||
|
||||
xcomp->AddAttribute( wxT( "ref" ), symbol->GetRef( &sheet ) );
|
||||
addSymbolFields( xcomp, symbol, &sheet );
|
||||
addSymbolFields( xcomp, symbol, sheet, sheetList );
|
||||
|
||||
XNODE* xlibsource;
|
||||
xcomp->AddChild( xlibsource = node( wxT( "libsource" ) ) );
|
||||
|
@ -476,21 +475,19 @@ XNODE* NETLIST_EXPORTER_XML::makeDesignHeader()
|
|||
/*
|
||||
* Export the sheets information
|
||||
*/
|
||||
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
|
||||
unsigned sheetIndex = 1; // Human readable index
|
||||
|
||||
for( unsigned i = 0; i < sheetList.size(); i++ )
|
||||
for( const SCH_SHEET_PATH& sheet : m_schematic->BuildSheetListSortedByPageNumbers() )
|
||||
{
|
||||
screen = sheetList[i].LastScreen();
|
||||
screen = sheet.LastScreen();
|
||||
|
||||
xdesign->AddChild( xsheet = node( wxT( "sheet" ) ) );
|
||||
|
||||
// get the string representation of the sheet index number.
|
||||
// Note that sheet->GetIndex() is zero index base and we need to increment the
|
||||
// number by one to make it human readable
|
||||
sheetTxt.Printf( wxT( "%u" ), i + 1 );
|
||||
sheetTxt.Printf( wxT( "%u" ), sheetIndex++ );
|
||||
xsheet->AddAttribute( wxT( "number" ), sheetTxt );
|
||||
xsheet->AddAttribute( wxT( "name" ), sheetList[i].PathHumanReadable() );
|
||||
xsheet->AddAttribute( wxT( "tstamps" ), sheetList[i].PathAsString() );
|
||||
xsheet->AddAttribute( wxT( "name" ), sheet.PathHumanReadable() );
|
||||
xsheet->AddAttribute( wxT( "tstamps" ), sheet.PathAsString() );
|
||||
|
||||
TITLE_BLOCK tb = screen->GetTitleBlock();
|
||||
PROJECT* prj = &m_schematic->Prj();
|
||||
|
|
|
@ -130,7 +130,8 @@ protected:
|
|||
*/
|
||||
XNODE* makeLibraries();
|
||||
|
||||
void addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aSheet );
|
||||
void addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol, const SCH_SHEET_PATH& aSheet,
|
||||
const SCH_SHEET_LIST& aSheetList);
|
||||
|
||||
bool m_resolveTextVars; // Export textVar references resolved
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileNam
|
|||
unsigned aNetlistOptions, REPORTER* aReporter )
|
||||
{
|
||||
// Ensure all power symbols have a valid reference
|
||||
Schematic().GetSheets().AnnotatePowerSymbols();
|
||||
Schematic().BuildSheetListSortedByPageNumbers().AnnotatePowerSymbols();
|
||||
|
||||
if( !ReadyToNetlist( _( "Exporting netlist requires a fully annotated schematic." ) ) )
|
||||
return false;
|
||||
|
@ -192,7 +192,7 @@ bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileNam
|
|||
bool SCH_EDIT_FRAME::ReadyToNetlist( const wxString& aAnnotateMessage )
|
||||
{
|
||||
// Ensure all power symbols have a valid reference
|
||||
Schematic().GetSheets().AnnotatePowerSymbols();
|
||||
Schematic().BuildSheetListSortedByPageNumbers().AnnotatePowerSymbols();
|
||||
|
||||
// Symbols must be annotated
|
||||
if( CheckAnnotate( []( ERCE_T, const wxString&, SCH_REFERENCE*, SCH_REFERENCE* ) {} ) )
|
||||
|
|
|
@ -69,7 +69,7 @@ bool SCH_PRINTOUT::OnBeginDocument( int startPage, int endPage )
|
|||
|
||||
bool SCH_PRINTOUT::OnPrintPage( int page )
|
||||
{
|
||||
SCH_SHEET_LIST sheetList = m_parent->Schematic().GetSheets();
|
||||
SCH_SHEET_LIST sheetList = m_parent->Schematic().BuildSheetListSortedByPageNumbers();
|
||||
|
||||
wxCHECK_MSG( page >= 1 && page <= (int)sheetList.size(), false,
|
||||
wxT( "Cannot print invalid page number." ) );
|
||||
|
|
|
@ -567,7 +567,7 @@ void SCH_COMMIT::Revert()
|
|||
{
|
||||
// Lazy eval of sheet list; this is expensive even when unsorted
|
||||
if( sheets.empty() )
|
||||
sheets = schematic->GetUnorderedSheets();
|
||||
sheets = schematic->BuildUnorderedSheetList();
|
||||
|
||||
SCH_SHEET_PATH sheet = sheets.FindSheetForScreen( screen );
|
||||
symbol->SetRef( &sheet, field->GetText() );
|
||||
|
|
|
@ -178,7 +178,10 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
|
||||
// NB: also links the schematic to the loaded project
|
||||
CreateScreens();
|
||||
SetCurrentSheet( Schematic().GetSheets()[0] );
|
||||
|
||||
SCH_SHEET_PATH root;
|
||||
root.push_back( &Schematic().Root() );
|
||||
SetCurrentSheet( root );
|
||||
|
||||
setupTools();
|
||||
setupUIConditions();
|
||||
|
@ -714,20 +717,6 @@ void SCH_EDIT_FRAME::setupUIConditions()
|
|||
return navigateTool && navigateTool->CanGoUp();
|
||||
};
|
||||
|
||||
auto navSchematicHasPreviousSheet =
|
||||
[this]( const SELECTION& aSel )
|
||||
{
|
||||
SCH_NAVIGATE_TOOL* navigateTool = m_toolManager->GetTool<SCH_NAVIGATE_TOOL>();
|
||||
return navigateTool && navigateTool->CanGoPrevious();
|
||||
};
|
||||
|
||||
auto navSchematicHasNextSheet =
|
||||
[this]( const SELECTION& aSel )
|
||||
{
|
||||
SCH_NAVIGATE_TOOL* navigateTool = m_toolManager->GetTool<SCH_NAVIGATE_TOOL>();
|
||||
return navigateTool && navigateTool->CanGoNext();
|
||||
};
|
||||
|
||||
mgr->SetConditions( EE_ACTIONS::leaveSheet, ENABLE( belowRootSheetCondition ) );
|
||||
|
||||
/* Some of these are bound by default to arrow keys which will get a different action if we
|
||||
|
@ -738,8 +727,6 @@ void SCH_EDIT_FRAME::setupUIConditions()
|
|||
mgr->SetConditions( EE_ACTIONS::navigateBack, ENABLE( navHistoryHsBackward ) );
|
||||
*/
|
||||
|
||||
mgr->SetConditions( EE_ACTIONS::navigatePrevious, ENABLE( navSchematicHasPreviousSheet ) );
|
||||
mgr->SetConditions( EE_ACTIONS::navigateNext, ENABLE( navSchematicHasNextSheet ) );
|
||||
mgr->SetConditions( EE_ACTIONS::remapSymbols, ENABLE( remapSymbolsCondition ) );
|
||||
mgr->SetConditions( EE_ACTIONS::toggleHiddenPins, CHECK( showHiddenPinsCond ) );
|
||||
mgr->SetConditions( EE_ACTIONS::toggleHiddenFields, CHECK( showHiddenFieldsCond ) );
|
||||
|
@ -1011,7 +998,7 @@ bool SCH_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
|
|||
|
||||
void SCH_EDIT_FRAME::doCloseWindow()
|
||||
{
|
||||
SCH_SHEET_LIST sheetlist = Schematic().GetUnorderedSheets();
|
||||
SCH_SHEET_LIST sheetlist = Schematic().BuildUnorderedSheetList();
|
||||
|
||||
// Shutdown all running tools
|
||||
if( m_toolManager )
|
||||
|
@ -1723,7 +1710,7 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FL
|
|||
wxString highlightedConn = GetHighlightedConnection();
|
||||
bool hasHighlightedConn = !highlightedConn.IsEmpty();
|
||||
SCHEMATIC_SETTINGS& settings = Schematic().Settings();
|
||||
SCH_SHEET_LIST list = Schematic().GetSheets();
|
||||
SCH_SHEET_LIST list = Schematic().BuildSheetListSortedByPageNumbers();
|
||||
SCH_COMMIT localCommit( m_toolManager );
|
||||
|
||||
if( !aCommit )
|
||||
|
@ -2199,7 +2186,7 @@ const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
|
|||
|
||||
bool SCH_EDIT_FRAME::IsContentModified() const
|
||||
{
|
||||
return Schematic().GetUnorderedSheets().IsModified();
|
||||
return Schematic().BuildUnorderedSheetList().IsModified();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2271,7 +2258,8 @@ void SCH_EDIT_FRAME::SaveSymbolToSchematic( const LIB_SYMBOL& aSymbol,
|
|||
const KIID& aSchematicSymbolUUID )
|
||||
{
|
||||
SCH_SHEET_PATH principalPath;
|
||||
SCH_ITEM* item = Schematic().GetSheets().GetItem( aSchematicSymbolUUID, &principalPath );
|
||||
SCH_SHEET_LIST sheets = Schematic().BuildUnorderedSheetList();
|
||||
SCH_ITEM* item = sheets.GetItem( aSchematicSymbolUUID, &principalPath );
|
||||
SCH_SYMBOL* principalSymbol = dynamic_cast<SCH_SYMBOL*>( item );
|
||||
SCH_COMMIT commit( m_toolManager );
|
||||
|
||||
|
@ -2285,7 +2273,7 @@ void SCH_EDIT_FRAME::SaveSymbolToSchematic( const LIB_SYMBOL& aSymbol,
|
|||
|
||||
std::vector< std::pair<SCH_SYMBOL*, SCH_SHEET_PATH> > allUnits;
|
||||
|
||||
for( const SCH_SHEET_PATH& path : Schematic().GetSheets() )
|
||||
for( const SCH_SHEET_PATH& path : sheets )
|
||||
{
|
||||
for( SCH_ITEM* candidate : path.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||
{
|
||||
|
|
|
@ -858,7 +858,7 @@ void SCH_FIELD::OnScintillaCharAdded( SCINTILLA_TRICKS* aScintillaTricks,
|
|||
SCH_REFERENCE_LIST refs;
|
||||
SCH_SYMBOL* refSymbol = nullptr;
|
||||
|
||||
schematic->GetUnorderedSheets().GetSymbols( refs );
|
||||
schematic->BuildUnorderedSheetList().GetSymbols( refs );
|
||||
|
||||
for( size_t jj = 0; jj < refs.GetCount(); jj++ )
|
||||
{
|
||||
|
|
|
@ -141,7 +141,7 @@ SCH_SHEET* SCH_IO_CADSTAR_ARCHIVE::LoadSchematicFile( const wxString& aFi
|
|||
sch_plugin->SaveLibrary( libFileName.GetFullPath() );
|
||||
|
||||
// Link up all symbols in the design to the newly created library
|
||||
for( SCH_SHEET_PATH& sheet : aSchematic->GetSheets() )
|
||||
for( SCH_SHEET_PATH& sheet : aSchematic->BuildUnorderedSheetList() )
|
||||
{
|
||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||
{
|
||||
|
|
|
@ -362,6 +362,7 @@ void SCH_IO_KICAD_SEXPR::Format( SCH_SHEET* aSheet )
|
|||
wxCHECK_RET( aSheet != nullptr, "NULL SCH_SHEET* object." );
|
||||
wxCHECK_RET( m_schematic != nullptr, "NULL SCHEMATIC* object." );
|
||||
|
||||
SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
|
||||
SCH_SCREEN* screen = aSheet->GetScreen();
|
||||
|
||||
wxCHECK( screen, /* void */ );
|
||||
|
@ -426,7 +427,7 @@ void SCH_IO_KICAD_SEXPR::Format( SCH_SHEET* aSheet )
|
|||
{
|
||||
case SCH_SYMBOL_T:
|
||||
m_out->Print( 0, "\n" );
|
||||
saveSymbol( static_cast<SCH_SYMBOL*>( item ), *m_schematic, 1, false );
|
||||
saveSymbol( static_cast<SCH_SYMBOL*>( item ), *m_schematic, sheets, 1, false );
|
||||
break;
|
||||
|
||||
case SCH_BITMAP_T:
|
||||
|
@ -435,7 +436,7 @@ void SCH_IO_KICAD_SEXPR::Format( SCH_SHEET* aSheet )
|
|||
|
||||
case SCH_SHEET_T:
|
||||
m_out->Print( 0, "\n" );
|
||||
saveSheet( static_cast<SCH_SHEET*>( item ), 1 );
|
||||
saveSheet( static_cast<SCH_SHEET*>( item ), sheets, 1 );
|
||||
break;
|
||||
|
||||
case SCH_JUNCTION_T:
|
||||
|
@ -516,7 +517,7 @@ void SCH_IO_KICAD_SEXPR::Format( EE_SELECTION* aSelection, SCH_SHEET_PATH* aSele
|
|||
wxCHECK( aSelection && aSelectionPath && aFormatter, /* void */ );
|
||||
|
||||
LOCALE_IO toggle;
|
||||
SCH_SHEET_LIST fullHierarchy = aSchematic.GetSheets();
|
||||
SCH_SHEET_LIST sheets = aSchematic.BuildSheetListSortedByPageNumbers();
|
||||
|
||||
m_schematic = &aSchematic;
|
||||
m_out = aFormatter;
|
||||
|
@ -580,7 +581,7 @@ void SCH_IO_KICAD_SEXPR::Format( EE_SELECTION* aSelection, SCH_SHEET_PATH* aSele
|
|||
break;
|
||||
|
||||
case SCH_SHEET_T:
|
||||
saveSheet( static_cast< SCH_SHEET* >( item ), 0 );
|
||||
saveSheet( static_cast< SCH_SHEET* >( item ), sheets, 0 );
|
||||
break;
|
||||
|
||||
case SCH_JUNCTION_T:
|
||||
|
@ -647,6 +648,7 @@ void SCH_IO_KICAD_SEXPR::Format( EE_SELECTION* aSelection, SCH_SHEET_PATH* aSele
|
|||
|
||||
|
||||
void SCH_IO_KICAD_SEXPR::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSchematic,
|
||||
const SCH_SHEET_LIST& aSheetList,
|
||||
int aNestLevel, bool aForClipboard,
|
||||
const SCH_SHEET_PATH* aRelativePath )
|
||||
{
|
||||
|
@ -711,9 +713,8 @@ void SCH_IO_KICAD_SEXPR::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSche
|
|||
|
||||
// The symbol unit is always set to the first instance regardless of the current sheet
|
||||
// instance to prevent file churn.
|
||||
int unit = ( aSymbol->GetInstances().size() == 0 ) ?
|
||||
aSymbol->GetUnit() :
|
||||
aSymbol->GetInstances()[0].m_Unit;
|
||||
int unit = ( aSymbol->GetInstances().size() == 0 ) ? aSymbol->GetUnit()
|
||||
: aSymbol->GetInstances()[0].m_Unit;
|
||||
|
||||
if( aForClipboard && aRelativePath )
|
||||
{
|
||||
|
@ -819,7 +820,6 @@ void SCH_IO_KICAD_SEXPR::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSche
|
|||
wxString projectName;
|
||||
KIID lastProjectUuid;
|
||||
KIID rootSheetUuid = aSchematic.Root().m_Uuid;
|
||||
SCH_SHEET_LIST fullHierarchy = aSchematic.GetSheets();
|
||||
|
||||
for( const SCH_SYMBOL_INSTANCE& inst : aSymbol->GetInstances() )
|
||||
{
|
||||
|
@ -830,7 +830,7 @@ void SCH_IO_KICAD_SEXPR::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSche
|
|||
// path, don't save it. This prevents large amounts of orphaned instance data for the
|
||||
// current project from accumulating in the schematic files.
|
||||
bool isOrphaned = ( inst.m_Path[0] == rootSheetUuid )
|
||||
&& !fullHierarchy.GetSheetPathByKIIDPath( inst.m_Path );
|
||||
&& !aSheetList.GetSheetPathByKIIDPath( inst.m_Path );
|
||||
|
||||
// Keep all instance data when copying to the clipboard. They may be needed on paste.
|
||||
if( !aForClipboard && isOrphaned )
|
||||
|
@ -998,7 +998,8 @@ void SCH_IO_KICAD_SEXPR::saveBitmap( SCH_BITMAP* aBitmap, int aNestLevel )
|
|||
}
|
||||
|
||||
|
||||
void SCH_IO_KICAD_SEXPR::saveSheet( SCH_SHEET* aSheet, int aNestLevel )
|
||||
void SCH_IO_KICAD_SEXPR::saveSheet( SCH_SHEET* aSheet, const SCH_SHEET_LIST& aSheetList,
|
||||
int aNestLevel )
|
||||
{
|
||||
wxCHECK_RET( aSheet != nullptr && m_out != nullptr, "" );
|
||||
|
||||
|
@ -1081,7 +1082,6 @@ void SCH_IO_KICAD_SEXPR::saveSheet( SCH_SHEET* aSheet, int aNestLevel )
|
|||
|
||||
KIID lastProjectUuid;
|
||||
KIID rootSheetUuid = m_schematic->Root().m_Uuid;
|
||||
SCH_SHEET_LIST fullHierarchy = m_schematic->GetSheets();
|
||||
bool project_open = false;
|
||||
|
||||
for( size_t i = 0; i < sheetInstances.size(); i++ )
|
||||
|
@ -1092,7 +1092,7 @@ void SCH_IO_KICAD_SEXPR::saveSheet( SCH_SHEET* aSheet, int aNestLevel )
|
|||
//
|
||||
// Keep all instance data when copying to the clipboard. It may be needed on paste.
|
||||
if( ( sheetInstances[i].m_Path[0] == rootSheetUuid )
|
||||
&& !fullHierarchy.GetSheetPathByKIIDPath( sheetInstances[i].m_Path, false ) )
|
||||
&& !aSheetList.GetSheetPathByKIIDPath( sheetInstances[i].m_Path, false ) )
|
||||
{
|
||||
if( project_open && ( ( i + 1 == sheetInstances.size() )
|
||||
|| lastProjectUuid != sheetInstances[i+1].m_Path[0] ) )
|
||||
|
|
|
@ -142,11 +142,12 @@ private:
|
|||
void loadHierarchy( const SCH_SHEET_PATH& aParentSheetPath, SCH_SHEET* aSheet );
|
||||
void loadFile( const wxString& aFileName, SCH_SHEET* aSheet );
|
||||
|
||||
void saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSchematic, int aNestLevel,
|
||||
void saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSchematic,
|
||||
const SCH_SHEET_LIST& aSheetList, int aNestLevel,
|
||||
bool aForClipboard, const SCH_SHEET_PATH* aRelativePath = nullptr );
|
||||
void saveField( SCH_FIELD* aField, int aNestLevel );
|
||||
void saveBitmap( SCH_BITMAP* aBitmap, int aNestLevel );
|
||||
void saveSheet( SCH_SHEET* aSheet, int aNestLevel );
|
||||
void saveSheet( SCH_SHEET* aSheet, const SCH_SHEET_LIST& aSheetList, int aNestLevel );
|
||||
void saveJunction( SCH_JUNCTION* aJunction, int aNestLevel );
|
||||
void saveNoConnect( SCH_NO_CONNECT* aNoConnect, int aNestLevel );
|
||||
void saveBusEntry( SCH_BUS_ENTRY_BASE* aBusEntry, int aNestLevel );
|
||||
|
|
|
@ -1756,7 +1756,7 @@ void SCH_SCREENS::ClearAnnotationOfNewSheetPaths( SCH_SHEET_LIST& aInitialSheetP
|
|||
|
||||
// Search for new sheet paths, not existing in aInitialSheetPathList
|
||||
// and existing in sheetpathList
|
||||
for( SCH_SHEET_PATH& sheetpath : sch->GetSheets() )
|
||||
for( SCH_SHEET_PATH& sheetpath : sch->BuildSheetListSortedByPageNumbers() )
|
||||
{
|
||||
bool path_exists = false;
|
||||
|
||||
|
@ -1896,7 +1896,7 @@ void SCH_SCREENS::UpdateSymbolLinks( REPORTER* aReporter )
|
|||
|
||||
wxCHECK_RET( sch, "Null schematic in SCH_SCREENS::UpdateSymbolLinks" );
|
||||
|
||||
SCH_SHEET_LIST sheets = sch->GetSheets();
|
||||
SCH_SHEET_LIST sheets = sch->BuildSheetListSortedByPageNumbers();
|
||||
|
||||
// All of the library symbols have been replaced with copies so the connection graph
|
||||
// pointers are stale.
|
||||
|
@ -1995,7 +1995,7 @@ void SCH_SCREENS::BuildClientSheetPathList()
|
|||
for( SCH_SCREEN* curr_screen = GetFirst(); curr_screen; curr_screen = GetNext() )
|
||||
curr_screen->GetClientSheetPaths().clear();
|
||||
|
||||
for( SCH_SHEET_PATH& sheetpath : sch->GetSheets() )
|
||||
for( SCH_SHEET_PATH& sheetpath : sch->BuildSheetListSortedByPageNumbers() )
|
||||
{
|
||||
SCH_SCREEN* used_screen = sheetpath.LastScreen();
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ bool SCH_SHEET::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, in
|
|||
}
|
||||
else if( token->IsSameAs( wxT( "##" ) ) )
|
||||
{
|
||||
*token = wxString::Format( wxT( "%d" ), (int) schematic->GetUnorderedSheets().size() );
|
||||
*token = wxString::Format( wxT( "%d" ), (int) schematic->BuildUnorderedSheetList().size() );
|
||||
return true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "SHEETPATH" ) ) )
|
||||
|
|
|
@ -711,15 +711,10 @@ void SCH_SHEET_PATH::MakeFilePathRelativeToParentSheet()
|
|||
}
|
||||
|
||||
|
||||
SCH_SHEET_LIST::SCH_SHEET_LIST( SCH_SHEET* aSheet, bool aCheckIntegrity )
|
||||
SCH_SHEET_LIST::SCH_SHEET_LIST( SCH_SHEET* aSheet )
|
||||
{
|
||||
if( aSheet != nullptr )
|
||||
{
|
||||
BuildSheetList( aSheet, aCheckIntegrity );
|
||||
|
||||
if( aSheet->IsRootSheet() )
|
||||
SortByPageNumbers();
|
||||
}
|
||||
BuildSheetList( aSheet, false );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -471,7 +471,7 @@ public:
|
|||
*
|
||||
* If aSheet == NULL, then this is an empty hierarchy which the user can populate.
|
||||
*/
|
||||
SCH_SHEET_LIST( SCH_SHEET* aSheet = nullptr, bool aCheckIntegrity = false );
|
||||
SCH_SHEET_LIST( SCH_SHEET* aSheet = nullptr );
|
||||
|
||||
~SCH_SHEET_LIST() {}
|
||||
|
||||
|
@ -595,7 +595,7 @@ public:
|
|||
*
|
||||
* If \a aSheet is the root sheet, the full sheet path and sheet list are built.
|
||||
*
|
||||
* The list will be ordered as per #SCH_SCREEN::GetSheets which results in sheets being ordered
|
||||
* The list will be ordered as per #SCH_SCREEN::BuildSheetList which results in sheets being ordered
|
||||
* in the legacy way of using the X and Y positions of the sheets.
|
||||
*
|
||||
* @see #SortByPageNumbers to sort by page numbers
|
||||
|
|
|
@ -72,7 +72,7 @@ SCHEMATIC::SCHEMATIC( PROJECT* aPrj ) :
|
|||
int unit = symbol->GetUnit();
|
||||
LIB_ID libId = symbol->GetLibId();
|
||||
|
||||
for( SCH_SHEET_PATH& sheet : GetUnorderedSheets() )
|
||||
for( SCH_SHEET_PATH& sheet : BuildUnorderedSheetList() )
|
||||
{
|
||||
std::vector<SCH_SYMBOL*> otherUnits;
|
||||
|
||||
|
@ -302,7 +302,7 @@ ERC_SETTINGS& SCHEMATIC::ErcSettings() const
|
|||
|
||||
std::vector<SCH_MARKER*> SCHEMATIC::ResolveERCExclusions()
|
||||
{
|
||||
SCH_SHEET_LIST sheetList = GetSheets();
|
||||
SCH_SHEET_LIST sheetList = BuildUnorderedSheetList();
|
||||
ERC_SETTINGS& settings = ErcSettings();
|
||||
|
||||
// Migrate legacy marker exclusions to new format to ensure exclusion matching functions across
|
||||
|
@ -384,7 +384,7 @@ std::vector<SCH_MARKER*> SCHEMATIC::ResolveERCExclusions()
|
|||
|
||||
std::shared_ptr<BUS_ALIAS> SCHEMATIC::GetBusAlias( const wxString& aLabel ) const
|
||||
{
|
||||
for( const SCH_SHEET_PATH& sheet : GetUnorderedSheets() )
|
||||
for( const SCH_SHEET_PATH& sheet : BuildUnorderedSheetList() )
|
||||
{
|
||||
for( const std::shared_ptr<BUS_ALIAS>& alias : sheet.LastScreen()->GetBusAliases() )
|
||||
{
|
||||
|
@ -454,7 +454,7 @@ std::map<int, wxString> SCHEMATIC::GetVirtualPageToSheetNamesMap() const
|
|||
{
|
||||
std::map<int, wxString> namesMap;
|
||||
|
||||
for( const SCH_SHEET_PATH& sheet : GetUnorderedSheets() )
|
||||
for( const SCH_SHEET_PATH& sheet : BuildUnorderedSheetList() )
|
||||
{
|
||||
if( sheet.size() == 1 )
|
||||
namesMap[sheet.GetVirtualPageNumber()] = _( "<root sheet>" );
|
||||
|
@ -470,7 +470,7 @@ std::map<int, wxString> SCHEMATIC::GetVirtualPageToSheetPagesMap() const
|
|||
{
|
||||
std::map<int, wxString> pagesMap;
|
||||
|
||||
for( const SCH_SHEET_PATH& sheet : GetUnorderedSheets() )
|
||||
for( const SCH_SHEET_PATH& sheet : BuildUnorderedSheetList() )
|
||||
pagesMap[sheet.GetVirtualPageNumber()] = sheet.GetPageNumber();
|
||||
|
||||
return pagesMap;
|
||||
|
@ -518,7 +518,7 @@ wxString SCHEMATIC::ConvertRefsToKIIDs( const wxString& aSource ) const
|
|||
wxString ref = token.BeforeFirst( ':', &remainder );
|
||||
SCH_REFERENCE_LIST references;
|
||||
|
||||
GetUnorderedSheets().GetSymbols( references );
|
||||
BuildUnorderedSheetList().GetSymbols( references );
|
||||
|
||||
for( size_t jj = 0; jj < references.GetCount(); jj++ )
|
||||
{
|
||||
|
@ -641,7 +641,7 @@ void SCHEMATIC::SetSheetNumberAndCount()
|
|||
|
||||
// @todo Remove all pseudo page number system is left over from prior to real page number
|
||||
// implementation.
|
||||
for( const SCH_SHEET_PATH& sheet : GetSheets() )
|
||||
for( const SCH_SHEET_PATH& sheet : BuildSheetListSortedByPageNumbers() )
|
||||
{
|
||||
if( sheet.Path() == current_sheetpath ) // Current sheet path found
|
||||
break;
|
||||
|
@ -664,7 +664,7 @@ void SCHEMATIC::RecomputeIntersheetRefs( const std::function<void( SCH_GLOBALLAB
|
|||
|
||||
pageRefsMap.clear();
|
||||
|
||||
for( const SCH_SHEET_PATH& sheet : GetSheets() )
|
||||
for( const SCH_SHEET_PATH& sheet : BuildSheetListSortedByPageNumbers() )
|
||||
{
|
||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_GLOBAL_LABEL_T ) )
|
||||
{
|
||||
|
@ -802,7 +802,8 @@ void SCHEMATIC::RemoveAllListeners()
|
|||
|
||||
void SCHEMATIC::RecordERCExclusions()
|
||||
{
|
||||
SCH_SHEET_LIST sheetList = GetSheets();
|
||||
// Use a sorted sheetList to reduce file churn
|
||||
SCH_SHEET_LIST sheetList = BuildSheetListSortedByPageNumbers();
|
||||
ERC_SETTINGS& ercSettings = ErcSettings();
|
||||
|
||||
ercSettings.m_ErcExclusions.clear();
|
||||
|
@ -827,7 +828,7 @@ void SCHEMATIC::RecordERCExclusions()
|
|||
|
||||
void SCHEMATIC::ResolveERCExclusionsPostUpdate()
|
||||
{
|
||||
SCH_SHEET_LIST sheetList = GetUnorderedSheets();
|
||||
SCH_SHEET_LIST sheetList = BuildUnorderedSheetList();
|
||||
|
||||
for( SCH_MARKER* marker : ResolveERCExclusions() )
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
virtual ~SCHEMATIC_IFACE() {};
|
||||
|
||||
virtual CONNECTION_GRAPH* ConnectionGraph() const = 0;
|
||||
virtual SCH_SHEET_LIST GetSheets() const = 0;
|
||||
virtual SCH_SHEET_LIST BuildSheetListSortedByPageNumbers() const = 0;
|
||||
virtual void SetCurrentSheet( const SCH_SHEET_PATH& aPath ) = 0;
|
||||
virtual SCH_SHEET_PATH& CurrentSheet() const = 0;
|
||||
virtual wxString GetFileName() const = 0;
|
||||
|
@ -92,17 +92,12 @@ public:
|
|||
|
||||
const std::map<wxString, wxString>* GetProperties() { return &m_properties; }
|
||||
|
||||
/**
|
||||
* Builds and returns an updated schematic hierarchy
|
||||
* TODO: can this be cached?
|
||||
* @return a SCH_SHEET_LIST containing the schematic hierarchy
|
||||
*/
|
||||
SCH_SHEET_LIST GetSheets() const override
|
||||
SCH_SHEET_LIST BuildSheetListSortedByPageNumbers() const override
|
||||
{
|
||||
return SCH_SHEET_LIST( m_rootSheet );
|
||||
}
|
||||
|
||||
SCH_SHEET_LIST GetUnorderedSheets() const
|
||||
SCH_SHEET_LIST BuildUnorderedSheetList() const
|
||||
{
|
||||
SCH_SHEET_LIST sheets;
|
||||
sheets.BuildSheetList( m_rootSheet, false );
|
||||
|
@ -111,7 +106,7 @@ public:
|
|||
|
||||
SCH_ITEM* GetItem( const KIID& aID, SCH_SHEET_PATH* aPathOut = nullptr ) const
|
||||
{
|
||||
return GetUnorderedSheets().GetItem( aID, aPathOut );
|
||||
return BuildUnorderedSheetList().GetItem( aID, aPathOut );
|
||||
}
|
||||
|
||||
SCH_SHEET& Root() const
|
||||
|
|
|
@ -374,7 +374,7 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
|||
{
|
||||
// Lazy eval of sheet list; this is expensive even when unsorted
|
||||
if( sheets.empty() )
|
||||
sheets = m_schematic->GetUnorderedSheets();
|
||||
sheets = m_schematic->BuildUnorderedSheetList();
|
||||
|
||||
SCH_SHEET_PATH undoSheet = sheets.FindSheetForScreen( screen );
|
||||
|
||||
|
@ -435,7 +435,7 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
|||
{
|
||||
// Lazy eval of sheet list; this is expensive even when unsorted
|
||||
if( sheets.empty() )
|
||||
sheets = m_schematic->GetUnorderedSheets();
|
||||
sheets = m_schematic->BuildUnorderedSheetList();
|
||||
|
||||
SCH_SHEET_PATH sheet = sheets.FindSheetForScreen( screen );
|
||||
symbol->SetRef( &sheet, field->GetText() );
|
||||
|
|
|
@ -53,8 +53,8 @@ bool SCH_EDIT_FRAME::CheckSheetForRecursion( SCH_SHEET* aSheet, SCH_SHEET_PATH*
|
|||
wxASSERT( aSheet && aCurrentSheet );
|
||||
|
||||
wxString msg;
|
||||
SCH_SHEET_LIST hierarchy = Schematic().GetSheets(); // The full schematic sheet hierarchy.
|
||||
SCH_SHEET_LIST sheetHierarchy( aSheet ); // This is the hierarchy of the loaded file.
|
||||
SCH_SHEET_LIST schematicSheets = Schematic().BuildUnorderedSheetList();
|
||||
SCH_SHEET_LIST loadedSheets( aSheet ); // This is the schematicSheets of the loaded file.
|
||||
|
||||
wxString destFilePath = aCurrentSheet->LastScreen()->GetFileName();
|
||||
|
||||
|
@ -68,11 +68,11 @@ bool SCH_EDIT_FRAME::CheckSheetForRecursion( SCH_SHEET* aSheet, SCH_SHEET_PATH*
|
|||
// something is seriously broken.
|
||||
wxASSERT( wxFileName( destFilePath ).IsAbsolute() );
|
||||
|
||||
if( hierarchy.TestForRecursion( sheetHierarchy, destFilePath ) )
|
||||
if( schematicSheets.TestForRecursion( loadedSheets, destFilePath ) )
|
||||
{
|
||||
msg.Printf( _( "The sheet changes cannot be made because the destination sheet already "
|
||||
"has the sheet '%s' or one of its subsheets as a parent somewhere in the "
|
||||
"schematic hierarchy." ),
|
||||
"schematic schematicSheets." ),
|
||||
destFilePath );
|
||||
DisplayError( this, msg );
|
||||
return true;
|
||||
|
@ -275,8 +275,8 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aCurr
|
|||
}
|
||||
}
|
||||
|
||||
SCH_SHEET_LIST sheetHierarchy( tmpSheet.get() ); // This is the hierarchy of the loaded file.
|
||||
SCH_SHEET_LIST hierarchy = Schematic().GetSheets(); // This is the schematic sheet hierarchy.
|
||||
SCH_SHEET_LIST loadedSheets( tmpSheet.get() );
|
||||
SCH_SHEET_LIST schematicSheets = Schematic().BuildUnorderedSheetList();
|
||||
|
||||
// Make sure any new sheet changes do not cause any recursion issues.
|
||||
if( CheckSheetForRecursion( tmpSheet.get(), aCurrentSheet )
|
||||
|
@ -565,17 +565,17 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aCurr
|
|||
{
|
||||
// If the loaded schematic is a root sheet for another project, update the symbol
|
||||
// instances.
|
||||
sheetHierarchy.UpdateSymbolInstanceData( newScreen->GetSymbolInstances());
|
||||
loadedSheets.UpdateSymbolInstanceData( newScreen->GetSymbolInstances());
|
||||
}
|
||||
}
|
||||
|
||||
newScreen->MigrateSimModels();
|
||||
|
||||
// Attempt to create new symbol instances using the instance data loaded above.
|
||||
sheetHierarchy.AddNewSymbolInstances( *aCurrentSheet, Prj().GetProjectName() );
|
||||
loadedSheets.AddNewSymbolInstances( *aCurrentSheet, Prj().GetProjectName() );
|
||||
|
||||
// Add new sheet instance data.
|
||||
sheetHierarchy.AddNewSheetInstances( *aCurrentSheet, hierarchy.GetLastVirtualPageNumber() );
|
||||
loadedSheets.AddNewSheetInstances( *aCurrentSheet, schematicSheets.GetLastVirtualPageNumber() );
|
||||
|
||||
// It is finally safe to add or append the imported schematic.
|
||||
if( aSheet->GetScreen() == nullptr )
|
||||
|
@ -693,7 +693,7 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard()
|
|||
bool SCH_EDIT_FRAME::AllowCaseSensitiveFileNameClashes( const wxString& aOldName, const wxString& aSchematicFileName )
|
||||
{
|
||||
wxString msg;
|
||||
SCH_SHEET_LIST sheets( &Schematic().Root() );
|
||||
SCH_SHEET_LIST sheets = Schematic().BuildUnorderedSheetList();
|
||||
wxFileName fn = aSchematicFileName;
|
||||
|
||||
wxCHECK( fn.IsAbsolute(), false );
|
||||
|
|
|
@ -45,11 +45,10 @@ void SCH_EDITOR_CONTROL::AssignFootprints( const std::string& aChangedSetOfRefer
|
|||
{
|
||||
// Build a flat list of symbols in schematic:
|
||||
SCH_REFERENCE_LIST refs;
|
||||
SCH_SHEET_LIST sheets = m_frame->Schematic().GetSheets();
|
||||
bool isChanged = false;
|
||||
bool appendToUndoList = false;
|
||||
|
||||
sheets.GetSymbols( refs, false );
|
||||
m_frame->Schematic().BuildUnorderedSheetList().GetSymbols( refs, false );
|
||||
|
||||
DSNLEXER lexer( aChangedSetOfReferences, From_UTF8( __func__ ) );
|
||||
PTREE doc;
|
||||
|
@ -129,9 +128,7 @@ bool SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile( const wxString& aFullFil
|
|||
{
|
||||
// Build a flat list of symbols in schematic:
|
||||
SCH_REFERENCE_LIST referencesList;
|
||||
SCH_SHEET_LIST sheetList = m_frame->Schematic().GetSheets();
|
||||
|
||||
sheetList.GetSymbols( referencesList, false );
|
||||
m_frame->Schematic().BuildUnorderedSheetList().GetSymbols( referencesList, false );
|
||||
|
||||
FILE* cmpFile = wxFopen( aFullFilename, wxT( "rt" ) );
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ bool BACK_ANNOTATE::BackAnnotateSymbols( const std::string& aNetlist )
|
|||
|
||||
getPcbModulesFromString( aNetlist );
|
||||
|
||||
SCH_SHEET_LIST sheets = m_frame->Schematic().GetSheets();
|
||||
SCH_SHEET_LIST sheets = m_frame->Schematic().BuildUnorderedSheetList();
|
||||
sheets.GetSymbols( m_refs, false );
|
||||
sheets.GetMultiUnitSymbols( m_multiUnitsRefs );
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
|||
|
||||
// First we need to get all instances of this sheet so we can annotate
|
||||
// whatever symbols we place on all copies
|
||||
SCH_SHEET_LIST hierarchy = m_frame->Schematic().GetSheets();
|
||||
SCH_SHEET_LIST hierarchy = m_frame->Schematic().BuildSheetListSortedByPageNumbers();
|
||||
SCH_SHEET_LIST newInstances =
|
||||
hierarchy.FindAllSheetsForScreen( m_frame->GetCurrentSheet().LastScreen() );
|
||||
newInstances.SortByPageNumbers();
|
||||
|
|
|
@ -1872,7 +1872,8 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
// Keep track of existing sheet paths. EditSheet() can modify this list.
|
||||
// Note that we use the validity checking/repairing version here just to make sure
|
||||
// we've got a valid hierarchy to begin with.
|
||||
SCH_SHEET_LIST originalHierarchy( &m_frame->Schematic().Root(), true );
|
||||
SCH_SHEET_LIST originalHierarchy;
|
||||
originalHierarchy.BuildSheetList( &m_frame->Schematic().Root(), true );
|
||||
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
commit.Modify( sheet, m_frame->GetScreen() );
|
||||
|
|
|
@ -359,8 +359,9 @@ int SCH_EDITOR_CONTROL::ExportSymbolsToLibrary( const TOOL_EVENT& aEvent )
|
|||
|
||||
bool createNew = aEvent.IsAction( &EE_ACTIONS::exportSymbolsToNewLibrary );
|
||||
|
||||
SCH_SHEET_LIST sheets = m_frame->Schematic().BuildSheetListSortedByPageNumbers();
|
||||
SCH_REFERENCE_LIST symbols;
|
||||
m_frame->Schematic().GetSheets().GetSymbols( symbols, savePowerSymbols );
|
||||
sheets.GetSymbols( symbols, savePowerSymbols );
|
||||
|
||||
std::map<LIB_ID, LIB_SYMBOL*> libSymbols;
|
||||
std::map<LIB_ID, std::vector<SCH_SYMBOL*>> symbolMap;
|
||||
|
@ -519,7 +520,6 @@ int SCH_EDITOR_CONTROL::ExportSymbolsToLibrary( const TOOL_EVENT& aEvent )
|
|||
if( append )
|
||||
{
|
||||
std::set<SCH_SCREEN*> processedScreens;
|
||||
SCH_SHEET_LIST sheets = m_frame->Schematic().GetSheets();
|
||||
|
||||
for( SCH_SHEET_PATH& sheet : sheets )
|
||||
{
|
||||
|
@ -1344,7 +1344,6 @@ bool SCH_EDITOR_CONTROL::doCopy( bool aUseDuplicateClipboard )
|
|||
|
||||
STRING_FORMATTER formatter;
|
||||
SCH_IO_KICAD_SEXPR plugin;
|
||||
SCH_SHEET_LIST hierarchy = schematic.GetSheets();
|
||||
SCH_SHEET_PATH selPath = m_frame->GetCurrentSheet();
|
||||
|
||||
plugin.Format( &selection, &selPath, schematic, &formatter, true );
|
||||
|
@ -1676,7 +1675,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||
EDA_ITEMS loadedItems;
|
||||
std::vector<SCH_ITEM*> sortedLoadedItems;
|
||||
bool sheetsPasted = false;
|
||||
SCH_SHEET_LIST hierarchy = m_frame->Schematic().GetSheets();
|
||||
SCH_SHEET_LIST hierarchy = m_frame->Schematic().BuildSheetListSortedByPageNumbers();
|
||||
SCH_SHEET_PATH& pasteRoot = m_frame->GetCurrentSheet();
|
||||
wxFileName destFn = pasteRoot.Last()->GetFileName();
|
||||
|
||||
|
@ -1838,7 +1837,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||
|
||||
// Update hierarchy to include any other sheets we already added, avoiding
|
||||
// duplicate sheet names
|
||||
hierarchy = m_frame->Schematic().GetSheets();
|
||||
hierarchy = m_frame->Schematic().BuildSheetListSortedByPageNumbers();
|
||||
|
||||
//@todo: it might be better to just iterate through the sheet names
|
||||
// in this screen instead of the whole hierarchy.
|
||||
|
@ -1988,7 +1987,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||
|
||||
// Get a version with correct sheet numbers since we've pasted sheets,
|
||||
// we'll need this when annotating next
|
||||
hierarchy = m_frame->Schematic().GetSheets();
|
||||
hierarchy = m_frame->Schematic().BuildSheetListSortedByPageNumbers();
|
||||
}
|
||||
|
||||
std::map<SCH_SHEET_PATH, SCH_REFERENCE_LIST> annotatedSymbols;
|
||||
|
@ -2077,12 +2076,11 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||
// schematic file.
|
||||
prunePastedSymbolInstances();
|
||||
|
||||
SCH_SHEET_LIST sheets = m_frame->Schematic().BuildUnorderedSheetList();
|
||||
SCH_SCREENS allScreens( m_frame->Schematic().Root() );
|
||||
|
||||
allScreens.PruneOrphanedSymbolInstances( m_frame->Prj().GetProjectName(),
|
||||
m_frame->Schematic().GetSheets() );
|
||||
allScreens.PruneOrphanedSheetInstances( m_frame->Prj().GetProjectName(),
|
||||
m_frame->Schematic().GetSheets() );
|
||||
allScreens.PruneOrphanedSymbolInstances( m_frame->Prj().GetProjectName(), sheets );
|
||||
allScreens.PruneOrphanedSheetInstances( m_frame->Prj().GetProjectName(), sheets );
|
||||
|
||||
// Now clear the previous selection, select the pasted items, and fire up the "move" tool.
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
|
||||
|
@ -2610,6 +2608,8 @@ int SCH_EDITOR_CONTROL::RepairSchematic( const TOOL_EVENT& aEvent )
|
|||
std::map<KIID, EDA_ITEM*> ids;
|
||||
int duplicates = 0;
|
||||
|
||||
SCH_SHEET_LIST sheets = m_frame->Schematic().BuildUnorderedSheetList();
|
||||
|
||||
auto processItem =
|
||||
[&]( EDA_ITEM* aItem )
|
||||
{
|
||||
|
@ -2627,7 +2627,7 @@ int SCH_EDITOR_CONTROL::RepairSchematic( const TOOL_EVENT& aEvent )
|
|||
// Symbol IDs are the most important, so give them the first crack at "claiming" a
|
||||
// particular KIID.
|
||||
|
||||
for( const SCH_SHEET_PATH& sheet : m_frame->Schematic().GetUnorderedSheets() )
|
||||
for( const SCH_SHEET_PATH& sheet : sheets )
|
||||
{
|
||||
SCH_SCREEN* screen = sheet.LastScreen();
|
||||
|
||||
|
@ -2640,7 +2640,7 @@ int SCH_EDITOR_CONTROL::RepairSchematic( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
for( const SCH_SHEET_PATH& sheet : m_frame->Schematic().GetUnorderedSheets() )
|
||||
for( const SCH_SHEET_PATH& sheet : sheets )
|
||||
{
|
||||
SCH_SCREEN* screen = sheet.LastScreen();
|
||||
|
||||
|
|
|
@ -431,7 +431,7 @@ int SCH_FIND_REPLACE_TOOL::ReplaceAll( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
SCH_SHEET_LIST allSheets = m_frame->Schematic().GetUnorderedSheets();
|
||||
SCH_SHEET_LIST allSheets = m_frame->Schematic().BuildUnorderedSheetList();
|
||||
SCH_SCREENS screens( m_frame->Schematic().Root() );
|
||||
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
|
||||
|
|
|
@ -42,7 +42,7 @@ void SCH_NAVIGATE_TOOL::ResetHistory()
|
|||
|
||||
void SCH_NAVIGATE_TOOL::CleanHistory()
|
||||
{
|
||||
SCH_SHEET_LIST sheets = m_frame->Schematic().GetSheets();
|
||||
SCH_SHEET_LIST sheets = m_frame->Schematic().BuildUnorderedSheetList();
|
||||
|
||||
// Search through our history, and removing any entries
|
||||
// that the no longer point to a sheet on the schematic
|
||||
|
@ -69,7 +69,7 @@ void SCH_NAVIGATE_TOOL::HypertextCommand( const wxString& href )
|
|||
}
|
||||
else if( EDA_TEXT::IsGotoPageHref( href, &destPage ) && !destPage.IsEmpty() )
|
||||
{
|
||||
for( const SCH_SHEET_PATH& sheet : m_frame->Schematic().GetSheets() )
|
||||
for( const SCH_SHEET_PATH& sheet : m_frame->Schematic().BuildSheetListSortedByPageNumbers() )
|
||||
{
|
||||
if( sheet.GetPageNumber() == destPage )
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ int SCH_NAVIGATE_TOOL::Previous( const TOOL_EVENT& aEvent )
|
|||
if( CanGoPrevious() )
|
||||
{
|
||||
int targetSheet = m_frame->GetCurrentSheet().GetVirtualPageNumber() - 1;
|
||||
changeSheet( m_frame->Schematic().GetSheets().at( targetSheet - 1 ) );
|
||||
changeSheet( m_frame->Schematic().BuildSheetListSortedByPageNumbers().at( targetSheet - 1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -163,7 +163,7 @@ int SCH_NAVIGATE_TOOL::Next( const TOOL_EVENT& aEvent )
|
|||
if( CanGoNext() )
|
||||
{
|
||||
int targetSheet = m_frame->GetCurrentSheet().GetVirtualPageNumber() + 1;
|
||||
changeSheet( m_frame->Schematic().GetSheets().at( targetSheet - 1 ) );
|
||||
changeSheet( m_frame->Schematic().BuildSheetListSortedByPageNumbers().at( targetSheet - 1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -201,7 +201,7 @@ bool SCH_NAVIGATE_TOOL::CanGoPrevious()
|
|||
bool SCH_NAVIGATE_TOOL::CanGoNext()
|
||||
{
|
||||
return m_frame->GetCurrentSheet().GetVirtualPageNumber()
|
||||
< (int) m_frame->Schematic().GetUnorderedSheets().size();
|
||||
< (int) m_frame->Schematic().BuildUnorderedSheetList().size();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ void KI_TEST::SCHEMATIC_TEST_FIXTURE::LoadSchematic( const wxString& aBaseName )
|
|||
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
|
||||
screen->UpdateLocalLibSymbolLinks();
|
||||
|
||||
SCH_SHEET_LIST sheets = m_schematic.GetSheets();
|
||||
SCH_SHEET_LIST sheets = m_schematic.BuildSheetListSortedByPageNumbers();
|
||||
|
||||
// Restore all of the loaded symbol instances from the root sheet screen.
|
||||
if( m_schematic.RootScreen()->GetFileFormatVersionAtLoad() < 20221002 )
|
||||
|
|
|
@ -149,7 +149,7 @@ void LoadSchematic( SETTINGS_MANAGER& aSettingsManager, const wxString& aRelPath
|
|||
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
|
||||
screen->UpdateLocalLibSymbolLinks();
|
||||
|
||||
SCH_SHEET_LIST sheets = aSchematic->GetSheets();
|
||||
SCH_SHEET_LIST sheets = aSchematic->BuildSheetListSortedByPageNumbers();
|
||||
|
||||
// Restore all of the loaded symbol instances from the root sheet screen.
|
||||
sheets.UpdateSymbolInstanceData( aSchematic->RootScreen()->GetSymbolInstances() );
|
||||
|
|
|
@ -61,7 +61,8 @@ BOOST_FIXTURE_TEST_CASE( ERCGlobalLabels, ERC_REGRESSION_TEST_FIXTURE )
|
|||
settings.m_ERCSeverities[ERCE_LIB_SYMBOL_ISSUES] = RPT_SEVERITY_IGNORE;
|
||||
settings.m_ERCSeverities[ERCE_LIB_SYMBOL_MISMATCH] = RPT_SEVERITY_IGNORE;
|
||||
|
||||
m_schematic->ConnectionGraph()->Recalculate( m_schematic->GetSheets(), true );
|
||||
SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
|
||||
m_schematic->ConnectionGraph()->Recalculate( sheets, true );
|
||||
m_schematic->ConnectionGraph()->RunERC();
|
||||
|
||||
ERC_TESTER tester( m_schematic.get() );
|
||||
|
@ -107,7 +108,8 @@ BOOST_FIXTURE_TEST_CASE( ERCSingleGlobalLabels, ERC_REGRESSION_TEST_FIXTURE )
|
|||
settings.m_ERCSeverities[ERCE_GLOBLABEL] = RPT_SEVERITY_IGNORE;
|
||||
settings.m_ERCSeverities[ERCE_SINGLE_GLOBAL_LABEL] = RPT_SEVERITY_ERROR;
|
||||
|
||||
m_schematic->ConnectionGraph()->Recalculate( m_schematic->GetSheets(), true );
|
||||
SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
|
||||
m_schematic->ConnectionGraph()->Recalculate( sheets, true );
|
||||
m_schematic->ConnectionGraph()->RunERC();
|
||||
|
||||
ERC_TESTER tester( m_schematic.get() );
|
||||
|
|
|
@ -74,7 +74,9 @@ BOOST_FIXTURE_TEST_CASE( ERCRuleAreaNetClasseDirectives, ERC_REGRESSION_TEST_FIX
|
|||
allScreens.insert( screen );
|
||||
|
||||
SCH_RULE_AREA::UpdateRuleAreasInScreens( allScreens, nullptr );
|
||||
m_schematic->ConnectionGraph()->Recalculate( m_schematic->GetSheets(), true );
|
||||
|
||||
SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
|
||||
m_schematic->ConnectionGraph()->Recalculate( sheets, true );
|
||||
m_schematic->ConnectionGraph()->RunERC();
|
||||
|
||||
errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING );
|
||||
|
@ -117,12 +119,13 @@ BOOST_FIXTURE_TEST_CASE( ERCRuleAreaOverlaps, ERC_REGRESSION_TEST_FIXTURE )
|
|||
SCH_SCREENS screens( m_schematic->Root() );
|
||||
screens.BuildClientSheetPathList();
|
||||
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen != nullptr;
|
||||
screen = screens.GetNext() )
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
|
||||
allScreens.insert( screen );
|
||||
|
||||
SCH_RULE_AREA::UpdateRuleAreasInScreens( allScreens, nullptr );
|
||||
m_schematic->ConnectionGraph()->Recalculate( m_schematic->GetSheets(), true );
|
||||
|
||||
SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
|
||||
m_schematic->ConnectionGraph()->Recalculate( sheets, true );
|
||||
|
||||
ERC_TESTER tester( m_schematic.get() );
|
||||
tester.RunRuleAreaERC();
|
||||
|
|
|
@ -67,7 +67,7 @@ BOOST_FIXTURE_TEST_CASE( RemoveAddItems, INCREMENTAL_NETLIST_TEST_FIXTURE )
|
|||
{
|
||||
KI_TEST::LoadSchematic( m_settingsManager, test, m_schematic );
|
||||
|
||||
SCH_SHEET_LIST sheets = m_schematic->GetSheets();
|
||||
SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
|
||||
|
||||
for( const SCH_SHEET_PATH& path : sheets )
|
||||
{
|
||||
|
|
|
@ -33,9 +33,8 @@ BOOST_AUTO_TEST_CASE( TestSubsheetNetclass )
|
|||
{
|
||||
LoadSchematic( "issue14494" );
|
||||
|
||||
SCH_SHEET_LIST sheets = m_schematic.GetSheets();
|
||||
SCH_SHEET_PATH path = sheets.at( 1 );
|
||||
SCH_SCREEN *screen = path.GetSheet( 1 )->GetScreen();
|
||||
SCH_SHEET_PATH path = m_schematic.BuildSheetListSortedByPageNumbers().at( 1 );
|
||||
SCH_SCREEN* screen = path.GetSheet( 1 )->GetScreen();
|
||||
|
||||
for( SCH_ITEM* item : screen->Items().OfType( SCH_HIER_LABEL_T ) )
|
||||
{
|
||||
|
|
|
@ -80,10 +80,8 @@ void TEST_SCH_REFERENCE_LIST_FIXTURE::loadTestCase( wxString aSchematicRelativeP
|
|||
SCH_SYMBOL* TEST_SCH_REFERENCE_LIST_FIXTURE::getSymbolByKIID( wxString aKIID,
|
||||
SCH_SHEET_PATH* aSymbolPath )
|
||||
{
|
||||
SCH_SHEET_LIST sheets = m_schematic.GetSheets();
|
||||
|
||||
KIID symKIID( aKIID );
|
||||
SCH_ITEM* foundItem = sheets.GetItem( symKIID, aSymbolPath );
|
||||
SCH_ITEM* foundItem = m_schematic.GetItem( symKIID, aSymbolPath );
|
||||
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( foundItem );
|
||||
|
||||
return symbol;
|
||||
|
@ -95,7 +93,7 @@ SCH_REFERENCE_LIST TEST_SCH_REFERENCE_LIST_FIXTURE::getAdditionalRefs()
|
|||
// Build List of additional references to pass into Annotate()
|
||||
SCH_REFERENCE_LIST allRefs, additionalRefs;
|
||||
|
||||
m_schematic.GetSheets().GetSymbols( allRefs );
|
||||
m_schematic.BuildSheetListSortedByPageNumbers().GetSymbols( allRefs );
|
||||
|
||||
for( size_t i = 0; i < allRefs.GetCount(); ++i )
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ BOOST_AUTO_TEST_CASE( TestSheetListPageProperties )
|
|||
{
|
||||
LoadSchematic( "complex_hierarchy/complex_hierarchy" );
|
||||
|
||||
SCH_SHEET_LIST sheets = m_schematic.GetSheets();
|
||||
SCH_SHEET_LIST sheets = m_schematic.BuildSheetListSortedByPageNumbers();
|
||||
|
||||
BOOST_CHECK( sheets.AllSheetPageNumbersEmpty() );
|
||||
|
||||
|
@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE( TestEditPageNumbersInSharedDesign )
|
|||
// Check the Sub Sheet has the expected page numbers
|
||||
LoadSchematic( "complex_hierarchy_shared/ampli_ht/ampli_ht" );
|
||||
|
||||
SCH_SHEET_LIST sheets = m_schematic.GetSheets();
|
||||
SCH_SHEET_LIST sheets = m_schematic.BuildSheetListSortedByPageNumbers();
|
||||
|
||||
BOOST_CHECK_EQUAL( sheets.size(), 2 );
|
||||
BOOST_CHECK_EQUAL( sheets.at( 0 ).GetPageNumber(), "i" );
|
||||
|
@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE( TestEditPageNumbersInSharedDesign )
|
|||
// Check the parent sheet has the expected page numbers
|
||||
LoadSchematic( "complex_hierarchy_shared/complex_hierarchy" );
|
||||
|
||||
SCH_SHEET_LIST sheets = m_schematic.GetSheets();
|
||||
SCH_SHEET_LIST sheets = m_schematic.BuildSheetListSortedByPageNumbers();
|
||||
|
||||
BOOST_CHECK_EQUAL( sheets.size(), 5 );
|
||||
BOOST_CHECK_EQUAL( sheets.at( 0 ).GetPageNumber(), "1" );
|
||||
|
@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE( TestEditPageNumbersInSharedDesign )
|
|||
|
||||
BOOST_TEST_CONTEXT( "Modify page numbers in root sheet" )
|
||||
{
|
||||
SCH_SHEET_LIST sheets = m_schematic.GetSheets();
|
||||
SCH_SHEET_LIST sheets = m_schematic.BuildSheetListSortedByPageNumbers();
|
||||
|
||||
// Amend Page numbers
|
||||
sheets.at( 0 ).SetPageNumber( "A" );
|
||||
|
@ -129,7 +129,7 @@ BOOST_AUTO_TEST_CASE( TestEditPageNumbersInSharedDesign )
|
|||
|
||||
LoadSchematic( "complex_hierarchy_shared/temp/complex_hierarchy" );
|
||||
|
||||
sheets = m_schematic.GetSheets();
|
||||
sheets = m_schematic.BuildSheetListSortedByPageNumbers();
|
||||
|
||||
BOOST_CHECK_EQUAL( sheets.size(), 5 );
|
||||
BOOST_CHECK_EQUAL( sheets.at( 0 ).GetPageNumber(), "A" );
|
||||
|
@ -154,7 +154,7 @@ BOOST_AUTO_TEST_CASE( TestEditPageNumbersInSharedDesign )
|
|||
// (This should not have been modified after editing the root sheet)
|
||||
LoadSchematic( "complex_hierarchy_shared/ampli_ht/ampli_ht" );
|
||||
|
||||
SCH_SHEET_LIST sheets = m_schematic.GetSheets();
|
||||
SCH_SHEET_LIST sheets = m_schematic.BuildSheetListSortedByPageNumbers();
|
||||
|
||||
BOOST_CHECK_EQUAL( sheets.size(), 2 );
|
||||
BOOST_CHECK_EQUAL( sheets.at( 0 ).GetPageNumber(), "i" );
|
||||
|
|
Loading…
Reference in New Issue