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
This commit is contained in:
parent
b36e1c741d
commit
c15a9e60d4
|
@ -405,7 +405,10 @@ FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintNam
|
||||||
|
|
||||||
try
|
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 )
|
catch( const IO_ERROR& ioe )
|
||||||
{
|
{
|
||||||
|
|
|
@ -138,7 +138,12 @@ bool FOOTPRINT_PREVIEW_PANEL::DisplayFootprint( const LIB_ID& aFPID )
|
||||||
|
|
||||||
try
|
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( ... )
|
catch( ... )
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,7 +49,8 @@ class FOOTPRINT_INFO_GENERATOR
|
||||||
wxString m_html;
|
wxString m_html;
|
||||||
FP_LIB_TABLE* m_fp_lib_table;
|
FP_LIB_TABLE* m_fp_lib_table;
|
||||||
LIB_ID const m_lib_id;
|
LIB_ID const m_lib_id;
|
||||||
FOOTPRINT* m_footprint;
|
|
||||||
|
const FOOTPRINT* m_footprint;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FOOTPRINT_INFO_GENERATOR( FP_LIB_TABLE* aFpLibTable, LIB_ID const& aLibId )
|
FOOTPRINT_INFO_GENERATOR( FP_LIB_TABLE* aFpLibTable, LIB_ID const& aLibId )
|
||||||
|
@ -71,8 +72,8 @@ public:
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_footprint = m_fp_lib_table->FootprintLoad( m_lib_id.GetLibNickname(),
|
m_footprint = m_fp_lib_table->GetEnumeratedFootprint( m_lib_id.GetLibNickname(),
|
||||||
m_lib_id.GetLibItemName() );
|
m_lib_id.GetLibItemName() );
|
||||||
}
|
}
|
||||||
catch( const IO_ERROR& ioe )
|
catch( const IO_ERROR& ioe )
|
||||||
{
|
{
|
||||||
|
|
|
@ -2284,7 +2284,7 @@ FOOTPRINT* PCB_IO::FootprintLoad( const wxString& aLibraryPath, const wxString&
|
||||||
|
|
||||||
if( footprint )
|
if( footprint )
|
||||||
{
|
{
|
||||||
FOOTPRINT* copy = (FOOTPRINT*) footprint->Duplicate();
|
FOOTPRINT* copy = static_cast<FOOTPRINT*>( footprint->Duplicate() );
|
||||||
copy->SetParent( nullptr );
|
copy->SetParent( nullptr );
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue