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
bfeaeafe
Commit
bfeaeafe
authored
Oct 17, 2010
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gerbview: enhancements.
parent
de37bbad
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
62 additions
and
43 deletions
+62
-43
class_GERBER.cpp
gerbview/class_GERBER.cpp
+17
-12
class_GERBER.h
gerbview/class_GERBER.h
+2
-4
class_gerber_draw_item.cpp
gerbview/class_gerber_draw_item.cpp
+19
-14
class_gerber_draw_item.h
gerbview/class_gerber_draw_item.h
+1
-1
edit.cpp
gerbview/edit.cpp
+1
-0
files.cpp
gerbview/files.cpp
+8
-5
test-layer-rotation.gbr
gerbview/gerber_test_files/test-layer-rotation.gbr
+1
-1
gerberframe.cpp
gerbview/gerberframe.cpp
+2
-0
initpcb.cpp
gerbview/initpcb.cpp
+2
-2
rs274x.cpp
gerbview/rs274x.cpp
+9
-4
No files found.
gerbview/class_GERBER.cpp
View file @
bfeaeafe
...
...
@@ -159,8 +159,8 @@ void GERBER_IMAGE::ResetDefaultValues()
// true = relative Coord
m_NoTrailingZeros
=
false
;
// true: trailing zeros deleted
m_ImageOffset
.
x
=
m_ImageOffset
.
y
=
0
;
// Coord Offset, from IO command
m_ImageRotation
=
0
;
// Allowed 0, 90
0, 1800, 2700 (in 0.1 degree
m_LocalRotation
=
0
;
// Layer totation from RO command (in 0.1 degree)
m_ImageRotation
=
0
;
// Allowed 0, 90
, 180, 270 (in degree)
m_LocalRotation
=
0
.0
;
// Layer totation from RO command (in 0.1 degree)
m_Offset
.
x
=
0
;
m_Offset
.
y
=
0
;
// Coord Offset, from OF command
m_Scale
.
x
=
m_Scale
.
y
=
1.0
;
// scale (A and B) this layer
...
...
@@ -276,10 +276,12 @@ void GERBER_IMAGE::StepAndRepeatItem( const GERBER_DRAW_ITEM& aItem )
}
/** Function DisplayInfo
/** Function DisplayI
mageI
nfo
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Display info about Image Parameters.
* These parameters are valid for the entire file, and must set only once
* (If more than once, only the last value is used)
*/
void
GERBER_IMAGE
::
DisplayImageInfo
(
void
)
{
...
...
@@ -287,20 +289,23 @@ void GERBER_IMAGE::DisplayImageInfo( void )
m_Parent
->
ClearMsgPanel
();
// Display Image name
m_Parent
->
AppendMsgPanel
(
_
(
"Image name"
),
m_ImageName
,
BROW
N
);
// Display Image name
(Image specific)
m_Parent
->
AppendMsgPanel
(
_
(
"Image name"
),
m_ImageName
,
CYA
N
);
// Display graphic layer number
// Display graphic layer number used to draw this Image
// (not a Gerber parameter but is also image specific)
msg
.
Printf
(
wxT
(
"%d"
),
m_GraphicLayer
+
1
);
m_Parent
->
AppendMsgPanel
(
_
(
"Graphic layer"
),
msg
,
BROWN
);
// This next info can be see as debug info, so it can be disabled
// Display Image rotation (Image specific)
msg
.
Printf
(
wxT
(
"%d"
),
m_ImageRotation
);
m_Parent
->
AppendMsgPanel
(
_
(
"Img Rot."
),
msg
,
CYAN
);
// Display
rotation
msg
.
Printf
(
wxT
(
"%d"
),
m_ImageRotation
/
10
);
m_Parent
->
AppendMsgPanel
(
_
(
"
Rotation"
),
msg
,
CYA
N
);
// Display
Image polarity (Image specific)
msg
=
m_ImageNegative
?
_
(
"Negative"
)
:
_
(
"Normal"
);
m_Parent
->
AppendMsgPanel
(
_
(
"
Polarity"
),
msg
,
BROW
N
);
// Display Image justification
;
// Display Image justification
and offset for justification (Image specific)
msg
=
m_ImageJustifyXCenter
?
_
(
"Center"
)
:
_
(
"Normal"
);
m_Parent
->
AppendMsgPanel
(
_
(
"X Justify"
),
msg
,
DARKRED
);
...
...
@@ -313,6 +318,6 @@ void GERBER_IMAGE::DisplayImageInfo( void )
else
msg
.
Printf
(
wxT
(
"X=%f Y=%f"
),
(
double
)
m_ImageJustifyOffset
.
x
*
2.54
/
1000
,
(
double
)
m_ImageJustifyOffset
.
y
*
2.54
/
1000
);
m_Parent
->
AppendMsgPanel
(
_
(
"Image Justify Offset"
),
msg
,
CYAN
);
m_Parent
->
AppendMsgPanel
(
_
(
"Image Justify Offset"
),
msg
,
DARKRED
);
}
gerbview/class_GERBER.h
View file @
bfeaeafe
...
...
@@ -95,10 +95,8 @@ public:
wxPoint
m_ImageOffset
;
// Coord Offset, from IO command
wxSize
m_FmtScale
;
// Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4
wxSize
m_FmtLen
;
// Nb chars per coord. ex fmt 2.3, m_FmtLen = 5
int
m_ImageRotation
;
// Image rotation (0, 90, 180, 270
// Note these values are stored in 0.1 degrees
int
m_LocalRotation
;
// Local rotation, added to m_ImageRotation
int
m_ImageRotation
;
// Image rotation (0, 90, 180, 270 only) in degrees
double
m_LocalRotation
;
// Local rotation, in degrees, added to m_ImageRotation
// Note this value is stored in 0.1 degrees
wxPoint
m_Offset
;
// Coord Offset, from OF command
wxRealPoint
m_Scale
;
// scale (X and Y) of layer.
...
...
gerbview/class_gerber_draw_item.cpp
View file @
bfeaeafe
...
...
@@ -57,7 +57,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( BOARD_ITEM* aParent, GERBER_IMAGE* aGerberpa
m_mirrorA
=
false
;
m_mirrorB
=
false
;
m_drawScale
.
x
=
m_drawScale
.
y
=
1.0
;
m_l
ayerRotation
=
0
;
m_l
yrRotation
=
0
;
if
(
m_imageParams
)
SetLayerParameters
();
}
...
...
@@ -90,7 +90,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource ) :
m_layerOffset
=
aSource
.
m_layerOffset
;
m_drawScale
.
x
=
aSource
.
m_drawScale
.
x
;
m_drawScale
.
y
=
aSource
.
m_drawScale
.
y
;
m_l
ayerRotation
=
aSource
.
m_laye
rRotation
;
m_l
yrRotation
=
aSource
.
m_ly
rRotation
;
}
...
...
@@ -127,13 +127,15 @@ wxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition )
abPos
+=
m_layerOffset
+
m_imageParams
->
m_ImageOffset
;
abPos
.
x
=
wxRound
(
abPos
.
x
*
m_drawScale
.
x
);
abPos
.
y
=
wxRound
(
abPos
.
y
*
m_drawScale
.
y
);
int
rotation
=
m_layerRotation
+
m_imageParams
->
m_ImageRotation
;
int
rotation
=
wxRound
(
m_lyrRotation
*
10
)
+
(
m_imageParams
->
m_ImageRotation
*
10
)
;
if
(
rotation
)
RotatePoint
(
&
abPos
,
-
rotation
);
// Negate A axis if mirrored
if
(
m_mirrorA
)
NEGATE
(
abPos
.
x
);
// abPos.y must be negated, because draw axis is top to bottom
// abPos.y must be negated
when no mirror
, because draw axis is top to bottom
if
(
!
m_mirrorB
)
NEGATE
(
abPos
.
y
);
return
abPos
;
...
...
@@ -157,7 +159,7 @@ wxPoint GERBER_DRAW_ITEM::GetXYPosition( const wxPoint& aABPosition )
NEGATE
(
xyPos
.
x
);
if
(
!
m_mirrorB
)
NEGATE
(
xyPos
.
y
);
int
rotation
=
m_layerRotation
+
m_imageParams
->
m_ImageRotation
;
int
rotation
=
wxRound
(
m_lyrRotation
*
10
)
+
(
m_imageParams
->
m_ImageRotation
*
10
)
;
if
(
rotation
)
RotatePoint
(
&
xyPos
,
rotation
);
xyPos
.
x
=
wxRound
(
xyPos
.
x
/
m_drawScale
.
x
);
...
...
@@ -186,7 +188,7 @@ void GERBER_DRAW_ITEM::SetLayerParameters()
m_drawScale
=
m_imageParams
->
m_Scale
;
// A and B scaling factor
m_layerOffset
=
m_imageParams
->
m_Offset
;
// Offset from OF command
// Rotation from RO command:
m_l
aye
rRotation
=
m_imageParams
->
m_LocalRotation
;
m_l
y
rRotation
=
m_imageParams
->
m_LocalRotation
;
m_LayerNegative
=
m_imageParams
->
GetLayerParams
().
m_LayerNegative
;
}
...
...
@@ -477,23 +479,26 @@ void GERBER_DRAW_ITEM::DisplayInfo( WinEDA_DrawFrame* frame )
msg
.
Printf
(
wxT
(
"%d"
),
GetLayer
()
+
1
);
frame
->
AppendMsgPanel
(
_
(
"Graphic layer"
),
msg
,
BROWN
);
// This next info can be see as debug info, so it can be disabled
#if 1
// Display item rotation
// The full rotation is Image rotation + m_lyrRotation
// but m_lyrRotation is specific to this object
// so we display only this parameter
msg
.
Printf
(
wxT
(
"%f"
),
m_lyrRotation
);
frame
->
AppendMsgPanel
(
_
(
"Rotation"
),
msg
,
BLUE
);
// Display
rotation
msg
.
Printf
(
wxT
(
"%.1f"
),
(
double
)(
m_imageParams
->
m_ImageRotation
+
m_layerRotation
)
/
10
);
frame
->
AppendMsgPanel
(
_
(
"
Rotation"
),
msg
,
DARKRED
);
// Display
item polarity (item specific)
msg
=
m_LayerNegative
?
_
(
"Clear"
)
:
_
(
"Dark"
);
frame
->
AppendMsgPanel
(
_
(
"
Polarity"
),
msg
,
BLUE
);
// Display mirroring
// Display mirroring
(item specific)
msg
.
Printf
(
wxT
(
"A:%s B:%s"
),
m_mirrorA
?
_
(
"Yes"
)
:
_
(
"No"
),
m_mirrorB
?
_
(
"Yes"
)
:
_
(
"No"
));
frame
->
AppendMsgPanel
(
_
(
"Mirror"
),
msg
,
DARKRED
);
// Display AB axis swap
// Display AB axis swap
(item specific)
msg
=
m_swapAxis
?
wxT
(
"A=Y B=X"
)
:
wxT
(
"A=X B=Y"
);
frame
->
AppendMsgPanel
(
_
(
"AB axis"
),
msg
,
DARKRED
);
#endif
}
...
...
gerbview/class_gerber_draw_item.h
View file @
bfeaeafe
...
...
@@ -92,7 +92,7 @@ private:
bool
m_mirrorB
;
// true: mirror / axe B
wxRealPoint
m_drawScale
;
// A and B scaling factor
wxPoint
m_layerOffset
;
// Offset for A and B axis, from OF parameter
int
m_layerRotation
;
// Fine rotation, from OR parameter
double
m_lyrRotation
;
// Fine rotation, from OR parameter, in degrees
public
:
GERBER_DRAW_ITEM
(
BOARD_ITEM
*
aParent
,
GERBER_IMAGE
*
aGerberparams
);
...
...
gerbview/edit.cpp
View file @
bfeaeafe
...
...
@@ -124,6 +124,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_GERBVIEW_GLOBAL_DELETE
:
Erase_Current_Layer
(
TRUE
);
ClearMsgPanel
();
break
;
case
ID_NO_SELECT_BUTT
:
...
...
gerbview/files.cpp
View file @
bfeaeafe
...
...
@@ -16,7 +16,7 @@ static void LoadDCodeFile( WinEDA_GerberFrame* frame,
const
wxString
&
FullFileName
);
/* Load a
g
erber file selected from history list on current layer
/* Load a
G
erber file selected from history list on current layer
* Previous data is deleted
*/
void
WinEDA_GerberFrame
::
OnFileHistory
(
wxCommandEvent
&
event
)
...
...
@@ -56,10 +56,8 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
{
setActiveLayer
(
origLayer
+
1
);
Erase_Current_Layer
(
false
);
if
(
!
LoadOneGerberFile
(
wxEmptyString
)
)
setActiveLayer
(
origLayer
);
SetToolbars
();
}
else
...
...
@@ -76,6 +74,7 @@ delete an existing layer to load any new layers." ), NB_LAYERS );
Clear_Pcb
(
true
);
Zoom_Automatique
(
false
);
DrawPanel
->
Refresh
();
ClearMsgPanel
();
break
;
case
ID_GERBVIEW_LOAD_DRILL_FILE
:
...
...
@@ -105,10 +104,14 @@ bool WinEDA_GerberFrame::LoadOneGerberFile( const wxString& aFullFileName, bool
/* Standard gerber filetypes
* (See http://en.wikipedia.org/wiki/Gerber_File)
* the .pho extension is the default used in Pcbnew
* However there are a lot of other extensions used for gerber files
* Because the first letter is usually g, we accept g* as extension
* (Mainly internal copper layers do not have specific extention,
* and filenames are like *.g1, *.g2 *.gb1 ...).
*/
filetypes
=
_
(
"Gerber files (.g
b* .gt* .lgr .ge
r .pho)"
);
filetypes
=
_
(
"Gerber files (.g
* .lg
r .pho)"
);
filetypes
<<
wxT
(
"|"
);
filetypes
+=
wxT
(
"*.g
b*;*.GB*;*.gt*;*.GT*;*.gko;*.GKO;*.GPB;*.gpb;*.lgr;*.LGR;*.ger;*.GE
R;*.pho;*.PHO"
);
filetypes
+=
wxT
(
"*.g
*;*.G*;*.lgr;*.LG
R;*.pho;*.PHO"
);
filetypes
<<
wxT
(
"|"
);
/* Special gerber filetypes */
...
...
gerbview/gerber_test_files/test-layer-rotation.gbr
View file @
bfeaeafe
...
...
@@ -4,7 +4,7 @@ G04 the center line straight up *
G04 Handcoded by Julian Lamb *
%MOIN*%
%FSLAX23Y23*%
%RO45*%
%RO45
.0
*%
%ADD10C,0.025*%
G04 Quarter star *
...
...
gerbview/gerberframe.cpp
View file @
bfeaeafe
...
...
@@ -497,6 +497,7 @@ void WinEDA_GerberFrame::UpdateTitleAndInfo()
SetTitle
(
text
);
SetStatusText
(
wxEmptyString
,
0
);
m_TextInfo
->
Clear
();
ClearMsgPanel
();
return
;
}
...
...
@@ -504,6 +505,7 @@ void WinEDA_GerberFrame::UpdateTitleAndInfo()
text
<<
wxT
(
" "
)
<<
gerber
->
m_FileName
;
SetTitle
(
text
);
gerber
->
DisplayImageInfo
(
);
// Display Image Name and Layer Name (from the current gerber data):
text
.
Printf
(
_
(
"Image name:
\"
%s
\"
Layer name
\"
%s
\"
"
),
...
...
gerbview/initpcb.cpp
View file @
bfeaeafe
...
...
@@ -25,6 +25,8 @@ bool WinEDA_GerberFrame::Clear_Pcb( bool query )
if
(
!
IsOK
(
this
,
_
(
"Current data will be lost?"
)
)
)
return
FALSE
;
}
SetCurItem
(
NULL
);
GetBoard
()
->
m_Drawings
.
DeleteAll
();
for
(
layer
=
0
;
layer
<
32
;
layer
++
)
...
...
@@ -45,8 +47,6 @@ bool WinEDA_GerberFrame::Clear_Pcb( bool query )
SetBaseScreen
(
ActiveScreen
=
ScreenPcb
);
GetScreen
()
->
Init
();
setActiveLayer
(
LAYER_N_BACK
);
SetCurItem
(
NULL
);
return
TRUE
;
}
...
...
gerbview/rs274x.cpp
View file @
bfeaeafe
...
...
@@ -53,6 +53,7 @@ enum RS274X_PARAMETERS {
// Layer specific parameters
// May be used singly or may be layer specfic
// theses parameters are at the beginning of the file or layer
// and reset some layer parameters (like interpolation)
LAYER_NAME
=
CODE
(
'L'
,
'N'
),
// Default: Positive
LAYER_POLARITY
=
CODE
(
'L'
,
'P'
),
KNOCKOUT
=
CODE
(
'K'
,
'O'
),
// Default: off
...
...
@@ -389,16 +390,17 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
if
(
strnicmp
(
text
,
"0*"
,
2
)
==
0
)
m_ImageRotation
=
0
;
if
(
strnicmp
(
text
,
"90*"
,
2
)
==
0
)
m_ImageRotation
=
90
0
;
m_ImageRotation
=
90
;
if
(
strnicmp
(
text
,
"180*"
,
2
)
==
0
)
m_ImageRotation
=
180
0
;
m_ImageRotation
=
180
;
if
(
strnicmp
(
text
,
"270*"
,
2
)
==
0
)
m_ImageRotation
=
270
0
;
m_ImageRotation
=
270
;
else
ReportMessage
(
_
(
"RS274X: Command
\"
IR
\"
rotation value not allowed"
)
);
break
;
case
STEP_AND_REPEAT
:
// command SR, like %SRX3Y2I5.0J2*%
m_Iterpolation
=
GERB_INTERPOL_LINEAR_1X
;
// Start a new Gerber layer
GetLayerParams
().
m_StepForRepeat
.
x
=
0.0
;
GetLayerParams
().
m_StepForRepeat
.
x
=
0.0
;
// offset for Step and Repeat command
GetLayerParams
().
m_XRepeatCount
=
1
;
...
...
@@ -484,6 +486,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
break
;
case
KNOCKOUT
:
m_Iterpolation
=
GERB_INTERPOL_LINEAR_1X
;
// Start a new Gerber layer
msg
=
_
(
"RS274X: Command KNOCKOUT ignored by Gerbview"
)
;
ReportMessage
(
msg
);
break
;
...
...
@@ -500,7 +503,8 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
break
;
case
ROTATE
:
// Layer rotation: command like %RO45*%
m_LocalRotation
=
wxRound
(
ReadDouble
(
text
)
*
10
);
m_Iterpolation
=
GERB_INTERPOL_LINEAR_1X
;
// Start a new Gerber layer
m_LocalRotation
=
ReadDouble
(
text
);
// Store layer rotation in degrees
break
;
case
IMAGE_NAME
:
...
...
@@ -513,6 +517,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
break
;
case
LAYER_NAME
:
m_Iterpolation
=
GERB_INTERPOL_LINEAR_1X
;
// Start a new Gerber layer
GetLayerParams
(
).
m_LayerName
.
Empty
();
while
(
*
text
!=
'*'
)
{
...
...
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