diff --git a/TODO.txt b/TODO.txt index 96a071639f..6bfbb36099 100644 --- a/TODO.txt +++ b/TODO.txt @@ -26,11 +26,6 @@ Common but is now in scripts/python/ky temporarily. -CvPCB ------ -* Preview of the already assigned footprint. - - EESchema -------- * Drag and drop between two EESchema windows. diff --git a/cvpcb/cvframe.cpp b/cvpcb/cvframe.cpp index f0e93453af..4b52238608 100644 --- a/cvpcb/cvframe.cpp +++ b/cvpcb/cvframe.cpp @@ -525,6 +525,25 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event ) } 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(); DisplayStatus(); } @@ -660,13 +679,13 @@ void CVPCB_MAINFRAME::SendMessageToEESCHEMA() selection = m_ListCmp->GetSelection(); - if ( selection < 0 ) - selection = 0; + if ( selection < 0 ) + selection = 0; if( &m_components[ selection ] == NULL ) - return; + return; - Component = &m_components[ selection ]; + Component = &m_components[ selection ]; sprintf( cmd, "$PART: \"%s\"", TO_UTF8( Component->m_Reference ) );