void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard() { DIALOG_FOOTPRINT_WIZARD_LIST* selectWizard = new DIALOG_FOOTPRINT_WIZARD_LIST( this ); if( selectWizard->ShowModal() != wxID_OK ) return; FOOTPRINT_WIZARD* footprintWizard = selectWizard->GetWizard(); if( footprintWizard ) { m_wizardName = footprintWizard->GetName(); m_wizardDescription = footprintWizard->GetDescription(); } else { m_wizardName = wxT( "" ); m_wizardDescription = wxT( "" ); } ReloadFootprint(); Zoom_Automatique( false ); DisplayWizardInfos(); ReCreatePageList(); ReCreateParameterList(); }
FOOTPRINT_WIZARD* FOOTPRINT_WIZARDS::GetWizard( wxString aName ) { int max = GetSize(); for( int i=0; i<max; i++ ) { FOOTPRINT_WIZARD *wizard = GetWizard( i ); wxString name = wizard->GetName(); if ( name.Cmp( aName ) ) return wizard; } return NULL; }
void DIALOG_FOOTPRINT_WIZARD_LIST::initLists() { // Current wizard selection, empty or first m_footprintWizard = NULL; int n_wizards = FOOTPRINT_WIZARDS::GetWizardsCount(); if( n_wizards ) m_footprintWizard = FOOTPRINT_WIZARDS::GetWizard( 0 ); // Choose selection mode and insert the needed rows m_footprintGeneratorsGrid->SetSelectionMode( wxGrid::wxGridSelectRows ); int curr_row_cnt = m_footprintGeneratorsGrid->GetNumberRows(); m_footprintGeneratorsGrid->DeleteRows( 0, curr_row_cnt ); m_footprintGeneratorsGrid->InsertRows( 0, n_wizards ); // Put all wizards in the list for( int ii = 0; ii < n_wizards; ii++ ) { wxString num = wxString::Format( "%d", ii+1 ); FOOTPRINT_WIZARD *wizard = FOOTPRINT_WIZARDS::GetWizard( ii ); wxString name = wizard->GetName(); wxString description = wizard->GetDescription(); wxString image = wizard->GetImage(); m_footprintGeneratorsGrid->SetCellValue( ii, FP_GEN_ROW_NUMBER, num ); m_footprintGeneratorsGrid->SetCellValue( ii, FP_GEN_ROW_NAME, name ); m_footprintGeneratorsGrid->SetCellValue( ii, FP_GEN_ROW_DESCR, description ); } m_footprintGeneratorsGrid->AutoSizeColumns(); // Auto-expand the description column int width = m_footprintGeneratorsGrid->GetClientSize().GetWidth() - m_footprintGeneratorsGrid->GetRowLabelSize() - m_footprintGeneratorsGrid->GetColSize( FP_GEN_ROW_NAME ); if ( width > m_footprintGeneratorsGrid->GetColMinimalAcceptableWidth() ) m_footprintGeneratorsGrid->SetColSize( FP_GEN_ROW_DESCR, width ); // Select the first row m_footprintGeneratorsGrid->ClearSelection(); m_footprintGeneratorsGrid->SelectRow( 0, false ); // Display info about scripts: Search paths wxString message; pcbnewGetScriptsSearchPaths( message ); m_tcSearchPaths->SetValue( message ); // Display info about scripts: unloadable scripts (due to syntax errors is python source) pcbnewGetUnloadableScriptNames( message ); if( message.IsEmpty() ) { m_tcNotLoaded->SetValue( _( "All footprint generator scripts were loaded" ) ); m_buttonShowTrace->Show( false ); } else m_tcNotLoaded->SetValue( message ); }