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
c65942e1
Commit
c65942e1
authored
Sep 14, 2008
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eeschema: code cleaning
parent
45a066ab
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
268 additions
and
433 deletions
+268
-433
block_libedit.cpp
eeschema/block_libedit.cpp
+3
-4
class_pin.cpp
eeschema/class_pin.cpp
+163
-0
classes_body_items.cpp
eeschema/classes_body_items.cpp
+18
-0
classes_body_items.h
eeschema/classes_body_items.h
+2
-6
delete.cpp
eeschema/delete.cpp
+1
-1
eelibs_draw_components.cpp
eeschema/eelibs_draw_components.cpp
+35
-199
libclass.cpp
eeschema/libclass.cpp
+0
-173
pinedit.cpp
eeschema/pinedit.cpp
+9
-10
protos.h
eeschema/protos.h
+4
-4
symbdraw.cpp
eeschema/symbdraw.cpp
+25
-28
symbtext.cpp
eeschema/symbtext.cpp
+8
-8
No files found.
eeschema/block_libedit.cpp
View file @
c65942e1
...
@@ -462,8 +462,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -462,8 +462,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
if
(
CurrentConvert
&&
item
->
m_Convert
&&
(
item
->
m_Convert
!=
CurrentConvert
)
)
if
(
CurrentConvert
&&
item
->
m_Convert
&&
(
item
->
m_Convert
!=
CurrentConvert
)
)
continue
;
continue
;
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
PtBlock
->
m_MoveVector
.
x
,
PtBlock
->
m_MoveVector
.
y
,
PtBlock
->
m_MoveVector
,
item
,
g_XorMode
);
item
,
CurrentUnit
,
g_XorMode
);
}
}
}
}
}
}
...
@@ -491,8 +490,8 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -491,8 +490,8 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
if
(
CurrentConvert
&&
item
->
m_Convert
&&
(
item
->
m_Convert
!=
CurrentConvert
)
)
if
(
CurrentConvert
&&
item
->
m_Convert
&&
(
item
->
m_Convert
!=
CurrentConvert
)
)
continue
;
continue
;
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
PtBlock
->
m_MoveVector
.
x
,
PtBlock
->
m_MoveVector
.
y
,
PtBlock
->
m_MoveVector
,
item
,
CurrentUnit
,
g_XorMode
);
item
,
g_XorMode
);
}
}
}
}
}
}
...
...
eeschema/class_pin.cpp
View file @
c65942e1
...
@@ -665,3 +665,166 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
...
@@ -665,3 +665,166 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
}
}
}
}
}
}
/***************************************************************/
LibDrawPin
::
LibDrawPin
()
:
LibEDA_BaseStruct
(
COMPONENT_PIN_DRAW_TYPE
)
/***************************************************************/
{
m_PinLen
=
300
;
/* default Pin len */
m_Orient
=
PIN_RIGHT
;
/* Pin oprient: Up, Down, Left, Right */
m_PinShape
=
NONE
;
/* Bit a bit: Pin shape (voir enum prec) */
m_PinType
=
PIN_UNSPECIFIED
;
/* electrical type of pin */
m_Attributs
=
0
;
/* bit 0 != 0: pin invisible */
m_PinNum
=
0
;
/*pin number ( i.e. 4 codes Ascii ) */
m_PinNumSize
=
50
;
m_PinNameSize
=
50
;
/* Default size for pin name and num */
m_Width
=
0
;
// m_PinNumWidth = m_PinNameWidth = 0; // Unused
}
/******************************************/
wxPoint
LibDrawPin
::
ReturnPinEndPoint
()
/******************************************/
/* return the pin end position, for a component in normal orient
*/
{
wxPoint
pos
=
m_Pos
;
switch
(
m_Orient
)
{
case
PIN_UP
:
pos
.
y
+=
m_PinLen
;
break
;
case
PIN_DOWN
:
pos
.
y
-=
m_PinLen
;
break
;
case
PIN_LEFT
:
pos
.
x
-=
m_PinLen
;
break
;
case
PIN_RIGHT
:
pos
.
x
+=
m_PinLen
;
break
;
}
return
pos
;
}
/********************************************************/
int
LibDrawPin
::
ReturnPinDrawOrient
(
int
TransMat
[
2
][
2
]
)
/********************************************************/
/* Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT),
* according to its orientation,
* AND the matrix transform (rot, mirror) TransMat
*/
{
int
orient
;
int
x1
=
0
,
y1
=
0
;
int
t1
,
t2
;
switch
(
m_Orient
)
{
case
PIN_UP
:
y1
=
1
;
break
;
case
PIN_DOWN
:
y1
=
-
1
;
break
;
case
PIN_LEFT
:
x1
=
-
1
;
break
;
case
PIN_RIGHT
:
x1
=
1
;
break
;
}
t1
=
TransMat
[
0
][
0
]
*
x1
+
TransMat
[
0
][
1
]
*
y1
;
t2
=
TransMat
[
1
][
0
]
*
x1
+
TransMat
[
1
][
1
]
*
y1
;
orient
=
PIN_UP
;
if
(
t1
==
0
)
{
if
(
t2
>
0
)
orient
=
PIN_DOWN
;
}
else
{
orient
=
PIN_RIGHT
;
if
(
t1
<
0
)
orient
=
PIN_LEFT
;
}
return
orient
;
}
/****************************************************/
void
LibDrawPin
::
ReturnPinStringNum
(
wxString
&
buffer
)
/****************************************************/
/* fill the buffer with pin num as a wxString
* Pin num is coded as a long
* Used to print/draw the pin num
*/
{
char
ascii_buf
[
5
];
strncpy
(
ascii_buf
,
(
char
*
)
&
m_PinNum
,
4
);
ascii_buf
[
4
]
=
0
;
buffer
=
CONV_FROM_UTF8
(
ascii_buf
);
}
/****************************************************/
void
LibDrawPin
::
SetPinNumFromString
(
wxString
&
buffer
)
/****************************************************/
/* fill the buffer with pin num as a wxString
* Pin num is coded as a long
* Used to print/draw the pin num
*/
{
char
ascii_buf
[
4
];
unsigned
ii
,
len
=
buffer
.
Len
();
ascii_buf
[
0
]
=
ascii_buf
[
1
]
=
ascii_buf
[
2
]
=
ascii_buf
[
3
]
=
0
;
if
(
len
>
4
)
len
=
4
;
for
(
ii
=
0
;
ii
<
len
;
ii
++
)
{
ascii_buf
[
ii
]
=
buffer
.
GetChar
(
ii
)
&
0xFF
;
}
strncpy
(
(
char
*
)
&
m_PinNum
,
ascii_buf
,
4
);
}
/*************************************/
LibDrawPin
*
LibDrawPin
::
GenCopy
()
/*************************************/
{
LibDrawPin
*
newpin
=
new
LibDrawPin
();
newpin
->
m_Pos
=
m_Pos
;
newpin
->
m_PinLen
=
m_PinLen
;
newpin
->
m_Orient
=
m_Orient
;
newpin
->
m_PinShape
=
m_PinShape
;
newpin
->
m_PinType
=
m_PinType
;
newpin
->
m_Attributs
=
m_Attributs
;
newpin
->
m_PinNum
=
m_PinNum
;
newpin
->
m_PinNumSize
=
m_PinNumSize
;
newpin
->
m_PinNameSize
=
m_PinNameSize
;
newpin
->
m_Unit
=
m_Unit
;
newpin
->
m_Convert
=
m_Convert
;
newpin
->
m_Flags
=
m_Flags
;
newpin
->
m_Width
=
m_Width
;
newpin
->
m_PinName
=
m_PinName
;
return
newpin
;
}
eeschema/classes_body_items.cpp
View file @
c65942e1
...
@@ -15,6 +15,20 @@
...
@@ -15,6 +15,20 @@
//#define DRAW_ARC_WITH_ANGLE // Used to draw arcs
//#define DRAW_ARC_WITH_ANGLE // Used to draw arcs
/* Basic class (abstract) for components bodies items */
LibEDA_BaseStruct
::
LibEDA_BaseStruct
(
KICAD_T
struct_type
)
:
EDA_BaseStruct
(
struct_type
)
{
m_Unit
=
0
;
/* Unit identification (for multi part per package)
* 0 if the item is common to all units */
m_Convert
=
0
;
/* Shape identification (for parts which have a convert shape)
* 0 if the item is common to all shapes */
m_Width
=
0
;
/* Default value to draw lines or arc ... */
m_Fill
=
NO_FILL
;
/* NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR.
* has meaning only for some items */
}
/** Function Draw (virtual)
/** Function Draw (virtual)
* Draw A body item
* Draw A body item
* @param aPanel = DrawPanel to use (can be null) mainly used for clipping purposes
* @param aPanel = DrawPanel to use (can be null) mainly used for clipping purposes
...
@@ -70,10 +84,14 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffs
...
@@ -70,10 +84,14 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffs
else
else
#ifdef DRAW_ARC_WITH_ANGLE
#ifdef DRAW_ARC_WITH_ANGLE
GRArc
(
&
aPanel
->
m_ClipBox
,
aDC
,
posc
.
x
,
posc
.
y
,
pt1
,
pt2
,
GRArc
(
&
aPanel
->
m_ClipBox
,
aDC
,
posc
.
x
,
posc
.
y
,
pt1
,
pt2
,
m_Rayon
,
LineWidth
,
color
);
m_Rayon
,
LineWidth
,
color
);
#else
#else
GRArc1
(
&
aPanel
->
m_ClipBox
,
aDC
,
pos1
.
x
,
pos1
.
y
,
pos2
.
x
,
pos2
.
y
,
GRArc1
(
&
aPanel
->
m_ClipBox
,
aDC
,
pos1
.
x
,
pos1
.
y
,
pos2
.
x
,
pos2
.
y
,
posc
.
x
,
posc
.
y
,
LineWidth
,
color
);
posc
.
x
,
posc
.
y
,
LineWidth
,
color
);
#endif
#endif
...
...
eeschema/classes_body_items.h
View file @
c65942e1
...
@@ -132,6 +132,7 @@ public:
...
@@ -132,6 +132,7 @@ public:
* 0 if the item is common to all shapes */
* 0 if the item is common to all shapes */
wxPoint
m_Pos
;
/* Position or centre (Arc and Circle) or start point (segments) */
wxPoint
m_Pos
;
/* Position or centre (Arc and Circle) or start point (segments) */
int
m_Width
;
/* Tickness */
int
m_Width
;
/* Tickness */
FILL_T
m_Fill
;
/* NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR. has meaning only for some items */
public
:
public
:
LibEDA_BaseStruct
*
Next
()
LibEDA_BaseStruct
*
Next
()
...
@@ -154,7 +155,7 @@ public:
...
@@ -154,7 +155,7 @@ public:
* used for some items to force to force no fill mode
* used for some items to force to force no fill mode
* ( has meaning only for items what can be filled ). used in printing or moving objects mode
* ( has meaning only for items what can be filled ). used in printing or moving objects mode
* or to pass refernce to the lib component for pins
* or to pass refernce to the lib component for pins
* @param aTransformMatrix = Transform Matrix
* @param aTransformMatrix = Transform Matrix
(rotaion, mirror ..)
*/
*/
virtual
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
virtual
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
)
=
0
;
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
)
=
0
;
...
@@ -223,7 +224,6 @@ class LibDrawArc : public LibEDA_BaseStruct
...
@@ -223,7 +224,6 @@ class LibDrawArc : public LibEDA_BaseStruct
{
{
public
:
public
:
int
m_Rayon
;
int
m_Rayon
;
FILL_T
m_Fill
;
// NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR
int
t1
,
t2
;
/* position des 2 extremites de l'arc en 0.1 degres */
int
t1
,
t2
;
/* position des 2 extremites de l'arc en 0.1 degres */
wxPoint
m_ArcStart
,
m_ArcEnd
;
/* position des 2 extremites de l'arc en coord reelles*/
wxPoint
m_ArcStart
,
m_ArcEnd
;
/* position des 2 extremites de l'arc en coord reelles*/
...
@@ -249,7 +249,6 @@ class LibDrawCircle : public LibEDA_BaseStruct
...
@@ -249,7 +249,6 @@ class LibDrawCircle : public LibEDA_BaseStruct
{
{
public
:
public
:
int
m_Rayon
;
int
m_Rayon
;
FILL_T
m_Fill
;
public
:
public
:
LibDrawCircle
();
LibDrawCircle
();
...
@@ -304,7 +303,6 @@ class LibDrawSquare : public LibEDA_BaseStruct
...
@@ -304,7 +303,6 @@ class LibDrawSquare : public LibEDA_BaseStruct
{
{
public
:
public
:
wxPoint
m_End
;
wxPoint
m_End
;
FILL_T
m_Fill
;
public
:
public
:
LibDrawSquare
();
LibDrawSquare
();
...
@@ -352,7 +350,6 @@ class LibDrawPolyline : public LibEDA_BaseStruct
...
@@ -352,7 +350,6 @@ class LibDrawPolyline : public LibEDA_BaseStruct
public
:
public
:
int
m_CornersCount
;
int
m_CornersCount
;
int
*
m_PolyList
;
int
*
m_PolyList
;
FILL_T
m_Fill
;
public
:
public
:
LibDrawPolyline
();
LibDrawPolyline
();
...
@@ -392,7 +389,6 @@ class LibDrawField : public LibEDA_BaseStruct
...
@@ -392,7 +389,6 @@ class LibDrawField : public LibEDA_BaseStruct
public
:
public
:
int
m_FieldId
;
// 0 a 11
int
m_FieldId
;
// 0 a 11
// 0 = Name; 1 = Valeur; 2 .. 11 other fields
// 0 = Name; 1 = Valeur; 2 .. 11 other fields
wxPoint
m_Pos
;
wxSize
m_Size
;
wxSize
m_Size
;
int
m_Orient
;
/* Orientation */
int
m_Orient
;
/* Orientation */
int
m_Attributs
;
/* Attributes (Non visible ...) */
int
m_Attributs
;
/* Attributes (Non visible ...) */
...
...
eeschema/delete.cpp
View file @
c65942e1
...
@@ -540,7 +540,7 @@ void DeleteOneLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -540,7 +540,7 @@ void DeleteOneLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC,
/* Effacement du graphique */
/* Effacement du graphique */
if
(
Affiche
&&
DC
)
if
(
Affiche
&&
DC
)
DrawLibraryDrawStruct
(
panel
,
DC
,
LibEntry
,
0
,
0
,
DrawItem
,
CurrentUnit
,
g_XorMode
);
DrawLibraryDrawStruct
(
panel
,
DC
,
LibEntry
,
wxPoint
(
0
,
0
),
DrawItem
,
g_XorMode
);
/* Effacement de la structure en memoire */
/* Effacement de la structure en memoire */
if
(
LibEntry
)
/* Recherche du predecesseur */
if
(
LibEntry
)
/* Recherche du predecesseur */
...
...
eeschema/eelibs_draw_components.cpp
View file @
c65942e1
...
@@ -211,7 +211,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -211,7 +211,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
Field
->
m_HJustify
,
Field
->
m_VJustify
,
LineWidth
);
Field
->
m_HJustify
,
Field
->
m_VJustify
,
LineWidth
);
}
}
// Trac
�
de l'ancre
// Trac
e
de l'ancre
int
len
=
3
*
panel
->
GetZoom
();
int
len
=
3
*
panel
->
GetZoom
();
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
posX
,
posY
-
len
,
posX
,
posY
+
len
,
0
,
color
);
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
posX
,
posY
-
len
,
posX
,
posY
+
len
,
0
,
color
);
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
posX
-
len
,
posY
,
posX
+
len
,
posY
,
0
,
color
);
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
posX
-
len
,
posY
,
posX
+
len
,
posY
,
0
,
color
);
...
@@ -435,10 +435,8 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -435,10 +435,8 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
int
Color
,
bool
DrawPinText
)
int
Color
,
bool
DrawPinText
)
{
{
wxPoint
pos1
,
pos2
;
wxPoint
pos1
,
pos2
;
LibEDA_BaseStruct
*
DEntry
=
NULL
;
LibEDA_BaseStruct
*
DEntry
;
bool
force_nofill
;
bool
force_nofill
;
int
SetHightColor
;
int
LineWidth
;
if
(
Entry
->
m_Drawings
==
NULL
)
if
(
Entry
->
m_Drawings
==
NULL
)
return
;
return
;
...
@@ -446,7 +444,7 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -446,7 +444,7 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
for
(
DEntry
=
Entry
->
m_Drawings
;
DEntry
!=
NULL
;
DEntry
=
DEntry
->
Next
()
)
for
(
DEntry
=
Entry
->
m_Drawings
;
DEntry
!=
NULL
;
DEntry
=
DEntry
->
Next
()
)
{
{
/*
Elimination des elements non relatifs a l'unite
*/
/*
Do not draw items not attached to the current part
*/
if
(
Multi
&&
DEntry
->
m_Unit
&&
(
DEntry
->
m_Unit
!=
Multi
)
)
if
(
Multi
&&
DEntry
->
m_Unit
&&
(
DEntry
->
m_Unit
!=
Multi
)
)
continue
;
continue
;
...
@@ -454,72 +452,33 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -454,72 +452,33 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
continue
;
continue
;
if
(
DEntry
->
m_Flags
&
IS_MOVED
)
if
(
DEntry
->
m_Flags
&
IS_MOVED
)
continue
;
//
Element en deplacement non trace
continue
;
//
Do do draw here an item while moving (the cursor handler does that)
SetHightColor
=
(
DEntry
->
m_Selected
&
IS_SELECTED
)
?
HIGHT_LIGHT_FLAG
:
0
;
force_nofill
=
false
;
LineWidth
=
MAX
(
DEntry
->
m_Width
,
g_DrawMinimunLineWidth
);
switch
(
DEntry
->
Type
()
)
switch
(
DEntry
->
Type
()
)
{
{
case
COMPONENT_
ARC
_DRAW_TYPE
:
case
COMPONENT_
PIN
_DRAW_TYPE
:
{
{
LibDrawArc
*
Arc
=
(
LibDrawArc
*
)
DEntry
;
DrawPinPrms
prms
(
Entry
,
DrawPinText
);
force_nofill
=
false
;
DEntry
->
Draw
(
panel
,
DC
,
Pos
,
Color
,
DrawMode
,
&
prms
,
TransMat
);
if
(
g_IsPrinting
&&
Arc
->
m_Fill
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
()
)
force_nofill
=
true
;
DEntry
->
Draw
(
panel
,
DC
,
Pos
,
Color
,
DrawMode
,
(
void
*
)
force_nofill
,
TransMat
);
break
;
}
case
COMPONENT_CIRCLE_DRAW_TYPE
:
{
LibDrawCircle
*
Circle
=
(
LibDrawCircle
*
)
DEntry
;
force_nofill
=
false
;
if
(
g_IsPrinting
&&
Circle
->
m_Fill
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
()
)
force_nofill
=
true
;
DEntry
->
Draw
(
panel
,
DC
,
Pos
,
Color
,
DrawMode
,
(
void
*
)
force_nofill
,
TransMat
);
}
}
break
;
break
;
case
COMPONENT_ARC_DRAW_TYPE
:
case
COMPONENT_CIRCLE_DRAW_TYPE
:
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
DEntry
->
Draw
(
panel
,
DC
,
Pos
,
Color
,
DrawMode
,
NULL
,
TransMat
);
break
;
case
COMPONENT_RECT_DRAW_TYPE
:
case
COMPONENT_RECT_DRAW_TYPE
:
{
LibDrawSquare
*
Square
=
(
LibDrawSquare
*
)
DEntry
;
force_nofill
=
false
;
if
(
g_IsPrinting
&&
Square
->
m_Fill
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
()
)
force_nofill
=
true
;
DEntry
->
Draw
(
panel
,
DC
,
Pos
,
Color
,
DrawMode
,
(
void
*
)
force_nofill
,
TransMat
);
}
break
;
case
COMPONENT_PIN_DRAW_TYPE
:
/* Trace des Pins */
{
DrawPinPrms
prms
(
Entry
,
DrawPinText
);
DEntry
->
Draw
(
panel
,
DC
,
Pos
,
Color
,
DrawMode
,
&
prms
,
TransMat
);
}
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
{
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DEntry
;
force_nofill
=
false
;
if
(
g_IsPrinting
&&
polyline
->
m_Fill
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
()
)
force_nofill
=
true
;
DEntry
->
Draw
(
panel
,
DC
,
Pos
,
Color
,
DrawMode
,
(
void
*
)
force_nofill
,
TransMat
);
}
break
;
default
:
default
:
wxBell
();
if
(
g_IsPrinting
&&
DEntry
->
m_Fill
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
()
)
force_nofill
=
true
;
DEntry
->
Draw
(
panel
,
DC
,
Pos
,
Color
,
DrawMode
,
(
void
*
)
force_nofill
,
TransMat
);
break
;
break
;
}
}
/* Fin Switch */
}
}
/* Fin Boucle de dessin */
if
(
g_DebugLevel
>
4
)
/* Draw the component boundary box */
if
(
g_DebugLevel
>
4
)
/* Draw the component boundary box */
{
{
EDA_Rect
BoundaryBox
;
EDA_Rect
BoundaryBox
;
...
@@ -548,7 +507,6 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -548,7 +507,6 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
}
}
/*****************************************************************************
/*****************************************************************************
* Routine to rotate the given angular direction by the given Transformation. *
* Routine to rotate the given angular direction by the given Transformation. *
* Input (and output) angles must be as follows: *
* Input (and output) angles must be as follows: *
...
@@ -638,164 +596,42 @@ void DrawingLibInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -638,164 +596,42 @@ void DrawingLibInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
/* DrawMode = GrXOR, GrOR .. */
/* DrawMode = GrXOR, GrOR .. */
/************************************************************/
/************************************************************/
/* Utilise en LibEdit et Lib Browse */
/* Utilise en LibEdit et Lib Browse */
void
DrawLibraryDrawStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
DrawLibraryDrawStruct
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
a
DC
,
EDA_LibComponentStruct
*
LibEntry
,
EDA_LibComponentStruct
*
a
LibEntry
,
int
PartX
,
int
PartY
,
wxPoint
aPosition
,
LibEDA_BaseStruct
*
DrawItem
,
int
Multi
,
LibEDA_BaseStruct
*
aDrawItem
,
int
DrawMode
,
int
Color
)
int
aDrawMode
,
int
a
Color
)
{
{
int
x1
,
y1
,
x2
,
y2
,
t1
,
t2
,
orient
;
int
TransMat
[
2
][
2
];
int
CharColor
;
bool
no_fill
;
int
TransMat
[
2
][
2
];
int
fill_option
;
GRSetDrawMode
(
aDC
,
aDrawMode
);
wxPoint
position
(
PartX
,
PartY
);
#undef GETCOLOR
#define GETCOLOR( l ) Color < 0 ? ReturnLayerColor( l ) : Color;
Multi
=
0
;
/* unused */
/* Trace de la structure */
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
GRSetDrawMode
(
DC
,
DrawMode
);
TransMat
[
0
][
0
]
=
1
;
TransMat
[
0
][
0
]
=
1
;
TransMat
[
0
][
1
]
=
TransMat
[
1
][
0
]
=
0
;
TransMat
[
0
][
1
]
=
TransMat
[
1
][
0
]
=
0
;
TransMat
[
1
][
1
]
=
-
1
;
TransMat
[
1
][
1
]
=
-
1
;
int
LineWidth
=
MAX
(
DrawItem
->
m_Width
,
g_DrawMinimunLineWidth
)
;
no_fill
=
false
;
switch
(
DrawItem
->
Type
()
)
switch
(
a
DrawItem
->
Type
()
)
{
{
case
COMPONENT_
ARC_DRAW_TYPE
:
case
COMPONENT_
PIN_DRAW_TYPE
:
/* Trace des Pins */
{
{
int
xc
,
yc
,
x2
,
y2
;
DrawPinPrms
prms
(
aLibEntry
,
true
);
LibDrawArc
*
Arc
=
(
LibDrawArc
*
)
DrawItem
;
aDrawItem
->
Draw
(
aPanel
,
aDC
,
aPosition
,
aColor
,
aDrawMode
,
&
prms
,
TransMat
);
t1
=
Arc
->
t1
;
t2
=
Arc
->
t2
;
bool
swap
=
MapAngles
(
&
t1
,
&
t2
,
TransMat
);
xc
=
PartX
+
Arc
->
m_Pos
.
x
;
yc
=
PartY
-
Arc
->
m_Pos
.
y
;
x2
=
PartX
+
Arc
->
m_ArcStart
.
x
;
y2
=
PartY
-
Arc
->
m_ArcStart
.
y
;
x1
=
PartX
+
Arc
->
m_ArcEnd
.
x
;
y1
=
PartY
-
Arc
->
m_ArcEnd
.
y
;
if
(
swap
)
{
EXCHG
(
x1
,
x2
);
EXCHG
(
y1
,
y2
)
}
fill_option
=
Arc
->
m_Fill
;
if
(
g_IsPrinting
&&
fill_option
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
()
)
fill_option
=
NO_FILL
;
if
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
GRFilledArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
Arc
->
m_Rayon
,
CharColor
,
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
)
);
else
if
(
fill_option
==
FILLED_SHAPE
)
GRFilledArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
Arc
->
m_Rayon
,
LineWidth
,
CharColor
,
CharColor
);
#ifdef DRAW_ARC_WITH_ANGLE
else
GRArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
Arc
->
m_Rayon
,
CharColor
);
#else
else
GRArc1
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
xc
,
yc
,
LineWidth
,
CharColor
);
#endif
}
}
break
;
break
;
case
COMPONENT_ARC_DRAW_TYPE
:
case
COMPONENT_CIRCLE_DRAW_TYPE
:
case
COMPONENT_CIRCLE_DRAW_TYPE
:
{
LibDrawCircle
*
Circle
=
(
LibDrawCircle
*
)
DrawItem
;
x1
=
PartX
+
Circle
->
m_Pos
.
x
;
y1
=
PartY
-
Circle
->
m_Pos
.
y
;
fill_option
=
Circle
->
m_Fill
;
if
(
g_IsPrinting
&&
fill_option
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
()
)
fill_option
=
NO_FILL
;
if
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
GRFilledCircle
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
Circle
->
m_Rayon
,
LineWidth
,
CharColor
,
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
)
);
else
if
(
fill_option
==
FILLED_SHAPE
)
GRFilledCircle
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
Circle
->
m_Rayon
,
0
,
CharColor
,
CharColor
);
else
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
Circle
->
m_Rayon
,
LineWidth
,
CharColor
);
}
break
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
{
LibDrawText
*
Text
=
(
LibDrawText
*
)
DrawItem
;
x1
=
PartX
+
Text
->
m_Pos
.
x
;
y1
=
PartY
-
Text
->
m_Pos
.
y
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
,
y1
),
CharColor
,
Text
->
m_Text
,
Text
->
m_Horiz
,
Text
->
m_Size
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
}
break
;
case
COMPONENT_RECT_DRAW_TYPE
:
case
COMPONENT_RECT_DRAW_TYPE
:
{
LibDrawSquare
*
Square
=
(
LibDrawSquare
*
)
DrawItem
;
x1
=
PartX
+
Square
->
m_Pos
.
x
;
y1
=
PartY
-
Square
->
m_Pos
.
y
;
x2
=
PartX
+
Square
->
m_End
.
x
;
y2
=
PartY
-
Square
->
m_End
.
y
;
fill_option
=
Square
->
m_Fill
;
if
(
g_IsPrinting
&&
fill_option
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
()
)
fill_option
=
NO_FILL
;
if
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
GRFilledRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
CharColor
,
LineWidth
,
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
)
);
else
if
(
fill_option
==
FILLED_SHAPE
)
GRFilledRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
CharColor
,
CharColor
);
else
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
LineWidth
,
CharColor
);
}
break
;
case
COMPONENT_PIN_DRAW_TYPE
:
/* Trace des Pins */
{
LibDrawPin
*
Pin
=
(
LibDrawPin
*
)
DrawItem
;
x2
=
PartX
+
Pin
->
m_Pos
.
x
;
y2
=
PartY
-
Pin
->
m_Pos
.
y
;
/* Compute the real pin orientation, i.e. pin orient + component orient */
orient
=
Pin
->
ReturnPinDrawOrient
(
TransMat
);
/* Dessin de la pin et du symbole special associe */
if
(
Pin
->
m_Attributs
&
PINNOTDRAW
)
CharColor
=
DARKGRAY
;
else
CharColor
=
-
1
;
Pin
->
DrawPinSymbol
(
panel
,
DC
,
wxPoint
(
x2
,
y2
),
orient
,
DrawMode
);
wxPoint
pinpos
(
x2
,
y2
);
Pin
->
DrawPinTexts
(
panel
,
DC
,
pinpos
,
orient
,
LibEntry
->
m_TextInside
,
LibEntry
->
m_DrawPinNum
,
LibEntry
->
m_DrawPinName
,
CharColor
,
DrawMode
);
}
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
{
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DrawItem
;
fill_option
=
false
;
if
(
g_IsPrinting
&&
polyline
->
m_Fill
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
()
)
fill_option
=
true
;
DrawItem
->
Draw
(
panel
,
DC
,
position
,
Color
,
DrawMode
,
(
void
*
)
fill_option
,
TransMat
);
break
;
}
default
:
default
:
;
if
(
g_IsPrinting
&&
aDrawItem
->
m_Fill
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
()
)
no_fill
=
true
;
aDrawItem
->
Draw
(
aPanel
,
aDC
,
aPosition
,
aColor
,
aDrawMode
,
(
void
*
)
no_fill
,
TransMat
);
break
;
}
}
}
}
eeschema/libclass.cpp
View file @
c65942e1
...
@@ -434,179 +434,6 @@ void LibDrawField::Copy( LibDrawField* Target )
...
@@ -434,179 +434,6 @@ void LibDrawField::Copy( LibDrawField* Target )
}
}
/* Elements Graphiques */
LibEDA_BaseStruct
::
LibEDA_BaseStruct
(
KICAD_T
struct_type
)
:
EDA_BaseStruct
(
struct_type
)
{
m_Unit
=
0
;
/* Unit identification (for multi part per package)
* 0 if the item is common to all units */
m_Convert
=
0
;
/* Shape identification (for parts which have a convert shape)
* 0 if the item is common to all shapes */
m_Width
=
0
;
/* Default value to draw lines or arc ... */
}
/***************************************************************/
LibDrawPin
::
LibDrawPin
()
:
LibEDA_BaseStruct
(
COMPONENT_PIN_DRAW_TYPE
)
/***************************************************************/
{
m_PinLen
=
300
;
/* default Pin len */
m_Orient
=
PIN_RIGHT
;
/* Pin oprient: Up, Down, Left, Right */
m_PinShape
=
NONE
;
/* Bit a bit: Pin shape (voir enum prec) */
m_PinType
=
PIN_UNSPECIFIED
;
/* electrical type of pin */
m_Attributs
=
0
;
/* bit 0 != 0: pin invisible */
m_PinNum
=
0
;
/*pin number ( i.e. 4 codes Ascii ) */
m_PinNumSize
=
50
;
m_PinNameSize
=
50
;
/* Default size for pin name and num */
m_Width
=
0
;
// m_PinNumWidth = m_PinNameWidth = 0; // Unused
}
/******************************************/
wxPoint
LibDrawPin
::
ReturnPinEndPoint
()
/******************************************/
/* return the pin end position, for a component in normal orient
*/
{
wxPoint
pos
=
m_Pos
;
switch
(
m_Orient
)
{
case
PIN_UP
:
pos
.
y
+=
m_PinLen
;
break
;
case
PIN_DOWN
:
pos
.
y
-=
m_PinLen
;
break
;
case
PIN_LEFT
:
pos
.
x
-=
m_PinLen
;
break
;
case
PIN_RIGHT
:
pos
.
x
+=
m_PinLen
;
break
;
}
return
pos
;
}
/********************************************************/
int
LibDrawPin
::
ReturnPinDrawOrient
(
int
TransMat
[
2
][
2
]
)
/********************************************************/
/* Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT),
* according to its orientation,
* AND the matrix transform (rot, mirror) TransMat
*/
{
int
orient
;
int
x1
=
0
,
y1
=
0
;
int
t1
,
t2
;
switch
(
m_Orient
)
{
case
PIN_UP
:
y1
=
1
;
break
;
case
PIN_DOWN
:
y1
=
-
1
;
break
;
case
PIN_LEFT
:
x1
=
-
1
;
break
;
case
PIN_RIGHT
:
x1
=
1
;
break
;
}
t1
=
TransMat
[
0
][
0
]
*
x1
+
TransMat
[
0
][
1
]
*
y1
;
t2
=
TransMat
[
1
][
0
]
*
x1
+
TransMat
[
1
][
1
]
*
y1
;
orient
=
PIN_UP
;
if
(
t1
==
0
)
{
if
(
t2
>
0
)
orient
=
PIN_DOWN
;
}
else
{
orient
=
PIN_RIGHT
;
if
(
t1
<
0
)
orient
=
PIN_LEFT
;
}
return
orient
;
}
/****************************************************/
void
LibDrawPin
::
ReturnPinStringNum
(
wxString
&
buffer
)
/****************************************************/
/* fill the buffer with pin num as a wxString
* Pin num is coded as a long
* Used to print/draw the pin num
*/
{
char
ascii_buf
[
5
];
strncpy
(
ascii_buf
,
(
char
*
)
&
m_PinNum
,
4
);
ascii_buf
[
4
]
=
0
;
buffer
=
CONV_FROM_UTF8
(
ascii_buf
);
}
/****************************************************/
void
LibDrawPin
::
SetPinNumFromString
(
wxString
&
buffer
)
/****************************************************/
/* fill the buffer with pin num as a wxString
* Pin num is coded as a long
* Used to print/draw the pin num
*/
{
char
ascii_buf
[
4
];
unsigned
ii
,
len
=
buffer
.
Len
();
ascii_buf
[
0
]
=
ascii_buf
[
1
]
=
ascii_buf
[
2
]
=
ascii_buf
[
3
]
=
0
;
if
(
len
>
4
)
len
=
4
;
for
(
ii
=
0
;
ii
<
len
;
ii
++
)
{
ascii_buf
[
ii
]
=
buffer
.
GetChar
(
ii
)
&
0xFF
;
}
strncpy
(
(
char
*
)
&
m_PinNum
,
ascii_buf
,
4
);
}
/*************************************/
LibDrawPin
*
LibDrawPin
::
GenCopy
()
/*************************************/
{
LibDrawPin
*
newpin
=
new
LibDrawPin
();
newpin
->
m_Pos
=
m_Pos
;
newpin
->
m_PinLen
=
m_PinLen
;
newpin
->
m_Orient
=
m_Orient
;
newpin
->
m_PinShape
=
m_PinShape
;
newpin
->
m_PinType
=
m_PinType
;
newpin
->
m_Attributs
=
m_Attributs
;
newpin
->
m_PinNum
=
m_PinNum
;
newpin
->
m_PinNumSize
=
m_PinNumSize
;
newpin
->
m_PinNameSize
=
m_PinNameSize
;
newpin
->
m_Unit
=
m_Unit
;
newpin
->
m_Convert
=
m_Convert
;
newpin
->
m_Flags
=
m_Flags
;
newpin
->
m_Width
=
m_Width
;
newpin
->
m_PinName
=
m_PinName
;
return
newpin
;
}
/**************************************************************/
/**************************************************************/
LibDrawArc
::
LibDrawArc
()
:
LibEDA_BaseStruct
(
COMPONENT_ARC_DRAW_TYPE
)
LibDrawArc
::
LibDrawArc
()
:
LibEDA_BaseStruct
(
COMPONENT_ARC_DRAW_TYPE
)
/**************************************************************/
/**************************************************************/
...
...
eeschema/pinedit.cpp
View file @
c65942e1
...
@@ -88,7 +88,7 @@ void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event )
...
@@ -88,7 +88,7 @@ void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event )
m_Parent
->
DrawPanel
->
ManageCurseur
(
m_Parent
->
DrawPanel
,
&
dc
,
FALSE
);
m_Parent
->
DrawPanel
->
ManageCurseur
(
m_Parent
->
DrawPanel
,
&
dc
,
FALSE
);
else
else
DrawLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
CurrentLibEntry
,
DrawLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
CurrentLibEntry
,
0
,
0
,
CurrentPin
,
CurrentUnit
,
g_XorMode
);
wxPoint
(
0
,
0
),
CurrentPin
,
g_XorMode
);
SetPinName
(
m_PinNameCtrl
->
GetValue
(),
LastPinNameSize
);
SetPinName
(
m_PinNameCtrl
->
GetValue
(),
LastPinNameSize
);
msg
=
m_PinNumCtrl
->
GetValue
();
if
(
msg
.
IsEmpty
()
)
msg
=
m_PinNumCtrl
->
GetValue
();
if
(
msg
.
IsEmpty
()
)
...
@@ -103,7 +103,7 @@ void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event )
...
@@ -103,7 +103,7 @@ void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event )
m_Parent
->
DrawPanel
->
ManageCurseur
(
m_Parent
->
DrawPanel
,
&
dc
,
FALSE
);
m_Parent
->
DrawPanel
->
ManageCurseur
(
m_Parent
->
DrawPanel
,
&
dc
,
FALSE
);
else
else
DrawLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
CurrentLibEntry
,
DrawLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
CurrentLibEntry
,
0
,
0
,
CurrentPin
,
CurrentUnit
,
g_XorMode
);
wxPoint
(
0
,
0
),
CurrentPin
,
g_XorMode
);
}
}
if
(
CurrentDrawItem
)
if
(
CurrentDrawItem
)
...
@@ -250,7 +250,7 @@ void WinEDA_LibeditFrame::PlacePin( wxDC* DC )
...
@@ -250,7 +250,7 @@ void WinEDA_LibeditFrame::PlacePin( wxDC* DC )
}
}
DrawPanel
->
CursorOff
(
DC
);
DrawPanel
->
CursorOff
(
DC
);
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
CurrentPin
,
CurrentUnit
,
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
wxPoint
(
0
,
0
),
CurrentPin
,
GR_DEFAULT_DRAWMODE
);
GR_DEFAULT_DRAWMODE
);
DrawPanel
->
CursorOn
(
DC
);
DrawPanel
->
CursorOn
(
DC
);
...
@@ -344,14 +344,14 @@ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
...
@@ -344,14 +344,14 @@ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if
(
erase
||
(
CurrentPin
->
m_Flags
&
IS_NEW
)
)
if
(
erase
||
(
CurrentPin
->
m_Flags
&
IS_NEW
)
)
{
{
CurrentPin
->
m_Pos
=
PinPreviousPos
;
CurrentPin
->
m_Pos
=
PinPreviousPos
;
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
wxPoint
(
0
,
0
)
,
CurrentPin
,
CurrentUnit
,
g_XorMode
);
CurrentPin
,
g_XorMode
);
}
}
/* Redraw pin in new position */
/* Redraw pin in new position */
CurrentPin
->
m_Pos
.
x
=
panel
->
GetScreen
()
->
m_Curseur
.
x
;
CurrentPin
->
m_Pos
.
x
=
panel
->
GetScreen
()
->
m_Curseur
.
x
;
CurrentPin
->
m_Pos
.
y
=
-
panel
->
GetScreen
()
->
m_Curseur
.
y
;
CurrentPin
->
m_Pos
.
y
=
-
panel
->
GetScreen
()
->
m_Curseur
.
y
;
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
0
,
0
,
CurrentPin
,
CurrentUnit
,
g_XorMode
);
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
wxPoint
(
0
,
0
),
CurrentPin
,
g_XorMode
);
PinPreviousPos
=
CurrentPin
->
m_Pos
;
PinPreviousPos
=
CurrentPin
->
m_Pos
;
...
@@ -608,7 +608,7 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
...
@@ -608,7 +608,7 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
if
(
DC
)
if
(
DC
)
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
CurrentPin
,
CurrentUnit
,
g_XorMode
);
wxPoint
(
0
,
0
),
CurrentPin
,
g_XorMode
);
DrawPanel
->
m_IgnoreMouseEvents
=
TRUE
;
DrawPanel
->
m_IgnoreMouseEvents
=
TRUE
;
InstallPineditFrame
(
this
,
DC
,
wxPoint
(
-
1
,
-
1
)
);
InstallPineditFrame
(
this
,
DC
,
wxPoint
(
-
1
,
-
1
)
);
...
@@ -872,7 +872,7 @@ void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC,
...
@@ -872,7 +872,7 @@ void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC,
if
(
selected
&&
(
Pin
->
m_Selected
&
IS_SELECTED
)
==
0
)
if
(
selected
&&
(
Pin
->
m_Selected
&
IS_SELECTED
)
==
0
)
continue
;
continue
;
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
Pin
,
CurrentUnit
,
g_XorMode
);
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
wxPoint
(
0
,
0
),
Pin
,
g_XorMode
);
switch
(
id
)
switch
(
id
)
{
{
...
@@ -889,8 +889,7 @@ void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC,
...
@@ -889,8 +889,7 @@ void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC,
break
;
break
;
}
}
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
Pin
,
CurrentUnit
,
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
wxPoint
(
0
,
0
),
Pin
,
GR_DEFAULT_DRAWMODE
);
GR_DEFAULT_DRAWMODE
);
}
}
}
}
...
...
eeschema/protos.h
View file @
c65942e1
...
@@ -54,10 +54,10 @@ void DrawLibEntry(WinEDA_DrawPanel * panel, wxDC * DC,
...
@@ -54,10 +54,10 @@ void DrawLibEntry(WinEDA_DrawPanel * panel, wxDC * DC,
int
Multi
,
int
convert
,
int
Multi
,
int
convert
,
int
DrawMode
,
int
Color
=
-
1
);
int
DrawMode
,
int
Color
=
-
1
);
void
DrawLibraryDrawStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
DrawLibraryDrawStruct
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
a
DC
,
EDA_LibComponentStruct
*
LibEntry
,
int
PartX
,
int
PartY
,
EDA_LibComponentStruct
*
aLibEntry
,
wxPoint
aPosition
,
LibEDA_BaseStruct
*
DrawItem
,
int
Multi
,
LibEDA_BaseStruct
*
aDrawItem
,
int
DrawMode
,
int
Color
=
-
1
);
int
aDrawMode
,
int
a
Color
=
-
1
);
bool
MapAngles
(
int
*
Angle1
,
int
*
Angle2
,
int
TransMat
[
2
][
2
]);
bool
MapAngles
(
int
*
Angle1
,
int
*
Angle2
,
int
TransMat
[
2
][
2
]);
...
...
eeschema/symbdraw.cpp
View file @
c65942e1
...
@@ -60,8 +60,8 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
...
@@ -60,8 +60,8 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
m_Parent
->
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
m_Parent
->
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
DrawLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
CurrentLibEntry
,
wxPoint
(
0
,
0
)
,
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
CurrentDrawItem
,
g_XorMode
);
if
(
g_FlDrawSpecificUnit
)
if
(
g_FlDrawSpecificUnit
)
CurrentDrawItem
->
m_Unit
=
CurrentUnit
;
CurrentDrawItem
->
m_Unit
=
CurrentUnit
;
...
@@ -104,8 +104,8 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
...
@@ -104,8 +104,8 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
m_Parent
->
GetScreen
()
->
SetModify
();
m_Parent
->
GetScreen
()
->
SetModify
();
DrawLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
CurrentLibEntry
,
wxPoint
(
0
,
0
)
,
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
CurrentDrawItem
,
g_XorMode
);
}
}
Close
();
Close
();
...
@@ -150,8 +150,8 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -150,8 +150,8 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel
->
m_Parent
->
RedrawActiveWindow
(
DC
,
TRUE
);
Panel
->
m_Parent
->
RedrawActiveWindow
(
DC
,
TRUE
);
}
}
else
else
DrawLibraryDrawStruct
(
Panel
,
DC
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
Panel
,
DC
,
CurrentLibEntry
,
wxPoint
(
0
,
0
)
,
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
CurrentDrawItem
,
g_XorMode
);
SAFE_DELETE
(
CurrentDrawItem
);
SAFE_DELETE
(
CurrentDrawItem
);
}
}
else
else
...
@@ -161,8 +161,8 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -161,8 +161,8 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel
->
GetScreen
()
->
m_Curseur
=
StartCursor
;
Panel
->
GetScreen
()
->
m_Curseur
=
StartCursor
;
RedrawWhileMovingCursor
(
Panel
,
DC
,
TRUE
);
RedrawWhileMovingCursor
(
Panel
,
DC
,
TRUE
);
Panel
->
GetScreen
()
->
m_Curseur
=
curpos
;
Panel
->
GetScreen
()
->
m_Curseur
=
curpos
;
DrawLibraryDrawStruct
(
Panel
,
DC
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
Panel
,
DC
,
CurrentLibEntry
,
wxPoint
(
0
,
0
)
,
CurrentDrawItem
,
CurrentUnit
,
GR_DEFAULT_DRAWMODE
);
CurrentDrawItem
,
GR_DEFAULT_DRAWMODE
);
CurrentDrawItem
->
m_Flags
=
0
;
CurrentDrawItem
->
m_Flags
=
0
;
}
}
...
@@ -303,8 +303,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
...
@@ -303,8 +303,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
else
else
{
{
StartMoveDrawSymbol
(
DC
);
StartMoveDrawSymbol
(
DC
);
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
wxPoint
(
0
,
0
)
,
Text
,
CurrentUnit
,
g_XorMode
);
Text
,
g_XorMode
);
}
}
}
}
break
;
break
;
...
@@ -383,23 +383,20 @@ static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool era
...
@@ -383,23 +383,20 @@ static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool era
*/
*/
{
{
BASE_SCREEN
*
Screen
=
panel
->
GetScreen
();
BASE_SCREEN
*
Screen
=
panel
->
GetScreen
();
int
mx
,
my
;
wxPoint
pos
;
/* Erase shape in the old positon*/
/* Erase shape in the old positon*/
if
(
erase
)
if
(
erase
)
{
{
mx
=
ItemPreviousPos
.
x
-
StartCursor
.
x
,
pos
=
ItemPreviousPos
-
StartCursor
,
my
=
ItemPreviousPos
.
y
-
StartCursor
.
y
;
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
pos
,
CurrentDrawItem
,
g_XorMode
);
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
mx
,
my
,
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
}
}
/* Redraw moved shape */
/* Redraw moved shape */
mx
=
Screen
->
m_Curseur
.
x
-
StartCursor
.
x
,
pos
=
Screen
->
m_Curseur
-
StartCursor
,
my
=
Screen
->
m_Curseur
.
y
-
StartCursor
.
y
;
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
pos
,
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
mx
,
my
,
CurrentDrawItem
,
g_XorMode
);
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
ItemPreviousPos
=
Screen
->
m_Curseur
;
ItemPreviousPos
=
Screen
->
m_Curseur
;
}
}
...
@@ -543,8 +540,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
...
@@ -543,8 +540,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
}
}
else
else
{
{
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
wxPoint
(
0
,
0
)
,
CurrentDrawItem
,
CurrentUnit
,
DrawMode
);
CurrentDrawItem
,
DrawMode
);
if
(
CurrentDrawItem
->
Type
()
==
COMPONENT_ARC_DRAW_TYPE
)
if
(
CurrentDrawItem
->
Type
()
==
COMPONENT_ARC_DRAW_TYPE
)
{
{
int
Color
=
ReturnLayerColor
(
LAYER_DEVICE
);
int
Color
=
ReturnLayerColor
(
LAYER_DEVICE
);
...
@@ -615,8 +612,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
...
@@ -615,8 +612,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
}
}
else
else
{
{
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
wxPoint
(
0
,
0
)
,
CurrentDrawItem
,
CurrentUnit
,
DrawMode
);
CurrentDrawItem
,
DrawMode
);
if
(
CurrentDrawItem
->
Type
()
==
COMPONENT_ARC_DRAW_TYPE
)
if
(
CurrentDrawItem
->
Type
()
==
COMPONENT_ARC_DRAW_TYPE
)
{
{
int
Color
=
ReturnLayerColor
(
LAYER_DEVICE
);
int
Color
=
ReturnLayerColor
(
LAYER_DEVICE
);
...
@@ -824,8 +821,8 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
...
@@ -824,8 +821,8 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
int
*
ptpoly
;
int
*
ptpoly
;
LibDrawPolyline
*
Poly
=
(
LibDrawPolyline
*
)
CurrentDrawItem
;
LibDrawPolyline
*
Poly
=
(
LibDrawPolyline
*
)
CurrentDrawItem
;
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
wxPoint
(
0
,
0
)
,
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
CurrentDrawItem
,
g_XorMode
);
while
(
Poly
->
m_CornersCount
>
2
)
// First segment is kept, only its end point is changed
while
(
Poly
->
m_CornersCount
>
2
)
// First segment is kept, only its end point is changed
{
{
...
@@ -843,6 +840,6 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
...
@@ -843,6 +840,6 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
int
allocsize
=
2
*
sizeof
(
int
)
*
Poly
->
m_CornersCount
;
int
allocsize
=
2
*
sizeof
(
int
)
*
Poly
->
m_CornersCount
;
Poly
->
m_PolyList
=
(
int
*
)
realloc
(
Poly
->
m_PolyList
,
allocsize
);
Poly
->
m_PolyList
=
(
int
*
)
realloc
(
Poly
->
m_PolyList
,
allocsize
);
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
wxPoint
(
0
,
0
)
,
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
CurrentDrawItem
,
g_XorMode
);
}
}
eeschema/symbtext.cpp
View file @
c65942e1
...
@@ -291,8 +291,8 @@ int DrawMode = g_XorMode;
...
@@ -291,8 +291,8 @@ int DrawMode = g_XorMode;
/* Effacement ancien texte */
/* Effacement ancien texte */
if
(
((
LibDrawText
*
)
DrawItem
)
->
m_Text
&&
DC
)
if
(
((
LibDrawText
*
)
DrawItem
)
->
m_Text
&&
DC
)
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
wxPoint
(
0
,
0
)
,
DrawItem
,
CurrentUnit
,
DrawMode
);
DrawItem
,
DrawMode
);
WinEDA_bodytext_PropertiesFrame
*
frame
=
WinEDA_bodytext_PropertiesFrame
*
frame
=
...
@@ -306,8 +306,8 @@ int DrawMode = g_XorMode;
...
@@ -306,8 +306,8 @@ int DrawMode = g_XorMode;
{
{
if
(
(
DrawItem
->
m_Flags
&
IS_MOVED
)
==
0
)
if
(
(
DrawItem
->
m_Flags
&
IS_MOVED
)
==
0
)
DrawMode
=
GR_DEFAULT_DRAWMODE
;
DrawMode
=
GR_DEFAULT_DRAWMODE
;
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
wxPoint
(
0
,
0
)
,
DrawItem
,
CurrentUnit
,
DrawMode
);
DrawItem
,
DrawMode
);
}
}
}
}
...
@@ -325,8 +325,8 @@ LibDrawText * DrawItem = (LibDrawText *) CurrentDrawItem;
...
@@ -325,8 +325,8 @@ LibDrawText * DrawItem = (LibDrawText *) CurrentDrawItem;
/* Erase drawing (can be within a move command) */
/* Erase drawing (can be within a move command) */
if
(
DrawPanel
->
ManageCurseur
==
NULL
)
if
(
DrawPanel
->
ManageCurseur
==
NULL
)
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
wxPoint
(
0
,
0
)
,
DrawItem
,
CurrentUnit
,
g_XorMode
);
DrawItem
,
g_XorMode
);
else
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
else
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
if
(
DrawItem
->
m_Horiz
==
TEXT_ORIENT_HORIZ
)
if
(
DrawItem
->
m_Horiz
==
TEXT_ORIENT_HORIZ
)
...
@@ -337,8 +337,8 @@ LibDrawText * DrawItem = (LibDrawText *) CurrentDrawItem;
...
@@ -337,8 +337,8 @@ LibDrawText * DrawItem = (LibDrawText *) CurrentDrawItem;
/* Redraw item with new orient */
/* Redraw item with new orient */
if
(
DrawPanel
->
ManageCurseur
==
NULL
)
if
(
DrawPanel
->
ManageCurseur
==
NULL
)
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
wxPoint
(
0
,
0
)
,
DrawItem
,
CurrentUnit
,
GR_DEFAULT_DRAWMODE
);
DrawItem
,
GR_DEFAULT_DRAWMODE
);
else
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
else
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
}
}
...
...
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