Select assigned footprint in right panel.

Fixes: lp:1793294
* https://bugs.launchpad.net/kicad/+bug/1793294
This commit is contained in:
Jeff Young 2018-09-22 16:20:45 +01:00
parent a1bcc4ba1e
commit dd9b0c2dc6
3 changed files with 24 additions and 7 deletions

View File

@ -480,6 +480,9 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, component,
m_currentSearchPattern, m_filteringOptions);
if( component && component->GetFPID().IsValid() )
m_footprintListBox->SetSelectedFootprint( component->GetFPID() );
else
m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
refreshAfterComponentSearch (component);

View File

@ -112,15 +112,28 @@ void FOOTPRINTS_LISTBOX::SetSelection( int index, bool State )
if( (index >= 0) && (GetCount() > 0) )
{
#ifndef __WXMAC__
Select( index, State );
#endif
EnsureVisible( index );
#ifdef __WXMAC__
Refresh();
#endif
}
}
void FOOTPRINTS_LISTBOX::SetSelectedFootprint( const LIB_ID& aFPID )
{
wxString id = wxString::Format( "%s:%s",
GetChars( aFPID.GetLibNickname() ),
GetChars( aFPID.GetLibItemName() ) );
for( size_t i = 0; i < GetCount(); ++i )
{
wxString candidate = m_footprintList.Item( i ).substr( 4 );
if( candidate.CmpNoCase( id ) == 0 )
{
SetSelection( i, true );
return;
}
}
}

View File

@ -110,6 +110,7 @@ public:
int GetCount();
void SetSelection( int index, bool State = true );
void SetSelectedFootprint( const LIB_ID& aFPID );
void SetString( unsigned linecount, const wxString& text );
void AppendLine( const wxString& text );