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