diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index cfe3d99ee8..44f95588bc 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -190,6 +190,8 @@ LIB_PART::LIB_PART( const wxString& aName, PART_LIB* aLibrary ) : m_showPinNumbers = true; m_showPinNames = true; + m_libId.SetLibItemName( aName, false ); + // Create the default alias if the name parameter is not empty. if( !aName.IsEmpty() ) m_aliases.push_back( new LIB_ALIAS( aName, this ) ); @@ -222,6 +224,7 @@ LIB_PART::LIB_PART( LIB_PART& aPart, PART_LIB* aLibrary ) : m_showPinNames = aPart.m_showPinNames; m_dateModified = aPart.m_dateModified; m_options = aPart.m_options; + m_libId = aPart.m_libId; for( LIB_ITEM& oldItem : aPart.m_drawings ) { diff --git a/eeschema/dialogs/dialog_symbol_remap.cpp b/eeschema/dialogs/dialog_symbol_remap.cpp index a8391b895d..26e07d7f89 100644 --- a/eeschema/dialogs/dialog_symbol_remap.cpp +++ b/eeschema/dialogs/dialog_symbol_remap.cpp @@ -49,6 +49,8 @@ DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP( SCH_EDIT_FRAME* aParent ) : void DIALOG_SYMBOL_REMAP::OnRemapSymbols( wxCommandEvent& aEvent ) { + wxBusyCursor busy; + // The schematic is fully loaded, any legacy library symbols have been rescued. Now // check to see if the schematic has not been converted to the symbol library table // method for looking up symbols. diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp index 857e3d777b..0637e5c8d7 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -163,7 +163,10 @@ void LIB_EDIT_FRAME::LoadOneLibraryPart( wxCommandEvent& event ) // Get the name of the current part to preselect it LIB_PART* current_part = GetCurPart(); - LIB_ID id = current_part->GetLibId(); + LIB_ID id; + + if( current_part ) + id = current_part->GetLibId(); SCH_BASE_FRAME::HISTORY_LIST dummyHistoryList; SCHLIB_FILTER filter; diff --git a/eeschema/project_rescue.cpp b/eeschema/project_rescue.cpp index 4fdee7b9d9..48303d0bef 100644 --- a/eeschema/project_rescue.cpp +++ b/eeschema/project_rescue.cpp @@ -255,6 +255,9 @@ void RESCUE_CACHE_CANDIDATE::FindRescues( RESCUER& aRescuer, cache_match = find_component( part_name, aRescuer.GetPrj()->SchLibs(), true ); lib_match = find_component( part_name, aRescuer.GetPrj()->SchLibs(), false ); + if( !cache_match && !lib_match ) + continue; + // Test whether there is a conflict or if the symbol can only be found in the cache. if( ( cache_match && lib_match && !cache_match->PinsConflictWith( *lib_match, true, true, true, true, false ) ) @@ -364,6 +367,9 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues( lib_match = aRescuer.GetFrame()->GetLibPart( part_id ); + if( !cache_match && !lib_match ) + continue; + // Test whether there is a conflict or if the symbol can only be found in the cache. if( ( cache_match && lib_match && !cache_match->PinsConflictWith( *lib_match, true, true, true, true, false ) ) @@ -609,6 +615,27 @@ void LEGACY_RESCUER::OpenRescueLibrary() m_rescue_lib = std::move( rescue_lib ); m_rescue_lib->EnableBuffering(); + + // If a rescue library already exists copy the contents of that library so we do not + // lose an previous rescues. + PART_LIB* rescueLib = m_prj->SchLibs()->FindLibrary( fn.GetName() ); + + if( rescueLib ) + { + // For items in the rescue library, aliases are the root symbol. + std::vector< LIB_ALIAS* > aliases; + + rescueLib->GetAliases( aliases ); + + for( auto alias : aliases ) + { + LIB_PART* part = alias->GetPart(); + + wxCHECK2( part, continue ); + + m_rescue_lib->AddPart( new LIB_PART( *part, m_rescue_lib.get() ) ); + } + } }