From d52429fc3c8184d024b2ddb28b0b2a47f2213a13 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 5 Aug 2018 00:07:25 +0100 Subject: [PATCH] Read footprint info cache when fpinfo requested via kiway. --- common/footprint_info.cpp | 10 +++++++++- pcbnew/pcb_base_edit_frame.cpp | 5 +---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/common/footprint_info.cpp b/common/footprint_info.cpp index 5a8c7d6fac..f094819a9c 100644 --- a/common/footprint_info.cpp +++ b/common/footprint_info.cpp @@ -142,7 +142,15 @@ static FOOTPRINT_LIST* get_instance_from_id( KIWAY& aKiway, int aId ) FOOTPRINT_LIST* FOOTPRINT_LIST::GetInstance( KIWAY& aKiway ) { - return get_instance_from_id( aKiway, KIFACE_FOOTPRINT_LIST ); + FOOTPRINT_LIST* footprintInfo = get_instance_from_id( aKiway, KIFACE_FOOTPRINT_LIST ); + + if( !footprintInfo->GetCount() ) + { + wxTextFile footprintInfoCache( aKiway.Prj().GetProjectPath() + "fp-info-cache" ); + footprintInfo->ReadCacheFromFile( &footprintInfoCache ); + } + + return footprintInfo; } diff --git a/pcbnew/pcb_base_edit_frame.cpp b/pcbnew/pcb_base_edit_frame.cpp index aaf1ceba4d..28efcd0b6f 100644 --- a/pcbnew/pcb_base_edit_frame.cpp +++ b/pcbnew/pcb_base_edit_frame.cpp @@ -38,13 +38,10 @@ 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 ) { - static bool oneShot = true; - - if( oneShot ) + if( !GFootprintList.GetCount() ) { wxTextFile footprintInfoCache( Prj().GetProjectPath() + "fp-info-cache" ); GFootprintList.ReadCacheFromFile( &footprintInfoCache ); - oneShot = false; } }