Added progress dialogs for library loading

- Modal wxProgressDialog when loading symbol libraries (eeschema / libedit)
This commit is contained in:
Oliver 2017-02-02 16:48:29 +11:00 committed by Chris Pavlina
parent 227ef64212
commit 702795f4a9
2 changed files with 26 additions and 2 deletions

View File

@ -44,6 +44,7 @@
#include <class_library.h> #include <class_library.h>
#include <sch_legacy_plugin.h> #include <sch_legacy_plugin.h>
#include <wx/progdlg.h>
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
#include <wx/regex.h> #include <wx/regex.h>
@ -900,7 +901,7 @@ const wxString PART_LIBS::CacheName( const wxString& aFullProjectFilename )
} }
void PART_LIBS::LoadAllLibraries( PROJECT* aProject ) throw( IO_ERROR, boost::bad_pointer ) void PART_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress ) throw( IO_ERROR, boost::bad_pointer )
{ {
wxString filename; wxString filename;
wxString libs_not_found; wxString libs_not_found;
@ -920,8 +921,26 @@ void PART_LIBS::LoadAllLibraries( PROJECT* aProject ) throw( IO_ERROR, boost::ba
wxASSERT( !size() ); // expect to load into "this" empty container. wxASSERT( !size() ); // expect to load into "this" empty container.
wxProgressDialog lib_dialog( _( "Loading symbol libraries" ),
wxEmptyString,
lib_names.GetCount(),
NULL,
wxPD_APP_MODAL );
if( aShowProgress )
{
lib_dialog.Show();
}
wxString progress_message;
for( unsigned i = 0; i < lib_names.GetCount(); ++i ) for( unsigned i = 0; i < lib_names.GetCount(); ++i )
{ {
if( aShowProgress )
{
lib_dialog.Update( i, _( "Loading " + lib_names[i] ) );
}
wxFileName fn = lib_names[i]; wxFileName fn = lib_names[i];
// lib_names[] does not store the file extension. Set it: // lib_names[] does not store the file extension. Set it:
fn.SetExt( SchematicLibraryFileExtension ); fn.SetExt( SchematicLibraryFileExtension );
@ -966,6 +985,11 @@ void PART_LIBS::LoadAllLibraries( PROJECT* aProject ) throw( IO_ERROR, boost::ba
} }
} }
if( aShowProgress )
{
lib_dialog.Destroy();
}
// add the special cache library. // add the special cache library.
wxString cache_name = CacheName( aProject->GetProjectFullName() ); wxString cache_name = CacheName( aProject->GetProjectFullName() );
PART_LIB* cache_lib; PART_LIB* cache_lib;

View File

@ -230,7 +230,7 @@ public:
* loads all of the project's libraries into this container, which should * loads all of the project's libraries into this container, which should
* be cleared before calling it. * be cleared before calling it.
*/ */
void LoadAllLibraries( PROJECT* aProject ) throw( IO_ERROR, boost::bad_pointer ); void LoadAllLibraries( PROJECT* aProject, bool aShowProgress=true ) throw( IO_ERROR, boost::bad_pointer );
/** /**
* Function LibNamesAndPaths * Function LibNamesAndPaths