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
......
This diff is collapsed.
...@@ -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