Commit 3465bfeb authored by dickelbeck's avatar dickelbeck

2nd of 3 commits for DrcDialog rework

parent 128521f0
...@@ -281,6 +281,17 @@ public: ...@@ -281,6 +281,17 @@ public:
return m_markers[index]; return m_markers[index];
return NULL; return NULL;
} }
/**
* Function GetMARKERCount
* @return int - The number of MARKERS.
*/
int GetMARKERCount() const
{
return (int) m_markers.size();
}
/* Routines de calcul des nombres de segments pistes et zones */ /* Routines de calcul des nombres de segments pistes et zones */
int GetNumSegmTrack(); int GetNumSegmTrack();
......
...@@ -9,6 +9,62 @@ ...@@ -9,6 +9,62 @@
#include "bitmaps.h" #include "bitmaps.h"
wxString DRC_ITEM::GetErrorText() const
{
switch( m_ErrorCode )
{
// case DRCE_: not assigned yet
case DRCE_UNCONNECTED_PADS:
return wxString( _("Unconnected pads") );
case DRCE_TRACK_NEAR_THROUGH_HOLE:
return wxString( _("Track near thru-hole") );
case DRCE_TRACK_NEAR_PAD:
return wxString( _("Track near pad") );
case DRCE_TRACK_NEAR_VIA:
return wxString( _("Track near via") );
case DRCE_VIA_NEAR_VIA:
return wxString( _("Via near via") );
case DRCE_VIA_NEAR_TRACK:
return wxString( _("Via near track") );
case DRCE_TRACK_ENDS1:
case DRCE_TRACK_ENDS2:
case DRCE_TRACK_ENDS3:
case DRCE_TRACK_ENDS4:
case DRCE_ENDS_PROBLEM1:
case DRCE_ENDS_PROBLEM2:
case DRCE_ENDS_PROBLEM3:
case DRCE_ENDS_PROBLEM4:
case DRCE_ENDS_PROBLEM5:
return wxString( _("Two track ends") );
case DRCE_TRACK_UNKNOWN1:
return wxString( _("This looks bad") ); ///< @todo check source code and change this comment
case DRCE_TRACKS_CROSSING:
return wxString( _("Tracks crossing") );
case DRCE_PAD_NEAR_PAD1:
return wxString( _("Pad near pad") );
default:
return wxString( wxT("PROGRAM BUG, PLEASE LEAVE THE ROOM.") );
}
}
wxString DRC_ITEM::ShowCoord( const wxPoint& aPos )
{
wxString temp;
wxString ret;
ret << wxT("@(") << valeur_param( aPos.x, temp );
ret << wxT(",") << valeur_param( aPos.y, temp );
ret << wxT(")");
return ret;
}
/*****************/ /*****************/
/* Class BOARD: */ /* Class BOARD: */
/*****************/ /*****************/
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
/* Default bitmap shape for markers */ /* Default bitmap shape for markers */
static char Default_MarkerBitmap[] = static char Default_MarkerBitmap[] =
{ {
12, 12, /* x and y sise of the bitmap */ 12, 12, /* x and y size of the bitmap */
1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, /* bitmap: 1 = color, 0 = notrace */ 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, /* bitmap: 1 = color, 0 = notrace */
1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0,
1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0,
...@@ -106,11 +106,26 @@ void MARKER::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -106,11 +106,26 @@ void MARKER::Display_Infos( WinEDA_DrawFrame* frame )
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
const DRC_ITEM& rpt = m_drc;
text_pos = 1; text_pos = 1;
Affiche_1_Parametre( frame, text_pos, _( "Type" ), _("Marker"), DARKCYAN ); Affiche_1_Parametre( frame, text_pos, _( "Type" ), _("Marker"), DARKCYAN );
text_pos = 12; wxString errorTxt;
Affiche_1_Parametre( frame, text_pos, _( "Marker Error Text" ), GetOneLineMessage(), RED );
errorTxt << _("ErrType") << wxT("(") << rpt.GetErrorCode() << wxT(")- ") << rpt.GetErrorText() << wxT(":");
text_pos = 5;
Affiche_1_Parametre( frame, text_pos, errorTxt, wxEmptyString, RED );
wxString txtA;
txtA << DRC_ITEM::ShowCoord( rpt.GetPointA() ) << wxT(": ") << rpt.GetTextA();
wxString txtB;
txtB << DRC_ITEM::ShowCoord( rpt.GetPointB() ) << wxT(": ") << rpt.GetTextB();
text_pos = 20; // @todo pick a better color here
Affiche_1_Parametre( frame, text_pos, txtA, txtB, BLACK );
} }
......
...@@ -78,37 +78,19 @@ public: ...@@ -78,37 +78,19 @@ public:
const wxString& aText, const wxPoint& aPos, const wxString& aText, const wxPoint& aPos,
const wxString& bText, const wxPoint& bPos ); const wxString& bText, const wxPoint& bPos );
/**
* Function GetMessage
* @return const wxString& - the diagnostic message
*/
const wxString GetOneLineMessage()
{
return m_drc.ShowText();
}
/** /**
* Function GetReporter * Function GetReporter
* returns the REPORT_ISSUE held within this MARKER so that its * returns the DRC_ITEM held within this MARKER so that its
* interface may be used. * interface may be used.
* @return const& REPORT_ISSUE * @return const& DRC_ITEM
*/ */
const REPORT_ISSUE& GetReporter() const const DRC_ITEM& GetReporter() const
{ {
return m_drc; return m_drc;
} }
/*
void SetMessage( const wxString& aMsg )
{
m_Diag = aMsg;
}
*/
/** /**
* Function Display_Infos * Function Display_Infos
* has knowledge about the frame and how and where to put status information * has knowledge about the frame and how and where to put status information
......
...@@ -41,13 +41,10 @@ ...@@ -41,13 +41,10 @@
#include "drc_stuff.h" #include "drc_stuff.h"
#include "dialog_drc.cpp"
/* variables locales */ #define EC_INC // ++m_errorCount don't need this anymore, vector counts
class DrcDialog;
#include "dialog_drc.cpp"
/******************************************************/ /******************************************************/
...@@ -67,53 +64,14 @@ void DRC::ShowDialog() ...@@ -67,53 +64,14 @@ void DRC::ShowDialog()
if( !m_ui ) if( !m_ui )
{ {
printf("creating new DrcFrame\n");
m_ui = new DrcDialog( this, m_mainWindow ); m_ui = new DrcDialog( this, m_mainWindow );
} }
// @todo enter retentitive member data into the DrcDialog here
// @todo enter retentitive data into the panel.
// m_RptFilenameCtrl->SetValue(s_RptFilename);
m_ui->Show(true); m_ui->Show(true);
// int rval = m_ui->ShowModal();
#if defined(DEBUG)
// printf("dialog rval=%d wxID_OK=%d\n", rval, wxID_OK );
#endif
// if( rval == wxID_OK ) // @todo capture the UI entered data into this DRC object. BUT in the OK handler
{
// @todo capture the UI entered data into the DRC_TESTER here
/*
s_Pad2PadTestOpt = m_Pad2PadTestCtrl->IsChecked();
s_UnconnectedTestOpt = m_UnconnectedTestCtrl->IsChecked();
s_ZonesTestOpt = m_ZonesTestCtrl->IsChecked();
s_CreateRptFileOpt = m_CreateRptCtrl->IsChecked();
wxBoxSizer* m_MainSizer;
wxBoxSizer* m_CommandSizer;
wxStaticText* m_ClearenceTitle;
wxTextCtrl* m_SetClearance;
wxCheckBox* m_CreateRptCtrl;
wxTextCtrl* m_RptFilenameCtrl;
wxButton* m_BrowseButton;
wxCheckBox* m_Pad2PadTestCtrl;
wxCheckBox* m_UnconnectedTestCtrl;
wxCheckBox* m_ZonesTestCtrl;
wxButton* m_DeleteCurrentMarkerButton;
DRCLISTBOX* m_ClearanceListBox;
DRCLISTBOX* m_UnconnectedListBox;
wxStdDialogButtonSizer* StdDialogButtonSizer;
*/
}
// m_ui->Destroy();
// m_ui = 0;
} }
...@@ -180,7 +138,7 @@ void DrcDialog::CmdDrc() ...@@ -180,7 +138,7 @@ void DrcDialog::CmdDrc()
// @todo set the list counts in the DRCLISTITEMS here. // @todo set the list counts in the DRCLISTITEMS here.
printf("done with tests\n"); // printf("done with tests\n");
} }
...@@ -194,31 +152,6 @@ void DrcDialog::ListUnconnectedPads( wxCommandEvent& event ) ...@@ -194,31 +152,6 @@ void DrcDialog::ListUnconnectedPads( wxCommandEvent& event )
} }
const wxString& DRC_ITEM::GetErrorText() const
{
static const wxString error1( wxT("Items Too Close:") );
switch( m_ErrorCode )
{
default:
case DRCE_: return error1;
}
}
wxString DRC_ITEM::ShowCoord( const wxPoint& aPos )
{
wxString temp;
wxString ret;
ret << wxT("@(") << valeur_param( aPos.x, temp );
ret << wxT(",") << valeur_param( aPos.y, temp );
ret << wxT(")");
return ret;
}
DRC::DRC( WinEDA_PcbFrame* aPcbWindow ) DRC::DRC( WinEDA_PcbFrame* aPcbWindow )
{ {
m_mainWindow = aPcbWindow; m_mainWindow = aPcbWindow;
...@@ -234,7 +167,7 @@ DRC::DRC( WinEDA_PcbFrame* aPcbWindow ) ...@@ -234,7 +167,7 @@ DRC::DRC( WinEDA_PcbFrame* aPcbWindow )
// m_rptFilename set to empty by its constructor // m_rptFilename set to empty by its constructor
m_errorCount = 0; //m_errorCount = 0;
m_currentMarker = 0; m_currentMarker = 0;
m_spotcx = 0; m_spotcx = 0;
...@@ -263,9 +196,9 @@ int DRC::Drc( TRACK* aRefSegm, TRACK* aList ) ...@@ -263,9 +196,9 @@ int DRC::Drc( TRACK* aRefSegm, TRACK* aList )
if( !doTrackDrc( aRefSegm, aList ) ) if( !doTrackDrc( aRefSegm, aList ) )
{ {
wxString msg = m_currentMarker->GetReporter().ShowText(); wxASSERT( m_currentMarker );
m_mainWindow->Affiche_Message( msg ); m_currentMarker->Display_Infos( m_mainWindow );
return BAD_DRC; return BAD_DRC;
} }
...@@ -275,20 +208,24 @@ int DRC::Drc( TRACK* aRefSegm, TRACK* aList ) ...@@ -275,20 +208,24 @@ int DRC::Drc( TRACK* aRefSegm, TRACK* aList )
void DRC::WriteReport( FILE* fp ) void DRC::WriteReport( FILE* fp )
{ {
fprintf( fp, "Drc report for %s\n", fprintf( fp, "** Drc report for %s **\n",
CONV_TO_UTF8( m_mainWindow->GetScreen()->m_FileName ) ); CONV_TO_UTF8( m_mainWindow->GetScreen()->m_FileName ) );
char line[256]; char line[256];
fprintf( fp, "Created on %s\n", DateAndTime( line ) ); fprintf( fp, "** Created on %s **\n", DateAndTime( line ) );
// write report here
int errors = 0;
if( errors ) fprintf( fp, "** Found %d DRC errors **\n", m_pcb->GetMARKERCount() );
fprintf( fp, "** End DRC: %d errors **\n", errors );
else if( m_unconnectedCount == 0 ) for( int i=0; i<m_pcb->GetMARKERCount(); ++i )
fprintf( fp, "** End Drc: No Error **\n" ); fprintf( fp, m_pcb->GetMARKER(i)->GetReporter().ShowReport().mb_str() );
// @todo: the unconnected report comes here:
/*
for( int i=0; i<m_pcb->GetOPENNETCount(); ++i )
fprintf( fp, m_pcb->GetOPENNET(i)->GetReporter().ShowReport().mb_str() );
*/
} }
...@@ -302,7 +239,7 @@ void DRC::RunTests() ...@@ -302,7 +239,7 @@ void DRC::RunTests()
if( m_doPad2PadTest ) if( m_doPad2PadTest )
testPad2Pad(); testPad2Pad();
// test track and via clearnces to other tracks, pads, and vias // test track and via clearances to other tracks, pads, and vias
testTracks(); testTracks();
// test zone clearances to other zones, pads, tracks, and vias // test zone clearances to other zones, pads, tracks, and vias
...@@ -448,7 +385,7 @@ MARKER* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, MARKE ...@@ -448,7 +385,7 @@ MARKER* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, MARKE
wxPoint endPos = track->m_End; wxPoint endPos = track->m_End;
// either of aItem's start or end will be used for the marker position // either of aItem's start or end will be used for the marker position
// first assume start, then swith to end if needed. decision made on // first assume start, then switch at end if needed. decision made on
// distance from end of aTrack. // distance from end of aTrack.
position = track->m_Start; position = track->m_Start;
...@@ -533,7 +470,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart ) ...@@ -533,7 +470,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
/* Phase 1 : test DRC track to pads : */ /* Phase 1 : test DRC track to pads : */
/******************************************/ /******************************************/
D_PAD pseudo_pad( (MODULE*) NULL ); D_PAD pseudo_pad( (MODULE*) NULL ); // construct this once outside following loop
// Compute the min distance to pads // Compute the min distance to pads
w_dist = aRefSeg->m_Width >> 1; w_dist = aRefSeg->m_Width >> 1;
...@@ -557,7 +494,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart ) ...@@ -557,7 +494,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
pseudo_pad.SetPosition( pad->GetPosition() ); pseudo_pad.SetPosition( pad->GetPosition() );
pseudo_pad.m_PadShape = pad->m_DrillShape; pseudo_pad.m_PadShape = pad->m_DrillShape;
pseudo_pad.m_Orient = pad->m_Orient; pseudo_pad.m_Orient = pad->m_Orient;
pseudo_pad.ComputeRayon(); // compute the ray length pseudo_pad.ComputeRayon(); // compute the radius
m_spotcx = pseudo_pad.GetPosition().x - org_X; m_spotcx = pseudo_pad.GetPosition().x - org_X;
m_spotcy = pseudo_pad.GetPosition().y - org_Y; m_spotcy = pseudo_pad.GetPosition().y - org_Y;
...@@ -565,7 +502,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart ) ...@@ -565,7 +502,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
if( !checkClearanceSegmToPad( &pseudo_pad, w_dist, if( !checkClearanceSegmToPad( &pseudo_pad, w_dist,
g_DesignSettings.m_TrackClearence ) ) g_DesignSettings.m_TrackClearence ) )
{ {
++m_errorCount; EC_INC;
m_currentMarker = fillMarker( aRefSeg, pad, m_currentMarker = fillMarker( aRefSeg, pad,
DRCE_TRACK_NEAR_THROUGH_HOLE, m_currentMarker ); DRCE_TRACK_NEAR_THROUGH_HOLE, m_currentMarker );
return false; return false;
...@@ -586,7 +523,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart ) ...@@ -586,7 +523,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
m_spotcy = shape_pos.y - org_Y; m_spotcy = shape_pos.y - org_Y;
if( !checkClearanceSegmToPad( pad, w_dist, g_DesignSettings.m_TrackClearence ) ) if( !checkClearanceSegmToPad( pad, w_dist, g_DesignSettings.m_TrackClearence ) )
{ {
++m_errorCount; EC_INC;
m_currentMarker = fillMarker( aRefSeg, pad, m_currentMarker = fillMarker( aRefSeg, pad,
DRCE_TRACK_NEAR_PAD, m_currentMarker ); DRCE_TRACK_NEAR_PAD, m_currentMarker );
return false; return false;
...@@ -642,7 +579,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart ) ...@@ -642,7 +579,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
// Test distance between two vias // Test distance between two vias
if( (int) hypot( x0, y0 ) < w_dist ) if( (int) hypot( x0, y0 ) < w_dist )
{ {
++m_errorCount; EC_INC;
m_currentMarker = fillMarker( aRefSeg, track, m_currentMarker = fillMarker( aRefSeg, track,
DRCE_VIA_NEAR_VIA, m_currentMarker ); DRCE_VIA_NEAR_VIA, m_currentMarker );
return false; return false;
...@@ -659,7 +596,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart ) ...@@ -659,7 +596,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
if( !checkMarginToCircle( x0, y0, w_dist, dx ) ) if( !checkMarginToCircle( x0, y0, w_dist, dx ) )
{ {
++m_errorCount; EC_INC;
m_currentMarker = fillMarker( aRefSeg, track, m_currentMarker = fillMarker( aRefSeg, track,
DRCE_VIA_NEAR_TRACK, m_currentMarker ); DRCE_VIA_NEAR_TRACK, m_currentMarker );
return false; return false;
...@@ -686,7 +623,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart ) ...@@ -686,7 +623,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
if( checkMarginToCircle( x0, y0, w_dist, m_segmLength ) ) if( checkMarginToCircle( x0, y0, w_dist, m_segmLength ) )
continue; continue;
++m_errorCount; EC_INC;
m_currentMarker = fillMarker( aRefSeg, track, m_currentMarker = fillMarker( aRefSeg, track,
DRCE_TRACK_NEAR_VIA, m_currentMarker ); DRCE_TRACK_NEAR_VIA, m_currentMarker );
return false; return false;
...@@ -710,14 +647,14 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart ) ...@@ -710,14 +647,14 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
/* Fine test : we consider the rounded shape of the ends */ /* Fine test : we consider the rounded shape of the ends */
if( x0 >= 0 && x0 <= m_segmLength ) if( x0 >= 0 && x0 <= m_segmLength )
{ {
++m_errorCount; EC_INC;
m_currentMarker = fillMarker( aRefSeg, track, m_currentMarker = fillMarker( aRefSeg, track,
DRCE_TRACK_ENDS1, m_currentMarker ); DRCE_TRACK_ENDS1, m_currentMarker );
return false; return false;
} }
if( !checkMarginToCircle( x0, y0, w_dist, m_segmLength ) ) if( !checkMarginToCircle( x0, y0, w_dist, m_segmLength ) )
{ {
++m_errorCount; EC_INC;
m_currentMarker = fillMarker( aRefSeg, track, m_currentMarker = fillMarker( aRefSeg, track,
DRCE_TRACK_ENDS2, m_currentMarker ); DRCE_TRACK_ENDS2, m_currentMarker );
return false; return false;
...@@ -728,14 +665,14 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart ) ...@@ -728,14 +665,14 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
/* Fine test : we consider the rounded shape of the ends */ /* Fine test : we consider the rounded shape of the ends */
if( xf >= 0 && xf <= m_segmLength ) if( xf >= 0 && xf <= m_segmLength )
{ {
++m_errorCount; EC_INC;
m_currentMarker = fillMarker( aRefSeg, track, m_currentMarker = fillMarker( aRefSeg, track,
DRCE_TRACK_ENDS3, m_currentMarker ); DRCE_TRACK_ENDS3, m_currentMarker );
return false; return false;
} }
if( !checkMarginToCircle( xf, yf, w_dist, m_segmLength ) ) if( !checkMarginToCircle( xf, yf, w_dist, m_segmLength ) )
{ {
++m_errorCount; EC_INC;
m_currentMarker = fillMarker( aRefSeg, track, m_currentMarker = fillMarker( aRefSeg, track,
DRCE_TRACK_ENDS4, m_currentMarker ); DRCE_TRACK_ENDS4, m_currentMarker );
return false; return false;
...@@ -744,7 +681,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart ) ...@@ -744,7 +681,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
if( x0 <=0 && xf >= 0 ) if( x0 <=0 && xf >= 0 )
{ {
++m_errorCount; EC_INC;
m_currentMarker = fillMarker( aRefSeg, track, m_currentMarker = fillMarker( aRefSeg, track,
DRCE_TRACK_UNKNOWN1, m_currentMarker ); DRCE_TRACK_UNKNOWN1, m_currentMarker );
return false; return false;
...@@ -760,7 +697,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart ) ...@@ -760,7 +697,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
EXCHG( y0, yf ); EXCHG( y0, yf );
if( (y0 < 0) && (yf > 0) ) if( (y0 < 0) && (yf > 0) )
{ {
++m_errorCount; EC_INC;
m_currentMarker = fillMarker( aRefSeg, track, m_currentMarker = fillMarker( aRefSeg, track,
DRCE_TRACKS_CROSSING, m_currentMarker ); DRCE_TRACKS_CROSSING, m_currentMarker );
return false; return false;
...@@ -769,14 +706,14 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart ) ...@@ -769,14 +706,14 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
// At this point the drc error is due to an end near a reference segm end // At this point the drc error is due to an end near a reference segm end
if( !checkMarginToCircle( x0, y0, w_dist, m_segmLength ) ) if( !checkMarginToCircle( x0, y0, w_dist, m_segmLength ) )
{ {
++m_errorCount; EC_INC;
m_currentMarker = fillMarker( aRefSeg, track, m_currentMarker = fillMarker( aRefSeg, track,
DRCE_ENDS_PROBLEM1, m_currentMarker ); DRCE_ENDS_PROBLEM1, m_currentMarker );
return false; return false;
} }
if( !checkMarginToCircle( xf, yf, w_dist, m_segmLength ) ) if( !checkMarginToCircle( xf, yf, w_dist, m_segmLength ) )
{ {
++m_errorCount; EC_INC;
m_currentMarker = fillMarker( aRefSeg, track, m_currentMarker = fillMarker( aRefSeg, track,
DRCE_ENDS_PROBLEM2, m_currentMarker ); DRCE_ENDS_PROBLEM2, m_currentMarker );
return false; return false;
...@@ -805,7 +742,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart ) ...@@ -805,7 +742,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
if( !checkLine( x0, y0, xf, yf ) ) if( !checkLine( x0, y0, xf, yf ) )
{ {
++m_errorCount; EC_INC;
m_currentMarker = fillMarker( aRefSeg, track, m_currentMarker = fillMarker( aRefSeg, track,
DRCE_ENDS_PROBLEM3, m_currentMarker ); DRCE_ENDS_PROBLEM3, m_currentMarker );
return false; return false;
...@@ -841,14 +778,14 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart ) ...@@ -841,14 +778,14 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
RotatePoint( &rxf, &ryf, angle ); RotatePoint( &rxf, &ryf, angle );
if( !checkMarginToCircle( rx0, ry0, w_dist, dx ) ) if( !checkMarginToCircle( rx0, ry0, w_dist, dx ) )
{ {
++m_errorCount; EC_INC;
m_currentMarker = fillMarker( aRefSeg, track, m_currentMarker = fillMarker( aRefSeg, track,
DRCE_ENDS_PROBLEM4, m_currentMarker ); DRCE_ENDS_PROBLEM4, m_currentMarker );
return false; return false;
} }
if( !checkMarginToCircle( rxf, ryf, w_dist, dx ) ) if( !checkMarginToCircle( rxf, ryf, w_dist, dx ) )
{ {
++m_errorCount; EC_INC;
m_currentMarker = fillMarker( aRefSeg, track, m_currentMarker = fillMarker( aRefSeg, track,
DRCE_ENDS_PROBLEM5, m_currentMarker ); DRCE_ENDS_PROBLEM5, m_currentMarker );
return false; return false;
...@@ -900,7 +837,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd, ...@@ -900,7 +837,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
if( !checkClearancePadToPad( aRefPad, pad, g_DesignSettings.m_TrackClearence ) ) if( !checkClearancePadToPad( aRefPad, pad, g_DesignSettings.m_TrackClearence ) )
{ {
// here we have a drc error! // here we have a drc error!
++m_errorCount; EC_INC;
m_currentMarker = fillMarker( aRefPad, pad, m_currentMarker = fillMarker( aRefPad, pad,
DRCE_PAD_NEAR_PAD1, m_currentMarker ); DRCE_PAD_NEAR_PAD1, m_currentMarker );
return false; return false;
......
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
/// DRC error codes: /// DRC error codes:
#define DRCE_ 1 #define DRCE_ 1 // not used yet
#define DRCE_UNCONNECTED_PADS 2 #define DRCE_UNCONNECTED_PADS 2 ///< pads are unconnected
#define DRCE_TRACK_NEAR_THROUGH_HOLE 3 ///< thru hole is too close to track #define DRCE_TRACK_NEAR_THROUGH_HOLE 3 ///< thru hole is too close to track
#define DRCE_TRACK_NEAR_PAD 4 ///< pad too close to track #define DRCE_TRACK_NEAR_PAD 4 ///< pad too close to track
#define DRCE_TRACK_NEAR_VIA 5 ///< track too close to via #define DRCE_TRACK_NEAR_VIA 5 ///< track too close to via
...@@ -55,52 +55,6 @@ ...@@ -55,52 +55,6 @@
#define DRCE_PAD_NEAR_PAD1 19 ///< pad too close to pad #define DRCE_PAD_NEAR_PAD1 19 ///< pad too close to pad
/**
* Class REPORT_ISSUE
* is an abstract interface used by DRCLISTBOX. It has functions to return
* either html text or disk file report text on this item. It also can
* return the drawing coordinate of the report item.
*/
class REPORT_ISSUE
{
public:
/**
* Function ShowHtml
* translates this object into a fragment of HTML suitable for the
* wxWidget's wxHtmlListBox class.
* @return wxString - the html text.
*/
virtual wxString ShowHtml() const = 0;
/**
* Function ShowText
* translates this object into a text string suitable for showing
* in the status panel.
* @return wxString - the simple non-html text.
*/
virtual wxString ShowText() const = 0;
/**
* Function ShowText
* translates this object into a text string suitable for saving
* to disk in a report.
* @return wxString - the simple non-html text.
*/
virtual wxString ShowReport() const = 0;
/**
* Function GetPosition
* @return const wxPoint& - the position of this report item within
* the drawing.
*/
virtual const wxPoint& GetPosition() const = 0;
};
/** /**
* Class DRC_ITEM * Class DRC_ITEM
* is a holder for a DRC error item. It is generated when two objects are * is a holder for a DRC error item. It is generated when two objects are
...@@ -109,7 +63,7 @@ public: ...@@ -109,7 +63,7 @@ public:
* Also held is the type of error by number and the location of the MARKER. * Also held is the type of error by number and the location of the MARKER.
* A function is provided to translate that number into text. * A function is provided to translate that number into text.
*/ */
class DRC_ITEM : public REPORT_ISSUE class DRC_ITEM
{ {
protected: protected:
...@@ -150,8 +104,6 @@ public: ...@@ -150,8 +104,6 @@ public:
} }
//-----<Interface REPORT_ISSUE>---------------------------------------
/** /**
* Function ShowHtml * Function ShowHtml
* translates this object into a fragment of HTML suitable for the * translates this object into a fragment of HTML suitable for the
...@@ -162,7 +114,8 @@ public: ...@@ -162,7 +114,8 @@ public:
{ {
wxString ret; wxString ret;
ret.Printf( wxT("<b>%s</b><ul><li> %s: %s </li><li> %s: %s </li></ul>"), ret.Printf( _("<b>ErrType(%d): %s</b><ul><li> %s: %s </li><li> %s: %s </li></ul>"),
m_ErrorCode,
GetErrorText().GetData(), GetErrorText().GetData(),
ShowCoord( m_APos ).GetData(), m_AText.GetData(), ShowCoord( m_APos ).GetData(), m_AText.GetData(),
ShowCoord( m_BPos ).GetData(), m_BText.GetData() ); ShowCoord( m_BPos ).GetData(), m_BText.GetData() );
...@@ -170,17 +123,19 @@ public: ...@@ -170,17 +123,19 @@ public:
return ret; return ret;
} }
/** /**
* Function ShowText * Function ShowReport
* translates this object into a text string suitable for saving * translates this object into a text string suitable for saving
* to disk in a report. Change this as needed to format the report. * to disk in a report.
* @return wxString - the simple non-html text. * @return wxString - the simple multi-line report text.
*/ */
wxString ShowText() const wxString ShowReport() const
{ {
wxString ret; wxString ret;
ret.Printf( wxT("%s %s: %s AND %s: %s"), ret.Printf( wxT("ErrType(%d): %s\n %s: %s\n %s: %s\n"),
m_ErrorCode,
GetErrorText().GetData(), GetErrorText().GetData(),
ShowCoord( m_APos ).GetData(), m_AText.GetData(), ShowCoord( m_APos ).GetData(), m_AText.GetData(),
ShowCoord( m_BPos ).GetData(), m_BText.GetData() ); ShowCoord( m_BPos ).GetData(), m_BText.GetData() );
...@@ -188,26 +143,43 @@ public: ...@@ -188,26 +143,43 @@ public:
return ret; return ret;
} }
/** /**
* Function ShowText * Function GetErrorCode
* translates this object into a text string suitable for saving * returns the error code.
* to disk in a report.
* @return wxString - the simple non-html text.
*/ */
wxString ShowReport() const int GetErrorCode() const
{ {
wxString ret; return m_ErrorCode;
}
ret.Printf( wxT("%s\n %s: %s\n %s: %s\n"),
GetErrorText().GetData(), /**
ShowCoord( m_APos ).GetData(), m_AText.GetData(), * Function GetErrorText
ShowCoord( m_BPos ).GetData(), m_BText.GetData() ); * returns the string form of a drc error code.
*/
return ret; wxString GetErrorText() const;
const wxString& GetTextA() const
{
return m_AText;
}
const wxString& GetTextB() const
{
return m_BText;
} }
const wxPoint& GetPointA() const
{
return m_APos;
}
const wxPoint& GetPointB() const
{
return m_BPos;
}
/** /**
* Function GetPosition * Function GetPosition
* @return wxPoint& - the position of this report item within * @return wxPoint& - the position of this report item within
...@@ -218,16 +190,6 @@ public: ...@@ -218,16 +190,6 @@ public:
return m_Pos; return m_Pos;
} }
//-----</Interface REPORT_ISSUE>---------------------------------------
/**
* Function GetErrorText
* returns the string form of a drc error code.
*/
const wxString& GetErrorText() const;
/** /**
* Function ShowCoord * Function ShowCoord
* formats a coordinate or position to text. * formats a coordinate or position to text.
...@@ -268,7 +230,7 @@ private: ...@@ -268,7 +230,7 @@ private:
wxString m_rptFilename; wxString m_rptFilename;
int m_errorCount; // int m_errorCount;
MARKER* m_currentMarker; MARKER* m_currentMarker;
...@@ -477,6 +439,12 @@ public: ...@@ -477,6 +439,12 @@ public:
m_doCreateRptFile = aSaveReport; m_doCreateRptFile = aSaveReport;
} }
/**
* Function RunTests
* will actually run all the tests specified with a previous call to
* SetSettings()
*/
void RunTests(); void RunTests();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment