Reset connection graph when loading new root sheet

This commit is contained in:
Jon Evans 2020-05-23 15:11:02 -04:00
parent ab07c852d0
commit cc47082566
2 changed files with 17 additions and 4 deletions

View File

@ -55,6 +55,16 @@ void SCHEMATIC::Reset()
}
void SCHEMATIC::SetRoot( SCH_SHEET* aRootSheet )
{
wxCHECK_RET( aRootSheet, "Call to SetRoot with null SCH_SHEET!" );
m_rootSheet = aRootSheet;
m_connectionGraph->Reset();
}
SCH_SCREEN* SCHEMATIC::RootScreen() const
{
return IsValid() ? m_rootSheet->GetScreen() : nullptr;

View File

@ -106,10 +106,13 @@ public:
return *m_rootSheet;
}
void SetRoot( SCH_SHEET* aRootSheet )
{
m_rootSheet = aRootSheet;
}
/**
* Initializes the schematic with a new root sheet.
* This is typically done by calling a file loader that returns the new root sheet
* As a side-effect, takes care of some post-load initialization.
* @param aRootSheet is the new root sheet for this schematic.
*/
void SetRoot( SCH_SHEET* aRootSheet );
/// A simple test if the schematic is loaded, not a complete one
bool IsValid() const