Browse Source

Used cached footprints without check in preview

Between the time the user loads the footprint preview in cvpcb or Add
Footprint in pcbnew, we don't need to verify cache integrity to display
the footprint.  We use the cache copy when displaying until we close the
selection window and re-open.  This limits our need to iterate over the
full directory on every footprint display.

Alternate solutions for v7 should include looking into libfswatch for
change detection
6.0.7
Seth Hillbrand 5 years ago
parent
commit
c15a9e60d4
  1. 5
      cvpcb/display_footprints_frame.cpp
  2. 7
      pcbnew/footprint_preview_panel.cpp
  3. 7
      pcbnew/generate_footprint_info.cpp
  4. 2
      pcbnew/plugins/kicad/kicad_plugin.cpp

5
cvpcb/display_footprints_frame.cpp

@ -405,7 +405,10 @@ FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintNam
try
{
footprint = fpTable->FootprintLoad( libNickname, fpName );
const FOOTPRINT* fp = fpTable->GetEnumeratedFootprint( libNickname, fpName );
if( fp )
footprint = static_cast<FOOTPRINT*>( fp->Duplicate() );
}
catch( const IO_ERROR& ioe )
{

7
pcbnew/footprint_preview_panel.cpp

@ -138,7 +138,12 @@ bool FOOTPRINT_PREVIEW_PANEL::DisplayFootprint( const LIB_ID& aFPID )
try
{
m_currentFootprint.reset( fptbl->FootprintLoadWithOptionalNickname( aFPID ) );
const FOOTPRINT* fp = fptbl->GetEnumeratedFootprint( aFPID.GetLibNickname(), aFPID.GetLibItemName() );
if( fp )
m_currentFootprint.reset( static_cast<FOOTPRINT*>( fp->Duplicate() ) );
else
m_currentFootprint.reset();
}
catch( ... )
{

7
pcbnew/generate_footprint_info.cpp

@ -49,7 +49,8 @@ class FOOTPRINT_INFO_GENERATOR
wxString m_html;
FP_LIB_TABLE* m_fp_lib_table;
LIB_ID const m_lib_id;
FOOTPRINT* m_footprint;
const FOOTPRINT* m_footprint;
public:
FOOTPRINT_INFO_GENERATOR( FP_LIB_TABLE* aFpLibTable, LIB_ID const& aLibId )
@ -71,8 +72,8 @@ public:
try
{
m_footprint = m_fp_lib_table->FootprintLoad( m_lib_id.GetLibNickname(),
m_lib_id.GetLibItemName() );
m_footprint = m_fp_lib_table->GetEnumeratedFootprint( m_lib_id.GetLibNickname(),
m_lib_id.GetLibItemName() );
}
catch( const IO_ERROR& ioe )
{

2
pcbnew/plugins/kicad/kicad_plugin.cpp

@ -2284,7 +2284,7 @@ FOOTPRINT* PCB_IO::FootprintLoad( const wxString& aLibraryPath, const wxString&
if( footprint )
{
FOOTPRINT* copy = (FOOTPRINT*) footprint->Duplicate();
FOOTPRINT* copy = static_cast<FOOTPRINT*>( footprint->Duplicate() );
copy->SetParent( nullptr );
return copy;
}

Loading…
Cancel
Save