Eeschema: fix broken project symbol rescue bug.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9111
This commit is contained in:
Wayne Stambaugh 2021-09-09 10:19:25 -04:00
parent bb2efa0649
commit 451f8eefc0
4 changed files with 11 additions and 12 deletions

View File

@ -89,7 +89,7 @@ static void getSymbols( SCHEMATIC* aSchematic, std::vector<SCH_SYMBOL*>& aSymbol
static LIB_SYMBOL* findSymbol( const wxString& aName, SYMBOL_LIBS* aLibs, bool aCached )
{
LIB_SYMBOL *symbol = nullptr;
wxString new_name = LIB_ID::FixIllegalChars( aName, false );
// wxString new_name = LIB_ID::FixIllegalChars( aName, false );
for( SYMBOL_LIB& each_lib : *aLibs )
{
@ -99,7 +99,7 @@ static LIB_SYMBOL* findSymbol( const wxString& aName, SYMBOL_LIBS* aLibs, bool a
if( !aCached && each_lib.IsCache() )
continue;
symbol = each_lib.FindSymbol( new_name );
symbol = each_lib.FindSymbol( aName );
if( symbol )
break;

View File

@ -2808,7 +2808,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadHeader( FILE_LINE_READER& aReader )
LIB_SYMBOL* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorVersion,
int aMinorVersion, LIB_SYMBOL_MAP* aMap )
int aMinorVersion, LIB_SYMBOL_MAP* aMap )
{
const char* line = aReader.Line();

View File

@ -1337,13 +1337,11 @@ void SCH_SCREENS::UpdateSymbolLinks( REPORTER* aReporter )
bool SCH_SCREENS::HasNoFullyDefinedLibIds()
{
SCH_SCREEN* screen;
unsigned cnt = 0;
for( screen = GetFirst(); screen; screen = GetNext() )
{
for( SCH_ITEM* item : screen->Items().OfType( SCH_SYMBOL_T ) )
{
cnt++;
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
if( !symbol->GetLibId().GetLibNickname().empty() )
@ -1351,7 +1349,7 @@ bool SCH_SCREENS::HasNoFullyDefinedLibIds()
}
}
return cnt != 0;
return true;
}

View File

@ -250,11 +250,11 @@ int SCH_EDITOR_CONTROL::UpdateFind( const TOOL_EVENT& aEvent )
auto visit =
[&]( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheet )
{
// We may get triggered when the dialog is not opened due to binding SelectedItemsModified
// we also get triggered when the find dialog is closed....so we need to double check the dialog is open
if( m_frame->m_findReplaceDialog != nullptr
&& !data.GetFindString().IsEmpty()
// We may get triggered when the dialog is not opened due to binding
// SelectedItemsModified we also get triggered when the find dialog is
// closed....so we need to double check the dialog is open.
if( m_frame->m_findReplaceDialog != nullptr
&& !data.GetFindString().IsEmpty()
&& aItem->Matches( data, aSheet ) )
{
aItem->SetForceVisible( true );
@ -441,7 +441,8 @@ int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent )
}
}
std::sort( paths.begin(), paths.end(), [] ( const SCH_SHEET_PATH* lhs, const SCH_SHEET_PATH* rhs ) -> bool
std::sort( paths.begin(), paths.end(), [] ( const SCH_SHEET_PATH* lhs,
const SCH_SHEET_PATH* rhs ) -> bool
{
int retval = lhs->ComparePageNumAndName( *rhs );