Commit 514c63c7 authored by dickelbeck's avatar dickelbeck

DRC rework start

parent 699eaf4a
...@@ -4,6 +4,12 @@ Started 2007-June-11 ...@@ -4,6 +4,12 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Nov-26 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew
DRC code and dialog rework start. This breaks DRC, until I get out the
other end of the tunnel.
2007-Nov-24 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Nov-24 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
......
This diff is collapsed.
...@@ -24,38 +24,41 @@ ...@@ -24,38 +24,41 @@
////@begin includes ////@begin includes
#include "wx/valgen.h" #include "wx/valgen.h"
#include "wx/statline.h" #include "wx/notebook.h"
////@end includes ////@end includes
/*! /*!
* Forward declarations * Forward declarations
*/ */
////@begin forward declarations ////@begin forward declarations
class wxBoxSizer; class wxBoxSizer;
class wxStaticLine; class DRCLISTBOX;
class wxStdDialogButtonSizer; class wxStdDialogButtonSizer;
////@end forward declarations ////@end forward declarations
/*! /*!
* Control identifiers * Control identifiers
*/ */
////@begin control identifiers ////@begin control identifiers
#define ID_DIALOG 10000 #define ID_DIALOG 10000
#define ID_TEXTCTRL_CLEARANCE 10002 #define ID_TEXTCTRL1 10002
#define ID_CHECKBOX_PAD2PAD 10009 #define ID_CHECKBOX 10004
#define ID_CHECKBOX_UNCONNECTED 10008 #define ID_TEXTCTRL3 10014
#define ID_CHECKBOX_TEST_ZONES 10007 #define ID_BUTTON_BROWSE_RPT_FILE 10018
#define ID_CHECKBOX_CREATE_FILE 10012 #define ID_CHECKBOX2 10019
#define ID_DRC_RUN 10003 #define ID_CHECKBOX3 10020
#define ID_STOP_CONTROL_DRC 10004 #define ID_CHECKBOX7 10021
#define ID_ERASE_DRC_MARKERS 10005 #define ID_STARTDRC 10006
#define ID_LIST_UNCONNECTED_PADS 10006 #define ID_LIST_UNCONNECTED 10003
#define ID_BUTTON_BROWSE_RPT_FILE 10011 #define ID_DELETE_ALL 10005
#define ID_TEXTCTRL_GET_RPT_FILENAME 10010 #define ID_DELETE_ONE 10007
#define ID_TEXTCTRL 10001 #define ID_NOTEBOOK1 10008
#define ID_STATICLINE 10013 #define ID_CLEARANCE_LIST 10001
#define ID_UNCONNECTED_LIST 10009
#define SYMBOL_WINEDA_DRCFRAME_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER #define SYMBOL_WINEDA_DRCFRAME_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER
#define SYMBOL_WINEDA_DRCFRAME_TITLE _("DRC Control") #define SYMBOL_WINEDA_DRCFRAME_TITLE _("DRC Control")
#define SYMBOL_WINEDA_DRCFRAME_IDNAME ID_DIALOG #define SYMBOL_WINEDA_DRCFRAME_IDNAME ID_DIALOG
...@@ -63,6 +66,8 @@ class wxStdDialogButtonSizer; ...@@ -63,6 +66,8 @@ class wxStdDialogButtonSizer;
#define SYMBOL_WINEDA_DRCFRAME_POSITION wxDefaultPosition #define SYMBOL_WINEDA_DRCFRAME_POSITION wxDefaultPosition
////@end control identifiers ////@end control identifiers
#define ID_DRCLISTCTRL 10001 // outside @end control identifiers since DialogBlocks knows not DRCLISTBOX
/*! /*!
* Compatibility * Compatibility
*/ */
...@@ -96,32 +101,44 @@ public: ...@@ -96,32 +101,44 @@ public:
/// Creates the controls and sizers /// Creates the controls and sizers
void CreateControls(); void CreateControls();
/// Override the event handler so we can direct the m_lowWindows events here initially
virtual bool ProcessEvent( wxEvent& event );
////@begin WinEDA_DrcFrame event handler declarations ////@begin WinEDA_DrcFrame event handler declarations
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DRC_RUN /// wxEVT_INIT_DIALOG event handler for ID_DIALOG
void OnDrcRunClick( wxCommandEvent& event ); void OnInitDialog( wxInitDialogEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_STOP_CONTROL_DRC /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX
void OnStopControlDrcClick( wxCommandEvent& event ); void OnReportCheckBoxClicked( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERASE_DRC_MARKERS
void OnEraseDrcMarkersClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIST_UNCONNECTED_PADS
void OnListUnconnectedPadsClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_BROWSE_RPT_FILE /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_BROWSE_RPT_FILE
void OnButtonBrowseRptFileClick( wxCommandEvent& event ); void OnButtonBrowseRptFileClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_STARTDRC
void OnOkClick( wxCommandEvent& event ); void OnStartdrcClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIST_UNCONNECTED
void OnListUnconnectedClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ALL
void OnDeleteAllClick( wxCommandEvent& event );
/// wxEVT_LEFT_DCLICK event handler for ID_CLEARANCE_LIST
void OnLeftDClickClearance( wxMouseEvent& event );
/// wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST
void OnRightUpClearance( wxMouseEvent& event );
/// wxEVT_LEFT_DCLICK event handler for ID_UNCONNECTED_LIST
void OnLeftDClickUnconnected( wxMouseEvent& event );
/// wxEVT_RIGHT_UP event handler for ID_UNCONNECTED_LIST
void OnRightUpUnconnected( wxMouseEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void OnOkClick( wxCommandEvent& event );
////@end WinEDA_DrcFrame event handler declarations ////@end WinEDA_DrcFrame event handler declarations
////@begin WinEDA_DrcFrame member function declarations ////@begin WinEDA_DrcFrame member function declarations
...@@ -133,6 +150,9 @@ public: ...@@ -133,6 +150,9 @@ public:
wxIcon GetIconResource( const wxString& name ); wxIcon GetIconResource( const wxString& name );
////@end WinEDA_DrcFrame member function declarations ////@end WinEDA_DrcFrame member function declarations
void OnMarkerSelectionEvent( wxCommandEvent& event );
void OnUnconnectedSelectionEvent( wxCommandEvent& event );
/// Should we show tooltips? /// Should we show tooltips?
static bool ShowToolTips(); static bool ShowToolTips();
...@@ -145,19 +165,22 @@ public: ...@@ -145,19 +165,22 @@ public:
wxBoxSizer* m_CommandSizer; wxBoxSizer* m_CommandSizer;
wxStaticText* m_ClearenceTitle; wxStaticText* m_ClearenceTitle;
wxTextCtrl* m_SetClearance; wxTextCtrl* m_SetClearance;
wxCheckBox* m_CreateRptCtrl;
wxTextCtrl* m_RptFilenameCtrl;
wxButton* m_BrowseButton;
wxCheckBox* m_Pad2PadTestCtrl; wxCheckBox* m_Pad2PadTestCtrl;
wxCheckBox* m_UnconnectedTestCtrl; wxCheckBox* m_UnconnectedTestCtrl;
wxCheckBox* m_ZonesTestCtrl; wxCheckBox* m_ZonesTestCtrl;
wxCheckBox* m_CreateRptCtrl; wxButton* m_DeleteCurrentMarkerButton;
wxTextCtrl* m_RptFilenameCtrl; DRCLISTBOX* m_ClearanceListBox;
wxTextCtrl* m_logWindow; DRCLISTBOX* m_UnconnectedListBox;
wxStaticLine* Line;
wxStdDialogButtonSizer* StdDialogButtonSizer; wxStdDialogButtonSizer* StdDialogButtonSizer;
////@end WinEDA_DrcFrame member variables ////@end WinEDA_DrcFrame member variables
WinEDA_PcbFrame * m_Parent; WinEDA_PcbFrame * m_Parent;
wxDC * m_DC; wxDC * m_DC;
int m_UnconnectedCount; int m_UnconnectedCount;
}; };
#endif #endif // _DIALOG_DRC_H_
// _DIALOG_DRC_H_
This diff is collapsed.
...@@ -162,12 +162,14 @@ bool WinEDA_GraphicItemsOptionsDialog::Create( wxWindow* parent, wxWindowID id, ...@@ -162,12 +162,14 @@ bool WinEDA_GraphicItemsOptionsDialog::Create( wxWindow* parent, wxWindowID id,
////@end WinEDA_GraphicItemsOptionsDialog member initialisation ////@end WinEDA_GraphicItemsOptionsDialog member initialisation
////@begin WinEDA_GraphicItemsOptionsDialog creation ////@begin WinEDA_GraphicItemsOptionsDialog creation
SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style ); wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls(); CreateControls();
GetSizer()->Fit(this); if (GetSizer())
{
GetSizer()->SetSizeHints(this); GetSizer()->SetSizeHints(this);
}
Centre(); Centre();
////@end WinEDA_GraphicItemsOptionsDialog creation ////@end WinEDA_GraphicItemsOptionsDialog creation
return true; return true;
...@@ -182,7 +184,7 @@ void WinEDA_GraphicItemsOptionsDialog::CreateControls() ...@@ -182,7 +184,7 @@ void WinEDA_GraphicItemsOptionsDialog::CreateControls()
SetFont(*g_DialogFont); SetFont(*g_DialogFont);
////@begin WinEDA_GraphicItemsOptionsDialog content construction ////@begin WinEDA_GraphicItemsOptionsDialog content construction
// Generated by DialogBlocks, 25/02/2006 10:43:53 (unregistered) // Generated by DialogBlocks, Mon 26 Nov 2007 18:58:29 CST (unregistered)
WinEDA_GraphicItemsOptionsDialog* itemDialog1 = this; WinEDA_GraphicItemsOptionsDialog* itemDialog1 = this;
......
...@@ -34,11 +34,6 @@ ...@@ -34,11 +34,6 @@
////@begin control identifiers ////@begin control identifiers
#define ID_DIALOG 10000 #define ID_DIALOG 10000
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_TITLE _("Texts and Drawings")
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_POSITION wxDefaultPosition
#define ID_TEXTCTRL_SEGW 10001 #define ID_TEXTCTRL_SEGW 10001
#define ID_TEXTCTRL_EDGES 10002 #define ID_TEXTCTRL_EDGES 10002
#define ID_TEXTCTRL_TEXTW 10003 #define ID_TEXTCTRL_TEXTW 10003
...@@ -48,6 +43,11 @@ ...@@ -48,6 +43,11 @@
#define ID_TEXTCTRL_TXTMOD_W 10007 #define ID_TEXTCTRL_TXTMOD_W 10007
#define ID_TEXTCTRL_TXTMOD_V 10008 #define ID_TEXTCTRL_TXTMOD_V 10008
#define ID_TEXTCTRL_TXTMOD_H 10009 #define ID_TEXTCTRL_TXTMOD_H 10009
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_TITLE _("Texts and Drawings")
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_POSITION wxDefaultPosition
////@end control identifiers ////@end control identifiers
/*! /*!
......
This diff is collapsed.
...@@ -12,10 +12,15 @@ ...@@ -12,10 +12,15 @@
#include "protos.h" #include "protos.h"
#include "drc_stuff.h"
/* variables locales */ /* variables locales */
class WinEDA_DrcFrame; class WinEDA_DrcFrame;
WinEDA_DrcFrame* DrcFrame; WinEDA_DrcFrame* DrcFrame;
/* saving drc options */ /* saving drc options */
static bool s_Pad2PadTestOpt = true; static bool s_Pad2PadTestOpt = true;
static bool s_UnconnectedTestOpt = true; static bool s_UnconnectedTestOpt = true;
...@@ -55,10 +60,37 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, ...@@ -55,10 +60,37 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
/*******************************************/ /*******************************************/
/* function relatives to the DRC control */ /* DRC functions */
/*******************************************/ /*******************************************/
#include "dialog_drc.cpp" #include "dialog_drc.cpp"
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;
}
/***************************************************************/ /***************************************************************/
void WinEDA_DrcFrame::ListUnconnectedPads( wxCommandEvent& event ) void WinEDA_DrcFrame::ListUnconnectedPads( wxCommandEvent& event )
/***************************************************************/ /***************************************************************/
...@@ -75,10 +107,10 @@ void WinEDA_DrcFrame::ListUnconnectedPads( wxCommandEvent& event ) ...@@ -75,10 +107,10 @@ void WinEDA_DrcFrame::ListUnconnectedPads( wxCommandEvent& event )
WinEDA_DrawPanel* panel = m_Parent->DrawPanel; WinEDA_DrawPanel* panel = m_Parent->DrawPanel;
int ii; int ii;
wxString msg; wxString msg;
float convert = 0.0001; double convert = 0.0001;
msg = _( "Look for active routes\n" ); msg = _( "Look for active routes\n" );
m_logWindow->AppendText( msg ); // m_logWindow->AppendText( msg );
if( s_RptFile ) if( s_RptFile )
fprintf( s_RptFile, "%s", CONV_TO_UTF8( msg ) ); fprintf( s_RptFile, "%s", CONV_TO_UTF8( msg ) );
...@@ -90,7 +122,9 @@ void WinEDA_DrcFrame::ListUnconnectedPads( wxCommandEvent& event ) ...@@ -90,7 +122,9 @@ void WinEDA_DrcFrame::ListUnconnectedPads( wxCommandEvent& event )
m_UnconnectedCount++; m_UnconnectedCount++;
if( m_UnconnectedCount == 1 ) if( m_UnconnectedCount == 1 )
m_logWindow->AppendText( _( "Unconnected found:\n" ) ); {
// m_logWindow->AppendText( _( "Unconnected found:\n" ) );
}
D_PAD* pad = Ratsnest->pad_start; D_PAD* pad = Ratsnest->pad_start;
pad->Draw( panel, m_DC, wxPoint( 0, 0 ), draw_mode ); pad->Draw( panel, m_DC, wxPoint( 0, 0 ), draw_mode );
...@@ -102,7 +136,7 @@ void WinEDA_DrcFrame::ListUnconnectedPads( wxCommandEvent& event ) ...@@ -102,7 +136,7 @@ void WinEDA_DrcFrame::ListUnconnectedPads( wxCommandEvent& event )
pad_name.GetData(), module_name.GetData(), pad_name.GetData(), module_name.GetData(),
pad->m_Pos.x * convert, pad->m_Pos.y * convert ); pad->m_Pos.x * convert, pad->m_Pos.y * convert );
m_logWindow->AppendText( msg ); // m_logWindow->AppendText( msg );
if( s_RptFile ) if( s_RptFile )
fprintf( s_RptFile, "%s", CONV_TO_UTF8( msg ) ); fprintf( s_RptFile, "%s", CONV_TO_UTF8( msg ) );
...@@ -116,7 +150,7 @@ void WinEDA_DrcFrame::ListUnconnectedPads( wxCommandEvent& event ) ...@@ -116,7 +150,7 @@ void WinEDA_DrcFrame::ListUnconnectedPads( wxCommandEvent& event )
pad_name.GetData(), module_name.GetData(), pad_name.GetData(), module_name.GetData(),
pad->m_Pos.x * convert, pad->m_Pos.y * convert ); pad->m_Pos.x * convert, pad->m_Pos.y * convert );
m_logWindow->AppendText( msg ); // m_logWindow->AppendText( msg );
if( s_RptFile ) if( s_RptFile )
fprintf( s_RptFile, "%s", CONV_TO_UTF8( msg ) ); fprintf( s_RptFile, "%s", CONV_TO_UTF8( msg ) );
} }
...@@ -126,7 +160,7 @@ void WinEDA_DrcFrame::ListUnconnectedPads( wxCommandEvent& event ) ...@@ -126,7 +160,7 @@ void WinEDA_DrcFrame::ListUnconnectedPads( wxCommandEvent& event )
else else
msg = _( "OK! (No active routes)\n" ); msg = _( "OK! (No active routes)\n" );
m_logWindow->AppendText( msg ); // m_logWindow->AppendText( msg );
if( s_RptFile ) if( s_RptFile )
fprintf( s_RptFile, "%s", CONV_TO_UTF8( msg ) ); fprintf( s_RptFile, "%s", CONV_TO_UTF8( msg ) );
} }
...@@ -168,13 +202,13 @@ void WinEDA_DrcFrame::TestDrc( wxCommandEvent& event ) ...@@ -168,13 +202,13 @@ void WinEDA_DrcFrame::TestDrc( wxCommandEvent& event )
s_ZonesTestOpt = m_ZonesTestCtrl->IsChecked(); s_ZonesTestOpt = m_ZonesTestCtrl->IsChecked();
AbortDrc = FALSE; AbortDrc = FALSE;
m_logWindow->Clear(); // m_logWindow->Clear();
g_DesignSettings.m_TrackClearence = g_DesignSettings.m_TrackClearence =
ReturnValueFromTextCtrl( *m_SetClearance, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetClearance, m_Parent->m_InternalUnits );
/* Test DRC errors (clearance errors, bad connections .. */ /* Test DRC errors (clearance errors, bad connections .. */
errors = m_Parent->Test_DRC( m_DC, m_Pad2PadTestCtrl->IsChecked( errors = m_Parent->Test_DRC( m_DC, m_Pad2PadTestCtrl->IsChecked(),
), m_ZonesTestCtrl->IsChecked() ); m_ZonesTestCtrl->IsChecked() );
/* Search for active routes (unconnected pads) */ /* Search for active routes (unconnected pads) */
if( m_UnconnectedTestCtrl->IsChecked() ) if( m_UnconnectedTestCtrl->IsChecked() )
...@@ -187,7 +221,7 @@ void WinEDA_DrcFrame::TestDrc( wxCommandEvent& event ) ...@@ -187,7 +221,7 @@ void WinEDA_DrcFrame::TestDrc( wxCommandEvent& event )
else if( m_UnconnectedCount == 0 ) else if( m_UnconnectedCount == 0 )
msg = _( "** End Drc: No Error **\n" ); msg = _( "** End Drc: No Error **\n" );
m_logWindow->AppendText( msg ); // m_logWindow->AppendText( msg );
if( s_RptFile ) if( s_RptFile )
fprintf( s_RptFile, "%s", CONV_TO_UTF8( msg ) ); fprintf( s_RptFile, "%s", CONV_TO_UTF8( msg ) );
...@@ -195,7 +229,7 @@ void WinEDA_DrcFrame::TestDrc( wxCommandEvent& event ) ...@@ -195,7 +229,7 @@ void WinEDA_DrcFrame::TestDrc( wxCommandEvent& event )
if( s_RptFile ) if( s_RptFile )
{ {
msg.Printf( _( "Report file <%s> created\n" ), s_RptFilename.GetData() ); msg.Printf( _( "Report file <%s> created\n" ), s_RptFilename.GetData() );
m_logWindow->AppendText( msg ); // m_logWindow->AppendText( msg );
fclose( s_RptFile ); fclose( s_RptFile );
s_RptFile = NULL; s_RptFile = NULL;
} }
...@@ -228,7 +262,8 @@ void WinEDA_PcbFrame::Install_Test_DRC_Frame( wxDC* DC ) ...@@ -228,7 +262,8 @@ void WinEDA_PcbFrame::Install_Test_DRC_Frame( wxDC* DC )
{ {
AbortDrc = FALSE; AbortDrc = FALSE;
DrcFrame = new WinEDA_DrcFrame( this, DC ); DrcFrame = new WinEDA_DrcFrame( this, DC );
DrcFrame->ShowModal(); DrcFrame->Destroy(); DrcFrame->ShowModal();
DrcFrame->Destroy();
DrcFrame = NULL; DrcFrame = NULL;
} }
...@@ -276,7 +311,9 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone ) ...@@ -276,7 +311,9 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone )
Affiche_1_Parametre( this, PRINT_PAD_ERR_POS, wxT( "Pad Err" ), wxT( "0" ), LIGHTRED ); Affiche_1_Parametre( this, PRINT_PAD_ERR_POS, wxT( "Pad Err" ), wxT( "0" ), LIGHTRED );
if( DrcFrame ) if( DrcFrame )
DrcFrame->m_logWindow->AppendText( _( "Tst Pad to Pad\n" ) ); {
// DrcFrame->m_logWindow->AppendText( _( "Tst Pad to Pad\n" ) );
}
LISTE_PAD* pad_list_start = CreateSortedPadListByXCoord( m_Pcb ); LISTE_PAD* pad_list_start = CreateSortedPadListByXCoord( m_Pcb );
LISTE_PAD* pad_list_limit = &pad_list_start[m_Pcb->m_NbPads]; LISTE_PAD* pad_list_limit = &pad_list_start[m_Pcb->m_NbPads];
...@@ -326,8 +363,7 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone ) ...@@ -326,8 +363,7 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone )
Affiche_1_Parametre( this, PRINT_TRACK_ERR_POS, _( "Track Err" ), wxT( "0" ), LIGHTRED ); Affiche_1_Parametre( this, PRINT_TRACK_ERR_POS, _( "Track Err" ), wxT( "0" ), LIGHTRED );
pt_segm = m_Pcb->m_Track; pt_segm = m_Pcb->m_Track;
if( DrcFrame ) // if( DrcFrame ) DrcFrame->m_logWindow->AppendText( _( "Tst Tracks\n" ) );
DrcFrame->m_logWindow->AppendText( _( "Tst Tracks\n" ) );
for( ii = 0, old_net = -1, jj = 0; for( ii = 0, old_net = -1, jj = 0;
pt_segm != NULL; pt_segm != NULL;
...@@ -399,8 +435,7 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone ) ...@@ -399,8 +435,7 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone )
Affiche_1_Parametre( this, PRINT_NB_ZONESEGM_POS, _( "SegmNb" ), Line, RED ); Affiche_1_Parametre( this, PRINT_NB_ZONESEGM_POS, _( "SegmNb" ), Line, RED );
Affiche_1_Parametre( this, PRINT_ZONE_ERR_POS, _( "Zone Err" ), wxT( "0" ), LIGHTRED ); Affiche_1_Parametre( this, PRINT_ZONE_ERR_POS, _( "Zone Err" ), wxT( "0" ), LIGHTRED );
if( DrcFrame ) // if( DrcFrame ) DrcFrame->m_logWindow->AppendText( _( "Tst Zones\n" ) );
DrcFrame->m_logWindow->AppendText( _( "Tst Zones\n" ) );
pt_segm = (TRACK*) m_Pcb->m_Zone; pt_segm = (TRACK*) m_Pcb->m_Zone;
...@@ -1424,7 +1459,9 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, ...@@ -1424,7 +1459,9 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
} }
if( DrcFrame ) if( DrcFrame )
DrcFrame->m_logWindow->AppendText( msg ); {
// DrcFrame->m_logWindow->AppendText( msg );
}
else else
panel->m_Parent->Affiche_Message( msg ); panel->m_Parent->Affiche_Message( msg );
...@@ -1480,7 +1517,9 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, ...@@ -1480,7 +1517,9 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
pad_name2.GetData(), module_name2.GetData(), netname2.GetData(), pad2->m_Pos.x, pad2->m_Pos.y ); pad_name2.GetData(), module_name2.GetData(), netname2.GetData(), pad2->m_Pos.x, pad2->m_Pos.y );
if( DrcFrame ) if( DrcFrame )
DrcFrame->m_logWindow->AppendText( msg ); {
// DrcFrame->m_logWindow->AppendText( msg );
}
else else
panel->m_Parent->Affiche_Message( msg ); panel->m_Parent->Affiche_Message( msg );
...@@ -1510,8 +1549,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, ...@@ -1510,8 +1549,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
* Retourne OK_DRC si aucune partie commune * Retourne OK_DRC si aucune partie commune
* Retourne BAD_DRC si partie commune * Retourne BAD_DRC si partie commune
*/ */
#define us unsigned int static inline int USCALE( unsigned arg, unsigned num, unsigned den )
static inline int USCALE( us arg, us num, us den )
{ {
int ii; int ii;
...@@ -1527,10 +1565,10 @@ static int Tst_Ligne( int x1, int y1, int x2, int y2 ) ...@@ -1527,10 +1565,10 @@ static int Tst_Ligne( int x1, int y1, int x2, int y2 )
{ {
int temp; int temp;
do {
if( x1 > x2 ) if( x1 > x2 )
{ {
EXCHG( x1, x2 ); EXCHG( y1, y2 ); EXCHG( x1, x2 );
EXCHG( y1, y2 );
} }
if( (x2 < xcliplo) || (x1 > xcliphi) ) if( (x2 < xcliplo) || (x1 > xcliphi) )
{ {
...@@ -1616,7 +1654,6 @@ static int Tst_Ligne( int x1, int y1, int x2, int y2 ) ...@@ -1616,7 +1654,6 @@ static int Tst_Ligne( int x1, int y1, int x2, int y2 )
WHEN_INSIDE; WHEN_INSIDE;
} }
} }
} while( 0 );
if( ( (x2 + x1)/2 <= xcliphi ) && ( (x2 + x1)/2 >= xcliplo ) \ if( ( (x2 + x1)/2 <= xcliphi ) && ( (x2 + x1)/2 >= xcliplo ) \
&& ( (y2 + y1)/2 <= ycliphi ) && ( (y2 + y1)/2 >= ycliplo ) ) && ( (y2 + y1)/2 <= ycliphi ) && ( (y2 + y1)/2 >= ycliplo ) )
...@@ -1626,3 +1663,4 @@ static int Tst_Ligne( int x1, int y1, int x2, int y2 ) ...@@ -1626,3 +1663,4 @@ static int Tst_Ligne( int x1, int y1, int x2, int y2 )
else else
return OK_DRC; return OK_DRC;
} }
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2007 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _DRC_STUFF_H
#define _DRC_STUFF_H
#include "fctsys.h"
/// DRC error codes:
#define DRCE_ 1
/**
* Class DRC_ITEM
* is a holder for a DRC error item. It is generated when two objects are
* too close. There are holders for information on two items. The
* information held is the board coordinate and the MenuText for each item.
* Also held is the type of error by number and the location of the MARQUEUR.
* A function is provided to translate that number into text.
*/
class DRC_ITEM
{
protected:
int m_ErrorCode; ///< the error code's numeric value
wxPoint m_MarkerPos; ///< position of the MARKER
wxString m_AText; ///< text for the first BOARD_ITEM
wxString m_BText; ///< text for the second BOARD_ITEM
wxPoint m_APos; ///< the location of the first BOARD_ITEM
wxPoint m_BPos; ///< the location of the first BOARD_ITEM
public:
DRC_ITEM( int aErrorCode, const wxString& aText, const wxString& bText,
const wxPoint& aPos, const wxPoint& bPos )
{
m_ErrorCode = aErrorCode;
m_AText = aText;
m_BText = bText;
m_APos = aPos;
m_BPos = bPos;
}
/**
* Function ShowHtml
* translates this object into a fragment of HTML suitable for the
* wxWidget's wxHtmlListBox class.
* @return wxString - the html text.
*/
wxString ShowHtml() const
{
wxString ret;
ret.Printf( wxT("<b>%s</b> <ul><li> %s: %s </li> <li> %s: %s </li> </ul>"),
GetErrorText().GetData(),
ShowCoord( m_APos ).GetData(), m_AText.GetData(),
ShowCoord( m_BPos ).GetData(), m_BText.GetData() );
return ret;
}
/**
* Function ShowText
* translates this object into a text string suitable for saving
* to disk in a report. Change this as needed to format the report.
* @return wxString - the simple non-html text.
*/
wxString ShowText() const
{
wxString ret;
ret.Printf( wxT("%s\n %s: %s\n %s: %s\n"),
GetErrorText().GetData(),
ShowCoord( m_APos ).GetData(), m_AText.GetData(),
ShowCoord( m_BPos ).GetData(), m_BText.GetData() );
return ret;
}
/**
* Function GetErrorText
* returns the string form of a drc error code.
*/
const wxString& GetErrorText() const;
/**
* Function ShowCoord
* formats a coordinate or position to text.
* @param aPos The position to format
* @return wxString - The formated string
*/
static wxString ShowCoord( const wxPoint& aPos );
};
class WinEDA_DrawPanel;
class MARQUEUR;
typedef std::vector<DRC_ITEM> DRC_LIST;
/**
* Class DRC_TESTER
* performs all the DRC tests, and can optionally generate a DRC test report
* to a disk file. This class is given access to the windows and the BOARD
* that it needs via its constructor or access functions.
*/
class DRC_TESTER
{
protected:
bool doPad2PadTest;
bool doUnconnectedTest;
bool doZonesTest;
bool doCreateRptFile;
FILE* rptFile;
wxString rptFilename;
int errorCount;
MARQUEUR* currentMarker;
bool abortDrc;
bool drcInProgress;
int spot_cX;
int spot_cY;
int finx;
int finy; // coord relatives de l'extremite du segm de reference
int segmAngle; // angle d'inclinaison du segment de reference en 0,1 degre
int segmLong; // longueur du segment de reference
int xcliplo;
int ycliplo;
int xcliphi;
int ycliphi; // coord de la surface de securite du segment a comparer
DRC_LIST drcList;
WinEDA_DrawPanel* drawPanel;
public:
DRC_TESTER()
{
doPad2PadTest = true;
doUnconnectedTest = true;
doZonesTest = false;
doCreateRptFile = false;
}
/**
* Function SetTests
* sets all the test flags and may be called before running the tests.
* @param aPad2PadTest Tells whether to test pad to pad distances.
* @param aUnconnectedTest Tells whether to list unconnected pads.
* @param aZonesTest Tells whether to test zones.
* @param aRptFilename If non-Empty, is the name of the file to
* save the report to. If Empty, means save no report.
*/
void SetTests( bool aPad2PadTest, bool aUnconnectedTest, bool aZonesTest, const wxString& aRptFilename )
{
doPad2PadTest = aPad2PadTest;
doUnconnectedTest = aUnconnectedTest;
doZonesTest = aZonesTest;
rptFilename = aRptFilename;
if( rptFilename.IsEmpty() )
doCreateRptFile = false;
else
doCreateRptFile = true;
}
};
#endif // _DRC_STUFF_H
//EOF
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