Prevent symbol libraries from being unnecessarily reloaded.

When Eeschema is relaunched from KiCad, the symbol libraries were always
reloaded which isn't necessary as they are maintained by the kiface project
object until the project is changed.

Fix minor title capitalization in symbol library progress dialog.
This commit is contained in:
Wayne Stambaugh 2017-02-17 19:31:47 -05:00
parent ccbdb41186
commit 0898b6c94d
2 changed files with 17 additions and 10 deletions

View File

@ -595,7 +595,7 @@ void PART_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress )
wxASSERT( !size() ); // expect to load into "this" empty container.
wxProgressDialog lib_dialog( _( "Loading symbol libraries" ),
wxProgressDialog lib_dialog( _( "Loading Symbol Libraries" ),
wxEmptyString,
lib_names.GetCount(),
NULL,

View File

@ -275,23 +275,30 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
SetStatusText( wxEmptyString );
ClearMsgPanel();
LoadProjectFile();
// PROJECT::SetProjectFullName() is an impactful function. It should only be
// called under carefully considered circumstances.
// The calling code should know not to ask me here to change projects unless
// it knows what consequences that will have on other KIFACEs running and using
// this same PROJECT. It can be very harmful if that calling code is stupid.
Prj().SetProjectFullName( pro.GetFullPath() );
LoadProjectFile();
// Don't reload the symbol libraries if we are just launching Eeschema from KiCad again.
// They are already saved in the kiface project object.
if( pro.GetFullPath() != Prj().GetProjectFullName()
|| !Prj().GetElem( PROJECT::ELEM_SCH_PART_LIBS ) )
{
Prj().SetProjectFullName( pro.GetFullPath() );
// load the libraries here, not in SCH_SCREEN::Draw() which is a context
// that will not tolerate DisplayError() dialog since we're already in an
// event handler in there.
// And when a schematic file is loaded, we need these libs to initialize
// some parameters (links to PART LIB, dangling ends ...)
Prj().SetElem( PROJECT::ELEM_SCH_PART_LIBS, NULL );
Prj().SchLibs();
// load the libraries here, not in SCH_SCREEN::Draw() which is a context
// that will not tolerate DisplayError() dialog since we're already in an
// event handler in there.
// And when a schematic file is loaded, we need these libs to initialize
// some parameters (links to PART LIB, dangling ends ...)
Prj().SetElem( PROJECT::ELEM_SCH_PART_LIBS, NULL );
Prj().SchLibs();
}
if( is_new )
{