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