Performance Mitigate "Edit all symbol fields" dialog slow closing.
GetSymbols will return all symbols. Call it once and cache it.
This commit is contained in:
parent
a4da829ccc
commit
62c961b8ba
|
@ -2182,6 +2182,11 @@ 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().GetSheets();
|
||||||
|
SCH_REFERENCE_LIST allRefs;
|
||||||
|
|
||||||
|
allSheets.GetSymbols( allRefs );
|
||||||
|
|
||||||
for( SCH_ITEM* item : aSchItem )
|
for( SCH_ITEM* item : aSchItem )
|
||||||
{
|
{
|
||||||
if( item->Type() == SCH_SYMBOL_T )
|
if( item->Type() == SCH_SYMBOL_T )
|
||||||
|
@ -2192,7 +2197,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnSchItemsAdded( SCHEMATIC& aSch,
|
||||||
for( SCH_FIELD& field : symbol->GetFields() )
|
for( SCH_FIELD& field : symbol->GetFields() )
|
||||||
AddField( field.GetCanonicalName(), field.GetName(), true, false, true );
|
AddField( field.GetCanonicalName(), field.GetName(), true, false, true );
|
||||||
|
|
||||||
m_dataModel->AddReferences( getSymbolReferences( symbol ) );
|
m_dataModel->AddReferences( getSymbolReferences( symbol, allRefs ) );
|
||||||
}
|
}
|
||||||
else if( item->Type() == SCH_SHEET_T )
|
else if( item->Type() == SCH_SHEET_T )
|
||||||
{
|
{
|
||||||
|
@ -2240,6 +2245,11 @@ 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().GetSheets();
|
||||||
|
SCH_REFERENCE_LIST allRefs;
|
||||||
|
|
||||||
|
allSheets.GetSymbols( allRefs );
|
||||||
|
|
||||||
for( SCH_ITEM* item : aSchItem )
|
for( SCH_ITEM* item : aSchItem )
|
||||||
{
|
{
|
||||||
if( item->Type() == SCH_SYMBOL_T )
|
if( item->Type() == SCH_SYMBOL_T )
|
||||||
|
@ -2250,7 +2260,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnSchItemsChanged( SCHEMATIC& aSch
|
||||||
for( SCH_FIELD& field : symbol->GetFields() )
|
for( SCH_FIELD& field : symbol->GetFields() )
|
||||||
AddField( field.GetCanonicalName(), field.GetName(), true, false, true );
|
AddField( field.GetCanonicalName(), field.GetName(), true, false, true );
|
||||||
|
|
||||||
m_dataModel->UpdateReferences( getSymbolReferences( symbol ) );
|
m_dataModel->UpdateReferences( getSymbolReferences( symbol, allRefs ) );
|
||||||
}
|
}
|
||||||
else if( item->Type() == SCH_SHEET_T )
|
else if( item->Type() == SCH_SHEET_T )
|
||||||
{
|
{
|
||||||
|
@ -2308,17 +2318,16 @@ void DIALOG_SYMBOL_FIELDS_TABLE::DisableSelectionEvents()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_REFERENCE_LIST DIALOG_SYMBOL_FIELDS_TABLE::getSymbolReferences( SCH_SYMBOL* aSymbol )
|
SCH_REFERENCE_LIST
|
||||||
|
DIALOG_SYMBOL_FIELDS_TABLE::getSymbolReferences( SCH_SYMBOL* aSymbol,
|
||||||
|
SCH_REFERENCE_LIST& aCachedRefs )
|
||||||
{
|
{
|
||||||
SCH_SHEET_LIST allSheets = m_parent->Schematic().GetSheets();
|
SCH_SHEET_LIST allSheets = m_parent->Schematic().GetSheets();
|
||||||
SCH_REFERENCE_LIST allRefs;
|
|
||||||
SCH_REFERENCE_LIST symbolRefs;
|
SCH_REFERENCE_LIST symbolRefs;
|
||||||
|
|
||||||
allSheets.GetSymbols( allRefs );
|
for( size_t i = 0; i < aCachedRefs.GetCount(); i++ )
|
||||||
|
|
||||||
for( size_t i = 0; i < allRefs.GetCount(); i++ )
|
|
||||||
{
|
{
|
||||||
SCH_REFERENCE& ref = allRefs[i];
|
SCH_REFERENCE& ref = aCachedRefs[i];
|
||||||
|
|
||||||
if( ref.GetSymbol() == aSymbol )
|
if( ref.GetSymbol() == aSymbol )
|
||||||
{
|
{
|
||||||
|
|
|
@ -119,7 +119,7 @@ private:
|
||||||
void DisableSelectionEvents();
|
void DisableSelectionEvents();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SCH_REFERENCE_LIST getSymbolReferences( SCH_SYMBOL* aSymbol );
|
SCH_REFERENCE_LIST getSymbolReferences( SCH_SYMBOL* aSymbol, SCH_REFERENCE_LIST& aCachedRefs );
|
||||||
SCH_REFERENCE_LIST getSheetSymbolReferences( SCH_SHEET& aSheet );
|
SCH_REFERENCE_LIST getSheetSymbolReferences( SCH_SHEET& aSheet );
|
||||||
|
|
||||||
void syncBomPresetSelection();
|
void syncBomPresetSelection();
|
||||||
|
|
Loading…
Reference in New Issue