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
ef1ed964
Commit
ef1ed964
authored
Mar 19, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DRC markers are drawn in GAL canvases.
parent
e1ce30d8
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
97 additions
and
7 deletions
+97
-7
layers_id_colors_and_visibility.h
include/layers_id_colors_and_visibility.h
+1
-0
basepcbframe.cpp
pcbnew/basepcbframe.cpp
+2
-0
class_marker_pcb.cpp
pcbnew/class_marker_pcb.cpp
+10
-4
class_marker_pcb.h
pcbnew/class_marker_pcb.h
+23
-0
drc.cpp
pcbnew/drc.cpp
+13
-0
drc_marker_functions.cpp
pcbnew/drc_marker_functions.cpp
+20
-0
pcb_painter.cpp
pcbnew/pcb_painter.cpp
+24
-2
pcb_painter.h
pcbnew/pcb_painter.h
+2
-0
pcbframe.cpp
pcbnew/pcbframe.cpp
+2
-1
No files found.
include/layers_id_colors_and_visibility.h
View file @
ef1ed964
...
...
@@ -239,6 +239,7 @@ enum PCB_VISIBLE
PADS_HOLES_VISIBLE
,
VIAS_HOLES_VISIBLE
,
DRC_VISIBLE
,
///< drc markers
WORKSHEET
,
///< worksheet frame
GP_OVERLAY
,
///< general purpose overlay
...
...
pcbnew/basepcbframe.cpp
View file @
ef1ed964
...
...
@@ -75,6 +75,7 @@ static const wxString FastGrid2Entry( wxT( "FastGrid2" ) );
const
LAYER_NUM
PCB_BASE_FRAME
::
GAL_LAYER_ORDER
[]
=
{
ITEM_GAL_LAYER
(
GP_OVERLAY
),
ITEM_GAL_LAYER
(
DRC_VISIBLE
),
NETNAMES_GAL_LAYER
(
PADS_NETNAMES_VISIBLE
),
DRAW_N
,
COMMENT_N
,
ECO1_N
,
ECO2_N
,
EDGE_N
,
UNUSED_LAYER_29
,
UNUSED_LAYER_30
,
UNUSED_LAYER_31
,
...
...
@@ -817,6 +818,7 @@ void PCB_BASE_FRAME::LoadSettings()
view
->
SetLayerTarget
(
ITEM_GAL_LAYER
(
GP_OVERLAY
),
KIGFX
::
TARGET_OVERLAY
);
view
->
SetLayerTarget
(
ITEM_GAL_LAYER
(
RATSNEST_VISIBLE
),
KIGFX
::
TARGET_OVERLAY
);
view
->
SetLayerTarget
(
ITEM_GAL_LAYER
(
DRC_VISIBLE
),
KIGFX
::
TARGET_NONCACHED
);
// Apply layer coloring scheme & display options
if
(
view
->
GetPainter
()
)
...
...
pcbnew/class_marker_pcb.cpp
View file @
ef1ed964
...
...
@@ -46,7 +46,7 @@
MARKER_PCB
::
MARKER_PCB
(
BOARD_ITEM
*
aParent
)
:
BOARD_ITEM
(
aParent
,
PCB_MARKER_T
),
MARKER_BASE
(
)
MARKER_BASE
(
),
m_item
(
NULL
)
{
m_Color
=
WHITE
;
m_ScalingFactor
=
SCALING_FACTOR
;
...
...
@@ -57,8 +57,7 @@ MARKER_PCB::MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
const
wxString
&
aText
,
const
wxPoint
&
aPos
,
const
wxString
&
bText
,
const
wxPoint
&
bPos
)
:
BOARD_ITEM
(
NULL
,
PCB_MARKER_T
),
// parent set during BOARD::Add()
MARKER_BASE
(
aErrorCode
,
aMarkerPos
,
aText
,
aPos
,
bText
,
bPos
)
MARKER_BASE
(
aErrorCode
,
aMarkerPos
,
aText
,
aPos
,
bText
,
bPos
),
m_item
(
NULL
)
{
m_Color
=
WHITE
;
m_ScalingFactor
=
SCALING_FACTOR
;
...
...
@@ -67,7 +66,7 @@ MARKER_PCB::MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
MARKER_PCB
::
MARKER_PCB
(
int
aErrorCode
,
const
wxPoint
&
aMarkerPos
,
const
wxString
&
aText
,
const
wxPoint
&
aPos
)
:
BOARD_ITEM
(
NULL
,
PCB_MARKER_T
),
// parent set during BOARD::Add()
MARKER_BASE
(
aErrorCode
,
aMarkerPos
,
aText
,
aPos
)
MARKER_BASE
(
aErrorCode
,
aMarkerPos
,
aText
,
aPos
)
,
m_item
(
NULL
)
{
m_Color
=
WHITE
;
m_ScalingFactor
=
SCALING_FACTOR
;
...
...
@@ -136,3 +135,10 @@ wxString MARKER_PCB::GetSelectMenuText() const
return
text
;
}
void
MARKER_PCB
::
ViewGetLayers
(
int
aLayers
[],
int
&
aCount
)
const
{
aCount
=
1
;
aLayers
[
0
]
=
ITEM_GAL_LAYER
(
DRC_VISIBLE
);
}
pcbnew/class_marker_pcb.h
View file @
ef1ed964
...
...
@@ -64,6 +64,16 @@ public:
const
wxPoint
&
GetPosition
()
const
{
return
m_Pos
;
}
void
SetPosition
(
const
wxPoint
&
aPos
)
{
m_Pos
=
aPos
;
}
void
SetItem
(
const
BOARD_ITEM
*
aItem
)
{
m_item
=
aItem
;
}
const
BOARD_ITEM
*
GetItem
()
const
{
return
m_item
;
}
bool
HitTest
(
const
wxPoint
&
aPosition
)
{
return
HitTestMarker
(
aPosition
);
...
...
@@ -77,9 +87,22 @@ public:
BITMAP_DEF
GetMenuImage
()
const
{
return
drc_xpm
;
}
///> @copydoc VIEW_ITEM::ViewBBox()
virtual
const
BOX2I
ViewBBox
()
const
{
return
GetParent
()
->
ViewBBox
();
}
///> @copydoc VIEW_ITEM::ViewGetLayers()
virtual
void
ViewGetLayers
(
int
aLayers
[],
int
&
aCount
)
const
;
#if defined(DEBUG)
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
const
{
ShowDummy
(
os
);
}
// override
#endif
protected
:
///> Pointer to BOARD_ITEM that causes DRC error.
const
BOARD_ITEM
*
m_item
;
};
#endif // CLASS_MARKER_PCB_H
pcbnew/drc.cpp
View file @
ef1ed964
...
...
@@ -38,6 +38,8 @@
#include <class_track.h>
#include <class_pad.h>
#include <class_zone.h>
#include <class_drawpanel_gal.h>
#include <view/view.h>
#include <pcbnew.h>
#include <drc_stuff.h>
...
...
@@ -312,6 +314,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
m_currentMarker = fillMarker( DRCE_NETCLASS_CLEARANCE, msg, m_currentMarker );
m_pcb->Add( m_currentMarker );
m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker );
m_currentMarker = 0;
ret = false;
}
...
...
@@ -327,6 +330,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
m_currentMarker
=
fillMarker
(
DRCE_NETCLASS_TRACKWIDTH
,
msg
,
m_currentMarker
);
m_pcb
->
Add
(
m_currentMarker
);
m_mainWindow
->
GetGalCanvas
()
->
GetView
()
->
Add
(
m_currentMarker
);
m_currentMarker
=
0
;
ret
=
false
;
}
...
...
@@ -341,6 +345,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
m_currentMarker
=
fillMarker
(
DRCE_NETCLASS_VIASIZE
,
msg
,
m_currentMarker
);
m_pcb
->
Add
(
m_currentMarker
);
m_mainWindow
->
GetGalCanvas
()
->
GetView
()
->
Add
(
m_currentMarker
);
m_currentMarker
=
0
;
ret
=
false
;
}
...
...
@@ -355,6 +360,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
m_currentMarker
=
fillMarker
(
DRCE_NETCLASS_VIADRILLSIZE
,
msg
,
m_currentMarker
);
m_pcb
->
Add
(
m_currentMarker
);
m_mainWindow
->
GetGalCanvas
()
->
GetView
()
->
Add
(
m_currentMarker
);
m_currentMarker
=
0
;
ret
=
false
;
}
...
...
@@ -369,6 +375,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
m_currentMarker
=
fillMarker
(
DRCE_NETCLASS_uVIASIZE
,
msg
,
m_currentMarker
);
m_pcb
->
Add
(
m_currentMarker
);
m_mainWindow
->
GetGalCanvas
()
->
GetView
()
->
Add
(
m_currentMarker
);
m_currentMarker
=
0
;
ret
=
false
;
}
...
...
@@ -383,6 +390,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
m_currentMarker
=
fillMarker
(
DRCE_NETCLASS_uVIADRILLSIZE
,
msg
,
m_currentMarker
);
m_pcb
->
Add
(
m_currentMarker
);
m_mainWindow
->
GetGalCanvas
()
->
GetView
()
->
Add
(
m_currentMarker
);
m_currentMarker
=
0
;
ret
=
false
;
}
...
...
@@ -447,6 +455,7 @@ void DRC::testPad2Pad()
{
wxASSERT
(
m_currentMarker
);
m_pcb
->
Add
(
m_currentMarker
);
m_mainWindow
->
GetGalCanvas
()
->
GetView
()
->
Add
(
m_currentMarker
);
m_currentMarker
=
0
;
}
}
...
...
@@ -493,6 +502,7 @@ void DRC::testTracks( bool aShowProgressBar )
{
wxASSERT
(
m_currentMarker
);
m_pcb
->
Add
(
m_currentMarker
);
m_mainWindow
->
GetGalCanvas
()
->
GetView
()
->
Add
(
m_currentMarker
);
m_currentMarker
=
0
;
}
}
...
...
@@ -554,6 +564,7 @@ void DRC::testZones()
m_currentMarker
=
fillMarker
(
test_area
,
DRCE_NON_EXISTANT_NET_FOR_ZONE_OUTLINE
,
m_currentMarker
);
m_pcb
->
Add
(
m_currentMarker
);
m_mainWindow
->
GetGalCanvas
()
->
GetView
()
->
Add
(
m_currentMarker
);
m_currentMarker
=
0
;
}
}
...
...
@@ -589,6 +600,7 @@ void DRC::testKeepoutAreas()
m_currentMarker
=
fillMarker
(
segm
,
NULL
,
DRCE_TRACK_INSIDE_KEEPOUT
,
m_currentMarker
);
m_pcb
->
Add
(
m_currentMarker
);
m_mainWindow
->
GetGalCanvas
()
->
GetView
()
->
Add
(
m_currentMarker
);
m_currentMarker
=
0
;
}
}
...
...
@@ -605,6 +617,7 @@ void DRC::testKeepoutAreas()
m_currentMarker
=
fillMarker
(
segm
,
NULL
,
DRCE_VIA_INSIDE_KEEPOUT
,
m_currentMarker
);
m_pcb
->
Add
(
m_currentMarker
);
m_mainWindow
->
GetGalCanvas
()
->
GetView
()
->
Add
(
m_currentMarker
);
m_currentMarker
=
0
;
}
}
...
...
pcbnew/drc_marker_functions.cpp
View file @
ef1ed964
...
...
@@ -100,13 +100,18 @@ MARKER_PCB* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, M
else
{
if
(
aItem
)
{
fillMe
=
new
MARKER_PCB
(
aErrorCode
,
position
,
textA
,
aTrack
->
GetPosition
(),
textB
,
posB
);
fillMe
->
SetItem
(
aItem
);
}
else
{
fillMe
=
new
MARKER_PCB
(
aErrorCode
,
position
,
textA
,
aTrack
->
GetPosition
()
);
}
}
return
fillMe
;
}
...
...
@@ -121,9 +126,14 @@ MARKER_PCB* DRC::fillMarker( D_PAD* aPad, D_PAD* bPad, int aErrorCode, MARKER_PC
wxPoint
posB
=
bPad
->
GetPosition
();
if
(
fillMe
)
{
fillMe
->
SetData
(
aErrorCode
,
posA
,
textA
,
posA
,
textB
,
posB
);
}
else
{
fillMe
=
new
MARKER_PCB
(
aErrorCode
,
posA
,
textA
,
posA
,
textB
,
posB
);
fillMe
->
SetItem
(
aPad
);
// TODO it has to be checked
}
return
fillMe
;
}
...
...
@@ -136,9 +146,14 @@ MARKER_PCB* DRC::fillMarker( ZONE_CONTAINER* aArea, int aErrorCode, MARKER_PCB*
wxPoint
posA
=
aArea
->
GetPosition
();
if
(
fillMe
)
{
fillMe
->
SetData
(
aErrorCode
,
posA
,
textA
,
posA
);
}
else
{
fillMe
=
new
MARKER_PCB
(
aErrorCode
,
posA
,
textA
,
posA
);
fillMe
->
SetItem
(
aArea
);
}
return
fillMe
;
}
...
...
@@ -154,9 +169,14 @@ MARKER_PCB* DRC::fillMarker( const ZONE_CONTAINER* aArea,
wxPoint
posA
=
aPos
;
if
(
fillMe
)
{
fillMe
->
SetData
(
aErrorCode
,
posA
,
textA
,
posA
);
}
else
{
fillMe
=
new
MARKER_PCB
(
aErrorCode
,
posA
,
textA
,
posA
);
fillMe
->
SetItem
(
aArea
);
}
return
fillMe
;
}
...
...
pcbnew/pcb_painter.cpp
View file @
ef1ed964
...
...
@@ -34,9 +34,8 @@
#include <class_marker_pcb.h>
#include <class_dimension.h>
#include <class_mire.h>
#include <
pcbstruct
.h>
#include <
class_marker_pcb
.h>
#include <view/view.h>
#include <pcb_painter.h>
#include <gal/graphics_abstraction_layer.h>
...
...
@@ -76,6 +75,7 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( COLORS_DESIGN_SETTINGS* aSettings
m_layerColors
[
NETNAMES_GAL_LAYER
(
PAD_BK_NETNAMES_VISIBLE
)]
=
COLOR4D
(
0.8
,
0.8
,
0.8
,
0.7
);
m_layerColors
[
ITEM_GAL_LAYER
(
RATSNEST_VISIBLE
)]
=
COLOR4D
(
0.4
,
0.4
,
0.4
,
0.7
);
m_layerColors
[
ITEM_GAL_LAYER
(
WORKSHEET
)]
=
COLOR4D
(
0.5
,
0.0
,
0.0
,
1.0
);
m_layerColors
[
ITEM_GAL_LAYER
(
DRC_VISIBLE
)]
=
COLOR4D
(
1.0
,
0.0
,
0.0
,
1.0
);
// Netnames for copper layers
for
(
LAYER_NUM
layer
=
FIRST_COPPER_LAYER
;
layer
<=
LAST_COPPER_LAYER
;
++
layer
)
...
...
@@ -246,6 +246,9 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
draw
(
(
PCB_TARGET
*
)
aItem
);
break
;
case
PCB_MARKER_T
:
draw
(
(
MARKER_PCB
*
)
aItem
);
default
:
// Painter does not know how to draw the object
return
false
;
...
...
@@ -863,4 +866,23 @@ void PCB_PAINTER::draw( const PCB_TARGET* aTarget )
}
void
PCB_PAINTER
::
draw
(
const
MARKER_PCB
*
aMarker
)
{
const
BOARD_ITEM
*
item
=
aMarker
->
GetItem
();
if
(
item
)
// By default draw an item in a different color
{
Draw
(
item
,
ITEM_GAL_LAYER
(
DRC_VISIBLE
)
);
}
else
// If there is no item associated - draw a circle marking the DRC error
{
m_gal
->
SetStrokeColor
(
COLOR4D
(
1.0
,
0.0
,
0.0
,
1.0
)
);
m_gal
->
SetIsFill
(
false
);
m_gal
->
SetIsStroke
(
true
);
m_gal
->
SetLineWidth
(
10000
);
m_gal
->
DrawCircle
(
VECTOR2D
(
aMarker
->
GetPosition
()
),
200000
);
}
}
const
double
PCB_RENDER_SETTINGS
::
MAX_FONT_SIZE
=
Millimeter2iu
(
10.0
);
pcbnew/pcb_painter.h
View file @
ef1ed964
...
...
@@ -48,6 +48,7 @@ class TEXTE_PCB;
class
TEXTE_MODULE
;
class
DIMENSION
;
class
PCB_TARGET
;
class
MARKER_PCB
;
namespace
KIGFX
{
...
...
@@ -169,6 +170,7 @@ protected:
void
draw
(
const
ZONE_CONTAINER
*
aZone
);
void
draw
(
const
DIMENSION
*
aDimension
,
int
aLayer
);
void
draw
(
const
PCB_TARGET
*
aTarget
);
void
draw
(
const
MARKER_PCB
*
aMarker
);
};
}
// namespace KIGFX
...
...
pcbnew/pcbframe.cpp
View file @
ef1ed964
...
...
@@ -923,7 +923,8 @@ void PCB_EDIT_FRAME::SetTopLayer( LAYER_NUM aLayer )
GetNetnameLayer
(
aLayer
),
ITEM_GAL_LAYER
(
VIA_THROUGH_VISIBLE
),
ITEM_GAL_LAYER
(
VIAS_HOLES_VISIBLE
),
ITEM_GAL_LAYER
(
PADS_VISIBLE
),
ITEM_GAL_LAYER
(
PADS_HOLES_VISIBLE
),
NETNAMES_GAL_LAYER
(
PADS_NETNAMES_VISIBLE
),
ITEM_GAL_LAYER
(
GP_OVERLAY
),
ITEM_GAL_LAYER
(
RATSNEST_VISIBLE
),
DRAW_N
ITEM_GAL_LAYER
(
GP_OVERLAY
),
ITEM_GAL_LAYER
(
RATSNEST_VISIBLE
),
DRAW_N
,
ITEM_GAL_LAYER
(
DRC_VISIBLE
)
};
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
layers
)
/
sizeof
(
LAYER_NUM
);
++
i
)
...
...
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