Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
514c63c7
Commit
514c63c7
authored
Nov 27, 2007
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DRC rework start
parent
699eaf4a
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
2096 additions
and
1198 deletions
+2096
-1198
change_log.txt
change_log.txt
+6
-0
dialog_drc.cpp
pcbnew/dialog_drc.cpp
+379
-139
dialog_drc.h
pcbnew/dialog_drc.h
+64
-41
dialog_drc.pjd
pcbnew/dialog_drc.pjd
+858
-804
dialog_graphic_items_options.cpp
pcbnew/dialog_graphic_items_options.cpp
+6
-4
dialog_graphic_items_options.h
pcbnew/dialog_graphic_items_options.h
+5
-5
dialog_graphic_items_options.pjd
pcbnew/dialog_graphic_items_options.pjd
+343
-22
drc.cpp
pcbnew/drc.cpp
+221
-183
drc_stuff.h
pcbnew/drc_stuff.h
+214
-0
No files found.
change_log.txt
View file @
514c63c7
...
...
@@ -4,6 +4,12 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
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>
================================================================================
...
...
pcbnew/dialog_drc.cpp
View file @
514c63c7
This diff is collapsed.
Click to expand it.
pcbnew/dialog_drc.h
View file @
514c63c7
...
...
@@ -24,38 +24,41 @@
////@begin includes
#include "wx/valgen.h"
#include "wx/
statline
.h"
#include "wx/
notebook
.h"
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
class
wxBoxSizer
;
class
wxStaticLine
;
class
DRCLISTBOX
;
class
wxStdDialogButtonSizer
;
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_DIALOG 10000
#define ID_TEXTCTRL_CLEARANCE 10002
#define ID_CHECKBOX_PAD2PAD 10009
#define ID_CHECKBOX_UNCONNECTED 10008
#define ID_CHECKBOX_TEST_ZONES 10007
#define ID_CHECKBOX_CREATE_FILE 10012
#define ID_DRC_RUN 10003
#define ID_STOP_CONTROL_DRC 10004
#define ID_ERASE_DRC_MARKERS 10005
#define ID_LIST_UNCONNECTED_PADS 10006
#define ID_BUTTON_BROWSE_RPT_FILE 10011
#define ID_TEXTCTRL_GET_RPT_FILENAME 10010
#define ID_TEXTCTRL 10001
#define ID_STATICLINE 10013
#define ID_TEXTCTRL1 10002
#define ID_CHECKBOX 10004
#define ID_TEXTCTRL3 10014
#define ID_BUTTON_BROWSE_RPT_FILE 10018
#define ID_CHECKBOX2 10019
#define ID_CHECKBOX3 10020
#define ID_CHECKBOX7 10021
#define ID_STARTDRC 10006
#define ID_LIST_UNCONNECTED 10003
#define ID_DELETE_ALL 10005
#define ID_DELETE_ONE 10007
#define ID_NOTEBOOK1 10008
#define ID_CLEARANCE_LIST 10001
#define ID_UNCONNECTED_LIST 10009
#define SYMBOL_WINEDA_DRCFRAME_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER
#define SYMBOL_WINEDA_DRCFRAME_TITLE _("DRC Control")
#define SYMBOL_WINEDA_DRCFRAME_IDNAME ID_DIALOG
...
...
@@ -63,6 +66,8 @@ class wxStdDialogButtonSizer;
#define SYMBOL_WINEDA_DRCFRAME_POSITION wxDefaultPosition
////@end control identifiers
#define ID_DRCLISTCTRL 10001 // outside @end control identifiers since DialogBlocks knows not DRCLISTBOX
/*!
* Compatibility
*/
...
...
@@ -96,32 +101,44 @@ public:
/// Creates the controls and sizers
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
/// wxEVT_
COMMAND_BUTTON_CLICKED event handler for ID_DRC_RUN
void
On
DrcRunClick
(
wxCommand
Event
&
event
);
/// wxEVT_
INIT_DIALOG event handler for ID_DIALOG
void
On
InitDialog
(
wxInitDialog
Event
&
event
);
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_STOP_CONTROL_DRC
void
OnStopControlDrcClick
(
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_CHECKBOX_CLICKED event handler for ID_CHECKBOX
void
OnReportCheckBoxClicked
(
wxCommandEvent
&
event
);
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_BROWSE_RPT_FILE
void
OnButtonBrowseRptFileClick
(
wxCommandEvent
&
event
);
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void
OnOkClick
(
wxCommandEvent
&
event
);
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_STARTDRC
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
void
OnCancelClick
(
wxCommandEvent
&
event
);
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void
OnOkClick
(
wxCommandEvent
&
event
);
////@end WinEDA_DrcFrame event handler declarations
////@begin WinEDA_DrcFrame member function declarations
...
...
@@ -133,6 +150,9 @@ public:
wxIcon
GetIconResource
(
const
wxString
&
name
);
////@end WinEDA_DrcFrame member function declarations
void
OnMarkerSelectionEvent
(
wxCommandEvent
&
event
);
void
OnUnconnectedSelectionEvent
(
wxCommandEvent
&
event
);
/// Should we show tooltips?
static
bool
ShowToolTips
();
...
...
@@ -145,19 +165,22 @@ public:
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
;
wxCheckBox
*
m_CreateRptCtrl
;
wxTextCtrl
*
m_RptFilenameCtrl
;
wxTextCtrl
*
m_logWindow
;
wxStaticLine
*
Line
;
wxButton
*
m_DeleteCurrentMarkerButton
;
DRCLISTBOX
*
m_ClearanceListBox
;
DRCLISTBOX
*
m_UnconnectedListBox
;
wxStdDialogButtonSizer
*
StdDialogButtonSizer
;
////@end WinEDA_DrcFrame member variables
WinEDA_PcbFrame
*
m_Parent
;
wxDC
*
m_DC
;
int
m_UnconnectedCount
;
};
#endif
// _DIALOG_DRC_H_
#endif
// _DIALOG_DRC_H_
pcbnew/dialog_drc.pjd
View file @
514c63c7
This diff is collapsed.
Click to expand it.
pcbnew/dialog_graphic_items_options.cpp
View file @
514c63c7
...
...
@@ -162,12 +162,14 @@ bool WinEDA_GraphicItemsOptionsDialog::Create( wxWindow* parent, wxWindowID id,
////@end WinEDA_GraphicItemsOptionsDialog member initialisation
////@begin WinEDA_GraphicItemsOptionsDialog creation
SetExtraStyle
(
GetExtraStyle
()
|
wxWS_EX_BLOCK_EVENTS
);
SetExtraStyle
(
wxWS_EX_BLOCK_EVENTS
);
wxDialog
::
Create
(
parent
,
id
,
caption
,
pos
,
size
,
style
);
CreateControls
();
GetSizer
()
->
Fit
(
this
);
if
(
GetSizer
())
{
GetSizer
()
->
SetSizeHints
(
this
);
}
Centre
();
////@end WinEDA_GraphicItemsOptionsDialog creation
return
true
;
...
...
@@ -182,7 +184,7 @@ void WinEDA_GraphicItemsOptionsDialog::CreateControls()
SetFont
(
*
g_DialogFont
);
////@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
;
...
...
pcbnew/dialog_graphic_items_options.h
View file @
514c63c7
...
...
@@ -34,11 +34,6 @@
////@begin control identifiers
#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_EDGES 10002
#define ID_TEXTCTRL_TEXTW 10003
...
...
@@ -48,6 +43,11 @@
#define ID_TEXTCTRL_TXTMOD_W 10007
#define ID_TEXTCTRL_TXTMOD_V 10008
#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
/*!
...
...
pcbnew/dialog_graphic_items_options.pjd
View file @
514c63c7
This diff is collapsed.
Click to expand it.
pcbnew/drc.cpp
View file @
514c63c7
...
...
@@ -12,10 +12,15 @@
#include "protos.h"
#include "drc_stuff.h"
/* variables locales */
class
WinEDA_DrcFrame
;
WinEDA_DrcFrame
*
DrcFrame
;
/* saving drc options */
static
bool
s_Pad2PadTestOpt
=
true
;
static
bool
s_UnconnectedTestOpt
=
true
;
...
...
@@ -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"
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
)
/***************************************************************/
...
...
@@ -75,10 +107,10 @@ void WinEDA_DrcFrame::ListUnconnectedPads( wxCommandEvent& event )
WinEDA_DrawPanel
*
panel
=
m_Parent
->
DrawPanel
;
int
ii
;
wxString
msg
;
float
convert
=
0.0001
;
double
convert
=
0.0001
;
msg
=
_
(
"Look for active routes
\n
"
);
m_logWindow
->
AppendText
(
msg
);
//
m_logWindow->AppendText( msg );
if
(
s_RptFile
)
fprintf
(
s_RptFile
,
"%s"
,
CONV_TO_UTF8
(
msg
)
);
...
...
@@ -90,7 +122,9 @@ void WinEDA_DrcFrame::ListUnconnectedPads( wxCommandEvent& event )
m_UnconnectedCount
++
;
if
(
m_UnconnectedCount
==
1
)
m_logWindow
->
AppendText
(
_
(
"Unconnected found:
\n
"
)
);
{
// m_logWindow->AppendText( _( "Unconnected found:\n" ) );
}
D_PAD
*
pad
=
Ratsnest
->
pad_start
;
pad
->
Draw
(
panel
,
m_DC
,
wxPoint
(
0
,
0
),
draw_mode
);
...
...
@@ -102,7 +136,7 @@ void WinEDA_DrcFrame::ListUnconnectedPads( wxCommandEvent& event )
pad_name
.
GetData
(),
module_name
.
GetData
(),
pad
->
m_Pos
.
x
*
convert
,
pad
->
m_Pos
.
y
*
convert
);
m_logWindow
->
AppendText
(
msg
);
//
m_logWindow->AppendText( msg );
if
(
s_RptFile
)
fprintf
(
s_RptFile
,
"%s"
,
CONV_TO_UTF8
(
msg
)
);
...
...
@@ -116,7 +150,7 @@ void WinEDA_DrcFrame::ListUnconnectedPads( wxCommandEvent& event )
pad_name
.
GetData
(),
module_name
.
GetData
(),
pad
->
m_Pos
.
x
*
convert
,
pad
->
m_Pos
.
y
*
convert
);
m_logWindow
->
AppendText
(
msg
);
//
m_logWindow->AppendText( msg );
if
(
s_RptFile
)
fprintf
(
s_RptFile
,
"%s"
,
CONV_TO_UTF8
(
msg
)
);
}
...
...
@@ -126,7 +160,7 @@ void WinEDA_DrcFrame::ListUnconnectedPads( wxCommandEvent& event )
else
msg
=
_
(
"OK! (No active routes)
\n
"
);
m_logWindow
->
AppendText
(
msg
);
//
m_logWindow->AppendText( msg );
if
(
s_RptFile
)
fprintf
(
s_RptFile
,
"%s"
,
CONV_TO_UTF8
(
msg
)
);
}
...
...
@@ -168,13 +202,13 @@ void WinEDA_DrcFrame::TestDrc( wxCommandEvent& event )
s_ZonesTestOpt
=
m_ZonesTestCtrl
->
IsChecked
();
AbortDrc
=
FALSE
;
m_logWindow
->
Clear
();
//
m_logWindow->Clear();
g_DesignSettings
.
m_TrackClearence
=
ReturnValueFromTextCtrl
(
*
m_SetClearance
,
m_Parent
->
m_InternalUnits
);
/* Test DRC errors (clearance errors, bad connections .. */
errors
=
m_Parent
->
Test_DRC
(
m_DC
,
m_Pad2PadTestCtrl
->
IsChecked
(
),
m_ZonesTestCtrl
->
IsChecked
()
);
errors
=
m_Parent
->
Test_DRC
(
m_DC
,
m_Pad2PadTestCtrl
->
IsChecked
(
),
m_ZonesTestCtrl
->
IsChecked
()
);
/* Search for active routes (unconnected pads) */
if
(
m_UnconnectedTestCtrl
->
IsChecked
()
)
...
...
@@ -187,7 +221,7 @@ void WinEDA_DrcFrame::TestDrc( wxCommandEvent& event )
else
if
(
m_UnconnectedCount
==
0
)
msg
=
_
(
"** End Drc: No Error **
\n
"
);
m_logWindow
->
AppendText
(
msg
);
//
m_logWindow->AppendText( msg );
if
(
s_RptFile
)
fprintf
(
s_RptFile
,
"%s"
,
CONV_TO_UTF8
(
msg
)
);
...
...
@@ -195,7 +229,7 @@ void WinEDA_DrcFrame::TestDrc( wxCommandEvent& event )
if
(
s_RptFile
)
{
msg
.
Printf
(
_
(
"Report file <%s> created
\n
"
),
s_RptFilename
.
GetData
()
);
m_logWindow
->
AppendText
(
msg
);
//
m_logWindow->AppendText( msg );
fclose
(
s_RptFile
);
s_RptFile
=
NULL
;
}
...
...
@@ -228,7 +262,8 @@ void WinEDA_PcbFrame::Install_Test_DRC_Frame( wxDC* DC )
{
AbortDrc
=
FALSE
;
DrcFrame
=
new
WinEDA_DrcFrame
(
this
,
DC
);
DrcFrame
->
ShowModal
();
DrcFrame
->
Destroy
();
DrcFrame
->
ShowModal
();
DrcFrame
->
Destroy
();
DrcFrame
=
NULL
;
}
...
...
@@ -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
);
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_limit
=
&
pad_list_start
[
m_Pcb
->
m_NbPads
];
...
...
@@ -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
);
pt_segm
=
m_Pcb
->
m_Track
;
if
(
DrcFrame
)
DrcFrame
->
m_logWindow
->
AppendText
(
_
(
"Tst Tracks
\n
"
)
);
// if( DrcFrame ) DrcFrame->m_logWindow->AppendText( _( "Tst Tracks\n" ) );
for
(
ii
=
0
,
old_net
=
-
1
,
jj
=
0
;
pt_segm
!=
NULL
;
...
...
@@ -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_ZONE_ERR_POS
,
_
(
"Zone Err"
),
wxT
(
"0"
),
LIGHTRED
);
if
(
DrcFrame
)
DrcFrame
->
m_logWindow
->
AppendText
(
_
(
"Tst Zones
\n
"
)
);
// if( DrcFrame ) DrcFrame->m_logWindow->AppendText( _( "Tst Zones\n" ) );
pt_segm
=
(
TRACK
*
)
m_Pcb
->
m_Zone
;
...
...
@@ -1424,7 +1459,9 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
}
if
(
DrcFrame
)
DrcFrame
->
m_logWindow
->
AppendText
(
msg
);
{
// DrcFrame->m_logWindow->AppendText( msg );
}
else
panel
->
m_Parent
->
Affiche_Message
(
msg
);
...
...
@@ -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
);
if
(
DrcFrame
)
DrcFrame
->
m_logWindow
->
AppendText
(
msg
);
{
// DrcFrame->m_logWindow->AppendText( msg );
}
else
panel
->
m_Parent
->
Affiche_Message
(
msg
);
...
...
@@ -1510,8 +1549,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
* Retourne OK_DRC si aucune partie commune
* Retourne BAD_DRC si partie commune
*/
#define us unsigned int
static
inline
int
USCALE
(
us
arg
,
us
num
,
us
den
)
static
inline
int
USCALE
(
unsigned
arg
,
unsigned
num
,
unsigned
den
)
{
int
ii
;
...
...
@@ -1527,10 +1565,10 @@ static int Tst_Ligne( int x1, int y1, int x2, int y2 )
{
int
temp
;
do
{
if
(
x1
>
x2
)
{
EXCHG
(
x1
,
x2
);
EXCHG
(
y1
,
y2
);
EXCHG
(
x1
,
x2
);
EXCHG
(
y1
,
y2
);
}
if
(
(
x2
<
xcliplo
)
||
(
x1
>
xcliphi
)
)
{
...
...
@@ -1616,7 +1654,6 @@ static int Tst_Ligne( int x1, int y1, int x2, int y2 )
WHEN_INSIDE
;
}
}
}
while
(
0
);
if
(
(
(
x2
+
x1
)
/
2
<=
xcliphi
)
&&
(
(
x2
+
x1
)
/
2
>=
xcliplo
)
\
&&
(
(
y2
+
y1
)
/
2
<=
ycliphi
)
&&
(
(
y2
+
y1
)
/
2
>=
ycliplo
)
)
...
...
@@ -1626,3 +1663,4 @@ static int Tst_Ligne( int x1, int y1, int x2, int y2 )
else
return
OK_DRC
;
}
pcbnew/drc_stuff.h
0 → 100644
View file @
514c63c7
/*
* 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment