Init Footprint Viewer with current FPID.

Fixes: lp:1757421
* https://bugs.launchpad.net/kicad/+bug/1757421
This commit is contained in:
Jeff Young 2018-03-21 21:13:10 +00:00
parent 99e659ff54
commit 79fe134495
3 changed files with 28 additions and 1 deletions

View File

@ -613,7 +613,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler( wxCommandEvent& even
else if( fieldNdx == FOOTPRINT )
{
// pick a footprint using the footprint picker.
wxString fpid;
wxString fpid = fieldValueTextCtrl->GetValue();
KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_MODULE_VIEWER_MODAL, true, this );

View File

@ -622,6 +622,24 @@ void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
}
bool FOOTPRINT_VIEWER_FRAME::ShowModal( wxString* aFootprint, wxWindow* aResultantFocusWindow )
{
if( aFootprint )
{
LIB_ID fpid( *aFootprint );
if( fpid.IsValid() )
{
setCurNickname( fpid.GetLibNickname() );
setCurFootprintName( fpid.GetLibItemName() );
ReCreateFootprintList();
SelectAndViewFootprint( NEW_PART );
}
}
return KIWAY_PLAYER::ShowModal( aFootprint, aResultantFocusWindow );
}
bool FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
{
bool eventHandled = true;

View File

@ -64,6 +64,15 @@ public:
*/
void ReCreateLibraryList();
/**
* Function ShowModal
*
* Runs the Footprint Viewer as a modal dialog.
* @param aFootprint an optional FPID string to initialize the viewer with and to
* return a selected footprint through.
*/
bool ShowModal( wxString* aFootprint, wxWindow* aResultantFocusWindow ) override;
private:
wxListBox* m_libList; // The list of libs names