Only load all the libraries for a keyword or wildcard search.

This commit is contained in:
Jeff Young 2018-02-22 01:21:46 +00:00 committed by Maciej Suminski
parent 60a9befe7c
commit cb77babe52
1 changed files with 31 additions and 29 deletions

View File

@ -199,13 +199,15 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
return NULL;
}
// While some of the search methods can load a libraray at a time (and stop when
// a match is found), the async loader gives much better feedback and loads the
// libraries in parallel.
if( dlg.IsKeyword() || moduleName.Contains( wxT( "?" ) ) || moduleName.Contains( wxT( "*" ) ) )
{
// While SelectFootprint() can load a library at a time (and stop when a match
// is found), the async loader gives much better feedback and loads the libraries
// in parallel.
// If the footprints are already in the cache, ReadFootprintFiles() will return
// immediately.
WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
MList.ReadFootprintFiles( aTable, libName.length() ? &libName : nullptr, &progressReporter );
MList.ReadFootprintFiles( aTable, libName.length() ? &libName : NULL, &progressReporter );
progressReporter.Show( false );
if( MList.GetErrorCount() )
@ -223,8 +225,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
return NULL;
}
}
else if( moduleName.Contains( wxT( "?" ) )
|| moduleName.Contains( wxT( "*" ) ) ) // Selection wild card
else // Selection wild card
{
allowWildSeach = false;
moduleName = SelectFootprint( this, libName, moduleName, wxEmptyString, aTable );
@ -235,6 +236,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
return NULL; // Cancel command.
}
}
}
LIB_ID fpid;