If the user has a selection then show the footprint.
Don't be pedantic about it having to come from the footprint list, the component list also has footprints assigned. (cherry picked from commit 759fba1)
This commit is contained in:
parent
34857d06c4
commit
7d71861015
|
@ -530,6 +530,8 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
|
|||
m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, component,
|
||||
m_currentSearchPattern, m_filteringOptions);
|
||||
|
||||
m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
|
||||
|
||||
refreshAfterComponentSearch (component);
|
||||
}
|
||||
|
||||
|
@ -556,7 +558,7 @@ void CVPCB_MAINFRAME::refreshAfterComponentSearch( COMPONENT* component )
|
|||
{
|
||||
wxString module = FROM_UTF8( component->GetFPID().Format().c_str() );
|
||||
|
||||
bool found = false;
|
||||
m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
|
||||
|
||||
for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
|
||||
{
|
||||
|
@ -569,23 +571,12 @@ void CVPCB_MAINFRAME::refreshAfterComponentSearch( COMPONENT* component )
|
|||
if( module.Cmp( footprintName ) == 0 )
|
||||
{
|
||||
m_footprintListBox->SetSelection( ii, true );
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !found )
|
||||
{
|
||||
int ii = m_footprintListBox->GetSelection();
|
||||
|
||||
if ( ii >= 0 )
|
||||
m_footprintListBox->SetSelection( ii, false );
|
||||
|
||||
if( GetFootprintViewerFrame() )
|
||||
{
|
||||
CreateScreenCmp();
|
||||
}
|
||||
}
|
||||
if( GetFootprintViewerFrame() )
|
||||
CreateScreenCmp();
|
||||
}
|
||||
|
||||
SendMessageToEESCHEMA();
|
||||
|
|
|
@ -466,59 +466,43 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
|
|||
|
||||
void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
|
||||
{
|
||||
wxString msg;
|
||||
CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
|
||||
MODULE* module = nullptr;
|
||||
const FOOTPRINT_INFO* module_info = nullptr;
|
||||
|
||||
CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
|
||||
if( GetBoard()->m_Modules.GetCount() )
|
||||
GetBoard()->m_Modules.DeleteAll();
|
||||
|
||||
wxString footprintName = parentframe->GetSelectedFootprint();
|
||||
|
||||
if( footprintName.IsEmpty() )
|
||||
{
|
||||
COMPONENT* comp = parentframe->GetSelectedComponent();
|
||||
|
||||
if( comp )
|
||||
footprintName = comp->GetFPID().GetUniStringLibId();
|
||||
}
|
||||
|
||||
if( !footprintName.IsEmpty() )
|
||||
{
|
||||
msg.Printf( _( "Footprint: %s" ), GetChars( footprintName ) );
|
||||
SetTitle( wxString::Format( _( "Footprint: %s" ), footprintName ) );
|
||||
|
||||
SetTitle( msg );
|
||||
const FOOTPRINT_INFO* module_info =
|
||||
parentframe->m_FootprintsList->GetModuleInfo( footprintName );
|
||||
module = Get_Module( footprintName );
|
||||
|
||||
const wxChar* libname;
|
||||
|
||||
if( module_info )
|
||||
libname = GetChars( module_info->GetNickname() );
|
||||
else
|
||||
libname = GetChars( wxT( "???" ) );
|
||||
|
||||
msg.Printf( _( "Lib: %s" ), libname );
|
||||
|
||||
SetStatusText( msg, 0 );
|
||||
|
||||
if( GetBoard()->m_Modules.GetCount() )
|
||||
{
|
||||
// there is only one module in the list
|
||||
GetBoard()->m_Modules.DeleteAll();
|
||||
}
|
||||
|
||||
MODULE* module = Get_Module( footprintName );
|
||||
|
||||
if( module )
|
||||
GetBoard()->m_Modules.PushBack( module );
|
||||
|
||||
Zoom_Automatique( false );
|
||||
}
|
||||
else // No footprint to display. Erase old footprint, if any
|
||||
{
|
||||
if( GetBoard()->m_Modules.GetCount() )
|
||||
{
|
||||
GetBoard()->m_Modules.DeleteAll();
|
||||
Zoom_Automatique( false );
|
||||
SetStatusText( wxEmptyString, 0 );
|
||||
}
|
||||
module_info = parentframe->m_FootprintsList->GetModuleInfo( footprintName );
|
||||
}
|
||||
|
||||
// Display new cursor coordinates and zoom value:
|
||||
if( module )
|
||||
GetBoard()->m_Modules.PushBack( module );
|
||||
|
||||
if( module_info )
|
||||
SetStatusText( wxString::Format( _( "Lib: %s" ), module_info->GetNickname() ), 0 );
|
||||
else
|
||||
SetStatusText( wxEmptyString, 0 );
|
||||
|
||||
UpdateStatusBar();
|
||||
|
||||
Zoom_Automatique( false );
|
||||
GetCanvas()->Refresh();
|
||||
|
||||
Update3DView();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue