Browse Source

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)
pull/17/head
Jeff Young 7 years ago
parent
commit
7d71861015
  1. 19
      cvpcb/cvpcb_mainframe.cpp
  2. 62
      cvpcb/display_footprints_frame.cpp

19
cvpcb/cvpcb_mainframe.cpp

@ -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();

62
cvpcb/display_footprints_frame.cpp

@ -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() )
if( footprintName.IsEmpty() )
{
msg.Printf( _( "Footprint: %s" ), GetChars( footprintName ) );
SetTitle( msg );
const FOOTPRINT_INFO* module_info =
parentframe->m_FootprintsList->GetModuleInfo( footprintName );
const wxChar* libname;
COMPONENT* comp = parentframe->GetSelectedComponent();
if( module_info )
libname = GetChars( module_info->GetNickname() );
else
libname = GetChars( wxT( "???" ) );
msg.Printf( _( "Lib: %s" ), libname );
if( comp )
footprintName = comp->GetFPID().GetUniStringLibId();
}
SetStatusText( msg, 0 );
if( !footprintName.IsEmpty() )
{
SetTitle( wxString::Format( _( "Footprint: %s" ), footprintName ) );
if( GetBoard()->m_Modules.GetCount() )
{
// there is only one module in the list
GetBoard()->m_Modules.DeleteAll();
}
module = Get_Module( footprintName );
MODULE* module = Get_Module( footprintName );
module_info = parentframe->m_FootprintsList->GetModuleInfo( footprintName );
}
if( module )
GetBoard()->m_Modules.PushBack( module );
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 );
}
}
if( module_info )
SetStatusText( wxString::Format( _( "Lib: %s" ), module_info->GetNickname() ), 0 );
else
SetStatusText( wxEmptyString, 0 );
// Display new cursor coordinates and zoom value:
UpdateStatusBar();
Zoom_Automatique( false );
GetCanvas()->Refresh();
Update3DView();
}

Loading…
Cancel
Save