void DRC::testTracks( wxWindow *aActiveWindow, bool aShowProgressBar ) { wxProgressDialog * progressDialog = NULL; const int delta = 500; // This is the number of tests between 2 calls to the // progress bar int count = 0; for( TRACK* segm = m_pcb->m_Track; segm && segm->Next(); segm = segm->Next() ) count++; int deltamax = count/delta; if( aShowProgressBar && deltamax > 3 ) { progressDialog = new wxProgressDialog( _( "Track clearances" ), wxEmptyString, deltamax, aActiveWindow, wxPD_AUTO_HIDE | wxPD_CAN_ABORT | wxPD_APP_MODAL | wxPD_ELAPSED_TIME ); progressDialog->Update( 0, wxEmptyString ); } int ii = 0; count = 0; for( TRACK* segm = m_pcb->m_Track; segm && segm->Next(); segm = segm->Next() ) { if ( ii++ > delta ) { ii = 0; count++; if( progressDialog ) { if( !progressDialog->Update( count, wxEmptyString ) ) break; // Aborted by user #ifdef __WXMAC__ // Work around a dialog z-order issue on OS X if( count == deltamax ) aActiveWindow->Raise(); #endif } } if( !doTrackDrc( segm, segm->Next(), true ) ) { wxASSERT( m_currentMarker ); m_pcb->Add( m_currentMarker ); m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); m_currentMarker = 0; } } if( progressDialog ) progressDialog->Destroy(); }
void DRC::testTracks( bool aShowProgressBar ) { wxProgressDialog * progressDialog = NULL; const int delta = 500; // This is the number of tests between 2 calls to the // progress bar int count = 0; for( TRACK* segm = m_pcb->m_Track; segm && segm->Next(); segm = segm->Next() ) count++; int deltamax = count/delta; if( aShowProgressBar && deltamax > 3 ) { progressDialog = new wxProgressDialog( _( "Track clearances" ), wxEmptyString, deltamax, m_mainWindow, wxPD_AUTO_HIDE | wxPD_CAN_ABORT ); progressDialog->Update( 0, wxEmptyString ); } int ii = 0; count = 0; for( TRACK* segm = m_pcb->m_Track; segm && segm->Next(); segm = segm->Next() ) { if ( ii++ > delta ) { ii = 0; count++; if( progressDialog ) { if( !progressDialog->Update( count, wxEmptyString ) ) break; // Aborted by user } } if( !doTrackDrc( segm, segm->Next(), true ) ) { wxASSERT( m_currentMarker ); m_pcb->Add( m_currentMarker ); m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); m_currentMarker = 0; } } if( progressDialog ) progressDialog->Destroy(); }
int DRC::Drc( TRACK* aRefSegm, TRACK* aList ) { updatePointers(); if( !doTrackDrc( aRefSegm, aList, true ) ) { wxASSERT( m_currentMarker ); m_pcbEditorFrame->SetMsgPanel( m_currentMarker ); return BAD_DRC; } if( !doTrackKeepoutDrc( aRefSegm ) ) { wxASSERT( m_currentMarker ); m_pcbEditorFrame->SetMsgPanel( m_currentMarker ); return BAD_DRC; } return OK_DRC; }