FIX: footprint viewer: avoid display a empty footprint list when a library is selected.

When invoking the viewer the fp list was sometime blank until a new lib is selected.

Fixes: lp:1851799
https://bugs.launchpad.net/kicad/+bug/1851799
This commit is contained in:
jean-pierre charras 2019-11-08 17:41:39 +01:00
parent 0a018f514b
commit c4023637df
1 changed files with 7 additions and 7 deletions

View File

@ -259,6 +259,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame
{ {
ReCreateFootprintList();
Raise(); // On some window managers, this is needed Raise(); // On some window managers, this is needed
Show( true ); Show( true );
} }
@ -370,10 +371,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
m_fpList->Clear(); m_fpList->Clear();
if( !getCurNickname() ) if( !getCurNickname() )
{
setCurFootprintName( wxEmptyString ); setCurFootprintName( wxEmptyString );
return;
}
auto fp_info_list = FOOTPRINT_LIST::GetInstance( Kiway() ); auto fp_info_list = FOOTPRINT_LIST::GetInstance( Kiway() );
@ -822,17 +820,19 @@ bool FOOTPRINT_VIEWER_FRAME::ShowModal( wxString* aFootprint, wxWindow* aParent
} }
else else
{ {
// Update last selection:
setCurNickname( nickname ); setCurNickname( nickname );
setCurFootprintName( fpid.GetLibItemName() ); setCurFootprintName( fpid.GetLibItemName() );
m_libList->SetStringSelection( nickname ); m_libList->SetStringSelection( nickname );
ReCreateFootprintList();
} }
SelectAndViewFootprint( NEW_PART );
} }
} }
// Rebuild the fp list from the last selected library,
// and show the last selected footprint
ReCreateFootprintList();
SelectAndViewFootprint( NEW_PART );
bool retval = KIWAY_PLAYER::ShowModal( aFootprint, aParent ); bool retval = KIWAY_PLAYER::ShowModal( aFootprint, aParent );
m_libFilter->SetFocus(); m_libFilter->SetFocus();