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 eff9c46e59
commit 3613bca5ea
3 changed files with 16 additions and 4 deletions

View File

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

View File

@ -58,6 +58,7 @@
#include <wx/stdpaths.h>
#include <pcb_layer_widget.h>
#include <wx/wupdlock.h>
#include "footprint_info_impl.h"
//#define USE_INSTRUMENTATION 1
@ -468,6 +469,9 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
LoadProjectSettings();
}
// Clear the cache footprint list which may be project specific
GFootprintList.Clear();
if( is_new )
{
OnModify();
@ -517,6 +521,10 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
return false;
}
if( GFootprintList.GetCount() == 0 )
{
GFootprintList.ReadCacheFromFile( Prj().GetProjectPath() + "fp-info-cache" );
}
// 6.0 TODO: some settings didn't make it into the board file in 5.1 so as not to
// change the file format. For 5.1 we must copy them across from the config-initialized

View File

@ -39,10 +39,6 @@ PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
PCB_BASE_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
m_rotationAngle( 900 ), m_undoRedoBlocked( false )
{
if( !GFootprintList.GetCount() )
{
GFootprintList.ReadCacheFromFile( Prj().GetProjectPath() + "fp-info-cache" );
}
}
PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME()