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
Hide 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
;
...
@@ -91,18 +92,18 @@ extern BASE_SCREEN* ActiveScreen;
...
@@ -91,18 +92,18 @@ extern BASE_SCREEN* ActiveScreen;
static
int
GRLastMoveToX
,
GRLastMoveToY
;
static
int
GRLastMoveToX
,
GRLastMoveToY
;
static
bool
s_ForceBlackPen
;
/* if true: draws in black instead of
static
bool
s_ForceBlackPen
;
/* if true: draws in black instead of
* color for printing. */
* color for printing. */
static
int
xcliplo
=
0
,
static
int
xcliplo
=
0
,
ycliplo
=
0
,
ycliplo
=
0
,
xcliphi
=
2000
,
xcliphi
=
2000
,
ycliphi
=
2000
;
ycliphi
=
2000
;
static
int
s_DC_lastcolor
=
-
1
;
static
int
s_DC_lastcolor
=
-
1
;
static
int
s_DC_lastwidth
=
-
1
;
static
int
s_DC_lastwidth
=
-
1
;
static
int
s_DC_lastpenstyle
=
-
1
;
static
int
s_DC_lastpenstyle
=
-
1
;
static
int
s_DC_lastbrushcolor
=
-
1
;
static
int
s_DC_lastbrushcolor
=
-
1
;
static
int
s_DC_lastbrushfill
=
-
1
;
static
int
s_DC_lastbrushfill
=
-
1
;
static
wxDC
*
s_DC_lastDC
=
NULL
;
static
wxDC
*
s_DC_lastDC
=
NULL
;
/* Local functions: */
/* Local functions: */
...
@@ -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.
*
*
...
@@ -189,14 +192,14 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
...
@@ -189,14 +192,14 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
return
false
;
return
false
;
wxRect
rect
=
*
aClipBox
;
wxRect
rect
=
*
aClipBox
;
int
minX
=
rect
.
GetLeft
();
int
minX
=
rect
.
GetLeft
();
int
maxX
=
rect
.
GetRight
();
int
maxX
=
rect
.
GetRight
();
int
minY
=
rect
.
GetTop
();
int
minY
=
rect
.
GetTop
();
int
maxY
=
rect
.
GetBottom
();
int
maxY
=
rect
.
GetBottom
();
int
clippedX
,
clippedY
;
int
clippedX
,
clippedY
;
#if DEBUG_DUMP_CLIP_COORDS
#if DEBUG_DUMP_CLIP_COORDS
int
tmpX1
,
tmpY1
,
tmpX2
,
tmpY2
;
int
tmpX1
,
tmpY1
,
tmpX2
,
tmpY2
;
tmpX1
=
x1
;
tmpX1
=
x1
;
tmpY1
=
y1
;
tmpY1
=
y1
;
tmpX2
=
x2
;
tmpX2
=
x2
;
...
@@ -236,14 +239,14 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
...
@@ -236,14 +239,14 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
/* If we're here, it's a diagonal line. */
/* If we're here, it's a diagonal line. */
if
(
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
minX
,
minY
,
minX
,
maxY
,
if
(
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
minX
,
minY
,
minX
,
maxY
,
&
clippedX
,
&
clippedY
)
/* Left */
&
clippedX
,
&
clippedY
)
/* Left */
||
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
minX
,
minY
,
maxX
,
minY
,
||
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
minX
,
minY
,
maxX
,
minY
,
&
clippedX
,
&
clippedY
)
/* Top */
&
clippedX
,
&
clippedY
)
/* Top */
||
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
maxX
,
minY
,
maxX
,
maxY
,
||
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
maxX
,
minY
,
maxX
,
maxY
,
&
clippedX
,
&
clippedY
)
/* Right */
&
clippedX
,
&
clippedY
)
/* Right */
||
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
minX
,
maxY
,
maxX
,
maxY
,
||
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
minX
,
maxY
,
maxX
,
maxY
,
&
clippedX
,
&
clippedY
)
)
/* Bottom */
&
clippedX
,
&
clippedY
)
)
/* Bottom */
{
{
if
(
x2
!=
clippedX
)
if
(
x2
!=
clippedX
)
x2
=
clippedX
;
x2
=
clippedX
;
...
@@ -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
;
...
@@ -290,14 +294,14 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
...
@@ -290,14 +294,14 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
}
}
}
}
if
(
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
minX
,
minY
,
minX
,
maxY
,
if
(
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
minX
,
minY
,
minX
,
maxY
,
&
clippedX
,
&
clippedY
)
/* Left */
&
clippedX
,
&
clippedY
)
/* Left */
||
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
minX
,
minY
,
maxX
,
minY
,
||
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
minX
,
minY
,
maxX
,
minY
,
&
clippedX
,
&
clippedY
)
/* Top */
&
clippedX
,
&
clippedY
)
/* Top */
||
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
maxX
,
minY
,
maxX
,
maxY
,
||
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
maxX
,
minY
,
maxX
,
maxY
,
&
clippedX
,
&
clippedY
)
/* Right */
&
clippedX
,
&
clippedY
)
/* Right */
||
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
minX
,
maxY
,
maxX
,
maxY
,
||
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
minX
,
maxY
,
maxX
,
maxY
,
&
clippedX
,
&
clippedY
)
)
/* Bottom */
&
clippedX
,
&
clippedY
)
)
/* Bottom */
{
{
if
(
x1
!=
clippedX
)
if
(
x1
!=
clippedX
)
x1
=
clippedX
;
x1
=
clippedX
;
...
@@ -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
;
...
@@ -317,7 +322,7 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
...
@@ -317,7 +322,7 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
{
{
int
*
intersectX
;
int
*
intersectX
;
int
*
intersectY
;
int
*
intersectY
;
int
intersectX1
,
intersectY1
,
intersectX2
,
intersectY2
;
int
intersectX1
,
intersectY1
,
intersectX2
,
intersectY2
;
bool
haveFirstPoint
=
false
;
bool
haveFirstPoint
=
false
;
intersectX
=
&
intersectX1
;
intersectX
=
&
intersectX1
;
...
@@ -327,8 +332,8 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
...
@@ -327,8 +332,8 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
if
(
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
minX
,
minY
,
minX
,
maxY
,
if
(
TestForIntersectionOfStraightLineSegments
(
x1
,
y1
,
x2
,
y2
,
minX
,
minY
,
minX
,
maxY
,
intersectX
,
intersectY
)
)
intersectX
,
intersectY
)
)
{
{
intersectX
=
&
intersectX2
;
intersectX
=
&
intersectX2
;
intersectY
=
&
intersectY2
;
intersectY
=
&
intersectY2
;
haveFirstPoint
=
true
;
haveFirstPoint
=
true
;
}
}
...
@@ -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
;
}
}
...
@@ -548,7 +557,7 @@ void GRResetPenAndBrush( wxDC* DC )
...
@@ -548,7 +557,7 @@ void GRResetPenAndBrush( wxDC* DC )
GRSetBrush
(
DC
,
BLACK
);
// Force no fill
GRSetBrush
(
DC
,
BLACK
);
// Force no fill
s_DC_lastbrushcolor
=
-
1
;
s_DC_lastbrushcolor
=
-
1
;
s_DC_lastcolor
=
-
1
;
s_DC_lastcolor
=
-
1
;
s_DC_lastDC
=
NULL
;
s_DC_lastDC
=
NULL
;
}
}
...
@@ -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
;
...
@@ -584,8 +593,7 @@ void GRSetColorPen( wxDC* DC, int Color, int width, wxPenStyle style )
...
@@ -584,8 +593,7 @@ void GRSetColorPen( wxDC* DC, int Color, int width, wxPenStyle style )
s_DC_lastcolor
=
Color
;
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
;
}
}
}
}
...
@@ -595,28 +603,27 @@ void GRSetBrush( wxDC* DC, int Color, int fill )
...
@@ -595,28 +603,27 @@ 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
)
);
if
(
fill
)
if
(
fill
)
DrawBrush
.
SetStyle
(
wxSOLID
);
DrawBrush
.
SetStyle
(
wxSOLID
);
else
else
DrawBrush
.
SetStyle
(
wxTRANSPARENT
);
DrawBrush
.
SetStyle
(
wxTRANSPARENT
);
DC
->
SetBrush
(
DrawBrush
);
DC
->
SetBrush
(
DrawBrush
);
s_DC_lastbrushcolor
=
Color
;
s_DC_lastbrushcolor
=
Color
;
s_DC_lastbrushfill
=
fill
;
s_DC_lastbrushfill
=
fill
;
s_DC_lastDC
=
DC
;
s_DC_lastDC
=
DC
;
}
}
}
}
/** 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
...
@@ -731,9 +748,9 @@ void GRSDashedLine( EDA_Rect* ClipBox,
...
@@ -731,9 +748,9 @@ void GRSDashedLine( EDA_Rect* ClipBox,
int
width
,
int
width
,
int
Color
)
int
Color
)
{
{
GRLastMoveToX
=
x2
;
GRLastMoveToX
=
x2
;
GRLastMoveToY
=
y2
;
GRLastMoveToY
=
y2
;
s_DC_lastcolor
=
-
1
;
s_DC_lastcolor
=
-
1
;
GRSetColorPen
(
DC
,
Color
,
width
,
wxPENSTYLE_SHORT_DASH
);
GRSetColorPen
(
DC
,
Color
,
width
,
wxPENSTYLE_SHORT_DASH
);
GRSLine
(
ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
width
,
Color
);
GRSLine
(
ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
width
,
Color
);
s_DC_lastcolor
=
-
1
;
s_DC_lastcolor
=
-
1
;
...
@@ -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
}
/*
#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
);
}
/*
* 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.).
*/
*/
...
@@ -1005,7 +994,7 @@ void GRFillCSegm( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
...
@@ -1005,7 +994,7 @@ void GRFillCSegm( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int
width
,
int
Color
)
int
width
,
int
Color
)
{
{
WinClipAndDrawLine
(
ClipBox
,
DC
,
GRMapX
(
x1
),
GRMapY
(
y1
),
GRMapX
(
x2
),
WinClipAndDrawLine
(
ClipBox
,
DC
,
GRMapX
(
x1
),
GRMapY
(
y1
),
GRMapX
(
x2
),
GRMapY
(
y2
),
Color
,
ZoomValue
(
width
)
);
GRMapY
(
y2
),
Color
,
ZoomValue
(
width
)
);
}
}
...
@@ -1013,8 +1002,8 @@ void GRFilledSegment( EDA_Rect* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEn
...
@@ -1013,8 +1002,8 @@ void GRFilledSegment( EDA_Rect* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEn
int
aWidth
,
int
aColor
)
int
aWidth
,
int
aColor
)
{
{
WinClipAndDrawLine
(
aClipBox
,
aDC
,
GRMapX
(
aStart
.
x
),
GRMapY
(
aStart
.
y
),
WinClipAndDrawLine
(
aClipBox
,
aDC
,
GRMapX
(
aStart
.
x
),
GRMapY
(
aStart
.
y
),
GRMapX
(
aEnd
.
x
),
GRMapY
(
aEnd
.
y
),
GRMapX
(
aEnd
.
x
),
GRMapY
(
aEnd
.
y
),
aColor
,
ZoomValue
(
aWidth
)
);
aColor
,
ZoomValue
(
aWidth
)
);
}
}
...
@@ -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,13 +1368,14 @@ void GRCircle( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int r, int width, int
...
@@ -1377,13 +1368,14 @@ 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.
*/
*/
void
GRCircle
(
EDA_Rect
*
aClipBox
,
wxDC
*
aDC
,
wxPoint
aPos
,
int
aRadius
,
int
aWidth
,
int
aColor
)
void
GRCircle
(
EDA_Rect
*
aClipBox
,
wxDC
*
aDC
,
wxPoint
aPos
,
int
aRadius
,
int
aWidth
,
int
aColor
)
{
{
aRadius
=
ZoomValue
(
aRadius
);
aRadius
=
ZoomValue
(
aRadius
);
aWidth
=
ZoomValue
(
aWidth
);
aWidth
=
ZoomValue
(
aWidth
);
GRSCircle
(
aClipBox
,
aDC
,
GRMapX
(
aPos
.
x
),
GRMapY
(
aPos
.
y
),
aRadius
,
aWidth
,
aColor
);
GRSCircle
(
aClipBox
,
aDC
,
GRMapX
(
aPos
.
x
),
GRMapY
(
aPos
.
y
),
aRadius
,
aWidth
,
aColor
);
}
}
...
@@ -1400,16 +1392,18 @@ void GRFilledCircle( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int r,
...
@@ -1400,16 +1392,18 @@ 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.
*/
*/
void
GRFilledCircle
(
EDA_Rect
*
aClipBox
,
wxDC
*
aDC
,
wxPoint
aPos
,
int
aRadius
,
int
aColor
)
void
GRFilledCircle
(
EDA_Rect
*
aClipBox
,
wxDC
*
aDC
,
wxPoint
aPos
,
int
aRadius
,
int
aColor
)
{
{
aRadius
=
ZoomValue
(
aRadius
);
aRadius
=
ZoomValue
(
aRadius
);
GRSFilledCircle
(
aClipBox
,
aDC
,
GRMapX
(
aPos
.
x
),
GRMapY
(
aPos
.
y
),
aRadius
,
0
,
GRSFilledCircle
(
aClipBox
,
aDC
,
GRMapX
(
aPos
.
x
),
GRMapY
(
aPos
.
y
),
aRadius
,
0
,
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,10 +1841,9 @@ void GRSRect( EDA_Rect* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2,
...
@@ -1845,10 +1841,9 @@ 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
)
{
{
if
(
x1
>
x2
)
if
(
x1
>
x2
)
EXCHG
(
x1
,
x2
);
EXCHG
(
x1
,
x2
);
...
@@ -1916,11 +1911,11 @@ void ClipAndDrawFilledPoly( EDA_Rect* aClipBox,
...
@@ -1916,11 +1911,11 @@ void ClipAndDrawFilledPoly( EDA_Rect* aClipBox,
clippedPolygon
.
clear
();
clippedPolygon
.
clear
();
for
(
int
ii
=
0
;
ii
<
n
;
ii
++
)
for
(
int
ii
=
0
;
ii
<
n
;
ii
++
)
inputPolygon
.
push_back
(
PointF
(
(
REAL
)
aPoints
[
ii
].
x
,
inputPolygon
.
push_back
(
PointF
(
(
REAL
)
aPoints
[
ii
].
x
,
(
REAL
)
aPoints
[
ii
].
y
)
);
(
REAL
)
aPoints
[
ii
].
y
)
);
RectF
window
(
(
REAL
)
aClipBox
->
GetX
(),
(
REAL
)
aClipBox
->
GetY
(),
RectF
window
(
(
REAL
)
aClipBox
->
GetX
(),
(
REAL
)
aClipBox
->
GetY
(),
(
REAL
)
aClipBox
->
GetWidth
(),
(
REAL
)
aClipBox
->
GetWidth
(),
(
REAL
)
aClipBox
->
GetHeight
()
);
(
REAL
)
aClipBox
->
GetHeight
()
);
SutherlandHodgman
sh
(
window
);
SutherlandHodgman
sh
(
window
);
sh
.
Clip
(
inputPolygon
,
outputPolygon
);
sh
.
Clip
(
inputPolygon
,
outputPolygon
);
...
@@ -1930,7 +1925,7 @@ void ClipAndDrawFilledPoly( EDA_Rect* aClipBox,
...
@@ -1930,7 +1925,7 @@ void ClipAndDrawFilledPoly( EDA_Rect* aClipBox,
++
cit
)
++
cit
)
{
{
clippedPolygon
.
push_back
(
wxPoint
(
wxRound
(
cit
->
X
),
clippedPolygon
.
push_back
(
wxPoint
(
wxRound
(
cit
->
X
),
wxRound
(
cit
->
Y
)
)
);
wxRound
(
cit
->
Y
)
)
);
}
}
if
(
clippedPolygon
.
size
()
)
if
(
clippedPolygon
.
size
()
)
...
...
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