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
598cc337
Commit
598cc337
authored
Jan 02, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleaning
parent
ada6b6b8
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
611 additions
and
592 deletions
+611
-592
CHANGELOG.txt
CHANGELOG.txt
+1
-0
block.cpp
eeschema/block.cpp
+8
-12
bus-wire-junction.cpp
eeschema/bus-wire-junction.cpp
+6
-8
class_libentry_fields.h
eeschema/class_libentry_fields.h
+1
-1
class_pin.cpp
eeschema/class_pin.cpp
+2
-2
class_schematic_items.cpp
eeschema/class_schematic_items.cpp
+4
-16
class_schematic_items.h
eeschema/class_schematic_items.h
+285
-0
classes_body_items.cpp
eeschema/classes_body_items.cpp
+82
-77
classes_body_items.h
eeschema/classes_body_items.h
+61
-57
eelibs_draw_components.cpp
eeschema/eelibs_draw_components.cpp
+8
-12
eeredraw.cpp
eeschema/eeredraw.cpp
+89
-83
load_one_schematic_file.cpp
eeschema/load_one_schematic_file.cpp
+5
-7
locate.cpp
eeschema/locate.cpp
+46
-57
program.h
eeschema/program.h
+11
-258
protos.h
eeschema/protos.h
+2
-2
No files found.
CHANGELOG.txt
View file @
598cc337
...
@@ -10,6 +10,7 @@ email address.
...
@@ -10,6 +10,7 @@ email address.
++Eeschema:
++Eeschema:
Code cleaning.
Code cleaning.
LibDrawPolyline uses now std::vector<wxPoint> to handle corners.
LibDrawPolyline uses now std::vector<wxPoint> to handle corners.
DrawPolylineStruct uses now std::vector<wxPoint> to handle corners.
...
...
eeschema/block.cpp
View file @
598cc337
...
@@ -626,7 +626,7 @@ void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center )
...
@@ -626,7 +626,7 @@ void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center )
/* Given a structure rotate it to 90 degrees refer to the Center point.
/* Given a structure rotate it to 90 degrees refer to the Center point.
*/
*/
{
{
int
dx
,
ii
,
*
Points
;
int
dx
;
DrawPolylineStruct
*
DrawPoly
;
DrawPolylineStruct
*
DrawPoly
;
DrawJunctionStruct
*
DrawConnect
;
DrawJunctionStruct
*
DrawConnect
;
EDA_DrawLineStruct
*
DrawSegment
;
EDA_DrawLineStruct
*
DrawSegment
;
...
@@ -652,13 +652,12 @@ void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center )
...
@@ -652,13 +652,12 @@ void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center )
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_POLYLINE_STRUCT_TYPE
:
DrawPoly
=
(
DrawPolylineStruct
*
)
DrawStruct
;
DrawPoly
=
(
DrawPolylineStruct
*
)
DrawStruct
;
Points
=
DrawPoly
->
m_Points
;
for
(
unsigned
ii
=
0
;
ii
<
DrawPoly
->
GetCornerCount
();
ii
++
)
for
(
ii
=
0
;
ii
<
DrawPoly
->
m_NumOfPoints
;
ii
++
)
{
{
wxPoint
point
;
wxPoint
point
;
point
.
x
=
Points
[
ii
*
2
];
point
.
y
=
Points
[
ii
*
2
+
1
];
point
=
DrawPoly
->
m_PolyPoints
[
ii
];
MirrorYPoint
(
point
,
Center
);
MirrorYPoint
(
point
,
Center
);
Points
[
ii
*
2
]
=
point
.
x
;
Points
[
ii
*
2
+
1
]
=
point
.
y
;
DrawPoly
->
m_PolyPoints
[
ii
]
=
point
;
}
}
break
;
break
;
...
@@ -740,7 +739,7 @@ void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center )
...
@@ -740,7 +739,7 @@ void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center )
MirrorYPoint
(
DrawLibItem
->
m_Pos
,
Center
);
MirrorYPoint
(
DrawLibItem
->
m_Pos
,
Center
);
dx
-=
DrawLibItem
->
m_Pos
.
x
;
dx
-=
DrawLibItem
->
m_Pos
.
x
;
for
(
ii
=
0
;
ii
<
DrawLibItem
->
GetFieldCount
();
ii
++
)
for
(
i
nt
i
i
=
0
;
ii
<
DrawLibItem
->
GetFieldCount
();
ii
++
)
{
{
/* move the fields to the new position because the component itself has moved */
/* move the fields to the new position because the component itself has moved */
DrawLibItem
->
GetField
(
ii
)
->
m_Pos
.
x
-=
dx
;
DrawLibItem
->
GetField
(
ii
)
->
m_Pos
.
x
-=
dx
;
...
@@ -1194,7 +1193,6 @@ void MoveOneStruct( SCH_ITEM* DrawStruct, const wxPoint& move_vector )
...
@@ -1194,7 +1193,6 @@ void MoveOneStruct( SCH_ITEM* DrawStruct, const wxPoint& move_vector )
/* Given a structure move it by Dx, Dy.
/* Given a structure move it by Dx, Dy.
*/
*/
{
{
int
ii
,
*
Points
;
DrawPolylineStruct
*
DrawPoly
;
DrawPolylineStruct
*
DrawPoly
;
DrawJunctionStruct
*
DrawConnect
;
DrawJunctionStruct
*
DrawConnect
;
EDA_DrawLineStruct
*
DrawSegment
;
EDA_DrawLineStruct
*
DrawSegment
;
...
@@ -1215,11 +1213,9 @@ void MoveOneStruct( SCH_ITEM* DrawStruct, const wxPoint& move_vector )
...
@@ -1215,11 +1213,9 @@ void MoveOneStruct( SCH_ITEM* DrawStruct, const wxPoint& move_vector )
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_POLYLINE_STRUCT_TYPE
:
DrawPoly
=
(
DrawPolylineStruct
*
)
DrawStruct
;
DrawPoly
=
(
DrawPolylineStruct
*
)
DrawStruct
;
Points
=
DrawPoly
->
m_Points
;
for
(
unsigned
ii
=
0
;
ii
<
DrawPoly
->
GetCornerCount
();
ii
++
)
for
(
ii
=
0
;
ii
<
DrawPoly
->
m_NumOfPoints
;
ii
++
)
{
{
Points
[
ii
*
2
]
+=
move_vector
.
x
;
DrawPoly
->
m_PolyPoints
[
ii
]
+=
move_vector
;
Points
[
ii
*
2
+
1
]
+=
move_vector
.
y
;
}
}
break
;
break
;
...
@@ -1275,7 +1271,7 @@ void MoveOneStruct( SCH_ITEM* DrawStruct, const wxPoint& move_vector )
...
@@ -1275,7 +1271,7 @@ void MoveOneStruct( SCH_ITEM* DrawStruct, const wxPoint& move_vector )
case
TYPE_SCH_COMPONENT
:
case
TYPE_SCH_COMPONENT
:
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawStruct
;
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawStruct
;
DrawLibItem
->
m_Pos
+=
move_vector
;
DrawLibItem
->
m_Pos
+=
move_vector
;
for
(
ii
=
0
;
ii
<
DrawLibItem
->
GetFieldCount
();
ii
++
)
for
(
i
nt
i
i
=
0
;
ii
<
DrawLibItem
->
GetFieldCount
();
ii
++
)
{
{
DrawLibItem
->
GetField
(
ii
)
->
m_Pos
+=
move_vector
;
DrawLibItem
->
GetField
(
ii
)
->
m_Pos
+=
move_vector
;
}
}
...
...
eeschema/bus-wire-junction.cpp
View file @
598cc337
...
@@ -474,24 +474,22 @@ static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool eras
...
@@ -474,24 +474,22 @@ static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool eras
GRSetDrawMode
(
DC
,
g_XorMode
);
GRSetDrawMode
(
DC
,
g_XorMode
);
int
idx
=
NewPoly
->
GetCornerCount
()
-
1
;
if
(
g_HVLines
)
if
(
g_HVLines
)
{
{
/* Coerce the line to vertical or horizontal one: */
/* Coerce the line to vertical or horizontal one: */
if
(
ABS
(
endpos
.
x
-
NewPoly
->
m_Po
ints
[
NewPoly
->
m_NumOfPoints
*
2
-
2
]
)
<
if
(
ABS
(
endpos
.
x
-
NewPoly
->
m_Po
lyPoints
[
idx
].
x
)
<
ABS
(
endpos
.
y
-
NewPoly
->
m_Po
ints
[
NewPoly
->
m_NumOfPoints
*
2
-
1
]
)
)
ABS
(
endpos
.
y
-
NewPoly
->
m_Po
lyPoints
[
idx
].
y
)
)
endpos
.
x
=
NewPoly
->
m_Po
ints
[
NewPoly
->
m_NumOfPoints
*
2
-
2
]
;
endpos
.
x
=
NewPoly
->
m_Po
lyPoints
[
idx
].
x
;
else
else
endpos
.
y
=
NewPoly
->
m_Po
ints
[
NewPoly
->
m_NumOfPoints
*
2
-
1
]
;
endpos
.
y
=
NewPoly
->
m_Po
lyPoints
[
idx
].
y
;
}
}
NewPoly
->
m_NumOfPoints
++
;
if
(
erase
)
if
(
erase
)
RedrawOneStruct
(
panel
,
DC
,
NewPoly
,
g_XorMode
,
color
);
RedrawOneStruct
(
panel
,
DC
,
NewPoly
,
g_XorMode
,
color
);
NewPoly
->
m_Points
[
NewPoly
->
m_NumOfPoints
*
2
-
2
]
=
endpos
.
x
;
NewPoly
->
m_PolyPoints
[
idx
]
=
endpos
;
NewPoly
->
m_Points
[
NewPoly
->
m_NumOfPoints
*
2
-
1
]
=
endpos
.
y
;
RedrawOneStruct
(
panel
,
DC
,
NewPoly
,
g_XorMode
,
color
);
RedrawOneStruct
(
panel
,
DC
,
NewPoly
,
g_XorMode
,
color
);
NewPoly
->
m_NumOfPoints
--
;
}
}
...
...
eeschema/class_libentry_fields.h
View file @
598cc337
...
@@ -59,7 +59,7 @@ public:
...
@@ -59,7 +59,7 @@ public:
void
SetFields
(
const
std
::
vector
<
LibDrawField
>
aFields
);
void
SetFields
(
const
std
::
vector
<
LibDrawField
>
aFields
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
int
aDrawMode
,
void
*
aData
,
const
int
aTransformMatrix
[
2
][
2
]
);
/**
/**
* Function HitTest
* Function HitTest
...
...
eeschema/class_pin.cpp
View file @
598cc337
...
@@ -19,7 +19,7 @@ void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel,
...
@@ -19,7 +19,7 @@ void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel,
int
aColor
,
int
aColor
,
int
aDrawMode
,
int
aDrawMode
,
void
*
aData
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
)
const
int
aTransformMatrix
[
2
][
2
]
)
/**********************************************************************************************/
/**********************************************************************************************/
{
{
// Invisibles pins are only drawn on request.
// Invisibles pins are only drawn on request.
...
@@ -866,7 +866,7 @@ wxPoint LibDrawPin::ReturnPinEndPoint()
...
@@ -866,7 +866,7 @@ wxPoint LibDrawPin::ReturnPinEndPoint()
/********************************************************/
/********************************************************/
int
LibDrawPin
::
ReturnPinDrawOrient
(
int
TransMat
[
2
][
2
]
)
int
LibDrawPin
::
ReturnPinDrawOrient
(
const
int
TransMat
[
2
][
2
]
)
/********************************************************/
/********************************************************/
/** Function ReturnPinDrawOrient
/** Function ReturnPinDrawOrient
...
...
eeschema/class_schematic_items.cpp
View file @
598cc337
...
@@ -427,8 +427,6 @@ DrawPolylineStruct::DrawPolylineStruct( int layer ) :
...
@@ -427,8 +427,6 @@ DrawPolylineStruct::DrawPolylineStruct( int layer ) :
SCH_ITEM
(
NULL
,
DRAW_POLYLINE_STRUCT_TYPE
)
SCH_ITEM
(
NULL
,
DRAW_POLYLINE_STRUCT_TYPE
)
/***********************************************************/
/***********************************************************/
{
{
m_NumOfPoints
=
0
;
/* Number of XY pairs in Points array. */
m_Points
=
NULL
;
/* XY pairs that forms the polyline. */
m_Width
=
GR_NORM_WIDTH
;
m_Width
=
GR_NORM_WIDTH
;
switch
(
layer
)
switch
(
layer
)
...
@@ -454,8 +452,6 @@ DrawPolylineStruct::DrawPolylineStruct( int layer ) :
...
@@ -454,8 +452,6 @@ DrawPolylineStruct::DrawPolylineStruct( int layer ) :
DrawPolylineStruct
::~
DrawPolylineStruct
()
DrawPolylineStruct
::~
DrawPolylineStruct
()
/*********************************************/
/*********************************************/
{
{
if
(
m_Points
)
free
(
m_Points
);
}
}
...
@@ -463,16 +459,9 @@ DrawPolylineStruct::~DrawPolylineStruct()
...
@@ -463,16 +459,9 @@ DrawPolylineStruct::~DrawPolylineStruct()
DrawPolylineStruct
*
DrawPolylineStruct
::
GenCopy
()
DrawPolylineStruct
*
DrawPolylineStruct
::
GenCopy
()
/*****************************************************/
/*****************************************************/
{
{
int
memsize
;
DrawPolylineStruct
*
newitem
=
DrawPolylineStruct
*
newitem
=
new
DrawPolylineStruct
(
m_Layer
);
new
DrawPolylineStruct
(
m_Layer
);
newitem
->
m_PolyPoints
=
m_PolyPoints
;
// std::vector copy
memsize
=
sizeof
(
int
)
*
2
*
m_NumOfPoints
;
newitem
->
m_NumOfPoints
=
m_NumOfPoints
;
newitem
->
m_Points
=
(
int
*
)
MyZMalloc
(
memsize
);
memcpy
(
newitem
->
m_Points
,
m_Points
,
memsize
);
return
newitem
;
return
newitem
;
}
}
...
@@ -497,16 +486,15 @@ bool DrawPolylineStruct::Save( FILE* aFile ) const
...
@@ -497,16 +486,15 @@ bool DrawPolylineStruct::Save( FILE* aFile ) const
if
(
m_Width
!=
GR_NORM_WIDTH
)
if
(
m_Width
!=
GR_NORM_WIDTH
)
width
=
"Bus"
;
width
=
"Bus"
;
if
(
fprintf
(
aFile
,
"Poly %s %s %d
\n
"
,
if
(
fprintf
(
aFile
,
"Poly %s %s %d
\n
"
,
width
,
layer
,
m_NumOfPoints
)
==
EOF
)
width
,
layer
,
GetCornerCount
()
)
==
EOF
)
{
{
success
=
false
;
success
=
false
;
return
success
;
return
success
;
}
}
for
(
int
ii
=
0
;
ii
<
m_NumOfPoints
;
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
GetCornerCount
()
;
ii
++
)
{
{
if
(
fprintf
(
aFile
,
"
\t
%-4d %-4d
\n
"
,
if
(
fprintf
(
aFile
,
"
\t
%-4d %-4d
\n
"
,
m_Points
[
ii
*
2
],
m_PolyPoints
[
ii
].
x
,
m_PolyPoints
[
ii
].
y
)
==
EOF
)
m_Points
[
ii
*
2
+
1
]
)
==
EOF
)
{
{
success
=
false
;
success
=
false
;
break
;
break
;
...
...
eeschema/class_schematic_items.h
0 → 100644
View file @
598cc337
/************************************************************************/
/* classes to handle items used in schematic: wires, bus, junctions ... */
/************************************************************************/
#ifndef CLASS_SCHEMATIC_ITEMS_H
#define CLASS_SCHEMATIC_ITEMS_H
#ifndef eda_global
#define eda_global extern
#endif
#define DRAWJUNCTION_SIZE 16
/* Rayon du symbole connexion */
#define DRAWMARKER_SIZE 16
/* Rayon du symbole marqueur */
#define DRAWNOCONNECT_SIZE 48
/* Rayon du symbole No Connexion */
/* flags pour BUS ENTRY (bus to bus ou wire to bus */
#define WIRE_TO_BUS 0
#define BUS_TO_BUS 1
enum
TypeMarker
{
/* Type des Marqueurs */
MARQ_UNSPEC
,
MARQ_ERC
,
MARQ_PCB
,
MARQ_SIMUL
,
MARQ_NMAX
/* Derniere valeur: fin de tableau */
};
/* Messages correspondants aux types des marqueurs */
#ifdef MAIN
const
wxChar
*
NameMarqueurType
[]
=
{
wxT
(
""
),
wxT
(
"ERC"
),
wxT
(
"PCB"
),
wxT
(
"SIMUL"
),
wxT
(
"?????"
)
};
#else
extern
const
wxChar
*
NameMarqueurType
[];
#endif
/**
* Class EDA_DrawLineStruct
* is a segment decription base class to describe items which have 2 end
* points (track, wire, draw line ...)
*/
class
EDA_DrawLineStruct
:
public
SCH_ITEM
{
public
:
int
m_Width
;
// 0 = line, > 0 = tracks, bus ...
wxPoint
m_Start
;
// Line start point
wxPoint
m_End
;
// Line end point
bool
m_StartIsDangling
;
bool
m_EndIsDangling
;
// TRUE si Start ou End not connected (wires, tracks...)
public
:
EDA_DrawLineStruct
(
const
wxPoint
&
pos
,
int
layer
);
~
EDA_DrawLineStruct
()
{
}
EDA_DrawLineStruct
*
Next
()
const
{
return
(
EDA_DrawLineStruct
*
)
Pnext
;
}
EDA_DrawLineStruct
*
Back
()
const
{
return
(
EDA_DrawLineStruct
*
)
Pback
;
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"EDA_DrawLine"
);
}
bool
IsOneEndPointAt
(
const
wxPoint
&
pos
);
EDA_DrawLineStruct
*
GenCopy
();
bool
IsNull
()
{
return
m_Start
==
m_End
;
}
EDA_Rect
GetBoundingBox
();
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
Save
(
FILE
*
aFile
)
const
;
#if defined(DEBUG)
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
};
class
DrawMarkerStruct
:
public
SCH_ITEM
/* marqueurs */
{
public
:
wxPoint
m_Pos
;
/* XY coordinates of marker. */
TypeMarker
m_Type
;
int
m_MarkFlags
;
// complements d'information
wxString
m_Comment
;
/* Texte (commentaireassocie eventuel */
public
:
DrawMarkerStruct
(
const
wxPoint
&
pos
,
const
wxString
&
text
);
~
DrawMarkerStruct
();
virtual
wxString
GetClass
()
const
{
return
wxT
(
"DrawMarker"
);
}
DrawMarkerStruct
*
GenCopy
();
wxString
GetComment
();
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
Save
(
FILE
*
aFile
)
const
;
#if defined(DEBUG)
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
};
class
DrawNoConnectStruct
:
public
SCH_ITEM
/* Symboles de non connexion */
{
public
:
wxPoint
m_Pos
;
/* XY coordinates of NoConnect. */
public
:
DrawNoConnectStruct
(
const
wxPoint
&
pos
);
~
DrawNoConnectStruct
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"DrawNoConnect"
);
}
DrawNoConnectStruct
*
GenCopy
();
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
Save
(
FILE
*
aFile
)
const
;
EDA_Rect
GetBoundingBox
();
};
/**
* Class DrawBusEntryStruct
* Struct de descr 1 raccord a 45 degres de BUS ou WIRE
*/
class
DrawBusEntryStruct
:
public
SCH_ITEM
{
public
:
int
m_Width
;
wxPoint
m_Pos
;
wxSize
m_Size
;
public
:
DrawBusEntryStruct
(
const
wxPoint
&
pos
,
int
shape
,
int
id
);
~
DrawBusEntryStruct
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"DrawBusEntry"
);
}
DrawBusEntryStruct
*
GenCopy
();
wxPoint
m_End
()
const
;
// retourne la coord de fin du raccord
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
Save
(
FILE
*
aFile
)
const
;
EDA_Rect
GetBoundingBox
();
};
class
DrawPolylineStruct
:
public
SCH_ITEM
/* Polyligne (serie de segments) */
{
public
:
int
m_Width
;
/* Tickness */
std
::
vector
<
wxPoint
>
m_PolyPoints
;
// list of points (>= 2)
public
:
DrawPolylineStruct
(
int
layer
);
~
DrawPolylineStruct
();
virtual
wxString
GetClass
()
const
{
return
wxT
(
"DrawPolyline"
);
}
DrawPolylineStruct
*
GenCopy
();
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
Save
(
FILE
*
aFile
)
const
;
/** Function AddPoint
* add a corner to m_PolyPoints
*/
void
AddPoint
(
const
wxPoint
&
point
)
{
m_PolyPoints
.
push_back
(
point
);
}
/** Function GetCornerCount
* @return the number of corners
*/
unsigned
GetCornerCount
()
const
{
return
m_PolyPoints
.
size
();
}
};
class
DrawJunctionStruct
:
public
SCH_ITEM
{
public
:
wxPoint
m_Pos
;
/* XY coordinates of connection. */
public
:
DrawJunctionStruct
(
const
wxPoint
&
pos
);
~
DrawJunctionStruct
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"DrawJunction"
);
}
EDA_Rect
GetBoundingBox
();
DrawJunctionStruct
*
GenCopy
();
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
Save
(
FILE
*
aFile
)
const
;
#if defined(DEBUG)
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
};
#endif
/* CLASS_SCHEMATIC_ITEMS_H */
eeschema/classes_body_items.cpp
View file @
598cc337
This diff is collapsed.
Click to expand it.
eeschema/classes_body_items.h
View file @
598cc337
This diff is collapsed.
Click to expand it.
eeschema/eelibs_draw_components.cpp
View file @
598cc337
...
@@ -34,7 +34,7 @@ static void DrawLibPartAux( WinEDA_DrawPanel * panel, wxDC * DC,
...
@@ -34,7 +34,7 @@ static void DrawLibPartAux( WinEDA_DrawPanel * panel, wxDC * DC,
SCH_COMPONENT
*
Component
,
SCH_COMPONENT
*
Component
,
EDA_LibComponentStruct
*
Entry
,
EDA_LibComponentStruct
*
Entry
,
const
wxPoint
&
Pos
,
const
wxPoint
&
Pos
,
int
TransMat
[
2
][
2
],
const
int
TransMat
[
2
][
2
],
int
Multi
,
int
convert
,
int
Multi
,
int
convert
,
int
DrawMode
,
int
Color
=
-
1
,
bool
DrawPinText
=
TRUE
);
int
DrawMode
,
int
Color
=
-
1
,
bool
DrawPinText
=
TRUE
);
...
@@ -42,7 +42,7 @@ static void DrawLibPartAux( WinEDA_DrawPanel * panel, wxDC * DC,
...
@@ -42,7 +42,7 @@ static void DrawLibPartAux( WinEDA_DrawPanel * panel, wxDC * DC,
static
EDA_LibComponentStruct
*
DummyCmp
;
static
EDA_LibComponentStruct
*
DummyCmp
;
/***************************************************************************/
/***************************************************************************/
wxPoint
TransformCoordinate
(
int
aTransformMatrix
[
2
][
2
],
wxPoint
&
aPosition
)
wxPoint
TransformCoordinate
(
const
int
aTransformMatrix
[
2
][
2
],
const
wxPoint
&
aPosition
)
/***************************************************************************/
/***************************************************************************/
/** Function TransformCoordinate
/** Function TransformCoordinate
...
@@ -102,17 +102,13 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -102,17 +102,13 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
*/
*/
{
{
int
color
;
int
color
;
int
TransMat
[
2
][
2
];
wxString
Prefix
;
wxString
Prefix
;
LibDrawField
*
Field
;
LibDrawField
*
Field
;
wxPoint
text_pos
;
wxPoint
text_pos
;
/* Orientation normale */
TransMat
[
0
][
0
]
=
1
;
TransMat
[
1
][
1
]
=
-
1
;
TransMat
[
1
][
0
]
=
TransMat
[
0
][
1
]
=
0
;
DrawLibPartAux
(
panel
,
DC
,
NULL
,
LibEntry
,
aOffset
,
DrawLibPartAux
(
panel
,
DC
,
NULL
,
LibEntry
,
aOffset
,
TransMat
,
Multi
,
DefaultTransformMatrix
,
Multi
,
convert
,
DrawMode
,
Color
);
convert
,
DrawMode
,
Color
);
/* Trace des 2 champs ref et value (Attention aux coord: la matrice
/* Trace des 2 champs ref et value (Attention aux coord: la matrice
...
@@ -139,7 +135,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -139,7 +135,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
Prefix
=
LibEntry
->
m_Prefix
.
m_Text
+
wxT
(
"?"
);
Prefix
=
LibEntry
->
m_Prefix
.
m_Text
+
wxT
(
"?"
);
if
(
(
LibEntry
->
m_Prefix
.
m_Flags
&
IS_MOVED
)
==
0
)
if
(
(
LibEntry
->
m_Prefix
.
m_Flags
&
IS_MOVED
)
==
0
)
LibEntry
->
m_Prefix
.
Draw
(
panel
,
DC
,
aOffset
,
color
,
DrawMode
,
&
Prefix
,
TransMat
);
LibEntry
->
m_Prefix
.
Draw
(
panel
,
DC
,
aOffset
,
color
,
DrawMode
,
&
Prefix
,
DefaultTransformMatrix
);
if
(
LibEntry
->
m_Name
.
m_Attributs
&
TEXT_NO_VISIBLE
)
if
(
LibEntry
->
m_Name
.
m_Attributs
&
TEXT_NO_VISIBLE
)
{
{
...
@@ -151,7 +147,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -151,7 +147,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
else
color
=
Color
;
else
color
=
Color
;
if
(
(
LibEntry
->
m_Name
.
m_Flags
&
IS_MOVED
)
==
0
)
if
(
(
LibEntry
->
m_Name
.
m_Flags
&
IS_MOVED
)
==
0
)
LibEntry
->
m_Name
.
Draw
(
panel
,
DC
,
aOffset
,
color
,
DrawMode
,
NULL
,
TransMat
);
LibEntry
->
m_Name
.
Draw
(
panel
,
DC
,
aOffset
,
color
,
DrawMode
,
NULL
,
DefaultTransformMatrix
);
for
(
Field
=
LibEntry
->
m_Fields
;
Field
!=
NULL
;
Field
=
Field
->
Next
()
)
for
(
Field
=
LibEntry
->
m_Fields
;
Field
!=
NULL
;
Field
=
Field
->
Next
()
)
{
{
...
@@ -167,7 +163,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -167,7 +163,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
color
=
g_InvisibleItemColor
;
color
=
g_InvisibleItemColor
;
}
}
else
color
=
Color
;
else
color
=
Color
;
Field
->
Draw
(
panel
,
DC
,
aOffset
,
color
,
DrawMode
,
NULL
,
TransMat
);
Field
->
Draw
(
panel
,
DC
,
aOffset
,
color
,
DrawMode
,
NULL
,
DefaultTransformMatrix
);
}
}
// Trace de l'ancre
// Trace de l'ancre
...
@@ -446,7 +442,7 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -446,7 +442,7 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
SCH_COMPONENT
*
Component
,
SCH_COMPONENT
*
Component
,
EDA_LibComponentStruct
*
Entry
,
EDA_LibComponentStruct
*
Entry
,
const
wxPoint
&
Pos
,
const
wxPoint
&
Pos
,
int
TransMat
[
2
][
2
],
const
int
TransMat
[
2
][
2
],
int
Multi
,
int
convert
,
int
DrawMode
,
int
Multi
,
int
convert
,
int
DrawMode
,
int
Color
,
bool
DrawPinText
)
int
Color
,
bool
DrawPinText
)
{
{
...
@@ -534,7 +530,7 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -534,7 +530,7 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
* transform (only mirror and rotate so it remains on the unit circle) to *
* transform (only mirror and rotate so it remains on the unit circle) to *
* a new point which is used to detect new angle. *
* a new point which is used to detect new angle. *
*****************************************************************************/
*****************************************************************************/
bool
MapAngles
(
int
*
Angle1
,
int
*
Angle2
,
int
TransMat
[
2
][
2
]
)
bool
MapAngles
(
int
*
Angle1
,
int
*
Angle2
,
const
int
TransMat
[
2
][
2
]
)
{
{
int
Angle
,
Delta
;
int
Angle
,
Delta
;
double
x
,
y
,
t
;
double
x
,
y
,
t
;
...
...
eeschema/eeredraw.cpp
View file @
598cc337
This diff is collapsed.
Click to expand it.
eeschema/load_one_schematic_file.cpp
View file @
598cc337
...
@@ -249,16 +249,12 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -249,16 +249,12 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
layer
=
LAYER_BUS
;
layer
=
LAYER_BUS
;
PolylineStruct
=
new
DrawPolylineStruct
(
layer
);
PolylineStruct
=
new
DrawPolylineStruct
(
layer
);
for
(
unsigned
jj
=
0
;
jj
<
(
unsigned
)
ii
;
jj
++
)
PolylineStruct
->
m_NumOfPoints
=
ii
;
PolylineStruct
->
m_Points
=
(
int
*
)
MyZMalloc
(
sizeof
(
int
)
*
2
*
PolylineStruct
->
m_NumOfPoints
);
for
(
ii
=
0
;
ii
<
PolylineStruct
->
m_NumOfPoints
;
ii
++
)
{
{
LineCount
++
;
LineCount
++
;
wxPoint
point
;
if
(
fgets
(
Line
,
256
-
1
,
f
)
==
NULL
if
(
fgets
(
Line
,
256
-
1
,
f
)
==
NULL
||
sscanf
(
Line
,
"%d %d"
,
&
PolylineStruct
->
m_Points
[
ii
*
2
],
||
sscanf
(
Line
,
"%d %d"
,
&
point
.
x
,
&
point
.
y
)
!=
2
)
&
PolylineStruct
->
m_Points
[
ii
*
2
+
1
]
)
!=
2
)
{
{
MsgDiag
.
Printf
(
MsgDiag
.
Printf
(
wxT
(
"EESchema file polyline struct error at line %d, aborted"
),
wxT
(
"EESchema file polyline struct error at line %d, aborted"
),
...
@@ -268,6 +264,8 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -268,6 +264,8 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
SAFE_DELETE
(
PolylineStruct
);
SAFE_DELETE
(
PolylineStruct
);
break
;
break
;
}
}
PolylineStruct
->
AddPoint
(
point
);
}
}
if
(
!
Failed
)
if
(
!
Failed
)
...
...
eeschema/locate.cpp
View file @
598cc337
...
@@ -24,8 +24,7 @@ static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
...
@@ -24,8 +24,7 @@ static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
int
StartX2
,
int
StartY2
,
int
EndX2
,
int
EndY2
);
int
StartX2
,
int
StartY2
,
int
EndX2
,
int
EndY2
);
static
bool
IsPointInBox
(
wxPoint
aPosRef
,
static
bool
IsPointInBox
(
wxPoint
aPosRef
,
int
BoxX1
,
int
BoxY1
,
int
BoxX2
,
int
BoxY2
);
int
BoxX1
,
int
BoxY1
,
int
BoxX2
,
int
BoxY2
);
static
bool
IsPointOnSegment
(
wxPoint
aPosRef
,
static
bool
IsPointOnSegment
(
wxPoint
aPosRef
,
wxPoint
aSegmStart
,
wxPoint
aSegmEnd
,
int
aDist
=
0
);
int
SegmX1
,
int
SegmY1
,
int
SegmX2
,
int
SegmY2
,
int
seuil
=
0
);
static
bool
SnapPoint2
(
const
wxPoint
&
aPosRef
,
int
SearchMask
,
static
bool
SnapPoint2
(
const
wxPoint
&
aPosRef
,
int
SearchMask
,
SCH_ITEM
*
DrawList
,
DrawPickedStruct
*
DontSnapList
,
int
zoom_value
);
SCH_ITEM
*
DrawList
,
DrawPickedStruct
*
DontSnapList
,
int
zoom_value
);
...
@@ -198,8 +197,7 @@ SCH_ITEM* PickStruct( EDA_Rect& block, BASE_SCREEN* screen, int SearchMask )
...
@@ -198,8 +197,7 @@ SCH_ITEM* PickStruct( EDA_Rect& block, BASE_SCREEN* screen, int SearchMask )
bool
SnapPoint2
(
const
wxPoint
&
aPosRef
,
int
SearchMask
,
bool
SnapPoint2
(
const
wxPoint
&
aPosRef
,
int
SearchMask
,
SCH_ITEM
*
DrawList
,
DrawPickedStruct
*
DontSnapList
,
int
zoom_value
)
SCH_ITEM
*
DrawList
,
DrawPickedStruct
*
DontSnapList
,
int
zoom_value
)
{
{
int
i
,
*
Points
;
int
x1
,
y1
,
x2
,
y2
;
int
x1
,
y1
,
x2
,
y2
,
NumOfPoints2
;
DrawPickedStruct
*
DontSnap
;
DrawPickedStruct
*
DontSnap
;
int
dx
,
dy
;
int
dx
,
dy
;
...
@@ -223,13 +221,9 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
...
@@ -223,13 +221,9 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
if
(
!
(
SearchMask
&
(
DRAWITEM
|
WIREITEM
|
BUSITEM
)
)
)
if
(
!
(
SearchMask
&
(
DRAWITEM
|
WIREITEM
|
BUSITEM
)
)
)
break
;
break
;
Points
=
STRUCT
->
m_Points
;
for
(
unsigned
i
=
0
;
i
<
STRUCT
->
GetCornerCount
()
-
1
;
i
++
)
NumOfPoints2
=
STRUCT
->
m_NumOfPoints
*
2
;
for
(
i
=
0
;
i
<
NumOfPoints2
-
2
;
i
+=
2
)
{
{
x1
=
Points
[
i
];
y1
=
Points
[
i
+
1
];
if
(
IsPointOnSegment
(
aPosRef
,
STRUCT
->
m_PolyPoints
[
i
],
STRUCT
->
m_PolyPoints
[
i
+
1
]
)
)
x2
=
Points
[
i
+
2
];
y2
=
Points
[
i
+
3
];
if
(
IsPointOnSegment
(
aPosRef
,
x1
,
y1
,
x2
,
y2
)
)
{
{
LastSnappedStruct
=
DrawList
;
LastSnappedStruct
=
DrawList
;
return
TRUE
;
return
TRUE
;
...
@@ -244,8 +238,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
...
@@ -244,8 +238,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
if
(
!
(
SearchMask
&
(
DRAWITEM
|
WIREITEM
|
BUSITEM
)
)
)
if
(
!
(
SearchMask
&
(
DRAWITEM
|
WIREITEM
|
BUSITEM
)
)
)
break
;
break
;
if
(
IsPointOnSegment
(
aPosRef
,
STRUCT
->
m_Start
.
x
,
STRUCT
->
m_Start
.
y
,
if
(
IsPointOnSegment
(
aPosRef
,
STRUCT
->
m_Start
,
STRUCT
->
m_End
)
)
STRUCT
->
m_End
.
x
,
STRUCT
->
m_End
.
y
)
)
{
{
if
(
(
(
SearchMask
&
DRAWITEM
)
&&
(
STRUCT
->
GetLayer
()
==
LAYER_NOTES
)
)
if
(
(
(
SearchMask
&
DRAWITEM
)
&&
(
STRUCT
->
GetLayer
()
==
LAYER_NOTES
)
)
||
(
(
SearchMask
&
WIREITEM
)
&&
(
STRUCT
->
GetLayer
()
==
LAYER_WIRE
)
)
||
(
(
SearchMask
&
WIREITEM
)
&&
(
STRUCT
->
GetLayer
()
==
LAYER_WIRE
)
)
...
@@ -277,8 +270,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
...
@@ -277,8 +270,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
if
(
!
(
SearchMask
&
(
RACCORDITEM
)
)
)
if
(
!
(
SearchMask
&
(
RACCORDITEM
)
)
)
break
;
break
;
if
(
IsPointOnSegment
(
aPosRef
,
STRUCT
->
m_Pos
.
x
,
STRUCT
->
m_Pos
.
y
,
if
(
IsPointOnSegment
(
aPosRef
,
STRUCT
->
m_Pos
,
STRUCT
->
m_End
()
)
)
STRUCT
->
m_End
().
x
,
STRUCT
->
m_End
().
y
)
)
{
{
LastSnappedStruct
=
DrawList
;
LastSnappedStruct
=
DrawList
;
return
TRUE
;
return
TRUE
;
...
@@ -419,7 +411,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
...
@@ -419,7 +411,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
if
(
SearchMask
&
FIELDCMPITEM
)
if
(
SearchMask
&
FIELDCMPITEM
)
{
{
SCH_COMPONENT
*
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
SCH_COMPONENT
*
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
for
(
i
=
REFERENCE
;
i
<
DrawLibItem
->
GetFieldCount
();
i
++
)
for
(
i
nt
i
=
REFERENCE
;
i
<
DrawLibItem
->
GetFieldCount
();
i
++
)
{
{
SCH_CMP_FIELD
*
field
=
DrawLibItem
->
GetField
(
i
);
SCH_CMP_FIELD
*
field
=
DrawLibItem
->
GetField
(
i
);
...
@@ -491,10 +483,9 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
...
@@ -491,10 +483,9 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
* defined by x1/y1 and x2/y2 (x1 < x2, y1 < y2), and return TRUE if so. This *
* defined by x1/y1 and x2/y2 (x1 < x2, y1 < y2), and return TRUE if so. This *
* routine is used to pick all points in a given box. *
* routine is used to pick all points in a given box. *
*****************************************************************************/
*****************************************************************************/
bool
DrawStructInBox
(
int
x1
,
int
y1
,
int
x2
,
int
y2
,
bool
DrawStructInBox
(
int
x1
,
int
y1
,
int
x2
,
int
y2
,
SCH_ITEM
*
DrawStruct
)
SCH_ITEM
*
DrawStruct
)
{
{
int
i
,
*
Points
,
xt1
,
yt1
,
xt2
,
yt2
,
NumOfPoints
2
;
int
xt1
,
yt1
,
xt2
,
yt
2
;
int
dx
,
dy
;
int
dx
,
dy
;
wxString
msg
;
wxString
msg
;
...
@@ -503,12 +494,10 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2,
...
@@ -503,12 +494,10 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2,
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_POLYLINE_STRUCT_TYPE
:
#undef STRUCT
#undef STRUCT
#define STRUCT ( (DrawPolylineStruct*) DrawStruct )
#define STRUCT ( (DrawPolylineStruct*) DrawStruct )
Points
=
STRUCT
->
m_Points
;
for
(
unsigned
i
=
0
;
i
<
STRUCT
->
GetCornerCount
();
i
++
)
NumOfPoints2
=
STRUCT
->
m_NumOfPoints
*
2
;
for
(
i
=
0
;
i
<
NumOfPoints2
;
i
+=
2
)
{
{
if
(
Points
[
i
]
>=
x1
&&
Points
[
i
]
<=
x2
if
(
STRUCT
->
m_PolyPoints
[
i
].
x
>=
x1
&&
STRUCT
->
m_PolyPoints
[
i
].
x
<=
x2
&&
Points
[
i
+
1
]
>=
y1
&&
Points
[
i
+
1
]
<=
y2
)
&&
STRUCT
->
m_PolyPoints
[
i
].
y
>=
y1
&&
STRUCT
->
m_PolyPoints
[
i
].
y
<=
y2
)
return
TRUE
;
return
TRUE
;
}
}
...
@@ -759,19 +748,18 @@ static bool IsPointInBox( wxPoint aPosRef,
...
@@ -759,19 +748,18 @@ static bool IsPointInBox( wxPoint aPosRef,
/********************************************************************************/
/********************************************************************************/
static
bool
IsPointOnSegment
(
wxPoint
aPosRef
,
static
bool
IsPointOnSegment
(
wxPoint
aPosRef
,
wxPoint
aSegmStart
,
wxPoint
aSegmEnd
,
int
aDist
)
int
SegmX1
,
int
SegmY1
,
int
SegmX2
,
int
SegmY2
,
int
seuil
)
/********************************************************************************/
/********************************************************************************/
/* Routine detectant que le point pX,pY est sur le Segment X1,Y1 a X2,Y2
/* Routine detectant que le point pX,pY est sur le Segment X1,Y1 a X2,Y2
* Retourne TRUE ou FALSE.
* Retourne TRUE ou FALSE.
*/
*/
{
{
/*
Recalcul des coord avec SegmX1, SegmX2 comme origine
*/
/*
Move coordinates origin to aSegmStart
*/
aPosRef
.
x
-=
SegmX1
;
aPosRef
.
y
-=
SegmY1
;
aPosRef
-=
aSegmStart
;
SegmX2
-=
SegmX1
;
SegmY2
-=
SegmY1
;
aSegmEnd
-=
aSegmStart
;
if
(
distance
(
SegmX2
,
SegmY2
,
aPosRef
.
x
,
aPosRef
.
y
,
seuil
)
)
if
(
distance
(
aSegmEnd
.
x
,
aSegmEnd
.
y
,
aPosRef
.
x
,
aPosRef
.
y
,
aDist
)
)
return
TRUE
;
return
TRUE
;
else
else
...
@@ -788,10 +776,10 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
...
@@ -788,10 +776,10 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
int
masque
)
int
masque
)
/*********************************************************************************/
/*********************************************************************************/
/*
Routine de localisation d'un element de dessin de symbole( sauf
pins )
/*
Locates a body item( not
pins )
* Unit =
Unite d'appartenance (si Unit = 0, recherche sur toutes unites
)
* Unit =
part number (if Unit = 0, all parts are considered
)
* Convert =
Conversion d'appartenance (si Convert = 0, recherche sur
* Convert =
convert value for shape (si Convert = 0, all shapes are considered)
*
toutes variantes)
*
remember the Y axis is from bottom to top in library entries for graphic items.
*/
*/
{
{
int
dx
,
dy
;
int
dx
,
dy
;
...
@@ -847,25 +835,32 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
...
@@ -847,25 +835,32 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
break
;
break
;
case
COMPONENT_RECT_DRAW_TYPE
:
case
COMPONENT_RECT_DRAW_TYPE
:
{
// Locate a rect if the mouse cursor is on a s
egment
{
// Locate a rect if the mouse cursor is on a s
ide of this rectangle
LibDrawSquare
*
Square
=
(
LibDrawSquare
*
)
DrawItem
;
LibDrawSquare
*
Square
=
(
LibDrawSquare
*
)
DrawItem
;
if
(
(
masque
&
LOCATE_COMPONENT_RECT_DRAW_TYPE
)
==
0
)
if
(
(
masque
&
LOCATE_COMPONENT_RECT_DRAW_TYPE
)
==
0
)
break
;
break
;
if
(
IsPointOnSegment
(
aRefPoint
,
// locate lower segment
wxPoint
start
,
end
;
Square
->
m_Pos
.
x
,
-
Square
->
m_Pos
.
y
,
start
.
x
=
Square
->
m_Pos
.
x
;
Square
->
m_End
.
x
,
-
Square
->
m_Pos
.
y
,
seuil
)
)
start
.
y
=
-
Square
->
m_Pos
.
y
;
end
.
x
=
Square
->
m_End
.
x
;
end
.
y
=
-
Square
->
m_Pos
.
y
;
// locate lower segment
if
(
IsPointOnSegment
(
aRefPoint
,
start
,
end
,
seuil
)
)
return
DrawItem
;
return
DrawItem
;
if
(
IsPointOnSegment
(
aRefPoint
,
// locate right segment
// locate right segment
Square
->
m_End
.
x
,
-
Square
->
m_Pos
.
y
,
start
.
x
=
Square
->
m_End
.
x
;
Square
->
m_End
.
x
,
-
Square
->
m_End
.
y
,
seuil
)
)
end
.
y
=
-
Square
->
m_End
.
y
;
if
(
IsPointOnSegment
(
aRefPoint
,
start
,
end
,
seuil
)
)
return
DrawItem
;
return
DrawItem
;
if
(
IsPointOnSegment
(
aRefPoint
,
// locate upper segment
// locate upper segment
Square
->
m_End
.
x
,
-
Square
->
m_End
.
y
,
start
.
y
=
-
Square
->
m_End
.
y
;
Square
->
m_Pos
.
x
,
-
Square
->
m_End
.
y
,
seuil
)
)
end
.
x
=
Square
->
m_Pos
.
x
;
if
(
IsPointOnSegment
(
aRefPoint
,
start
,
end
,
seuil
)
)
return
DrawItem
;
return
DrawItem
;
if
(
IsPointOnSegment
(
aRefPoint
,
// locate left segment
// locate left segment
Square
->
m_Pos
.
x
,
-
Square
->
m_End
.
y
,
start
.
x
=
Square
->
m_Pos
.
x
;
Square
->
m_Pos
.
x
,
-
Square
->
m_Pos
.
y
,
seuil
)
)
end
.
x
=
-
Square
->
m_Pos
.
y
;
if
(
IsPointOnSegment
(
aRefPoint
,
start
,
end
,
seuil
)
)
return
DrawItem
;
return
DrawItem
;
}
}
break
;
break
;
...
@@ -875,15 +870,9 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
...
@@ -875,15 +870,9 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DrawItem
;
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DrawItem
;
if
(
(
masque
&
LOCATE_COMPONENT_POLYLINE_DRAW_TYPE
)
==
0
)
if
(
(
masque
&
LOCATE_COMPONENT_POLYLINE_DRAW_TYPE
)
==
0
)
break
;
break
;
if
(
polyline
->
HitTest
(
aRefPoint
,
seuil
,
DefaultTransformMatrix
)
)
for
(
unsigned
ii
=
0
;
ii
<
polyline
->
m_PolyPoints
.
size
()
-
1
;
ii
++
)
{
if
(
IsPointOnSegment
(
aRefPoint
,
polyline
->
m_PolyPoints
[
ii
].
x
,
-
polyline
->
m_PolyPoints
[
ii
].
y
,
polyline
->
m_PolyPoints
[
ii
+
1
].
x
,
-
polyline
->
m_PolyPoints
[
ii
+
1
].
y
,
seuil
)
)
return
DrawItem
;
return
DrawItem
;
}
}
}
break
;
break
;
case
COMPONENT_LINE_DRAW_TYPE
:
case
COMPONENT_LINE_DRAW_TYPE
:
...
@@ -891,9 +880,9 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
...
@@ -891,9 +880,9 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
LibDrawSegment
*
Segment
=
(
LibDrawSegment
*
)
DrawItem
;
LibDrawSegment
*
Segment
=
(
LibDrawSegment
*
)
DrawItem
;
if
(
(
masque
&
LOCATE_COMPONENT_LINE_DRAW_TYPE
)
==
0
)
if
(
(
masque
&
LOCATE_COMPONENT_LINE_DRAW_TYPE
)
==
0
)
break
;
break
;
if
(
IsPointOnSegment
(
aRefPoint
,
wxPoint
ref
=
aRefPoint
;
Segment
->
m_Pos
.
x
,
-
Segment
->
m_Pos
.
y
,
NEGATE
(
ref
.
y
);
Segment
->
m_End
.
x
,
-
Segment
->
m_End
.
y
,
seuil
)
)
if
(
IsPointOnSegment
(
ref
,
Segment
->
m_Pos
,
Segment
->
m_End
,
seuil
)
)
return
DrawItem
;
return
DrawItem
;
}
}
break
;
break
;
...
...
eeschema/program.h
View file @
598cc337
...
@@ -18,271 +18,24 @@
...
@@ -18,271 +18,24 @@
#include "class_screen.h"
#include "class_screen.h"
#include "class_drawsheet.h"
#include "class_drawsheet.h"
#include "class_text-label.h"
#include "class_text-label.h"
#include "class_schematic_items.h"
#define DRAWJUNCTION_SIZE 16
/* Rayon du symbole connexion */
#define DRAWMARKER_SIZE 16
/* Rayon du symbole marqueur */
#define DRAWNOCONNECT_SIZE 48
/* Rayon du symbole No Connexion */
#define HIGHLIGHT_COLOR WHITE
#define HIGHLIGHT_COLOR WHITE
#define TEXT_NO_VISIBLE 1
#define TEXT_NO_VISIBLE 1
/* flags pour BUS ENTRY (bus to bus ou wire to bus */
/* Rotation, mirror of graphic items in components bodies are handled by a transform matrix
#define WIRE_TO_BUS 0
* The default matix is useful to draw lib entries with a defualt matix ( no rotation, no mirrot
#define BUS_TO_BUS 1
* but Y axis is bottom to top, and Y draw axis is to to bottom
* so we must have a default matix that reverses the Y coordinate and keeps the X coordiante
* DefaultTransformMatrix[0][0] = 1; DefaultTransformMatrix[1][1] = -1;
enum
TypeMarker
{
/* Type des Marqueurs */
* DefaultTransformMatrix[1][0] = DefaultTransformMatrix[0][1] = 0;
MARQ_UNSPEC
,
MARQ_ERC
,
MARQ_PCB
,
MARQ_SIMUL
,
MARQ_NMAX
/* Derniere valeur: fin de tableau */
};
/* Messages correspondants aux types des marqueurs */
#ifdef MAIN
const
wxChar
*
NameMarqueurType
[]
=
{
wxT
(
""
),
wxT
(
"ERC"
),
wxT
(
"PCB"
),
wxT
(
"SIMUL"
),
wxT
(
"?????"
)
};
#else
extern
const
wxChar
*
NameMarqueurType
[];
#endif
/* Forward declarations */
class
DrawSheetStruct
;
/**
* Class EDA_DrawLineStruct
* is a segment decription base class to describe items which have 2 end
* points (track, wire, draw line ...)
*/
*/
class
EDA_DrawLineStruct
:
public
SCH_ITEM
eda_global
int
DefaultTransformMatrix
[
2
][
2
]
{
#ifdef MAIN
public
:
=
{
{
1
,
0
},
{
0
,
-
1
}
}
int
m_Width
;
// 0 = line, > 0 = tracks, bus ...
wxPoint
m_Start
;
// Line start point
wxPoint
m_End
;
// Line end point
bool
m_StartIsDangling
;
bool
m_EndIsDangling
;
// TRUE si Start ou End not connected (wires, tracks...)
public
:
EDA_DrawLineStruct
(
const
wxPoint
&
pos
,
int
layer
);
~
EDA_DrawLineStruct
()
{
}
EDA_DrawLineStruct
*
Next
()
const
{
return
(
EDA_DrawLineStruct
*
)
Pnext
;
}
EDA_DrawLineStruct
*
Back
()
const
{
return
(
EDA_DrawLineStruct
*
)
Pback
;
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"EDA_DrawLine"
);
}
bool
IsOneEndPointAt
(
const
wxPoint
&
pos
);
EDA_DrawLineStruct
*
GenCopy
();
bool
IsNull
()
{
return
m_Start
==
m_End
;
}
EDA_Rect
GetBoundingBox
();
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
Save
(
FILE
*
aFile
)
const
;
#if defined(DEBUG)
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
};
class
DrawMarkerStruct
:
public
SCH_ITEM
/* marqueurs */
{
public
:
wxPoint
m_Pos
;
/* XY coordinates of marker. */
TypeMarker
m_Type
;
int
m_MarkFlags
;
// complements d'information
wxString
m_Comment
;
/* Texte (commentaireassocie eventuel */
public
:
DrawMarkerStruct
(
const
wxPoint
&
pos
,
const
wxString
&
text
);
~
DrawMarkerStruct
();
virtual
wxString
GetClass
()
const
{
return
wxT
(
"DrawMarker"
);
}
DrawMarkerStruct
*
GenCopy
();
wxString
GetComment
();
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
Save
(
FILE
*
aFile
)
const
;
#if defined(DEBUG)
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
};
class
DrawNoConnectStruct
:
public
SCH_ITEM
/* Symboles de non connexion */
{
public
:
wxPoint
m_Pos
;
/* XY coordinates of NoConnect. */
public
:
DrawNoConnectStruct
(
const
wxPoint
&
pos
);
~
DrawNoConnectStruct
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"DrawNoConnect"
);
}
DrawNoConnectStruct
*
GenCopy
();
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
Save
(
FILE
*
aFile
)
const
;
EDA_Rect
GetBoundingBox
();
};
/**
* Class DrawBusEntryStruct
* Struct de descr 1 raccord a 45 degres de BUS ou WIRE
*/
class
DrawBusEntryStruct
:
public
SCH_ITEM
{
public
:
int
m_Width
;
wxPoint
m_Pos
;
wxSize
m_Size
;
public
:
DrawBusEntryStruct
(
const
wxPoint
&
pos
,
int
shape
,
int
id
);
~
DrawBusEntryStruct
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"DrawBusEntry"
);
}
DrawBusEntryStruct
*
GenCopy
();
wxPoint
m_End
()
const
;
// retourne la coord de fin du raccord
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
Save
(
FILE
*
aFile
)
const
;
EDA_Rect
GetBoundingBox
();
};
class
DrawPolylineStruct
:
public
SCH_ITEM
/* Polyligne (serie de segments) */
{
public
:
int
m_Width
;
int
m_NumOfPoints
;
/* Number of XY pairs in Points array. */
int
*
m_Points
;
/* XY pairs that forms the polyline. */
public
:
DrawPolylineStruct
(
int
layer
);
~
DrawPolylineStruct
();
virtual
wxString
GetClass
()
const
{
return
wxT
(
"DrawPolyline"
);
}
DrawPolylineStruct
*
GenCopy
();
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
Save
(
FILE
*
aFile
)
const
;
};
class
DrawJunctionStruct
:
public
SCH_ITEM
{
public
:
wxPoint
m_Pos
;
/* XY coordinates of connection. */
public
:
DrawJunctionStruct
(
const
wxPoint
&
pos
);
~
DrawJunctionStruct
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"DrawJunction"
);
}
EDA_Rect
GetBoundingBox
();
DrawJunctionStruct
*
GenCopy
();
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
Save
(
FILE
*
aFile
)
const
;
#if defined(DEBUG)
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
#endif
;
};
#define MAX_LAYERS 44
#define MAX_LAYERS 44
...
...
eeschema/protos.h
View file @
598cc337
...
@@ -57,7 +57,7 @@ void DrawLibraryDrawStruct(WinEDA_DrawPanel * aPanel, wxDC * aDC,
...
@@ -57,7 +57,7 @@ void DrawLibraryDrawStruct(WinEDA_DrawPanel * aPanel, wxDC * aDC,
LibEDA_BaseStruct
*
aDrawItem
,
LibEDA_BaseStruct
*
aDrawItem
,
int
aDrawMode
,
int
aColor
=
-
1
);
int
aDrawMode
,
int
aColor
=
-
1
);
bool
MapAngles
(
int
*
Angle1
,
int
*
Angle2
,
int
TransMat
[
2
][
2
]);
bool
MapAngles
(
int
*
Angle1
,
int
*
Angle2
,
const
int
TransMat
[
2
][
2
]);
EDA_LibComponentStruct
*
Read_Component_Definition
(
WinEDA_DrawFrame
*
frame
,
char
*
Line
,
EDA_LibComponentStruct
*
Read_Component_Definition
(
WinEDA_DrawFrame
*
frame
,
char
*
Line
,
FILE
*
f
,
int
*
LineNum
);
FILE
*
f
,
int
*
LineNum
);
...
@@ -69,7 +69,7 @@ EDA_LibComponentStruct * Read_Component_Definition(WinEDA_DrawFrame * frame, cha
...
@@ -69,7 +69,7 @@ EDA_LibComponentStruct * Read_Component_Definition(WinEDA_DrawFrame * frame, cha
* @param aPosition = the position to transform
* @param aPosition = the position to transform
* @return the new coordinate
* @return the new coordinate
*/
*/
wxPoint
TransformCoordinate
(
int
aTransformMatrix
[
2
][
2
],
wxPoint
&
aPosition
);
wxPoint
TransformCoordinate
(
const
int
aTransformMatrix
[
2
][
2
],
const
wxPoint
&
aPosition
);
LibraryStruct
*
FindLibrary
(
const
wxString
&
Name
);
LibraryStruct
*
FindLibrary
(
const
wxString
&
Name
);
int
LoadDocLib
(
WinEDA_DrawFrame
*
frame
,
const
wxString
&
FullDocLibName
,
const
wxString
&
Libname
);
int
LoadDocLib
(
WinEDA_DrawFrame
*
frame
,
const
wxString
&
FullDocLibName
,
const
wxString
&
Libname
);
...
...
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