void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event ) { if( m_skipComponentSelect ) return; wxString libraryName; COMPONENT* component = GetSelectedComponent(); libraryName = m_libListBox->GetSelectedLibrary(); m_footprintListBox->SetFootprints( m_FootprintsList, libraryName, component, m_currentSearchPattern, m_filteringOptions); refreshAfterComponentSearch (component); }
void CVPCB_MAINFRAME::DisplayStatus() { wxString msg; COMPONENT* component; if( wxWindow::FindFocus() == m_compListBox || wxWindow::FindFocus() == m_libListBox ) { msg.Printf( _( "Components: %d, unassigned: %d" ), (int) m_netlist.GetCount(), m_undefinedComponentCnt ); SetStatusText( msg, 0 ); msg.Empty(); component = GetSelectedComponent(); if( component ) { for( unsigned ii = 0; ii < component->GetFootprintFilters().GetCount(); ii++ ) { if( msg.IsEmpty() ) msg += component->GetFootprintFilters()[ii]; else msg += wxT( ", " ) + component->GetFootprintFilters()[ii]; } msg = _( "Filter list: " ) + msg; } SetStatusText( msg, 1 ); } else { wxString footprintName = m_footprintListBox->GetSelectedFootprint(); FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( footprintName ); if( module ) // can be NULL if no netlist loaded { msg = _( "Description: " ) + module->GetDoc(); SetStatusText( msg, 0 ); msg = _( "Key words: " ) + module->GetKeywords(); SetStatusText( msg, 1 ); } } msg.Empty(); wxString filters; if( m_footprintListBox ) { if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) ) filters = _( "key words" ); if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) ) { if( !filters.IsEmpty() ) filters += wxT( "+" ); filters += _( "pin count" ); } if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) ) { if( !filters.IsEmpty() ) filters += wxT( "+" ); filters += _( "library" ); } if( filters.IsEmpty() ) msg = _( "No filtering" ); else msg.Printf( _( "Filtered by %s" ), GetChars( filters ) ); msg << wxT( ": " ) << m_footprintListBox->GetCount(); SetStatusText( msg, 2 ); } }
void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event ) { if( m_skipComponentSelect ) return; wxString libraryName; COMPONENT* component = NULL; int filter = FOOTPRINTS_LISTBOX::UNFILTERED; if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) ) filter |= FOOTPRINTS_LISTBOX::BY_COMPONENT; if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) ) filter |= FOOTPRINTS_LISTBOX::BY_PIN_COUNT; if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) ) filter |= FOOTPRINTS_LISTBOX::BY_LIBRARY; component = GetSelectedComponent(); libraryName = m_libListBox->GetSelectedLibrary(); m_footprintListBox->SetFootprints( m_footprints, libraryName, component, filter ); // Tell AuiMgr that objects are changed ! if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized // (could be not the case when starting CvPcb m_auimgr.Update(); if( component == NULL ) return; // Preview of the already assigned footprint. // Find the footprint that was already chosen for this component and select it, // but only if the selection is made from the component list or the library list. // If the selection is made from the footprint list, do not change the current // selected footprint. if( FindFocus() == m_compListBox || FindFocus() == m_libListBox ) { wxString module = FROM_UTF8( component->GetFPID().Format().c_str() ); bool found = false; for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ ) { wxString footprintName; wxString msg = m_footprintListBox->OnGetItemText( ii, 0 ); msg.Trim( true ); msg.Trim( false ); footprintName = msg.AfterFirst( wxChar( ' ' ) ); 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( GetFpViewerFrame() ) { CreateScreenCmp(); } } } SendMessageToEESCHEMA(); DisplayStatus(); }