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
aac10106
Commit
aac10106
authored
May 22, 2012
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more eagle_plugin work
parent
cb210042
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
695 additions
and
137 deletions
+695
-137
wxPcbStruct.h
include/wxPcbStruct.h
+1
-1
class_drawsegment.cpp
pcbnew/class_drawsegment.cpp
+45
-35
class_drawsegment.h
pcbnew/class_drawsegment.h
+14
-14
class_module.h
pcbnew/class_module.h
+5
-0
class_text_mod.h
pcbnew/class_text_mod.h
+5
-5
eagle_plugin.cpp
pcbnew/eagle_plugin.cpp
+556
-27
eagle_plugin.h
pcbnew/eagle_plugin.h
+33
-22
edgemod.cpp
pcbnew/edgemod.cpp
+1
-1
editedge.cpp
pcbnew/editedge.cpp
+1
-1
legacy_plugin.cpp
pcbnew/legacy_plugin.cpp
+6
-3
modedit_onclick.cpp
pcbnew/modedit_onclick.cpp
+2
-2
module_editor_frame.h
pcbnew/module_editor_frame.h
+1
-1
onleftclick.cpp
pcbnew/onleftclick.cpp
+25
-25
No files found.
include/wxPcbStruct.h
View file @
aac10106
...
...
@@ -1340,7 +1340,7 @@ public:
void
ShowTargetOptionsDialog
(
PCB_TARGET
*
aTarget
,
wxDC
*
DC
);
// Graphic segments type DRAWSEGMENT handling:
DRAWSEGMENT
*
Begin_DrawSegment
(
DRAWSEGMENT
*
Segment
,
int
shape
,
wxDC
*
DC
);
DRAWSEGMENT
*
Begin_DrawSegment
(
DRAWSEGMENT
*
Segment
,
STROKE_T
shape
,
wxDC
*
DC
);
void
End_Edge
(
DRAWSEGMENT
*
Segment
,
wxDC
*
DC
);
void
Delete_Segment_Edge
(
DRAWSEGMENT
*
Segment
,
wxDC
*
DC
);
void
Delete_Drawings_All_Layer
(
int
aLayer
);
...
...
pcbnew/class_drawsegment.cpp
View file @
aac10106
...
...
@@ -124,6 +124,10 @@ const wxPoint DRAWSEGMENT::GetArcEnd() const
// m_Start is the arc centre
endPoint
=
m_End
;
// m_End = start point of arc
RotatePoint
(
&
endPoint
,
m_Start
,
-
m_Angle
);
break
;
default
:
;
}
return
endPoint
;
// after rotation, the end of the arc.
...
...
@@ -387,15 +391,15 @@ EDA_RECT DRAWSEGMENT::GetBoundingBox() const
switch
(
m_Shape
)
{
case
S_SEGMENT
:
bbox
.
SetEnd
(
m_End
);
break
;
case
S_SEGMENT
:
bbox
.
SetEnd
(
m_End
);
break
;
case
S_CIRCLE
:
bbox
.
Inflate
(
GetRadius
()
);
break
;
case
S_CIRCLE
:
bbox
.
Inflate
(
GetRadius
()
);
break
;
case
S_ARC
:
case
S_ARC
:
{
bbox
.
Merge
(
m_End
);
wxPoint
end
=
m_End
;
...
...
@@ -404,7 +408,7 @@ EDA_RECT DRAWSEGMENT::GetBoundingBox() const
}
break
;
case
S_POLYGON
:
case
S_POLYGON
:
{
wxPoint
p_end
;
MODULE
*
module
=
GetParentModule
();
...
...
@@ -429,8 +433,11 @@ EDA_RECT DRAWSEGMENT::GetBoundingBox() const
}
bbox
.
SetEnd
(
p_end
);
break
;
}
break
;
default
:
;
}
bbox
.
Inflate
(
((
m_Width
+
1
)
/
2
)
+
1
);
...
...
@@ -449,30 +456,30 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aPosition )
{
case
S_CIRCLE
:
case
S_ARC
:
{
int
radius
=
GetRadius
();
int
dist
=
(
int
)
hypot
(
(
double
)
relPos
.
x
,
(
double
)
relPos
.
y
);
if
(
abs
(
radius
-
dist
)
<=
(
m_Width
/
2
)
)
{
i
f
(
m_Shape
==
S_CIRCLE
)
return
true
;
i
nt
radius
=
GetRadius
();
int
dist
=
(
int
)
hypot
(
(
double
)
relPos
.
x
,
(
double
)
relPos
.
y
)
;
wxPoint
startVec
=
wxPoint
(
m_End
.
x
-
m_Start
.
x
,
m_End
.
y
-
m_Start
.
y
);
wxPoint
endVec
=
m_End
-
m_Start
;
RotatePoint
(
&
endVec
,
-
m_Angle
);
if
(
abs
(
radius
-
dist
)
<=
(
m_Width
/
2
)
)
{
if
(
m_Shape
==
S_CIRCLE
)
return
true
;
// Check dot products
if
(
(
long
long
)
relPos
.
x
*
startVec
.
x
+
(
long
long
)
relPos
.
y
*
startVec
.
y
<
0
)
return
false
;
wxPoint
startVec
=
wxPoint
(
m_End
.
x
-
m_Start
.
x
,
m_End
.
y
-
m_Start
.
y
);
wxPoint
endVec
=
m_End
-
m_Start
;
RotatePoint
(
&
endVec
,
-
m_Angle
)
;
if
(
(
long
long
)
relPos
.
x
*
endVec
.
x
+
(
long
long
)
relPos
.
y
*
endVec
.
y
<
0
)
return
false
;
// Check dot products
if
(
(
long
long
)
relPos
.
x
*
startVec
.
x
+
(
long
long
)
relPos
.
y
*
startVec
.
y
<
0
)
return
false
;
return
true
;
if
(
(
long
long
)
relPos
.
x
*
endVec
.
x
+
(
long
long
)
relPos
.
y
*
endVec
.
y
<
0
)
return
false
;
return
true
;
}
}
}
break
;
break
;
case
S_CURVE
:
for
(
unsigned
int
i
=
1
;
i
<
m_BezierPoints
.
size
();
i
++
)
...
...
@@ -499,7 +506,7 @@ bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect ) const
{
switch
(
m_Shape
)
{
case
S_CIRCLE
:
case
S_CIRCLE
:
{
int
radius
=
GetRadius
();
...
...
@@ -512,14 +519,17 @@ bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect ) const
}
break
;
case
S_ARC
:
case
S_SEGMENT
:
if
(
aRect
.
Contains
(
GetStart
()
)
)
return
true
;
case
S_ARC
:
case
S_SEGMENT
:
if
(
aRect
.
Contains
(
GetStart
()
)
)
return
true
;
if
(
aRect
.
Contains
(
GetEnd
()
)
)
return
true
;
break
;
if
(
aRect
.
Contains
(
GetEnd
()
)
)
return
true
;
break
;
default
:
;
}
return
false
;
}
...
...
pcbnew/class_drawsegment.h
View file @
aac10106
...
...
@@ -43,15 +43,15 @@ class MODULE;
class
DRAWSEGMENT
:
public
BOARD_ITEM
{
protected
:
int
m_Width
;
///< thickness of lines ...
wxPoint
m_Start
;
///< Line start point or Circle and Arc center
wxPoint
m_End
;
///< Line end point or circle and arc start point
int
m_Width
;
///< thickness of lines ...
wxPoint
m_Start
;
///< Line start point or Circle and Arc center
wxPoint
m_End
;
///< Line end point or circle and arc start point
int
m_Shape
;
///< Shape: line, Circle, Arc
int
m_Type
;
///< Used in complex associations ( Dimensions.. )
double
m_Angle
;
///< Used only for Arcs: Arc angle in 1/10 deg
wxPoint
m_BezierC1
;
///< Bezier Control Point 1
wxPoint
m_BezierC2
;
///< Bezier Control Point 2
STROKE_T
m_Shape
;
///< Shape: line, Circle, Arc
int
m_Type
;
///< Used in complex associations ( Dimensions.. )
double
m_Angle
;
///< Used only for Arcs: Arc angle in 1/10 deg
wxPoint
m_BezierC1
;
///< Bezier Control Point 1
wxPoint
m_BezierC2
;
///< Bezier Control Point 2
std
::
vector
<
wxPoint
>
m_BezierPoints
;
std
::
vector
<
wxPoint
>
m_PolyPoints
;
...
...
@@ -80,11 +80,11 @@ public:
void
SetAngle
(
double
aAngle
);
// encapsulates the transition to degrees
double
GetAngle
()
const
{
return
m_Angle
;
}
void
SetType
(
int
aType
)
{
m_Type
=
aType
;
}
int
GetType
()
const
{
return
m_Type
;
}
void
SetType
(
int
aType
)
{
m_Type
=
aType
;
}
int
GetType
()
const
{
return
m_Type
;
}
void
SetShape
(
int
aShape
)
{
m_Shape
=
aShape
;
}
int
GetShape
()
const
{
return
m_Shape
;
}
void
SetShape
(
STROKE_T
aShape
)
{
m_Shape
=
aShape
;
}
STROKE_T
GetShape
()
const
{
return
m_Shape
;
}
void
SetBezControl1
(
const
wxPoint
&
aPoint
)
{
m_BezierC1
=
aPoint
;
}
const
wxPoint
&
GetBezControl1
()
const
{
return
m_BezierC1
;
}
...
...
@@ -92,8 +92,8 @@ public:
void
SetBezControl2
(
const
wxPoint
&
aPoint
)
{
m_BezierC2
=
aPoint
;
}
const
wxPoint
&
GetBezControl2
()
const
{
return
m_BezierC2
;
}
void
SetPosition
(
const
wxPoint
&
aPos
)
{
m_Start
=
aPos
;
}
// override
const
wxPoint
&
GetPosition
()
const
{
return
m_Start
;
}
// override
void
SetPosition
(
const
wxPoint
&
aPos
)
{
m_Start
=
aPos
;
}
// override
const
wxPoint
&
GetPosition
()
const
{
return
m_Start
;
}
// override
/**
* Function GetStart
...
...
pcbnew/class_module.h
View file @
aac10106
...
...
@@ -294,6 +294,11 @@ public:
m_Value
->
m_Text
=
aValue
;
}
/// read/write accessors:
TEXTE_MODULE
&
Value
()
{
return
*
m_Value
;
}
TEXTE_MODULE
&
Reference
()
{
return
*
m_Reference
;
}
/**
* Function FindPadByName
* returns a D_PAD* with a matching name. Note that names may not be
...
...
pcbnew/class_text_mod.h
View file @
aac10106
...
...
@@ -88,14 +88,14 @@ public:
}
/// @deprecated it seems
void
SetType
(
int
aType
)
{
m_Type
=
aType
;
}
int
GetType
()
const
{
return
m_Type
;
}
void
SetType
(
int
aType
)
{
m_Type
=
aType
;
}
int
GetType
()
const
{
return
m_Type
;
}
void
SetVisible
(
bool
isVisible
)
{
m_NoShow
=
!
isVisible
;
}
bool
IsVisible
()
const
{
return
!
m_NoShow
;
}
bool
IsVisible
()
const
{
return
!
m_NoShow
;
}
void
SetPos0
(
const
wxPoint
&
aPos
)
{
m_Pos0
=
aPos
;
}
const
wxPoint
&
GetPos0
()
const
{
return
m_Pos0
;
}
void
SetPos0
(
const
wxPoint
&
aPos
)
{
m_Pos0
=
aPos
;
}
const
wxPoint
&
GetPos0
()
const
{
return
m_Pos0
;
}
void
Copy
(
TEXTE_MODULE
*
source
);
// copy structure
...
...
pcbnew/eagle_plugin.cpp
View file @
aac10106
This diff is collapsed.
Click to expand it.
pcbnew/eagle_plugin.h
View file @
aac10106
...
...
@@ -55,15 +55,10 @@ namespace boost {
typedef
boost
::
property_tree
::
ptree
PTREE
;
typedef
const
PTREE
CPTREE
;
struct
EWIRE
///< Eagle wire
{
double
x1
;
double
y1
;
double
x2
;
double
y2
;
double
width
;
int
layer
;
};
struct
EWIRE
;
struct
EROT
;
struct
EATTR
;
struct
ECIRCLE
;
/**
...
...
@@ -104,26 +99,26 @@ public:
EAGLE_PLUGIN
();
~
EAGLE_PLUGIN
();
private
:
MODULE_MAP
m_modules
;
///< is a factory by use of MODULE copy constructor,
///< lookup is based on libname.packagename
MODULE_MAP
m_templates
;
///< is part of a MODULE factory that operates
///< using copy construction.
///< lookup key is libname.packagename
PROPERTIES
*
m_props
;
///< passed via Save() or Load(), no ownership, may be NULL.
PROPERTIES
*
m_props
;
///< passed via Save() or Load(), no ownership, may be NULL.
BOARD
*
m_board
;
///< which BOARD, no ownership here
double
mm_per_biu
;
///< how many mm in each BIU
double
biu_per_mm
;
///< how many bius in a mm
BOARD
*
m_board
;
///< which BOARD, no ownership here
double
mm_per_biu
;
///< how many mm in each BIU
double
biu_per_mm
;
///< how many bius in a mm
/// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed.
void
init
(
PROPERTIES
*
aProperties
);
int
kicad
(
double
d
)
const
;
int
kicad_y
(
double
y
)
const
{
return
kicad
(
y
);
}
int
kicad_y
(
double
y
)
const
{
return
-
kicad
(
y
);
}
int
kicad_x
(
double
x
)
const
{
return
kicad
(
x
);
}
int
kicad_layer
(
int
aLayer
)
const
;
static
int
kicad_layer
(
int
aLayer
)
;
double
eagle
(
BIU
d
)
const
{
return
mm_per_biu
*
d
;
}
double
eagle_x
(
BIU
x
)
const
{
return
eagle
(
x
);
}
...
...
@@ -202,16 +197,32 @@ private:
void
loadAllSections
(
CPTREE
&
aEagleBoard
,
const
std
::
string
&
aXpath
,
bool
aAppendToMe
);
void
loadPlain
(
CPTREE
&
aPlain
,
const
std
::
string
&
aXpath
);
void
loadNetsAndTracks
(
CPTREE
&
aSignals
,
const
std
::
string
&
aXpath
);
void
loadModules
(
CPTREE
&
aLibs
,
const
std
::
string
&
aXpath
);
void
loadLibraries
(
CPTREE
&
aLibs
,
const
std
::
string
&
aXpath
);
void
loadElements
(
CPTREE
&
aElements
,
const
std
::
string
&
aXpath
);
/**
* Function wire
* Function
e
wire
* converts a <wire>'s xml attributes to binary without additional conversion.
* @return EWIRE - an Eagle <wire> object in binary.
* @param aResult is an EWIRE to fill in with the <wire> data converted to binary.
*/
EWIRE
ewire
(
CPTREE
&
aWire
)
const
;
ECIRCLE
ecircle
(
CPTREE
&
aCircle
)
const
;
EROT
erot
(
const
std
::
string
&
aRot
)
const
;
/**
* Function eattr
* parses an Eagle "attribute" element. Note that an attribute element
* is different than an XML element attribute. The attribute element is a
* full XML node in and of itself, and has attributes of its own. Blame Eagle.
*/
E
WIRE
wire
(
CPTREE
aWir
e
)
const
;
E
ATTR
eattr
(
CPTREE
&
aAttribut
e
)
const
;
/**
* Function fmtDEG
...
...
pcbnew/edgemod.cpp
View file @
aac10106
...
...
@@ -310,7 +310,7 @@ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC )
EDGE_MODULE
*
FOOTPRINT_EDIT_FRAME
::
Begin_Edge_Module
(
EDGE_MODULE
*
aEdge
,
wxDC
*
DC
,
int
type_edge
)
STROKE_T
type_edge
)
{
MODULE
*
module
=
GetBoard
()
->
m_Modules
;
int
angle
=
0
;
...
...
pcbnew/editedge.cpp
View file @
aac10106
...
...
@@ -231,7 +231,7 @@ static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC )
/* Initialize the drawing of a segment of type other than trace.
*/
DRAWSEGMENT
*
PCB_EDIT_FRAME
::
Begin_DrawSegment
(
DRAWSEGMENT
*
Segment
,
int
shape
,
wxDC
*
DC
)
DRAWSEGMENT
*
PCB_EDIT_FRAME
::
Begin_DrawSegment
(
DRAWSEGMENT
*
Segment
,
STROKE_T
shape
,
wxDC
*
DC
)
{
int
s_large
;
DRAWSEGMENT
*
DrawItem
;
...
...
pcbnew/legacy_plugin.cpp
View file @
aac10106
...
...
@@ -1238,7 +1238,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
pos
.
y
=
biuParse
(
data
);
pad
->
SetPos0
(
pos
);
pad
->
SetPosition
(
pos
);
// pad->SetPosition( pos ); set at function return
}
else
if
(
TESTLINE
(
"Le"
)
)
...
...
@@ -1291,7 +1291,10 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
else
if
(
TESTLINE
(
"$EndPAD"
)
)
{
wxPoint
padpos
=
pad
->
GetPosition
();
// pad's "Position" is not relative to the module's,
// whereas Pos0 is relative to the module's but is the unrotated coordinate.
wxPoint
padpos
=
pad
->
GetPos0
();
RotatePoint
(
&
padpos
,
aModule
->
GetOrientation
()
);
...
...
@@ -1634,7 +1637,7 @@ void LEGACY_PLUGIN::loadPCB_LINE()
if
(
width
<
0
)
width
=
0
;
dseg
->
SetShape
(
shape
);
dseg
->
SetShape
(
STROKE_T
(
shape
)
);
dseg
->
SetWidth
(
width
);
dseg
->
SetStart
(
wxPoint
(
start_x
,
start_y
)
);
dseg
->
SetEnd
(
wxPoint
(
end_x
,
end_y
)
);
...
...
pcbnew/modedit_onclick.cpp
View file @
aac10106
...
...
@@ -81,7 +81,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case
ID_MODEDIT_LINE_TOOL
:
if
(
!
item
||
item
->
GetFlags
()
==
0
)
{
int
shape
=
S_SEGMENT
;
STROKE_T
shape
=
S_SEGMENT
;
if
(
GetToolId
()
==
ID_MODEDIT_CIRCLE_TOOL
)
shape
=
S_CIRCLE
;
...
...
@@ -107,7 +107,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
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
,
S_SEGMENT
)
);
}
else
{
...
...
pcbnew/module_editor_frame.h
View file @
aac10106
...
...
@@ -319,7 +319,7 @@ public:
* @param type_edge = S_SEGMENT,S_ARC ..
* @return the new created edge.
*/
EDGE_MODULE
*
Begin_Edge_Module
(
EDGE_MODULE
*
Edge
,
wxDC
*
DC
,
int
type_edge
);
EDGE_MODULE
*
Begin_Edge_Module
(
EDGE_MODULE
*
Edge
,
wxDC
*
DC
,
STROKE_T
type_edge
);
/**
* Function End_Edge_Module
...
...
pcbnew/onleftclick.cpp
View file @
aac10106
...
...
@@ -229,37 +229,37 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case
ID_PCB_CIRCLE_BUTT
:
case
ID_PCB_ARC_BUTT
:
case
ID_PCB_ADD_LINE_BUTT
:
{
int
shape
=
S_SEGMENT
;
{
STROKE_T
shape
=
S_SEGMENT
;
if
(
GetToolId
()
==
ID_PCB_CIRCLE_BUTT
)
shape
=
S_CIRCLE
;
if
(
GetToolId
()
==
ID_PCB_CIRCLE_BUTT
)
shape
=
S_CIRCLE
;
if
(
GetToolId
()
==
ID_PCB_ARC_BUTT
)
shape
=
S_ARC
;
if
(
GetToolId
()
==
ID_PCB_ARC_BUTT
)
shape
=
S_ARC
;
if
(
getActiveLayer
()
<=
LAST_COPPER_LAYER
)
{
DisplayError
(
this
,
_
(
"Graphic not authorized on Copper layers"
)
);
break
;
}
if
(
getActiveLayer
()
<=
LAST_COPPER_LAYER
)
{
DisplayError
(
this
,
_
(
"Graphic not authorized on Copper layers"
)
);
break
;
}
if
(
(
DrawStruct
==
NULL
)
||
(
DrawStruct
->
GetFlags
()
==
0
)
)
{
DrawStruct
=
(
BOARD_ITEM
*
)
Begin_DrawSegment
(
NULL
,
shape
,
aDC
);
SetCurItem
(
DrawStruct
);
m_canvas
->
SetAutoPanRequest
(
true
);
}
else
if
(
DrawStruct
&&
(
DrawStruct
->
Type
()
==
PCB_LINE_T
)
&&
DrawStruct
->
IsNew
()
)
{
DrawStruct
=
(
BOARD_ITEM
*
)
Begin_DrawSegment
(
(
DRAWSEGMENT
*
)
DrawStruct
,
shape
,
aDC
);
SetCurItem
(
DrawStruct
);
m_canvas
->
SetAutoPanRequest
(
true
);
if
(
(
DrawStruct
==
NULL
)
||
(
DrawStruct
->
GetFlags
()
==
0
)
)
{
DrawStruct
=
(
BOARD_ITEM
*
)
Begin_DrawSegment
(
NULL
,
shape
,
aDC
);
SetCurItem
(
DrawStruct
);
m_canvas
->
SetAutoPanRequest
(
true
);
}
else
if
(
DrawStruct
&&
(
DrawStruct
->
Type
()
==
PCB_LINE_T
)
&&
DrawStruct
->
IsNew
()
)
{
DrawStruct
=
(
BOARD_ITEM
*
)
Begin_DrawSegment
(
(
DRAWSEGMENT
*
)
DrawStruct
,
shape
,
aDC
);
SetCurItem
(
DrawStruct
);
m_canvas
->
SetAutoPanRequest
(
true
);
}
}
break
;
}
case
ID_TRACK_BUTT
:
if
(
getActiveLayer
()
>
LAST_COPPER_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