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
6b05cf31
Commit
6b05cf31
authored
Oct 13, 2010
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug in GRLineArray(). Cleanup Gerbview code
parent
ee4aadc4
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
168 additions
and
202 deletions
+168
-202
gr_basic.cpp
common/gr_basic.cpp
+141
-146
edit.cpp
gerbview/edit.cpp
+1
-31
gerberframe.cpp
gerbview/gerberframe.cpp
+1
-1
toolbars_gerber.cpp
gerbview/toolbars_gerber.cpp
+0
-7
gr_basic.h
include/gr_basic.h
+11
-4
class_zone.cpp
pcbnew/class_zone.cpp
+14
-13
No files found.
common/gr_basic.cpp
View file @
6b05cf31
...
@@ -56,7 +56,7 @@ int g_DrawBgColor = WHITE;
...
@@ -56,7 +56,7 @@ int g_DrawBgColor = WHITE;
#define USE_CLIP_FILLED_POLYGONS
#define USE_CLIP_FILLED_POLYGONS
#ifdef USE_CLIP_FILLED_POLYGONS
#ifdef USE_CLIP_FILLED_POLYGONS
void
ClipAndDrawFilledPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
wxPoint
Points
[],
int
n
);
void
ClipAndDrawFilledPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
wxPoint
Points
[],
int
n
);
#endif
#endif
/* These functions are used by corresponding functions
/* These functions are used by corresponding functions
...
@@ -82,8 +82,9 @@ static void GRSFilledArc( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int StAngle
...
@@ -82,8 +82,9 @@ static void GRSFilledArc( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int StAngle
int
EndAngle
,
int
r
,
int
width
,
int
Color
,
int
BgColor
);
int
EndAngle
,
int
r
,
int
width
,
int
Color
,
int
BgColor
);
static
void
GRSCSegm
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x1
,
int
y1
,
int
x2
,
int
y2
,
static
void
GRSCSegm
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x1
,
int
y1
,
int
x2
,
int
y2
,
int
width
,
int
aPenSize
,
int
Color
);
int
width
,
int
aPenSize
,
int
Color
);
static
void
GRSLineArray
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
wxPoint
points
[],
int
lines
,
int
width
,
int
Color
);
static
void
GRSLineArray
(
EDA_Rect
*
aClipBox
,
wxDC
*
aDC
,
std
::
vector
<
wxPoint
>&
aLines
,
int
aWidth
,
int
aColor
);
/**/
/**/
extern
BASE_SCREEN
*
ActiveScreen
;
extern
BASE_SCREEN
*
ActiveScreen
;
...
@@ -169,7 +170,9 @@ int GRMapY( int y )
...
@@ -169,7 +170,9 @@ int GRMapY( int y )
#if defined( USE_WX_ZOOM )
#if defined( USE_WX_ZOOM )
// currently only used if USE_WX_ZOOM is defined.
// currently only used if USE_WX_ZOOM is defined.
/**
/**
* Test if any part of a line falls within the bounds of a rectangle.
* Test if any part of a line falls within the bounds of a rectangle.
*
*
...
@@ -254,7 +257,8 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
...
@@ -254,7 +257,8 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
/* If we're here, something has gone terribly wrong. */
/* If we're here, something has gone terribly wrong. */
#if DEBUG_DUMP_CLIP_ERROR_COORDS
#if DEBUG_DUMP_CLIP_ERROR_COORDS
wxLogDebug
(
wxT
(
"Line (%d,%d):(%d,%d) in rectangle (%d,%d,%d,%d) clipped to (%d,%d,%d,%d)"
),
wxLogDebug
(
wxT
(
"Line (%d,%d):(%d,%d) in rectangle (%d,%d,%d,%d) clipped to (%d,%d,%d,%d)"
),
tmpX1
,
tmpY1
,
tmpX2
,
tmpY2
,
minX
,
minY
,
maxX
,
maxY
,
x1
,
y1
,
x2
,
y2
);
tmpX1
,
tmpY1
,
tmpX2
,
tmpY2
,
minX
,
minY
,
maxX
,
maxY
,
x1
,
y1
,
x2
,
y2
);
#endif
#endif
return
false
;
return
false
;
...
@@ -308,7 +312,8 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
...
@@ -308,7 +312,8 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
/* If we're here, something has gone terribly wrong. */
/* If we're here, something has gone terribly wrong. */
#if DEBUG_DUMP_CLIP_ERROR_COORDS
#if DEBUG_DUMP_CLIP_ERROR_COORDS
wxLogDebug
(
wxT
(
"Line (%d,%d):(%d,%d) in rectangle (%d,%d,%d,%d) clipped to (%d,%d,%d,%d)"
),
wxLogDebug
(
wxT
(
"Line (%d,%d):(%d,%d) in rectangle (%d,%d,%d,%d) clipped to (%d,%d,%d,%d)"
),
tmpX1
,
tmpY1
,
tmpX2
,
tmpY2
,
minX
,
minY
,
maxX
,
maxY
,
x1
,
y1
,
x2
,
y2
);
tmpX1
,
tmpY1
,
tmpX2
,
tmpY2
,
minX
,
minY
,
maxX
,
maxY
,
x1
,
y1
,
x2
,
y2
);
#endif
#endif
return
false
;
return
false
;
...
@@ -386,7 +391,8 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
...
@@ -386,7 +391,8 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
* something has gone terribly wrong. */
* something has gone terribly wrong. */
#if DEBUG_DUMP_CLIP_ERROR_COORDS
#if DEBUG_DUMP_CLIP_ERROR_COORDS
if
(
haveFirstPoint
)
if
(
haveFirstPoint
)
wxLogDebug
(
wxT
(
"Line (%d,%d):(%d,%d) in rectangle (%d,%d,%d,%d) clipped to (%d,%d,%d,%d)"
),
wxLogDebug
(
wxT
(
"Line (%d,%d):(%d,%d) in rectangle (%d,%d,%d,%d) clipped to (%d,%d,%d,%d)"
),
tmpX1
,
tmpY1
,
tmpX2
,
tmpY2
,
minX
,
minY
,
maxX
,
maxY
,
x1
,
y1
,
x2
,
y2
);
tmpX1
,
tmpY1
,
tmpX2
,
tmpY2
,
minX
,
minY
,
maxX
,
maxY
,
x1
,
y1
,
x2
,
y2
);
#endif
#endif
}
}
...
@@ -400,6 +406,8 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
...
@@ -400,6 +406,8 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
return
true
;
return
true
;
}
}
#endif // if defined( USE_WX_ZOOM )
#endif // if defined( USE_WX_ZOOM )
...
@@ -528,10 +536,11 @@ static void WinClipAndDrawLine( EDA_Rect* ClipBox, wxDC* DC,
...
@@ -528,10 +536,11 @@ static void WinClipAndDrawLine( EDA_Rect* ClipBox, wxDC* DC,
ycliphi
+=
width
;
ycliphi
+=
width
;
#if defined( USE_WX_ZOOM )
#if defined( USE_WX_ZOOM )
if
(
clipLine
(
ClipBox
,
x1
,
y1
,
x2
,
y2
)
)
if
(
clipLine
(
ClipBox
,
x1
,
y1
,
x2
,
y2
)
)
#else
#else
if
(
clip_line
(
x1
,
y1
,
x2
,
y2
)
)
if
(
clip_line
(
x1
,
y1
,
x2
,
y2
)
)
#endif
#endif
return
;
return
;
}
}
...
@@ -566,10 +575,10 @@ void GRSetColorPen( wxDC* DC, int Color, int width, wxPenStyle style )
...
@@ -566,10 +575,10 @@ void GRSetColorPen( wxDC* DC, int Color, int width, wxPenStyle style )
Color
=
BLACK
;
Color
=
BLACK
;
}
}
if
(
s_DC_lastcolor
!=
Color
||
if
(
s_DC_lastcolor
!=
Color
s_DC_lastwidth
!=
width
||
||
s_DC_lastwidth
!=
width
s_DC_lastpenstyle
!=
style
||
||
s_DC_lastpenstyle
!=
style
s_DC_lastDC
!=
DC
)
||
s_DC_lastDC
!=
DC
)
{
{
wxPen
pen
;
wxPen
pen
;
...
@@ -585,7 +594,6 @@ void GRSetColorPen( wxDC* DC, int Color, int width, wxPenStyle style )
...
@@ -585,7 +594,6 @@ void GRSetColorPen( wxDC* DC, int Color, int width, wxPenStyle style )
s_DC_lastwidth
=
width
;
s_DC_lastwidth
=
width
;
s_DC_lastpenstyle
=
style
;
s_DC_lastpenstyle
=
style
;
s_DC_lastDC
=
DC
;
s_DC_lastDC
=
DC
;
}
}
}
}
...
@@ -595,9 +603,9 @@ void GRSetBrush( wxDC* DC, int Color, int fill )
...
@@ -595,9 +603,9 @@ void GRSetBrush( wxDC* DC, int Color, int fill )
if
(
s_ForceBlackPen
)
if
(
s_ForceBlackPen
)
Color
=
BLACK
;
Color
=
BLACK
;
if
(
s_DC_lastbrushcolor
!=
Color
||
if
(
s_DC_lastbrushcolor
!=
Color
s_DC_lastbrushfill
!=
fill
||
||
s_DC_lastbrushfill
!=
fill
s_DC_lastDC
!=
DC
)
||
s_DC_lastDC
!=
DC
)
{
{
wxBrush
DrawBrush
;
wxBrush
DrawBrush
;
DrawBrush
.
SetColour
(
MakeColour
(
Color
)
);
DrawBrush
.
SetColour
(
MakeColour
(
Color
)
);
...
@@ -616,7 +624,6 @@ void GRSetBrush( wxDC* DC, int Color, int fill )
...
@@ -616,7 +624,6 @@ void GRSetBrush( wxDC* DC, int Color, int fill )
}
}
/** function GRForceBlackPen
/** function GRForceBlackPen
* @param flagforce True to force a black pen whenever the asked color
* @param flagforce True to force a black pen whenever the asked color
*/
*/
...
@@ -642,30 +649,40 @@ void GRSetDrawMode( wxDC* DC, int draw_mode )
...
@@ -642,30 +649,40 @@ void GRSetDrawMode( wxDC* DC, int draw_mode )
{
{
if
(
draw_mode
&
GR_OR
)
if
(
draw_mode
&
GR_OR
)
#if defined(__WXMAC__) && (wxMAC_USE_CORE_GRAPHICS || wxCHECK_VERSION( 2, 9, 0 ) )
#if defined(__WXMAC__) && (wxMAC_USE_CORE_GRAPHICS || wxCHECK_VERSION( 2, 9, 0 ) )
DC
->
SetLogicalFunction
(
wxCOPY
);
DC
->
SetLogicalFunction
(
wxCOPY
);
#elif defined( USE_WX_GRAPHICS_CONTEXT )
#elif defined( USE_WX_GRAPHICS_CONTEXT )
DC
->
SetLogicalFunction
(
wxCOPY
);
DC
->
SetLogicalFunction
(
wxCOPY
);
#else
#else
DC
->
SetLogicalFunction
(
wxOR
);
DC
->
SetLogicalFunction
(
wxOR
);
#endif
#endif
else
if
(
draw_mode
&
GR_XOR
)
else
if
(
draw_mode
&
GR_XOR
)
#if defined( USE_WX_GRAPHICS_CONTEXT )
#if defined( USE_WX_GRAPHICS_CONTEXT )
DC
->
SetLogicalFunction
(
wxCOPY
);
DC
->
SetLogicalFunction
(
wxCOPY
);
#else
#else
DC
->
SetLogicalFunction
(
wxXOR
);
DC
->
SetLogicalFunction
(
wxXOR
);
#endif
#endif
else
if
(
draw_mode
&
GR_NXOR
)
else
if
(
draw_mode
&
GR_NXOR
)
#if defined(__WXMAC__) && (wxMAC_USE_CORE_GRAPHICS || wxCHECK_VERSION( 2, 9, 0 ) )
#if defined(__WXMAC__) && (wxMAC_USE_CORE_GRAPHICS || wxCHECK_VERSION( 2, 9, 0 ) )
DC
->
SetLogicalFunction
(
wxXOR
);
DC
->
SetLogicalFunction
(
wxXOR
);
#elif defined( USE_WX_GRAPHICS_CONTEXT )
#elif defined( USE_WX_GRAPHICS_CONTEXT )
DC
->
SetLogicalFunction
(
wxCOPY
);
DC
->
SetLogicalFunction
(
wxCOPY
);
#else
#else
DC
->
SetLogicalFunction
(
wxEQUIV
);
DC
->
SetLogicalFunction
(
wxEQUIV
);
#endif
#endif
else
if
(
draw_mode
&
GR_INVERT
)
else
if
(
draw_mode
&
GR_INVERT
)
#if defined( USE_WX_GRAPHICS_CONTEXT )
#if defined( USE_WX_GRAPHICS_CONTEXT )
DC
->
SetLogicalFunction
(
wxCOPY
);
DC
->
SetLogicalFunction
(
wxCOPY
);
#else
#else
DC
->
SetLogicalFunction
(
wxINVERT
);
DC
->
SetLogicalFunction
(
wxINVERT
);
#endif
#endif
else
else
...
@@ -863,7 +880,6 @@ void GRSMoveTo( int x, int y )
...
@@ -863,7 +880,6 @@ void GRSMoveTo( int x, int y )
}
}
/*
/*
* Draw line to a new position, in screen (pixels) space.
* Draw line to a new position, in screen (pixels) space.
*/
*/
...
@@ -881,95 +897,65 @@ void GRSLine( EDA_Rect* ClipBox,
...
@@ -881,95 +897,65 @@ void GRSLine( EDA_Rect* ClipBox,
GRLastMoveToY
=
y2
;
GRLastMoveToY
=
y2
;
}
}
/*
* Draw an array of lines
*/
void
GRLineArray
(
EDA_Rect
*
ClipBox
,
/** Function GRLineArray
wxDC
*
DC
,
* draws an array of lines (not a polygon).
wxPoint
points
[],
* @param aClipBox = the clip box
int
lines
,
* @param aDC = the device context into which drawing should occur.
int
width
,
* @param aLines = a list of pair of coordinate in user space: a pair for each line.
int
Color
)
* @param aWidth = the width of each line.
* @param aColor = an index into our color table of RGB colors.
* @see EDA_Colors and colors.h
*/
void
GRLineArray
(
EDA_Rect
*
aClipBox
,
wxDC
*
aDC
,
std
::
vector
<
wxPoint
>&
aLines
,
int
aWidth
,
int
aColor
)
{
{
for
(
int
i
=
0
;
i
<
lines
;
i
++
)
for
(
unsigned
i
=
0
;
i
<
aLines
.
size
();
i
++
)
{
{
points
[
i
].
x
=
GRMapX
(
point
s
[
i
].
x
);
aLines
[
i
].
x
=
GRMapX
(
aLine
s
[
i
].
x
);
points
[
i
].
y
=
GRMapY
(
point
s
[
i
].
y
);
aLines
[
i
].
y
=
GRMapY
(
aLine
s
[
i
].
y
);
}
}
width
=
ZoomValue
(
w
idth
);
aWidth
=
ZoomValue
(
aW
idth
);
GRSLineArray
(
ClipBox
,
DC
,
points
,
lines
,
width
,
Color
);
GRSLineArray
(
aClipBox
,
aDC
,
aLines
,
aWidth
,
aColor
);
}
}
void
GRSLineArray
(
EDA_Rect
*
ClipBox
,
void
GRSLineArray
(
EDA_Rect
*
aClipBox
,
wxDC
*
aDC
,
wxDC
*
DC
,
std
::
vector
<
wxPoint
>&
aLines
,
wxPoint
points
[],
int
aWidth
,
int
aColor
)
int
lines
,
int
width
,
int
Color
)
{
{
GRSetColorPen
(
DC
,
Color
,
w
idth
);
GRSetColorPen
(
aDC
,
aColor
,
aW
idth
);
#if defined( USE_WX_GRAPHICS_CONTEXT ) || defined(__WXMAC__)
#if defined( USE_WX_GRAPHICS_CONTEXT ) || defined(__WXMAC__)
wxGraphicsContext
*
gc
=
wxGraphicsContext
::
Create
(
DC
);
wxGraphicsContext
*
gc
=
wxGraphicsContext
::
Create
(
a
DC
);
wxASSERT
(
gc
);
wxASSERT
(
gc
);
gc
->
Clip
(
ClipBox
->
GetX
(),
ClipBox
->
GetY
(),
ClipBox
->
GetRight
(),
ClipBox
->
GetHeight
()
);
gc
->
Clip
(
aClipBox
->
GetX
(),
aClipBox
->
GetY
(),
aClipBox
->
GetRight
(),
aClipBox
->
GetHeight
()
);
wxGraphicsPath
path
=
gc
->
CreatePath
();
wxGraphicsPath
path
=
gc
->
CreatePath
();
for
(
int
i
=
0
;
i
<
lines
;
i
+=
2
)
for
(
unsigned
i
=
0
;
i
<
aLines
.
size
();
)
{
{
path
.
MoveToPoint
(
points
[
i
].
x
,
points
[
i
].
y
);
path
.
MoveToPoint
(
aLines
[
i
].
x
,
aLines
[
i
].
y
);
path
.
AddLineToPoint
(
points
[
i
+
1
].
x
,
points
[
i
+
1
].
y
);
i
++
;
path
.
AddLineToPoint
(
aLines
[
i
].
x
,
aLines
[
i
].
y
);
i
++
;
}
}
gc
->
StrokePath
(
path
);
gc
->
StrokePath
(
path
);
gc
->
ResetClip
();
gc
->
ResetClip
();
delete
gc
;
delete
gc
;
#else
#else
for
(
int
i
=
0
;
i
<
lines
;
i
+=
2
)
for
(
unsigned
i
=
0
;
i
<
aLines
.
size
();
)
{
{
WinClipAndDrawLine
(
ClipBox
,
DC
,
points
[
i
].
x
,
points
[
i
].
y
,
points
[
i
+
1
].
x
,
points
[
i
+
1
].
y
,
Color
,
width
);
WinClipAndDrawLine
(
aClipBox
,
aDC
,
aLines
[
i
].
x
,
aLines
[
i
].
y
,
GRLastMoveToX
=
points
[
i
+
1
].
x
;
aLines
[
i
+
1
].
x
,
aLines
[
i
+
1
].
y
,
aColor
,
aWidth
);
GRLastMoveToY
=
points
[
i
+
1
].
y
;
i
++
;
GRLastMoveToX
=
aLines
[
i
].
x
;
GRLastMoveToY
=
aLines
[
i
].
y
;
i
++
;
}
}
#endif
}
/*
* Move to a new position relative to current one, in object space.
*/
void
GRMoveRel
(
int
x
,
int
y
)
{
GRLastMoveToX
+=
ZoomValue
(
x
);
GRLastMoveToY
+=
ZoomValue
(
y
);
}
/*
#endif
* Draw a line to a new position relative to current one, in object space.
*/
void
GRLineRel
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x
,
int
y
,
int
width
,
int
Color
)
{
int
GRLineToX
=
GRLastMoveToX
,
GRLineToY
=
GRLastMoveToY
;
GRLineToX
+=
ZoomValue
(
x
);
GRLineToY
+=
ZoomValue
(
y
);
GRSLine
(
ClipBox
,
DC
,
GRLastMoveToX
,
GRLastMoveToY
,
GRLineToX
,
GRLineToY
,
ZoomValue
(
width
),
Color
);
}
}
...
@@ -983,6 +969,7 @@ void GRCSegm( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
...
@@ -983,6 +969,7 @@ void GRCSegm( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
GRMapY
(
y2
),
ZoomValue
(
width
),
ZoomValue
(
aPenSize
),
Color
);
GRMapY
(
y2
),
ZoomValue
(
width
),
ZoomValue
(
aPenSize
),
Color
);
}
}
void
GRCSegm
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x1
,
int
y1
,
int
x2
,
int
y2
,
void
GRCSegm
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x1
,
int
y1
,
int
x2
,
int
y2
,
int
width
,
int
Color
)
int
width
,
int
Color
)
{
{
...
@@ -990,6 +977,7 @@ void GRCSegm( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
...
@@ -990,6 +977,7 @@ void GRCSegm( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
GRMapY
(
y2
),
ZoomValue
(
width
),
0
,
Color
);
GRMapY
(
y2
),
ZoomValue
(
width
),
0
,
Color
);
}
}
void
GRCSegm
(
EDA_Rect
*
aClipBox
,
wxDC
*
aDC
,
wxPoint
aStart
,
wxPoint
aEnd
,
void
GRCSegm
(
EDA_Rect
*
aClipBox
,
wxDC
*
aDC
,
wxPoint
aStart
,
wxPoint
aEnd
,
int
aWidth
,
int
aColor
)
int
aWidth
,
int
aColor
)
{
{
...
@@ -998,6 +986,7 @@ void GRCSegm( EDA_Rect* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
...
@@ -998,6 +986,7 @@ void GRCSegm( EDA_Rect* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
ZoomValue
(
aWidth
),
0
,
aColor
);
ZoomValue
(
aWidth
),
0
,
aColor
);
}
}
/*
/*
* Draw segment (full) with rounded ends in object space (real coords.).
* Draw segment (full) with rounded ends in object space (real coords.).
*/
*/
...
@@ -1060,6 +1049,7 @@ void GRSCSegm( EDA_Rect* ClipBox,
...
@@ -1060,6 +1049,7 @@ void GRSCSegm( EDA_Rect* ClipBox,
#else
#else
if
(
clip_line
(
x1
,
y1
,
x2
,
y2
)
)
if
(
clip_line
(
x1
,
y1
,
x2
,
y2
)
)
#endif
#endif
return
;
return
;
}
}
...
@@ -1187,7 +1177,7 @@ void GRSCSegm( EDA_Rect* ClipBox,
...
@@ -1187,7 +1177,7 @@ void GRSCSegm( EDA_Rect* ClipBox,
static
bool
IsGRSPolyDrawable
(
EDA_Rect
*
ClipBox
,
int
n
,
wxPoint
Points
[]
)
static
bool
IsGRSPolyDrawable
(
EDA_Rect
*
ClipBox
,
int
n
,
wxPoint
Points
[]
)
{
{
if
(
!
ClipBox
)
if
(
!
ClipBox
)
return
true
;
return
true
;
if
(
n
<=
0
)
if
(
n
<=
0
)
...
@@ -1367,6 +1357,7 @@ void GRCircle( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int r, int Color )
...
@@ -1367,6 +1357,7 @@ void GRCircle( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int r, int Color )
GRSCircle
(
ClipBox
,
DC
,
cx
,
cy
,
radius
,
0
,
Color
);
GRSCircle
(
ClipBox
,
DC
,
cx
,
cy
,
radius
,
0
,
Color
);
}
}
/*
/*
* Draw a circle in object space.
* Draw a circle in object space.
*/
*/
...
@@ -1377,6 +1368,7 @@ void GRCircle( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int r, int width, int
...
@@ -1377,6 +1368,7 @@ void GRCircle( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int r, int width, int
GRSCircle
(
ClipBox
,
DC
,
GRMapX
(
x
),
GRMapY
(
y
),
r
,
width
,
Color
);
GRSCircle
(
ClipBox
,
DC
,
GRMapX
(
x
),
GRMapY
(
y
),
r
,
width
,
Color
);
}
}
/*
/*
* Draw a circle in object space.
* Draw a circle in object space.
*/
*/
...
@@ -1400,6 +1392,7 @@ void GRFilledCircle( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int r,
...
@@ -1400,6 +1392,7 @@ void GRFilledCircle( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int r,
Color
,
BgColor
);
Color
,
BgColor
);
}
}
/*
/*
* Draw a filled circle, in object space.
* Draw a filled circle, in object space.
*/
*/
...
@@ -1410,6 +1403,7 @@ void GRFilledCircle( EDA_Rect* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, i
...
@@ -1410,6 +1403,7 @@ void GRFilledCircle( EDA_Rect* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, i
aColor
,
aColor
);
aColor
,
aColor
);
}
}
/*
/*
* Draw a filled circle, in drawing space.
* Draw a filled circle, in drawing space.
*/
*/
...
@@ -1440,7 +1434,6 @@ void GRSFilledCircle( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int r,
...
@@ -1440,7 +1434,6 @@ void GRSFilledCircle( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int r,
}
}
/*
/*
* Draw a circle in drawing space.
* Draw a circle in drawing space.
*/
*/
...
@@ -1498,6 +1491,7 @@ void GRArc1( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
...
@@ -1498,6 +1491,7 @@ void GRArc1( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
Color
);
Color
);
}
}
void
GRArc1
(
EDA_Rect
*
aClipBox
,
wxDC
*
aDC
,
wxPoint
aStart
,
wxPoint
aEnd
,
void
GRArc1
(
EDA_Rect
*
aClipBox
,
wxDC
*
aDC
,
wxPoint
aStart
,
wxPoint
aEnd
,
wxPoint
aCenter
,
int
aWidth
,
int
aColor
)
wxPoint
aCenter
,
int
aWidth
,
int
aColor
)
{
{
...
@@ -1736,6 +1730,7 @@ void GRRect( EDA_Rect* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, int
...
@@ -1736,6 +1730,7 @@ void GRRect( EDA_Rect* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, int
GRSRect
(
aClipBox
,
aDC
,
x1
,
y1
,
x2
,
y2
,
0
,
aColor
);
GRSRect
(
aClipBox
,
aDC
,
x1
,
y1
,
x2
,
y2
,
0
,
aColor
);
}
}
void
GRRectPs
(
EDA_Rect
*
aClipBox
,
wxDC
*
aDC
,
const
EDA_Rect
&
aRect
,
int
aColor
,
wxPenStyle
aStyle
)
void
GRRectPs
(
EDA_Rect
*
aClipBox
,
wxDC
*
aDC
,
const
EDA_Rect
&
aRect
,
int
aColor
,
wxPenStyle
aStyle
)
{
{
int
x1
=
GRMapX
(
aRect
.
GetX
()
);
int
x1
=
GRMapX
(
aRect
.
GetX
()
);
...
@@ -1761,6 +1756,7 @@ void GRRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int wi
...
@@ -1761,6 +1756,7 @@ void GRRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int wi
GRSRect
(
ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
width
,
Color
);
GRSRect
(
ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
width
,
Color
);
}
}
void
GRRect
(
EDA_Rect
*
aClipBox
,
wxDC
*
aDC
,
const
EDA_Rect
&
aRect
,
int
aWidth
,
int
aColor
)
void
GRRect
(
EDA_Rect
*
aClipBox
,
wxDC
*
aDC
,
const
EDA_Rect
&
aRect
,
int
aWidth
,
int
aColor
)
{
{
int
x1
=
GRMapX
(
aRect
.
GetX
()
);
int
x1
=
GRMapX
(
aRect
.
GetX
()
);
...
@@ -1845,7 +1841,6 @@ void GRSRect( EDA_Rect* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2,
...
@@ -1845,7 +1841,6 @@ void GRSRect( EDA_Rect* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2,
}
}
void
GRSFilledRect
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
void
GRSFilledRect
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x1
,
int
y1
,
int
x2
,
int
y2
,
int
x1
,
int
y1
,
int
x2
,
int
y2
,
int
width
,
int
Color
,
int
BgColor
)
int
width
,
int
Color
,
int
BgColor
)
...
...
gerbview/edit.cpp
View file @
6b05cf31
...
@@ -116,26 +116,10 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -116,26 +116,10 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
Close
(
TRUE
);
Close
(
TRUE
);
break
;
break
;
case
ID_NEW_PROJECT
:
case
ID_LOAD_PROJECT
:
Files_io
(
event
);
break
;
case
ID_GERBVIEW_GLOBAL_DELETE
:
case
ID_GERBVIEW_GLOBAL_DELETE
:
Erase_Current_Layer
(
TRUE
);
Erase_Current_Layer
(
TRUE
);
break
;
break
;
case
ID_GET_TOOLS
:
// InstallToolsFrame(this, wxPoint(-1,-1) );
break
;
case
ID_FIND_ITEMS
:
// InstallFindFrame(this, pos);
break
;
case
ID_NO_SELECT_BUTT
:
case
ID_NO_SELECT_BUTT
:
SetToolID
(
0
,
0
,
wxEmptyString
);
SetToolID
(
0
,
0
,
wxEmptyString
);
break
;
break
;
...
@@ -223,19 +207,5 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -223,19 +207,5 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
*/
*/
void
WinEDA_GerberFrame
::
OnLeftDClick
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
)
void
WinEDA_GerberFrame
::
OnLeftDClick
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
)
{
{
EDA_BaseStruct
*
DrawStruct
=
GetScreen
()
->
GetCurItem
();
// Currently: no nothing
switch
(
m_ID_current_state
)
{
case
0
:
if
(
(
DrawStruct
==
NULL
)
||
((
DrawStruct
->
m_Flags
&
~
DRAW_ERASED
)
==
0
)
)
{
DrawStruct
=
GerberGeneralLocateAndDisplay
();
}
break
;
default
:
break
;
}
}
}
gerbview/gerberframe.cpp
View file @
6b05cf31
...
@@ -169,7 +169,7 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
...
@@ -169,7 +169,7 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
ReCreateMenuBar
();
ReCreateMenuBar
();
ReCreateHToolbar
();
ReCreateHToolbar
();
ReCreateVToolbar
();
// ReCreateVToolbar(); // Currently: no right vertical toolbar
ReCreateOptToolbar
();
ReCreateOptToolbar
();
m_auimgr
.
SetManagedWindow
(
this
);
m_auimgr
.
SetManagedWindow
(
this
);
...
...
gerbview/toolbars_gerber.cpp
View file @
6b05cf31
...
@@ -47,13 +47,6 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
...
@@ -47,13 +47,6 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
wxBitmap
(
open_xpm
),
wxBitmap
(
open_xpm
),
_
(
"Load a new Gerber file on the current layer. Previous data will be deleted"
)
);
_
(
"Load a new Gerber file on the current layer. Previous data will be deleted"
)
);
m_HToolBar
->
AddSeparator
();
m_HToolBar
->
AddTool
(
wxID_UNDO
,
wxEmptyString
,
wxBitmap
(
undelete_xpm
),
_
(
"Undelete"
)
);
m_HToolBar
->
AddSeparator
();
m_HToolBar
->
AddSeparator
();
m_HToolBar
->
AddTool
(
wxID_PRINT
,
wxEmptyString
,
m_HToolBar
->
AddTool
(
wxID_PRINT
,
wxEmptyString
,
wxBitmap
(
print_button
),
wxBitmap
(
print_button
),
...
...
include/gr_basic.h
View file @
6b05cf31
...
@@ -77,8 +77,6 @@ void GRDashedLine( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
...
@@ -77,8 +77,6 @@ void GRDashedLine( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
void
GRDashedLineTo
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x2
,
int
y2
,
int
width
,
int
Color
);
void
GRDashedLineTo
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x2
,
int
y2
,
int
width
,
int
Color
);
void
GRMoveTo
(
int
x
,
int
y
);
void
GRMoveTo
(
int
x
,
int
y
);
void
GRLineTo
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x
,
int
y
,
int
width
,
int
Color
);
void
GRLineTo
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x
,
int
y
,
int
width
,
int
Color
);
void
GRMoveRel
(
int
x
,
int
y
);
void
GRLineRel
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x
,
int
y
,
int
width
,
int
Color
);
void
GRPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
wxPoint
Points
[],
bool
Fill
,
void
GRPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
wxPoint
Points
[],
bool
Fill
,
int
width
,
int
Color
,
int
BgColor
);
int
width
,
int
Color
,
int
BgColor
);
...
@@ -204,7 +202,16 @@ void GRRectPs( EDA_Rect* aClipBox, wxDC* aDC,const EDA_Rect& aRect,
...
@@ -204,7 +202,16 @@ void GRRectPs( EDA_Rect* aClipBox, wxDC* aDC,const EDA_Rect& aRect,
void
GRSFilledRect
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x1
,
int
y1
,
void
GRSFilledRect
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x1
,
int
y1
,
int
x2
,
int
y2
,
int
width
,
int
Color
,
int
BgColor
);
int
x2
,
int
y2
,
int
width
,
int
Color
,
int
BgColor
);
void
GRLineArray
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
wxPoint
points
[],
/** Function GRLineArray
int
lines
,
int
width
,
int
Color
);
* draws an array of lines (not a polygon).
* @param aClipBox = the clip box
* @param aDC = the device context into which drawing should occur.
* @param aLines = a list of pair of coordinate in user space: a pair for each line.
* @param aWidth = the width of each line.
* @param aColor = an index into our color table of RGB colors.
* @see EDA_Colors and colors.h
*/
void
GRLineArray
(
EDA_Rect
*
aClipBox
,
wxDC
*
aDC
,
std
::
vector
<
wxPoint
>&
aLines
,
int
aWidth
,
int
aColor
);
#endif
/* define GR_BASIC */
#endif
/* define GR_BASIC */
pcbnew/class_zone.cpp
View file @
6b05cf31
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
#include "protos.h"
#include "protos.h"
/************************/
/************************/
/* class ZONE_CONTAINER */
/* class ZONE_CONTAINER */
/************************/
/************************/
...
@@ -477,7 +476,8 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con
...
@@ -477,7 +476,8 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con
// draw the lines
// draw the lines
int
i_start_contour
=
0
;
int
i_start_contour
=
0
;
wxPoint
lines
[(
GetNumCorners
()
*
2
)
+
2
];
std
::
vector
<
wxPoint
>
lines
;
lines
.
reserve
(
(
GetNumCorners
()
*
2
)
+
2
);
for
(
int
ic
=
0
;
ic
<
GetNumCorners
();
ic
++
)
for
(
int
ic
=
0
;
ic
<
GetNumCorners
();
ic
++
)
{
{
seg_start
=
GetCornerPosition
(
ic
)
+
offset
;
seg_start
=
GetCornerPosition
(
ic
)
+
offset
;
...
@@ -490,23 +490,24 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con
...
@@ -490,23 +490,24 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con
seg_end
=
GetCornerPosition
(
i_start_contour
)
+
offset
;
seg_end
=
GetCornerPosition
(
i_start_contour
)
+
offset
;
i_start_contour
=
ic
+
1
;
i_start_contour
=
ic
+
1
;
}
}
lines
[
ic
*
2
].
x
=
seg_start
.
x
;
lines
.
push_back
(
seg_start
);
lines
[
ic
*
2
].
y
=
seg_start
.
y
;
lines
.
push_back
(
seg_end
);
lines
[
ic
*
2
+
1
].
x
=
seg_start
.
x
;
lines
[
ic
*
2
+
1
].
y
=
seg_start
.
y
;
}
}
GRLineArray
(
&
panel
->
m_ClipBox
,
DC
,
lines
,
GetNumCorners
(),
0
,
color
);
GRLineArray
(
&
panel
->
m_ClipBox
,
DC
,
lines
,
0
,
color
);
// draw hatches
// draw hatches
wxPoint
hatches
[(
m_Poly
->
m_HatchLines
.
size
()
*
2
)
+
2
];
lines
.
clear
();
lines
.
reserve
(
(
m_Poly
->
m_HatchLines
.
size
()
*
2
)
+
2
);
for
(
unsigned
ic
=
0
;
ic
<
m_Poly
->
m_HatchLines
.
size
();
ic
++
)
for
(
unsigned
ic
=
0
;
ic
<
m_Poly
->
m_HatchLines
.
size
();
ic
++
)
{
{
hatches
[
ic
*
2
].
x
=
m_Poly
->
m_HatchLines
[
ic
].
xi
+
offset
.
x
;
seg_start
.
x
=
m_Poly
->
m_HatchLines
[
ic
].
xi
+
offset
.
x
;
hatches
[
ic
*
2
].
y
=
m_Poly
->
m_HatchLines
[
ic
].
yi
+
offset
.
y
;
seg_start
.
y
=
m_Poly
->
m_HatchLines
[
ic
].
yi
+
offset
.
y
;
hatches
[
ic
*
2
+
1
].
x
=
m_Poly
->
m_HatchLines
[
ic
].
xf
+
offset
.
x
;
seg_end
.
x
=
m_Poly
->
m_HatchLines
[
ic
].
xf
+
offset
.
x
;
hatches
[
ic
*
2
+
1
].
y
=
m_Poly
->
m_HatchLines
[
ic
].
yf
+
offset
.
y
;
seg_end
.
y
=
m_Poly
->
m_HatchLines
[
ic
].
yf
+
offset
.
y
;
lines
.
push_back
(
seg_start
);
lines
.
push_back
(
seg_end
);
}
}
GRLineArray
(
&
panel
->
m_ClipBox
,
DC
,
hatches
,
m_Poly
->
m_HatchLines
.
size
()
,
0
,
color
);
GRLineArray
(
&
panel
->
m_ClipBox
,
DC
,
lines
,
0
,
color
);
}
}
...
...
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