diff --git a/eeschema/lib_edit_frame.cpp b/eeschema/lib_edit_frame.cpp index 2644a18277..d53a8c27b7 100644 --- a/eeschema/lib_edit_frame.cpp +++ b/eeschema/lib_edit_frame.cpp @@ -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 ) ); } ); } diff --git a/eeschema/lib_edit_frame.h b/eeschema/lib_edit_frame.h index f0b0694b21..6d93935a3b 100644 --- a/eeschema/lib_edit_frame.h +++ b/eeschema/lib_edit_frame.h @@ -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. diff --git a/eeschema/lib_export.cpp b/eeschema/lib_export.cpp index ff788da798..ff2e17db32 100644 --- a/eeschema/lib_export.cpp +++ b/eeschema/lib_export.cpp @@ -93,6 +93,7 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event ) } m_libMgr->UpdatePart( entry->GetPart(), libName ); + SyncLibraries( false ); loadPart( symbolName, libName, 1 ); } diff --git a/eeschema/lib_manager.cpp b/eeschema/lib_manager.cpp index ed75e144f5..2545947d25 100644 --- a/eeschema/lib_manager.cpp +++ b/eeschema/lib_manager.cpp @@ -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; } diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp index 7ed60452cd..ccc67dc946 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -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() ) ); }