Make CvPcb correctly preview the selected component footprint if one has already been assigned.

This commit is contained in:
Guillaume Simard 2011-12-14 15:23:32 -05:00 committed by Wayne Stambaugh
parent 95891006cd
commit 6767a0b2a3
2 changed files with 23 additions and 9 deletions

View File

@ -26,11 +26,6 @@ Common
but is now in scripts/python/ky temporarily. but is now in scripts/python/ky temporarily.
CvPCB
-----
* Preview of the already assigned footprint.
EESchema EESchema
-------- --------
* Drag and drop between two EESchema windows. * Drag and drop between two EESchema windows.

View File

@ -525,6 +525,25 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
} }
m_FootprintList->SetFootprintFilteredList( &m_components[ selection ], m_footprints ); m_FootprintList->SetFootprintFilteredList( &m_components[ selection ], m_footprints );
// Preview of the already assigned footprint.
// Find the footprint that was already choosen for this component and select it.
wxString module = *(&m_components[ selection ].m_Module);
for( int ii = 0; ii < m_FootprintList->GetCount(); ii++ )
{
wxString footprintName;
wxString msg = (*m_FootprintList->m_ActiveFootprintList)[ii];
msg.Trim( true );
msg.Trim( false );
footprintName = msg.AfterFirst( wxChar( ' ' ) );
if( module.Cmp( footprintName ) == 0 )
m_FootprintList->SetSelection( ii, true );
else
m_FootprintList->SetSelection( ii, false );
}
SendMessageToEESCHEMA(); SendMessageToEESCHEMA();
DisplayStatus(); DisplayStatus();
} }
@ -660,13 +679,13 @@ void CVPCB_MAINFRAME::SendMessageToEESCHEMA()
selection = m_ListCmp->GetSelection(); selection = m_ListCmp->GetSelection();
if ( selection < 0 ) if ( selection < 0 )
selection = 0; selection = 0;
if( &m_components[ selection ] == NULL ) if( &m_components[ selection ] == NULL )
return; return;
Component = &m_components[ selection ]; Component = &m_components[ selection ];
sprintf( cmd, "$PART: \"%s\"", TO_UTF8( Component->m_Reference ) ); sprintf( cmd, "$PART: \"%s\"", TO_UTF8( Component->m_Reference ) );