Don't rebuild component tree when not necessary.
Fixes: lp:1780363 * https://bugs.launchpad.net/kicad/+bug/1780363
This commit is contained in:
parent
946f4a217d
commit
f9aaa01329
|
@ -1037,9 +1037,9 @@ void LIB_EDIT_FRAME::OnEditComponentProperties( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
if( oldName != GetCurPart()->GetName() )
|
||||
m_libMgr->RemovePart( GetCurLib(), oldName );
|
||||
|
||||
m_libMgr->UpdatePart( GetCurPart(), GetCurLib() );
|
||||
m_libMgr->UpdatePartAfterRename( GetCurPart(), oldName, GetCurLib() );
|
||||
else
|
||||
m_libMgr->UpdatePart( GetCurPart(), GetCurLib() );
|
||||
|
||||
UpdatePartSelectList();
|
||||
DisplayLibInfos();
|
||||
|
@ -1515,19 +1515,20 @@ wxString LIB_EDIT_FRAME::getTargetLib() const
|
|||
}
|
||||
|
||||
|
||||
void LIB_EDIT_FRAME::SyncLibraries( bool aProgress )
|
||||
void LIB_EDIT_FRAME::SyncLibraries( bool aShowProgress )
|
||||
{
|
||||
LIB_ID selected;
|
||||
|
||||
if( m_treePane )
|
||||
selected = m_treePane->GetLibTree()->GetSelectedLibId();
|
||||
|
||||
if( aProgress )
|
||||
if( aShowProgress )
|
||||
{
|
||||
wxProgressDialog progressDlg( _( "Loading Symbol Libraries" ),
|
||||
wxEmptyString, m_libMgr->GetAdapter()->GetLibrariesCount(), this );
|
||||
wxProgressDialog progressDlg( _( "Loading Symbol Libraries" ), wxEmptyString,
|
||||
m_libMgr->GetAdapter()->GetLibrariesCount(), this );
|
||||
|
||||
m_libMgr->Sync( true, [&]( int progress, int max, const wxString& libName ) {
|
||||
m_libMgr->Sync( true, [&]( int progress, int max, const wxString& libName )
|
||||
{
|
||||
progressDlg.Update( progress, wxString::Format( _( "Loading library \"%s\"" ), libName ) );
|
||||
} );
|
||||
}
|
||||
|
|
|
@ -687,9 +687,10 @@ public:
|
|||
void SVG_PlotComponent( const wxString& aFullFileName );
|
||||
|
||||
/**
|
||||
* Synchronize the library manager and the symbol library table. Displays a progress dialog.
|
||||
* Synchronize the library manager to the symbol library table, and then the symbol tree
|
||||
* to the library manager. Optionally displays a progress dialog.
|
||||
*/
|
||||
void SyncLibraries( bool aLoad );
|
||||
void SyncLibraries( bool aShowProgress );
|
||||
|
||||
/**
|
||||
* Allows Libedit to install its preferences panel into the preferences dialog.
|
||||
|
|
|
@ -93,6 +93,7 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
m_libMgr->UpdatePart( entry->GetPart(), libName );
|
||||
SyncLibraries( false );
|
||||
loadPart( symbolName, libName, 1 );
|
||||
}
|
||||
|
||||
|
|
|
@ -407,8 +407,6 @@ bool LIB_MANAGER::UpdatePart( LIB_PART* aPart, const wxString& aLibrary )
|
|||
screen->SetModify();
|
||||
}
|
||||
|
||||
m_frame.SyncLibraries( false );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -438,6 +436,8 @@ bool LIB_MANAGER::UpdatePartAfterRename( LIB_PART* aPart, const wxString& oldAli
|
|||
wxCHECK( partBuf, false );
|
||||
partBuf->SetOriginal( original ); // part buffer takes ownership of pointer
|
||||
|
||||
m_frame.SyncLibraries( false );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -319,6 +319,7 @@ void LIB_EDIT_FRAME::OnCreateNewPart( wxCommandEvent& event )
|
|||
new_part.LockUnits( false );
|
||||
|
||||
m_libMgr->UpdatePart( &new_part, lib );
|
||||
SyncLibraries( false );
|
||||
loadPart( name, lib, 1 );
|
||||
|
||||
new_part.SetConversion( dlg.GetAlternateBodyStyle() );
|
||||
|
@ -461,6 +462,7 @@ void LIB_EDIT_FRAME::savePartAs()
|
|||
|
||||
fixDuplicateAliases( &new_part, new_lib );
|
||||
m_libMgr->UpdatePart( &new_part, new_lib );
|
||||
SyncLibraries( false );
|
||||
m_treePane->GetLibTree()->SelectLibId( LIB_ID( new_lib, new_part.GetName() ) );
|
||||
|
||||
if( isCurrentPart( old_lib_id ) )
|
||||
|
@ -505,6 +507,7 @@ void LIB_EDIT_FRAME::OnDuplicatePart( wxCommandEvent& aEvent )
|
|||
LIB_PART newPart( *srcPart );
|
||||
fixDuplicateAliases( &newPart, lib );
|
||||
m_libMgr->UpdatePart( &newPart, lib );
|
||||
SyncLibraries( false );
|
||||
m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, newPart.GetName() ) );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue