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
96bb90de
Commit
96bb90de
authored
Dec 14, 2011
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kicad_plugin
parent
0498f265
Changes
60
Hide whitespace changes
Inline
Side-by-side
Showing
60 changed files
with
1303 additions
and
1328 deletions
+1303
-1328
3d_draw.cpp
3d-viewer/3d_draw.cpp
+12
-9
CHANGELOG.txt
CHANGELOG.txt
+13
-0
trigo.cpp
common/trigo.cpp
+8
-8
class_gerber_draw_item.cpp
gerbview/class_gerber_draw_item.cpp
+1
-1
export_to_pcbnew.cpp
gerbview/export_to_pcbnew.cpp
+11
-11
base_struct.h
include/base_struct.h
+5
-11
class_board_item.h
include/class_board_item.h
+1
-1
footprint_info.h
include/footprint_info.h
+1
-1
trigo.h
include/trigo.h
+6
-6
autoplac.cpp
pcbnew/autoplac.cpp
+4
-4
block_module_editor.cpp
pcbnew/block_module_editor.cpp
+32
-29
board.cpp
pcbnew/board.cpp
+10
-10
board_undo_redo.cpp
pcbnew/board_undo_redo.cpp
+59
-54
class_board_connected_item.cpp
pcbnew/class_board_connected_item.cpp
+10
-5
class_board_connected_item.h
pcbnew/class_board_connected_item.h
+5
-5
class_dimension.cpp
pcbnew/class_dimension.cpp
+39
-40
class_dimension.h
pcbnew/class_dimension.h
+14
-8
class_drawsegment.cpp
pcbnew/class_drawsegment.cpp
+46
-17
class_drawsegment.h
pcbnew/class_drawsegment.h
+42
-43
class_edge_mod.h
pcbnew/class_edge_mod.h
+10
-4
class_marker_pcb.cpp
pcbnew/class_marker_pcb.cpp
+1
-14
class_marker_pcb.h
pcbnew/class_marker_pcb.h
+1
-1
class_mire.cpp
pcbnew/class_mire.cpp
+10
-18
class_mire.h
pcbnew/class_mire.h
+19
-10
class_module.h
pcbnew/class_module.h
+6
-10
class_module_transform_functions.cpp
pcbnew/class_module_transform_functions.cpp
+62
-70
class_pcb_text.cpp
pcbnew/class_pcb_text.cpp
+1
-19
class_pcb_text.h
pcbnew/class_pcb_text.h
+1
-1
class_track.cpp
pcbnew/class_track.cpp
+10
-10
class_track.h
pcbnew/class_track.h
+31
-23
class_zone.cpp
pcbnew/class_zone.cpp
+1
-1
class_zone.h
pcbnew/class_zone.h
+8
-9
clean.cpp
pcbnew/clean.cpp
+1
-1
dialog_edit_module_for_BoardEditor.cpp
pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp
+1
-1
dialog_gendrill.cpp
pcbnew/dialogs/dialog_gendrill.cpp
+3
-3
dialog_graphic_item_properties.cpp
pcbnew/dialogs/dialog_graphic_item_properties.cpp
+17
-23
dialog_pcb_text_properties.cpp
pcbnew/dialogs/dialog_pcb_text_properties.cpp
+16
-16
dimension.cpp
pcbnew/dimension.cpp
+22
-22
drc_clearance_test_functions.cpp
pcbnew/drc_clearance_test_functions.cpp
+2
-2
edgemod.cpp
pcbnew/edgemod.cpp
+53
-42
edit_track_width.cpp
pcbnew/edit_track_width.cpp
+1
-1
editedge.cpp
pcbnew/editedge.cpp
+33
-26
editrack-part2.cpp
pcbnew/editrack-part2.cpp
+2
-2
export_gencad.cpp
pcbnew/export_gencad.cpp
+13
-13
export_vrml.cpp
pcbnew/export_vrml.cpp
+13
-13
gen_modules_placefile.cpp
pcbnew/gen_modules_placefile.cpp
+12
-10
gpcb_exchange.cpp
pcbnew/gpcb_exchange.cpp
+54
-33
ioascii.cpp
pcbnew/ioascii.cpp
+4
-6
item_io.cpp
pcbnew/item_io.cpp
+53
-38
kicad_plugin.cpp
pcbnew/kicad_plugin.cpp
+243
-325
kicad_plugin.h
pcbnew/kicad_plugin.h
+4
-16
mirepcb.cpp
pcbnew/mirepcb.cpp
+17
-16
modedit.cpp
pcbnew/modedit.cpp
+25
-23
modedit_onclick.cpp
pcbnew/modedit_onclick.cpp
+3
-3
muonde.cpp
pcbnew/muonde.cpp
+75
-76
plot_rtn.cpp
pcbnew/plot_rtn.cpp
+118
-138
protos.h
pcbnew/protos.h
+2
-1
specctra_export.cpp
pcbnew/specctra_export.cpp
+32
-21
specctra_import.cpp
pcbnew/specctra_import.cpp
+3
-3
swap_layers.cpp
pcbnew/swap_layers.cpp
+1
-1
No files found.
3d-viewer/3d_draw.cpp
View file @
96bb90de
...
@@ -568,11 +568,14 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment )
...
@@ -568,11 +568,14 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment )
int
color
=
g_ColorsSettings
.
GetLayerColor
(
layer
);
int
color
=
g_ColorsSettings
.
GetLayerColor
(
layer
);
SetGLColor
(
color
);
SetGLColor
(
color
);
w
=
segment
->
m_Width
*
g_Parm_3D_Visu
.
m_BoardScale
;
x
=
segment
->
m_Start
.
x
*
g_Parm_3D_Visu
.
m_BoardScale
;
w
=
segment
->
GetWidth
()
*
g_Parm_3D_Visu
.
m_BoardScale
;
y
=
segment
->
m_Start
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
xf
=
segment
->
m_End
.
x
*
g_Parm_3D_Visu
.
m_BoardScale
;
x
=
segment
->
GetStart
().
x
*
g_Parm_3D_Visu
.
m_BoardScale
;
yf
=
segment
->
m_End
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
y
=
segment
->
GetStart
().
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
xf
=
segment
->
GetEnd
().
x
*
g_Parm_3D_Visu
.
m_BoardScale
;
yf
=
segment
->
GetEnd
().
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
if
(
layer
==
EDGE_N
)
if
(
layer
==
EDGE_N
)
{
{
...
@@ -581,10 +584,10 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment )
...
@@ -581,10 +584,10 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment )
glNormal3f
(
0.0
,
0.0
,
(
layer
==
LAYER_N_BACK
)
?
-
1.0
:
1.0
);
glNormal3f
(
0.0
,
0.0
,
(
layer
==
LAYER_N_BACK
)
?
-
1.0
:
1.0
);
zpos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
layer
];
zpos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
layer
];
switch
(
segment
->
m_Shape
)
switch
(
segment
->
GetShape
()
)
{
{
case
S_ARC
:
case
S_ARC
:
Draw3D_ArcSegment
(
x
,
-
y
,
xf
,
-
yf
,
(
double
)
segment
->
m_Angle
,
w
,
zpos
);
Draw3D_ArcSegment
(
x
,
-
y
,
xf
,
-
yf
,
segment
->
GetAngle
()
,
w
,
zpos
);
break
;
break
;
case
S_CIRCLE
:
case
S_CIRCLE
:
...
@@ -604,10 +607,10 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment )
...
@@ -604,10 +607,10 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment )
if
(
Get3DLayerEnable
(
layer
)
)
if
(
Get3DLayerEnable
(
layer
)
)
{
{
switch
(
segment
->
m_Shape
)
switch
(
segment
->
GetShape
()
)
{
{
case
S_ARC
:
case
S_ARC
:
Draw3D_ArcSegment
(
x
,
-
y
,
xf
,
-
yf
,
(
double
)
segment
->
m_Angle
,
w
,
zpos
);
Draw3D_ArcSegment
(
x
,
-
y
,
xf
,
-
yf
,
segment
->
GetAngle
()
,
w
,
zpos
);
break
;
break
;
case
S_CIRCLE
:
case
S_CIRCLE
:
...
...
CHANGELOG.txt
View file @
96bb90de
...
@@ -5,6 +5,19 @@ Please add newer entries at the top, list the date and your name with
...
@@ -5,6 +5,19 @@ Please add newer entries at the top, list the date and your name with
email address.
email address.
2011-Dec-13 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++common
* changed all the RotatePoint() functions in trigo.{h,cpp} to take a double as the
angle, which is still in tenths of degrees for now.
++pcbnew
* DRAWSEGMENT::GetStart() and GetEnd() do not operate for S_ARC like they used to.
They are now simply accessors for m_Start and m_End. Use DRAWSEGMENT::GetArcStart()
and GetArcEnd() and GetCenter() for arcs. specctra_export.cpp was the only
source file dependent on the old behavior.
* DIMENSION::m_Text is now contained, not dynamically allocated.
* more kicad_plugin work.
2011-Dec-9 UPDATE Dick Hollenbeck <dick@softplc.com>
2011-Dec-9 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
================================================================================
++PCBNew
++PCBNew
...
...
common/trigo.cpp
View file @
96bb90de
...
@@ -215,7 +215,7 @@ int ArcTangente( int dy, int dx )
...
@@ -215,7 +215,7 @@ int ArcTangente( int dy, int dx )
}
}
void
RotatePoint
(
int
*
pX
,
int
*
pY
,
int
angle
)
void
RotatePoint
(
int
*
pX
,
int
*
pY
,
double
angle
)
{
{
int
tmp
;
int
tmp
;
...
@@ -248,7 +248,7 @@ void RotatePoint( int* pX, int* pY, int angle )
...
@@ -248,7 +248,7 @@ void RotatePoint( int* pX, int* pY, int angle )
}
}
else
else
{
{
double
fangle
=
DEG2RAD
(
(
double
)
angle
/
10.0
);
double
fangle
=
DEG2RAD
(
angle
/
10.0
);
double
sinus
=
sin
(
fangle
);
double
sinus
=
sin
(
fangle
);
double
cosinus
=
cos
(
fangle
);
double
cosinus
=
cos
(
fangle
);
double
fpx
=
(
*
pY
*
sinus
)
+
(
*
pX
*
cosinus
);
double
fpx
=
(
*
pY
*
sinus
)
+
(
*
pX
*
cosinus
);
...
@@ -259,7 +259,7 @@ void RotatePoint( int* pX, int* pY, int angle )
...
@@ -259,7 +259,7 @@ void RotatePoint( int* pX, int* pY, int angle )
}
}
void
RotatePoint
(
int
*
pX
,
int
*
pY
,
int
cx
,
int
cy
,
int
angle
)
void
RotatePoint
(
int
*
pX
,
int
*
pY
,
int
cx
,
int
cy
,
double
angle
)
{
{
int
ox
,
oy
;
int
ox
,
oy
;
...
@@ -273,7 +273,7 @@ void RotatePoint( int* pX, int* pY, int cx, int cy, int angle )
...
@@ -273,7 +273,7 @@ void RotatePoint( int* pX, int* pY, int cx, int cy, int angle )
}
}
void
RotatePoint
(
wxPoint
*
point
,
int
angle
)
void
RotatePoint
(
wxPoint
*
point
,
double
angle
)
{
{
int
ox
,
oy
;
int
ox
,
oy
;
...
@@ -286,7 +286,7 @@ void RotatePoint( wxPoint* point, int angle )
...
@@ -286,7 +286,7 @@ void RotatePoint( wxPoint* point, int angle )
}
}
void
RotatePoint
(
wxPoint
*
point
,
const
wxPoint
&
centre
,
int
angle
)
void
RotatePoint
(
wxPoint
*
point
,
const
wxPoint
&
centre
,
double
angle
)
{
{
int
ox
,
oy
;
int
ox
,
oy
;
...
@@ -299,7 +299,7 @@ void RotatePoint( wxPoint* point, const wxPoint& centre, int angle )
...
@@ -299,7 +299,7 @@ void RotatePoint( wxPoint* point, const wxPoint& centre, int angle )
}
}
void
RotatePoint
(
double
*
pX
,
double
*
pY
,
double
cx
,
double
cy
,
int
angle
)
void
RotatePoint
(
double
*
pX
,
double
*
pY
,
double
cx
,
double
cy
,
double
angle
)
{
{
double
ox
,
oy
;
double
ox
,
oy
;
...
@@ -313,7 +313,7 @@ void RotatePoint( double* pX, double* pY, double cx, double cy, int angle )
...
@@ -313,7 +313,7 @@ void RotatePoint( double* pX, double* pY, double cx, double cy, int angle )
}
}
void
RotatePoint
(
double
*
pX
,
double
*
pY
,
int
angle
)
void
RotatePoint
(
double
*
pX
,
double
*
pY
,
double
angle
)
{
{
double
tmp
;
double
tmp
;
...
@@ -346,7 +346,7 @@ void RotatePoint( double* pX, double* pY, int angle )
...
@@ -346,7 +346,7 @@ void RotatePoint( double* pX, double* pY, int angle )
}
}
else
else
{
{
double
fangle
=
DEG2RAD
(
(
double
)
angle
/
10.0
);
double
fangle
=
DEG2RAD
(
angle
/
10.0
);
double
sinus
=
sin
(
fangle
);
double
sinus
=
sin
(
fangle
);
double
cosinus
=
cos
(
fangle
);
double
cosinus
=
cos
(
fangle
);
...
...
gerbview/class_gerber_draw_item.cpp
View file @
96bb90de
...
@@ -72,7 +72,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource ) :
...
@@ -72,7 +72,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource ) :
m_Flags
=
aSource
.
m_Flags
;
m_Flags
=
aSource
.
m_Flags
;
SetTimeStamp
(
aSource
.
m_TimeStamp
);
SetTimeStamp
(
aSource
.
m_TimeStamp
);
SetStatus
(
aSource
.
Return
Status
()
);
SetStatus
(
aSource
.
Get
Status
()
);
m_Start
=
aSource
.
m_Start
;
m_Start
=
aSource
.
m_Start
;
m_End
=
aSource
.
m_End
;
m_End
=
aSource
.
m_End
;
m_Size
=
aSource
.
m_Size
;
m_Size
=
aSource
.
m_Size
;
...
...
gerbview/export_to_pcbnew.cpp
View file @
96bb90de
...
@@ -256,9 +256,9 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, in
...
@@ -256,9 +256,9 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, in
DRAWSEGMENT
*
drawitem
=
new
DRAWSEGMENT
(
m_pcb
,
PCB_LINE_T
);
DRAWSEGMENT
*
drawitem
=
new
DRAWSEGMENT
(
m_pcb
,
PCB_LINE_T
);
drawitem
->
SetLayer
(
aLayer
);
drawitem
->
SetLayer
(
aLayer
);
drawitem
->
m_Start
=
aGbrItem
->
m_Start
;
drawitem
->
SetStart
(
aGbrItem
->
m_Start
)
;
drawitem
->
m_End
=
aGbrItem
->
m_End
;
drawitem
->
SetEnd
(
aGbrItem
->
m_End
)
;
drawitem
->
m_Width
=
aGbrItem
->
m_Size
.
x
;
drawitem
->
SetWidth
(
aGbrItem
->
m_Size
.
x
)
;
if
(
aGbrItem
->
m_Shape
==
GBR_ARC
)
if
(
aGbrItem
->
m_Shape
==
GBR_ARC
)
{
{
...
@@ -267,20 +267,20 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, in
...
@@ -267,20 +267,20 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, in
double
b
=
atan2
(
(
double
)(
aGbrItem
->
m_End
.
y
-
aGbrItem
->
m_ArcCentre
.
y
),
double
b
=
atan2
(
(
double
)(
aGbrItem
->
m_End
.
y
-
aGbrItem
->
m_ArcCentre
.
y
),
(
double
)(
aGbrItem
->
m_End
.
x
-
aGbrItem
->
m_ArcCentre
.
x
)
);
(
double
)(
aGbrItem
->
m_End
.
x
-
aGbrItem
->
m_ArcCentre
.
x
)
);
drawitem
->
m_Shape
=
S_ARC
;
drawitem
->
SetShape
(
S_ARC
)
;
drawitem
->
m_Angle
=
wxRound
(
(
a
-
b
)
/
M_PI
*
1800.0
);
drawitem
->
SetAngle
(
wxRound
(
(
a
-
b
)
/
M_PI
*
1800.0
)
);
drawitem
->
m_Start
=
aGbrItem
->
m_ArcCentre
;
drawitem
->
SetStart
(
aGbrItem
->
m_ArcCentre
)
;
if
(
drawitem
->
m_Angle
<
0
)
if
(
drawitem
->
GetAngle
()
<
0
)
{
{
NEGATE
(
drawitem
->
m_Angle
);
drawitem
->
SetAngle
(
-
drawitem
->
GetAngle
()
);
drawitem
->
m_End
=
aGbrItem
->
m_Start
;
drawitem
->
SetEnd
(
aGbrItem
->
m_Start
)
;
}
}
}
}
// Reverse Y axis:
// Reverse Y axis:
NEGATE
(
drawitem
->
m_Start
.
y
);
drawitem
->
SetStartY
(
-
drawitem
->
GetStart
()
.
y
);
NEGATE
(
drawitem
->
m_End
.
y
);
drawitem
->
SetEndY
(
-
drawitem
->
GetEnd
()
.
y
);
m_pcb
->
Add
(
drawitem
);
m_pcb
->
Add
(
drawitem
);
}
}
...
...
include/base_struct.h
View file @
96bb90de
...
@@ -444,7 +444,6 @@ public:
...
@@ -444,7 +444,6 @@ public:
return
m_Status
&
type
;
return
m_Status
&
type
;
}
}
void
SetState
(
int
type
,
int
state
)
void
SetState
(
int
type
,
int
state
)
{
{
if
(
state
)
if
(
state
)
...
@@ -453,13 +452,8 @@ public:
...
@@ -453,13 +452,8 @@ public:
m_Status
&=
~
type
;
m_Status
&=
~
type
;
}
}
int
GetStatus
()
const
{
return
m_Status
;
}
int
ReturnStatus
()
const
{
return
m_Status
;
}
void
SetStatus
(
int
aStatus
)
{
m_Status
=
aStatus
;
}
void
SetStatus
(
int
new_status
)
{
m_Status
=
new_status
;
}
void
SetFlags
(
int
aMask
)
{
m_Flags
|=
aMask
;
}
void
SetFlags
(
int
aMask
)
{
m_Flags
|=
aMask
;
}
void
ClearFlags
(
int
aMask
=
EDA_ITEM_ALL_FLAGS
)
{
m_Flags
&=
~
aMask
;
}
void
ClearFlags
(
int
aMask
=
EDA_ITEM_ALL_FLAGS
)
{
m_Flags
&=
~
aMask
;
}
...
@@ -760,7 +754,7 @@ class EDA_TEXT
...
@@ -760,7 +754,7 @@ class EDA_TEXT
public
:
public
:
wxString
m_Text
;
wxString
m_Text
;
int
m_Thickness
;
///< pen size used to draw this text
int
m_Thickness
;
///< pen size used to draw this text
int
m_Orient
;
///< Orient in 0.1 degrees
double
m_Orient
;
///< Orient in 0.1 degrees
wxPoint
m_Pos
;
///< XY position of anchor text.
wxPoint
m_Pos
;
///< XY position of anchor text.
wxSize
m_Size
;
///< XY size of text
wxSize
m_Size
;
///< XY size of text
bool
m_Mirror
;
///< true iff mirrored
bool
m_Mirror
;
///< true iff mirrored
...
@@ -794,8 +788,8 @@ public:
...
@@ -794,8 +788,8 @@ public:
*/
*/
int
GetThickness
()
const
{
return
m_Thickness
;
};
int
GetThickness
()
const
{
return
m_Thickness
;
};
void
SetOrientation
(
int
aOrientation
)
{
m_Orient
=
aOrientation
;
}
void
SetOrientation
(
double
aOrientation
)
{
m_Orient
=
aOrientation
;
}
int
GetOrientation
()
const
{
return
m_Orient
;
}
double
GetOrientation
()
const
{
return
m_Orient
;
}
void
SetItalic
(
bool
isItalic
)
{
m_Italic
=
isItalic
;
}
void
SetItalic
(
bool
isItalic
)
{
m_Italic
=
isItalic
;
}
bool
IsItalic
()
const
{
return
m_Italic
;
}
bool
IsItalic
()
const
{
return
m_Italic
;
}
...
...
include/class_board_item.h
View file @
96bb90de
...
@@ -194,7 +194,7 @@ public:
...
@@ -194,7 +194,7 @@ public:
* @param aRotCentre - the rotation point.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
* @param aAngle - the rotation angle in 0.1 degree.
*/
*/
virtual
void
Rotate
(
const
wxPoint
&
aRotCentre
,
int
aAngle
)
virtual
void
Rotate
(
const
wxPoint
&
aRotCentre
,
double
aAngle
)
{
{
wxMessageBox
(
wxT
(
"virtual BOARD_ITEM::Rotate used, should not occur"
),
GetClass
()
);
wxMessageBox
(
wxT
(
"virtual BOARD_ITEM::Rotate used, should not occur"
),
GetClass
()
);
}
}
...
...
include/footprint_info.h
View file @
96bb90de
...
@@ -43,7 +43,7 @@ public:
...
@@ -43,7 +43,7 @@ public:
* Function GetCount
* Function GetCount
* @return the number of items stored in list
* @return the number of items stored in list
*/
*/
unsigned
GetCount
()
{
return
m_List
.
size
();
}
unsigned
GetCount
()
const
{
return
m_List
.
size
();
}
/**
/**
* Function GetModuleInfo
* Function GetModuleInfo
...
...
include/trigo.h
View file @
96bb90de
...
@@ -10,29 +10,29 @@
...
@@ -10,29 +10,29 @@
* Calculate the new point of coord coord pX, pY,
* Calculate the new point of coord coord pX, pY,
* for a rotation center 0, 0, and angle in (1 / 10 degree)
* for a rotation center 0, 0, and angle in (1 / 10 degree)
*/
*/
void
RotatePoint
(
int
*
pX
,
int
*
pY
,
int
angle
);
void
RotatePoint
(
int
*
pX
,
int
*
pY
,
double
angle
);
/*
/*
* Calculate the new point of coord coord pX, pY,
* Calculate the new point of coord coord pX, pY,
* for a rotation center cx, cy, and angle in (1 / 10 degree)
* for a rotation center cx, cy, and angle in (1 / 10 degree)
*/
*/
void
RotatePoint
(
int
*
pX
,
int
*
pY
,
int
cx
,
int
cy
,
int
angle
);
void
RotatePoint
(
int
*
pX
,
int
*
pY
,
int
cx
,
int
cy
,
double
angle
);
/*
/*
* Calculates the new coord point point
* Calculates the new coord point point
* for a rotation angle in (1 / 10 degree)
* for a rotation angle in (1 / 10 degree)
*/
*/
void
RotatePoint
(
wxPoint
*
point
,
int
angle
);
void
RotatePoint
(
wxPoint
*
point
,
double
angle
);
/*
/*
* Calculates the new coord point point
* Calculates the new coord point point
* for a center rotation center and angle in (1 / 10 degree)
* for a center rotation center and angle in (1 / 10 degree)
*/
*/
void
RotatePoint
(
wxPoint
*
point
,
const
wxPoint
&
centre
,
int
angle
);
void
RotatePoint
(
wxPoint
*
point
,
const
wxPoint
&
centre
,
double
angle
);
void
RotatePoint
(
double
*
pX
,
double
*
pY
,
int
angle
);
void
RotatePoint
(
double
*
pX
,
double
*
pY
,
double
angle
);
void
RotatePoint
(
double
*
pX
,
double
*
pY
,
double
cx
,
double
cy
,
int
angle
);
void
RotatePoint
(
double
*
pX
,
double
*
pY
,
double
cx
,
double
cy
,
double
angle
);
/* Return the arc tangent of 0.1 degrees coord vector dx, dy
/* Return the arc tangent of 0.1 degrees coord vector dx, dy
* between -1800 and 1800
* between -1800 and 1800
...
...
pcbnew/autoplac.cpp
View file @
96bb90de
...
@@ -484,10 +484,10 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
...
@@ -484,10 +484,10 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
if
(
DrawSegm
->
GetLayer
()
!=
EDGE_N
)
if
(
DrawSegm
->
GetLayer
()
!=
EDGE_N
)
break
;
break
;
TmpSegm
.
m_Start
=
DrawSegm
->
m_Start
;
TmpSegm
.
SetStart
(
DrawSegm
->
GetStart
()
)
;
TmpSegm
.
m_End
=
DrawSegm
->
m_End
;
TmpSegm
.
SetEnd
(
DrawSegm
->
GetEnd
()
)
;
TmpSegm
.
m_Shape
=
DrawSegm
->
m_Shape
;
TmpSegm
.
SetShape
(
DrawSegm
->
GetShape
()
)
;
TmpSegm
.
m_Param
=
DrawSegm
->
m_Angle
;
TmpSegm
.
m_Param
=
DrawSegm
->
GetAngle
()
;
TraceSegmentPcb
(
GetBoard
(),
&
TmpSegm
,
HOLE
|
CELL_is_EDGE
,
TraceSegmentPcb
(
GetBoard
(),
&
TmpSegm
,
HOLE
|
CELL_is_EDGE
,
Board
.
m_GridRouting
,
WRITE_CELL
);
Board
.
m_GridRouting
,
WRITE_CELL
);
...
...
pcbnew/block_module_editor.cpp
View file @
96bb90de
...
@@ -483,10 +483,10 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
...
@@ -483,10 +483,10 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
case
PCB_MODULE_EDGE_T
:
case
PCB_MODULE_EDGE_T
:
{
{
EDGE_MODULE
*
em
=
(
EDGE_MODULE
*
)
item
;
EDGE_MODULE
*
em
=
(
EDGE_MODULE
*
)
item
;
em
->
m_Start
+=
offset
;
em
->
SetStart
(
em
->
GetStart
()
+
offset
)
;
em
->
m_End
+=
offset
;
em
->
SetEnd
(
em
->
GetEnd
()
+
offset
)
;
em
->
m_Start0
+=
offset
;
em
->
SetStart0
(
em
->
GetStart0
()
+
offset
)
;
em
->
m_End0
+=
offset
;
em
->
SetEnd0
(
em
->
GetEnd0
()
+
offset
)
;
}
}
break
;
break
;
...
@@ -537,20 +537,17 @@ void DeleteMarkedItems( MODULE* module )
...
@@ -537,20 +537,17 @@ void DeleteMarkedItems( MODULE* module )
}
}
/* Mirror marked items, refer to a Vertical axis at position offset
/*
*
Mirror marked items, refer to a Vertical axis at position offset
*/
*/
void
MirrorMarkedItems
(
MODULE
*
module
,
wxPoint
offset
)
void
MirrorMarkedItems
(
MODULE
*
module
,
wxPoint
offset
)
{
{
#define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x;
#define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x;
EDA_ITEM
*
item
;
wxPoint
tmp
;
wxPoint
tmp
;
if
(
module
==
NULL
)
if
(
module
==
NULL
)
return
;
return
;
D_PAD
*
pad
=
module
->
m_Pads
;
for
(
D_PAD
*
pad
=
module
->
m_Pads
;
pad
;
pad
=
pad
->
Next
()
)
for
(
;
pad
!=
NULL
;
pad
=
pad
->
Next
()
)
{
{
if
(
pad
->
m_Selected
==
0
)
if
(
pad
->
m_Selected
==
0
)
continue
;
continue
;
...
@@ -566,9 +563,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
...
@@ -566,9 +563,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
NORMALIZE_ANGLE_POS
(
pad
->
m_Orient
);
NORMALIZE_ANGLE_POS
(
pad
->
m_Orient
);
}
}
item
=
module
->
m_Drawings
;
for
(
EDA_ITEM
*
item
=
module
->
m_Drawings
;
item
;
item
=
item
->
Next
()
)
for
(
;
item
!=
NULL
;
item
=
item
->
Next
()
)
{
{
if
(
item
->
m_Selected
==
0
)
if
(
item
->
m_Selected
==
0
)
continue
;
continue
;
...
@@ -578,11 +573,18 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
...
@@ -578,11 +573,18 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
case
PCB_MODULE_EDGE_T
:
case
PCB_MODULE_EDGE_T
:
{
{
EDGE_MODULE
*
em
=
(
EDGE_MODULE
*
)
item
;
EDGE_MODULE
*
em
=
(
EDGE_MODULE
*
)
item
;
SETMIRROR
(
em
->
m_Start
.
x
);
em
->
m_Start0
.
x
=
em
->
m_Start
.
x
;
tmp
=
em
->
GetStart0
();
SETMIRROR
(
em
->
m_End
.
x
);
SETMIRROR
(
tmp
.
x
);
em
->
m_End0
.
x
=
em
->
m_End
.
x
;
em
->
SetStart0
(
tmp
);
NEGATE
(
em
->
m_Angle
);
em
->
SetStartX
(
tmp
.
x
);
tmp
=
em
->
GetEnd0
();
SETMIRROR
(
tmp
.
x
);
em
->
SetEnd0
(
tmp
);
em
->
SetEndX
(
tmp
.
x
);
em
->
SetAngle
(
-
em
->
GetAngle
()
);
}
}
break
;
break
;
...
@@ -607,19 +609,16 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
...
@@ -607,19 +609,16 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
}
}
/* Rotate marked items, refer to a Vertical axis at position offset
/*
*
Rotate marked items, refer to a Vertical axis at position offset
*/
*/
void
RotateMarkedItems
(
MODULE
*
module
,
wxPoint
offset
)
void
RotateMarkedItems
(
MODULE
*
module
,
wxPoint
offset
)
{
{
#define ROTATE( z ) RotatePoint( (&z), offset, 900 )
#define ROTATE( z ) RotatePoint( (&z), offset, 900 )
EDA_ITEM
*
item
;
if
(
module
==
NULL
)
if
(
module
==
NULL
)
return
;
return
;
D_PAD
*
pad
=
module
->
m_Pads
;
for
(
D_PAD
*
pad
=
module
->
m_Pads
;
pad
;
pad
=
pad
->
Next
()
)
for
(
;
pad
!=
NULL
;
pad
=
pad
->
Next
()
)
{
{
if
(
pad
->
m_Selected
==
0
)
if
(
pad
->
m_Selected
==
0
)
continue
;
continue
;
...
@@ -633,9 +632,7 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
...
@@ -633,9 +632,7 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
NORMALIZE_ANGLE_POS
(
pad
->
m_Orient
);
NORMALIZE_ANGLE_POS
(
pad
->
m_Orient
);
}
}
item
=
module
->
m_Drawings
;
for
(
EDA_ITEM
*
item
=
module
->
m_Drawings
;
item
;
item
=
item
->
Next
()
)
for
(
;
item
!=
NULL
;
item
=
item
->
Next
()
)
{
{
if
(
item
->
m_Selected
==
0
)
if
(
item
->
m_Selected
==
0
)
continue
;
continue
;
...
@@ -645,10 +642,16 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
...
@@ -645,10 +642,16 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
case
PCB_MODULE_EDGE_T
:
case
PCB_MODULE_EDGE_T
:
{
{
EDGE_MODULE
*
em
=
(
EDGE_MODULE
*
)
item
;
EDGE_MODULE
*
em
=
(
EDGE_MODULE
*
)
item
;
ROTATE
(
em
->
m_Start
);
em
->
m_Start0
=
em
->
m_Start
;
wxPoint
tmp
=
em
->
GetStart
();
ROTATE
(
em
->
m_End
);
ROTATE
(
tmp
);
em
->
m_End0
=
em
->
m_End
;
em
->
SetStart
(
tmp
);
em
->
SetStart0
(
tmp
);
tmp
=
em
->
GetEnd
();
ROTATE
(
tmp
);
em
->
SetEnd
(
tmp
);
em
->
SetEnd0
(
tmp
);
}
}
break
;
break
;
...
...
pcbnew/board.cpp
View file @
96bb90de
...
@@ -234,11 +234,11 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
...
@@ -234,11 +234,11 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
if
(
tmpSegm
.
GetLayer
()
==
EDGE_N
)
if
(
tmpSegm
.
GetLayer
()
==
EDGE_N
)
tmpSegm
.
SetLayer
(
-
1
);
tmpSegm
.
SetLayer
(
-
1
);
tmpSegm
.
m_Start
=
edge
->
m_Start
;
tmpSegm
.
SetStart
(
edge
->
GetStart
()
)
;
tmpSegm
.
m_End
=
edge
->
m_End
;
tmpSegm
.
SetEnd
(
edge
->
GetEnd
()
)
;
tmpSegm
.
m_Shape
=
edge
->
m_Shape
;
tmpSegm
.
SetShape
(
edge
->
GetShape
()
)
;
tmpSegm
.
m_Width
=
edge
->
m_Width
;
tmpSegm
.
SetWidth
(
edge
->
GetWidth
()
)
;
tmpSegm
.
m_Param
=
edge
->
m_Angle
;
tmpSegm
.
m_Param
=
edge
->
GetAngle
()
;
tmpSegm
.
SetNet
(
-
1
);
tmpSegm
.
SetNet
(
-
1
);
TraceSegmentPcb
(
aPcb
,
&
tmpSegm
,
HOLE
,
marge
,
WRITE_CELL
);
TraceSegmentPcb
(
aPcb
,
&
tmpSegm
,
HOLE
,
marge
,
WRITE_CELL
);
...
@@ -271,11 +271,11 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
...
@@ -271,11 +271,11 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
type_cell
|=
CELL_is_EDGE
;
type_cell
|=
CELL_is_EDGE
;
}
}
tmpSegm
.
m_Start
=
DrawSegm
->
m_Start
;
tmpSegm
.
SetStart
(
DrawSegm
->
GetStart
()
)
;
tmpSegm
.
m_End
=
DrawSegm
->
m_End
;
tmpSegm
.
SetEnd
(
DrawSegm
->
GetEnd
()
)
;
tmpSegm
.
m_Shape
=
DrawSegm
->
m_Shape
;
tmpSegm
.
SetShape
(
DrawSegm
->
GetShape
()
)
;
tmpSegm
.
m_Width
=
DrawSegm
->
m_Width
;
tmpSegm
.
SetWidth
(
DrawSegm
->
GetWidth
()
)
;
tmpSegm
.
m_Param
=
DrawSegm
->
m_Angle
;
tmpSegm
.
m_Param
=
DrawSegm
->
GetAngle
()
;
tmpSegm
.
SetNet
(
-
1
);
tmpSegm
.
SetNet
(
-
1
);
TraceSegmentPcb
(
aPcb
,
&
tmpSegm
,
type_cell
,
marge
,
WRITE_CELL
);
TraceSegmentPcb
(
aPcb
,
&
tmpSegm
,
type_cell
,
marge
,
WRITE_CELL
);
...
...
pcbnew/board_undo_redo.cpp
View file @
96bb90de
...
@@ -185,61 +185,69 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
...
@@ -185,61 +185,69 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
switch
(
aItem
->
Type
()
)
switch
(
aItem
->
Type
()
)
{
{
case
PCB_MODULE_T
:
case
PCB_MODULE_T
:
{
{
MODULE
*
tmp
=
(
MODULE
*
)
DuplicateStruct
(
aImage
);
MODULE
*
tmp
=
(
MODULE
*
)
DuplicateStruct
(
aImage
);
(
(
MODULE
*
)
aImage
)
->
Copy
(
(
MODULE
*
)
aItem
);
(
(
MODULE
*
)
aImage
)
->
Copy
(
(
MODULE
*
)
aItem
);
(
(
MODULE
*
)
aItem
)
->
Copy
(
tmp
);
(
(
MODULE
*
)
aItem
)
->
Copy
(
tmp
);
delete
tmp
;
delete
tmp
;
}
}
break
;
break
;
case
PCB_ZONE_AREA_T
:
case
PCB_ZONE_AREA_T
:
{
{
ZONE_CONTAINER
*
tmp
=
(
ZONE_CONTAINER
*
)
DuplicateStruct
(
aImage
);
ZONE_CONTAINER
*
tmp
=
(
ZONE_CONTAINER
*
)
DuplicateStruct
(
aImage
);
(
(
ZONE_CONTAINER
*
)
aImage
)
->
Copy
(
(
ZONE_CONTAINER
*
)
aItem
);
(
(
ZONE_CONTAINER
*
)
aImage
)
->
Copy
(
(
ZONE_CONTAINER
*
)
aItem
);
(
(
ZONE_CONTAINER
*
)
aItem
)
->
Copy
(
tmp
);
(
(
ZONE_CONTAINER
*
)
aItem
)
->
Copy
(
tmp
);
delete
tmp
;
delete
tmp
;
}
}
break
;
break
;
case
PCB_LINE_T
:
case
PCB_LINE_T
:
#if 0
EXCHG( ( (DRAWSEGMENT*) aItem )->m_Start, ( (DRAWSEGMENT*) aImage )->m_Start );
EXCHG( ( (DRAWSEGMENT*) aItem )->m_Start, ( (DRAWSEGMENT*) aImage )->m_Start );
EXCHG( ( (DRAWSEGMENT*) aItem )->m_End, ( (DRAWSEGMENT*) aImage )->m_End );
EXCHG( ( (DRAWSEGMENT*) aItem )->m_End, ( (DRAWSEGMENT*) aImage )->m_End );
EXCHG( ( (DRAWSEGMENT*) aItem )->m_Width, ( (DRAWSEGMENT*) aImage )->m_Width );
EXCHG( ( (DRAWSEGMENT*) aItem )->m_Width, ( (DRAWSEGMENT*) aImage )->m_Width );
EXCHG( ( (DRAWSEGMENT*) aItem )->m_Shape, ( (DRAWSEGMENT*) aImage )->m_Shape );
EXCHG( ( (DRAWSEGMENT*) aItem )->m_Shape, ( (DRAWSEGMENT*) aImage )->m_Shape );
#else
{
DRAWSEGMENT
tmp
=
*
(
DRAWSEGMENT
*
)
aImage
;
*
aImage
=
*
aItem
;
*
aItem
=
tmp
;
}
#endif
break
;
break
;
case
PCB_TRACE_T
:
case
PCB_TRACE_T
:
case
PCB_VIA_T
:
case
PCB_VIA_T
:
{
{
TRACK
*
track
=
(
TRACK
*
)
aItem
;
TRACK
*
track
=
(
TRACK
*
)
aItem
;
TRACK
*
image
=
(
TRACK
*
)
aImage
;
TRACK
*
image
=
(
TRACK
*
)
aImage
;
EXCHG
(
track
->
m_Start
,
image
->
m_Start
);
EXCHG
(
track
->
m_Start
,
image
->
m_Start
);
EXCHG
(
track
->
m_End
,
image
->
m_End
);
EXCHG
(
track
->
m_End
,
image
->
m_End
);
EXCHG
(
track
->
m_Width
,
image
->
m_Width
);
EXCHG
(
track
->
m_Width
,
image
->
m_Width
);
EXCHG
(
track
->
m_Shape
,
image
->
m_Shape
);
EXCHG
(
track
->
m_Shape
,
image
->
m_Shape
);
int
atmp
=
track
->
GetDrillValue
();
int
atmp
=
track
->
GetDrillValue
();
if
(
track
->
IsDrillDefault
()
)
if
(
track
->
IsDrillDefault
()
)
atmp
=
-
1
;
atmp
=
-
1
;
int
itmp
=
image
->
GetDrillValue
();
int
itmp
=
image
->
GetDrillValue
();
if
(
image
->
IsDrillDefault
()
)
if
(
image
->
IsDrillDefault
()
)
itmp
=
-
1
;
itmp
=
-
1
;
EXCHG
(
itmp
,
atmp
);
EXCHG
(
itmp
,
atmp
);
if
(
atmp
>
0
)
if
(
atmp
>
0
)
track
->
SetDrillValue
(
atmp
);
track
->
SetDrill
(
atmp
);
else
else
track
->
SetDrillDefault
();
track
->
SetDrillDefault
();
if
(
itmp
>
0
)
if
(
itmp
>
0
)
image
->
SetDrillValue
(
itmp
);
image
->
SetDrill
(
itmp
);
else
else
image
->
SetDrillDefault
();
image
->
SetDrillDefault
();
}
}
break
;
break
;
case
PCB_TEXT_T
:
case
PCB_TEXT_T
:
...
@@ -256,26 +264,23 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
...
@@ -256,26 +264,23 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
break
;
break
;
case
PCB_TARGET_T
:
case
PCB_TARGET_T
:
EXCHG
(
(
(
PCB_TARGET
*
)
aItem
)
->
m_Pos
,
(
(
PCB_TARGET
*
)
aImage
)
->
m_Pos
);
(
(
PCB_TARGET
*
)
aItem
)
->
Exchg
(
(
PCB_TARGET
*
)
aImage
);
EXCHG
(
(
(
PCB_TARGET
*
)
aItem
)
->
m_Width
,
(
(
PCB_TARGET
*
)
aImage
)
->
m_Width
);
EXCHG
(
(
(
PCB_TARGET
*
)
aItem
)
->
m_Size
,
(
(
PCB_TARGET
*
)
aImage
)
->
m_Size
);
EXCHG
(
(
(
PCB_TARGET
*
)
aItem
)
->
m_Shape
,
(
(
PCB_TARGET
*
)
aImage
)
->
m_Shape
);
break
;
break
;
case
PCB_DIMENSION_T
:
case
PCB_DIMENSION_T
:
{
{
wxString
txt
=
(
(
DIMENSION
*
)
aItem
)
->
GetText
();
wxString
txt
=
(
(
DIMENSION
*
)
aItem
)
->
GetText
();
(
(
DIMENSION
*
)
aItem
)
->
SetText
(
(
(
DIMENSION
*
)
aImage
)
->
GetText
()
);
(
(
DIMENSION
*
)
aItem
)
->
SetText
(
(
(
DIMENSION
*
)
aImage
)
->
GetText
()
);
(
(
DIMENSION
*
)
aImage
)
->
SetText
(
txt
);
(
(
DIMENSION
*
)
aImage
)
->
SetText
(
txt
);
EXCHG
(
(
(
DIMENSION
*
)
aItem
)
->
m_Width
,
(
(
DIMENSION
*
)
aImage
)
->
m_Width
);
EXCHG
(
(
(
DIMENSION
*
)
aItem
)
->
m_Width
,
(
(
DIMENSION
*
)
aImage
)
->
m_Width
);
EXCHG
(
(
(
DIMENSION
*
)
aItem
)
->
m_Text
->
m_Size
,
(
(
DIMENSION
*
)
aImage
)
->
m_Text
->
m_Size
);
EXCHG
(
(
(
DIMENSION
*
)
aItem
)
->
m_Text
.
m_Size
,
(
(
DIMENSION
*
)
aImage
)
->
m_Text
.
m_Size
);
EXCHG
(
(
(
DIMENSION
*
)
aItem
)
->
m_Text
->
m_Pos
,
(
(
DIMENSION
*
)
aImage
)
->
m_Text
->
m_Pos
);
EXCHG
(
(
(
DIMENSION
*
)
aItem
)
->
m_Text
.
m_Pos
,
(
(
DIMENSION
*
)
aImage
)
->
m_Text
.
m_Pos
);
EXCHG
(
(
(
DIMENSION
*
)
aItem
)
->
m_Text
->
m_Thickness
,
EXCHG
(
(
(
DIMENSION
*
)
aItem
)
->
m_Text
.
m_Thickness
,
(
(
DIMENSION
*
)
aImage
)
->
m_Text
->
m_Thickness
);
(
(
DIMENSION
*
)
aImage
)
->
m_Text
.
m_Thickness
);
EXCHG
(
(
(
DIMENSION
*
)
aItem
)
->
m_Text
->
m_Mirror
,
EXCHG
(
(
(
DIMENSION
*
)
aItem
)
->
m_Text
.
m_Mirror
,
(
(
DIMENSION
*
)
aImage
)
->
m_Text
->
m_Mirror
);
(
(
DIMENSION
*
)
aImage
)
->
m_Text
.
m_Mirror
);
}
}
break
;
break
;
case
PCB_ZONE_T
:
case
PCB_ZONE_T
:
default:
default:
...
...
pcbnew/class_board_connected_item.cpp
View file @
96bb90de
...
@@ -115,25 +115,30 @@ NETCLASS* BOARD_CONNECTED_ITEM::GetNetClass() const
...
@@ -115,25 +115,30 @@ NETCLASS* BOARD_CONNECTED_ITEM::GetNetClass() const
// It is important that this be implemented without any sequential searching.
// It is important that this be implemented without any sequential searching.
// Simple array lookups should be fine, performance-wise.
// Simple array lookups should be fine, performance-wise.
BOARD
*
board
=
GetBoard
();
BOARD
*
board
=
GetBoard
();
// DO NOT use wxASSERT, because GetNetClass is called inside an OnPaint event
// DO NOT use wxASSERT, because GetNetClass is called inside an OnPaint event
// and a call to wxASSERT can crash the application.
// and a call to wxASSERT can crash the application.
if
(
board
==
NULL
)
// Should not occurs
if
(
board
==
NULL
)
// Should not occur
{
{
#ifdef __WXDEBUG__
#ifdef __WXDEBUG__
wxLogWarning
(
wxT
(
"BOARD_CONNECTED_ITEM::GetNetClass():NULL board,type %d"
),
Type
()
);
wxLogWarning
(
wxT
(
"BOARD_CONNECTED_ITEM::GetNetClass():NULL board,type %d"
),
Type
()
);
#endif
#endif
return
NULL
;
return
NULL
;
}
}
NETCLASS
*
netclass
=
NULL
;
NETCLASS
*
netclass
=
NULL
;
NETINFO_ITEM
*
net
=
board
->
FindNet
(
GetNet
()
);
int
netcode
=
GetNet
();
NETINFO_ITEM
*
net
=
board
->
FindNet
(
netcode
);
if
(
net
)
if
(
net
)
{
{
netclass
=
net
->
GetNetClass
();
netclass
=
net
->
GetNetClass
();
#ifdef __WXDEBUG__
#ifdef __WXDEBUG__
if
(
netclass
==
NULL
)
if
(
netclass
==
NULL
)
{
{
wxLogWarning
(
wxT
(
"BOARD_CONNECTED_ITEM::GetNetClass():NULL netclass,type %d"
),
Type
()
);
wxLogWarning
(
wxT
(
"BOARD_CONNECTED_ITEM::GetNetClass():NULL netclass,type %d"
),
Type
()
);
}
}
#endif
#endif
}
}
...
...
pcbnew/class_board_connected_item.h
View file @
96bb90de
...
@@ -15,7 +15,7 @@ class D_PAD;
...
@@ -15,7 +15,7 @@ class D_PAD;
/**
/**
* Class BOARD_CONNECTED_ITEM
* Class BOARD_CONNECTED_ITEM
*
This
is a base class derived from BOARD_ITEM for items that can be connected
* is a base class derived from BOARD_ITEM for items that can be connected
* and have a net, a netname, a clearance ...
* and have a net, a netname, a clearance ...
* mainly: tracks, pads and zones
* mainly: tracks, pads and zones
* Handle connection info
* Handle connection info
...
@@ -88,9 +88,9 @@ public:
...
@@ -88,9 +88,9 @@ public:
};
};
/*
/*
*
*
c
lass BOARD_ITEM_LIST
*
C
lass BOARD_ITEM_LIST
*
Handles a collection of BOARD_ITEM elements
*
is a container for a list of BOARD_ITEMs.
*/
*/
class
BOARD_ITEM_LIST
:
public
BOARD_ITEM
class
BOARD_ITEM_LIST
:
public
BOARD_ITEM
{
{
...
@@ -203,4 +203,4 @@ public:
...
@@ -203,4 +203,4 @@ public:
};
};
#endif
/
* BOARD_CONNECTED_ITEM_H */
#endif /
/ BOARD_CONNECTED_ITEM_H
pcbnew/class_dimension.cpp
View file @
96bb90de
...
@@ -20,46 +20,45 @@
...
@@ -20,46 +20,45 @@
DIMENSION
::
DIMENSION
(
BOARD_ITEM
*
aParent
)
:
DIMENSION
::
DIMENSION
(
BOARD_ITEM
*
aParent
)
:
BOARD_ITEM
(
aParent
,
PCB_DIMENSION_T
)
BOARD_ITEM
(
aParent
,
PCB_DIMENSION_T
),
m_Text
(
this
)
{
{
m_Layer
=
DRAW_LAYER
;
m_Layer
=
DRAW_LAYER
;
m_Width
=
50
;
m_Width
=
50
;
m_Value
=
0
;
m_Value
=
0
;
m_Shape
=
0
;
m_Shape
=
0
;
m_Unit
=
INCHES
;
m_Unit
=
INCHES
;
m_Text
=
new
TEXTE_PCB
(
this
);
}
}
DIMENSION
::~
DIMENSION
()
DIMENSION
::~
DIMENSION
()
{
{
delete
m_Text
;
}
}
void
DIMENSION
::
SetPosition
(
const
wxPoint
&
aPos
)
void
DIMENSION
::
SetPosition
(
const
wxPoint
&
aPos
)
{
{
m_Pos
=
aPos
;
m_Pos
=
aPos
;
m_Text
->
SetPos
(
aPos
);
m_Text
.
SetPos
(
aPos
);
}
}
void
DIMENSION
::
SetText
(
const
wxString
&
aNewText
)
void
DIMENSION
::
SetText
(
const
wxString
&
aNewText
)
{
{
m_Text
->
SetText
(
aNewText
);
m_Text
.
SetText
(
aNewText
);
}
}
const
wxString
DIMENSION
::
GetText
()
const
const
wxString
DIMENSION
::
GetText
()
const
{
{
return
m_Text
->
GetText
();
return
m_Text
.
GetText
();
}
}
void
DIMENSION
::
SetLayer
(
int
aLayer
)
void
DIMENSION
::
SetLayer
(
int
aLayer
)
{
{
m_Layer
=
aLayer
;
m_Layer
=
aLayer
;
m_Text
->
SetLayer
(
aLayer
);
m_Text
.
SetLayer
(
aLayer
);
}
}
...
@@ -72,7 +71,7 @@ void DIMENSION::Copy( DIMENSION* source )
...
@@ -72,7 +71,7 @@ void DIMENSION::Copy( DIMENSION* source )
m_Shape
=
source
->
m_Shape
;
m_Shape
=
source
->
m_Shape
;
m_Unit
=
source
->
m_Unit
;
m_Unit
=
source
->
m_Unit
;
SetTimeStamp
(
GetNewTimeStamp
()
);
SetTimeStamp
(
GetNewTimeStamp
()
);
m_Text
->
Copy
(
source
->
m_Text
);
m_Text
.
Copy
(
&
source
->
m_Text
);
m_crossBarOx
=
source
->
m_crossBarOx
;
m_crossBarOx
=
source
->
m_crossBarOx
;
m_crossBarOy
=
source
->
m_crossBarOy
;
m_crossBarOy
=
source
->
m_crossBarOy
;
...
@@ -105,10 +104,10 @@ void DIMENSION::Copy( DIMENSION* source )
...
@@ -105,10 +104,10 @@ void DIMENSION::Copy( DIMENSION* source )
}
}
void
DIMENSION
::
Move
(
const
wxPoint
&
offset
)
void
DIMENSION
::
Move
(
const
wxPoint
&
offset
)
{
{
m_Pos
+=
offset
;
m_Pos
+=
offset
;
m_Text
->
m_Pos
+=
offset
;
m_Text
.
m_Pos
+=
offset
;
m_crossBarOx
+=
offset
.
x
;
m_crossBarOx
+=
offset
.
x
;
m_crossBarOy
+=
offset
.
y
;
m_crossBarOy
+=
offset
.
y
;
m_crossBarFx
+=
offset
.
x
;
m_crossBarFx
+=
offset
.
x
;
...
@@ -140,13 +139,13 @@ void DIMENSION::Move(const wxPoint& offset)
...
@@ -140,13 +139,13 @@ void DIMENSION::Move(const wxPoint& offset)
}
}
void
DIMENSION
::
Rotate
(
const
wxPoint
&
aRotCentre
,
int
aAngle
)
void
DIMENSION
::
Rotate
(
const
wxPoint
&
aRotCentre
,
double
aAngle
)
{
{
RotatePoint
(
&
m_Pos
,
aRotCentre
,
aAngle
);
RotatePoint
(
&
m_Pos
,
aRotCentre
,
aAngle
);
RotatePoint
(
&
m_Text
->
m_Pos
,
aRotCentre
,
aAngle
);
RotatePoint
(
&
m_Text
.
m_Pos
,
aRotCentre
,
aAngle
);
int
newAngle
=
m_Text
->
GetOrientation
()
+
aAngle
;
double
newAngle
=
m_Text
.
GetOrientation
()
+
aAngle
;
if
(
newAngle
>=
3600
)
if
(
newAngle
>=
3600
)
newAngle
-=
3600
;
newAngle
-=
3600
;
...
@@ -154,7 +153,7 @@ void DIMENSION::Rotate( const wxPoint& aRotCentre, int aAngle )
...
@@ -154,7 +153,7 @@ void DIMENSION::Rotate( const wxPoint& aRotCentre, int aAngle )
if
(
newAngle
>
900
&&
newAngle
<
2700
)
if
(
newAngle
>
900
&&
newAngle
<
2700
)
newAngle
-=
1800
;
newAngle
-=
1800
;
m_Text
->
SetOrientation
(
newAngle
);
m_Text
.
SetOrientation
(
newAngle
);
RotatePoint
(
&
m_crossBarOx
,
&
m_crossBarOy
,
aRotCentre
.
x
,
aRotCentre
.
y
,
aAngle
);
RotatePoint
(
&
m_crossBarOx
,
&
m_crossBarOy
,
aRotCentre
.
x
,
aRotCentre
.
y
,
aAngle
);
RotatePoint
(
&
m_crossBarFx
,
&
m_crossBarFy
,
aRotCentre
.
x
,
aRotCentre
.
y
,
aAngle
);
RotatePoint
(
&
m_crossBarFx
,
&
m_crossBarFy
,
aRotCentre
.
x
,
aRotCentre
.
y
,
aAngle
);
...
@@ -180,21 +179,21 @@ void DIMENSION::Flip( const wxPoint& aCentre )
...
@@ -180,21 +179,21 @@ void DIMENSION::Flip( const wxPoint& aCentre )
}
}
void
DIMENSION
::
Mirror
(
const
wxPoint
&
axis_pos
)
void
DIMENSION
::
Mirror
(
const
wxPoint
&
axis_pos
)
{
{
#define INVERT( pos ) (pos) = axis_pos.y - ( (pos) - axis_pos.y )
#define INVERT( pos ) (pos) = axis_pos.y - ( (pos) - axis_pos.y )
INVERT
(
m_Pos
.
y
);
INVERT
(
m_Pos
.
y
);
INVERT
(
m_Text
->
m_Pos
.
y
);
INVERT
(
m_Text
.
m_Pos
.
y
);
// invert angle
// invert angle
int
newAngle
=
m_Text
->
GetOrientation
();
double
newAngle
=
m_Text
.
GetOrientation
();
if
(
newAngle
>=
3600
)
if
(
newAngle
>=
3600
)
newAngle
-=
3600
;
newAngle
-=
3600
;
if
(
newAngle
>
900
&&
newAngle
<
2700
)
if
(
newAngle
>
900
&&
newAngle
<
2700
)
newAngle
-=
1800
;
newAngle
-=
1800
;
m_Text
->
SetOrientation
(
newAngle
);
m_Text
.
SetOrientation
(
newAngle
);
INVERT
(
m_crossBarOy
);
INVERT
(
m_crossBarOy
);
INVERT
(
m_crossBarFy
);
INVERT
(
m_crossBarFy
);
...
@@ -217,25 +216,25 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
...
@@ -217,25 +216,25 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
{
{
#define ARROW_SIZE 500 //size of arrows
#define ARROW_SIZE 500 //size of arrows
int
ii
;
int
ii
;
int
mesure
,
deltax
,
deltay
;
/
* value of the measure on X and Y axes */
int
mesure
,
deltax
,
deltay
;
/
/ value of the measure on X and Y axes
int
arrow_up_X
=
0
,
arrow_up_Y
=
0
;
/
* coordinates of arrow line / *
/
int
arrow_up_X
=
0
,
arrow_up_Y
=
0
;
/
/ coordinates of arrow line
/
int
arrow_dw_X
=
0
,
arrow_dw_Y
=
0
;
/
* coordinates of arrow line \ */
int
arrow_dw_X
=
0
,
arrow_dw_Y
=
0
;
/
/ coordinates of arrow line '\'
int
hx
,
hy
;
/
* dimension line interval */
int
hx
,
hy
;
/
/ dimension line interval
float
angle
,
angle_f
;
double
angle
,
angle_f
;
wxString
msg
;
wxString
msg
;
/
* Init layer : */
/
/ Init layer :
m_Text
->
SetLayer
(
GetLayer
()
);
m_Text
.
SetLayer
(
GetLayer
()
);
/
* calculate the size of the dimension (text + line above the text) */
/
/ calculate the size of the dimension (text + line above the text)
ii
=
m_Text
->
m_Size
.
y
+
ii
=
m_Text
.
m_Size
.
y
+
m_Text
->
GetThickness
()
+
(
m_Width
*
3
);
m_Text
.
GetThickness
()
+
(
m_Width
*
3
);
deltax
=
m_featureLineDOx
-
m_featureLineGOx
;
deltax
=
m_featureLineDOx
-
m_featureLineGOx
;
deltay
=
m_featureLineDOy
-
m_featureLineGOy
;
deltay
=
m_featureLineDOy
-
m_featureLineGOy
;
// Calculate dimension value
// Calculate dimension value
mesure
=
wxRound
(
hypot
(
(
double
)
deltax
,
(
double
)
deltay
)
);
mesure
=
wxRound
(
hypot
(
(
double
)
deltax
,
(
double
)
deltay
)
);
if
(
deltax
||
deltay
)
if
(
deltax
||
deltay
)
angle
=
atan2
(
(
double
)
deltay
,
(
double
)
deltax
);
angle
=
atan2
(
(
double
)
deltay
,
(
double
)
deltax
);
...
@@ -302,11 +301,11 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
...
@@ -302,11 +301,11 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
m_featureLineDFx
=
m_crossBarFx
+
hx
;
m_featureLineDFx
=
m_crossBarFx
+
hx
;
m_featureLineDFy
=
m_crossBarFy
+
hy
;
m_featureLineDFy
=
m_crossBarFy
+
hy
;
/
* Calculate the better text position and orientation: */
/
/ Calculate the better text position and orientation:
m_Pos
.
x
=
m_Text
->
m_Pos
.
x
=
(
m_crossBarFx
+
m_featureLineGFx
)
/
2
;
m_Pos
.
x
=
m_Text
.
m_Pos
.
x
=
(
m_crossBarFx
+
m_featureLineGFx
)
/
2
;
m_Pos
.
y
=
m_Text
->
m_Pos
.
y
=
(
m_crossBarFy
+
m_featureLineGFy
)
/
2
;
m_Pos
.
y
=
m_Text
.
m_Pos
.
y
=
(
m_crossBarFy
+
m_featureLineGFy
)
/
2
;
int
newAngle
=
-
(
int
)
(
angle
*
1800
/
M_PI
);
double
newAngle
=
-
(
angle
*
1800
/
M_PI
);
if
(
newAngle
<
0
)
if
(
newAngle
<
0
)
newAngle
+=
3600
;
newAngle
+=
3600
;
...
@@ -316,7 +315,7 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
...
@@ -316,7 +315,7 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
if
(
newAngle
>
900
&&
newAngle
<
2700
)
if
(
newAngle
>
900
&&
newAngle
<
2700
)
newAngle
-=
1800
;
newAngle
-=
1800
;
m_Text
->
SetOrientation
(
newAngle
);
m_Text
.
SetOrientation
(
newAngle
);
if
(
!
aDoNotChangeText
)
if
(
!
aDoNotChangeText
)
{
{
...
@@ -334,7 +333,7 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxP
...
@@ -334,7 +333,7 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxP
ox
=
-
offset
.
x
;
ox
=
-
offset
.
x
;
oy
=
-
offset
.
y
;
oy
=
-
offset
.
y
;
m_Text
->
Draw
(
panel
,
DC
,
mode_color
,
offset
);
m_Text
.
Draw
(
panel
,
DC
,
mode_color
,
offset
);
BOARD
*
brd
=
GetBoard
(
);
BOARD
*
brd
=
GetBoard
(
);
...
@@ -417,7 +416,7 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxP
...
@@ -417,7 +416,7 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxP
void
DIMENSION
::
DisplayInfo
(
EDA_DRAW_FRAME
*
frame
)
void
DIMENSION
::
DisplayInfo
(
EDA_DRAW_FRAME
*
frame
)
{
{
// for now, display only the text within the DIMENSION using class TEXTE_PCB.
// for now, display only the text within the DIMENSION using class TEXTE_PCB.
m_Text
->
DisplayInfo
(
frame
);
m_Text
.
DisplayInfo
(
frame
);
}
}
...
@@ -426,14 +425,14 @@ bool DIMENSION::HitTest( const wxPoint& aPoint )
...
@@ -426,14 +425,14 @@ bool DIMENSION::HitTest( const wxPoint& aPoint )
int
ux0
,
uy0
;
int
ux0
,
uy0
;
int
dx
,
dy
,
spot_cX
,
spot_cY
;
int
dx
,
dy
,
spot_cX
,
spot_cY
;
if
(
m_Text
&&
m_Text
->
TextHitTest
(
aPoint
)
)
if
(
m_Text
.
TextHitTest
(
aPoint
)
)
return
true
;
return
true
;
/
* Locate SEGMENTS? */
/
/ Locate SEGMENTS?
ux0
=
m_crossBarOx
;
ux0
=
m_crossBarOx
;
uy0
=
m_crossBarOy
;
uy0
=
m_crossBarOy
;
/
* Recalculate coordinates with ux0, uy0 = origin. */
/
/ Recalculate coordinates with ux0, uy0 = origin.
dx
=
m_crossBarFx
-
ux0
;
dx
=
m_crossBarFx
-
ux0
;
dy
=
m_crossBarFy
-
uy0
;
dy
=
m_crossBarFy
-
uy0
;
...
@@ -533,7 +532,7 @@ EDA_RECT DIMENSION::GetBoundingBox() const
...
@@ -533,7 +532,7 @@ EDA_RECT DIMENSION::GetBoundingBox() const
EDA_RECT
bBox
;
EDA_RECT
bBox
;
int
xmin
,
xmax
,
ymin
,
ymax
;
int
xmin
,
xmax
,
ymin
,
ymax
;
bBox
=
m_Text
->
GetTextBox
(
-
1
);
bBox
=
m_Text
.
GetTextBox
(
-
1
);
xmin
=
bBox
.
GetX
();
xmin
=
bBox
.
GetX
();
xmax
=
bBox
.
GetRight
();
xmax
=
bBox
.
GetRight
();
ymin
=
bBox
.
GetY
();
ymin
=
bBox
.
GetY
();
...
...
pcbnew/class_dimension.h
View file @
96bb90de
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
* @brief DIMENSION class definition.
* @brief DIMENSION class definition.
*/
*/
#ifndef DIMENSION_H
#ifndef DIMENSION_H
_
#define DIMENSION_H
#define DIMENSION_H
_
#include "class_board_item.h"
#include "class_board_item.h"
...
@@ -21,10 +21,10 @@ public:
...
@@ -21,10 +21,10 @@ public:
int
m_Width
;
int
m_Width
;
wxPoint
m_Pos
;
wxPoint
m_Pos
;
int
m_Shape
;
int
m_Shape
;
int
m_Unit
;
/* 0 = inches, 1 = mm */
int
m_Unit
;
/// 0 = inches, 1 = mm
int
m_Value
;
/* value of PCB dimensions. */
int
m_Value
;
/// value of PCB dimensions.
TEXTE_PCB
*
m_Text
;
TEXTE_PCB
m_Text
;
int
m_crossBarOx
,
m_crossBarOy
,
m_crossBarFx
,
m_crossBarFy
;
int
m_crossBarOx
,
m_crossBarOy
,
m_crossBarFx
,
m_crossBarFy
;
int
m_featureLineGOx
,
m_featureLineGOy
,
m_featureLineGFx
,
m_featureLineGFy
;
int
m_featureLineGOx
,
m_featureLineGOy
,
m_featureLineGFx
,
m_featureLineGFy
;
int
m_featureLineDOx
,
m_featureLineDOy
,
m_featureLineDFx
,
m_featureLineDFy
;
int
m_featureLineDOx
,
m_featureLineDOy
,
m_featureLineDFx
,
m_featureLineDFy
;
...
@@ -43,7 +43,7 @@ public:
...
@@ -43,7 +43,7 @@ public:
void
SetTextSize
(
const
wxSize
&
aTextSize
)
void
SetTextSize
(
const
wxSize
&
aTextSize
)
{
{
m_Text
->
SetSize
(
aTextSize
);
m_Text
.
SetSize
(
aTextSize
);
}
}
/**
/**
...
@@ -53,6 +53,12 @@ public:
...
@@ -53,6 +53,12 @@ public:
*/
*/
void
SetLayer
(
int
aLayer
);
void
SetLayer
(
int
aLayer
);
void
SetShape
(
int
aShape
)
{
m_Shape
=
aShape
;
}
int
GetShape
()
const
{
return
m_Shape
;
}
int
GetWidth
()
const
{
return
m_Width
;
}
void
SetWidth
(
int
aWidth
)
{
m_Width
=
aWidth
;
}
/**
/**
* Function AdjustDimensionDetails
* Function AdjustDimensionDetails
* Calculate coordinates of segments used to draw the dimension.
* Calculate coordinates of segments used to draw the dimension.
...
@@ -90,7 +96,7 @@ public:
...
@@ -90,7 +96,7 @@ public:
* @param aRotCentre - the rotation point.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
* @param aAngle - the rotation angle in 0.1 degree.
*/
*/
virtual
void
Rotate
(
const
wxPoint
&
aRotCentre
,
int
aAngle
);
virtual
void
Rotate
(
const
wxPoint
&
aRotCentre
,
double
aAngle
);
/**
/**
* Function Flip
* Function Flip
...
@@ -151,4 +157,4 @@ public:
...
@@ -151,4 +157,4 @@ public:
virtual
BITMAP_DEF
GetMenuImage
()
const
{
return
add_dimension_xpm
;
}
virtual
BITMAP_DEF
GetMenuImage
()
const
{
return
add_dimension_xpm
;
}
};
};
#endif //
#define DIMENSION_H
#endif //
DIMENSION_H_
pcbnew/class_drawsegment.cpp
View file @
96bb90de
...
@@ -31,31 +31,40 @@ DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* aParent, KICAD_T idtype ) :
...
@@ -31,31 +31,40 @@ DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* aParent, KICAD_T idtype ) :
}
}
DRAWSEGMENT
::
~
DRAWSEGMENT
()
DRAWSEGMENT
::~
DRAWSEGMENT
()
{
{
}
}
const
DRAWSEGMENT
&
DRAWSEGMENT
::
operator
=
(
const
DRAWSEGMENT
&
rhs
)
{
// skip the linked list stuff, and parent
m_Type
=
rhs
.
m_Type
;
m_Layer
=
rhs
.
m_Layer
;
m_Width
=
rhs
.
m_Width
;
m_Start
=
rhs
.
m_Start
;
m_End
=
rhs
.
m_End
;
m_Shape
=
rhs
.
m_Shape
;
m_Angle
=
rhs
.
m_Angle
;
m_TimeStamp
=
rhs
.
m_TimeStamp
;
m_BezierC1
=
rhs
.
m_BezierC1
;
m_BezierC2
=
rhs
.
m_BezierC1
;
m_BezierPoints
=
rhs
.
m_BezierPoints
;
return
*
this
;
}
void
DRAWSEGMENT
::
Copy
(
DRAWSEGMENT
*
source
)
void
DRAWSEGMENT
::
Copy
(
DRAWSEGMENT
*
source
)
{
{
if
(
source
==
NULL
)
if
(
source
==
NULL
)
// who would do this?
return
;
return
;
m_Type
=
source
->
m_Type
;
*
this
=
*
source
;
// operator = ()
m_Layer
=
source
->
m_Layer
;
m_Width
=
source
->
m_Width
;
m_Start
=
source
->
m_Start
;
m_End
=
source
->
m_End
;
m_Shape
=
source
->
m_Shape
;
m_Angle
=
source
->
m_Angle
;
SetTimeStamp
(
source
->
m_TimeStamp
);
m_BezierC1
=
source
->
m_BezierC1
;
m_BezierC2
=
source
->
m_BezierC1
;
m_BezierPoints
=
source
->
m_BezierPoints
;
}
}
void
DRAWSEGMENT
::
Rotate
(
const
wxPoint
&
aRotCentre
,
double
aAngle
)
void
DRAWSEGMENT
::
Rotate
(
const
wxPoint
&
aRotCentre
,
int
aAngle
)
{
{
RotatePoint
(
&
m_Start
,
aRotCentre
,
aAngle
);
RotatePoint
(
&
m_Start
,
aRotCentre
,
aAngle
);
RotatePoint
(
&
m_End
,
aRotCentre
,
aAngle
);
RotatePoint
(
&
m_End
,
aRotCentre
,
aAngle
);
...
@@ -74,7 +83,26 @@ void DRAWSEGMENT::Flip( const wxPoint& aCentre )
...
@@ -74,7 +83,26 @@ void DRAWSEGMENT::Flip( const wxPoint& aCentre )
}
}
wxPoint
DRAWSEGMENT
::
GetStart
()
const
const
wxPoint
DRAWSEGMENT
::
GetArcEnd
()
const
{
wxPoint
endPoint
;
// start of arc
switch
(
m_Shape
)
{
case
S_ARC
:
// rotate the starting point of the arc, given by m_End, through the
// angle m_Angle to get the ending point of the arc.
// m_Start is the arc centre
endPoint
=
m_End
;
// m_End = start point of arc
RotatePoint
(
&
endPoint
,
m_Start
,
-
m_Angle
);
}
return
endPoint
;
// after rotation, the end of the arc.
}
/* use GetArcStart() now
const wxPoint DRAWSEGMENT::GetStart() const
{
{
switch( m_Shape )
switch( m_Shape )
{
{
...
@@ -88,7 +116,7 @@ wxPoint DRAWSEGMENT::GetStart() const
...
@@ -88,7 +116,7 @@ wxPoint DRAWSEGMENT::GetStart() const
}
}
wxPoint
DRAWSEGMENT
::
GetEnd
()
const
const
wxPoint DRAWSEGMENT::GetEnd() const
{
{
wxPoint endPoint; // start of arc
wxPoint endPoint; // start of arc
...
@@ -108,6 +136,7 @@ wxPoint DRAWSEGMENT::GetEnd() const
...
@@ -108,6 +136,7 @@ wxPoint DRAWSEGMENT::GetEnd() const
return m_End;
return m_End;
}
}
}
}
*/
void
DRAWSEGMENT
::
SetAngle
(
double
aAngle
)
void
DRAWSEGMENT
::
SetAngle
(
double
aAngle
)
...
...
pcbnew/class_drawsegment.h
View file @
96bb90de
...
@@ -18,34 +18,32 @@ class MODULE;
...
@@ -18,34 +18,32 @@ class MODULE;
class
DRAWSEGMENT
:
public
BOARD_ITEM
class
DRAWSEGMENT
:
public
BOARD_ITEM
{
{
p
ublic
:
p
rotected
:
int
m_Width
;
// thickness of lines ...
int
m_Width
;
//
/<
thickness of lines ...
wxPoint
m_Start
;
// Line start point or Circle and Arc center
wxPoint
m_Start
;
//
/<
Line start point or Circle and Arc center
wxPoint
m_End
;
// Line end point or circle and arc start point
wxPoint
m_End
;
//
/<
Line end point or circle and arc start point
int
m_Shape
;
// Shape: line, Circle, Arc
int
m_Shape
;
//
/<
Shape: line, Circle, Arc
int
m_Type
;
// Used in complex associations ( Dimensions.. )
int
m_Type
;
//
/<
Used in complex associations ( Dimensions.. )
int
m_Angle
;
//
Used only for Arcs: Arc angle in 1/10 deg
double
m_Angle
;
///<
Used only for Arcs: Arc angle in 1/10 deg
wxPoint
m_BezierC1
;
// Bezier Control Point 1
wxPoint
m_BezierC1
;
//
/<
Bezier Control Point 1
wxPoint
m_BezierC2
;
// Bezier Control Point 1
wxPoint
m_BezierC2
;
//
/<
Bezier Control Point 1
protected
:
std
::
vector
<
wxPoint
>
m_BezierPoints
;
std
::
vector
<
wxPoint
>
m_BezierPoints
;
std
::
vector
<
wxPoint
>
m_PolyPoints
;
std
::
vector
<
wxPoint
>
m_PolyPoints
;
public
:
public
:
DRAWSEGMENT
(
BOARD_ITEM
*
aParent
,
KICAD_T
idtype
=
PCB_LINE_T
);
DRAWSEGMENT
(
BOARD_ITEM
*
aParent
=
NULL
,
KICAD_T
idtype
=
PCB_LINE_T
);
~
DRAWSEGMENT
();
~
DRAWSEGMENT
();
/// skip the linked list stuff, and parent
const
DRAWSEGMENT
&
operator
=
(
const
DRAWSEGMENT
&
rhs
);
DRAWSEGMENT
*
Next
()
const
{
return
(
DRAWSEGMENT
*
)
Pnext
;
}
DRAWSEGMENT
*
Next
()
const
{
return
(
DRAWSEGMENT
*
)
Pnext
;
}
DRAWSEGMENT
*
Back
()
const
{
return
(
DRAWSEGMENT
*
)
Pback
;
}
DRAWSEGMENT
*
Back
()
const
{
return
(
DRAWSEGMENT
*
)
Pback
;
}
void
SetWidth
(
int
aWidth
)
{
m_Width
=
aWidth
;
}
void
SetWidth
(
int
aWidth
)
{
m_Width
=
aWidth
;
}
int
GetWidth
()
const
{
return
m_Width
;
}
int
GetWidth
()
const
{
return
m_Width
;
}
void
SetStart
(
const
wxPoint
&
aStart
)
{
m_Start
=
aStart
;
}
void
SetEnd
(
const
wxPoint
&
aEnd
)
{
m_End
=
aEnd
;
}
/**
/**
* Function SetAngle
* Function SetAngle
...
@@ -55,45 +53,52 @@ public:
...
@@ -55,45 +53,52 @@ public:
void
SetAngle
(
double
aAngle
);
// encapsulates the transition to degrees
void
SetAngle
(
double
aAngle
);
// encapsulates the transition to degrees
double
GetAngle
()
const
{
return
m_Angle
;
}
double
GetAngle
()
const
{
return
m_Angle
;
}
void
SetType
(
int
aType
)
{
m_Type
=
aType
;
}
void
SetType
(
int
aType
)
{
m_Type
=
aType
;
}
int
GetType
()
const
{
return
m_Type
;
}
void
SetShape
(
int
aShape
)
{
m_Shape
=
aShape
;
}
void
SetShape
(
int
aShape
)
{
m_Shape
=
aShape
;
}
int
GetShape
()
const
{
return
m_Shape
;
}
int
GetShape
()
const
{
return
m_Shape
;
}
void
SetBezControl1
(
const
wxPoint
&
aPoint
)
{
m_BezierC1
=
aPoint
;
}
void
SetBezControl1
(
const
wxPoint
&
aPoint
)
{
m_BezierC1
=
aPoint
;
}
void
SetBezControl2
(
const
wxPoint
&
aPoint
)
{
m_BezierC2
=
aPoint
;
}
const
wxPoint
&
GetBezControl1
()
const
{
return
m_BezierC1
;
}
/**
void
SetBezControl2
(
const
wxPoint
&
aPoint
)
{
m_BezierC2
=
aPoint
;
}
* Function GetPosition
const
wxPoint
&
GetBezControl2
()
const
{
return
m_BezierC2
;
}
* returns the position of this object.
* Required by pure virtual BOARD_ITEM::GetPosition()
* @return const wxPoint - The position of this object.
*/
const
wxPoint
GetPosition
()
const
{
return
m_Start
;
}
void
SetPosition
(
const
wxPoint
&
aPos
)
{
m_Start
=
aPos
;
}
void
SetPosition
(
const
wxPoint
&
aPos
)
{
m_Start
=
aPos
;
}
// override
const
wxPoint
GetPosition
()
const
{
return
m_Start
;
}
// override
/**
/**
* Function GetStart
* Function GetStart
* returns the starting point of the graphic
* returns the starting point of the graphic
*/
*/
wxPoint
GetStart
()
const
;
const
wxPoint
&
GetStart
()
const
{
return
m_Start
;
}
void
SetStart
(
const
wxPoint
&
aStart
)
{
m_Start
=
aStart
;
}
void
SetStartY
(
int
y
)
{
m_Start
.
y
=
y
;
}
void
SetStartX
(
int
x
)
{
m_Start
.
x
=
x
;
}
/**
/**
* Function GetEnd
* Function GetEnd
* returns the ending point of the graphic
* returns the ending point of the graphic
*/
*/
wxPoint
GetEnd
()
const
;
const
wxPoint
&
GetEnd
()
const
{
return
m_End
;
}
void
SetEnd
(
const
wxPoint
&
aEnd
)
{
m_End
=
aEnd
;
}
void
SetEndY
(
int
y
)
{
m_End
.
y
=
y
;
}
void
SetEndX
(
int
x
)
{
m_End
.
x
=
x
;
}
// Arc attributes are read only, since they are "calculated" from
// m_Start, m_End, and m_Angle. No Set...() functions.
const
wxPoint
&
GetCenter
()
const
{
return
m_Start
;
}
const
wxPoint
&
GetArcStart
()
const
{
return
m_End
;
}
const
wxPoint
GetArcEnd
()
const
;
/**
/**
* Function GetRadius
* Function GetRadius
* returns the radius of this item
* returns the radius of this item
* Has meaning only for arc and circle
* Has meaning only for arc and circle
*/
*/
int
GetRadius
()
const
int
GetRadius
()
const
{
{
double
radius
=
hypot
(
(
double
)
(
m_End
.
x
-
m_Start
.
x
),
(
double
)
(
m_End
.
y
-
m_Start
.
y
)
);
double
radius
=
hypot
(
(
double
)
(
m_End
.
x
-
m_Start
.
x
),
(
double
)
(
m_End
.
y
-
m_Start
.
y
)
);
return
wxRound
(
radius
);
return
wxRound
(
radius
);
...
@@ -132,7 +137,6 @@ public:
...
@@ -132,7 +137,6 @@ public:
void
Copy
(
DRAWSEGMENT
*
source
);
void
Copy
(
DRAWSEGMENT
*
source
);
void
Draw
(
EDA_DRAW_PANEL
*
panel
,
wxDC
*
DC
,
void
Draw
(
EDA_DRAW_PANEL
*
panel
,
wxDC
*
DC
,
int
aDrawMode
,
const
wxPoint
&
aOffset
=
ZeroOffset
);
int
aDrawMode
,
const
wxPoint
&
aOffset
=
ZeroOffset
);
...
@@ -145,7 +149,6 @@ public:
...
@@ -145,7 +149,6 @@ public:
*/
*/
virtual
void
DisplayInfo
(
EDA_DRAW_FRAME
*
frame
);
virtual
void
DisplayInfo
(
EDA_DRAW_FRAME
*
frame
);
/**
/**
* Function GetBoundingBox
* Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes.
* returns the orthogonal, bounding box of this object for display purposes.
...
@@ -155,7 +158,6 @@ public:
...
@@ -155,7 +158,6 @@ public:
*/
*/
virtual
EDA_RECT
GetBoundingBox
()
const
;
virtual
EDA_RECT
GetBoundingBox
()
const
;
/**
/**
* Function HitTest
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
* tests if the given wxPoint is within the bounds of this object.
...
@@ -183,7 +185,6 @@ public:
...
@@ -183,7 +185,6 @@ public:
return
wxT
(
"DRAWSEGMENT"
);
return
wxT
(
"DRAWSEGMENT"
);
}
}
/**
/**
* Function GetLength
* Function GetLength
* returns the length of the track using the hypotenuse calculation.
* returns the length of the track using the hypotenuse calculation.
...
@@ -196,7 +197,6 @@ public:
...
@@ -196,7 +197,6 @@ public:
return
hypot
(
double
(
delta
.
x
),
double
(
delta
.
y
)
);
return
hypot
(
double
(
delta
.
x
),
double
(
delta
.
y
)
);
}
}
/**
/**
* Function Move
* Function Move
* move this object.
* move this object.
...
@@ -208,14 +208,13 @@ public:
...
@@ -208,14 +208,13 @@ public:
m_End
+=
aMoveVector
;
m_End
+=
aMoveVector
;
}
}
/**
/**
* Function Rotate
* Function Rotate
* Rotate this object.
* Rotate this object.
* @param aRotCentre - the rotation point.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
* @param aAngle - the rotation angle in 0.1 degree.
*/
*/
virtual
void
Rotate
(
const
wxPoint
&
aRotCentre
,
int
aAngle
);
virtual
void
Rotate
(
const
wxPoint
&
aRotCentre
,
double
aAngle
);
/**
/**
* Function Flip
* Function Flip
...
...
pcbnew/class_edge_mod.h
View file @
96bb90de
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
* @brief EDGE_MODULE class definition.
* @brief EDGE_MODULE class definition.
*/
*/
#ifndef
_
CLASS_EDGE_MOD_H_
#ifndef CLASS_EDGE_MOD_H_
#define
_
CLASS_EDGE_MOD_H_
#define CLASS_EDGE_MOD_H_
#include "class_drawsegment.h"
#include "class_drawsegment.h"
...
@@ -29,7 +29,13 @@ public:
...
@@ -29,7 +29,13 @@ public:
EDGE_MODULE
*
Next
()
const
{
return
(
EDGE_MODULE
*
)
Pnext
;
}
EDGE_MODULE
*
Next
()
const
{
return
(
EDGE_MODULE
*
)
Pnext
;
}
EDGE_MODULE
*
Back
()
const
{
return
(
EDGE_MODULE
*
)
Pback
;
}
EDGE_MODULE
*
Back
()
const
{
return
(
EDGE_MODULE
*
)
Pback
;
}
void
Copy
(
EDGE_MODULE
*
source
);
// copy structure
void
Copy
(
EDGE_MODULE
*
source
);
// copy structure
void
SetStart0
(
const
wxPoint
&
aPoint
)
{
m_Start0
=
aPoint
;
}
const
wxPoint
&
GetStart0
()
const
{
return
m_Start0
;
}
void
SetEnd0
(
const
wxPoint
&
aPoint
)
{
m_End0
=
aPoint
;
}
const
wxPoint
&
GetEnd0
()
const
{
return
m_End0
;
}
/**
/**
* Function Save
* Function Save
...
@@ -88,4 +94,4 @@ public:
...
@@ -88,4 +94,4 @@ public:
#endif
#endif
};
};
#endif //
_
CLASS_EDGE_MOD_H_
#endif // CLASS_EDGE_MOD_H_
pcbnew/class_marker_pcb.cpp
View file @
96bb90de
...
@@ -80,25 +80,12 @@ void MARKER_PCB::DisplayInfo( EDA_DRAW_FRAME* frame )
...
@@ -80,25 +80,12 @@ void MARKER_PCB::DisplayInfo( EDA_DRAW_FRAME* frame )
}
}
/**
void
MARKER_PCB
::
Rotate
(
const
wxPoint
&
aRotCentre
,
double
aAngle
)
* Function Rotate
* Rotate this object.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
*/
void
MARKER_PCB
::
Rotate
(
const
wxPoint
&
aRotCentre
,
int
aAngle
)
{
{
RotatePoint
(
&
m_Pos
,
aRotCentre
,
aAngle
);
RotatePoint
(
&
m_Pos
,
aRotCentre
,
aAngle
);
}
}
/**
* Function Flip
* Flip this object, i.e. change the board side for this object
* this function has not really sense for a marker.
* It moves just the marker to keep its position on board, when the board is flipped
* @param aCentre - the rotation point.
*/
void
MARKER_PCB
::
Flip
(
const
wxPoint
&
aCentre
)
void
MARKER_PCB
::
Flip
(
const
wxPoint
&
aCentre
)
{
{
m_Pos
.
y
=
aCentre
.
y
-
(
m_Pos
.
y
-
aCentre
.
y
);
m_Pos
.
y
=
aCentre
.
y
-
(
m_Pos
.
y
-
aCentre
.
y
);
...
...
pcbnew/class_marker_pcb.h
View file @
96bb90de
...
@@ -59,7 +59,7 @@ public:
...
@@ -59,7 +59,7 @@ public:
* @param aRotCentre - the rotation point.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
* @param aAngle - the rotation angle in 0.1 degree.
*/
*/
virtual
void
Rotate
(
const
wxPoint
&
aRotCentre
,
int
aAngle
);
virtual
void
Rotate
(
const
wxPoint
&
aRotCentre
,
double
aAngle
);
/**
/**
* Function Flip
* Function Flip
...
...
pcbnew/class_mire.cpp
View file @
96bb90de
...
@@ -43,6 +43,15 @@ PCB_TARGET::~PCB_TARGET()
...
@@ -43,6 +43,15 @@ PCB_TARGET::~PCB_TARGET()
}
}
void
PCB_TARGET
::
Exchg
(
PCB_TARGET
*
source
)
{
EXCHG
(
m_Pos
,
source
->
m_Pos
);
EXCHG
(
m_Width
,
source
->
m_Width
);
EXCHG
(
m_Size
,
source
->
m_Size
);
EXCHG
(
m_Shape
,
source
->
m_Shape
);
}
void
PCB_TARGET
::
Copy
(
PCB_TARGET
*
source
)
void
PCB_TARGET
::
Copy
(
PCB_TARGET
*
source
)
{
{
m_Layer
=
source
->
m_Layer
;
m_Layer
=
source
->
m_Layer
;
...
@@ -143,12 +152,6 @@ bool PCB_TARGET::HitTest( const wxPoint& refPos )
...
@@ -143,12 +152,6 @@ bool PCB_TARGET::HitTest( const wxPoint& refPos )
}
}
/**
* Function HitTest (overlayed)
* tests if the given EDA_RECT intersect this object.
* @param refArea : the given EDA_RECT
* @return bool - true if a hit, else false
*/
bool
PCB_TARGET
::
HitTest
(
EDA_RECT
&
refArea
)
bool
PCB_TARGET
::
HitTest
(
EDA_RECT
&
refArea
)
{
{
if
(
refArea
.
Contains
(
m_Pos
)
)
if
(
refArea
.
Contains
(
m_Pos
)
)
...
@@ -158,23 +161,12 @@ bool PCB_TARGET::HitTest( EDA_RECT& refArea )
...
@@ -158,23 +161,12 @@ bool PCB_TARGET::HitTest( EDA_RECT& refArea )
}
}
/**
void
PCB_TARGET
::
Rotate
(
const
wxPoint
&
aRotCentre
,
double
aAngle
)
* Function Rotate
* Rotate this object.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
*/
void
PCB_TARGET
::
Rotate
(
const
wxPoint
&
aRotCentre
,
int
aAngle
)
{
{
RotatePoint
(
&
m_Pos
,
aRotCentre
,
aAngle
);
RotatePoint
(
&
m_Pos
,
aRotCentre
,
aAngle
);
}
}
/**
* Function Flip
* Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point.
*/
void
PCB_TARGET
::
Flip
(
const
wxPoint
&
aCentre
)
void
PCB_TARGET
::
Flip
(
const
wxPoint
&
aCentre
)
{
{
m_Pos
.
y
=
aCentre
.
y
-
(
m_Pos
.
y
-
aCentre
.
y
);
m_Pos
.
y
=
aCentre
.
y
-
(
m_Pos
.
y
-
aCentre
.
y
);
...
...
pcbnew/class_mire.h
View file @
96bb90de
...
@@ -17,11 +17,10 @@ class EDA_DRAW_PANEL;
...
@@ -17,11 +17,10 @@ class EDA_DRAW_PANEL;
class
PCB_TARGET
:
public
BOARD_ITEM
class
PCB_TARGET
:
public
BOARD_ITEM
{
{
public
:
int
m_Width
;
wxPoint
m_Pos
;
int
m_Shape
;
// bit 0 : 0 = draw +, 1 = draw X
int
m_Shape
;
// bit 0 : 0 = draw +, 1 = draw X
int
m_Size
;
int
m_Size
;
int
m_Width
;
wxPoint
m_Pos
;
public
:
public
:
PCB_TARGET
(
BOARD_ITEM
*
aParent
);
PCB_TARGET
(
BOARD_ITEM
*
aParent
);
...
@@ -33,12 +32,23 @@ public:
...
@@ -33,12 +32,23 @@ public:
PCB_TARGET
*
Next
()
const
{
return
(
PCB_TARGET
*
)
Pnext
;
}
PCB_TARGET
*
Next
()
const
{
return
(
PCB_TARGET
*
)
Pnext
;
}
PCB_TARGET
*
Back
()
const
{
return
(
PCB_TARGET
*
)
Pnext
;
}
PCB_TARGET
*
Back
()
const
{
return
(
PCB_TARGET
*
)
Pnext
;
}
const
wxPoint
GetPosition
()
const
void
SetPosition
(
const
wxPoint
&
aPos
)
{
m_Pos
=
aPos
;
}
// override
{
const
wxPoint
GetPosition
()
const
{
return
m_Pos
;
}
// override
return
m_Pos
;
}
void
SetPosition
(
const
wxPoint
&
aPos
)
{
m_Pos
=
aPos
;
}
void
SetShape
(
int
aShape
)
{
m_Shape
=
aShape
;
}
int
GetShape
()
const
{
return
m_Shape
;
}
void
SetSize
(
int
aSize
)
{
m_Size
=
aSize
;
}
int
GetSize
()
const
{
return
m_Size
;
}
void
SetWidth
(
int
aWidth
)
{
m_Width
=
aWidth
;
}
int
GetWidth
()
const
{
return
m_Width
;
}
/**
* Function Exchg
* swaps data with another PCB_TARGET for use by undo-redo.
*/
void
Exchg
(
PCB_TARGET
*
aTarget
);
/**
/**
* Function Move
* Function Move
...
@@ -56,7 +66,7 @@ public:
...
@@ -56,7 +66,7 @@ public:
* @param aRotCentre - the rotation point.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
* @param aAngle - the rotation angle in 0.1 degree.
*/
*/
virtual
void
Rotate
(
const
wxPoint
&
aRotCentre
,
int
aAngle
);
virtual
void
Rotate
(
const
wxPoint
&
aRotCentre
,
double
aAngle
);
/**
/**
* Function Flip
* Function Flip
...
@@ -80,7 +90,6 @@ public:
...
@@ -80,7 +90,6 @@ public:
void
Draw
(
EDA_DRAW_PANEL
*
panel
,
wxDC
*
DC
,
int
aDrawMode
,
void
Draw
(
EDA_DRAW_PANEL
*
panel
,
wxDC
*
DC
,
int
aDrawMode
,
const
wxPoint
&
offset
=
ZeroOffset
);
const
wxPoint
&
offset
=
ZeroOffset
);
/**
/**
* Function HitTest
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
* tests if the given wxPoint is within the bounds of this object.
...
...
pcbnew/class_module.h
View file @
96bb90de
...
@@ -43,7 +43,7 @@ class MODULE : public BOARD_ITEM
...
@@ -43,7 +43,7 @@ class MODULE : public BOARD_ITEM
{
{
public
:
public
:
int
m_Orient
;
// orientation in 0.1 degrees
double
m_Orient
;
// orientation in 0.1 degrees
wxPoint
m_Pos
;
// Real coord on board
wxPoint
m_Pos
;
// Real coord on board
DLIST
<
D_PAD
>
m_Pads
;
/* Pad list (linked list) */
DLIST
<
D_PAD
>
m_Pads
;
/* Pad list (linked list) */
DLIST
<
BOARD_ITEM
>
m_Drawings
;
/* Graphic items list (linked list) */
DLIST
<
BOARD_ITEM
>
m_Drawings
;
/* Graphic items list (linked list) */
...
@@ -142,15 +142,11 @@ public:
...
@@ -142,15 +142,11 @@ public:
*/
*/
EDA_RECT
GetBoundingBox
()
const
;
EDA_RECT
GetBoundingBox
()
const
;
const
wxPoint
GetPosition
()
const
// overload
void
SetPosition
(
const
wxPoint
&
aPos
);
// overload
{
const
wxPoint
GetPosition
()
const
{
return
m_Pos
;
}
// overload
return
m_Pos
;
}
void
SetPosition
(
const
wxPoint
&
aPos
);
// overload
void
SetOrientation
(
int
newangle
);
void
SetOrientation
(
double
newangle
);
int
GetOrientation
()
const
{
return
m_Orient
;
}
double
GetOrientation
()
const
{
return
m_Orient
;
}
const
wxString
&
GetLibRef
()
const
{
return
m_LibRef
;
}
const
wxString
&
GetLibRef
()
const
{
return
m_LibRef
;
}
void
SetLibRef
(
const
wxString
&
aLibRef
)
{
m_LibRef
=
aLibRef
;
}
void
SetLibRef
(
const
wxString
&
aLibRef
)
{
m_LibRef
=
aLibRef
;
}
...
@@ -192,7 +188,7 @@ public:
...
@@ -192,7 +188,7 @@ public:
* @param aRotCentre - the rotation point.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
* @param aAngle - the rotation angle in 0.1 degree.
*/
*/
virtual
void
Rotate
(
const
wxPoint
&
aRotCentre
,
int
aAngle
);
virtual
void
Rotate
(
const
wxPoint
&
aRotCentre
,
double
aAngle
);
/**
/**
* Function Flip
* Function Flip
...
...
pcbnew/class_module_transform_functions.cpp
View file @
96bb90de
...
@@ -127,25 +127,14 @@ int ChangeSideMaskLayer( int aMask )
...
@@ -127,25 +127,14 @@ int ChangeSideMaskLayer( int aMask )
}
}
/**
void
MODULE
::
Move
(
const
wxPoint
&
aMoveVector
)
* Function Move (virtual)
* move this object.
* @param aMoveVector - the move vector for this object.
*/
void
MODULE
::
Move
(
const
wxPoint
&
aMoveVector
)
{
{
wxPoint
newpos
=
m_Pos
+
aMoveVector
;
wxPoint
newpos
=
m_Pos
+
aMoveVector
;
SetPosition
(
newpos
);
SetPosition
(
newpos
);
}
}
/**
void
MODULE
::
Rotate
(
const
wxPoint
&
aRotCentre
,
double
aAngle
)
* Function Rotate
* Rotate this object.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
*/
void
MODULE
::
Rotate
(
const
wxPoint
&
aRotCentre
,
int
aAngle
)
{
{
wxPoint
newpos
=
m_Pos
;
wxPoint
newpos
=
m_Pos
;
RotatePoint
(
&
newpos
,
aRotCentre
,
aAngle
);
RotatePoint
(
&
newpos
,
aRotCentre
,
aAngle
);
...
@@ -154,48 +143,42 @@ void MODULE::Rotate(const wxPoint& aRotCentre, int aAngle)
...
@@ -154,48 +143,42 @@ void MODULE::Rotate(const wxPoint& aRotCentre, int aAngle)
}
}
/**
* Function Flip
* Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point.
*/
void
MODULE
::
Flip
(
const
wxPoint
&
aCentre
)
void
MODULE
::
Flip
(
const
wxPoint
&
aCentre
)
{
{
D_PAD
*
pt_pad
;
TEXTE_MODULE
*
pt_texte
;
TEXTE_MODULE
*
pt_texte
;
EDGE_MODULE
*
pt_edgmod
;
EDA_ITEM
*
PtStruct
;
// Move module to its final position:
// Move module to its final position:
wxPoint
finalPos
=
m_Pos
;
wxPoint
finalPos
=
m_Pos
;
finalPos
.
y
=
aCentre
.
y
-
(
finalPos
.
y
-
aCentre
.
y
);
/// Mirror the Y position
finalPos
.
y
=
aCentre
.
y
-
(
finalPos
.
y
-
aCentre
.
y
);
/// Mirror the Y position
SetPosition
(
finalPos
);
/* Flip layer */
SetPosition
(
finalPos
);
// Flip layer
SetLayer
(
ChangeSideNumLayer
(
GetLayer
()
)
);
SetLayer
(
ChangeSideNumLayer
(
GetLayer
()
)
);
/
* Reverse mirror orientation. */
/
/ Reverse mirror orientation.
NEGATE
(
m_Orient
);
NEGATE
(
m_Orient
);
NORMALIZE_ANGLE_POS
(
m_Orient
);
NORMALIZE_ANGLE_POS
(
m_Orient
);
/* Mirror inversion layers pads. */
// Mirror inversion layers pads.
pt_pad
=
m_Pads
;
for
(
D_PAD
*
pad
=
m_Pads
;
pad
;
pad
=
pad
->
Next
()
)
for
(
;
pt_pad
!=
NULL
;
pt_pad
=
pt_pad
->
Next
()
)
{
{
pt_pad
->
m_Pos
.
y
-=
m_Pos
.
y
;
pad
->
m_Pos
.
y
-=
m_Pos
.
y
;
pt_pad
->
m_Pos
.
y
=
-
pt_pad
->
m_Pos
.
y
;
pad
->
m_Pos
.
y
=
-
pad
->
m_Pos
.
y
;
pt_pad
->
m_Pos
.
y
+=
m_Pos
.
y
;
pad
->
m_Pos
.
y
+=
m_Pos
.
y
;
NEGATE
(
pt_pad
->
m_Pos0
.
y
);
NEGATE
(
pt_pad
->
m_Offset
.
y
);
NEGATE
(
pad
->
m_Pos0
.
y
);
NEGATE
(
pt_pad
->
m_DeltaSize
.
y
);
NEGATE
(
pad
->
m_Offset
.
y
);
NEGATE_AND_NORMALIZE_ANGLE_POS
(
pt_pad
->
m_Orient
);
NEGATE
(
pad
->
m_DeltaSize
.
y
);
/* flip pads layers*/
NEGATE_AND_NORMALIZE_ANGLE_POS
(
pad
->
m_Orient
);
pt_pad
->
m_layerMask
=
ChangeSideMaskLayer
(
pt_pad
->
m_layerMask
);
// flip pads layers
pad
->
m_layerMask
=
ChangeSideMaskLayer
(
pad
->
m_layerMask
);
}
}
/
* Mirror reference. */
/
/ Mirror reference.
pt_texte
=
m_Reference
;
pt_texte
=
m_Reference
;
pt_texte
->
m_Pos
.
y
-=
m_Pos
.
y
;
pt_texte
->
m_Pos
.
y
-=
m_Pos
.
y
;
pt_texte
->
m_Pos
.
y
=
-
pt_texte
->
m_Pos
.
y
;
pt_texte
->
m_Pos
.
y
=
-
pt_texte
->
m_Pos
.
y
;
...
@@ -216,7 +199,7 @@ void MODULE::Flip( const wxPoint& aCentre )
...
@@ -216,7 +199,7 @@ void MODULE::Flip( const wxPoint& aCentre )
||
(
GetLayer
()
==
ADHESIVE_N_BACK
)
||
(
GetLayer
()
==
LAYER_N_BACK
)
)
||
(
GetLayer
()
==
ADHESIVE_N_BACK
)
||
(
GetLayer
()
==
LAYER_N_BACK
)
)
pt_texte
->
m_Mirror
=
true
;
pt_texte
->
m_Mirror
=
true
;
/
* Mirror value. */
/
/ Mirror value.
pt_texte
=
m_Value
;
pt_texte
=
m_Value
;
pt_texte
->
m_Pos
.
y
-=
m_Pos
.
y
;
pt_texte
->
m_Pos
.
y
-=
m_Pos
.
y
;
NEGATE
(
pt_texte
->
m_Pos
.
y
);
NEGATE
(
pt_texte
->
m_Pos
.
y
);
...
@@ -237,33 +220,42 @@ void MODULE::Flip( const wxPoint& aCentre )
...
@@ -237,33 +220,42 @@ void MODULE::Flip( const wxPoint& aCentre )
||
(
GetLayer
()
==
ADHESIVE_N_BACK
)
||
(
GetLayer
()
==
LAYER_N_BACK
)
)
||
(
GetLayer
()
==
ADHESIVE_N_BACK
)
||
(
GetLayer
()
==
LAYER_N_BACK
)
)
pt_texte
->
m_Mirror
=
true
;
pt_texte
->
m_Mirror
=
true
;
/* Reverse mirror footprints. */
// Reverse mirror module graphics and texts.
PtStruct
=
m_Drawings
;
for
(
EDA_ITEM
*
item
=
m_Drawings
;
item
;
item
=
item
->
Next
()
)
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Next
()
)
{
{
switch
(
PtStruct
->
Type
()
)
switch
(
item
->
Type
()
)
{
{
case
PCB_MODULE_EDGE_T
:
case
PCB_MODULE_EDGE_T
:
pt_edgmod
=
(
EDGE_MODULE
*
)
PtStruct
;
pt_edgmod
->
m_Start
.
y
-=
m_Pos
.
y
;
pt_edgmod
->
m_Start
.
y
=
-
pt_edgmod
->
m_Start
.
y
;
pt_edgmod
->
m_Start
.
y
+=
m_Pos
.
y
;
pt_edgmod
->
m_End
.
y
-=
m_Pos
.
y
;
pt_edgmod
->
m_End
.
y
=
-
pt_edgmod
->
m_End
.
y
;
pt_edgmod
->
m_End
.
y
+=
m_Pos
.
y
;
NEGATE
(
pt_edgmod
->
m_Start0
.
y
);
NEGATE
(
pt_edgmod
->
m_End0
.
y
);
if
(
pt_edgmod
->
m_Shape
==
S_ARC
)
{
{
NEGATE
(
pt_edgmod
->
m_Angle
);
EDGE_MODULE
*
em
=
(
EDGE_MODULE
*
)
item
;
}
wxPoint
s
=
em
->
GetStart
();
s
.
y
-=
m_Pos
.
y
;
s
.
y
=
-
s
.
y
;
s
.
y
+=
m_Pos
.
y
;
em
->
SetStart
(
s
);
wxPoint
e
=
em
->
GetEnd
();
e
.
y
-=
m_Pos
.
y
;
e
.
y
=
-
e
.
y
;
e
.
y
+=
m_Pos
.
y
;
em
->
SetEnd
(
e
);
NEGATE
(
em
->
m_Start0
.
y
);
NEGATE
(
em
->
m_End0
.
y
);
if
(
em
->
GetShape
()
==
S_ARC
)
{
em
->
SetAngle
(
-
em
->
GetAngle
()
);
}
pt_edgmod
->
SetLayer
(
ChangeSideNumLayer
(
pt_edgmod
->
GetLayer
()
)
);
em
->
SetLayer
(
ChangeSideNumLayer
(
em
->
GetLayer
()
)
);
}
break
;
break
;
case
PCB_MODULE_TEXT_T
:
case
PCB_MODULE_TEXT_T
:
/
* Reverse mirror position and mirror. */
/
/ Reverse mirror position and mirror.
pt_texte
=
(
TEXTE_MODULE
*
)
PtStruct
;
pt_texte
=
(
TEXTE_MODULE
*
)
item
;
pt_texte
->
m_Pos
.
y
-=
m_Pos
.
y
;
pt_texte
->
m_Pos
.
y
-=
m_Pos
.
y
;
pt_texte
->
m_Pos
.
y
=
-
pt_texte
->
m_Pos
.
y
;
pt_texte
->
m_Pos
.
y
=
-
pt_texte
->
m_Pos
.
y
;
pt_texte
->
m_Pos
.
y
+=
m_Pos
.
y
;
pt_texte
->
m_Pos
.
y
+=
m_Pos
.
y
;
...
@@ -298,6 +290,7 @@ void MODULE::Flip( const wxPoint& aCentre )
...
@@ -298,6 +290,7 @@ void MODULE::Flip( const wxPoint& aCentre )
CalculateBoundingBox
();
CalculateBoundingBox
();
}
}
void
MODULE
::
SetPosition
(
const
wxPoint
&
newpos
)
void
MODULE
::
SetPosition
(
const
wxPoint
&
newpos
)
{
{
wxPoint
delta
=
newpos
-
m_Pos
;
wxPoint
delta
=
newpos
-
m_Pos
;
...
@@ -311,22 +304,20 @@ void MODULE::SetPosition( const wxPoint& newpos )
...
@@ -311,22 +304,20 @@ void MODULE::SetPosition( const wxPoint& newpos )
pad
->
m_Pos
+=
delta
;
pad
->
m_Pos
+=
delta
;
}
}
EDA_ITEM
*
PtStruct
=
m_Drawings
;
for
(
EDA_ITEM
*
item
=
m_Drawings
;
item
;
item
=
item
->
Next
()
)
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Next
()
)
{
{
switch
(
PtStruct
->
Type
()
)
switch
(
item
->
Type
()
)
{
{
case
PCB_MODULE_EDGE_T
:
case
PCB_MODULE_EDGE_T
:
{
{
EDGE_MODULE
*
pt_edgmod
=
(
EDGE_MODULE
*
)
PtStruct
;
EDGE_MODULE
*
pt_edgmod
=
(
EDGE_MODULE
*
)
item
;
pt_edgmod
->
SetDrawCoord
();
pt_edgmod
->
SetDrawCoord
();
break
;
break
;
}
}
case
PCB_MODULE_TEXT_T
:
case
PCB_MODULE_TEXT_T
:
{
{
TEXTE_MODULE
*
pt_texte
=
(
TEXTE_MODULE
*
)
PtStruct
;
TEXTE_MODULE
*
pt_texte
=
(
TEXTE_MODULE
*
)
item
;
pt_texte
->
m_Pos
+=
delta
;
pt_texte
->
m_Pos
+=
delta
;
break
;
break
;
}
}
...
@@ -341,13 +332,14 @@ void MODULE::SetPosition( const wxPoint& newpos )
...
@@ -341,13 +332,14 @@ void MODULE::SetPosition( const wxPoint& newpos )
}
}
void
MODULE
::
SetOrientation
(
int
newangle
)
void
MODULE
::
SetOrientation
(
double
newangle
)
{
{
int
px
,
py
;
int
px
,
py
;
newangle
-=
m_Orient
;
// = Change in rotation
newangle
-=
m_Orient
;
// = Change in rotation
m_Orient
+=
newangle
;
m_Orient
+=
newangle
;
NORMALIZE_ANGLE_POS
(
m_Orient
);
NORMALIZE_ANGLE_POS
(
m_Orient
);
for
(
D_PAD
*
pad
=
m_Pads
;
pad
;
pad
=
pad
->
Next
()
)
for
(
D_PAD
*
pad
=
m_Pads
;
pad
;
pad
=
pad
->
Next
()
)
...
@@ -355,7 +347,7 @@ void MODULE::SetOrientation( int newangle )
...
@@ -355,7 +347,7 @@ void MODULE::SetOrientation( int newangle )
px
=
pad
->
m_Pos0
.
x
;
px
=
pad
->
m_Pos0
.
x
;
py
=
pad
->
m_Pos0
.
y
;
py
=
pad
->
m_Pos0
.
y
;
pad
->
m_Orient
+=
newangle
;
/* change m_Orientation */
pad
->
m_Orient
+=
newangle
;
// change m_Orientation
NORMALIZE_ANGLE_POS
(
pad
->
m_Orient
);
NORMALIZE_ANGLE_POS
(
pad
->
m_Orient
);
RotatePoint
(
&
px
,
&
py
,
m_Orient
);
RotatePoint
(
&
px
,
&
py
,
m_Orient
);
...
@@ -363,11 +355,11 @@ void MODULE::SetOrientation( int newangle )
...
@@ -363,11 +355,11 @@ void MODULE::SetOrientation( int newangle )
pad
->
m_Pos
.
y
=
m_Pos
.
y
+
py
;
pad
->
m_Pos
.
y
=
m_Pos
.
y
+
py
;
}
}
/
* Update of the reference and value. */
/
/ Update of the reference and value.
m_Reference
->
SetDrawCoord
();
m_Reference
->
SetDrawCoord
();
m_Value
->
SetDrawCoord
();
m_Value
->
SetDrawCoord
();
/
* Displace contours and text of the footprint. */
/
/ Displace contours and text of the footprint.
for
(
BOARD_ITEM
*
item
=
m_Drawings
;
item
;
item
=
item
->
Next
()
)
for
(
BOARD_ITEM
*
item
=
m_Drawings
;
item
;
item
=
item
->
Next
()
)
{
{
if
(
item
->
Type
()
==
PCB_MODULE_EDGE_T
)
if
(
item
->
Type
()
==
PCB_MODULE_EDGE_T
)
...
@@ -376,7 +368,7 @@ void MODULE::SetOrientation( int newangle )
...
@@ -376,7 +368,7 @@ void MODULE::SetOrientation( int newangle )
pt_edgmod
->
SetDrawCoord
();
pt_edgmod
->
SetDrawCoord
();
}
}
if
(
item
->
Type
()
==
PCB_MODULE_TEXT_T
)
else
if
(
item
->
Type
()
==
PCB_MODULE_TEXT_T
)
{
{
TEXTE_MODULE
*
pt_texte
=
(
TEXTE_MODULE
*
)
item
;
TEXTE_MODULE
*
pt_texte
=
(
TEXTE_MODULE
*
)
item
;
pt_texte
->
SetDrawCoord
();
pt_texte
->
SetDrawCoord
();
...
...
pcbnew/class_pcb_text.cpp
View file @
96bb90de
...
@@ -56,12 +56,6 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source )
...
@@ -56,12 +56,6 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source )
}
}
/*
* Function Draw
* Like tracks, texts are drawn in filled or sketch mode, never in line mode
* because the line mode does not keep the actual size of the text
* and the actual size is very important, especially for copper texts
*/
void
TEXTE_PCB
::
Draw
(
EDA_DRAW_PANEL
*
panel
,
wxDC
*
DC
,
void
TEXTE_PCB
::
Draw
(
EDA_DRAW_PANEL
*
panel
,
wxDC
*
DC
,
int
DrawMode
,
const
wxPoint
&
offset
)
int
DrawMode
,
const
wxPoint
&
offset
)
{
{
...
@@ -85,7 +79,6 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
...
@@ -85,7 +79,6 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
}
}
// see class_pcb_text.h
void
TEXTE_PCB
::
DisplayInfo
(
EDA_DRAW_FRAME
*
frame
)
void
TEXTE_PCB
::
DisplayInfo
(
EDA_DRAW_FRAME
*
frame
)
{
{
wxString
msg
;
wxString
msg
;
...
@@ -130,13 +123,7 @@ void TEXTE_PCB::DisplayInfo( EDA_DRAW_FRAME* frame )
...
@@ -130,13 +123,7 @@ void TEXTE_PCB::DisplayInfo( EDA_DRAW_FRAME* frame )
}
}
/**
void
TEXTE_PCB
::
Rotate
(
const
wxPoint
&
aRotCentre
,
double
aAngle
)
* Function Rotate
* Rotate this object.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
*/
void
TEXTE_PCB
::
Rotate
(
const
wxPoint
&
aRotCentre
,
int
aAngle
)
{
{
RotatePoint
(
&
m_Pos
,
aRotCentre
,
aAngle
);
RotatePoint
(
&
m_Pos
,
aRotCentre
,
aAngle
);
m_Orient
+=
aAngle
;
m_Orient
+=
aAngle
;
...
@@ -144,11 +131,6 @@ void TEXTE_PCB::Rotate(const wxPoint& aRotCentre, int aAngle)
...
@@ -144,11 +131,6 @@ void TEXTE_PCB::Rotate(const wxPoint& aRotCentre, int aAngle)
}
}
/**
* Function Flip
* Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point.
*/
void
TEXTE_PCB
::
Flip
(
const
wxPoint
&
aCentre
)
void
TEXTE_PCB
::
Flip
(
const
wxPoint
&
aCentre
)
{
{
m_Pos
.
y
=
aCentre
.
y
-
(
m_Pos
.
y
-
aCentre
.
y
);
m_Pos
.
y
=
aCentre
.
y
-
(
m_Pos
.
y
-
aCentre
.
y
);
...
...
pcbnew/class_pcb_text.h
View file @
96bb90de
...
@@ -47,7 +47,7 @@ public:
...
@@ -47,7 +47,7 @@ public:
* @param aRotCentre - the rotation point.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
* @param aAngle - the rotation angle in 0.1 degree.
*/
*/
virtual
void
Rotate
(
const
wxPoint
&
aRotCentre
,
int
aAngle
);
virtual
void
Rotate
(
const
wxPoint
&
aRotCentre
,
double
aAngle
);
/**
/**
* Function Flip
* Function Flip
...
...
pcbnew/class_track.cpp
View file @
96bb90de
...
@@ -186,7 +186,7 @@ wxString SEGVIA::GetSelectMenuText() const
...
@@ -186,7 +186,7 @@ wxString SEGVIA::GetSelectMenuText() const
text
<<
_
(
"Via"
)
<<
wxT
(
" "
)
<<
ShowWidth
();
text
<<
_
(
"Via"
)
<<
wxT
(
" "
)
<<
ShowWidth
();
int
shape
=
Shape
();
int
shape
=
Get
Shape
();
if
(
shape
==
VIA_BLIND_BURIED
)
if
(
shape
==
VIA_BLIND_BURIED
)
text
<<
wxT
(
" "
)
<<
_
(
"Blind/Buried"
);
text
<<
wxT
(
" "
)
<<
_
(
"Blind/Buried"
);
...
@@ -231,7 +231,7 @@ TRACK::TRACK( const TRACK& Source ) :
...
@@ -231,7 +231,7 @@ TRACK::TRACK( const TRACK& Source ) :
m_Flags
=
Source
.
m_Flags
;
m_Flags
=
Source
.
m_Flags
;
SetTimeStamp
(
Source
.
m_TimeStamp
);
SetTimeStamp
(
Source
.
m_TimeStamp
);
SetStatus
(
Source
.
Return
Status
()
);
SetStatus
(
Source
.
Get
Status
()
);
m_Start
=
Source
.
m_Start
;
m_Start
=
Source
.
m_Start
;
m_End
=
Source
.
m_End
;
m_End
=
Source
.
m_End
;
m_Width
=
Source
.
m_Width
;
m_Width
=
Source
.
m_Width
;
...
@@ -390,7 +390,7 @@ EDA_RECT TRACK::GetBoundingBox() const
...
@@ -390,7 +390,7 @@ EDA_RECT TRACK::GetBoundingBox() const
}
}
void
TRACK
::
Rotate
(
const
wxPoint
&
aRotCentre
,
int
aAngle
)
void
TRACK
::
Rotate
(
const
wxPoint
&
aRotCentre
,
double
aAngle
)
{
{
RotatePoint
(
&
m_Start
,
aRotCentre
,
aAngle
);
RotatePoint
(
&
m_Start
,
aRotCentre
,
aAngle
);
RotatePoint
(
&
m_End
,
aRotCentre
,
aAngle
);
RotatePoint
(
&
m_End
,
aRotCentre
,
aAngle
);
...
@@ -451,7 +451,7 @@ int TRACK::ReturnMaskLayer() const
...
@@ -451,7 +451,7 @@ int TRACK::ReturnMaskLayer() const
{
{
if
(
Type
()
==
PCB_VIA_T
)
if
(
Type
()
==
PCB_VIA_T
)
{
{
int
via_type
=
Shape
();
int
via_type
=
Get
Shape
();
if
(
via_type
==
VIA_THROUGH
)
if
(
via_type
==
VIA_THROUGH
)
return
ALL_CU_LAYERS
;
return
ALL_CU_LAYERS
;
...
@@ -481,7 +481,7 @@ int TRACK::ReturnMaskLayer() const
...
@@ -481,7 +481,7 @@ int TRACK::ReturnMaskLayer() const
void
SEGVIA
::
SetLayerPair
(
int
top_layer
,
int
bottom_layer
)
void
SEGVIA
::
SetLayerPair
(
int
top_layer
,
int
bottom_layer
)
{
{
if
(
Shape
()
==
VIA_THROUGH
)
if
(
Get
Shape
()
==
VIA_THROUGH
)
{
{
top_layer
=
LAYER_N_FRONT
;
top_layer
=
LAYER_N_FRONT
;
bottom_layer
=
LAYER_N_BACK
;
bottom_layer
=
LAYER_N_BACK
;
...
@@ -499,7 +499,7 @@ void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer ) const
...
@@ -499,7 +499,7 @@ void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer ) const
int
b_layer
=
LAYER_N_BACK
;
int
b_layer
=
LAYER_N_BACK
;
int
t_layer
=
LAYER_N_FRONT
;
int
t_layer
=
LAYER_N_FRONT
;
if
(
Shape
()
!=
VIA_THROUGH
)
if
(
Get
Shape
()
!=
VIA_THROUGH
)
{
{
b_layer
=
(
m_Layer
>>
4
)
&
15
;
b_layer
=
(
m_Layer
>>
4
)
&
15
;
t_layer
=
m_Layer
&
15
;
t_layer
=
m_Layer
&
15
;
...
@@ -888,7 +888,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
...
@@ -888,7 +888,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
// for Micro Vias, draw a partial cross : X on component layer, or + on copper layer
// for Micro Vias, draw a partial cross : X on component layer, or + on copper layer
// (so we can see 2 superimposed microvias ):
// (so we can see 2 superimposed microvias ):
if
(
Shape
()
==
VIA_MICROVIA
)
if
(
Get
Shape
()
==
VIA_MICROVIA
)
{
{
int
ax
,
ay
,
bx
,
by
;
int
ax
,
ay
,
bx
,
by
;
...
@@ -926,7 +926,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
...
@@ -926,7 +926,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
// for Buried Vias, draw a partial line : orient depending on layer pair
// for Buried Vias, draw a partial line : orient depending on layer pair
// (so we can see superimposed buried vias ):
// (so we can see superimposed buried vias ):
if
(
Shape
()
==
VIA_BLIND_BURIED
)
if
(
Get
Shape
()
==
VIA_BLIND_BURIED
)
{
{
int
ax
=
0
,
ay
=
radius
,
bx
=
0
,
by
=
drill_radius
;
int
ax
=
0
,
ay
=
radius
,
bx
=
0
,
by
=
drill_radius
;
int
layer_top
,
layer_bottom
;
int
layer_top
,
layer_bottom
;
...
@@ -1041,7 +1041,7 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame )
...
@@ -1041,7 +1041,7 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame )
switch
(
Type
()
)
switch
(
Type
()
)
{
{
case
PCB_VIA_T
:
case
PCB_VIA_T
:
switch
(
Shape
()
)
switch
(
Get
Shape
()
)
{
{
default
:
default
:
case
0
:
case
0
:
...
@@ -1593,7 +1593,7 @@ void SEGVIA::Show( int nestLevel, std::ostream& os )
...
@@ -1593,7 +1593,7 @@ void SEGVIA::Show( int nestLevel, std::ostream& os )
{
{
const
char
*
cp
;
const
char
*
cp
;
switch
(
Shape
()
)
switch
(
Get
Shape
()
)
{
{
case
VIA_THROUGH
:
case
VIA_THROUGH
:
cp
=
"through"
;
cp
=
"through"
;
...
...
pcbnew/class_track.h
View file @
96bb90de
...
@@ -67,7 +67,7 @@ public:
...
@@ -67,7 +67,7 @@ public:
std
::
vector
<
TRACK
*>
m_TracksConnected
;
// list of other tracks connected to me
std
::
vector
<
TRACK
*>
m_TracksConnected
;
// list of other tracks connected to me
std
::
vector
<
D_PAD
*>
m_PadsConnected
;
// list of pads connected to me
std
::
vector
<
D_PAD
*>
m_PadsConnected
;
// list of pads connected to me
int
m_Param
;
// Auxiliary variable ( used in some computations )
double
m_Param
;
// Auxiliary variable ( used in some computations )
protected
:
protected
:
TRACK
(
const
TRACK
&
track
);
// protected so Copy() is used instead.
TRACK
(
const
TRACK
&
track
);
// protected so Copy() is used instead.
...
@@ -110,7 +110,7 @@ public:
...
@@ -110,7 +110,7 @@ public:
* @param aRotCentre - the rotation point.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
* @param aAngle - the rotation angle in 0.1 degree.
*/
*/
virtual
void
Rotate
(
const
wxPoint
&
aRotCentre
,
int
aAngle
);
virtual
void
Rotate
(
const
wxPoint
&
aRotCentre
,
double
aAngle
);
/**
/**
* Function Flip
* Function Flip
...
@@ -119,17 +119,17 @@ public:
...
@@ -119,17 +119,17 @@ public:
*/
*/
virtual
void
Flip
(
const
wxPoint
&
aCentre
);
virtual
void
Flip
(
const
wxPoint
&
aCentre
);
const
wxPoint
GetPosition
()
const
// overload
void
SetPosition
(
const
wxPoint
&
aPos
)
{
m_Start
=
aPos
;
}
// overload
{
const
wxPoint
GetPosition
()
const
{
return
m_Start
;
}
// overload
return
m_Start
;
// it had to be start or end.
}
int
GetWidth
()
const
{
return
m_
Width
;
}
void
SetWidth
(
int
aWidth
)
{
m_Width
=
a
Width
;
}
void
SetWidth
(
int
aWidth
)
{
m_Width
=
a
Width
;
}
int
GetWidth
()
const
{
return
m_
Width
;
}
void
SetPosition
(
const
wxPoint
&
aPos
)
{
m_Start
=
aPos
;
}
// overload
void
SetEnd
(
const
wxPoint
&
aEnd
)
{
m_End
=
aEnd
;
}
const
wxPoint
&
GetEnd
()
const
{
return
m_End
;
}
void
SetEnd
(
const
wxPoint
&
aEnd
)
{
m_End
=
aEnd
;
}
void
SetStart
(
const
wxPoint
&
aStart
)
{
m_Start
=
aStart
;
}
const
wxPoint
&
GetStart
()
const
{
return
m_Start
;
}
EDA_RECT
GetBoundingBox
()
const
;
EDA_RECT
GetBoundingBox
()
const
;
...
@@ -168,8 +168,8 @@ public:
...
@@ -168,8 +168,8 @@ public:
*/
*/
double
GetLength
()
const
double
GetLength
()
const
{
{
int
dx
=
m_Start
.
x
-
m_End
.
x
;
double
dx
=
m_Start
.
x
-
m_End
.
x
;
int
dy
=
m_Start
.
y
-
m_End
.
y
;
double
dy
=
m_Start
.
y
-
m_End
.
y
;
return
hypot
(
dx
,
dy
);
return
hypot
(
dx
,
dy
);
}
}
...
@@ -179,7 +179,7 @@ public:
...
@@ -179,7 +179,7 @@ public:
const
wxPoint
&
aOffset
=
ZeroOffset
);
const
wxPoint
&
aOffset
=
ZeroOffset
);
/* divers */
/* divers */
int
Shape
()
const
{
return
m_Shape
&
0xFF
;
}
int
Get
Shape
()
const
{
return
m_Shape
&
0xFF
;
}
void
SetShape
(
int
aShape
)
{
m_Shape
=
aShape
;
}
void
SetShape
(
int
aShape
)
{
m_Shape
=
aShape
;
}
/**
/**
...
@@ -203,26 +203,34 @@ public:
...
@@ -203,26 +203,34 @@ public:
* Set the drill value for vias
* Set the drill value for vias
* @param drill_value = new drill value
* @param drill_value = new drill value
*/
*/
void
SetDrillValue
(
int
drill_value
)
{
m_Drill
=
drill_value
;
}
void
SetDrill
(
int
aDrill
)
{
m_Drill
=
aDrill
;
}
/**
* Function GetDrill
* returns the local drill setting for this VIA. If you want the calculated value,
* use GetDrillValue() instead.
*/
int
GetDrill
()
const
{
return
m_Drill
;
}
/**
* Function GetDrillValue
* "calculates" the drill value for vias (m-Drill if > 0, or default
* drill value for the board.
* @return real drill_value
*/
int
GetDrillValue
()
const
;
/**
/**
* Function SetDrillDefault
* Function SetDrillDefault
* Set the drill value for vias at default value (-1)
* Set the drill value for vias at default value (-1)
*/
*/
void
SetDrillDefault
(
void
)
{
m_Drill
=
-
1
;
}
void
SetDrillDefault
(
)
{
m_Drill
=
-
1
;
}
/**
/**
* Function IsDrillDefault
* Function IsDrillDefault
* @return true if the drill value is default value (-1)
* @return true if the drill value is default value (-1)
*/
*/
bool
IsDrillDefault
(
void
)
{
return
m_Drill
<=
0
;
}
bool
IsDrillDefault
()
{
return
m_Drill
<=
0
;
}
/**
* Function GetDrillValue
* calculate the drill value for vias (m-Drill if > 0, or default drill value for the board
* @return real drill_value
*/
int
GetDrillValue
()
const
;
/**
/**
* Function ReturnMaskLayer
* Function ReturnMaskLayer
...
...
pcbnew/class_zone.cpp
View file @
96bb90de
...
@@ -737,7 +737,7 @@ void ZONE_CONTAINER::MoveEdge( const wxPoint& offset )
...
@@ -737,7 +737,7 @@ void ZONE_CONTAINER::MoveEdge( const wxPoint& offset )
}
}
void
ZONE_CONTAINER
::
Rotate
(
const
wxPoint
&
centre
,
int
angle
)
void
ZONE_CONTAINER
::
Rotate
(
const
wxPoint
&
centre
,
double
angle
)
{
{
wxPoint
pos
;
wxPoint
pos
;
...
...
pcbnew/class_zone.h
View file @
96bb90de
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
* @brief Classes to handle copper zones
* @brief Classes to handle copper zones
*/
*/
#ifndef CLASS_ZONE_H
#ifndef CLASS_ZONE_H
_
#define CLASS_ZONE_H
#define CLASS_ZONE_H
_
#include <vector>
#include <vector>
...
@@ -41,7 +41,7 @@ struct SEGMENT
...
@@ -41,7 +41,7 @@ struct SEGMENT
m_Start
=
aStart
;
m_Start
=
aStart
;
m_End
=
aEnd
;
m_End
=
aEnd
;
}
}
};
};
/**
/**
...
@@ -103,7 +103,6 @@ private:
...
@@ -103,7 +103,6 @@ private:
public
:
public
:
ZONE_CONTAINER
(
BOARD
*
parent
);
ZONE_CONTAINER
(
BOARD
*
parent
);
~
ZONE_CONTAINER
();
~
ZONE_CONTAINER
();
bool
Save
(
FILE
*
aFile
)
const
;
bool
Save
(
FILE
*
aFile
)
const
;
...
@@ -224,9 +223,9 @@ public:
...
@@ -224,9 +223,9 @@ public:
/**
/**
* Function GetNetName
* Function GetNetName
* returns the net name.
* returns the net name.
* @return
wxString
- The net name.
* @return
const wxString&
- The net name.
*/
*/
wxString
GetNetName
()
const
{
return
m_Netname
;
};
const
wxString
&
GetNetName
()
const
{
return
m_Netname
;
};
void
SetNetName
(
const
wxString
&
aName
)
{
m_Netname
=
aName
;
}
void
SetNetName
(
const
wxString
&
aName
)
{
m_Netname
=
aName
;
}
void
SetFillMode
(
int
aFillMode
)
{
m_FillMode
=
aFillMode
;
}
void
SetFillMode
(
int
aFillMode
)
{
m_FillMode
=
aFillMode
;
}
...
@@ -392,7 +391,7 @@ public:
...
@@ -392,7 +391,7 @@ public:
* @param centre = rot centre
* @param centre = rot centre
* @param angle = in 0.1 degree
* @param angle = in 0.1 degree
*/
*/
void
Rotate
(
const
wxPoint
&
centre
,
int
angle
);
void
Rotate
(
const
wxPoint
&
centre
,
double
angle
);
/**
/**
* Function Flip
* Function Flip
...
@@ -420,10 +419,10 @@ public:
...
@@ -420,10 +419,10 @@ public:
return
wxT
(
"ZONE_CONTAINER"
);
return
wxT
(
"ZONE_CONTAINER"
);
}
}
/** Access to m_Poly parameters
/** Access to m_Poly parameters
*/
*/
int
GetNumCorners
(
void
)
const
int
GetNumCorners
(
void
)
const
{
{
return
m_Poly
->
GetNumCorners
();
return
m_Poly
->
GetNumCorners
();
...
@@ -500,4 +499,4 @@ public:
...
@@ -500,4 +499,4 @@ public:
};
};
#endif //
#ifndef CLASS_ZONE_H
#endif //
CLASS_ZONE_H_
pcbnew/clean.cpp
View file @
96bb90de
...
@@ -121,7 +121,7 @@ void clean_vias( BOARD * aPcb )
...
@@ -121,7 +121,7 @@ void clean_vias( BOARD * aPcb )
for
(
track
=
aPcb
->
m_Track
;
track
;
track
=
track
->
Next
()
)
for
(
track
=
aPcb
->
m_Track
;
track
;
track
=
track
->
Next
()
)
{
{
if
(
track
->
Shape
()
!=
VIA_THROUGH
)
if
(
track
->
Get
Shape
()
!=
VIA_THROUGH
)
continue
;
continue
;
// Search and delete others vias at same location
// Search and delete others vias at same location
...
...
pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp
View file @
96bb90de
...
@@ -73,7 +73,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
...
@@ -73,7 +73,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
(
m_CurrentModule
->
GetLayer
()
==
LAYER_N_BACK
)
?
1
:
0
);
(
m_CurrentModule
->
GetLayer
()
==
LAYER_N_BACK
)
?
1
:
0
);
bool
select
=
FALSE
;
bool
select
=
FALSE
;
switch
(
m_CurrentModule
->
m_Orient
)
switch
(
(
int
)
m_CurrentModule
->
GetOrientation
()
)
{
{
case
0
:
case
0
:
m_OrientCtrl
->
SetSelection
(
0
);
m_OrientCtrl
->
SetSelection
(
0
);
...
...
pcbnew/dialogs/dialog_gendrill.cpp
View file @
96bb90de
...
@@ -164,11 +164,11 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
...
@@ -164,11 +164,11 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
if
(
track
->
Type
()
!=
PCB_VIA_T
)
if
(
track
->
Type
()
!=
PCB_VIA_T
)
continue
;
continue
;
if
(
track
->
Shape
()
==
VIA_THROUGH
)
if
(
track
->
Get
Shape
()
==
VIA_THROUGH
)
m_throughViasCount
++
;
m_throughViasCount
++
;
else
if
(
track
->
Shape
()
==
VIA_MICROVIA
)
else
if
(
track
->
Get
Shape
()
==
VIA_MICROVIA
)
m_microViasCount
++
;
m_microViasCount
++
;
else
if
(
track
->
Shape
()
==
VIA_BLIND_BURIED
)
else
if
(
track
->
Get
Shape
()
==
VIA_BLIND_BURIED
)
m_blindOrBuriedViasCount
++
;
m_blindOrBuriedViasCount
++
;
}
}
...
...
pcbnew/dialogs/dialog_graphic_item_properties.cpp
View file @
96bb90de
...
@@ -90,7 +90,7 @@ void DialogGraphicItemProperties::initDlg( )
...
@@ -90,7 +90,7 @@ void DialogGraphicItemProperties::initDlg( )
wxString
msg
;
wxString
msg
;
// Change texts according to the segment shape:
// Change texts according to the segment shape:
switch
(
m_Item
->
m_Shape
)
switch
(
m_Item
->
GetShape
()
)
{
{
case
S_CIRCLE
:
case
S_CIRCLE
:
m_Start_Center_XText
->
SetLabel
(
_
(
"Center X"
));
m_Start_Center_XText
->
SetLabel
(
_
(
"Center X"
));
...
@@ -106,7 +106,7 @@ void DialogGraphicItemProperties::initDlg( )
...
@@ -106,7 +106,7 @@ void DialogGraphicItemProperties::initDlg( )
m_Start_Center_YText
->
SetLabel
(
_
(
"Center Y"
));
m_Start_Center_YText
->
SetLabel
(
_
(
"Center Y"
));
m_EndX_Radius_Text
->
SetLabel
(
_
(
"Start Point X"
));
m_EndX_Radius_Text
->
SetLabel
(
_
(
"Start Point X"
));
m_EndY_Text
->
SetLabel
(
_
(
"Start Point Y"
));
m_EndY_Text
->
SetLabel
(
_
(
"Start Point Y"
));
msg
<<
m_Item
->
m_Angle
;
msg
<<
m_Item
->
GetAngle
()
;
m_Angle_Ctrl
->
SetValue
(
msg
);
m_Angle_Ctrl
->
SetValue
(
msg
);
break
;
break
;
...
@@ -118,23 +118,23 @@ void DialogGraphicItemProperties::initDlg( )
...
@@ -118,23 +118,23 @@ void DialogGraphicItemProperties::initDlg( )
AddUnitSymbol
(
*
m_Start_Center_XText
);
AddUnitSymbol
(
*
m_Start_Center_XText
);
PutValueInLocalUnits
(
*
m_Center_StartXCtrl
,
m_Item
->
m_Start
.
x
,
PutValueInLocalUnits
(
*
m_Center_StartXCtrl
,
m_Item
->
GetStart
()
.
x
,
m_Parent
->
m_InternalUnits
);
m_Parent
->
m_InternalUnits
);
AddUnitSymbol
(
*
m_Start_Center_YText
);
AddUnitSymbol
(
*
m_Start_Center_YText
);
PutValueInLocalUnits
(
*
m_Center_StartYCtrl
,
m_Item
->
m_Start
.
y
,
PutValueInLocalUnits
(
*
m_Center_StartYCtrl
,
m_Item
->
GetStart
()
.
y
,
m_Parent
->
m_InternalUnits
);
m_Parent
->
m_InternalUnits
);
AddUnitSymbol
(
*
m_EndX_Radius_Text
);
AddUnitSymbol
(
*
m_EndX_Radius_Text
);
PutValueInLocalUnits
(
*
m_EndX_Radius_Ctrl
,
m_Item
->
m_End
.
x
,
PutValueInLocalUnits
(
*
m_EndX_Radius_Ctrl
,
m_Item
->
GetEnd
()
.
x
,
m_Parent
->
m_InternalUnits
);
m_Parent
->
m_InternalUnits
);
AddUnitSymbol
(
*
m_EndY_Text
);
AddUnitSymbol
(
*
m_EndY_Text
);
PutValueInLocalUnits
(
*
m_EndY_Ctrl
,
m_Item
->
m_End
.
y
,
PutValueInLocalUnits
(
*
m_EndY_Ctrl
,
m_Item
->
GetEnd
()
.
y
,
m_Parent
->
m_InternalUnits
);
m_Parent
->
m_InternalUnits
);
AddUnitSymbol
(
*
m_ItemThicknessText
);
AddUnitSymbol
(
*
m_ItemThicknessText
);
PutValueInLocalUnits
(
*
m_ThicknessCtrl
,
m_Item
->
m_Width
,
PutValueInLocalUnits
(
*
m_ThicknessCtrl
,
m_Item
->
GetWidth
()
,
m_Parent
->
m_InternalUnits
);
m_Parent
->
m_InternalUnits
);
AddUnitSymbol
(
*
m_DefaultThicknessText
);
AddUnitSymbol
(
*
m_DefaultThicknessText
);
...
@@ -192,28 +192,22 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event )
...
@@ -192,28 +192,22 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event )
m_Item
->
Draw
(
m_Parent
->
DrawPanel
,
m_DC
,
GR_XOR
);
m_Item
->
Draw
(
m_Parent
->
DrawPanel
,
m_DC
,
GR_XOR
);
msg
=
m_Center_StartXCtrl
->
GetValue
();
msg
=
m_Center_StartXCtrl
->
GetValue
();
m_Item
->
m_Start
.
x
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_Item
->
SetStartX
(
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_Parent
->
m_InternalUnits
));
m_Parent
->
m_InternalUnits
);
msg
=
m_Center_StartYCtrl
->
GetValue
();
msg
=
m_Center_StartYCtrl
->
GetValue
();
m_Item
->
m_Start
.
y
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_Item
->
SetStartY
(
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_Parent
->
m_InternalUnits
));
m_Parent
->
m_InternalUnits
);
msg
=
m_EndX_Radius_Ctrl
->
GetValue
();
msg
=
m_EndX_Radius_Ctrl
->
GetValue
();
m_Item
->
m_End
.
x
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_Item
->
SetEndX
(
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_Parent
->
m_InternalUnits
));
m_Parent
->
m_InternalUnits
);
msg
=
m_EndY_Ctrl
->
GetValue
();
msg
=
m_EndY_Ctrl
->
GetValue
();
m_Item
->
m_End
.
y
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_Item
->
SetEndY
(
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_Parent
->
m_InternalUnits
));
m_Parent
->
m_InternalUnits
);
msg
=
m_ThicknessCtrl
->
GetValue
();
msg
=
m_ThicknessCtrl
->
GetValue
();
m_Item
->
m_Width
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_Item
->
SetWidth
(
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_Parent
->
m_InternalUnits
));
m_Parent
->
m_InternalUnits
);
msg
=
m_DefaultThicknessCtrl
->
GetValue
();
msg
=
m_DefaultThicknessCtrl
->
GetValue
();
int
thickness
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
int
thickness
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_Parent
->
m_InternalUnits
);
m_Parent
->
m_InternalUnits
);
m_Item
->
SetLayer
(
m_LayerSelection
->
GetCurrentSelection
()
+
FIRST_NO_COPPER_LAYER
);
m_Item
->
SetLayer
(
m_LayerSelection
->
GetCurrentSelection
()
+
FIRST_NO_COPPER_LAYER
);
...
@@ -222,12 +216,12 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event )
...
@@ -222,12 +216,12 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event )
else
else
m_BrdSettings
.
m_DrawSegmentWidth
=
thickness
;
m_BrdSettings
.
m_DrawSegmentWidth
=
thickness
;
if
(
m_Item
->
m_Shape
==
S_ARC
)
if
(
m_Item
->
GetShape
()
==
S_ARC
)
{
{
long
angle
;
double
angle
;
m_Angle_Ctrl
->
GetValue
().
To
Long
(
&
angle
);
m_Angle_Ctrl
->
GetValue
().
To
Double
(
&
angle
);
NORMALIZE_ANGLE_360
(
angle
);
NORMALIZE_ANGLE_360
(
angle
);
m_Item
->
m_Angle
=
angle
;
m_Item
->
SetAngle
(
angle
)
;
}
}
m_Parent
->
OnModify
();
m_Parent
->
OnModify
();
...
...
pcbnew/dialogs/dialog_pcb_text_properties.cpp
View file @
96bb90de
...
@@ -114,23 +114,23 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit()
...
@@ -114,23 +114,23 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit()
}
}
}
}
switch
(
m_SelectedPCBText
->
m_Orient
)
switch
(
(
int
)
m_SelectedPCBText
->
GetOrientation
()
)
{
{
default
:
default
:
m_OrientationCtrl
->
SetSelection
(
0
);
m_OrientationCtrl
->
SetSelection
(
0
);
break
;
break
;
case
900
:
case
900
:
case
-
2700
:
case
-
2700
:
m_OrientationCtrl
->
SetSelection
(
1
);
m_OrientationCtrl
->
SetSelection
(
1
);
break
;
break
;
case
1800
:
case
1800
:
case
-
1800
:
case
-
1800
:
m_OrientationCtrl
->
SetSelection
(
2
);
m_OrientationCtrl
->
SetSelection
(
2
);
break
;
break
;
case
2700
:
case
2700
:
case
-
900
:
case
-
900
:
m_OrientationCtrl
->
SetSelection
(
3
);
m_OrientationCtrl
->
SetSelection
(
3
);
break
;
break
;
}
}
if
(
m_SelectedPCBText
->
m_Mirror
)
if
(
m_SelectedPCBText
->
m_Mirror
)
...
...
pcbnew/dimension.cpp
View file @
96bb90de
...
@@ -83,18 +83,18 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent,
...
@@ -83,18 +83,18 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent,
CurrentDimension
=
aDimension
;
CurrentDimension
=
aDimension
;
if
(
aDimension
->
m_Text
->
m_Mirror
)
if
(
aDimension
->
m_Text
.
m_Mirror
)
m_rbMirror
->
SetSelection
(
1
);
m_rbMirror
->
SetSelection
(
1
);
else
else
m_rbMirror
->
SetSelection
(
0
);
m_rbMirror
->
SetSelection
(
0
);
m_Name
->
SetValue
(
aDimension
->
m_Text
->
m_Text
);
m_Name
->
SetValue
(
aDimension
->
m_Text
.
m_Text
);
// Enter size value in dialog
// Enter size value in dialog
PutValueInLocalUnits
(
*
m_TxtSizeXCtrl
,
aDimension
->
m_Text
->
m_Size
.
x
,
PutValueInLocalUnits
(
*
m_TxtSizeXCtrl
,
aDimension
->
m_Text
.
m_Size
.
x
,
m_Parent
->
m_InternalUnits
);
m_Parent
->
m_InternalUnits
);
AddUnitSymbol
(
*
m_staticTextSizeX
);
AddUnitSymbol
(
*
m_staticTextSizeX
);
PutValueInLocalUnits
(
*
m_TxtSizeYCtrl
,
aDimension
->
m_Text
->
m_Size
.
y
,
PutValueInLocalUnits
(
*
m_TxtSizeYCtrl
,
aDimension
->
m_Text
.
m_Size
.
y
,
m_Parent
->
m_InternalUnits
);
m_Parent
->
m_InternalUnits
);
AddUnitSymbol
(
*
m_staticTextSizeY
);
AddUnitSymbol
(
*
m_staticTextSizeY
);
...
@@ -104,10 +104,10 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent,
...
@@ -104,10 +104,10 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent,
AddUnitSymbol
(
*
m_staticTextWidth
);
AddUnitSymbol
(
*
m_staticTextWidth
);
// Enter position value in dialog
// Enter position value in dialog
PutValueInLocalUnits
(
*
m_textCtrlPosX
,
aDimension
->
m_Text
->
m_Pos
.
x
,
PutValueInLocalUnits
(
*
m_textCtrlPosX
,
aDimension
->
m_Text
.
m_Pos
.
x
,
m_Parent
->
m_InternalUnits
);
m_Parent
->
m_InternalUnits
);
AddUnitSymbol
(
*
m_staticTextPosX
);
AddUnitSymbol
(
*
m_staticTextPosX
);
PutValueInLocalUnits
(
*
m_textCtrlPosY
,
aDimension
->
m_Text
->
m_Pos
.
y
,
PutValueInLocalUnits
(
*
m_textCtrlPosY
,
aDimension
->
m_Text
.
m_Pos
.
y
,
m_Parent
->
m_InternalUnits
);
m_Parent
->
m_InternalUnits
);
AddUnitSymbol
(
*
m_staticTextPosY
);
AddUnitSymbol
(
*
m_staticTextPosY
);
...
@@ -148,26 +148,26 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
...
@@ -148,26 +148,26 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
// Get new size value:
// Get new size value:
msg
=
m_TxtSizeXCtrl
->
GetValue
();
msg
=
m_TxtSizeXCtrl
->
GetValue
();
CurrentDimension
->
m_Text
->
m_Size
.
x
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
CurrentDimension
->
m_Text
.
m_Size
.
x
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_Parent
->
m_InternalUnits
);
m_Parent
->
m_InternalUnits
);
msg
=
m_TxtSizeYCtrl
->
GetValue
();
msg
=
m_TxtSizeYCtrl
->
GetValue
();
CurrentDimension
->
m_Text
->
m_Size
.
y
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
CurrentDimension
->
m_Text
.
m_Size
.
y
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_Parent
->
m_InternalUnits
);
m_Parent
->
m_InternalUnits
);
// Get new position value:
// Get new position value:
// It will be copied later in dimension, because
// It will be copied later in dimension, because
msg
=
m_textCtrlPosX
->
GetValue
();
msg
=
m_textCtrlPosX
->
GetValue
();
CurrentDimension
->
m_Text
->
m_Pos
.
x
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
CurrentDimension
->
m_Text
.
m_Pos
.
x
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_Parent
->
m_InternalUnits
);
m_Parent
->
m_InternalUnits
);
msg
=
m_textCtrlPosY
->
GetValue
();
msg
=
m_textCtrlPosY
->
GetValue
();
CurrentDimension
->
m_Text
->
m_Pos
.
y
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
CurrentDimension
->
m_Text
.
m_Pos
.
y
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_Parent
->
m_InternalUnits
);
m_Parent
->
m_InternalUnits
);
// Get new line thickness value:
// Get new line thickness value:
msg
=
m_TxtWidthCtrl
->
GetValue
();
msg
=
m_TxtWidthCtrl
->
GetValue
();
int
width
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
int
width
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_Parent
->
m_InternalUnits
);
m_Parent
->
m_InternalUnits
);
int
maxthickness
=
Clamp_Text_PenSize
(
width
,
CurrentDimension
->
m_Text
->
m_Size
);
int
maxthickness
=
Clamp_Text_PenSize
(
width
,
CurrentDimension
->
m_Text
.
m_Size
);
if
(
width
>
maxthickness
)
if
(
width
>
maxthickness
)
{
{
...
@@ -176,9 +176,9 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
...
@@ -176,9 +176,9 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
width
=
maxthickness
;
width
=
maxthickness
;
}
}
CurrentDimension
->
m_Text
->
m_Thickness
=
CurrentDimension
->
m_Width
=
width
;
CurrentDimension
->
m_Text
.
m_Thickness
=
CurrentDimension
->
m_Width
=
width
;
CurrentDimension
->
m_Text
->
m_Mirror
=
(
m_rbMirror
->
GetSelection
()
==
1
)
?
true
:
false
;
CurrentDimension
->
m_Text
.
m_Mirror
=
(
m_rbMirror
->
GetSelection
()
==
1
)
?
true
:
false
;
CurrentDimension
->
SetLayer
(
m_SelLayerBox
->
GetCurrentSelection
()
+
FIRST_NO_COPPER_LAYER
);
CurrentDimension
->
SetLayer
(
m_SelLayerBox
->
GetCurrentSelection
()
+
FIRST_NO_COPPER_LAYER
);
...
@@ -249,16 +249,16 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC )
...
@@ -249,16 +249,16 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC )
aDimension
->
m_arrowD2Ox
=
aDimension
->
m_arrowD2Fx
=
pos
.
x
;
aDimension
->
m_arrowD2Ox
=
aDimension
->
m_arrowD2Fx
=
pos
.
x
;
aDimension
->
m_arrowD2Oy
=
aDimension
->
m_arrowD2Fy
=
pos
.
y
;
aDimension
->
m_arrowD2Oy
=
aDimension
->
m_arrowD2Fy
=
pos
.
y
;
aDimension
->
m_Text
->
m_Size
=
GetBoard
()
->
GetDesignSettings
().
m_PcbTextSize
;
aDimension
->
m_Text
.
m_Size
=
GetBoard
()
->
GetDesignSettings
().
m_PcbTextSize
;
int
width
=
GetBoard
()
->
GetDesignSettings
().
m_PcbTextWidth
;
int
width
=
GetBoard
()
->
GetDesignSettings
().
m_PcbTextWidth
;
int
maxthickness
=
Clamp_Text_PenSize
(
width
,
aDimension
->
m_Text
->
m_Size
);
int
maxthickness
=
Clamp_Text_PenSize
(
width
,
aDimension
->
m_Text
.
m_Size
);
if
(
width
>
maxthickness
)
if
(
width
>
maxthickness
)
{
{
width
=
maxthickness
;
width
=
maxthickness
;
}
}
aDimension
->
m_Text
->
m_Thickness
=
aDimension
->
m_Width
=
width
;
aDimension
->
m_Text
.
m_Thickness
=
aDimension
->
m_Width
=
width
;
aDimension
->
AdjustDimensionDetails
(
);
aDimension
->
AdjustDimensionDetails
(
);
...
@@ -377,13 +377,13 @@ void PCB_EDIT_FRAME::BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC )
...
@@ -377,13 +377,13 @@ void PCB_EDIT_FRAME::BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC )
return
;
return
;
// Store the initial position for undo/abort command
// Store the initial position for undo/abort command
initialTextPosition
=
aItem
->
m_Text
->
m_Pos
;
initialTextPosition
=
aItem
->
m_Text
.
m_Pos
;
aItem
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
aItem
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
aItem
->
m_Flags
|=
IS_MOVED
;
aItem
->
m_Flags
|=
IS_MOVED
;
aItem
->
DisplayInfo
(
this
);
aItem
->
DisplayInfo
(
this
);
GetScreen
()
->
SetCrossHairPosition
(
aItem
->
m_Text
->
m_Pos
);
GetScreen
()
->
SetCrossHairPosition
(
aItem
->
m_Text
.
m_Pos
);
DrawPanel
->
MoveCursorToCrossHair
();
DrawPanel
->
MoveCursorToCrossHair
();
DrawPanel
->
SetMouseCapture
(
MoveDimensionText
,
AbortMoveDimensionText
);
DrawPanel
->
SetMouseCapture
(
MoveDimensionText
,
AbortMoveDimensionText
);
...
@@ -404,7 +404,7 @@ static void MoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
...
@@ -404,7 +404,7 @@ static void MoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if
(
aErase
)
if
(
aErase
)
dimension
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
dimension
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
dimension
->
m_Text
->
m_Pos
=
aPanel
->
GetScreen
()
->
GetCrossHairPosition
();
dimension
->
m_Text
.
m_Pos
=
aPanel
->
GetScreen
()
->
GetCrossHairPosition
();
dimension
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
dimension
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
}
}
...
@@ -425,7 +425,7 @@ void AbortMoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
...
@@ -425,7 +425,7 @@ void AbortMoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
return
;
return
;
dimension
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
dimension
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
dimension
->
m_Text
->
m_Pos
=
initialTextPosition
;
dimension
->
m_Text
.
m_Pos
=
initialTextPosition
;
dimension
->
m_Flags
=
0
;
dimension
->
m_Flags
=
0
;
dimension
->
Draw
(
aPanel
,
aDC
,
GR_OR
);
dimension
->
Draw
(
aPanel
,
aDC
,
GR_OR
);
}
}
...
@@ -444,9 +444,9 @@ void PCB_EDIT_FRAME::PlaceDimensionText( DIMENSION* aItem, wxDC* DC )
...
@@ -444,9 +444,9 @@ void PCB_EDIT_FRAME::PlaceDimensionText( DIMENSION* aItem, wxDC* DC )
aItem
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
aItem
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
OnModify
();
OnModify
();
EXCHG
(
aItem
->
m_Text
->
m_Pos
,
initialTextPosition
);
EXCHG
(
aItem
->
m_Text
.
m_Pos
,
initialTextPosition
);
SaveCopyInUndoList
(
aItem
,
UR_CHANGED
);
SaveCopyInUndoList
(
aItem
,
UR_CHANGED
);
EXCHG
(
aItem
->
m_Text
->
m_Pos
,
initialTextPosition
);
EXCHG
(
aItem
->
m_Text
.
m_Pos
,
initialTextPosition
);
aItem
->
m_Flags
=
0
;
aItem
->
m_Flags
=
0
;
}
}
pcbnew/drc_clearance_test_functions.cpp
View file @
96bb90de
...
@@ -175,7 +175,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
...
@@ -175,7 +175,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
if
(
aRefSeg
->
Type
()
==
PCB_VIA_T
)
if
(
aRefSeg
->
Type
()
==
PCB_VIA_T
)
{
{
// test if the via size is smaller than minimum
// test if the via size is smaller than minimum
if
(
aRefSeg
->
Shape
()
==
VIA_MICROVIA
)
if
(
aRefSeg
->
Get
Shape
()
==
VIA_MICROVIA
)
{
{
if
(
aRefSeg
->
m_Width
<
netclass
->
GetuViaMinDiameter
()
)
if
(
aRefSeg
->
m_Width
<
netclass
->
GetuViaMinDiameter
()
)
{
{
...
@@ -207,7 +207,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
...
@@ -207,7 +207,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// For microvias: test if they are blind vias and only between 2 layers
// For microvias: test if they are blind vias and only between 2 layers
// because they are used for very small drill size and are drill by laser
// because they are used for very small drill size and are drill by laser
// and **only one layer** can be drilled
// and **only one layer** can be drilled
if
(
aRefSeg
->
Shape
()
==
VIA_MICROVIA
)
if
(
aRefSeg
->
Get
Shape
()
==
VIA_MICROVIA
)
{
{
int
layer1
,
layer2
;
int
layer1
,
layer2
;
bool
err
=
true
;
bool
err
=
true
;
...
...
pcbnew/edgemod.cpp
View file @
96bb90de
...
@@ -29,7 +29,7 @@ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC );
...
@@ -29,7 +29,7 @@ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC );
static
void
ShowCurrentOutlineWhileMoving
(
EDA_DRAW_PANEL
*
aPanel
,
wxDC
*
aDC
,
static
void
ShowCurrentOutlineWhileMoving
(
EDA_DRAW_PANEL
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aPosition
,
bool
aErase
);
const
wxPoint
&
aPosition
,
bool
aErase
);
int
ArcValue
=
900
;
static
double
ArcValue
=
900
;
static
wxPoint
MoveVector
;
// Move vector for move edge
static
wxPoint
MoveVector
;
// Move vector for move edge
static
wxPoint
CursorInitialPosition
;
// Mouse cursor initial position for move command
static
wxPoint
CursorInitialPosition
;
// Mouse cursor initial position for move command
...
@@ -49,23 +49,25 @@ void FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
...
@@ -49,23 +49,25 @@ void FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
}
}
void
FOOTPRINT_EDIT_FRAME
::
Place_EdgeMod
(
EDGE_MODULE
*
Edge
)
void
FOOTPRINT_EDIT_FRAME
::
Place_EdgeMod
(
EDGE_MODULE
*
a
Edge
)
{
{
if
(
Edge
==
NULL
)
if
(
a
Edge
==
NULL
)
return
;
return
;
Edge
->
m_Start
-=
MoveVector
;
aEdge
->
SetStart
(
aEdge
->
GetStart
()
-
MoveVector
)
;
Edge
->
m_End
-=
MoveVector
;
aEdge
->
SetEnd
(
aEdge
->
GetEnd
()
-
MoveVector
)
;
Edge
->
m_Start0
-=
MoveVector
;
aEdge
->
SetStart0
(
aEdge
->
GetStart0
()
-
MoveVector
)
;
Edge
->
m_End0
-=
MoveVector
;
aEdge
->
SetEnd0
(
aEdge
->
GetEnd0
()
-
MoveVector
)
;
Edge
->
m_Flags
=
0
;
a
Edge
->
m_Flags
=
0
;
DrawPanel
->
SetMouseCapture
(
NULL
,
NULL
);
DrawPanel
->
SetMouseCapture
(
NULL
,
NULL
);
SetCurItem
(
NULL
);
SetCurItem
(
NULL
);
OnModify
();
OnModify
();
MODULE
*
Module
=
(
MODULE
*
)
Edge
->
GetParent
();
Module
->
CalculateBoundingBox
();
MODULE
*
module
=
(
MODULE
*
)
aEdge
->
GetParent
();
module
->
CalculateBoundingBox
();
DrawPanel
->
Refresh
(
);
DrawPanel
->
Refresh
(
);
}
}
...
@@ -109,22 +111,27 @@ static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
...
@@ -109,22 +111,27 @@ static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if
(
Edge
==
NULL
)
if
(
Edge
==
NULL
)
return
;
return
;
MODULE
*
M
odule
=
(
MODULE
*
)
Edge
->
GetParent
();
MODULE
*
m
odule
=
(
MODULE
*
)
Edge
->
GetParent
();
// if( erase )
// if( erase )
{
{
Edge
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
Edge
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
}
}
Edge
->
m_End
=
screen
->
GetCrossHairPosition
(
);
Edge
->
SetEnd
(
screen
->
GetCrossHairPosition
()
);
/* Update relative coordinate. */
// Update relative coordinate.
Edge
->
m_End0
=
Edge
->
m_End
-
Module
->
m_Pos
;
Edge
->
SetEnd0
(
Edge
->
GetEnd
()
-
module
->
GetPosition
()
);
RotatePoint
(
&
Edge
->
m_End0
,
-
Module
->
m_Orient
);
wxPoint
pt
(
Edge
->
GetEnd0
()
);
RotatePoint
(
&
pt
,
-
module
->
GetOrientation
()
);
Edge
->
SetEnd0
(
pt
);
Edge
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
Edge
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
M
odule
->
CalculateBoundingBox
();
m
odule
->
CalculateBoundingBox
();
}
}
...
@@ -143,12 +150,12 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width( EDGE_MODULE* aEdge )
...
@@ -143,12 +150,12 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width( EDGE_MODULE* aEdge )
if
(
aEdge
->
Type
()
!=
PCB_MODULE_EDGE_T
)
if
(
aEdge
->
Type
()
!=
PCB_MODULE_EDGE_T
)
continue
;
continue
;
aEdge
->
m_Width
=
g_ModuleSegmentWidth
;
aEdge
->
SetWidth
(
g_ModuleSegmentWidth
)
;
}
}
}
}
else
else
{
{
aEdge
->
m_Width
=
g_ModuleSegmentWidth
;
aEdge
->
SetWidth
(
g_ModuleSegmentWidth
)
;
}
}
OnModify
();
OnModify
();
...
@@ -222,9 +229,9 @@ void FOOTPRINT_EDIT_FRAME::Enter_Edge_Width( EDGE_MODULE* aEdge )
...
@@ -222,9 +229,9 @@ void FOOTPRINT_EDIT_FRAME::Enter_Edge_Width( EDGE_MODULE* aEdge )
if
(
aEdge
)
if
(
aEdge
)
{
{
MODULE
*
M
odule
=
GetBoard
()
->
m_Modules
;
MODULE
*
m
odule
=
GetBoard
()
->
m_Modules
;
aEdge
->
m_Width
=
g_ModuleSegmentWidth
;
aEdge
->
SetWidth
(
g_ModuleSegmentWidth
)
;
M
odule
->
CalculateBoundingBox
();
m
odule
->
CalculateBoundingBox
();
OnModify
();
OnModify
();
}
}
}
}
...
@@ -297,18 +304,18 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
...
@@ -297,18 +304,18 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
Edge
=
new
EDGE_MODULE
(
module
);
Edge
=
new
EDGE_MODULE
(
module
);
MoveVector
.
x
=
MoveVector
.
y
=
0
;
MoveVector
.
x
=
MoveVector
.
y
=
0
;
/
* Add the new item to the Drawings list head*/
/
/ Add the new item to the Drawings list head
module
->
m_Drawings
.
PushFront
(
Edge
);
module
->
m_Drawings
.
PushFront
(
Edge
);
/
* Update characteristics of the segment or arc. */
/
/ Update characteristics of the segment or arc.
Edge
->
m_Flags
=
IS_NEW
;
Edge
->
m_Flags
=
IS_NEW
;
Edge
->
m_Angle
=
angle
;
Edge
->
SetAngle
(
angle
)
;
Edge
->
m_Shape
=
type_edge
;
Edge
->
SetShape
(
type_edge
)
;
if
(
Edge
->
m_Shape
==
S_ARC
)
if
(
Edge
->
GetShape
()
==
S_ARC
)
Edge
->
m_Angle
=
ArcValue
;
Edge
->
SetAngle
(
ArcValue
)
;
Edge
->
m_Width
=
g_ModuleSegmentWidth
;
Edge
->
SetWidth
(
g_ModuleSegmentWidth
)
;
Edge
->
SetLayer
(
module
->
GetLayer
()
);
Edge
->
SetLayer
(
module
->
GetLayer
()
);
if
(
module
->
GetLayer
()
==
LAYER_N_FRONT
)
if
(
module
->
GetLayer
()
==
LAYER_N_FRONT
)
...
@@ -317,14 +324,14 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
...
@@ -317,14 +324,14 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
if
(
module
->
GetLayer
()
==
LAYER_N_BACK
)
if
(
module
->
GetLayer
()
==
LAYER_N_BACK
)
Edge
->
SetLayer
(
SILKSCREEN_N_BACK
);
Edge
->
SetLayer
(
SILKSCREEN_N_BACK
);
/
* Initialize the starting point of the new segment or arc */
/
/ Initialize the starting point of the new segment or arc
Edge
->
m_Start
=
GetScreen
()
->
GetCrossHairPosition
(
);
Edge
->
SetStart
(
GetScreen
()
->
GetCrossHairPosition
()
);
/
* Initialize the ending point of the new segment or arc */
/
/ Initialize the ending point of the new segment or arc
Edge
->
m_End
=
Edge
->
m_Start
;
Edge
->
SetEnd
(
Edge
->
GetStart
()
)
;
/
* Initialize the relative coordinates */
/
/ Initialize the relative coordinates
Edge
->
m_Start0
=
Edge
->
m_Start
-
module
->
m_Pos
;
Edge
->
SetStart0
(
Edge
->
GetStart
()
-
module
->
GetPosition
()
)
;
RotatePoint
(
&
Edge
->
m_Start0
,
-
module
->
m_Orient
);
RotatePoint
(
&
Edge
->
m_Start0
,
-
module
->
m_Orient
);
...
@@ -355,16 +362,20 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
...
@@ -355,16 +362,20 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
Edge
=
newedge
;
// point now new item
Edge
=
newedge
;
// point now new item
Edge
->
m_Flags
=
IS_NEW
;
Edge
->
m_Flags
=
IS_NEW
;
Edge
->
m_Width
=
g_ModuleSegmentWidth
;
Edge
->
SetWidth
(
g_ModuleSegmentWidth
);
Edge
->
m_Start
=
GetScreen
()
->
GetCrossHairPosition
();
Edge
->
SetStart
(
GetScreen
()
->
GetCrossHairPosition
()
);
Edge
->
m_End
=
Edge
->
m_Start
;
Edge
->
SetEnd
(
Edge
->
GetStart
()
);
// Update relative coordinate.
Edge
->
SetStart0
(
Edge
->
GetStart
()
-
module
->
GetPosition
()
);
wxPoint
pt
(
Edge
->
GetStart0
()
);
/* Update relative coordinate. */
RotatePoint
(
&
pt
,
-
module
->
GetOrientation
()
);
Edge
->
m_Start0
=
Edge
->
m_Start
-
module
->
m_Pos
;
RotatePoint
(
&
Edge
->
m_Start0
,
-
module
->
m_Orien
t
);
Edge
->
SetStart0
(
p
t
);
Edge
->
m_End0
=
Edge
->
m_Start0
;
Edge
->
SetEnd0
(
Edge
->
GetStart0
()
)
;
module
->
CalculateBoundingBox
();
module
->
CalculateBoundingBox
();
module
->
m_LastEdit_Time
=
time
(
NULL
);
module
->
m_LastEdit_Time
=
time
(
NULL
);
...
@@ -390,7 +401,7 @@ void FOOTPRINT_EDIT_FRAME::End_Edge_Module( EDGE_MODULE* Edge )
...
@@ -390,7 +401,7 @@ void FOOTPRINT_EDIT_FRAME::End_Edge_Module( EDGE_MODULE* Edge )
Edge
->
m_Flags
=
0
;
Edge
->
m_Flags
=
0
;
/* If last segment length is 0: remove it */
/* If last segment length is 0: remove it */
if
(
Edge
->
m_Start
==
Edge
->
m_End
)
if
(
Edge
->
GetStart
()
==
Edge
->
GetEnd
()
)
Edge
->
DeleteStructure
();
Edge
->
DeleteStructure
();
}
}
...
...
pcbnew/edit_track_width.cpp
View file @
96bb90de
...
@@ -108,7 +108,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
...
@@ -108,7 +108,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
{
{
// Set new drill value. Note: currently microvias have only a default drill value
// Set new drill value. Note: currently microvias have only a default drill value
if
(
new_drill
>
0
)
if
(
new_drill
>
0
)
aTrackItem
->
SetDrill
Value
(
new_drill
);
aTrackItem
->
SetDrill
(
new_drill
);
else
else
aTrackItem
->
SetDrillDefault
();
aTrackItem
->
SetDrillDefault
();
}
}
...
...
pcbnew/editedge.cpp
View file @
96bb90de
...
@@ -64,21 +64,23 @@ void PCB_EDIT_FRAME::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
...
@@ -64,21 +64,23 @@ void PCB_EDIT_FRAME::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
static
void
Move_Segment
(
EDA_DRAW_PANEL
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aPosition
,
static
void
Move_Segment
(
EDA_DRAW_PANEL
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aPosition
,
bool
aErase
)
bool
aErase
)
{
{
DRAWSEGMENT
*
S
egment
=
(
DRAWSEGMENT
*
)
aPanel
->
GetScreen
()
->
GetCurItem
();
DRAWSEGMENT
*
s
egment
=
(
DRAWSEGMENT
*
)
aPanel
->
GetScreen
()
->
GetCurItem
();
if
(
S
egment
==
NULL
)
if
(
s
egment
==
NULL
)
return
;
return
;
if
(
aErase
)
if
(
aErase
)
S
egment
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
s
egment
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
wxPoint
delta
;
wxPoint
delta
;
delta
=
aPanel
->
GetScreen
()
->
GetCrossHairPosition
()
-
s_LastPosition
;
delta
=
aPanel
->
GetScreen
()
->
GetCrossHairPosition
()
-
s_LastPosition
;
Segment
->
m_Start
+=
delta
;
Segment
->
m_End
+=
delta
;
segment
->
SetStart
(
segment
->
GetStart
()
+
delta
);
segment
->
SetEnd
(
segment
->
GetEnd
()
+
delta
);
s_LastPosition
=
aPanel
->
GetScreen
()
->
GetCrossHairPosition
();
s_LastPosition
=
aPanel
->
GetScreen
()
->
GetCrossHairPosition
();
S
egment
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
s
egment
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
}
}
...
@@ -221,10 +223,11 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
...
@@ -221,10 +223,11 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
SetCurItem
(
Segment
=
new
DRAWSEGMENT
(
GetBoard
()
)
);
SetCurItem
(
Segment
=
new
DRAWSEGMENT
(
GetBoard
()
)
);
Segment
->
m_Flags
=
IS_NEW
;
Segment
->
m_Flags
=
IS_NEW
;
Segment
->
SetLayer
(
getActiveLayer
()
);
Segment
->
SetLayer
(
getActiveLayer
()
);
Segment
->
m_Width
=
s_large
;
Segment
->
SetWidth
(
s_large
);
Segment
->
m_Shape
=
shape
;
Segment
->
SetShape
(
shape
);
Segment
->
m_Angle
=
900
;
Segment
->
SetAngle
(
900
);
Segment
->
m_Start
=
Segment
->
m_End
=
GetScreen
()
->
GetCrossHairPosition
();
Segment
->
SetStart
(
GetScreen
()
->
GetCrossHairPosition
()
);
Segment
->
SetEnd
(
GetScreen
()
->
GetCrossHairPosition
()
);
DrawPanel
->
SetMouseCapture
(
DrawSegment
,
Abort_EditEdge
);
DrawPanel
->
SetMouseCapture
(
DrawSegment
,
Abort_EditEdge
);
}
}
else
/* The ending point ccordinate Segment->m_End was updated by he function
else
/* The ending point ccordinate Segment->m_End was updated by he function
...
@@ -232,11 +235,11 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
...
@@ -232,11 +235,11 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
* during the segment creation
* during the segment creation
*/
*/
{
{
if
(
Segment
->
m_Start
!=
Segment
->
m_End
)
if
(
Segment
->
GetStart
()
!=
Segment
->
GetEnd
()
)
{
{
if
(
Segment
->
m_Shape
==
S_SEGMENT
)
if
(
Segment
->
GetShape
()
==
S_SEGMENT
)
{
{
SaveCopyInUndoList
(
Segment
,
UR_NEW
);
SaveCopyInUndoList
(
Segment
,
UR_NEW
);
GetBoard
()
->
Add
(
Segment
);
GetBoard
()
->
Add
(
Segment
);
OnModify
();
OnModify
();
...
@@ -250,11 +253,12 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
...
@@ -250,11 +253,12 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
Segment
->
m_Flags
=
IS_NEW
;
Segment
->
m_Flags
=
IS_NEW
;
Segment
->
SetLayer
(
DrawItem
->
GetLayer
()
);
Segment
->
SetLayer
(
DrawItem
->
GetLayer
()
);
Segment
->
m_Width
=
s_large
;
Segment
->
SetWidth
(
s_large
);
Segment
->
m_Shape
=
DrawItem
->
m_Shape
;
Segment
->
SetShape
(
DrawItem
->
GetShape
()
);
Segment
->
m_Type
=
DrawItem
->
m_Type
;
Segment
->
SetType
(
DrawItem
->
GetType
()
);
Segment
->
m_Angle
=
DrawItem
->
m_Angle
;
Segment
->
SetAngle
(
DrawItem
->
GetAngle
()
);
Segment
->
m_Start
=
Segment
->
m_End
=
DrawItem
->
m_End
;
Segment
->
SetStart
(
DrawItem
->
GetEnd
()
);
Segment
->
SetEnd
(
DrawItem
->
GetEnd
()
);
DrawSegment
(
DrawPanel
,
DC
,
wxDefaultPosition
,
false
);
DrawSegment
(
DrawPanel
,
DC
,
wxDefaultPosition
,
false
);
}
}
else
else
...
@@ -276,10 +280,10 @@ void PCB_EDIT_FRAME::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
...
@@ -276,10 +280,10 @@ void PCB_EDIT_FRAME::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
Segment
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
Segment
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
/
* Delete if segment length is zero. */
/
/ Delete if segment length is zero.
if
(
Segment
->
m_Start
==
Segment
->
m_End
)
if
(
Segment
->
GetStart
()
==
Segment
->
GetEnd
()
)
{
{
Segment
->
DeleteStructure
();
Segment
->
DeleteStructure
();
}
}
else
else
{
{
...
@@ -309,15 +313,18 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
...
@@ -309,15 +313,18 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
if
(
aErase
)
if
(
aErase
)
Segment
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
Segment
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
if
(
Segments_45_Only
&&
(
Segment
->
m_Shape
==
S_SEGMENT
)
)
if
(
Segments_45_Only
&&
Segment
->
GetShape
()
==
S_SEGMENT
)
{
{
wxPoint
pt
;
CalculateSegmentEndPoint
(
aPanel
->
GetScreen
()
->
GetCrossHairPosition
(),
CalculateSegmentEndPoint
(
aPanel
->
GetScreen
()
->
GetCrossHairPosition
(),
Segment
->
m_Start
.
x
,
Segment
->
m_Start
.
y
,
Segment
->
GetStart
().
x
,
Segment
->
GetStart
().
y
,
&
Segment
->
m_End
.
x
,
&
Segment
->
m_End
.
y
);
&
pt
.
x
,
&
pt
.
y
);
Segment
->
SetEnd
(
pt
);
}
}
else
/
* here the angle is arbitrary */
else
/
/ here the angle is arbitrary
{
{
Segment
->
m_End
=
aPanel
->
GetScreen
()
->
GetCrossHairPosition
(
);
Segment
->
SetEnd
(
aPanel
->
GetScreen
()
->
GetCrossHairPosition
()
);
}
}
Segment
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
Segment
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
...
...
pcbnew/editrack-part2.cpp
View file @
96bb90de
...
@@ -105,7 +105,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
...
@@ -105,7 +105,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
// Usual via is from copper to component.
// Usual via is from copper to component.
// layer pair is LAYER_N_BACK and LAYER_N_FRONT.
// layer pair is LAYER_N_BACK and LAYER_N_FRONT.
via
->
SetLayerPair
(
LAYER_N_BACK
,
LAYER_N_FRONT
);
via
->
SetLayerPair
(
LAYER_N_BACK
,
LAYER_N_FRONT
);
via
->
SetDrill
Value
(
GetBoard
()
->
GetCurrentViaDrill
()
);
via
->
SetDrill
(
GetBoard
()
->
GetCurrentViaDrill
()
);
int
first_layer
=
getActiveLayer
();
int
first_layer
=
getActiveLayer
();
int
last_layer
;
int
last_layer
;
...
@@ -117,7 +117,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
...
@@ -117,7 +117,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
last_layer
=
GetScreen
()
->
m_Route_Layer_BOTTOM
;
last_layer
=
GetScreen
()
->
m_Route_Layer_BOTTOM
;
/* Adjust the actual via layer pair */
/* Adjust the actual via layer pair */
switch
(
via
->
Shape
()
)
switch
(
via
->
Get
Shape
()
)
{
{
case
VIA_BLIND_BURIED
:
case
VIA_BLIND_BURIED
:
via
->
SetLayerPair
(
first_layer
,
last_layer
);
via
->
SetLayerPair
(
first_layer
,
last_layer
);
...
...
pcbnew/export_gencad.cpp
View file @
96bb90de
...
@@ -891,8 +891,8 @@ static void CreateBoardSection( FILE* aFile, BOARD* aPcb )
...
@@ -891,8 +891,8 @@ static void CreateBoardSection( FILE* aFile, BOARD* aPcb )
{
{
// XXX GenCAD supports arc boundaries but I've seen nothing that reads them
// XXX GenCAD supports arc boundaries but I've seen nothing that reads them
fprintf
(
aFile
,
"LINE %g %g %g %g
\n
"
,
fprintf
(
aFile
,
"LINE %g %g %g %g
\n
"
,
MapXTo
(
drawseg
->
m_Start
.
x
),
MapYTo
(
drawseg
->
m_Start
.
y
),
MapXTo
(
drawseg
->
GetStart
().
x
),
MapYTo
(
drawseg
->
GetStart
()
.
y
),
MapXTo
(
drawseg
->
m_End
.
x
),
MapYTo
(
drawseg
->
m_End
.
y
)
);
MapXTo
(
drawseg
->
GetEnd
().
x
),
MapYTo
(
drawseg
->
GetEnd
()
.
y
)
);
}
}
}
}
}
}
...
@@ -1041,7 +1041,7 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module )
...
@@ -1041,7 +1041,7 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module )
if
(
PtEdge
->
GetLayer
()
==
SILKSCREEN_N_FRONT
if
(
PtEdge
->
GetLayer
()
==
SILKSCREEN_N_FRONT
||
PtEdge
->
GetLayer
()
==
SILKSCREEN_N_BACK
)
||
PtEdge
->
GetLayer
()
==
SILKSCREEN_N_BACK
)
{
{
switch
(
PtEdge
->
m_Shape
)
switch
(
PtEdge
->
GetShape
()
)
{
{
case
S_SEGMENT
:
case
S_SEGMENT
:
fprintf
(
aFile
,
"LINE %g %g %g %g
\n
"
,
fprintf
(
aFile
,
"LINE %g %g %g %g
\n
"
,
...
@@ -1068,9 +1068,9 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module )
...
@@ -1068,9 +1068,9 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module )
int
arcendx
,
arcendy
;
int
arcendx
,
arcendy
;
arcendx
=
PtEdge
->
m_End0
.
x
-
PtEdge
->
m_Start0
.
x
;
arcendx
=
PtEdge
->
m_End0
.
x
-
PtEdge
->
m_Start0
.
x
;
arcendy
=
PtEdge
->
m_End0
.
y
-
PtEdge
->
m_Start0
.
y
;
arcendy
=
PtEdge
->
m_End0
.
y
-
PtEdge
->
m_Start0
.
y
;
RotatePoint
(
&
arcendx
,
&
arcendy
,
-
PtEdge
->
m_Angle
);
RotatePoint
(
&
arcendx
,
&
arcendy
,
-
PtEdge
->
GetAngle
()
);
arcendx
+=
PtEdge
->
m_Start0
.
x
;
arcendx
+=
PtEdge
->
GetStart0
()
.
x
;
arcendy
+=
PtEdge
->
m_Start0
.
y
;
arcendy
+=
PtEdge
->
GetStart0
()
.
y
;
if
(
Yaxis_sign
==
-
1
)
if
(
Yaxis_sign
==
-
1
)
{
{
// Flipping Y flips the arc direction too
// Flipping Y flips the arc direction too
...
@@ -1078,19 +1078,19 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module )
...
@@ -1078,19 +1078,19 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module )
(
arcendx
)
/
SCALE_FACTOR
,
(
arcendx
)
/
SCALE_FACTOR
,
(
Yaxis_sign
*
arcendy
)
/
SCALE_FACTOR
,
(
Yaxis_sign
*
arcendy
)
/
SCALE_FACTOR
,
(
PtEdge
->
m_End0
.
x
)
/
SCALE_FACTOR
,
(
PtEdge
->
m_End0
.
x
)
/
SCALE_FACTOR
,
(
Yaxis_sign
*
PtEdge
->
m_End0
.
y
)
/
SCALE_FACTOR
,
(
Yaxis_sign
*
PtEdge
->
GetEnd0
()
.
y
)
/
SCALE_FACTOR
,
(
PtEdge
->
m_Start0
.
x
)
/
SCALE_FACTOR
,
(
PtEdge
->
GetStart0
()
.
x
)
/
SCALE_FACTOR
,
(
Yaxis_sign
*
PtEdge
->
m_Start0
.
y
)
/
SCALE_FACTOR
);
(
Yaxis_sign
*
PtEdge
->
GetStart0
()
.
y
)
/
SCALE_FACTOR
);
}
}
else
else
{
{
fprintf
(
aFile
,
"ARC %g %g %g %g %g %g
\n
"
,
fprintf
(
aFile
,
"ARC %g %g %g %g %g %g
\n
"
,
(
PtEdge
->
m_End0
.
x
)
/
SCALE_FACTOR
,
(
PtEdge
->
GetEnd0
()
.
x
)
/
SCALE_FACTOR
,
(
Yaxis_sign
*
PtEdge
->
m_End0
.
y
)
/
SCALE_FACTOR
,
(
Yaxis_sign
*
PtEdge
->
GetEnd0
()
.
y
)
/
SCALE_FACTOR
,
(
arcendx
)
/
SCALE_FACTOR
,
(
arcendx
)
/
SCALE_FACTOR
,
(
Yaxis_sign
*
arcendy
)
/
SCALE_FACTOR
,
(
Yaxis_sign
*
arcendy
)
/
SCALE_FACTOR
,
(
PtEdge
->
m_Start0
.
x
)
/
SCALE_FACTOR
,
(
PtEdge
->
GetStart0
()
.
x
)
/
SCALE_FACTOR
,
(
Yaxis_sign
*
PtEdge
->
m_Start0
.
y
)
/
SCALE_FACTOR
);
(
Yaxis_sign
*
PtEdge
->
GetStart0
()
.
y
)
/
SCALE_FACTOR
);
}
}
break
;
break
;
}
}
...
...
pcbnew/export_vrml.cpp
View file @
96bb90de
...
@@ -593,16 +593,16 @@ static void export_vrml_arc( int layer, double startx, double starty, /*{{{*/
...
@@ -593,16 +593,16 @@ static void export_vrml_arc( int layer, double startx, double starty, /*{{{*/
static
void
export_vrml_drawsegment
(
DRAWSEGMENT
*
drawseg
)
/*{{{*/
static
void
export_vrml_drawsegment
(
DRAWSEGMENT
*
drawseg
)
/*{{{*/
{
{
int
layer
=
drawseg
->
GetLayer
();
int
layer
=
drawseg
->
GetLayer
();
double
w
=
drawseg
->
m_Width
;
double
w
=
drawseg
->
GetWidth
()
;
double
x
=
drawseg
->
m_Start
.
x
;
double
x
=
drawseg
->
GetStart
()
.
x
;
double
y
=
drawseg
->
m_Start
.
y
;
double
y
=
drawseg
->
GetStart
()
.
y
;
double
xf
=
drawseg
->
m_End
.
x
;
double
xf
=
drawseg
->
GetEnd
()
.
x
;
double
yf
=
drawseg
->
m_End
.
y
;
double
yf
=
drawseg
->
GetEnd
()
.
y
;
/* Items on the edge layer are high, not thick */
/* Items on the edge layer are high, not thick */
if
(
layer
==
EDGE_N
)
if
(
layer
==
EDGE_N
)
{
{
switch
(
drawseg
->
m_Shape
)
switch
(
drawseg
->
GetShape
()
)
{
{
/* There is a special 'varc' primitive for this */
/* There is a special 'varc' primitive for this */
case
S_ARC
:
case
S_ARC
:
...
@@ -630,7 +630,7 @@ static void export_vrml_drawsegment( DRAWSEGMENT* drawseg ) /*{{{*/
...
@@ -630,7 +630,7 @@ static void export_vrml_drawsegment( DRAWSEGMENT* drawseg ) /*{{{*/
}
}
else
else
{
{
switch
(
drawseg
->
m_Shape
)
switch
(
drawseg
->
GetShape
()
)
{
{
case
S_ARC
:
case
S_ARC
:
export_vrml_arc
(
layer
,
x
,
y
,
xf
,
yf
,
w
,
3
);
export_vrml_arc
(
layer
,
x
,
y
,
xf
,
yf
,
w
,
3
);
...
@@ -856,13 +856,13 @@ static void export_vrml_text_module( TEXTE_MODULE* module ) /*{{{*/
...
@@ -856,13 +856,13 @@ static void export_vrml_text_module( TEXTE_MODULE* module ) /*{{{*/
static
void
export_vrml_edge_module
(
EDGE_MODULE
*
module
)
/*{{{*/
static
void
export_vrml_edge_module
(
EDGE_MODULE
*
module
)
/*{{{*/
{
{
int
layer
=
module
->
GetLayer
();
int
layer
=
module
->
GetLayer
();
double
x
=
module
->
m_Start
.
x
;
double
x
=
module
->
GetStart
()
.
x
;
double
y
=
module
->
m_Start
.
y
;
double
y
=
module
->
GetStart
()
.
y
;
double
xf
=
module
->
m_End
.
x
;
double
xf
=
module
->
GetEnd
()
.
x
;
double
yf
=
module
->
m_End
.
y
;
double
yf
=
module
->
GetEnd
()
.
y
;
double
w
=
module
->
m_Width
;
double
w
=
module
->
GetWidth
()
;
switch
(
module
->
m_Shape
)
switch
(
module
->
GetShape
()
)
{
{
case
S_ARC
:
case
S_ARC
:
export_vrml_arc
(
layer
,
x
,
y
,
xf
,
yf
,
w
,
3
);
export_vrml_arc
(
layer
,
x
,
y
,
xf
,
yf
,
w
,
3
);
...
...
pcbnew/gen_modules_placefile.cpp
View file @
96bb90de
...
@@ -515,15 +515,15 @@ void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
...
@@ -515,15 +515,15 @@ void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
double
radius
,
width
;
double
radius
,
width
;
char
line
[
1024
];
char
line
[
1024
];
ux0
=
PtDrawSegment
->
m_Start
.
x
*
conv_unit
;
ux0
=
PtDrawSegment
->
GetStart
()
.
x
*
conv_unit
;
uy0
=
PtDrawSegment
->
m_Start
.
y
*
conv_unit
;
uy0
=
PtDrawSegment
->
GetStart
()
.
y
*
conv_unit
;
dx
=
PtDrawSegment
->
m_End
.
x
*
conv_unit
;
dx
=
PtDrawSegment
->
GetEnd
()
.
x
*
conv_unit
;
dy
=
PtDrawSegment
->
m_End
.
y
*
conv_unit
;
dy
=
PtDrawSegment
->
GetEnd
()
.
y
*
conv_unit
;
width
=
PtDrawSegment
->
m_Width
*
conv_unit
;
width
=
PtDrawSegment
->
GetWidth
()
*
conv_unit
;
switch
(
PtDrawSegment
->
m_Shape
)
switch
(
PtDrawSegment
->
GetShape
()
)
{
{
case
S_CIRCLE
:
case
S_CIRCLE
:
radius
=
hypot
(
dx
-
ux0
,
dy
-
uy0
);
radius
=
hypot
(
dx
-
ux0
,
dy
-
uy0
);
...
@@ -536,13 +536,15 @@ void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
...
@@ -536,13 +536,15 @@ void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
case
S_ARC
:
case
S_ARC
:
{
{
int
endx
=
PtDrawSegment
->
m_End
.
x
,
endy
=
PtDrawSegment
->
m_End
.
y
;
int
endx
=
PtDrawSegment
->
GetEnd
().
x
;
int
endy
=
PtDrawSegment
->
GetEnd
().
y
;
radius
=
hypot
(
dx
-
ux0
,
dy
-
uy0
);
radius
=
hypot
(
dx
-
ux0
,
dy
-
uy0
);
RotatePoint
(
&
endx
,
RotatePoint
(
&
endx
,
&
endy
,
&
endy
,
PtDrawSegment
->
m_Start
.
x
,
PtDrawSegment
->
GetStart
()
.
x
,
PtDrawSegment
->
m_Start
.
y
,
PtDrawSegment
->
GetStart
()
.
y
,
PtDrawSegment
->
m_Angle
);
PtDrawSegment
->
GetAngle
()
);
fprintf
(
rptfile
,
"$ARC
\n
"
);
fprintf
(
rptfile
,
"$ARC
\n
"
);
fprintf
(
rptfile
,
"centre %.6lf %.6lf
\n
"
,
ux0
,
uy0
);
fprintf
(
rptfile
,
"centre %.6lf %.6lf
\n
"
,
ux0
,
uy0
);
...
...
pcbnew/gpcb_exchange.cpp
View file @
96bb90de
...
@@ -158,13 +158,15 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
...
@@ -158,13 +158,15 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
#define TEXT_DEFAULT_SIZE 400
#define TEXT_DEFAULT_SIZE 400
#define OLD_GPCB_UNIT_CONV 10
#define OLD_GPCB_UNIT_CONV 10
#define NEW_GPCB_UNIT_CONV 0.1
#define NEW_GPCB_UNIT_CONV 0.1
FILE
*
cmpfile
;
FILE
*
cmpfile
;
double
conv_unit
=
NEW_GPCB_UNIT_CONV
;
// GPCB unit = 0.01 mils and Pcbnew 0.1
double
conv_unit
=
NEW_GPCB_UNIT_CONV
;
// GPCB unit = 0.01 mils and Pcbnew 0.1
// Old version unit = 1 mil, so conv_unit is 10 or 0.1
// Old version unit = 1 mil, so conv_unit is 10 or 0.1
bool
success
=
true
;
bool
success
=
true
;
char
*
L
ine
;
char
*
l
ine
;
long
ibuf
[
100
];
long
ibuf
[
100
];
EDGE_MODULE
*
DrawSegm
;
EDGE_MODULE
*
drawSeg
;
D_PAD
*
Pad
;
D_PAD
*
Pad
;
wxArrayString
params
;
wxArrayString
params
;
int
iprmcnt
,
icnt_max
,
iflgidx
;
int
iprmcnt
,
icnt_max
,
iflgidx
;
...
@@ -178,10 +180,10 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
...
@@ -178,10 +180,10 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
reader
.
ReadLine
();
reader
.
ReadLine
();
L
ine
=
reader
.
Line
();
l
ine
=
reader
.
Line
();
params
.
Clear
();
params
.
Clear
();
Extract_Parameters
(
params
,
L
ine
);
Extract_Parameters
(
params
,
l
ine
);
iprmcnt
=
0
;
iprmcnt
=
0
;
icnt_max
=
params
.
GetCount
();
icnt_max
=
params
.
GetCount
();
...
@@ -224,6 +226,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
...
@@ -224,6 +226,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
iprmcnt
++
;
iprmcnt
++
;
for
(
int
ii
=
0
;
ii
<
20
;
ii
++
)
for
(
int
ii
=
0
;
ii
<
20
;
ii
++
)
ibuf
[
ii
]
=
0
;
ibuf
[
ii
]
=
0
;
for
(
int
ii
=
0
;
ii
<=
8
;
ii
++
,
iprmcnt
++
)
// upt to 6 params + terminal char.
for
(
int
ii
=
0
;
ii
<=
8
;
ii
++
,
iprmcnt
++
)
// upt to 6 params + terminal char.
{
{
if
(
iprmcnt
>=
icnt_max
)
if
(
iprmcnt
>=
icnt_max
)
...
@@ -239,7 +242,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
...
@@ -239,7 +242,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
if
(
ii
<=
5
)
// no module position
if
(
ii
<=
5
)
// no module position
idx
=
0
;
idx
=
0
;
break
;
break
;
}
}
params
[
iprmcnt
].
ToLong
(
&
ibuf
[
ii
]
);
params
[
iprmcnt
].
ToLong
(
&
ibuf
[
ii
]
);
}
}
}
}
...
@@ -265,9 +268,10 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
...
@@ -265,9 +268,10 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
while
(
reader
.
ReadLine
()
)
while
(
reader
.
ReadLine
()
)
{
{
L
ine
=
reader
.
Line
();
l
ine
=
reader
.
Line
();
params
.
Clear
();
params
.
Clear
();
Extract_Parameters
(
params
,
Line
);
Extract_Parameters
(
params
,
line
);
if
(
params
.
GetCount
()
>
3
)
// Test units value for a string line param (more than 3 params : ident [ xx ] )
if
(
params
.
GetCount
()
>
3
)
// Test units value for a string line param (more than 3 params : ident [ xx ] )
{
{
if
(
params
[
1
]
==
wxT
(
"("
)
)
if
(
params
[
1
]
==
wxT
(
"("
)
)
...
@@ -278,17 +282,15 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
...
@@ -278,17 +282,15 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
if
(
params
[
0
].
CmpNoCase
(
wxT
(
"ElementLine"
)
)
==
0
)
// line descr
if
(
params
[
0
].
CmpNoCase
(
wxT
(
"ElementLine"
)
)
==
0
)
// line descr
{
// Format: ElementLine [X1 Y1 X2 Y2 Thickness]
{
// Format: ElementLine [X1 Y1 X2 Y2 Thickness]
DrawSegm
=
new
EDGE_MODULE
(
this
)
;
wxPoint
start0
;
DrawSegm
->
SetLayer
(
SILKSCREEN_N_FRONT
)
;
wxPoint
end0
;
DrawSegm
->
m_Shape
=
S_SEGMENT
;
int
width
;
m_Drawings
.
PushBack
(
DrawSegm
);
int
*
list
[
5
]
=
{
&
start0
.
x
,
&
start0
.
y
,
int
*
list
[
5
]
=
{
&
end0
.
x
,
&
end0
.
y
,
&
DrawSegm
->
m_Start0
.
x
,
&
DrawSegm
->
m_Start0
.
y
,
&
width
&
DrawSegm
->
m_End0
.
x
,
&
DrawSegm
->
m_End0
.
y
,
};
&
DrawSegm
->
m_Width
};
for
(
unsigned
ii
=
0
;
ii
<
5
;
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
5
;
ii
++
)
{
{
...
@@ -301,18 +303,29 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
...
@@ -301,18 +303,29 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
}
}
}
}
DrawSegm
->
SetDrawCoord
();
drawSeg
=
new
EDGE_MODULE
(
this
);
drawSeg
->
SetLayer
(
SILKSCREEN_N_FRONT
);
drawSeg
->
SetShape
(
S_SEGMENT
);
drawSeg
->
SetStart0
(
start0
);
drawSeg
->
SetEnd0
(
end0
);
drawSeg
->
SetWidth
(
width
);
drawSeg
->
SetDrawCoord
();
m_Drawings
.
PushBack
(
drawSeg
);
continue
;
continue
;
}
}
if
(
params
[
0
].
CmpNoCase
(
wxT
(
"ElementArc"
)
)
==
0
)
// Arc descr
if
(
params
[
0
].
CmpNoCase
(
wxT
(
"ElementArc"
)
)
==
0
)
// Arc descr
{
// format: ElementArc [X Y Width Height StartAngle DeltaAngle Thickness]
{
// format: ElementArc [X Y Width Height StartAngle DeltaAngle Thickness]
// Pcbnew does know ellipse so we must have Width = Height
// Pcbnew does know ellipse so we must have Width = Height
DrawSegm
=
new
EDGE_MODULE
(
this
);
drawSeg
=
new
EDGE_MODULE
(
this
);
DrawSegm
->
SetLayer
(
SILKSCREEN_N_FRONT
);
drawSeg
->
SetLayer
(
SILKSCREEN_N_FRONT
);
DrawSegm
->
m_Shape
=
S_ARC
;
drawSeg
->
SetShape
(
S_ARC
)
;
m_Drawings
.
PushBack
(
DrawSegm
);
m_Drawings
.
PushBack
(
drawSeg
);
for
(
unsigned
ii
=
0
;
ii
<
7
;
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
7
;
ii
++
)
{
{
...
@@ -328,21 +341,29 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
...
@@ -328,21 +341,29 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
ibuf
[
ii
]
=
0
;
ibuf
[
ii
]
=
0
;
}
}
int
radius
=
(
ibuf
[
2
]
+
ibuf
[
3
])
/
4
;
// for and arc: ibuf[3] = ibuf[4]. Pcbnew does not know ellipses
// for and arc: ibuf[3] = ibuf[4]. Pcbnew does not know ellipses
int
radius
=
(
ibuf
[
2
]
+
ibuf
[
3
])
/
4
;
wxPoint
centre
;
wxPoint
centre
;
centre
.
x
=
wxRound
(
ibuf
[
0
]
*
conv_unit
);
centre
.
x
=
wxRound
(
ibuf
[
0
]
*
conv_unit
);
centre
.
y
=
wxRound
(
ibuf
[
1
]
*
conv_unit
);
centre
.
y
=
wxRound
(
ibuf
[
1
]
*
conv_unit
);
DrawSegm
->
m_Start0
=
centre
;
int
start_angle
=
ibuf
[
4
]
*
10
;
// Pcbnew uses 0.1 degrees as units
drawSeg
->
SetStart0
(
centre
);
double
start_angle
=
ibuf
[
4
]
*
10
;
// Pcbnew uses 0.1 degrees as units
start_angle
-=
1800
;
// Use normal X axis as reference
start_angle
-=
1800
;
// Use normal X axis as reference
DrawSegm
->
m_Angle
=
ibuf
[
5
]
*
10
;
// Angle value is clockwise in gpcb and Pcbnew
DrawSegm
->
m_End0
.
x
=
wxRound
(
radius
*
conv_unit
);
drawSeg
->
SetAngle
(
ibuf
[
5
]
*
10
);
// Angle value is clockwise in gpcb and Pcbnew
DrawSegm
->
m_End0
.
y
=
0
;
RotatePoint
(
&
DrawSegm
->
m_End0
,
-
start_angle
);
// Calculate start point coordinate of arc
drawSeg
->
SetEnd0
(
wxPoint
(
wxRound
(
radius
*
conv_unit
),
0
)
);
DrawSegm
->
m_End0
+=
centre
;
// Calculate start point coordinate of arc
DrawSegm
->
m_Width
=
wxRound
(
ibuf
[
6
]
*
conv_unit
);
wxPoint
arcStart
(
drawSeg
->
GetEnd0
()
);
DrawSegm
->
SetDrawCoord
();
RotatePoint
(
&
arcStart
,
-
start_angle
);
drawSeg
->
SetEnd0
(
centre
+
arcStart
);
drawSeg
->
SetWidth
(
wxRound
(
ibuf
[
6
]
*
conv_unit
)
);
drawSeg
->
SetDrawCoord
();
continue
;
continue
;
}
}
...
...
pcbnew/ioascii.cpp
View file @
96bb90de
...
@@ -178,13 +178,13 @@ int PCB_BASE_FRAME::ReadListeSegmentDescr( LINE_READER* aReader,
...
@@ -178,13 +178,13 @@ int PCB_BASE_FRAME::ReadListeSegmentDescr( LINE_READER* aReader,
if
(
arg_count
<
7
||
drill
<=
0
)
if
(
arg_count
<
7
||
drill
<=
0
)
newTrack
->
SetDrillDefault
();
newTrack
->
SetDrillDefault
();
else
else
newTrack
->
SetDrill
Value
(
drill
);
newTrack
->
SetDrill
(
drill
);
newTrack
->
SetLayer
(
layer
);
newTrack
->
SetLayer
(
layer
);
if
(
makeType
==
PCB_VIA_T
)
// Ensure layers are OK when possible:
if
(
makeType
==
PCB_VIA_T
)
// Ensure layers are OK when possible:
{
{
if
(
newTrack
->
Shape
()
==
VIA_THROUGH
)
if
(
newTrack
->
Get
Shape
()
==
VIA_THROUGH
)
(
(
SEGVIA
*
)
newTrack
)
->
SetLayerPair
(
LAYER_N_FRONT
,
LAYER_N_BACK
);
(
(
SEGVIA
*
)
newTrack
)
->
SetLayerPair
(
LAYER_N_FRONT
,
LAYER_N_BACK
);
}
}
...
@@ -857,6 +857,8 @@ bool WriteSheetDescr( BASE_SCREEN* screen, FILE* File )
...
@@ -857,6 +857,8 @@ bool WriteSheetDescr( BASE_SCREEN* screen, FILE* File )
}
}
#if !defined( USE_NEW_PCBNEW_LOAD )
static
bool
ReadSheetDescr
(
BASE_SCREEN
*
screen
,
LINE_READER
*
aReader
)
static
bool
ReadSheetDescr
(
BASE_SCREEN
*
screen
,
LINE_READER
*
aReader
)
{
{
char
buf
[
1024
];
char
buf
[
1024
];
...
@@ -963,8 +965,6 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
...
@@ -963,8 +965,6 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
}
}
#if !defined( USE_NEW_PCBNEW_LOAD )
int
PCB_EDIT_FRAME
::
ReadPcbFile
(
LINE_READER
*
aReader
,
bool
Append
)
int
PCB_EDIT_FRAME
::
ReadPcbFile
(
LINE_READER
*
aReader
,
bool
Append
)
{
{
wxBusyCursor
dummy
;
wxBusyCursor
dummy
;
...
@@ -975,8 +975,6 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
...
@@ -975,8 +975,6 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
BOARD
*
board
=
GetBoard
();
BOARD
*
board
=
GetBoard
();
NbDraw
=
NbTrack
=
NbZone
=
NbMod
=
NbNets
=
-
1
;
board
->
m_Status_Pcb
=
0
;
board
->
m_Status_Pcb
=
0
;
board
->
m_NetClasses
.
Clear
();
board
->
m_NetClasses
.
Clear
();
...
...
pcbnew/item_io.cpp
View file @
96bb90de
...
@@ -148,15 +148,15 @@ bool DRAWSEGMENT::Save( FILE* aFile ) const
...
@@ -148,15 +148,15 @@ bool DRAWSEGMENT::Save( FILE* aFile ) const
if
(
m_Type
!=
S_CURVE
)
if
(
m_Type
!=
S_CURVE
)
{
{
fprintf
(
aFile
,
"De %d %d %
d
%lX %X
\n
"
,
fprintf
(
aFile
,
"De %d %d %
g
%lX %X
\n
"
,
m_Layer
,
m_Type
,
m_Angle
,
m_Layer
,
m_Type
,
GetAngle
()
,
m_TimeStamp
,
Return
Status
()
);
m_TimeStamp
,
Get
Status
()
);
}
}
else
else
{
{
fprintf
(
aFile
,
"De %d %d %
d
%lX %X %d %d %d %d
\n
"
,
fprintf
(
aFile
,
"De %d %d %
g
%lX %X %d %d %d %d
\n
"
,
m_Layer
,
m_Type
,
m_Angle
,
m_Layer
,
m_Type
,
GetAngle
()
,
m_TimeStamp
,
Return
Status
(),
m_TimeStamp
,
Get
Status
(),
m_BezierC1
.
x
,
m_BezierC1
.
y
,
m_BezierC1
.
x
,
m_BezierC1
.
y
,
m_BezierC2
.
x
,
m_BezierC2
.
y
);
m_BezierC2
.
x
,
m_BezierC2
.
y
);
}
}
...
@@ -437,8 +437,8 @@ bool TEXTE_PCB::Save( FILE* aFile ) const
...
@@ -437,8 +437,8 @@ bool TEXTE_PCB::Save( FILE* aFile ) const
delete
list
;
delete
list
;
fprintf
(
aFile
,
"Po %d %d %d %d %d %
d
\n
"
,
fprintf
(
aFile
,
"Po %d %d %d %d %d %
g
\n
"
,
m_Pos
.
x
,
m_Pos
.
y
,
m_Size
.
x
,
m_Size
.
y
,
m_Thickness
,
m_Orient
);
m_Pos
.
x
,
m_Pos
.
y
,
m_Size
.
x
,
m_Size
.
y
,
m_Thickness
,
GetOrientation
()
);
char
hJustify
=
'L'
;
char
hJustify
=
'L'
;
switch
(
m_HJustify
)
switch
(
m_HJustify
)
...
@@ -521,10 +521,10 @@ bool EDGE_MODULE::Save( FILE* aFile ) const
...
@@ -521,10 +521,10 @@ bool EDGE_MODULE::Save( FILE* aFile ) const
break
;
break
;
case
S_ARC
:
case
S_ARC
:
ret
=
fprintf
(
aFile
,
"DA %d %d %d %d %
d
%d %d
\n
"
,
ret
=
fprintf
(
aFile
,
"DA %d %d %d %d %
g
%d %d
\n
"
,
m_Start0
.
x
,
m_Start0
.
y
,
m_Start0
.
x
,
m_Start0
.
y
,
m_End0
.
x
,
m_End0
.
y
,
m_End0
.
x
,
m_End0
.
y
,
m_Angle
,
GetAngle
()
,
m_Width
,
m_Layer
);
m_Width
,
m_Layer
);
break
;
break
;
...
@@ -565,7 +565,7 @@ bool TRACK::Save( FILE* aFile ) const
...
@@ -565,7 +565,7 @@ bool TRACK::Save( FILE* aFile ) const
fprintf
(
aFile
,
"De %d %d %d %lX %X
\n
"
,
fprintf
(
aFile
,
"De %d %d %d %lX %X
\n
"
,
m_Layer
,
type
,
GetNet
(),
m_Layer
,
type
,
GetNet
(),
m_TimeStamp
,
Return
Status
()
);
m_TimeStamp
,
Get
Status
()
);
return
true
;
return
true
;
}
}
...
@@ -587,16 +587,16 @@ bool DIMENSION::Save( FILE* aFile ) const
...
@@ -587,16 +587,16 @@ bool DIMENSION::Save( FILE* aFile ) const
fprintf
(
aFile
,
"Va %d
\n
"
,
m_Value
);
fprintf
(
aFile
,
"Va %d
\n
"
,
m_Value
);
if
(
!
m_Text
->
m_Text
.
IsEmpty
()
)
if
(
!
m_Text
.
GetText
()
.
IsEmpty
()
)
fprintf
(
aFile
,
"Te %s
\n
"
,
EscapedUTF8
(
m_Text
->
m_Text
).
c_str
()
);
fprintf
(
aFile
,
"Te %s
\n
"
,
EscapedUTF8
(
m_Text
.
GetText
()
).
c_str
()
);
else
else
fprintf
(
aFile
,
"Te
\"
?
\"\n
"
);
fprintf
(
aFile
,
"Te
\"
?
\"\n
"
);
fprintf
(
aFile
,
"Po %d %d %d %d %d %
d
%d
\n
"
,
fprintf
(
aFile
,
"Po %d %d %d %d %d %
g
%d
\n
"
,
m_Text
->
m_Pos
.
x
,
m_Text
->
m_Pos
.
y
,
m_Text
.
m_Pos
.
x
,
m_Text
.
m_Pos
.
y
,
m_Text
->
m_Size
.
x
,
m_Text
->
m_Size
.
y
,
m_Text
.
m_Size
.
x
,
m_Text
.
m_Size
.
y
,
m_Text
->
GetThickness
(),
m_Text
->
GetOrientation
(),
m_Text
.
GetThickness
(),
m_Text
.
GetOrientation
(),
m_Text
->
m_Mirror
?
0
:
1
);
m_Text
.
m_Mirror
?
0
:
1
);
fprintf
(
aFile
,
"Sb %d %d %d %d %d %d
\n
"
,
S_SEGMENT
,
fprintf
(
aFile
,
"Sb %d %d %d %d %d %d
\n
"
,
S_SEGMENT
,
m_crossBarOx
,
m_crossBarOy
,
m_crossBarOx
,
m_crossBarOy
,
...
@@ -747,9 +747,9 @@ bool MODULE::Save( FILE* aFile ) const
...
@@ -747,9 +747,9 @@ bool MODULE::Save( FILE* aFile ) const
else
else
statusTxt
[
1
]
=
'~'
;
statusTxt
[
1
]
=
'~'
;
fprintf
(
aFile
,
"Po %d %d %
d
%d %8.8lX %8.8lX %s
\n
"
,
fprintf
(
aFile
,
"Po %d %d %
g
%d %8.8lX %8.8lX %s
\n
"
,
m_Pos
.
x
,
m_Pos
.
y
,
m_Pos
.
x
,
m_Pos
.
y
,
m_Orient
,
m_Layer
,
m_LastEdit_Time
,
GetOrientation
()
,
m_Layer
,
m_LastEdit_Time
,
m_TimeStamp
,
statusTxt
);
m_TimeStamp
,
statusTxt
);
fprintf
(
aFile
,
"Li %s
\n
"
,
TO_UTF8
(
m_LibRef
)
);
fprintf
(
aFile
,
"Li %s
\n
"
,
TO_UTF8
(
m_LibRef
)
);
...
@@ -1158,12 +1158,15 @@ int MODULE::ReadDescr( LINE_READER* aReader )
...
@@ -1158,12 +1158,15 @@ int MODULE::ReadDescr( LINE_READER* aReader )
switch
(
Line
[
0
]
)
switch
(
Line
[
0
]
)
{
{
case
'P'
:
case
'P'
:
double
orientation
;
memset
(
BufCar1
,
0
,
sizeof
(
BufCar1
)
);
memset
(
BufCar1
,
0
,
sizeof
(
BufCar1
)
);
sscanf
(
PtLine
,
"%d %d %
d
%d %lX %lX %s"
,
sscanf
(
PtLine
,
"%d %d %
lf
%d %lX %lX %s"
,
&
m_Pos
.
x
,
&
m_Pos
.
y
,
&
m_Pos
.
x
,
&
m_Pos
.
y
,
&
m_Orient
,
&
m_Layer
,
&
orientation
,
&
m_Layer
,
&
m_LastEdit_Time
,
&
m_TimeStamp
,
BufCar1
);
&
m_LastEdit_Time
,
&
m_TimeStamp
,
BufCar1
);
SetOrientation
(
orientation
);
m_ModuleStatus
=
0
;
m_ModuleStatus
=
0
;
if
(
BufCar1
[
0
]
==
'F'
)
if
(
BufCar1
[
0
]
==
'F'
)
...
@@ -1331,11 +1334,14 @@ int EDGE_MODULE::ReadDescr( LINE_READER* aReader )
...
@@ -1331,11 +1334,14 @@ int EDGE_MODULE::ReadDescr( LINE_READER* aReader )
switch
(
m_Shape
)
switch
(
m_Shape
)
{
{
case
S_ARC
:
case
S_ARC
:
sscanf
(
Line
+
3
,
"%d %d %d %d %d %d %d"
,
double
angle
;
sscanf
(
Line
+
3
,
"%d %d %d %d %lf %d %d"
,
&
m_Start0
.
x
,
&
m_Start0
.
y
,
&
m_Start0
.
x
,
&
m_Start0
.
y
,
&
m_End0
.
x
,
&
m_End0
.
y
,
&
m_End0
.
x
,
&
m_End0
.
y
,
&
m_Angle
,
&
m_Width
,
&
m_Layer
);
&
angle
,
&
m_Width
,
&
m_Layer
);
NORMALIZE_ANGLE_360
(
m_Angle
);
NORMALIZE_ANGLE_360
(
angle
);
SetAngle
(
angle
);
break
;
break
;
case
S_SEGMENT
:
case
S_SEGMENT
:
...
@@ -1441,14 +1447,14 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader )
...
@@ -1441,14 +1447,14 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader )
layer
=
LAST_NO_COPPER_LAYER
;
layer
=
LAST_NO_COPPER_LAYER
;
SetLayer
(
layer
);
SetLayer
(
layer
);
m_Text
->
SetLayer
(
layer
);
m_Text
.
SetLayer
(
layer
);
continue
;
continue
;
}
}
if
(
Line
[
0
]
==
'T'
)
if
(
Line
[
0
]
==
'T'
)
{
{
ReadDelimitedText
(
Text
,
Line
+
2
,
sizeof
(
Text
)
);
ReadDelimitedText
(
Text
,
Line
+
2
,
sizeof
(
Text
)
);
m_Text
->
m_Text
=
FROM_UTF8
(
Text
);
m_Text
.
m_Text
=
FROM_UTF8
(
Text
);
continue
;
continue
;
}
}
...
@@ -1458,15 +1464,15 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader )
...
@@ -1458,15 +1464,15 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader )
int
orientation
;
int
orientation
;
int
thickness
;
int
thickness
;
sscanf
(
Line
+
2
,
" %d %d %d %d %d %d %d"
,
sscanf
(
Line
+
2
,
" %d %d %d %d %d %d %d"
,
&
m_Text
->
m_Pos
.
x
,
&
m_Text
->
m_Pos
.
y
,
&
m_Text
.
m_Pos
.
x
,
&
m_Text
.
m_Pos
.
y
,
&
m_Text
->
m_Size
.
x
,
&
m_Text
->
m_Size
.
y
,
&
m_Text
.
m_Size
.
x
,
&
m_Text
.
m_Size
.
y
,
&
thickness
,
&
orientation
,
&
thickness
,
&
orientation
,
&
normal_display
);
&
normal_display
);
m_Text
->
m_Mirror
=
normal_display
?
false
:
true
;
m_Text
.
m_Mirror
=
normal_display
?
false
:
true
;
m_Pos
=
m_Text
->
m_Pos
;
m_Pos
=
m_Text
.
m_Pos
;
m_Text
->
SetOrientation
(
orientation
);
m_Text
.
SetOrientation
(
orientation
);
m_Text
->
SetThickness
(
thickness
);
m_Text
.
SetThickness
(
thickness
);
continue
;
continue
;
}
}
...
@@ -1580,7 +1586,9 @@ bool DRAWSEGMENT::ReadDrawSegmentDescr( LINE_READER* aReader )
...
@@ -1580,7 +1586,9 @@ bool DRAWSEGMENT::ReadDrawSegmentDescr( LINE_READER* aReader )
sscanf
(
token
,
"%d"
,
&
m_Type
);
sscanf
(
token
,
"%d"
,
&
m_Type
);
break
;
break
;
case
2
:
case
2
:
sscanf
(
token
,
"%d"
,
&
m_Angle
);
double
angle
;
sscanf
(
token
,
"%lf"
,
&
angle
);
SetAngle
(
angle
);
break
;
break
;
case
3
:
case
3
:
sscanf
(
token
,
"%lX"
,
&
m_TimeStamp
);
sscanf
(
token
,
"%lX"
,
&
m_TimeStamp
);
...
@@ -2062,9 +2070,12 @@ int TEXTE_PCB::ReadTextePcbDescr( LINE_READER* aReader )
...
@@ -2062,9 +2070,12 @@ int TEXTE_PCB::ReadTextePcbDescr( LINE_READER* aReader )
}
}
if
(
strncmp
(
line
,
"Po"
,
2
)
==
0
)
if
(
strncmp
(
line
,
"Po"
,
2
)
==
0
)
{
{
sscanf
(
line
+
2
,
" %d %d %d %d %d %d"
,
double
angle
;
sscanf
(
line
+
2
,
" %d %d %d %d %d %lf"
,
&
m_Pos
.
x
,
&
m_Pos
.
y
,
&
m_Size
.
x
,
&
m_Size
.
y
,
&
m_Pos
.
x
,
&
m_Pos
.
y
,
&
m_Size
.
x
,
&
m_Size
.
y
,
&
m_Thickness
,
&
m_Orient
);
&
m_Thickness
,
&
angle
);
SetOrientation
(
angle
);
// Ensure the text has minimal size to see this text on screen:
// Ensure the text has minimal size to see this text on screen:
if
(
m_Size
.
x
<
5
)
if
(
m_Size
.
x
<
5
)
...
@@ -2135,6 +2146,7 @@ int TEXTE_MODULE::ReadDescr( LINE_READER* aReader )
...
@@ -2135,6 +2146,7 @@ int TEXTE_MODULE::ReadDescr( LINE_READER* aReader )
int
type
;
int
type
;
char
BufCar1
[
128
],
BufCar2
[
128
],
BufCar3
[
128
];
char
BufCar1
[
128
],
BufCar2
[
128
],
BufCar3
[
128
];
char
*
line
=
aReader
->
Line
();
char
*
line
=
aReader
->
Line
();
double
angle
;
int
layer
=
SILKSCREEN_N_FRONT
;
int
layer
=
SILKSCREEN_N_FRONT
;
...
@@ -2142,16 +2154,19 @@ int TEXTE_MODULE::ReadDescr( LINE_READER* aReader )
...
@@ -2142,16 +2154,19 @@ int TEXTE_MODULE::ReadDescr( LINE_READER* aReader )
BufCar2
[
0
]
=
0
;
BufCar2
[
0
]
=
0
;
BufCar3
[
0
]
=
0
;
BufCar3
[
0
]
=
0
;
if
(
sscanf
(
line
+
1
,
"%d %d %d %d %d %
d
%d %s %s %d %s"
,
if
(
sscanf
(
line
+
1
,
"%d %d %d %d %d %
lf
%d %s %s %d %s"
,
&
type
,
&
type
,
&
m_Pos0
.
x
,
&
m_Pos0
.
y
,
&
m_Pos0
.
x
,
&
m_Pos0
.
y
,
&
m_Size
.
y
,
&
m_Size
.
x
,
&
m_Size
.
y
,
&
m_Size
.
x
,
&
m_Orient
,
&
m_Thickness
,
&
angle
,
&
m_Thickness
,
BufCar1
,
BufCar2
,
&
layer
,
BufCar3
)
>=
10
)
BufCar1
,
BufCar2
,
&
layer
,
BufCar3
)
>=
10
)
{
{
success
=
true
;
success
=
true
;
SetOrientation
(
angle
);
}
}
if
(
(
type
!=
TEXT_is_REFERENCE
)
&&
(
type
!=
TEXT_is_VALUE
)
)
if
(
(
type
!=
TEXT_is_REFERENCE
)
&&
(
type
!=
TEXT_is_VALUE
)
)
type
=
TEXT_is_DIVERS
;
type
=
TEXT_is_DIVERS
;
...
...
pcbnew/kicad_plugin.cpp
View file @
96bb90de
...
@@ -225,7 +225,7 @@ void KICAD_PLUGIN::loadAllSections( bool doAppend )
...
@@ -225,7 +225,7 @@ void KICAD_PLUGIN::loadAllSections( bool doAppend )
else
if
(
TESTLINE
(
"$DRAWSEGMENT"
)
)
else
if
(
TESTLINE
(
"$DRAWSEGMENT"
)
)
{
{
load
DRAWSEGMENT
();
load
PCB_LINE
();
}
}
else
if
(
TESTLINE
(
"$EQUIPOT"
)
)
else
if
(
TESTLINE
(
"$EQUIPOT"
)
)
...
@@ -408,7 +408,7 @@ void KICAD_PLUGIN::loadGENERAL()
...
@@ -408,7 +408,7 @@ void KICAD_PLUGIN::loadGENERAL()
m_board
->
SetBoundingBox
(
bbbox
);
m_board
->
SetBoundingBox
(
bbbox
);
}
}
/
/
Read the number of segments of type DRAW, TRACK, ZONE
/
*
Read the number of segments of type DRAW, TRACK, ZONE
else if( TESTLINE( "Ndraw" ) )
else if( TESTLINE( "Ndraw" ) )
{
{
NbDraw = intParse( line + SZ( "Ndraw" ) );
NbDraw = intParse( line + SZ( "Ndraw" ) );
...
@@ -433,6 +433,7 @@ void KICAD_PLUGIN::loadGENERAL()
...
@@ -433,6 +433,7 @@ void KICAD_PLUGIN::loadGENERAL()
{
{
NbNets = intParse( line + SZ( "Nnets" ) );
NbNets = intParse( line + SZ( "Nnets" ) );
}
}
*/
else
if
(
TESTLINE
(
"$EndGENERAL"
)
)
else
if
(
TESTLINE
(
"$EndGENERAL"
)
)
return
;
// preferred exit
return
;
// preferred exit
...
@@ -854,7 +855,7 @@ void KICAD_PLUGIN::loadMODULE()
...
@@ -854,7 +855,7 @@ void KICAD_PLUGIN::loadMODULE()
if
(
TESTLINE
(
"D"
)
)
// read a drawing item, e.g. "DS"
if
(
TESTLINE
(
"D"
)
)
// read a drawing item, e.g. "DS"
{
{
load
EDGE_MODUL
E
(
module
.
get
()
);
load
MODULE_EDG
E
(
module
.
get
()
);
}
}
else
if
(
TESTLINE
(
"$PAD"
)
)
else
if
(
TESTLINE
(
"$PAD"
)
)
...
@@ -1204,7 +1205,7 @@ void KICAD_PLUGIN::loadPAD( MODULE* aModule )
...
@@ -1204,7 +1205,7 @@ void KICAD_PLUGIN::loadPAD( MODULE* aModule )
}
}
void
KICAD_PLUGIN
::
load
EDGE_MODUL
E
(
MODULE
*
aModule
)
void
KICAD_PLUGIN
::
load
MODULE_EDG
E
(
MODULE
*
aModule
)
{
{
STROKE_T
shape
;
STROKE_T
shape
;
char
*
line
=
m_reader
->
Line
();
// obtain current (old) line
char
*
line
=
m_reader
->
Line
();
// obtain current (old) line
...
@@ -1494,7 +1495,7 @@ void KICAD_PLUGIN::load3D( MODULE* aModule )
...
@@ -1494,7 +1495,7 @@ void KICAD_PLUGIN::load3D( MODULE* aModule )
}
}
void
KICAD_PLUGIN
::
load
DRAWSEGMENT
()
void
KICAD_PLUGIN
::
load
PCB_LINE
()
{
{
/* example:
/* example:
$DRAWSEGMENT
$DRAWSEGMENT
...
@@ -1564,7 +1565,7 @@ void KICAD_PLUGIN::loadDRAWSEGMENT()
...
@@ -1564,7 +1565,7 @@ void KICAD_PLUGIN::loadDRAWSEGMENT()
dseg
->
SetAngle
(
angle
);
// m_Angle
dseg
->
SetAngle
(
angle
);
// m_Angle
break
;
break
;
case
3
:
case
3
:
long
timestamp
;
long
timestamp
;
timestamp
=
hexParse
(
data
);
timestamp
=
hexParse
(
data
);
dseg
->
SetTimeStamp
(
timestamp
);
dseg
->
SetTimeStamp
(
timestamp
);
break
;
break
;
...
@@ -1808,7 +1809,7 @@ void KICAD_PLUGIN::loadTrackList( TRACK* aInsertBeforeMe, int aStructType )
...
@@ -1808,7 +1809,7 @@ void KICAD_PLUGIN::loadTrackList( TRACK* aInsertBeforeMe, int aStructType )
// "De 0 0 463 0 800000\r\n"
// "De 0 0 463 0 800000\r\n"
#if 1
#if 1
assert
(
TESTLINE
(
"
Po
"
)
);
assert
(
TESTLINE
(
"
De
"
)
);
#else
#else
if
(
!
TESTLINE
(
"De"
)
)
if
(
!
TESTLINE
(
"De"
)
)
{
{
...
@@ -1861,13 +1862,13 @@ void KICAD_PLUGIN::loadTrackList( TRACK* aInsertBeforeMe, int aStructType )
...
@@ -1861,13 +1862,13 @@ void KICAD_PLUGIN::loadTrackList( TRACK* aInsertBeforeMe, int aStructType )
if
(
drill
<=
0
)
if
(
drill
<=
0
)
newTrack
->
SetDrillDefault
();
newTrack
->
SetDrillDefault
();
else
else
newTrack
->
SetDrill
Value
(
drill
);
newTrack
->
SetDrill
(
drill
);
newTrack
->
SetLayer
(
layer
);
newTrack
->
SetLayer
(
layer
);
if
(
makeType
==
PCB_VIA_T
)
// Ensure layers are OK when possible:
if
(
makeType
==
PCB_VIA_T
)
// Ensure layers are OK when possible:
{
{
if
(
newTrack
->
Shape
()
==
VIA_THROUGH
)
if
(
newTrack
->
Get
Shape
()
==
VIA_THROUGH
)
(
(
SEGVIA
*
)
newTrack
)
->
SetLayerPair
(
LAYER_N_FRONT
,
LAYER_N_BACK
);
(
(
SEGVIA
*
)
newTrack
)
->
SetLayerPair
(
LAYER_N_FRONT
,
LAYER_N_BACK
);
}
}
...
@@ -2083,7 +2084,10 @@ void KICAD_PLUGIN::loadZONE_CONTAINER()
...
@@ -2083,7 +2084,10 @@ void KICAD_PLUGIN::loadZONE_CONTAINER()
zc
->
SetFillMode
(
fillmode
?
1
:
0
);
zc
->
SetFillMode
(
fillmode
?
1
:
0
);
if
(
arcsegcount
>=
32
/* ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF: don't really want pcbnew.h in here, after all, its a PLUGIN and global data is evil. */
)
// @todo ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF: don't really want pcbnew.h
// in here, after all, its a PLUGIN and global data is evil.
// put in accessor
if
(
arcsegcount
>=
32
)
arcsegcount
=
32
;
arcsegcount
=
32
;
zc
->
SetArcSegCount
(
arcsegcount
);
zc
->
SetArcSegCount
(
arcsegcount
);
...
@@ -2228,7 +2232,7 @@ void KICAD_PLUGIN::loadDIMENSION()
...
@@ -2228,7 +2232,7 @@ void KICAD_PLUGIN::loadDIMENSION()
dim
->
SetLayer
(
layer
);
dim
->
SetLayer
(
layer
);
dim
->
SetTimeStamp
(
timestamp
);
dim
->
SetTimeStamp
(
timestamp
);
dim
->
m_Shape
=
shape
;
dim
->
SetShape
(
shape
)
;
}
}
else
if
(
TESTLINE
(
"Te"
)
)
else
if
(
TESTLINE
(
"Te"
)
)
...
@@ -2236,7 +2240,7 @@ void KICAD_PLUGIN::loadDIMENSION()
...
@@ -2236,7 +2240,7 @@ void KICAD_PLUGIN::loadDIMENSION()
char
buf
[
2048
];
char
buf
[
2048
];
ReadDelimitedText
(
buf
,
line
+
SZ
(
"Te"
),
sizeof
(
buf
)
);
ReadDelimitedText
(
buf
,
line
+
SZ
(
"Te"
),
sizeof
(
buf
)
);
dim
->
m_Text
->
SetText
(
FROM_UTF8
(
buf
)
);
dim
->
m_Text
.
SetText
(
FROM_UTF8
(
buf
)
);
}
}
else
if
(
TESTLINE
(
"Po"
)
)
else
if
(
TESTLINE
(
"Po"
)
)
...
@@ -2244,28 +2248,23 @@ void KICAD_PLUGIN::loadDIMENSION()
...
@@ -2244,28 +2248,23 @@ void KICAD_PLUGIN::loadDIMENSION()
// sscanf( Line + 2, " %d %d %d %d %d %d %d", &m_Text->m_Pos.x, &m_Text->m_Pos.y,
// sscanf( Line + 2, " %d %d %d %d %d %d %d", &m_Text->m_Pos.x, &m_Text->m_Pos.y,
// &m_Text->m_Size.x, &m_Text->m_Size.y, &thickness, &orientation, &normal_display );
// &m_Text->m_Size.x, &m_Text->m_Size.y, &thickness, &orientation, &normal_display );
int
normal_display
=
1
;
BIU
pos_x
=
biuParse
(
line
+
SZ
(
"Po"
),
&
data
);
BIU
pos_y
=
biuParse
(
data
,
&
data
);
BIU
pos_x
=
biuParse
(
line
+
SZ
(
"Po"
),
&
data
);
BIU
width
=
biuParse
(
data
,
&
data
);
BIU
pos_y
=
biuParse
(
data
,
&
data
);
BIU
height
=
biuParse
(
data
,
&
data
);
BIU
width
=
biuParse
(
data
,
&
data
);
BIU
thickn
=
biuParse
(
data
,
&
data
);
BIU
height
=
biuParse
(
data
,
&
data
);
double
orient
=
degParse
(
data
,
&
data
);
BIU
thickn
=
biuParse
(
data
,
&
data
);
char
*
mirror
=
strtok
(
(
char
*
)
data
,
delims
);
int
orient
=
intParse
(
data
,
&
data
);
data
=
strtok
(
(
char
*
)
data
,
delims
);
if
(
data
)
// optional from old days?
normal_display
=
intParse
(
data
);
// This sets both DIMENSION's position and internal m_Text's.
// This sets both DIMENSION's position and internal m_Text's.
// @todo: But why do we even know about internal m_Text?
// @todo: But why do we even know about internal m_Text?
dim
->
SetPosition
(
wxPoint
(
pos_x
,
pos_y
)
);
dim
->
SetPosition
(
wxPoint
(
pos_x
,
pos_y
)
);
dim
->
SetTextSize
(
wxSize
(
width
,
height
)
);
dim
->
SetTextSize
(
wxSize
(
width
,
height
)
);
dim
->
m_Text
->
m_Mirror
=
normal_display
?
false
:
true
;
dim
->
m_Text
.
SetMirrored
(
mirror
&&
*
mirror
==
'0'
)
;
dim
->
m_Text
->
SetThickness
(
thickn
);
dim
->
m_Text
.
SetThickness
(
thickn
);
dim
->
m_Text
->
SetOrientation
(
orient
);
dim
->
m_Text
.
SetOrientation
(
orient
);
}
}
else
if
(
TESTLINE
(
"Sb"
)
)
else
if
(
TESTLINE
(
"Sb"
)
)
...
@@ -2396,6 +2395,7 @@ void KICAD_PLUGIN::loadPCB_TARGET()
...
@@ -2396,6 +2395,7 @@ void KICAD_PLUGIN::loadPCB_TARGET()
{
{
while
(
READLINE
()
)
while
(
READLINE
()
)
{
{
const
char
*
data
;
char
*
line
=
m_reader
->
Line
();
char
*
line
=
m_reader
->
Line
();
if
(
TESTLINE
(
"$EndPCB_TARGET"
)
)
if
(
TESTLINE
(
"$EndPCB_TARGET"
)
)
...
@@ -2405,8 +2405,6 @@ void KICAD_PLUGIN::loadPCB_TARGET()
...
@@ -2405,8 +2405,6 @@ void KICAD_PLUGIN::loadPCB_TARGET()
else
if
(
TESTLINE
(
"Po"
)
)
else
if
(
TESTLINE
(
"Po"
)
)
{
{
const
char
*
data
;
// sscanf( Line + 2, " %X %d %d %d %d %d %lX", &m_Shape, &m_Layer, &m_Pos.x, &m_Pos.y, &m_Size, &m_Width, &m_TimeStamp );
// sscanf( Line + 2, " %X %d %d %d %d %d %lX", &m_Shape, &m_Layer, &m_Pos.x, &m_Pos.y, &m_Size, &m_Width, &m_TimeStamp );
int
shape
=
intParse
(
line
+
SZ
(
"Po"
),
&
data
);
int
shape
=
intParse
(
line
+
SZ
(
"Po"
),
&
data
);
...
@@ -2549,16 +2547,20 @@ double KICAD_PLUGIN::degParse( const char* aValue, const char** nptrptr )
...
@@ -2549,16 +2547,20 @@ double KICAD_PLUGIN::degParse( const char* aValue, const char** nptrptr )
void
KICAD_PLUGIN
::
init
(
PROPERTIES
*
aProperties
)
void
KICAD_PLUGIN
::
init
(
PROPERTIES
*
aProperties
)
{
{
NbDraw
=
NbTrack
=
NbZone
=
NbMod
=
NbNets
=
-
1
;
// conversion factor for saving RAM BIUs to KICAD legacy file format.
#if defined(KICAD_NANOMETRE)
#if defined(KICAD_NANOMETRE)
biuToDisk
=
1
/
1000000.0
;
// BIUs are nanometers
biuToDisk
=
1
/
1000000.0
;
// BIUs are nanometers
& file is mm
#else
#else
biuToDisk
=
1.0
;
// BIUs are deci-mils
biuToDisk
=
1.0
;
// BIUs are deci-mils
#endif
#endif
// start by assuming the board is in deci-mils.
// if we see "Units mm" in the $GENERAL section, switch to 1000000.0 then.
// conversion factor for loading KICAD legacy file format into BIUs in RAM
// Start by assuming the *.brd file is in deci-mils.
// if we see "Units mm" in the $GENERAL section, set diskToBiu to 1000000.0
// then, during the file loading process, to start a conversion from
// mm to nanometers.
#if defined(KICAD_NANOMETRE)
#if defined(KICAD_NANOMETRE)
diskToBiu
=
2540.0
;
// BIUs are nanometers
diskToBiu
=
2540.0
;
// BIUs are nanometers
...
@@ -2605,12 +2607,12 @@ wxString KICAD_PLUGIN::writeError() const
...
@@ -2605,12 +2607,12 @@ wxString KICAD_PLUGIN::writeError() const
}
}
#define CHECK_WRITE_ERROR() \
#define CHECK_WRITE_ERROR() \
do { \
do { \
if( ferror( m_fp ) ) \
if( ferror( m_fp ) ) \
{ \
{ \
THROW_IO_ERROR( writeError() ); \
THROW_IO_ERROR( writeError() ); \
} \
} \
} while(0)
} while(0)
void
KICAD_PLUGIN
::
saveAllSections
()
const
void
KICAD_PLUGIN
::
saveAllSections
()
const
...
@@ -2644,7 +2646,6 @@ void KICAD_PLUGIN::saveSETUP() const
...
@@ -2644,7 +2646,6 @@ void KICAD_PLUGIN::saveSETUP() const
void
KICAD_PLUGIN
::
saveBOARD
()
const
void
KICAD_PLUGIN
::
saveBOARD
()
const
{
{
#if 1
// save the nets
// save the nets
int
netcount
=
m_board
->
GetNetCount
();
int
netcount
=
m_board
->
GetNetCount
();
for
(
int
i
=
0
;
i
<
netcount
;
++
i
)
for
(
int
i
=
0
;
i
<
netcount
;
++
i
)
...
@@ -2666,10 +2667,10 @@ void KICAD_PLUGIN::saveBOARD() const
...
@@ -2666,10 +2667,10 @@ void KICAD_PLUGIN::saveBOARD() const
savePCB_TEXT
(
(
TEXTE_PCB
*
)
gr
);
savePCB_TEXT
(
(
TEXTE_PCB
*
)
gr
);
break
;
break
;
case
PCB_LINE_T
:
case
PCB_LINE_T
:
save
EDGE_MODUL
E
(
(
EDGE_MODULE
*
)
gr
);
save
MODULE_EDG
E
(
(
EDGE_MODULE
*
)
gr
);
break
;
break
;
case
PCB_TARGET_T
:
case
PCB_TARGET_T
:
saveTARGET
(
(
PCB_TARGET
*
)
gr
);
save
PCB_
TARGET
(
(
PCB_TARGET
*
)
gr
);
break
;
break
;
case
PCB_DIMENSION_T
:
case
PCB_DIMENSION_T
:
saveDIMENTION
(
(
DIMENSION
*
)
gr
);
saveDIMENTION
(
(
DIMENSION
*
)
gr
);
...
@@ -2684,13 +2685,13 @@ void KICAD_PLUGIN::saveBOARD() const
...
@@ -2684,13 +2685,13 @@ void KICAD_PLUGIN::saveBOARD() const
// save the tracks & vias
// save the tracks & vias
fprintf
(
m_fp
,
"$TRACK
\n
"
);
fprintf
(
m_fp
,
"$TRACK
\n
"
);
for
(
TRACK
*
track
=
m_board
->
m_Track
;
track
;
track
=
track
->
Next
()
)
for
(
TRACK
*
track
=
m_board
->
m_Track
;
track
;
track
=
track
->
Next
()
)
saveTRACK
(
(
TRACK
*
)
track
);
saveTRACK
(
track
);
fprintf
(
m_fp
,
"$EndTRACK
\n
"
);
fprintf
(
m_fp
,
"$EndTRACK
\n
"
);
// save the
zones
// save the
old obsolete zones which were done by segments (tracks)
fprintf
(
m_fp
,
"$ZONE
\n
"
);
fprintf
(
m_fp
,
"$ZONE
\n
"
);
for
(
SEGZONE
*
zone
=
m_board
->
m_Zone
;
zone
;
zone
=
zone
->
Next
()
)
for
(
SEGZONE
*
zone
=
m_board
->
m_Zone
;
zone
;
zone
=
zone
->
Next
()
)
save
SEGZONE
(
zone
);
save
TRACK
(
zone
);
fprintf
(
m_fp
,
"$EndZONE
\n
"
);
fprintf
(
m_fp
,
"$EndZONE
\n
"
);
// save the polygon (which are the newer technology) zones
// save the polygon (which are the newer technology) zones
...
@@ -2698,7 +2699,8 @@ void KICAD_PLUGIN::saveBOARD() const
...
@@ -2698,7 +2699,8 @@ void KICAD_PLUGIN::saveBOARD() const
saveZONE_CONTAINER
(
m_board
->
GetArea
(
i
)
);
saveZONE_CONTAINER
(
m_board
->
GetArea
(
i
)
);
fprintf
(
m_fp
,
"$EndBOARD
\n
"
);
fprintf
(
m_fp
,
"$EndBOARD
\n
"
);
#endif
CHECK_WRITE_ERROR
();
}
}
...
@@ -2935,7 +2937,7 @@ void KICAD_PLUGIN::saveMODULE( const MODULE* me ) const
...
@@ -2935,7 +2937,7 @@ void KICAD_PLUGIN::saveMODULE( const MODULE* me ) const
statusTxt
[
2
]
=
'\0'
;
statusTxt
[
2
]
=
'\0'
;
fprintf
(
m_fp
,
"Po %s %g %d %8
.8lX %8.
8lX %s
\n
"
,
fprintf
(
m_fp
,
"Po %s %g %d %8
lX %
8lX %s
\n
"
,
fmtBIUPoint
(
me
->
GetPosition
()
).
c_str
(),
// m_Pos.x, m_Pos.y,
fmtBIUPoint
(
me
->
GetPosition
()
).
c_str
(),
// m_Pos.x, m_Pos.y,
orient
,
orient
,
me
->
GetLayer
(),
me
->
GetLayer
(),
...
@@ -2955,7 +2957,7 @@ void KICAD_PLUGIN::saveMODULE( const MODULE* me ) const
...
@@ -2955,7 +2957,7 @@ void KICAD_PLUGIN::saveMODULE( const MODULE* me ) const
fprintf
(
m_fp
,
"Kw %s
\n
"
,
TO_UTF8
(
me
->
GetKeywords
()
)
);
fprintf
(
m_fp
,
"Kw %s
\n
"
,
TO_UTF8
(
me
->
GetKeywords
()
)
);
}
}
fprintf
(
m_fp
,
"Sc %8
.8
lX
\n
"
,
me
->
GetTimeStamp
()
);
fprintf
(
m_fp
,
"Sc %8lX
\n
"
,
me
->
GetTimeStamp
()
);
fprintf
(
m_fp
,
"AR %s
\n
"
,
TO_UTF8
(
me
->
GetPath
()
)
);
fprintf
(
m_fp
,
"AR %s
\n
"
,
TO_UTF8
(
me
->
GetPath
()
)
);
fprintf
(
m_fp
,
"Op %X %X 0
\n
"
,
me
->
m_CntRot90
,
me
->
m_CntRot180
);
fprintf
(
m_fp
,
"Op %X %X 0
\n
"
,
me
->
m_CntRot90
,
me
->
m_CntRot180
);
...
@@ -3011,6 +3013,8 @@ void KICAD_PLUGIN::saveMODULE( const MODULE* me ) const
...
@@ -3011,6 +3013,8 @@ void KICAD_PLUGIN::saveMODULE( const MODULE* me ) const
save3D
(
me
);
save3D
(
me
);
fprintf
(
m_fp
,
"$EndMODULE %s
\n
"
,
TO_UTF8
(
me
->
GetLibRef
()
)
);
fprintf
(
m_fp
,
"$EndMODULE %s
\n
"
,
TO_UTF8
(
me
->
GetLibRef
()
)
);
CHECK_WRITE_ERROR
();
}
}
...
@@ -3045,234 +3049,177 @@ void KICAD_PLUGIN::save3D( const MODULE* me ) const
...
@@ -3045,234 +3049,177 @@ void KICAD_PLUGIN::save3D( const MODULE* me ) const
}
}
void
KICAD_PLUGIN
::
saveTARGET
(
PCB_TARGET
const
*
)
const
void
KICAD_PLUGIN
::
savePCB_TARGET
(
const
PCB_TARGET
*
me
)
const
{
}
void
KICAD_PLUGIN
::
saveTRACK
(
TRACK
const
*
)
const
{
}
void
KICAD_PLUGIN
::
saveSEGZONE
(
SEGZONE
const
*
)
const
{
}
void
KICAD_PLUGIN
::
saveZONE_CONTAINER
(
ZONE_CONTAINER
const
*
)
const
{
}
void
KICAD_PLUGIN
::
saveDIMENTION
(
DIMENSION
const
*
)
const
{
{
}
fprintf
(
m_fp
,
"$PCB_TARGET
\n
"
);
fprintf
(
m_fp
,
"Po %X %d %s %s %s %8lX
\n
"
,
me
->
GetShape
(),
me
->
GetLayer
(),
fmtBIUPoint
(
me
->
GetPosition
()
).
c_str
(),
fmtBIU
(
me
->
GetSize
()
).
c_str
(),
fmtBIU
(
me
->
GetWidth
()
).
c_str
(),
me
->
GetTimeStamp
()
);
void
KICAD_PLUGIN
::
savePCB_TEXT
(
TEXTE_PCB
const
*
)
const
fprintf
(
m_fp
,
"$EndPCB_TARGET
\n
"
);
{
}
void
KICAD_PLUGIN
::
saveEDGE_MODULE
(
EDGE_MODULE
const
*
)
const
CHECK_WRITE_ERROR
();
{
}
}
#if 0
void
KICAD_PLUGIN
::
savePCB_LINE
(
const
DRAWSEGMENT
*
me
)
const
bool DRAWSEGMENT::Save( FILE* m_fp ) const
{
{
if( fprintf( m_fp, "$DRAWSEGMENT\n" ) != sizeof("$DRAWSEGMENT\n") - 1 )
fprintf
(
m_fp
,
"$DRAWSEGMENT
\n
"
);
return false;
fprintf( m_fp, "Po %d %d %d %d %d %d\n",
fprintf
(
m_fp
,
"Po %d %s %s %s
\n
"
,
m_Shape,
me
->
GetShape
(),
m_Start.x, m_Start.y,
fmtBIUPoint
(
me
->
GetStart
()
).
c_str
(),
m_End.x, m_End.y, m_Width );
fmtBIUPoint
(
me
->
GetEnd
()
).
c_str
(),
fmtBIU
(
me
->
GetWidth
()
).
c_str
()
);
if( m
_Type
!= S_CURVE )
if
(
m
e
->
GetType
()
!=
S_CURVE
)
{
{
fprintf( m_fp, "De %d %d %d %lX %X\n",
fprintf
(
m_fp
,
"De %d %d %g %8lX %X
\n
"
,
m_Layer, m_Type, m_Angle,
me
->
GetLayer
(),
m_TimeStamp, ReturnStatus() );
me
->
GetType
(),
me
->
GetAngle
(),
me
->
GetTimeStamp
(),
me
->
GetStatus
()
);
}
}
else
else
{
{
fprintf( m_fp, "De %d %d %d %lX %X %d %d %d %d\n",
fprintf
(
m_fp
,
"De %d %d %g %8lX %X %s %s
\n
"
,
m_Layer, m_Type, m_Angle,
me
->
GetLayer
(),
m_TimeStamp, ReturnStatus(),
me
->
GetType
(),
m_BezierC1.x,m_BezierC1.y,
me
->
GetAngle
(),
m_BezierC2.x,m_BezierC2.y);
me
->
GetTimeStamp
(),
me
->
GetStatus
(),
fmtBIUPoint
(
me
->
GetBezControl1
()
).
c_str
(),
fmtBIUPoint
(
me
->
GetBezControl2
()
).
c_str
()
);
}
}
if( fprintf( m_fp, "$EndDRAWSEGMENT\n" ) != sizeof("$EndDRAWSEGMENT\n") - 1 )
fprintf
(
m_fp
,
"$EndDRAWSEGMENT
\n
"
);
return false;
return true;
}
}
bool PCB_TARGET::Save( FILE* m_fp
) const
void
KICAD_PLUGIN
::
saveTRACK
(
const
TRACK
*
me
)
const
{
{
bool rc = false;
int
type
=
0
;
if( fprintf( m_fp, "$PCB_TARGET\n" ) != sizeof("$PCB_TARGET\n")-1 )
goto out;
fprintf( m_fp, "Po %X %d %d %d %d %d %8.8lX\n",
m_Shape, m_Layer,
m_Pos.x, m_Pos.y,
m_Size, m_Width, m_TimeStamp );
if(
fprintf( m_fp, "$EndPCB_TARGET\n" ) != sizeof("$EndPCB_TARGET\n")-1
)
if
(
me
->
Type
()
==
PCB_VIA_T
)
goto out
;
type
=
1
;
rc = true;
fprintf
(
m_fp
,
"Po %d %s %s %s %s
\n
"
,
me
->
GetShape
(),
fmtBIUPoint
(
me
->
GetStart
()
).
c_str
(),
fmtBIUPoint
(
me
->
GetEnd
()
).
c_str
(),
fmtBIU
(
me
->
GetWidth
()
).
c_str
(),
fmtBIU
(
me
->
GetDrill
()
).
c_str
()
);
out:
fprintf
(
m_fp
,
"De %d %d %d %8lX %X
\n
"
,
return rc;
me
->
GetLayer
(),
type
,
me
->
GetNet
(),
me
->
GetTimeStamp
(),
me
->
GetStatus
()
);
}
}
bool ZONE_CONTAINER::Save( FILE* m_fp
) const
void
KICAD_PLUGIN
::
saveZONE_CONTAINER
(
const
ZONE_CONTAINER
*
me
)
const
{
{
unsigned item_pos;
int ret;
unsigned corners_count = m_Poly->corner.size();
int outline_hatch;
char padoption;
fprintf
(
m_fp
,
"$CZONE_OUTLINE
\n
"
);
fprintf
(
m_fp
,
"$CZONE_OUTLINE
\n
"
);
// Save the outline main info
// Save the outline main info
ret = fprintf( m_fp, "ZInfo %8.8lX %d %s\n",
fprintf
(
m_fp
,
"ZInfo %8lX %d %s
\n
"
,
m_TimeStamp, m_NetCode,
me
->
GetTimeStamp
(),
me
->
GetNet
(),
EscapedUTF8( m_Netname ).c_str() );
EscapedUTF8
(
me
->
GetNetName
()
).
c_str
()
);
if( ret < 3 )
return false;
// Save the outline layer info
// Save the outline layer info
ret = fprintf( m_fp, "ZLayer %d\n", m_Layer );
fprintf
(
m_fp
,
"ZLayer %d
\n
"
,
me
->
GetLayer
()
);
if( ret < 1 )
return false;
// Save the outline aux info
// Save the outline aux info
switch( m_Poly->GetHatchStyle() )
int
outline_hatch
;
switch
(
me
->
GetHatchStyle
()
)
{
{
default
:
default
:
case CPolyLine::NO_HATCH:
case
CPolyLine
:
:
NO_HATCH
:
outline_hatch
=
'N'
;
break
;
outline_hatch = 'N';
case
CPolyLine
:
:
DIAGONAL_EDGE
:
outline_hatch
=
'E'
;
break
;
break;
case
CPolyLine
:
:
DIAGONAL_FULL
:
outline_hatch
=
'F'
;
break
;
case CPolyLine::DIAGONAL_EDGE:
outline_hatch = 'E';
break;
case CPolyLine::DIAGONAL_FULL:
outline_hatch = 'F';
break;
}
}
ret = fprintf( m_fp, "ZAux %d %c\n", corners_count, outline_hatch );
fprintf
(
m_fp
,
"ZAux %d %c
\n
"
,
me
->
GetNumCorners
(),
outline_hatch
);
if( ret < 2 )
return false;
// Save pad option and clearance
// Save pad option and clearance
switch( m_PadOption )
char
padoption
;
switch
(
me
->
GetPadOption
()
)
{
{
default
:
default
:
case PAD_IN_ZONE:
case
PAD_IN_ZONE
:
padoption
=
'I'
;
break
;
padoption = 'I';
case
THERMAL_PAD
:
padoption
=
'T'
;
break
;
break;
case
PAD_NOT_IN_ZONE
:
padoption
=
'X'
;
break
;
case THERMAL_PAD:
padoption = 'T';
break;
case PAD_NOT_IN_ZONE:
padoption = 'X';
break;
}
}
ret = fprintf( m_fp, "ZClearance %d %c\n", m_ZoneClearance, padoption );
fprintf
(
m_fp
,
"ZClearance %s %c
\n
"
,
fmtBIU
(
me
->
GetZoneClearance
()
).
c_str
(),
padoption
);
if( ret < 2 )
fprintf
(
m_fp
,
"ZMinThickness %s
\n
"
,
fmtBIU
(
me
->
GetMinThickness
()
).
c_str
()
);
return false;
ret = fprintf( m_fp, "ZMinThickness %d\n", m_ZoneMinThickness );
fprintf
(
m_fp
,
"ZOptions %d %d %c %s %s
\n
"
,
me
->
GetFillMode
(),
me
->
GetArcSegCount
(),
me
->
IsFilled
()
?
'S'
:
'F'
,
fmtBIU
(
me
->
GetThermalReliefGap
()
).
c_str
(),
fmtBIU
(
me
->
GetThermalReliefCopperBridge
()
).
c_str
()
);
if( ret < 1 )
fprintf
(
m_fp
,
"ZSmoothing %d %s
\n
"
,
return false;
me
->
GetCornerSmoothingType
(),
fmtBIU
(
me
->
GetCornerRadius
()
).
c_str
()
);
ret = fprintf( m_fp,
typedef
std
::
vector
<
CPolyPt
>
CPOLY_PTS
;
"ZOptions %d %d %c %d %d\n",
m_FillMode,
m_ArcToSegmentsCount,
m_IsFilled ? 'S' : 'F',
m_ThermalReliefGap,
m_ThermalReliefCopperBridge );
if( ret < 3 )
return false;
ret = fprintf( m_fp,
"ZSmoothing %d %d\n",
cornerSmoothingType, cornerRadius );
if( ret < 2 )
return false;
// Save the corner list
// Save the corner list
for( item_pos = 0; item_pos < corners_count; item_pos++ )
const
CPOLY_PTS
&
cv
=
me
->
m_Poly
->
corner
;
for
(
CPOLY_PTS
::
const_iterator
it
=
cv
.
begin
();
it
!=
cv
.
end
();
++
it
)
{
{
ret = fprintf( m_fp, "ZCorner %d %d %d\n",
fprintf
(
m_fp
,
"ZCorner %s %d
\n
"
,
m_Poly->corner[item_pos].x, m_Poly->corner[item_pos].y,
fmtBIUPair
(
it
->
x
,
it
->
y
).
c_str
(),
m_Poly->corner[item_pos].end_contour );
it
->
end_contour
);
if( ret < 3 )
return false;
}
}
// Save the PolysList
// Save the PolysList
if( m_FilledPolysList.size() )
const
CPOLY_PTS
&
fv
=
me
->
m_FilledPolysList
;
if
(
fv
.
size
()
)
{
{
fprintf
(
m_fp
,
"$POLYSCORNERS
\n
"
);
fprintf
(
m_fp
,
"$POLYSCORNERS
\n
"
);
for(
unsigned ii = 0; ii < m_FilledPolysList.size(); ii++
)
for
(
CPOLY_PTS
::
const_iterator
it
=
fv
.
begin
();
it
!=
fv
.
end
();
++
it
)
{
{
const CPolyPt* corner = &m_FilledPolysList[ii];
fprintf
(
m_fp
,
"%s %d %d
\n
"
,
ret = fprintf( m_fp,
fmtBIUPair
(
it
->
x
,
it
->
y
).
c_str
(),
"%d %d %d %d\n",
it
->
end_contour
,
corner->x,
it
->
utility
);
corner->y,
corner->end_contour,
corner->utility );
if( ret < 4 )
return false;
}
}
fprintf
(
m_fp
,
"$endPOLYSCORNERS
\n
"
);
fprintf
(
m_fp
,
"$endPOLYSCORNERS
\n
"
);
}
}
typedef
std
::
vector
<
SEGMENT
>
SEGMENTS
;
// Save the filling segments list
// Save the filling segments list
if( m_FillSegmList.size() )
const
SEGMENTS
&
segs
=
me
->
m_FillSegmList
;
if
(
segs
.
size
()
)
{
{
fprintf
(
m_fp
,
"$FILLSEGMENTS
\n
"
);
fprintf
(
m_fp
,
"$FILLSEGMENTS
\n
"
);
for(
unsigned ii = 0; ii < m_FillSegmList.size(); ii++
)
for
(
SEGMENTS
::
const_iterator
it
=
segs
.
begin
();
it
!=
segs
.
end
();
++
it
)
{
{
ret = fprintf( m_fp, "%d %d %d %d\n",
fprintf
(
m_fp
,
"%s %s
\n
"
,
m_FillSegmList[ii].m_Start.x, m_FillSegmList[ii].m_Start.y,
fmtBIUPoint
(
it
->
m_Start
).
c_str
(),
m_FillSegmList[ii].m_End.x, m_FillSegmList[ii].m_End.y );
fmtBIUPoint
(
it
->
m_End
).
c_str
()
);
if( ret < 4 )
return false;
}
}
fprintf
(
m_fp
,
"$endFILLSEGMENTS
\n
"
);
fprintf
(
m_fp
,
"$endFILLSEGMENTS
\n
"
);
...
@@ -3280,21 +3227,82 @@ bool ZONE_CONTAINER::Save( FILE* m_fp ) const
...
@@ -3280,21 +3227,82 @@ bool ZONE_CONTAINER::Save( FILE* m_fp ) const
fprintf
(
m_fp
,
"$endCZONE_OUTLINE
\n
"
);
fprintf
(
m_fp
,
"$endCZONE_OUTLINE
\n
"
);
return true
;
CHECK_WRITE_ERROR
()
;
}
}
bool TEXTE_PCB::Save( FILE* m_fp
) const
void
KICAD_PLUGIN
::
saveDIMENTION
(
const
DIMENSION
*
me
)
const
{
{
if( m_Text.IsEmpty() )
// note: COTATION was the previous name of DIMENSION
return true;
// this old keyword is used here for compatibility
fprintf
(
m_fp
,
"$COTATION
\n
"
);
fprintf
(
m_fp
,
"Ge %d %d %8lX
\n
"
,
me
->
GetShape
(),
me
->
GetLayer
(),
me
->
GetTimeStamp
()
);
fprintf
(
m_fp
,
"Va %d
\n
"
,
me
->
m_Value
);
if
(
!
me
->
m_Text
.
GetText
().
IsEmpty
()
)
fprintf
(
m_fp
,
"Te %s
\n
"
,
EscapedUTF8
(
me
->
m_Text
.
GetText
()
).
c_str
()
);
else
fprintf
(
m_fp
,
"Te
\"
?
\"\n
"
);
fprintf
(
m_fp
,
"Po %s %s %s %g %d
\n
"
,
fmtBIUPoint
(
me
->
m_Text
.
GetPosition
()
).
c_str
(),
fmtBIUSize
(
me
->
m_Text
.
GetSize
()
).
c_str
(),
fmtBIU
(
me
->
m_Text
.
GetThickness
()
).
c_str
(),
me
->
m_Text
.
GetOrientation
(),
me
->
m_Text
.
IsMirrored
()
?
0
:
1
// strange but true
);
fprintf
(
m_fp
,
"Sb %d %s %s %s
\n
"
,
S_SEGMENT
,
fmtBIUPair
(
me
->
m_crossBarOx
,
me
->
m_crossBarOy
).
c_str
(),
fmtBIUPair
(
me
->
m_crossBarFx
,
me
->
m_crossBarFy
).
c_str
(),
fmtBIU
(
me
->
GetWidth
()
).
c_str
()
);
fprintf
(
m_fp
,
"Sd %d %s %s %s
\n
"
,
S_SEGMENT
,
fmtBIUPair
(
me
->
m_featureLineDOx
,
me
->
m_featureLineDOy
).
c_str
(),
fmtBIUPair
(
me
->
m_featureLineDFx
,
me
->
m_featureLineDFy
).
c_str
(),
fmtBIU
(
me
->
GetWidth
()
).
c_str
()
);
fprintf
(
m_fp
,
"Sg %d %s %s %s
\n
"
,
S_SEGMENT
,
fmtBIUPair
(
me
->
m_featureLineGOx
,
me
->
m_featureLineGOy
).
c_str
(),
fmtBIUPair
(
me
->
m_featureLineGFx
,
me
->
m_featureLineGFy
).
c_str
(),
fmtBIU
(
me
->
GetWidth
()
).
c_str
()
);
fprintf
(
m_fp
,
"S1 %d %s %s %s
\n
"
,
S_SEGMENT
,
fmtBIUPair
(
me
->
m_arrowD1Ox
,
me
->
m_arrowD1Oy
).
c_str
(),
fmtBIUPair
(
me
->
m_arrowD1Fx
,
me
->
m_arrowD1Fy
).
c_str
(),
fmtBIU
(
me
->
GetWidth
()
).
c_str
()
);
fprintf
(
m_fp
,
"S2 %d %s %s %s
\n
"
,
S_SEGMENT
,
fmtBIUPair
(
me
->
m_arrowD2Ox
,
me
->
m_arrowD2Oy
).
c_str
(),
fmtBIUPair
(
me
->
m_arrowD2Fx
,
me
->
m_arrowD2Fy
).
c_str
(),
fmtBIU
(
me
->
GetWidth
()
).
c_str
()
);
fprintf
(
m_fp
,
"S3 %d %s %s %s
\n
"
,
S_SEGMENT
,
fmtBIUPair
(
me
->
m_arrowG1Ox
,
me
->
m_arrowG1Oy
).
c_str
(),
fmtBIUPair
(
me
->
m_arrowG1Fx
,
me
->
m_arrowG1Fy
).
c_str
(),
fmtBIU
(
me
->
GetWidth
()
).
c_str
()
);
fprintf
(
m_fp
,
"S4 %d %s %s %s
\n
"
,
S_SEGMENT
,
fmtBIUPair
(
me
->
m_arrowG2Ox
,
me
->
m_arrowG2Oy
).
c_str
(),
fmtBIUPair
(
me
->
m_arrowG2Fx
,
me
->
m_arrowG2Fy
).
c_str
(),
fmtBIU
(
me
->
GetWidth
()
).
c_str
()
);
fprintf
(
m_fp
,
"$endCOTATION
\n
"
);
if( fprintf( m_fp, "$TEXTPCB\n" ) != sizeof("$TEXTPCB\n") - 1 )
CHECK_WRITE_ERROR
();
return false;
}
void
KICAD_PLUGIN
::
savePCB_TEXT
(
const
TEXTE_PCB
*
me
)
const
{
if
(
me
->
GetText
().
IsEmpty
()
)
return
;
const char* style = m_Italic ? "Italic" : "Normal"
;
fprintf
(
m_fp
,
"$TEXTPCB
\n
"
)
;
wxArrayString* list = wxStringSplit( m
_Text
, '\n' );
wxArrayString
*
list
=
wxStringSplit
(
m
e
->
GetText
()
,
'\n'
);
for
(
unsigned
ii
=
0
;
ii
<
list
->
Count
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
list
->
Count
();
ii
++
)
{
{
...
@@ -3308,118 +3316,28 @@ bool TEXTE_PCB::Save( FILE* m_fp ) const
...
@@ -3308,118 +3316,28 @@ bool TEXTE_PCB::Save( FILE* m_fp ) const
delete
list
;
delete
list
;
fprintf( m_fp, "Po %d %d %d %d %d %d\n",
fprintf
(
m_fp
,
"Po %s %s %s %g
\n
"
,
m_Pos.x, m_Pos.y, m_Size.x, m_Size.y, m_Thickness, m_Orient );
fmtBIUPoint
(
me
->
GetPosition
()
).
c_str
(),
fmtBIUSize
(
me
->
GetSize
()
).
c_str
(),
fmtBIU
(
me
->
GetThickness
()
).
c_str
(),
me
->
GetOrientation
()
);
char
hJustify
;
char hJustify = 'L';
switch
(
me
->
GetHorizJustify
()
)
switch( m_HJustify )
{
{
case GR_TEXT_HJUSTIFY_LEFT:
hJustify = 'L';
break;
case GR_TEXT_HJUSTIFY_CENTER:
hJustify = 'C';
break;
case GR_TEXT_HJUSTIFY_RIGHT:
hJustify = 'R';
break;
default
:
default
:
hJustify = 'C';
case
GR_TEXT_HJUSTIFY_CENTER
:
hJustify
=
'C'
;
break
;
break;
case
GR_TEXT_HJUSTIFY_LEFT
:
hJustify
=
'L'
;
break
;
case
GR_TEXT_HJUSTIFY_RIGHT
:
hJustify
=
'R'
;
break
;
}
}
fprintf( m_fp, "De %d %d %lX %s %c\n", m_Layer,
fprintf
(
m_fp
,
"De %d %d %8lX %s %c
\n
"
,
m_Mirror ? 0 : 1,
me
->
GetLayer
(),
m_TimeStamp, style, hJustify );
!
me
->
IsMirrored
(),
me
->
GetTimeStamp
(),
if( fprintf( m_fp, "$EndTEXTPCB\n" ) != sizeof("$EndTEXTPCB\n") - 1 )
me
->
IsItalic
()
?
"Italic"
:
"Normal"
,
return false;
hJustify
);
return true;
}
bool TRACK::Save( FILE* m_fp ) const
{
int type = 0;
if( Type() == PCB_VIA_T )
type = 1;
fprintf( m_fp, "Po %d %d %d %d %d %d %d\n", m_Shape,
m_Start.x, m_Start.y, m_End.x, m_End.y, m_Width, m_Drill );
fprintf( m_fp, "De %d %d %d %lX %X\n",
m_Layer, type, GetNet(),
m_TimeStamp, ReturnStatus() );
return true;
}
bool DIMENSION::Save( FILE* m_fp ) const
{
bool rc = false;
// note: COTATION was the previous name of DIMENSION
// this old keyword is used here for compatibility
const char keyWordLine[] = "$COTATION\n";
const char keyWordLineEnd[] = "$endCOTATION\n";
if( fputs( keyWordLine, m_fp ) == EOF )
goto out;
fprintf( m_fp, "Ge %d %d %lX\n", m_Shape, m_Layer, m_TimeStamp );
fprintf( m_fp, "Va %d\n", m_Value );
if( !m_Text->m_Text.IsEmpty() )
fprintf
(
m_fp
,
"$EndTEXTPCB
\n
"
);
fprintf( m_fp, "Te %s\n", EscapedUTF8( m_Text->m_Text ).c_str() );
else
fprintf( m_fp, "Te \"?\"\n" );
fprintf( m_fp, "Po %d %d %d %d %d %d %d\n",
m_Text->m_Pos.x, m_Text->m_Pos.y,
m_Text->m_Size.x, m_Text->m_Size.y,
m_Text->GetThickness(), m_Text->GetOrientation(),
m_Text->m_Mirror ? 0 : 1 );
fprintf( m_fp, "Sb %d %d %d %d %d %d\n", S_SEGMENT,
m_crossBarOx, m_crossBarOy,
m_crossBarFx, m_crossBarFy, m_Width );
fprintf( m_fp, "Sd %d %d %d %d %d %d\n", S_SEGMENT,
m_featureLineDOx, m_featureLineDOy,
m_featureLineDFx, m_featureLineDFy, m_Width );
fprintf( m_fp, "Sg %d %d %d %d %d %d\n", S_SEGMENT,
m_featureLineGOx, m_featureLineGOy,
m_featureLineGFx, m_featureLineGFy, m_Width );
fprintf( m_fp, "S1 %d %d %d %d %d %d\n", S_SEGMENT,
m_arrowD1Ox, m_arrowD1Oy,
m_arrowD1Fx, m_arrowD1Fy, m_Width );
fprintf( m_fp, "S2 %d %d %d %d %d %d\n", S_SEGMENT,
m_arrowD2Ox, m_arrowD2Oy,
m_arrowD2Fx, m_arrowD2Fy, m_Width );
fprintf( m_fp, "S3 %d %d %d %d %d %d\n", S_SEGMENT,
m_arrowG1Ox, m_arrowG1Oy,
m_arrowG1Fx, m_arrowG1Fy, m_Width );
fprintf( m_fp, "S4 %d %d %d %d %d %d\n", S_SEGMENT,
m_arrowG2Ox, m_arrowG2Oy,
m_arrowG2Fx, m_arrowG2Fy, m_Width );
if( fputs( keyWordLineEnd, m_fp ) == EOF )
goto out;
rc = true;
out:
return rc;
}
}
#endif
pcbnew/kicad_plugin.h
View file @
96bb90de
...
@@ -83,12 +83,6 @@ protected:
...
@@ -83,12 +83,6 @@ protected:
/// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed.
/// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed.
void
init
(
PROPERTIES
*
aProperties
);
void
init
(
PROPERTIES
*
aProperties
);
int
NbDraw
;
int
NbTrack
;
int
NbZone
;
int
NbMod
;
int
NbNets
;
double
biuToDisk
;
///< convert from BIUs to disk engineering units with this scale factor
double
biuToDisk
;
///< convert from BIUs to disk engineering units with this scale factor
double
diskToBiu
;
///< convert from disk engineering units to BIUs with this scale factor
double
diskToBiu
;
///< convert from disk engineering units to BIUs with this scale factor
...
@@ -135,9 +129,9 @@ protected:
...
@@ -135,9 +129,9 @@ protected:
void
load3D
(
MODULE
*
aModule
);
void
load3D
(
MODULE
*
aModule
);
void
loadPAD
(
MODULE
*
aModule
);
void
loadPAD
(
MODULE
*
aModule
);
void
loadMODULE_TEXT
(
TEXTE_MODULE
*
aText
);
void
loadMODULE_TEXT
(
TEXTE_MODULE
*
aText
);
void
load
EDGE_MODUL
E
(
MODULE
*
aModule
);
void
load
MODULE_EDG
E
(
MODULE
*
aModule
);
void
load
DRAWSEGMENT
();
void
load
PCB_LINE
();
void
loadNETINFO_ITEM
();
void
loadNETINFO_ITEM
();
void
loadPCB_TEXT
();
void
loadPCB_TEXT
();
void
loadNETCLASS
();
void
loadNETCLASS
();
...
@@ -206,17 +200,11 @@ protected:
...
@@ -206,17 +200,11 @@ protected:
void
saveNETCLASS
(
const
NETCLASS
*
aNetclass
)
const
;
void
saveNETCLASS
(
const
NETCLASS
*
aNetclass
)
const
;
void
savePCB_TEXT
(
const
TEXTE_PCB
*
aText
)
const
;
void
savePCB_TEXT
(
const
TEXTE_PCB
*
aText
)
const
;
void
save
EDGE_MODULE
(
const
EDGE_MODULE
*
aEdge
)
const
;
void
save
PCB_TARGET
(
const
PCB_TARGET
*
aTarget
)
const
;
void
save
TARGET
(
const
PCB_TARGET
*
aTarget
)
const
;
void
save
PCB_LINE
(
const
DRAWSEGMENT
*
aStroke
)
const
;
void
saveDIMENTION
(
const
DIMENSION
*
aDimension
)
const
;
void
saveDIMENTION
(
const
DIMENSION
*
aDimension
)
const
;
void
saveTRACK
(
const
TRACK
*
aTrack
)
const
;
void
saveTRACK
(
const
TRACK
*
aTrack
)
const
;
/**
* Function saveSEGZONE
* saves the oldschool zones, now outdated in favor of polygon zones.
*/
void
saveSEGZONE
(
const
SEGZONE
*
aZone
)
const
;
/**
/**
* Function saveZONE_CONTAINER
* Function saveZONE_CONTAINER
* saves the new polygon zones.
* saves the new polygon zones.
...
...
pcbnew/mirepcb.cpp
View file @
96bb90de
...
@@ -102,13 +102,13 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME
...
@@ -102,13 +102,13 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME
// Size:
// Size:
m_MireSizeCtrl
=
new
EDA_VALUE_CTRL
(
this
,
_
(
"Size"
),
m_MireSizeCtrl
=
new
EDA_VALUE_CTRL
(
this
,
_
(
"Size"
),
m_Target
->
m_Size
,
m_Target
->
GetSize
()
,
g_UserUnit
,
LeftBoxSizer
,
g_UserUnit
,
LeftBoxSizer
,
m_Parent
->
m_InternalUnits
);
m_Parent
->
m_InternalUnits
);
// Width:
// Width:
m_MireWidthCtrl
=
new
EDA_VALUE_CTRL
(
this
,
_
(
"Width"
),
m_MireWidthCtrl
=
new
EDA_VALUE_CTRL
(
this
,
_
(
"Width"
),
m_Target
->
m_Width
,
m_Target
->
GetWidth
()
,
g_UserUnit
,
LeftBoxSizer
,
g_UserUnit
,
LeftBoxSizer
,
m_Parent
->
m_InternalUnits
);
m_Parent
->
m_InternalUnits
);
...
@@ -118,7 +118,7 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME
...
@@ -118,7 +118,7 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME
_
(
"Target Shape:"
),
_
(
"Target Shape:"
),
wxDefaultPosition
,
wxSize
(
-
1
,
-
1
),
wxDefaultPosition
,
wxSize
(
-
1
,
-
1
),
2
,
shape_list
,
1
);
2
,
shape_list
,
1
);
m_MireShape
->
SetSelection
(
m_Target
->
m_Shape
?
1
:
0
);
m_MireShape
->
SetSelection
(
m_Target
->
GetShape
()
?
1
:
0
);
LeftBoxSizer
->
Add
(
m_MireShape
,
0
,
wxGROW
|
wxALL
,
5
);
LeftBoxSizer
->
Add
(
m_MireShape
,
0
,
wxGROW
|
wxALL
,
5
);
GetSizer
()
->
Fit
(
this
);
GetSizer
()
->
Fit
(
this
);
...
@@ -146,9 +146,10 @@ void TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick( wxCommandEvent& event )
...
@@ -146,9 +146,10 @@ void TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick( wxCommandEvent& event )
m_Target
->
m_Flags
|=
IN_EDIT
;
// set flag in edit to force
m_Target
->
m_Flags
|=
IN_EDIT
;
// set flag in edit to force
// undo/redo/abort proper operation
// undo/redo/abort proper operation
m_Target
->
m_Width
=
m_MireWidthCtrl
->
GetValue
();
m_Target
->
SetWidth
(
m_MireWidthCtrl
->
GetValue
()
);
MireDefaultSize
=
m_Target
->
m_Size
=
m_MireSizeCtrl
->
GetValue
();
MireDefaultSize
=
m_MireSizeCtrl
->
GetValue
();
m_Target
->
m_Shape
=
m_MireShape
->
GetSelection
()
?
1
:
0
;
m_Target
->
SetSize
(
m_MireSizeCtrl
->
GetValue
()
);
m_Target
->
SetShape
(
m_MireShape
->
GetSelection
()
?
1
:
0
);
m_Target
->
Draw
(
m_Parent
->
DrawPanel
,
m_DC
,
(
m_Target
->
m_Flags
&
IS_MOVED
)
?
GR_XOR
:
GR_OR
);
m_Target
->
Draw
(
m_Parent
->
DrawPanel
,
m_DC
,
(
m_Target
->
m_Flags
&
IS_MOVED
)
?
GR_XOR
:
GR_OR
);
...
@@ -188,14 +189,14 @@ static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC )
...
@@ -188,14 +189,14 @@ static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC )
target
->
DeleteStructure
();
target
->
DeleteStructure
();
target
=
NULL
;
target
=
NULL
;
}
}
else
/
* it is an existing item: retrieve initial values of parameters */
else
/
/ it is an existing item: retrieve initial values of parameters
{
{
if
(
(
target
->
m_Flags
&
(
IN_EDIT
|
IS_MOVED
)
)
)
if
(
(
target
->
m_Flags
&
(
IN_EDIT
|
IS_MOVED
)
)
)
{
{
target
->
m_Pos
=
s_TargetCopy
.
m_Pos
;
target
->
SetPosition
(
s_TargetCopy
.
GetPosition
()
)
;
target
->
m_Width
=
s_TargetCopy
.
m_Width
;
target
->
SetWidth
(
s_TargetCopy
.
GetWidth
()
)
;
target
->
m_Size
=
s_TargetCopy
.
m_Size
;
target
->
SetSize
(
s_TargetCopy
.
GetSize
()
)
;
target
->
m_Shape
=
s_TargetCopy
.
m_Shape
;
target
->
SetShape
(
s_TargetCopy
.
GetShape
()
)
;
}
}
target
->
m_Flags
=
0
;
target
->
m_Flags
=
0
;
target
->
Draw
(
Panel
,
DC
,
GR_OR
);
target
->
Draw
(
Panel
,
DC
,
GR_OR
);
...
@@ -214,9 +215,9 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC )
...
@@ -214,9 +215,9 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC )
GetBoard
()
->
Add
(
target
);
GetBoard
()
->
Add
(
target
);
target
->
SetLayer
(
EDGE_N
);
target
->
SetLayer
(
EDGE_N
);
target
->
m_Width
=
GetBoard
()
->
GetDesignSettings
().
m_EdgeSegmentWidth
;
target
->
SetWidth
(
GetBoard
()
->
GetDesignSettings
().
m_EdgeSegmentWidth
)
;
target
->
m_Size
=
MireDefaultSize
;
target
->
SetSize
(
MireDefaultSize
)
;
target
->
m_Pos
=
DrawPanel
->
GetScreen
()
->
GetCrossHairPosition
(
);
target
->
SetPosition
(
DrawPanel
->
GetScreen
()
->
GetCrossHairPosition
()
);
PlaceTarget
(
target
,
DC
);
PlaceTarget
(
target
,
DC
);
...
@@ -257,7 +258,7 @@ void PCB_EDIT_FRAME::PlaceTarget( PCB_TARGET* aTarget, wxDC* DC )
...
@@ -257,7 +258,7 @@ void PCB_EDIT_FRAME::PlaceTarget( PCB_TARGET* aTarget, wxDC* DC )
if
(
aTarget
->
m_Flags
==
IS_MOVED
)
if
(
aTarget
->
m_Flags
==
IS_MOVED
)
{
{
SaveCopyInUndoList
(
aTarget
,
UR_MOVED
,
aTarget
->
m_Pos
-
s_TargetCopy
.
m_Pos
);
SaveCopyInUndoList
(
aTarget
,
UR_MOVED
,
aTarget
->
GetPosition
()
-
s_TargetCopy
.
GetPosition
()
);
aTarget
->
m_Flags
=
0
;
aTarget
->
m_Flags
=
0
;
return
;
return
;
}
}
...
@@ -286,7 +287,7 @@ static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
...
@@ -286,7 +287,7 @@ static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if
(
aErase
)
if
(
aErase
)
target
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
target
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
target
->
m_Pos
=
screen
->
GetCrossHairPosition
(
);
target
->
SetPosition
(
screen
->
GetCrossHairPosition
()
);
target
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
target
->
Draw
(
aPanel
,
aDC
,
GR_XOR
);
}
}
pcbnew/modedit.cpp
View file @
96bb90de
...
@@ -696,17 +696,17 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -696,17 +696,17 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
void
FOOTPRINT_EDIT_FRAME
::
Transform
(
MODULE
*
module
,
int
transform
)
void
FOOTPRINT_EDIT_FRAME
::
Transform
(
MODULE
*
module
,
int
transform
)
{
{
D_PAD
*
pad
=
module
->
m_Pads
;
D_PAD
*
pad
=
module
->
m_Pads
;
EDA_ITEM
*
PtStruct
=
module
->
m_Drawings
;
EDA_ITEM
*
item
=
module
->
m_Drawings
;
TEXTE_MODULE
*
textmod
;
TEXTE_MODULE
*
textmod
;
EDGE_MODULE
*
edgemod
;
EDGE_MODULE
*
edgemod
;
int
angle
=
900
;
// Necessary +- 900 (+- 90 degrees) )
double
angle
=
900
;
// Necessary +- 900 (+- 90 degrees) )
switch
(
transform
)
switch
(
transform
)
{
{
case
ID_MODEDIT_MODULE_ROTATE
:
case
ID_MODEDIT_MODULE_ROTATE
:
module
->
SetOrientation
(
angle
);
module
->
SetOrientation
(
angle
);
for
(
;
pad
!=
NULL
;
pad
=
(
D_PAD
*
)
pad
->
Next
()
)
for
(
;
pad
;
pad
=
pad
->
Next
()
)
{
{
pad
->
SetPos0
(
pad
->
m_Pos
);
pad
->
SetPos0
(
pad
->
m_Pos
);
pad
->
m_Orient
-=
angle
;
pad
->
m_Orient
-=
angle
;
...
@@ -727,18 +727,18 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
...
@@ -727,18 +727,18 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
if
(
module
->
m_Value
->
m_Orient
>=
1800
)
if
(
module
->
m_Value
->
m_Orient
>=
1800
)
module
->
m_Value
->
m_Orient
-=
1800
;
module
->
m_Value
->
m_Orient
-=
1800
;
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Next
()
)
for
(
;
item
!=
NULL
;
item
=
item
->
Next
()
)
{
{
if
(
PtStruct
->
Type
()
==
PCB_MODULE_EDGE_T
)
if
(
item
->
Type
()
==
PCB_MODULE_EDGE_T
)
{
{
edgemod
=
(
EDGE_MODULE
*
)
PtStruct
;
edgemod
=
(
EDGE_MODULE
*
)
item
;
edgemod
->
m_Start0
=
edgemod
->
m_Start
;
edgemod
->
SetStart0
(
edgemod
->
GetStart
()
)
;
edgemod
->
m_End0
=
edgemod
->
m_End
;
edgemod
->
SetEnd0
(
edgemod
->
GetEnd
()
)
;
}
}
if
(
PtStruct
->
Type
()
==
PCB_MODULE_TEXT_T
)
else
if
(
item
->
Type
()
==
PCB_MODULE_TEXT_T
)
{
{
textmod
=
(
TEXTE_MODULE
*
)
PtStruct
;
textmod
=
(
TEXTE_MODULE
*
)
item
;
textmod
->
SetPos0
(
textmod
->
m_Pos
);
textmod
->
SetPos0
(
textmod
->
m_Pos
);
}
}
}
}
...
@@ -758,7 +758,7 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
...
@@ -758,7 +758,7 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
pad
->
m_Orient
=
3600
-
pad
->
m_Orient
;
pad
->
m_Orient
=
3600
-
pad
->
m_Orient
;
}
}
/
* Reverse mirror of reference. */
/
/ Reverse mirror of reference.
textmod
=
module
->
m_Reference
;
textmod
=
module
->
m_Reference
;
NEGATE
(
textmod
->
m_Pos
.
y
);
NEGATE
(
textmod
->
m_Pos
.
y
);
NEGATE
(
textmod
->
m_Pos0
.
y
);
NEGATE
(
textmod
->
m_Pos0
.
y
);
...
@@ -766,7 +766,7 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
...
@@ -766,7 +766,7 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
if
(
textmod
->
m_Orient
)
if
(
textmod
->
m_Orient
)
textmod
->
m_Orient
=
3600
-
textmod
->
m_Orient
;
textmod
->
m_Orient
=
3600
-
textmod
->
m_Orient
;
/
* Reverse mirror of value. */
/
/ Reverse mirror of value.
textmod
=
module
->
m_Value
;
textmod
=
module
->
m_Value
;
NEGATE
(
textmod
->
m_Pos
.
y
);
NEGATE
(
textmod
->
m_Pos
.
y
);
NEGATE
(
textmod
->
m_Pos0
.
y
);
NEGATE
(
textmod
->
m_Pos0
.
y
);
...
@@ -774,26 +774,28 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
...
@@ -774,26 +774,28 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
if
(
textmod
->
m_Orient
)
if
(
textmod
->
m_Orient
)
textmod
->
m_Orient
=
3600
-
textmod
->
m_Orient
;
textmod
->
m_Orient
=
3600
-
textmod
->
m_Orient
;
/
* Reverse mirror of footprints. */
/
/ Reverse mirror of footprints.
PtStruct
=
module
->
m_Drawings
;
item
=
module
->
m_Drawings
;
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Next
()
)
for
(
;
item
;
item
=
item
->
Next
()
)
{
{
switch
(
PtStruct
->
Type
()
)
switch
(
item
->
Type
()
)
{
{
case
PCB_MODULE_EDGE_T
:
case
PCB_MODULE_EDGE_T
:
edgemod
=
(
EDGE_MODULE
*
)
PtStruct
;
edgemod
=
(
EDGE_MODULE
*
)
item
;
NEGATE
(
edgemod
->
m_Start
.
y
);
NEGATE
(
edgemod
->
m_End
.
y
);
edgemod
->
SetStartY
(
-
edgemod
->
GetStart
().
y
);
/* Invert local coordinates */
edgemod
->
SetEndY
(
-
edgemod
->
GetEnd
().
y
);
// Invert local coordinates
NEGATE
(
edgemod
->
m_Start0
.
y
);
NEGATE
(
edgemod
->
m_Start0
.
y
);
NEGATE
(
edgemod
->
m_End0
.
y
);
NEGATE
(
edgemod
->
m_End0
.
y
);
NEGATE
(
edgemod
->
m_Angle
);
edgemod
->
SetAngle
(
-
edgemod
->
GetAngle
()
);
break
;
break
;
case
PCB_MODULE_TEXT_T
:
case
PCB_MODULE_TEXT_T
:
/
* Reverse mirror position and mirror. */
/
/ Reverse mirror position and mirror.
textmod
=
(
TEXTE_MODULE
*
)
PtStruct
;
textmod
=
(
TEXTE_MODULE
*
)
item
;
NEGATE
(
textmod
->
m_Pos
.
y
);
NEGATE
(
textmod
->
m_Pos
.
y
);
NEGATE
(
textmod
->
m_Pos0
.
y
);
NEGATE
(
textmod
->
m_Pos0
.
y
);
...
...
pcbnew/modedit_onclick.cpp
View file @
96bb90de
...
@@ -92,19 +92,19 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -92,19 +92,19 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
}
else
if
(
item
->
IsNew
()
)
else
if
(
item
->
IsNew
()
)
{
{
if
(
(
(
EDGE_MODULE
*
)
item
)
->
m_Shape
==
S_CIRCLE
)
if
(
(
(
EDGE_MODULE
*
)
item
)
->
GetShape
()
==
S_CIRCLE
)
{
{
End_Edge_Module
(
(
EDGE_MODULE
*
)
item
);
End_Edge_Module
(
(
EDGE_MODULE
*
)
item
);
SetCurItem
(
NULL
);
SetCurItem
(
NULL
);
DrawPanel
->
Refresh
();
DrawPanel
->
Refresh
();
}
}
else
if
(
(
(
EDGE_MODULE
*
)
item
)
->
m_Shape
==
S_ARC
)
else
if
(
(
(
EDGE_MODULE
*
)
item
)
->
GetShape
()
==
S_ARC
)
{
{
End_Edge_Module
(
(
EDGE_MODULE
*
)
item
);
End_Edge_Module
(
(
EDGE_MODULE
*
)
item
);
SetCurItem
(
NULL
);
SetCurItem
(
NULL
);
DrawPanel
->
Refresh
();
DrawPanel
->
Refresh
();
}
}
else
if
(
(
(
EDGE_MODULE
*
)
item
)
->
m_Shape
==
S_SEGMENT
)
else
if
(
(
(
EDGE_MODULE
*
)
item
)
->
GetShape
()
==
S_SEGMENT
)
{
{
SetCurItem
(
Begin_Edge_Module
(
(
EDGE_MODULE
*
)
item
,
DC
,
0
)
);
SetCurItem
(
Begin_Edge_Module
(
(
EDGE_MODULE
*
)
item
,
DC
,
0
)
);
}
}
...
...
pcbnew/muonde.cpp
View file @
96bb90de
...
@@ -196,7 +196,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
...
@@ -196,7 +196,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
int
min_len
=
wxRound
(
sqrt
(
(
double
)
pt
.
x
*
pt
.
x
+
(
double
)
pt
.
y
*
pt
.
y
)
);
int
min_len
=
wxRound
(
sqrt
(
(
double
)
pt
.
x
*
pt
.
x
+
(
double
)
pt
.
y
*
pt
.
y
)
);
Mself
.
lng
=
min_len
;
Mself
.
lng
=
min_len
;
/
* Enter the desired length. */
/
/ Enter the desired length.
msg
=
ReturnStringFromValue
(
g_UserUnit
,
Mself
.
lng
,
GetScreen
()
->
GetInternalUnits
()
);
msg
=
ReturnStringFromValue
(
g_UserUnit
,
Mself
.
lng
,
GetScreen
()
->
GetInternalUnits
()
);
wxTextEntryDialog
dlg
(
this
,
_
(
"Length:"
),
_
(
"Length"
),
msg
);
wxTextEntryDialog
dlg
(
this
,
_
(
"Length:"
),
_
(
"Length"
),
msg
);
...
@@ -206,14 +206,14 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
...
@@ -206,14 +206,14 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
msg
=
dlg
.
GetValue
();
msg
=
dlg
.
GetValue
();
Mself
.
lng
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
GetScreen
()
->
GetInternalUnits
()
);
Mself
.
lng
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
GetScreen
()
->
GetInternalUnits
()
);
/
* Control values (ii = minimum length) */
/
/ Control values (ii = minimum length)
if
(
Mself
.
lng
<
min_len
)
if
(
Mself
.
lng
<
min_len
)
{
{
DisplayError
(
this
,
_
(
"Requested length < minimum length"
)
);
DisplayError
(
this
,
_
(
"Requested length < minimum length"
)
);
return
NULL
;
return
NULL
;
}
}
/
* Calculate the elements. */
/
/ Calculate the elements.
Mself
.
m_Width
=
GetBoard
()
->
GetCurrentTrackWidth
();
Mself
.
m_Width
=
GetBoard
()
->
GetCurrentTrackWidth
();
std
::
vector
<
wxPoint
>
buffer
;
std
::
vector
<
wxPoint
>
buffer
;
...
@@ -225,75 +225,74 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
...
@@ -225,75 +225,74 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
return
NULL
;
return
NULL
;
}
}
// Generate module.
MODULE
*
module
;
module
=
Create_1_Module
(
wxEmptyString
);
/* Generate module. */
if
(
module
==
NULL
)
MODULE
*
Module
;
Module
=
Create_1_Module
(
wxEmptyString
);
if
(
Module
==
NULL
)
return
NULL
;
return
NULL
;
// here the
M
odule is already in the BOARD, Create_1_Module() does that.
// here the
m
odule is already in the BOARD, Create_1_Module() does that.
M
odule
->
m_LibRef
=
wxT
(
"MuSelf"
);
m
odule
->
m_LibRef
=
wxT
(
"MuSelf"
);
M
odule
->
m_Attributs
=
MOD_VIRTUAL
|
MOD_CMS
;
m
odule
->
m_Attributs
=
MOD_VIRTUAL
|
MOD_CMS
;
M
odule
->
m_Flags
=
0
;
m
odule
->
m_Flags
=
0
;
M
odule
->
m_Pos
=
Mself
.
m_End
;
m
odule
->
m_Pos
=
Mself
.
m_End
;
/
* Generate segments. */
/
/ Generate segments
for
(
unsigned
jj
=
1
;
jj
<
buffer
.
size
();
jj
++
)
for
(
unsigned
jj
=
1
;
jj
<
buffer
.
size
();
jj
++
)
{
{
EDGE_MODULE
*
PtSegm
;
EDGE_MODULE
*
PtSegm
;
PtSegm
=
new
EDGE_MODULE
(
M
odule
);
PtSegm
=
new
EDGE_MODULE
(
m
odule
);
PtSegm
->
m_Start
=
buffer
[
jj
-
1
]
;
PtSegm
->
SetStart
(
buffer
[
jj
-
1
]
)
;
PtSegm
->
m_End
=
buffer
[
jj
]
;
PtSegm
->
SetEnd
(
buffer
[
jj
]
)
;
PtSegm
->
m_Width
=
Mself
.
m_Width
;
PtSegm
->
SetWidth
(
Mself
.
m_Width
)
;
PtSegm
->
SetLayer
(
M
odule
->
GetLayer
()
);
PtSegm
->
SetLayer
(
m
odule
->
GetLayer
()
);
PtSegm
->
m_Shape
=
S_SEGMENT
;
PtSegm
->
SetShape
(
S_SEGMENT
)
;
PtSegm
->
m_Start0
=
PtSegm
->
m_Start
-
Module
->
m_Pos
;
PtSegm
->
SetStart0
(
PtSegm
->
GetStart
()
-
module
->
GetPosition
()
)
;
PtSegm
->
m_End0
=
PtSegm
->
m_End
-
Module
->
m_Pos
;
PtSegm
->
SetEnd0
(
PtSegm
->
GetEnd
()
-
module
->
GetPosition
()
)
;
M
odule
->
m_Drawings
.
PushBack
(
PtSegm
);
m
odule
->
m_Drawings
.
PushBack
(
PtSegm
);
}
}
/
* Place a pad on each end of coil. */
/
/ Place a pad on each end of coil.
PtPad
=
new
D_PAD
(
M
odule
);
PtPad
=
new
D_PAD
(
m
odule
);
M
odule
->
m_Pads
.
PushFront
(
PtPad
);
m
odule
->
m_Pads
.
PushFront
(
PtPad
);
PtPad
->
SetPadName
(
wxT
(
"1"
)
);
PtPad
->
SetPadName
(
wxT
(
"1"
)
);
PtPad
->
m_Pos
=
Mself
.
m_End
;
PtPad
->
m_Pos
=
Mself
.
m_End
;
PtPad
->
m_Pos0
=
PtPad
->
m_Pos
-
M
odule
->
m_Pos
;
PtPad
->
m_Pos0
=
PtPad
->
m_Pos
-
m
odule
->
m_Pos
;
PtPad
->
m_Size
.
x
=
PtPad
->
m_Size
.
y
=
Mself
.
m_Width
;
PtPad
->
m_Size
.
x
=
PtPad
->
m_Size
.
y
=
Mself
.
m_Width
;
PtPad
->
m_layerMask
=
GetLayerMask
(
M
odule
->
GetLayer
()
);
PtPad
->
m_layerMask
=
GetLayerMask
(
m
odule
->
GetLayer
()
);
PtPad
->
m_Attribut
=
PAD_SMD
;
PtPad
->
m_Attribut
=
PAD_SMD
;
PtPad
->
m_PadShape
=
PAD_CIRCLE
;
PtPad
->
m_PadShape
=
PAD_CIRCLE
;
PtPad
->
ComputeShapeMaxRadius
();
PtPad
->
ComputeShapeMaxRadius
();
D_PAD
*
newpad
=
new
D_PAD
(
M
odule
);
D_PAD
*
newpad
=
new
D_PAD
(
m
odule
);
newpad
->
Copy
(
PtPad
);
newpad
->
Copy
(
PtPad
);
M
odule
->
m_Pads
.
Insert
(
newpad
,
PtPad
->
Next
()
);
m
odule
->
m_Pads
.
Insert
(
newpad
,
PtPad
->
Next
()
);
PtPad
=
newpad
;
PtPad
=
newpad
;
PtPad
->
SetPadName
(
wxT
(
"2"
)
);
PtPad
->
SetPadName
(
wxT
(
"2"
)
);
PtPad
->
m_Pos
=
Mself
.
m_Start
;
PtPad
->
m_Pos
=
Mself
.
m_Start
;
PtPad
->
m_Pos0
=
PtPad
->
m_Pos
-
M
odule
->
m_Pos
;
PtPad
->
m_Pos0
=
PtPad
->
m_Pos
-
m
odule
->
m_Pos
;
/
* Modify text positions. */
/
/ Modify text positions.
M
odule
->
DisplayInfo
(
this
);
m
odule
->
DisplayInfo
(
this
);
Module
->
m_Value
->
m_Pos
.
x
=
M
odule
->
m_Reference
->
m_Pos
.
x
=
module
->
m_Value
->
m_Pos
.
x
=
m
odule
->
m_Reference
->
m_Pos
.
x
=
(
Mself
.
m_Start
.
x
+
Mself
.
m_End
.
x
)
/
2
;
(
Mself
.
m_Start
.
x
+
Mself
.
m_End
.
x
)
/
2
;
Module
->
m_Value
->
m_Pos
.
y
=
M
odule
->
m_Reference
->
m_Pos
.
y
=
module
->
m_Value
->
m_Pos
.
y
=
m
odule
->
m_Reference
->
m_Pos
.
y
=
(
Mself
.
m_Start
.
y
+
Mself
.
m_End
.
y
)
/
2
;
(
Mself
.
m_Start
.
y
+
Mself
.
m_End
.
y
)
/
2
;
Module
->
m_Reference
->
m_Pos
.
y
-=
M
odule
->
m_Reference
->
m_Size
.
y
;
module
->
m_Reference
->
m_Pos
.
y
-=
m
odule
->
m_Reference
->
m_Size
.
y
;
Module
->
m_Value
->
m_Pos
.
y
+=
M
odule
->
m_Value
->
m_Size
.
y
;
module
->
m_Value
->
m_Pos
.
y
+=
m
odule
->
m_Value
->
m_Size
.
y
;
Module
->
m_Reference
->
SetPos0
(
Module
->
m_Reference
->
m_Pos
-
M
odule
->
m_Pos
);
module
->
m_Reference
->
SetPos0
(
module
->
m_Reference
->
m_Pos
-
m
odule
->
m_Pos
);
Module
->
m_Value
->
SetPos0
(
Module
->
m_Value
->
m_Pos
-
M
odule
->
m_Pos
);
module
->
m_Value
->
SetPos0
(
module
->
m_Value
->
m_Pos
-
m
odule
->
m_Pos
);
M
odule
->
CalculateBoundingBox
();
m
odule
->
CalculateBoundingBox
();
M
odule
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
m
odule
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
return
M
odule
;
return
m
odule
;
}
}
...
@@ -522,33 +521,33 @@ int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer,
...
@@ -522,33 +521,33 @@ int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer,
MODULE
*
PCB_EDIT_FRAME
::
Create_MuWaveBasicShape
(
const
wxString
&
name
,
int
pad_count
)
MODULE
*
PCB_EDIT_FRAME
::
Create_MuWaveBasicShape
(
const
wxString
&
name
,
int
pad_count
)
{
{
MODULE
*
M
odule
;
MODULE
*
m
odule
;
int
pad_num
=
1
;
int
pad_num
=
1
;
wxString
Line
;
wxString
Line
;
M
odule
=
Create_1_Module
(
name
);
m
odule
=
Create_1_Module
(
name
);
if
(
M
odule
==
NULL
)
if
(
m
odule
==
NULL
)
return
NULL
;
return
NULL
;
#define DEFAULT_SIZE 30
#define DEFAULT_SIZE 30
M
odule
->
SetTimeStamp
(
GetNewTimeStamp
()
);
m
odule
->
SetTimeStamp
(
GetNewTimeStamp
()
);
M
odule
->
m_Value
->
m_Size
=
wxSize
(
DEFAULT_SIZE
,
DEFAULT_SIZE
);
m
odule
->
m_Value
->
m_Size
=
wxSize
(
DEFAULT_SIZE
,
DEFAULT_SIZE
);
M
odule
->
m_Value
->
SetPos0
(
wxPoint
(
0
,
-
DEFAULT_SIZE
)
);
m
odule
->
m_Value
->
SetPos0
(
wxPoint
(
0
,
-
DEFAULT_SIZE
)
);
Module
->
m_Value
->
m_Pos
.
y
+=
M
odule
->
m_Value
->
GetPos0
().
y
;
module
->
m_Value
->
m_Pos
.
y
+=
m
odule
->
m_Value
->
GetPos0
().
y
;
M
odule
->
m_Value
->
m_Thickness
=
DEFAULT_SIZE
/
4
;
m
odule
->
m_Value
->
m_Thickness
=
DEFAULT_SIZE
/
4
;
M
odule
->
m_Reference
->
m_Size
=
wxSize
(
DEFAULT_SIZE
,
DEFAULT_SIZE
);
m
odule
->
m_Reference
->
m_Size
=
wxSize
(
DEFAULT_SIZE
,
DEFAULT_SIZE
);
M
odule
->
m_Reference
->
SetPos0
(
wxPoint
(
0
,
DEFAULT_SIZE
)
);
m
odule
->
m_Reference
->
SetPos0
(
wxPoint
(
0
,
DEFAULT_SIZE
)
);
Module
->
m_Reference
->
m_Pos
.
y
+=
M
odule
->
m_Reference
->
GetPos0
().
y
;
module
->
m_Reference
->
m_Pos
.
y
+=
m
odule
->
m_Reference
->
GetPos0
().
y
;
M
odule
->
m_Reference
->
m_Thickness
=
DEFAULT_SIZE
/
4
;
m
odule
->
m_Reference
->
m_Thickness
=
DEFAULT_SIZE
/
4
;
/* Create 2 pads used in gaps and stubs.
/* Create 2 pads used in gaps and stubs.
* The gap is between these 2 pads
* The gap is between these 2 pads
...
@@ -556,12 +555,12 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c
...
@@ -556,12 +555,12 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c
*/
*/
while
(
pad_count
--
)
while
(
pad_count
--
)
{
{
D_PAD
*
pad
=
new
D_PAD
(
M
odule
);
D_PAD
*
pad
=
new
D_PAD
(
m
odule
);
M
odule
->
m_Pads
.
PushFront
(
pad
);
m
odule
->
m_Pads
.
PushFront
(
pad
);
pad
->
m_Size
.
x
=
pad
->
m_Size
.
y
=
GetBoard
()
->
GetCurrentTrackWidth
();
pad
->
m_Size
.
x
=
pad
->
m_Size
.
y
=
GetBoard
()
->
GetCurrentTrackWidth
();
pad
->
m_Pos
=
M
odule
->
m_Pos
;
pad
->
m_Pos
=
m
odule
->
m_Pos
;
pad
->
m_PadShape
=
PAD_RECT
;
pad
->
m_PadShape
=
PAD_RECT
;
pad
->
m_Attribut
=
PAD_SMD
;
pad
->
m_Attribut
=
PAD_SMD
;
pad
->
m_layerMask
=
LAYER_FRONT
;
pad
->
m_layerMask
=
LAYER_FRONT
;
...
@@ -570,7 +569,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c
...
@@ -570,7 +569,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c
pad_num
++
;
pad_num
++
;
}
}
return
M
odule
;
return
m
odule
;
}
}
...
@@ -578,7 +577,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
...
@@ -578,7 +577,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
{
{
int
oX
;
int
oX
;
D_PAD
*
pad
;
D_PAD
*
pad
;
MODULE
*
M
odule
;
MODULE
*
m
odule
;
wxString
msg
,
cmp_name
;
wxString
msg
,
cmp_name
;
int
pad_count
=
2
;
int
pad_count
=
2
;
int
angle
=
0
;
int
angle
=
0
;
...
@@ -658,8 +657,8 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
...
@@ -658,8 +657,8 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
return
NULL
;
return
NULL
;
}
}
M
odule
=
Create_MuWaveBasicShape
(
cmp_name
,
pad_count
);
m
odule
=
Create_MuWaveBasicShape
(
cmp_name
,
pad_count
);
pad
=
M
odule
->
m_Pads
;
pad
=
m
odule
->
m_Pads
;
switch
(
shape_type
)
switch
(
shape_type
)
{
{
...
@@ -681,10 +680,10 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
...
@@ -681,10 +680,10 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
case
2
:
// Arc Stub created by a polygonal approach:
case
2
:
// Arc Stub created by a polygonal approach:
{
{
EDGE_MODULE
*
edge
=
new
EDGE_MODULE
(
M
odule
);
EDGE_MODULE
*
edge
=
new
EDGE_MODULE
(
m
odule
);
M
odule
->
m_Drawings
.
PushFront
(
edge
);
m
odule
->
m_Drawings
.
PushFront
(
edge
);
edge
->
m_Shape
=
S_POLYGON
;
edge
->
SetShape
(
S_POLYGON
)
;
edge
->
SetLayer
(
LAYER_N_FRONT
);
edge
->
SetLayer
(
LAYER_N_FRONT
);
int
numPoints
=
angle
/
50
+
3
;
// Note: angles are in 0.1 degrees
int
numPoints
=
angle
/
50
+
3
;
// Note: angles are in 0.1 degrees
...
@@ -720,10 +719,10 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
...
@@ -720,10 +719,10 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
break
;
break
;
}
}
M
odule
->
CalculateBoundingBox
();
m
odule
->
CalculateBoundingBox
();
GetBoard
()
->
m_Status_Pcb
=
0
;
GetBoard
()
->
m_Status_Pcb
=
0
;
OnModify
();
OnModify
();
return
M
odule
;
return
m
odule
;
}
}
...
@@ -934,7 +933,7 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
...
@@ -934,7 +933,7 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
MODULE
*
PCB_EDIT_FRAME
::
Create_MuWavePolygonShape
()
MODULE
*
PCB_EDIT_FRAME
::
Create_MuWavePolygonShape
()
{
{
D_PAD
*
pad1
,
*
pad2
;
D_PAD
*
pad1
,
*
pad2
;
MODULE
*
M
odule
;
MODULE
*
m
odule
;
wxString
cmp_name
;
wxString
cmp_name
;
int
pad_count
=
2
;
int
pad_count
=
2
;
EDGE_MODULE
*
edge
;
EDGE_MODULE
*
edge
;
...
@@ -973,8 +972,8 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
...
@@ -973,8 +972,8 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
cmp_name
=
wxT
(
"POLY"
);
cmp_name
=
wxT
(
"POLY"
);
M
odule
=
Create_MuWaveBasicShape
(
cmp_name
,
pad_count
);
m
odule
=
Create_MuWaveBasicShape
(
cmp_name
,
pad_count
);
pad1
=
M
odule
->
m_Pads
;
pad1
=
m
odule
->
m_Pads
;
pad1
->
m_Pos0
.
x
=
-
ShapeSize
.
x
/
2
;
pad1
->
m_Pos0
.
x
=
-
ShapeSize
.
x
/
2
;
pad1
->
m_Pos
.
x
+=
pad1
->
m_Pos0
.
x
;
pad1
->
m_Pos
.
x
+=
pad1
->
m_Pos0
.
x
;
...
@@ -983,11 +982,11 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
...
@@ -983,11 +982,11 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
pad2
->
m_Pos0
.
x
=
pad1
->
m_Pos0
.
x
+
ShapeSize
.
x
;
pad2
->
m_Pos0
.
x
=
pad1
->
m_Pos0
.
x
+
ShapeSize
.
x
;
pad2
->
m_Pos
.
x
+=
pad2
->
m_Pos0
.
x
;
pad2
->
m_Pos
.
x
+=
pad2
->
m_Pos0
.
x
;
edge
=
new
EDGE_MODULE
(
M
odule
);
edge
=
new
EDGE_MODULE
(
m
odule
);
M
odule
->
m_Drawings
.
PushFront
(
edge
);
m
odule
->
m_Drawings
.
PushFront
(
edge
);
edge
->
m_Shape
=
S_POLYGON
;
edge
->
SetShape
(
S_POLYGON
)
;
edge
->
SetLayer
(
LAYER_N_FRONT
);
edge
->
SetLayer
(
LAYER_N_FRONT
);
npoints
=
PolyEdges
.
size
();
npoints
=
PolyEdges
.
size
();
...
@@ -1020,8 +1019,8 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
...
@@ -1020,8 +1019,8 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
pad2
->
m_Size
.
x
=
pad2
->
m_Size
.
y
=
ABS
(
last_coordinate
.
y
);
pad2
->
m_Size
.
x
=
pad2
->
m_Size
.
y
=
ABS
(
last_coordinate
.
y
);
pad1
->
m_Pos0
.
y
=
first_coordinate
.
y
/
2
;
pad1
->
m_Pos0
.
y
=
first_coordinate
.
y
/
2
;
pad2
->
m_Pos0
.
y
=
last_coordinate
.
y
/
2
;
pad2
->
m_Pos0
.
y
=
last_coordinate
.
y
/
2
;
pad1
->
m_Pos
.
y
=
pad1
->
m_Pos0
.
y
+
M
odule
->
m_Pos
.
y
;
pad1
->
m_Pos
.
y
=
pad1
->
m_Pos0
.
y
+
m
odule
->
m_Pos
.
y
;
pad2
->
m_Pos
.
y
=
pad2
->
m_Pos0
.
y
+
M
odule
->
m_Pos
.
y
;
pad2
->
m_Pos
.
y
=
pad2
->
m_Pos0
.
y
+
m
odule
->
m_Pos
.
y
;
break
;
break
;
case
1
:
// Symmetric
case
1
:
// Symmetric
...
@@ -1040,10 +1039,10 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
...
@@ -1040,10 +1039,10 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
}
}
PolyEdges
.
clear
();
PolyEdges
.
clear
();
M
odule
->
CalculateBoundingBox
();
m
odule
->
CalculateBoundingBox
();
GetBoard
()
->
m_Status_Pcb
=
0
;
GetBoard
()
->
m_Status_Pcb
=
0
;
OnModify
();
OnModify
();
return
M
odule
;
return
m
odule
;
}
}
...
...
pcbnew/plot_rtn.cpp
View file @
96bb90de
...
@@ -266,114 +266,90 @@ static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte, GRTraceMod
...
@@ -266,114 +266,90 @@ static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte, GRTraceMod
}
}
void
PlotDimension
(
PLOTTER
*
plotter
,
DIMENSION
*
Dimension
,
int
aLayerMask
,
void
PlotDimension
(
PLOTTER
*
plotter
,
DIMENSION
*
aDim
,
int
aLayerMask
,
GRTraceMode
trace_mode
)
GRTraceMode
trace_mode
)
{
{
DRAWSEGMENT
*
DrawTmp
;
if
(
(
GetLayerMask
(
aDim
->
GetLayer
()
)
&
aLayerMask
)
==
0
)
if
(
(
GetLayerMask
(
Dimension
->
GetLayer
()
)
&
aLayerMask
)
==
0
)
return
;
return
;
DrawTmp
=
new
DRAWSEGMENT
(
NULL
);
DRAWSEGMENT
draw
;
DrawTmp
->
m_Width
=
(
trace_mode
==
FILAIRE
)
?
-
1
:
Dimension
->
m_Width
;
draw
.
SetWidth
(
(
trace_mode
==
FILAIRE
)
?
-
1
:
aDim
->
GetWidth
()
);
DrawTmp
->
SetLayer
(
Dimension
->
GetLayer
()
);
draw
.
SetLayer
(
aDim
->
GetLayer
()
);
PlotTextePcb
(
plotter
,
Dimension
->
m_Text
,
aLayerMask
,
trace_mode
);
PlotTextePcb
(
plotter
,
&
aDim
->
m_Text
,
aLayerMask
,
trace_mode
);
DrawTmp
->
m_Start
.
x
=
Dimension
->
m_crossBarOx
;
draw
.
SetStart
(
wxPoint
(
aDim
->
m_crossBarOx
,
aDim
->
m_crossBarOy
));
DrawTmp
->
m_Start
.
y
=
Dimension
->
m_crossBarOy
;
draw
.
SetEnd
(
wxPoint
(
aDim
->
m_crossBarFx
,
aDim
->
m_crossBarFy
));
DrawTmp
->
m_End
.
x
=
Dimension
->
m_crossBarFx
;
PlotDrawSegment
(
plotter
,
&
draw
,
aLayerMask
,
trace_mode
);
DrawTmp
->
m_End
.
y
=
Dimension
->
m_crossBarFy
;
PlotDrawSegment
(
plotter
,
DrawTmp
,
aLayerMask
,
trace_mode
);
draw
.
SetStart
(
wxPoint
(
aDim
->
m_featureLineGOx
,
aDim
->
m_featureLineGOy
));
draw
.
SetEnd
(
wxPoint
(
aDim
->
m_featureLineGFx
,
aDim
->
m_featureLineGFy
));
DrawTmp
->
m_Start
.
x
=
Dimension
->
m_featureLineGOx
;
PlotDrawSegment
(
plotter
,
&
draw
,
aLayerMask
,
trace_mode
);
DrawTmp
->
m_Start
.
y
=
Dimension
->
m_featureLineGOy
;
DrawTmp
->
m_End
.
x
=
Dimension
->
m_featureLineGFx
;
draw
.
SetStart
(
wxPoint
(
aDim
->
m_featureLineDOx
,
aDim
->
m_featureLineDOy
));
DrawTmp
->
m_End
.
y
=
Dimension
->
m_featureLineGFy
;
draw
.
SetEnd
(
wxPoint
(
aDim
->
m_featureLineDFx
,
aDim
->
m_featureLineDFy
));
PlotDrawSegment
(
plotter
,
DrawTmp
,
aLayerMask
,
trace_mode
);
PlotDrawSegment
(
plotter
,
&
draw
,
aLayerMask
,
trace_mode
);
DrawTmp
->
m_Start
.
x
=
Dimension
->
m_featureLineDOx
;
draw
.
SetStart
(
wxPoint
(
aDim
->
m_arrowD1Ox
,
aDim
->
m_arrowD1Oy
));
DrawTmp
->
m_Start
.
y
=
Dimension
->
m_featureLineDOy
;
draw
.
SetEnd
(
wxPoint
(
aDim
->
m_arrowD1Fx
,
aDim
->
m_arrowD1Fy
));
DrawTmp
->
m_End
.
x
=
Dimension
->
m_featureLineDFx
;
PlotDrawSegment
(
plotter
,
&
draw
,
aLayerMask
,
trace_mode
);
DrawTmp
->
m_End
.
y
=
Dimension
->
m_featureLineDFy
;
PlotDrawSegment
(
plotter
,
DrawTmp
,
aLayerMask
,
trace_mode
);
draw
.
SetStart
(
wxPoint
(
aDim
->
m_arrowD2Ox
,
aDim
->
m_arrowD2Oy
));
draw
.
SetEnd
(
wxPoint
(
aDim
->
m_arrowD2Fx
,
aDim
->
m_arrowD2Fy
));
DrawTmp
->
m_Start
.
x
=
Dimension
->
m_arrowD1Ox
;
PlotDrawSegment
(
plotter
,
&
draw
,
aLayerMask
,
trace_mode
);
DrawTmp
->
m_Start
.
y
=
Dimension
->
m_arrowD1Oy
;
DrawTmp
->
m_End
.
x
=
Dimension
->
m_arrowD1Fx
;
draw
.
SetStart
(
wxPoint
(
aDim
->
m_arrowG1Ox
,
aDim
->
m_arrowG1Oy
));
DrawTmp
->
m_End
.
y
=
Dimension
->
m_arrowD1Fy
;
draw
.
SetEnd
(
wxPoint
(
aDim
->
m_arrowG1Fx
,
aDim
->
m_arrowG1Fy
));
PlotDrawSegment
(
plotter
,
DrawTmp
,
aLayerMask
,
trace_mode
);
PlotDrawSegment
(
plotter
,
&
draw
,
aLayerMask
,
trace_mode
);
DrawTmp
->
m_Start
.
x
=
Dimension
->
m_arrowD2Ox
;
draw
.
SetStart
(
wxPoint
(
aDim
->
m_arrowG2Ox
,
aDim
->
m_arrowG2Oy
));
DrawTmp
->
m_Start
.
y
=
Dimension
->
m_arrowD2Oy
;
draw
.
SetEnd
(
wxPoint
(
aDim
->
m_arrowG2Fx
,
aDim
->
m_arrowG2Fy
));
DrawTmp
->
m_End
.
x
=
Dimension
->
m_arrowD2Fx
;
PlotDrawSegment
(
plotter
,
&
draw
,
aLayerMask
,
trace_mode
);
DrawTmp
->
m_End
.
y
=
Dimension
->
m_arrowD2Fy
;
PlotDrawSegment
(
plotter
,
DrawTmp
,
aLayerMask
,
trace_mode
);
DrawTmp
->
m_Start
.
x
=
Dimension
->
m_arrowG1Ox
;
DrawTmp
->
m_Start
.
y
=
Dimension
->
m_arrowG1Oy
;
DrawTmp
->
m_End
.
x
=
Dimension
->
m_arrowG1Fx
;
DrawTmp
->
m_End
.
y
=
Dimension
->
m_arrowG1Fy
;
PlotDrawSegment
(
plotter
,
DrawTmp
,
aLayerMask
,
trace_mode
);
DrawTmp
->
m_Start
.
x
=
Dimension
->
m_arrowG2Ox
;
DrawTmp
->
m_Start
.
y
=
Dimension
->
m_arrowG2Oy
;
DrawTmp
->
m_End
.
x
=
Dimension
->
m_arrowG2Fx
;
DrawTmp
->
m_End
.
y
=
Dimension
->
m_arrowG2Fy
;
PlotDrawSegment
(
plotter
,
DrawTmp
,
aLayerMask
,
trace_mode
);
delete
DrawTmp
;
}
}
void
PlotPcbTarget
(
PLOTTER
*
plotter
,
PCB_TARGET
*
Mire
,
int
aLayerMask
,
GRTraceMode
trace_mode
)
void
PlotPcbTarget
(
PLOTTER
*
plotter
,
PCB_TARGET
*
a
Mire
,
int
aLayerMask
,
GRTraceMode
trace_mode
)
{
{
DRAWSEGMENT
*
DrawTmp
;
int
dx1
,
dx2
,
dy1
,
dy2
,
radius
;
int
dx1
,
dx2
,
dy1
,
dy2
,
radius
;
if
(
(
GetLayerMask
(
Mire
->
GetLayer
()
)
&
aLayerMask
)
==
0
)
if
(
(
GetLayerMask
(
a
Mire
->
GetLayer
()
)
&
aLayerMask
)
==
0
)
return
;
return
;
D
rawTmp
=
new
DRAWSEGMENT
(
NULL
)
;
D
RAWSEGMENT
draw
;
DrawTmp
->
m_Width
=
(
trace_mode
==
FILAIRE
)
?
-
1
:
Mire
->
m_Width
;
draw
.
SetShape
(
S_CIRCLE
);
DrawTmp
->
SetLayer
(
Mire
->
GetLayer
()
);
draw
.
SetWidth
(
(
trace_mode
==
FILAIRE
)
?
-
1
:
aMire
->
GetWidth
()
);
draw
.
SetLayer
(
aMire
->
GetLayer
()
);
DrawTmp
->
m_Start
.
x
=
Mire
->
m_Pos
.
x
;
DrawTmp
->
m_Start
.
y
=
Mire
->
m_Pos
.
y
;
draw
.
SetStart
(
aMire
->
GetPosition
()
);
DrawTmp
->
m_End
.
x
=
DrawTmp
->
m_Start
.
x
+
(
Mire
->
m_Size
/
4
);
draw
.
SetEnd
(
wxPoint
(
draw
.
GetStart
().
x
+
(
aMire
->
GetSize
()
/
4
),
draw
.
GetStart
().
y
));
DrawTmp
->
m_End
.
y
=
DrawTmp
->
m_Start
.
y
;
PlotDrawSegment
(
plotter
,
&
draw
,
aLayerMask
,
trace_mode
);
DrawTmp
->
m_Shape
=
S_CIRCLE
;
PlotDrawSegment
(
plotter
,
DrawTmp
,
aLayerMask
,
trace_mode
);
DrawTmp
->
m_Shape
=
S_SEGMENT
;
draw
.
SetShape
(
S_SEGMENT
)
;
radius
=
Mire
->
m_Size
/
2
;
radius
=
aMire
->
GetSize
()
/
2
;
dx1
=
radius
;
dx1
=
radius
;
dy1
=
0
;
dy1
=
0
;
dx2
=
0
;
dx2
=
0
;
dy2
=
radius
;
dy2
=
radius
;
if
(
Mire
->
m_Shape
)
/* Shape X */
if
(
aMire
->
GetShape
()
)
// Shape X
{
{
dx1
=
dy1
=
(
radius
*
7
)
/
5
;
dx1
=
dy1
=
(
radius
*
7
)
/
5
;
dx2
=
dx1
;
dx2
=
dx1
;
dy2
=
-
dy1
;
dy2
=
-
dy1
;
}
}
DrawTmp
->
m_Start
.
x
=
Mire
->
m_Pos
.
x
-
dx1
;
wxPoint
mirePos
(
aMire
->
GetPosition
()
);
DrawTmp
->
m_Start
.
y
=
Mire
->
m_Pos
.
y
-
dy1
;
DrawTmp
->
m_End
.
x
=
Mire
->
m_Pos
.
x
+
dx1
;
DrawTmp
->
m_End
.
y
=
Mire
->
m_Pos
.
y
+
dy1
;
PlotDrawSegment
(
plotter
,
DrawTmp
,
aLayerMask
,
trace_mode
);
DrawTmp
->
m_Start
.
x
=
Mire
->
m_Pos
.
x
-
dx2
;
draw
.
SetStart
(
wxPoint
(
mirePos
.
x
-
dx1
,
mirePos
.
y
-
dy1
));
DrawTmp
->
m_Start
.
y
=
Mire
->
m_Pos
.
y
-
dy2
;
draw
.
SetEnd
(
wxPoint
(
mirePos
.
x
+
dx1
,
mirePos
.
y
+
dy1
));
DrawTmp
->
m_End
.
x
=
Mire
->
m_Pos
.
x
+
dx2
;
PlotDrawSegment
(
plotter
,
&
draw
,
aLayerMask
,
trace_mode
);
DrawTmp
->
m_End
.
y
=
Mire
->
m_Pos
.
y
+
dy2
;
PlotDrawSegment
(
plotter
,
DrawTmp
,
aLayerMask
,
trace_mode
);
delete
DrawTmp
;
draw
.
SetStart
(
wxPoint
(
mirePos
.
x
-
dx2
,
mirePos
.
y
-
dy2
));
draw
.
SetEnd
(
wxPoint
(
mirePos
.
x
+
dx2
,
mirePos
.
y
+
dy2
));
PlotDrawSegment
(
plotter
,
&
draw
,
aLayerMask
,
trace_mode
);
}
}
...
@@ -398,23 +374,21 @@ void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int aLayerMask, GRTraceMo
...
@@ -398,23 +374,21 @@ void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int aLayerMask, GRTraceMo
}
}
/* Plot a graphic item (outline) relative to a footprint */
/*
*
Plot a graphic item (outline) relative to a footprint */
void
Plot_1_EdgeModule
(
PLOTTER
*
plotter
,
EDGE_MODULE
*
Pt
Edge
,
GRTraceMode
trace_mode
)
void
Plot_1_EdgeModule
(
PLOTTER
*
plotter
,
EDGE_MODULE
*
a
Edge
,
GRTraceMode
trace_mode
)
{
{
int
type_trace
;
/* Type of item to plot. */
int
type_trace
;
// Type of item to plot.
int
thickness
;
/* Segment thickness. */
int
thickness
;
// Segment thickness.
int
radius
;
/* Circle radius. */
int
radius
;
// Circle radius.
int
StAngle
,
EndAngle
;
wxPoint
pos
,
end
;
if
(
Pt
Edge
->
Type
()
!=
PCB_MODULE_EDGE_T
)
if
(
a
Edge
->
Type
()
!=
PCB_MODULE_EDGE_T
)
return
;
return
;
type_trace
=
PtEdge
->
m_Shape
;
type_trace
=
aEdge
->
GetShape
()
;
thickness
=
PtEdge
->
m_Width
;
thickness
=
aEdge
->
GetWidth
()
;
pos
=
PtEdge
->
m_Start
;
wxPoint
pos
(
aEdge
->
GetStart
()
)
;
end
=
PtEdge
->
m_End
;
wxPoint
end
(
aEdge
->
GetEnd
()
)
;
switch
(
type_trace
)
switch
(
type_trace
)
{
{
...
@@ -429,48 +403,54 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge, GRTraceMode trace
...
@@ -429,48 +403,54 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge, GRTraceMode trace
break
;
break
;
case
S_ARC
:
case
S_ARC
:
radius
=
(
int
)
hypot
(
(
double
)
(
end
.
x
-
pos
.
x
),
{
(
double
)
(
end
.
y
-
pos
.
y
)
);
radius
=
(
int
)
hypot
(
(
double
)
(
end
.
x
-
pos
.
x
),
StAngle
=
ArcTangente
(
end
.
y
-
pos
.
y
,
end
.
x
-
pos
.
x
);
(
double
)
(
end
.
y
-
pos
.
y
)
);
EndAngle
=
StAngle
+
PtEdge
->
m_Angle
;
plotter
->
thick_arc
(
pos
,
double
startAngle
=
ArcTangente
(
end
.
y
-
pos
.
y
,
end
.
x
-
pos
.
x
);
-
EndAngle
,
-
StAngle
,
double
endAngle
=
startAngle
+
aEdge
->
GetAngle
();
radius
,
thickness
,
plotter
->
thick_arc
(
pos
,
trace_mode
);
-
endAngle
,
-
startAngle
,
radius
,
thickness
,
trace_mode
);
}
break
;
break
;
case
S_POLYGON
:
case
S_POLYGON
:
{
{
std
::
vector
<
wxPoint
>
polyPoints
=
Pt
Edge
->
GetPolyPoints
();
const
std
::
vector
<
wxPoint
>&
polyPoints
=
a
Edge
->
GetPolyPoints
();
if
(
polyPoints
.
size
()
<=
1
)
// Malformed polygon
if
(
polyPoints
.
size
()
<=
1
)
// Malformed polygon
break
;
break
;
// We must compute true coordinates from m_PolyList
// We must compute true coordinates from m_PolyList
// which are relative to module position, orientation 0
// which are relative to module position, orientation 0
MODULE
*
module
=
Pt
Edge
->
GetParentModule
();
MODULE
*
module
=
a
Edge
->
GetParentModule
();
static
std
::
vector
<
wxPoint
>
cornerList
;
std
::
vector
<
wxPoint
>
cornerList
;
cornerList
.
clear
();
for
(
unsigned
ii
=
0
;
ii
<
polyPoints
.
size
();
ii
++
)
cornerList
.
reserve
(
polyPoints
.
size
()
);
{
wxPoint
corner
=
polyPoints
[
ii
];
if
(
module
)
for
(
unsigned
ii
=
0
;
ii
<
polyPoints
.
size
();
ii
++
)
{
{
RotatePoint
(
&
corner
,
module
->
m_Orient
);
wxPoint
corner
=
polyPoints
[
ii
];
corner
+=
module
->
m_Pos
;
if
(
module
)
{
RotatePoint
(
&
corner
,
module
->
GetOrientation
()
);
corner
+=
module
->
GetPosition
();
}
cornerList
.
push_back
(
corner
);
}
}
cornerList
.
push_back
(
corner
);
plotter
->
PlotPoly
(
cornerList
,
FILLED_SHAPE
,
thickness
);
}
}
break
;
plotter
->
PlotPoly
(
cornerList
,
FILLED_SHAPE
,
thickness
);
}
break
;
}
}
}
}
...
@@ -613,27 +593,26 @@ void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone, GRTraceMode trace
...
@@ -613,27 +593,26 @@ void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone, GRTraceMode trace
/* Plot items type DRAWSEGMENT on layers allowed by aLayerMask
/* Plot items type DRAWSEGMENT on layers allowed by aLayerMask
*/
*/
void
PlotDrawSegment
(
PLOTTER
*
plotter
,
DRAWSEGMENT
*
pt_segm
,
int
aLayerMask
,
void
PlotDrawSegment
(
PLOTTER
*
plotter
,
DRAWSEGMENT
*
aSeg
,
int
aLayerMask
,
GRTraceMode
trace_mode
)
GRTraceMode
trace_mode
)
{
{
wxPoint
start
,
end
;
int
thickness
;
int
thickness
;
int
radius
=
0
,
StAngle
=
0
,
EndAngle
=
0
;
int
radius
=
0
,
StAngle
=
0
,
EndAngle
=
0
;
if
(
(
GetLayerMask
(
pt_segm
->
GetLayer
()
)
&
aLayerMask
)
==
0
)
if
(
(
GetLayerMask
(
aSeg
->
GetLayer
()
)
&
aLayerMask
)
==
0
)
return
;
return
;
if
(
trace_mode
==
FILAIRE
)
if
(
trace_mode
==
FILAIRE
)
thickness
=
g_PcbPlotOptions
.
m_PlotLineWidth
;
thickness
=
g_PcbPlotOptions
.
m_PlotLineWidth
;
else
else
thickness
=
pt_segm
->
m_Width
;
thickness
=
aSeg
->
GetWidth
()
;
start
=
pt_segm
->
m_Start
;
wxPoint
start
(
aSeg
->
GetStart
()
)
;
end
=
pt_segm
->
m_End
;
wxPoint
end
(
aSeg
->
GetEnd
()
)
;
plotter
->
set_current_line_width
(
thickness
);
plotter
->
set_current_line_width
(
thickness
);
switch
(
pt_segm
->
m_Shape
)
switch
(
aSeg
->
GetShape
()
)
{
{
case
S_CIRCLE
:
case
S_CIRCLE
:
radius
=
(
int
)
hypot
(
(
double
)
(
end
.
x
-
start
.
x
),
radius
=
(
int
)
hypot
(
(
double
)
(
end
.
x
-
start
.
x
),
...
@@ -645,20 +624,21 @@ void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* pt_segm, int aLayerMask,
...
@@ -645,20 +624,21 @@ void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* pt_segm, int aLayerMask,
radius
=
(
int
)
hypot
(
(
double
)
(
end
.
x
-
start
.
x
),
radius
=
(
int
)
hypot
(
(
double
)
(
end
.
x
-
start
.
x
),
(
double
)
(
end
.
y
-
start
.
y
)
);
(
double
)
(
end
.
y
-
start
.
y
)
);
StAngle
=
ArcTangente
(
end
.
y
-
start
.
y
,
end
.
x
-
start
.
x
);
StAngle
=
ArcTangente
(
end
.
y
-
start
.
y
,
end
.
x
-
start
.
x
);
EndAngle
=
StAngle
+
pt_segm
->
m_Angle
;
EndAngle
=
StAngle
+
aSeg
->
GetAngle
()
;
plotter
->
thick_arc
(
start
,
-
EndAngle
,
-
StAngle
,
radius
,
thickness
,
trace_mode
);
plotter
->
thick_arc
(
start
,
-
EndAngle
,
-
StAngle
,
radius
,
thickness
,
trace_mode
);
break
;
break
;
case
S_CURVE
:
case
S_CURVE
:
{
{
std
::
vector
<
wxPoint
>
bezierPoints
=
pt_segm
->
GetBezierPoints
();
const
std
::
vector
<
wxPoint
>&
bezierPoints
=
aSeg
->
GetBezierPoints
();
for
(
unsigned
i
=
1
;
i
<
bezierPoints
.
size
();
i
++
)
plotter
->
thick_segment
(
bezierPoints
[
i
-
1
],
for
(
unsigned
i
=
1
;
i
<
bezierPoints
.
size
();
i
++
)
bezierPoints
[
i
],
plotter
->
thick_segment
(
bezierPoints
[
i
-
1
],
thickness
,
bezierPoints
[
i
],
trace_mode
);
thickness
,
trace_mode
);
}
break
;
break
;
}
default
:
default
:
plotter
->
thick_segment
(
start
,
end
,
thickness
,
trace_mode
);
plotter
->
thick_segment
(
start
,
end
,
thickness
,
trace_mode
);
...
...
pcbnew/protos.h
View file @
96bb90de
...
@@ -69,7 +69,8 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoi
...
@@ -69,7 +69,8 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoi
void
ShowNewTrackWhenMovingCursor
(
EDA_DRAW_PANEL
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aPosition
,
void
ShowNewTrackWhenMovingCursor
(
EDA_DRAW_PANEL
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aPosition
,
bool
aErase
);
bool
aErase
);
/* Determine coordinate for a segment direction of 0, 90 or 45 degrees,
/**
* Determine coordinate for a segment direction of 0, 90 or 45 degrees,
* depending on it's position from the origin (ox, oy) and \a aPosiition..
* depending on it's position from the origin (ox, oy) and \a aPosiition..
*/
*/
void
CalculateSegmentEndPoint
(
const
wxPoint
&
aPosition
,
int
ox
,
int
oy
,
int
*
fx
,
int
*
fy
);
void
CalculateSegmentEndPoint
(
const
wxPoint
&
aPosition
,
int
ox
,
int
oy
,
int
*
fx
,
int
*
fy
);
...
...
pcbnew/specctra_export.cpp
View file @
96bb90de
...
@@ -212,14 +212,25 @@ static DRAWSEGMENT* findPoint( const wxPoint& aPoint, TYPE_COLLECTOR* items )
...
@@ -212,14 +212,25 @@ static DRAWSEGMENT* findPoint( const wxPoint& aPoint, TYPE_COLLECTOR* items )
wxASSERT
(
graphic
->
Type
()
==
PCB_LINE_T
);
wxASSERT
(
graphic
->
Type
()
==
PCB_LINE_T
);
if
(
aPoint
==
graphic
->
GetStart
()
||
aPoint
==
graphic
->
GetEnd
()
)
switch
(
graphic
->
GetShape
()
)
{
{
items
->
Remove
(
i
);
case
S_ARC
:
return
graphic
;
if
(
aPoint
==
graphic
->
GetArcStart
()
||
aPoint
==
graphic
->
GetArcEnd
()
)
{
items
->
Remove
(
i
);
return
graphic
;
}
break
;
default:
if
(
aPoint
==
graphic
->
GetStart
()
||
aPoint
==
graphic
->
GetEnd
()
)
{
items
->
Remove
(
i
);
return
graphic
;
}
}
}
}
}
#if defined(DEBUG)
#if defined(DEBUG)
printf
(
"Unable to find segment matching point (%d,%d)
\n
"
,
printf
(
"Unable to find segment matching point (%d,%d)
\n
"
,
aPoint
.
x
,
aPoint
.
y
);
aPoint
.
x
,
aPoint
.
y
);
...
@@ -229,7 +240,7 @@ static DRAWSEGMENT* findPoint( const wxPoint& aPoint, TYPE_COLLECTOR* items )
...
@@ -229,7 +240,7 @@ static DRAWSEGMENT* findPoint( const wxPoint& aPoint, TYPE_COLLECTOR* items )
DRAWSEGMENT
*
graphic
=
(
DRAWSEGMENT
*
)
(
*
items
)[
i
];
DRAWSEGMENT
*
graphic
=
(
DRAWSEGMENT
*
)
(
*
items
)[
i
];
printf
(
"type=%s, GetStart()=%d,%d GetEnd()=%d,%d
\n
"
,
printf
(
"type=%s, GetStart()=%d,%d GetEnd()=%d,%d
\n
"
,
TO_UTF8
(
BOARD_ITEM
::
ShowShape
(
(
STROKE_T
)
graphic
->
m_Shape
)
),
TO_UTF8
(
BOARD_ITEM
::
ShowShape
(
(
STROKE_T
)
graphic
->
GetShape
()
)
),
graphic
->
GetStart
().
x
,
graphic
->
GetStart
().
x
,
graphic
->
GetStart
().
y
,
graphic
->
GetStart
().
y
,
graphic
->
GetEnd
().
x
,
graphic
->
GetEnd
().
x
,
...
@@ -614,17 +625,17 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
...
@@ -614,17 +625,17 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
SHAPE
*
outline
;
SHAPE
*
outline
;
PATH
*
path
;
PATH
*
path
;
switch
(
graphic
->
m_Shape
)
switch
(
graphic
->
GetShape
()
)
{
{
case
S_SEGMENT
:
case
S_SEGMENT
:
outline
=
new
SHAPE
(
image
,
T_outline
);
outline
=
new
SHAPE
(
image
,
T_outline
);
image
->
Append
(
outline
);
image
->
Append
(
outline
);
path
=
new
PATH
(
outline
);
path
=
new
PATH
(
outline
);
outline
->
SetShape
(
path
);
outline
->
SetShape
(
path
);
path
->
SetAperture
(
scale
(
graphic
->
m_Width
)
);
path
->
SetAperture
(
scale
(
graphic
->
GetWidth
()
)
);
path
->
SetLayerId
(
"signal"
);
path
->
SetLayerId
(
"signal"
);
path
->
AppendPoint
(
mapPt
(
graphic
->
m_Start0
)
);
path
->
AppendPoint
(
mapPt
(
graphic
->
GetStart0
()
)
);
path
->
AppendPoint
(
mapPt
(
graphic
->
m_End0
)
);
path
->
AppendPoint
(
mapPt
(
graphic
->
GetEnd0
()
)
);
break
;
break
;
case
S_CIRCLE
:
case
S_CIRCLE
:
...
@@ -636,7 +647,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
...
@@ -636,7 +647,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
image
->
Append
(
outline
);
image
->
Append
(
outline
);
path
=
new
PATH
(
outline
);
path
=
new
PATH
(
outline
);
outline
->
SetShape
(
path
);
outline
->
SetShape
(
path
);
path
->
SetAperture
(
scale
(
graphic
->
m_Width
)
);
path
->
SetAperture
(
scale
(
graphic
->
GetWidth
()
)
);
path
->
SetLayerId
(
"signal"
);
path
->
SetLayerId
(
"signal"
);
// Do the math using KiCad units, that way we stay out of the
// Do the math using KiCad units, that way we stay out of the
...
@@ -645,8 +656,8 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
...
@@ -645,8 +656,8 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
// lexer/beautifier, and the spec is not clear that this is
// lexer/beautifier, and the spec is not clear that this is
// required. Fixed point floats are all that should be needed.
// required. Fixed point floats are all that should be needed.
double
radius
=
hypot
(
double
(
graphic
->
m_Start
.
x
-
graphic
->
m_End
.
x
),
double
radius
=
hypot
(
double
(
graphic
->
GetStart
().
x
-
graphic
->
GetEnd
()
.
x
),
double
(
graphic
->
m_Start
.
y
-
graphic
->
m_End
.
y
)
);
double
(
graphic
->
GetStart
().
y
-
graphic
->
GetEnd
()
.
y
)
);
// better if evenly divisible into 360
// better if evenly divisible into 360
const
int
DEGREE_INTERVAL
=
18
;
// 18 means 20 line segments
const
int
DEGREE_INTERVAL
=
18
;
// 18 means 20 line segments
...
@@ -667,7 +678,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
...
@@ -667,7 +678,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
case
S_ARC
:
case
S_ARC
:
default
:
default
:
D
(
printf
(
"makeIMAGE(): unsupported shape %s
\n
"
,
D
(
printf
(
"makeIMAGE(): unsupported shape %s
\n
"
,
TO_UTF8
(
BOARD_ITEM
::
ShowShape
(
(
STROKE_T
)
graphic
->
m_Shape
))
);)
TO_UTF8
(
BOARD_ITEM
::
ShowShape
(
(
STROKE_T
)
graphic
->
GetShape
()
))
);)
continue
;
continue
;
}
}
}
}
...
@@ -778,7 +789,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
...
@@ -778,7 +789,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
for
(;;)
for
(;;)
{
{
switch
(
graphic
->
m_Shape
)
switch
(
graphic
->
GetShape
()
)
{
{
case
S_SEGMENT
:
case
S_SEGMENT
:
{
{
...
@@ -807,14 +818,14 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
...
@@ -807,14 +818,14 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
{
{
const
int
STEPS
=
9
;
// in an arc of 90 degrees
const
int
STEPS
=
9
;
// in an arc of 90 degrees
wxPoint
start
=
graphic
->
GetStart
();
wxPoint
start
=
graphic
->
Get
Arc
Start
();
wxPoint
end
=
graphic
->
GetEnd
();
wxPoint
end
=
graphic
->
Get
Arc
End
();
wxPoint
center
=
graphic
->
m_Start
;
wxPoint
center
=
graphic
->
GetCenter
()
;
int
angle
=
-
graphic
->
m_Angle
;
double
angle
=
-
graphic
->
GetAngle
()
;
if
(
prevPt
!=
start
)
if
(
prevPt
!=
start
)
{
{
wxASSERT
(
prevPt
==
graphic
->
GetEnd
()
);
wxASSERT
(
prevPt
==
graphic
->
Get
Arc
End
()
);
angle
=
-
angle
;
angle
=
-
angle
;
EXCHG
(
start
,
end
);
EXCHG
(
start
,
end
);
...
@@ -824,7 +835,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
...
@@ -824,7 +835,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
for
(
int
step
=
1
;
step
<=
STEPS
;
++
step
)
for
(
int
step
=
1
;
step
<=
STEPS
;
++
step
)
{
{
int
rotation
=
(
angle
*
step
)
/
STEPS
;
double
rotation
=
(
angle
*
step
)
/
STEPS
;
nextPt
=
start
;
nextPt
=
start
;
...
@@ -858,7 +869,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
...
@@ -858,7 +869,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
wxString
error
;
wxString
error
;
error
.
Printf
(
_
(
"Unsupported DRAWSEGMENT type %s"
),
error
.
Printf
(
_
(
"Unsupported DRAWSEGMENT type %s"
),
GetChars
(
BOARD_ITEM
::
ShowShape
(
(
STROKE_T
)
graphic
->
m_Shape
)
)
);
GetChars
(
BOARD_ITEM
::
ShowShape
(
(
STROKE_T
)
graphic
->
GetShape
()
)
)
);
ThrowIOError
(
error
);
ThrowIOError
(
error
);
}
}
...
...
pcbnew/specctra_import.cpp
View file @
96bb90de
...
@@ -270,7 +270,7 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
...
@@ -270,7 +270,7 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
via
=
new
SEGVIA
(
sessionBoard
);
via
=
new
SEGVIA
(
sessionBoard
);
via
->
SetPosition
(
mapPt
(
aPoint
,
routeResolution
)
);
via
->
SetPosition
(
mapPt
(
aPoint
,
routeResolution
)
);
via
->
SetDrill
Value
(
drillDiam
);
via
->
SetDrill
(
drillDiam
);
via
->
m_Shape
=
VIA_THROUGH
;
via
->
m_Shape
=
VIA_THROUGH
;
via
->
m_Width
=
viaDiam
;
via
->
m_Width
=
viaDiam
;
via
->
SetLayerPair
(
LAYER_N_FRONT
,
LAYER_N_BACK
);
via
->
SetLayerPair
(
LAYER_N_FRONT
,
LAYER_N_BACK
);
...
@@ -288,7 +288,7 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
...
@@ -288,7 +288,7 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
via
=
new
SEGVIA
(
sessionBoard
);
via
=
new
SEGVIA
(
sessionBoard
);
via
->
SetPosition
(
mapPt
(
aPoint
,
routeResolution
)
);
via
->
SetPosition
(
mapPt
(
aPoint
,
routeResolution
)
);
via
->
SetDrill
Value
(
drillDiam
);
via
->
SetDrill
(
drillDiam
);
via
->
m_Shape
=
VIA_THROUGH
;
via
->
m_Shape
=
VIA_THROUGH
;
via
->
m_Width
=
viaDiam
;
via
->
m_Width
=
viaDiam
;
via
->
SetLayerPair
(
LAYER_N_FRONT
,
LAYER_N_BACK
);
via
->
SetLayerPair
(
LAYER_N_FRONT
,
LAYER_N_BACK
);
...
@@ -329,7 +329,7 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
...
@@ -329,7 +329,7 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
via
=
new
SEGVIA
(
sessionBoard
);
via
=
new
SEGVIA
(
sessionBoard
);
via
->
SetPosition
(
mapPt
(
aPoint
,
routeResolution
)
);
via
->
SetPosition
(
mapPt
(
aPoint
,
routeResolution
)
);
via
->
SetDrill
Value
(
drillDiam
);
via
->
SetDrill
(
drillDiam
);
if
(
(
topLayerNdx
==
0
&&
botLayerNdx
==
1
)
if
(
(
topLayerNdx
==
0
&&
botLayerNdx
==
1
)
||
(
topLayerNdx
==
copperLayerCount
-
2
&&
botLayerNdx
==
copperLayerCount
-
1
))
||
(
topLayerNdx
==
copperLayerCount
-
2
&&
botLayerNdx
==
copperLayerCount
-
1
))
...
...
pcbnew/swap_layers.cpp
View file @
96bb90de
...
@@ -371,7 +371,7 @@ void PCB_EDIT_FRAME::Swap_Layers( wxCommandEvent& event )
...
@@ -371,7 +371,7 @@ void PCB_EDIT_FRAME::Swap_Layers( wxCommandEvent& event )
{
{
SEGVIA
*
Via
=
(
SEGVIA
*
)
pt_segm
;
SEGVIA
*
Via
=
(
SEGVIA
*
)
pt_segm
;
if
(
Via
->
Shape
()
==
VIA_THROUGH
)
if
(
Via
->
Get
Shape
()
==
VIA_THROUGH
)
continue
;
continue
;
int
top_layer
,
bottom_layer
;
int
top_layer
,
bottom_layer
;
...
...
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