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_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, component,
|
||||||
m_currentSearchPattern, m_filteringOptions);
|
m_currentSearchPattern, m_filteringOptions);
|
||||||
|
|
||||||
|
m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
|
||||||
|
|
||||||
refreshAfterComponentSearch (component);
|
refreshAfterComponentSearch (component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,7 +558,7 @@ void CVPCB_MAINFRAME::refreshAfterComponentSearch( COMPONENT* component )
|
||||||
{
|
{
|
||||||
wxString module = FROM_UTF8( component->GetFPID().Format().c_str() );
|
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++ )
|
for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
|
@ -569,24 +571,13 @@ void CVPCB_MAINFRAME::refreshAfterComponentSearch( COMPONENT* component )
|
||||||
if( module.Cmp( footprintName ) == 0 )
|
if( module.Cmp( footprintName ) == 0 )
|
||||||
{
|
{
|
||||||
m_footprintListBox->SetSelection( ii, true );
|
m_footprintListBox->SetSelection( ii, true );
|
||||||
found = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !found )
|
|
||||||
{
|
|
||||||
int ii = m_footprintListBox->GetSelection();
|
|
||||||
|
|
||||||
if ( ii >= 0 )
|
|
||||||
m_footprintListBox->SetSelection( ii, false );
|
|
||||||
|
|
||||||
if( GetFootprintViewerFrame() )
|
if( GetFootprintViewerFrame() )
|
||||||
{
|
|
||||||
CreateScreenCmp();
|
CreateScreenCmp();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SendMessageToEESCHEMA();
|
SendMessageToEESCHEMA();
|
||||||
DisplayStatus();
|
DisplayStatus();
|
||||||
|
|
|
@ -466,59 +466,43 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
|
||||||
|
|
||||||
void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
|
void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
|
||||||
{
|
{
|
||||||
wxString msg;
|
|
||||||
|
|
||||||
CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
|
CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
|
||||||
|
MODULE* module = nullptr;
|
||||||
|
const FOOTPRINT_INFO* module_info = nullptr;
|
||||||
|
|
||||||
|
if( GetBoard()->m_Modules.GetCount() )
|
||||||
|
GetBoard()->m_Modules.DeleteAll();
|
||||||
|
|
||||||
wxString footprintName = parentframe->GetSelectedFootprint();
|
wxString footprintName = parentframe->GetSelectedFootprint();
|
||||||
|
|
||||||
if( !footprintName.IsEmpty() )
|
if( footprintName.IsEmpty() )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Footprint: %s" ), GetChars( footprintName ) );
|
COMPONENT* comp = parentframe->GetSelectedComponent();
|
||||||
|
|
||||||
SetTitle( msg );
|
if( comp )
|
||||||
const FOOTPRINT_INFO* module_info =
|
footprintName = comp->GetFPID().GetUniStringLibId();
|
||||||
parentframe->m_FootprintsList->GetModuleInfo( 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( !footprintName.IsEmpty() )
|
||||||
|
{
|
||||||
|
SetTitle( wxString::Format( _( "Footprint: %s" ), footprintName ) );
|
||||||
|
|
||||||
|
module = Get_Module( footprintName );
|
||||||
|
|
||||||
|
module_info = parentframe->m_FootprintsList->GetModuleInfo( footprintName );
|
||||||
|
}
|
||||||
|
|
||||||
if( module )
|
if( module )
|
||||||
GetBoard()->m_Modules.PushBack( module );
|
GetBoard()->m_Modules.PushBack( module );
|
||||||
|
|
||||||
Zoom_Automatique( false );
|
if( module_info )
|
||||||
}
|
SetStatusText( wxString::Format( _( "Lib: %s" ), module_info->GetNickname() ), 0 );
|
||||||
else // No footprint to display. Erase old footprint, if any
|
else
|
||||||
{
|
|
||||||
if( GetBoard()->m_Modules.GetCount() )
|
|
||||||
{
|
|
||||||
GetBoard()->m_Modules.DeleteAll();
|
|
||||||
Zoom_Automatique( false );
|
|
||||||
SetStatusText( wxEmptyString, 0 );
|
SetStatusText( wxEmptyString, 0 );
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Display new cursor coordinates and zoom value:
|
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
|
Zoom_Automatique( false );
|
||||||
GetCanvas()->Refresh();
|
GetCanvas()->Refresh();
|
||||||
|
|
||||||
Update3DView();
|
Update3DView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue