Read the fp-info-cache on pcb file load rather than on frame open

Otherwise in standalone mode pcbnew will never load the cache files and also later erase them :/
This commit is contained in:
Marek Roszko 2020-12-10 20:38:55 -05:00
parent 0967995a80
commit dd0ad8f3a1
3 changed files with 17 additions and 4 deletions

View File

@ -204,6 +204,14 @@ public:
return m_list;
}
/**
* @return Clears the footprint info cache
*/
void Clear()
{
m_list.clear();
}
/**
* Get info for a footprint by id.
*/

View File

@ -54,6 +54,7 @@
#include <plugins/cadstar/cadstar_pcb_archive_plugin.h>
#include <plugins/eagle/eagle_plugin.h>
#include <dialogs/dialog_imported_layers.h>
#include "footprint_info_impl.h"
//#define USE_INSTRUMENTATION 1
@ -608,6 +609,9 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
Prj().SetReadOnly();
}
// Clear the cache footprint list which may be project specific
GFootprintList.Clear();
if( is_new )
{
// Link the existing blank board to the new project
@ -677,6 +681,11 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
SetBoard( loadedBoard );
if( GFootprintList.GetCount() == 0 )
{
GFootprintList.ReadCacheFromFile( Prj().GetProjectPath() + "fp-info-cache" );
}
if( loadedBoard->m_LegacyDesignSettingsLoaded )
{
Prj().GetProjectFile().NetSettings().ResolveNetClassAssignments( true );

View File

@ -50,10 +50,6 @@ PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_selectionFilterPanel( nullptr ),
m_appearancePanel( nullptr )
{
if( !GFootprintList.GetCount() )
{
GFootprintList.ReadCacheFromFile( Prj().GetProjectPath() + "fp-info-cache" );
}
}