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
2f99ef29
Commit
2f99ef29
authored
Sep 13, 2008
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eeschema: code cleaning
parent
a178978c
Changes
21
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
1493 additions
and
1217 deletions
+1493
-1217
CMakeLists.txt
eeschema/CMakeLists.txt
+2
-0
block_libedit.cpp
eeschema/block_libedit.cpp
+6
-6
class_library.h
eeschema/class_library.h
+135
-0
class_pin.cpp
eeschema/class_pin.cpp
+426
-0
classes_body_items.cpp
eeschema/classes_body_items.cpp
+283
-0
classes_body_items.h
eeschema/classes_body_items.h
+419
-0
eelibs_draw_components.cpp
eeschema/eelibs_draw_components.cpp
+123
-438
eelibs_read_libraryfiles.cpp
eeschema/eelibs_read_libraryfiles.cpp
+9
-9
eestring.cpp
eeschema/eestring.cpp
+0
-254
general.h
eeschema/general.h
+8
-1
libclass.cpp
eeschema/libclass.cpp
+19
-19
libcmp.h
eeschema/libcmp.h
+18
-455
libedit_onrightclick.cpp
eeschema/libedit_onrightclick.cpp
+1
-1
locate.cpp
eeschema/locate.cpp
+2
-2
makefile.include
eeschema/makefile.include
+2
-0
plot.cpp
eeschema/plot.cpp
+6
-6
protos.h
eeschema/protos.h
+9
-1
savelib.cpp
eeschema/savelib.cpp
+3
-3
symbdraw.cpp
eeschema/symbdraw.cpp
+13
-13
symbedit.cpp
eeschema/symbedit.cpp
+7
-7
libs.win
libs.win
+2
-2
No files found.
eeschema/CMakeLists.txt
View file @
2f99ef29
...
@@ -14,9 +14,11 @@ set(EESCHEMA_SRCS
...
@@ -14,9 +14,11 @@ set(EESCHEMA_SRCS
bus-wire-junction.cpp
bus-wire-junction.cpp
class_drawsheet.cpp
class_drawsheet.cpp
class_hierarchical_PIN_sheet.cpp
class_hierarchical_PIN_sheet.cpp
class_pin.cpp
class_schematic_items.cpp
class_schematic_items.cpp
class_screen.cpp
class_screen.cpp
class_text-label.cpp
class_text-label.cpp
classes_body_items.cpp
cleanup.cpp
cleanup.cpp
component_class.cpp
component_class.cpp
controle.cpp
controle.cpp
...
...
eeschema/block_libedit.cpp
View file @
2f99ef29
...
@@ -139,8 +139,8 @@ int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent,
...
@@ -139,8 +139,8 @@ int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent,
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
{
{
int
ii
,
imax
=
(
(
LibDrawPolyline
*
)
item
)
->
n
*
2
;
int
ii
,
imax
=
(
(
LibDrawPolyline
*
)
item
)
->
m_CornersCount
*
2
;
int
*
ptpoly
=
(
(
LibDrawPolyline
*
)
item
)
->
PolyList
;
int
*
ptpoly
=
(
(
LibDrawPolyline
*
)
item
)
->
m_
PolyList
;
for
(
ii
=
0
;
ii
<
imax
;
ii
+=
2
)
for
(
ii
=
0
;
ii
<
imax
;
ii
+=
2
)
{
{
pos
.
x
=
ptpoly
[
ii
];
pos
.
y
=
-
ptpoly
[
ii
+
1
];
pos
.
x
=
ptpoly
[
ii
];
pos
.
y
=
-
ptpoly
[
ii
+
1
];
...
@@ -577,8 +577,8 @@ void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
...
@@ -577,8 +577,8 @@ void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
{
{
int
ii
,
imax
=
(
(
LibDrawPolyline
*
)
item
)
->
n
*
2
;
int
ii
,
imax
=
(
(
LibDrawPolyline
*
)
item
)
->
m_CornersCount
*
2
;
int
*
ptpoly
=
(
(
LibDrawPolyline
*
)
item
)
->
PolyList
;
int
*
ptpoly
=
(
(
LibDrawPolyline
*
)
item
)
->
m_
PolyList
;
for
(
ii
=
0
;
ii
<
imax
;
ii
+=
2
)
for
(
ii
=
0
;
ii
<
imax
;
ii
+=
2
)
{
{
ptpoly
[
ii
]
+=
offset
.
x
;
ptpoly
[
ii
]
+=
offset
.
x
;
...
@@ -689,8 +689,8 @@ void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
...
@@ -689,8 +689,8 @@ void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
{
{
int
ii
,
imax
=
(
(
LibDrawPolyline
*
)
item
)
->
n
*
2
;
int
ii
,
imax
=
(
(
LibDrawPolyline
*
)
item
)
->
m_CornersCount
*
2
;
int
*
ptpoly
=
(
(
LibDrawPolyline
*
)
item
)
->
PolyList
;
int
*
ptpoly
=
(
(
LibDrawPolyline
*
)
item
)
->
m_
PolyList
;
for
(
ii
=
0
;
ii
<
imax
;
ii
+=
2
)
for
(
ii
=
0
;
ii
<
imax
;
ii
+=
2
)
{
{
SETMIRROR
(
ptpoly
[
ii
]
);
SETMIRROR
(
ptpoly
[
ii
]
);
...
...
eeschema/class_library.h
0 → 100644
View file @
2f99ef29
/****************************************************************/
/* Headers fo library definition and lib component definitions */
/****************************************************************/
#ifndef CLASS_LIBRARY_H
#define CLASS_LIBRARY_H
/* Types for components in libraries
* components can be a true component or an alias of a true component.
*/
enum
LibrEntryType
{
ROOT
,
/* This is a true component standard EDA_LibComponentStruct */
ALIAS
/* This is an alias of a true component */
};
/* values for member .m_Options */
enum
LibrEntryOptions
{
ENTRY_NORMAL
,
// Libentry is a standard component (real or alias)
ENTRY_POWER
// Libentry is a power symbol
};
/******************************/
/* Classe to handle a library */
/******************************/
class
LibraryStruct
{
public
:
int
m_Type
;
/* type indicator */
wxString
m_Name
;
/* Short Name of the loaded library (without path). */
wxString
m_FullFileName
;
/* Full File Name (with path) of library. */
wxString
m_Header
;
/* first line of loaded library. */
int
m_NumOfParts
;
/* Number of parts this library has. */
PriorQue
*
m_Entries
;
/* Parts themselves are saved here. */
LibraryStruct
*
m_Pnext
;
/* Point on next lib in chain. */
int
m_Modified
;
/* flag indicateur d'edition */
int
m_Size
;
// Size in bytes (for statistics)
unsigned
long
m_TimeStamp
;
// Signature temporelle
int
m_Flags
;
// variable used in some functions
bool
m_IsLibCache
;
/* False for the "standard" libraries,
* True for the library cache */
public
:
LibraryStruct
(
int
type
,
const
wxString
&
name
,
const
wxString
&
fullname
);
~
LibraryStruct
();
bool
WriteHeader
(
FILE
*
file
);
bool
ReadHeader
(
FILE
*
file
,
int
*
LineNum
);
};
#include "classes_body_items.h"
/* basic class to describe components in libraries (true component or alias), non used directly */
class
LibCmpEntry
:
public
EDA_BaseStruct
{
public
:
LibrEntryType
Type
;
/* Type = ROOT;
* = ALIAS pour struct LibraryAliasType */
LibDrawField
m_Name
;
// name (74LS00 ..) in lib ( = VALUE )
wxString
m_Doc
;
/* documentation for info */
wxString
m_KeyWord
;
/* keyword list (used to select a group of components by keyword) */
wxString
m_DocFile
;
/* Associed doc filename */
LibrEntryOptions
m_Options
;
// special features (i.e. Entry is a POWER)
public
:
LibCmpEntry
(
LibrEntryType
CmpType
,
const
wxChar
*
CmpName
);
virtual
~
LibCmpEntry
();
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibCmpEntry"
);
}
bool
WriteDescr
(
FILE
*
File
);
};
/*********************************************/
/* class to handle an usual component in lib */
/*********************************************/
class
EDA_LibComponentStruct
:
public
LibCmpEntry
{
public
:
LibDrawField
m_Prefix
;
/* Prefix ( U, IC ... ) = REFERENCE */
wxArrayString
m_AliasList
;
/* ALIAS list for the component */
wxArrayString
m_FootprintList
;
/* list of suitable footprint names for the component (wildcard names accepted)*/
int
m_UnitCount
;
/* Units (or sections) per package */
bool
m_UnitSelectionLocked
;
// True if units are differents and their selection is locked
// (i.e. if part A cannot be automatically changed in part B
int
m_TextInside
;
/* if 0: pin name drawn on the pin itself
* if > 0 pin name drawn inside the component,
* with a distance of m_TextInside in mils */
bool
m_DrawPinNum
;
bool
m_DrawPinName
;
LibDrawField
*
Fields
;
/* Auxiliairy Field list (id = 2 a 11) */
LibEDA_BaseStruct
*
m_Drawings
;
/* How to draw this part */
long
m_LastDate
;
// Last change Date
public
:
virtual
wxString
GetClass
()
const
{
return
wxT
(
"EDA_LibComponentStruct"
);
}
EDA_LibComponentStruct
(
const
wxChar
*
CmpName
);
EDA_Rect
GetBoundaryBox
(
int
Unit
,
int
Convert
);
/* return Box around the part. */
~
EDA_LibComponentStruct
();
void
SortDrawItems
();
};
/**************************************************************************/
/* class to handle an alias of an usual component in lib (root component) */
/**************************************************************************/
class
EDA_LibCmpAliasStruct
:
public
LibCmpEntry
{
public
:
wxString
m_RootName
;
/* Root component Part name */
public
:
EDA_LibCmpAliasStruct
(
const
wxChar
*
CmpName
,
const
wxChar
*
CmpRootName
);
~
EDA_LibCmpAliasStruct
();
virtual
wxString
GetClass
()
const
{
return
wxT
(
"EDA_LibCmpAliasStruct"
);
}
};
#endif // CLASS_LIBRARY_H
eeschema/class_pin.cpp
0 → 100644
View file @
2f99ef29
/*****************/
/* class_pin.cpp */
/*****************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
#include "libcmp.h"
#include "general.h"
#include "protos.h"
/**********************************************************************************************/
void
LibDrawPin
::
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
)
/**********************************************************************************************/
{
if
(
(
m_Attributs
&
PINNOTDRAW
)
&&
!
g_ShowAllPins
)
return
;
EDA_LibComponentStruct
*
Entry
=
(
(
DrawPinPrms
*
)
aData
)
->
m_Entry
;
bool
DrawPinText
=
(
(
DrawPinPrms
*
)
aData
)
->
m_DrawPinText
;
/* Calculate Pin orient takin in account the component orientation */
int
orient
=
ReturnPinDrawOrient
(
aTransformMatrix
);
/* Calculate the pin position */
wxPoint
pos1
=
TransformCoordinate
(
aTransformMatrix
,
m_Pos
)
+
aOffset
;
/* Dessin de la pin et du symbole special associe */
DrawPinSymbol
(
aPanel
,
aDC
,
pos1
,
orient
,
aDrawMode
,
aColor
);
if
(
DrawPinText
)
{
DrawPinTexts
(
aPanel
,
aDC
,
pos1
,
orient
,
Entry
->
m_TextInside
,
Entry
->
m_DrawPinNum
,
Entry
->
m_DrawPinName
,
aColor
,
aDrawMode
);
}
}
/********************************************************************************/
void
LibDrawPin
::
DrawPinSymbol
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aPinPos
,
int
aOrient
,
int
aDrawMode
,
int
aColor
)
/*******************************************************************************/
/* Draw the pin symbol (without texts)
* if Color != 0 draw with Color, else with the normal pin color
*/
{
int
MapX1
,
MapY1
,
x1
,
y1
;
int
color
;
int
width
=
MAX
(
m_Width
,
g_DrawMinimunLineWidth
);
int
posX
=
aPinPos
.
x
,
posY
=
aPinPos
.
y
,
len
=
m_PinLen
;
color
=
ReturnLayerColor
(
LAYER_PIN
);
if
(
aColor
<
0
)
// Used normal color or selected color
{
if
(
(
m_Selected
&
IS_SELECTED
)
)
color
=
g_ItemSelectetColor
;
}
else
color
=
aColor
;
GRSetDrawMode
(
aDC
,
aDrawMode
);
MapX1
=
MapY1
=
0
;
x1
=
posX
;
y1
=
posY
;
switch
(
aOrient
)
{
case
PIN_UP
:
y1
=
posY
-
len
;
MapY1
=
1
;
break
;
case
PIN_DOWN
:
y1
=
posY
+
len
;
MapY1
=
-
1
;
break
;
case
PIN_LEFT
:
x1
=
posX
-
len
,
MapX1
=
1
;
break
;
case
PIN_RIGHT
:
x1
=
posX
+
len
;
MapX1
=
-
1
;
break
;
}
if
(
m_PinShape
&
INVERT
)
{
GRCircle
(
&
aPanel
->
m_ClipBox
,
aDC
,
MapX1
*
INVERT_PIN_RADIUS
+
x1
,
MapY1
*
INVERT_PIN_RADIUS
+
y1
,
INVERT_PIN_RADIUS
,
width
,
color
);
GRMoveTo
(
MapX1
*
INVERT_PIN_RADIUS
*
2
+
x1
,
MapY1
*
INVERT_PIN_RADIUS
*
2
+
y1
);
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
posX
,
posY
,
width
,
color
);
}
else
{
GRMoveTo
(
x1
,
y1
);
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
posX
,
posY
,
width
,
color
);
}
if
(
m_PinShape
&
CLOCK
)
{
if
(
MapY1
==
0
)
/* MapX1 = +- 1 */
{
GRMoveTo
(
x1
,
y1
+
CLOCK_PIN_DIM
);
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
x1
-
MapX1
*
CLOCK_PIN_DIM
,
y1
,
width
,
color
);
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
x1
,
y1
-
CLOCK_PIN_DIM
,
width
,
color
);
}
else
/* MapX1 = 0 */
{
GRMoveTo
(
x1
+
CLOCK_PIN_DIM
,
y1
);
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
x1
,
y1
-
MapY1
*
CLOCK_PIN_DIM
,
width
,
color
);
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
x1
-
CLOCK_PIN_DIM
,
y1
,
width
,
color
);
}
}
if
(
m_PinShape
&
LOWLEVEL_IN
)
/* IEEE symbol "Active Low Input" */
{
if
(
MapY1
==
0
)
/* MapX1 = +- 1 */
{
GRMoveTo
(
x1
+
MapX1
*
IEEE_SYMBOL_PIN_DIM
*
2
,
y1
);
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
x1
+
MapX1
*
IEEE_SYMBOL_PIN_DIM
*
2
,
y1
-
IEEE_SYMBOL_PIN_DIM
,
width
,
color
);
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
x1
,
y1
,
width
,
color
);
}
else
/* MapX1 = 0 */
{
GRMoveTo
(
x1
,
y1
+
MapY1
*
IEEE_SYMBOL_PIN_DIM
*
2
);
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
x1
-
IEEE_SYMBOL_PIN_DIM
,
y1
+
MapY1
*
IEEE_SYMBOL_PIN_DIM
*
2
,
width
,
color
);
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
x1
,
y1
,
width
,
color
);
}
}
if
(
m_PinShape
&
LOWLEVEL_OUT
)
/* IEEE symbol "Active Low Output" */
{
if
(
MapY1
==
0
)
/* MapX1 = +- 1 */
{
GRMoveTo
(
x1
,
y1
-
IEEE_SYMBOL_PIN_DIM
);
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
x1
+
MapX1
*
IEEE_SYMBOL_PIN_DIM
*
2
,
y1
,
width
,
color
);
}
else
/* MapX1 = 0 */
{
GRMoveTo
(
x1
-
IEEE_SYMBOL_PIN_DIM
,
y1
);
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
x1
,
y1
+
MapY1
*
IEEE_SYMBOL_PIN_DIM
*
2
,
width
,
color
);
}
}
/* Draw the pin end target (active end of the pin) */
if
(
!
g_IsPrinting
)
// Draw but do not print the pin end target 1 pixel width */
GRCircle
(
&
aPanel
->
m_ClipBox
,
aDC
,
posX
,
posY
,
TARGET_PIN_DIAM
,
0
,
color
);
}
/*****************************************************************************
* Put out pin number and pin text info, given the pin line coordinates.
* The line must be vertical or horizontal.
* If PinText == NULL nothing is printed. If PinNum = 0 no number is printed.
* Current Zoom factor is taken into account.
* If TextInside then the text is been put inside,otherwise all is drawn outside.
* Pin Name: substring beteween '~' is negated
*****************************************************************************/
void
LibDrawPin
::
DrawPinTexts
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
wxPoint
&
pin_pos
,
int
orient
,
int
TextInside
,
bool
DrawPinNum
,
bool
DrawPinName
,
int
Color
,
int
DrawMode
)
/* DrawMode = GR_OR, XOR ... */
{
int
ii
,
x
,
y
,
x1
,
y1
,
dx
,
dy
,
len
;
wxString
StringPinNum
;
wxString
PinText
;
int
PinTextBarPos
[
256
];
int
PinTextBarCount
;
int
NameColor
,
NumColor
;
int
PinTxtLen
;
wxSize
PinNameSize
(
m_PinNameSize
,
m_PinNameSize
);
wxSize
PinNumSize
(
m_PinNumSize
,
m_PinNumSize
);
int
LineWidth
=
g_DrawMinimunLineWidth
;
GRSetDrawMode
(
DC
,
DrawMode
);
/* Get the num and name colors */
if
(
(
Color
<
0
)
&&
(
m_Selected
&
IS_SELECTED
)
)
Color
=
g_ItemSelectetColor
;
NameColor
=
Color
==
-
1
?
ReturnLayerColor
(
LAYER_PINNAM
)
:
Color
;
NumColor
=
Color
==
-
1
?
ReturnLayerColor
(
LAYER_PINNUM
)
:
Color
;
/* Create the pin num string */
ReturnPinStringNum
(
StringPinNum
);
x1
=
pin_pos
.
x
;
y1
=
pin_pos
.
y
;
switch
(
orient
)
{
case
PIN_UP
:
y1
-=
m_PinLen
;
break
;
case
PIN_DOWN
:
y1
+=
m_PinLen
;
break
;
case
PIN_LEFT
:
x1
-=
m_PinLen
;
break
;
case
PIN_RIGHT
:
x1
+=
m_PinLen
;
break
;
}
const
wxChar
*
textsrc
=
m_PinName
.
GetData
();
float
fPinTextPitch
=
PinNameSize
.
x
*
1.1
;
/* Do we need to invert the string? Is this string has only "~"? */
PinTextBarCount
=
0
;
PinTxtLen
=
0
;
ii
=
0
;
while
(
*
textsrc
)
{
if
(
*
textsrc
==
'~'
)
{
PinTextBarPos
[
PinTextBarCount
++
]
=
(
int
)
(
PinTxtLen
*
fPinTextPitch
);
}
else
{
PinText
.
Append
(
*
textsrc
);
PinTxtLen
++
;
}
textsrc
++
;
}
PinTxtLen
=
(
int
)
(
fPinTextPitch
*
PinTxtLen
);
PinTextBarPos
[
PinTextBarCount
]
=
PinTxtLen
;
// Needed if no end '~'
if
(
PinText
[
0
]
==
0
)
DrawPinName
=
FALSE
;
if
(
TextInside
)
/* Draw the text inside, but the pin numbers outside. */
{
if
(
(
orient
==
PIN_LEFT
)
||
(
orient
==
PIN_RIGHT
)
)
// It is an horizontal line
{
if
(
PinText
&&
DrawPinName
)
{
if
(
orient
==
PIN_RIGHT
)
{
x
=
x1
+
TextInside
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x
,
y1
),
NameColor
,
PinText
,
TEXT_ORIENT_HORIZ
,
PinNameSize
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
for
(
ii
=
0
;
ii
<
PinTextBarCount
;
)
{
GRMoveTo
(
x
,
y1
-
TXTMARGE
);
dy
=
-
PinNameSize
.
y
/
2
;
GRMoveRel
(
0
,
dy
);
dx
=
PinTextBarPos
[
ii
++
];
// Get the line pos
GRMoveRel
(
dx
,
0
);
len
=
PinTextBarPos
[
ii
++
]
-
dx
;
// Get the line length
GRLineRel
(
&
panel
->
m_ClipBox
,
DC
,
len
,
0
,
LineWidth
,
NameColor
);
}
}
else
// Orient == PIN_LEFT
{
x
=
x1
-
TextInside
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x
,
y1
),
NameColor
,
PinText
,
TEXT_ORIENT_HORIZ
,
PinNameSize
,
GR_TEXT_HJUSTIFY_RIGHT
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
for
(
ii
=
0
;
ii
<
PinTextBarCount
;
)
{
GRMoveTo
(
x
,
y1
-
TXTMARGE
);
dy
=
-
PinNameSize
.
y
/
2
;
GRMoveRel
(
0
,
dy
);
dx
=
PinTextBarPos
[
ii
++
];
// Get the line pos
GRMoveRel
(
dx
-
PinTxtLen
,
0
);
len
=
PinTextBarPos
[
ii
++
]
-
dx
;
// Get the line length
GRLineRel
(
&
panel
->
m_ClipBox
,
DC
,
len
,
0
,
LineWidth
,
NameColor
);
}
}
}
if
(
DrawPinNum
)
{
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
(
x1
+
pin_pos
.
x
)
/
2
,
y1
-
TXTMARGE
),
NumColor
,
StringPinNum
,
TEXT_ORIENT_HORIZ
,
PinNumSize
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_BOTTOM
,
LineWidth
);
}
}
else
/* Its a vertical line. */
{
// Text is drawn from bottom to top (i.e. to negative value for Y axis)
if
(
PinText
&&
DrawPinName
)
{
if
(
orient
==
PIN_DOWN
)
{
y
=
y1
+
TextInside
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
,
y
),
NameColor
,
PinText
,
TEXT_ORIENT_VERT
,
PinNameSize
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_TOP
,
LineWidth
);
for
(
ii
=
0
;
ii
<
PinTextBarCount
;
)
{
GRMoveTo
(
x1
-
TXTMARGE
,
y
);
dy
=
-
PinNameSize
.
y
/
2
;
GRMoveRel
(
dy
,
0
);
dx
=
PinTextBarPos
[
ii
++
];
// Get the line pos
GRMoveRel
(
0
,
PinTxtLen
-
dx
);
len
=
PinTextBarPos
[
ii
++
]
-
dx
;
// Get the line length
GRLineRel
(
&
panel
->
m_ClipBox
,
DC
,
0
,
-
len
,
LineWidth
,
NameColor
);
}
}
else
/* PIN_UP */
{
y
=
y1
-
TextInside
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
,
y
),
NameColor
,
PinText
,
TEXT_ORIENT_VERT
,
PinNameSize
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_BOTTOM
,
LineWidth
);
for
(
ii
=
0
;
ii
<
PinTextBarCount
;
)
{
GRMoveTo
(
x1
-
TXTMARGE
,
y
);
dy
=
-
PinNameSize
.
y
/
2
;
GRMoveRel
(
dy
,
0
);
dx
=
PinTextBarPos
[
ii
++
];
// Get the line pos
GRMoveRel
(
0
,
-
dx
);
len
=
PinTextBarPos
[
ii
++
]
-
dx
;
// Get the line length
GRLineRel
(
&
panel
->
m_ClipBox
,
DC
,
0
,
-
len
,
LineWidth
,
NameColor
);
}
}
}
if
(
DrawPinNum
)
{
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
-
TXTMARGE
,
(
y1
+
pin_pos
.
y
)
/
2
),
NumColor
,
StringPinNum
,
TEXT_ORIENT_VERT
,
PinNumSize
,
GR_TEXT_HJUSTIFY_RIGHT
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
}
}
}
else
/**** Draw num & text pin outside ****/
{
if
(
(
orient
==
PIN_LEFT
)
||
(
orient
==
PIN_RIGHT
)
)
/* Its an horizontal line. */
{
if
(
PinText
&&
DrawPinName
)
{
x
=
(
x1
+
pin_pos
.
x
)
/
2
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x
,
y1
-
TXTMARGE
),
NameColor
,
PinText
,
TEXT_ORIENT_HORIZ
,
PinNameSize
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_BOTTOM
,
LineWidth
);
for
(
ii
=
0
;
ii
<
PinTextBarCount
;
)
{
GRMoveTo
(
x
,
y1
-
TXTMARGE
*
2
);
GRMoveRel
(
-
PinTxtLen
/
2
,
-
PinNameSize
.
y
);
dx
=
PinTextBarPos
[
ii
++
];
// Get the line pos
GRMoveRel
(
dx
,
0
);
len
=
PinTextBarPos
[
ii
++
]
-
dx
;
// Get the line length
GRLineRel
(
&
panel
->
m_ClipBox
,
DC
,
len
,
0
,
LineWidth
,
NameColor
);
}
}
if
(
DrawPinNum
)
{
x
=
(
x1
+
pin_pos
.
x
)
/
2
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x
,
y1
+
TXTMARGE
),
NumColor
,
StringPinNum
,
TEXT_ORIENT_HORIZ
,
PinNumSize
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_TOP
,
LineWidth
);
}
}
else
/* Its a vertical line. */
{
if
(
PinText
&&
DrawPinName
)
{
y
=
(
y1
+
pin_pos
.
y
)
/
2
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
-
TXTMARGE
,
y
),
NameColor
,
PinText
,
TEXT_ORIENT_VERT
,
PinNameSize
,
GR_TEXT_HJUSTIFY_RIGHT
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
for
(
ii
=
0
;
ii
<
PinTextBarCount
;
)
{
GRMoveTo
(
x1
-
(
TXTMARGE
*
2
),
y
);
GRMoveRel
(
-
PinNameSize
.
y
,
-
PinTxtLen
/
2
);
dx
=
PinTextBarPos
[
ii
++
];
// Get the line pos
GRMoveRel
(
0
,
PinTxtLen
-
dx
);
len
=
PinTextBarPos
[
ii
++
]
-
dx
;
// Get the line length
GRLineRel
(
&
panel
->
m_ClipBox
,
DC
,
0
,
-
len
,
LineWidth
,
NameColor
);
}
}
if
(
DrawPinNum
)
{
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
+
TXTMARGE
,
(
y1
+
pin_pos
.
y
)
/
2
),
NumColor
,
StringPinNum
,
TEXT_ORIENT_VERT
,
PinNumSize
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
}
}
}
}
eeschema/classes_body_items.cpp
0 → 100644
View file @
2f99ef29
/************************/
/* class_body_items.cpp */
/************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
#include "libcmp.h"
#include "general.h"
#include "protos.h"
//#define DRAW_ARC_WITH_ANGLE // Used to draw arcs
/** Function Draw (virtual)
* Draw A body item
* @param aPanel = DrawPanel to use (can be null) mainly used for clipping purposes
* @param aDC = Device Context (can be null)
* @param aOffset = offset to draw
* @param aDrawMode = GR_OR, GR_XOR, ...
* @param aDisplay_mode = FILL_T value ( has meaning only for items what can be filled )
* @param aTransformMatrix = Transform Matrix
*/
/**********************************************************************************************/
void
LibDrawArc
::
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
)
/**********************************************************************************************/
{
wxPoint
pos1
,
pos2
,
posc
;
int
color
=
ReturnLayerColor
(
LAYER_DEVICE
);
int
LineWidth
=
MAX
(
m_Width
,
g_DrawMinimunLineWidth
);
if
(
aColor
<
0
)
// Used normal color or selected color
{
if
(
(
m_Selected
&
IS_SELECTED
)
)
color
=
g_ItemSelectetColor
;
}
else
color
=
aColor
;
pos1
=
TransformCoordinate
(
aTransformMatrix
,
m_ArcEnd
)
+
aOffset
;
pos2
=
TransformCoordinate
(
aTransformMatrix
,
m_ArcStart
)
+
aOffset
;
posc
=
TransformCoordinate
(
aTransformMatrix
,
m_Pos
)
+
aOffset
;
int
pt1
=
t1
;
int
pt2
=
t2
;
bool
swap
=
MapAngles
(
&
pt1
,
&
pt2
,
aTransformMatrix
);
if
(
swap
)
{
EXCHG
(
pos1
.
x
,
pos2
.
x
);
EXCHG
(
pos1
.
y
,
pos2
.
y
)
}
GRSetDrawMode
(
aDC
,
aDrawMode
);
FILL_T
fill
=
aData
?
NO_FILL
:
m_Fill
;
if
(
aColor
>=
0
)
fill
=
NO_FILL
;
if
(
fill
==
FILLED_WITH_BG_BODYCOLOR
)
GRFilledArc
(
&
aPanel
->
m_ClipBox
,
aDC
,
posc
.
x
,
posc
.
y
,
pt1
,
pt2
,
m_Rayon
,
LineWidth
,
color
,
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
)
);
else
if
(
fill
==
FILLED_SHAPE
&&
!
aData
)
GRFilledArc
(
&
aPanel
->
m_ClipBox
,
aDC
,
posc
.
x
,
posc
.
y
,
pt1
,
pt2
,
m_Rayon
,
color
,
color
);
else
#ifdef DRAW_ARC_WITH_ANGLE
GRArc
(
&
aPanel
->
m_ClipBox
,
aDC
,
posc
.
x
,
posc
.
y
,
pt1
,
pt2
,
m_Rayon
,
LineWidth
,
color
);
#else
GRArc1
(
&
aPanel
->
m_ClipBox
,
aDC
,
pos1
.
x
,
pos1
.
y
,
pos2
.
x
,
pos2
.
y
,
posc
.
x
,
posc
.
y
,
LineWidth
,
color
);
#endif
}
/*************************************************************************************************/
void
LibDrawCircle
::
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
)
/*************************************************************************************************/
{
wxPoint
pos1
;
int
color
=
ReturnLayerColor
(
LAYER_DEVICE
);
int
LineWidth
=
MAX
(
m_Width
,
g_DrawMinimunLineWidth
);
if
(
aColor
<
0
)
// Used normal color or selected color
{
if
(
(
m_Selected
&
IS_SELECTED
)
)
color
=
g_ItemSelectetColor
;
}
else
color
=
aColor
;
pos1
=
TransformCoordinate
(
aTransformMatrix
,
m_Pos
)
+
aOffset
;
GRSetDrawMode
(
aDC
,
aDrawMode
);
FILL_T
fill
=
aData
?
NO_FILL
:
m_Fill
;
if
(
aColor
>=
0
)
fill
=
NO_FILL
;
if
(
fill
==
FILLED_WITH_BG_BODYCOLOR
)
GRFilledCircle
(
&
aPanel
->
m_ClipBox
,
aDC
,
pos1
.
x
,
pos1
.
y
,
m_Rayon
,
LineWidth
,
color
,
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
)
);
else
if
(
fill
==
FILLED_SHAPE
)
GRFilledCircle
(
&
aPanel
->
m_ClipBox
,
aDC
,
pos1
.
x
,
pos1
.
y
,
m_Rayon
,
0
,
color
,
color
);
else
GRCircle
(
&
aPanel
->
m_ClipBox
,
aDC
,
pos1
.
x
,
pos1
.
y
,
m_Rayon
,
LineWidth
,
color
);
}
/*************************************************************************************************/
void
LibDrawText
::
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
)
/*************************************************************************************************/
{
wxPoint
pos1
,
pos2
;
int
color
=
ReturnLayerColor
(
LAYER_DEVICE
);
int
LineWidth
=
MAX
(
m_Width
,
g_DrawMinimunLineWidth
);
if
(
aColor
<
0
)
// Used normal color or selected color
{
if
(
(
m_Selected
&
IS_SELECTED
)
)
color
=
g_ItemSelectetColor
;
}
else
color
=
aColor
;
pos1
=
TransformCoordinate
(
aTransformMatrix
,
m_Pos
)
+
aOffset
;
/* The text orientation may need to be flipped if the
* transformation matrix causes xy axes to be flipped. */
int
t1
=
(
aTransformMatrix
[
0
][
0
]
!=
0
)
^
(
m_Horiz
!=
0
);
DrawGraphicText
(
aPanel
,
aDC
,
pos1
,
color
,
m_Text
,
t1
?
TEXT_ORIENT_HORIZ
:
TEXT_ORIENT_VERT
,
m_Size
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
}
/*************************************************************************************************/
void
LibDrawSquare
::
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
)
/*************************************************************************************************/
{
wxPoint
pos1
,
pos2
;
int
color
=
ReturnLayerColor
(
LAYER_DEVICE
);
int
LineWidth
=
MAX
(
m_Width
,
g_DrawMinimunLineWidth
);
if
(
aColor
<
0
)
// Used normal color or selected color
{
if
(
(
m_Selected
&
IS_SELECTED
)
)
color
=
g_ItemSelectetColor
;
}
else
color
=
aColor
;
pos1
=
TransformCoordinate
(
aTransformMatrix
,
m_Pos
)
+
aOffset
;
pos2
=
TransformCoordinate
(
aTransformMatrix
,
m_End
)
+
aOffset
;
FILL_T
fill
=
aData
?
NO_FILL
:
m_Fill
;
if
(
aColor
>=
0
)
fill
=
NO_FILL
;
if
(
fill
==
FILLED_WITH_BG_BODYCOLOR
&&
!
aData
)
GRFilledRect
(
&
aPanel
->
m_ClipBox
,
aDC
,
pos1
.
x
,
pos1
.
y
,
pos2
.
x
,
pos2
.
y
,
color
,
LineWidth
,
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
)
);
else
if
(
m_Fill
==
FILLED_SHAPE
&&
!
aData
)
GRFilledRect
(
&
aPanel
->
m_ClipBox
,
aDC
,
pos1
.
x
,
pos1
.
y
,
pos2
.
x
,
pos2
.
y
,
color
,
color
);
else
GRRect
(
&
aPanel
->
m_ClipBox
,
aDC
,
pos1
.
x
,
pos1
.
y
,
pos2
.
x
,
pos2
.
y
,
LineWidth
,
color
);
}
/*************************************************************************************************/
void
LibDrawSegment
::
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
)
/*************************************************************************************************/
{
wxPoint
pos1
,
pos2
;
int
color
=
ReturnLayerColor
(
LAYER_DEVICE
);
int
LineWidth
=
MAX
(
m_Width
,
g_DrawMinimunLineWidth
);
if
(
aColor
<
0
)
// Used normal color or selected color
{
if
(
(
m_Selected
&
IS_SELECTED
)
)
color
=
g_ItemSelectetColor
;
}
else
color
=
aColor
;
pos1
=
TransformCoordinate
(
aTransformMatrix
,
m_Pos
)
+
aOffset
;
pos2
=
TransformCoordinate
(
aTransformMatrix
,
m_End
)
+
aOffset
;
GRLine
(
&
aPanel
->
m_ClipBox
,
aDC
,
pos1
.
x
,
pos1
.
y
,
pos2
.
x
,
pos2
.
y
,
LineWidth
,
color
);
}
/*************************************************************************************************/
void
LibDrawPolyline
::
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
)
/*************************************************************************************************/
{
wxPoint
pos1
;
int
color
=
ReturnLayerColor
(
LAYER_DEVICE
);
int
LineWidth
=
MAX
(
m_Width
,
g_DrawMinimunLineWidth
);
static
int
*
Buf_Poly_Drawings
=
NULL
;
// Buffer used to store current corners coordinates for drawings
static
int
Buf_Poly_Size
=
0
;
// Buffer used to store current corners coordinates for drawings
if
(
aColor
<
0
)
// Used normal color or selected color
{
if
(
(
m_Selected
&
IS_SELECTED
)
)
color
=
g_ItemSelectetColor
;
}
else
color
=
aColor
;
// Set the size of the buffer od coordinates
if
(
Buf_Poly_Drawings
==
NULL
)
{
Buf_Poly_Size
=
m_CornersCount
;
Buf_Poly_Drawings
=
(
int
*
)
MyMalloc
(
sizeof
(
int
)
*
2
*
Buf_Poly_Size
);
}
else
if
(
Buf_Poly_Size
<
m_CornersCount
)
{
Buf_Poly_Size
=
m_CornersCount
;
Buf_Poly_Drawings
=
(
int
*
)
realloc
(
Buf_Poly_Drawings
,
sizeof
(
int
)
*
2
*
Buf_Poly_Size
);
}
for
(
int
ii
=
0
,
jj
=
0
;
ii
<
m_CornersCount
;
ii
++
,
jj
+=
2
)
{
pos1
.
x
=
m_PolyList
[
jj
];
pos1
.
y
=
m_PolyList
[
jj
+
1
];
pos1
=
TransformCoordinate
(
aTransformMatrix
,
pos1
)
+
aOffset
;
Buf_Poly_Drawings
[
jj
]
=
pos1
.
x
;
Buf_Poly_Drawings
[
jj
+
1
]
=
pos1
.
y
;
}
FILL_T
fill
=
aData
?
NO_FILL
:
m_Fill
;
if
(
aColor
>=
0
)
fill
=
NO_FILL
;
if
(
fill
==
FILLED_WITH_BG_BODYCOLOR
)
GRPoly
(
&
aPanel
->
m_ClipBox
,
aDC
,
m_CornersCount
,
Buf_Poly_Drawings
,
1
,
LineWidth
,
color
,
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
)
);
else
if
(
fill
==
FILLED_SHAPE
)
GRPoly
(
&
aPanel
->
m_ClipBox
,
aDC
,
m_CornersCount
,
Buf_Poly_Drawings
,
1
,
LineWidth
,
color
,
color
);
else
GRPoly
(
&
aPanel
->
m_ClipBox
,
aDC
,
m_CornersCount
,
Buf_Poly_Drawings
,
0
,
LineWidth
,
color
,
color
);
}
/*************************************************************************************************/
void
LibDrawField
::
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
)
/*************************************************************************************************/
{
}
eeschema/classes_body_items.h
0 → 100644
View file @
2f99ef29
/****************************************************************/
/* Headers fo library definition and lib component definitions */
/****************************************************************/
#ifndef CLASSES_BODY_ITEMS_H
#define CLASSES_BODY_ITEMS_H
#define TARGET_PIN_DIAM 12
/* Circle diameter drawn at the active end of pins */
#define DEFAULT_TEXT_SIZE 50
/* Default size for field texts */
#define PART_NAME_LEN 15
/* Maximum length of part name. */
#define PREFIX_NAME_LEN 5
/* Maximum length of prefix (IC, R, SW etc.). */
#define PIN_WIDTH 100
/* Width between 2 pins in internal units. */
#define PIN_LENGTH 300
/* Default Length of each pin to be drawn. */
#define INVERT_PIN_RADIUS 35
/* Radius of inverted pin circle. */
#define CLOCK_PIN_DIM 40
/* Dim of clock pin symbol. */
#define IEEE_SYMBOL_PIN_DIM 40
/* Dim of special pin symbol. */
/**
* Enum FILL_T
* is the set of fill types used in plotting or drawing enclosed areas.
*/
enum
FILL_T
{
NO_FILL
,
// Poly, Square, Circle, Arc = option No Fill
FILLED_SHAPE
,
// Poly, Square, Circle, Arc = option Fill with current color ("Solid shape")
FILLED_WITH_BG_BODYCOLOR
,
/* Poly, Square, Circle, Arc = option Fill with background body color,
* translucent (texts inside this shape can be seen)
* not filled in B&W mode when plotting or printing
*/
};
/**
* Enum ElectricPinType
* is the set of schematic pin types, used in ERC tests.
*/
enum
ElectricPinType
{
/* Type des Pins. si modif: modifier tableau des mgs suivant */
PIN_INPUT
,
PIN_OUTPUT
,
PIN_BIDI
,
PIN_TRISTATE
,
PIN_PASSIVE
,
PIN_UNSPECIFIED
,
PIN_POWER_IN
,
PIN_POWER_OUT
,
PIN_OPENCOLLECTOR
,
PIN_OPENEMITTER
,
PIN_NC
,
/* No connect */
PIN_NMAX
/* End of List (no used as pin type) */
};
/* Messages d'affichage du type electrique */
eda_global
const
wxChar
*
MsgPinElectricType
[]
#ifdef MAIN
=
{
wxT
(
"input"
),
wxT
(
"output"
),
wxT
(
"BiDi"
),
wxT
(
"3state"
),
wxT
(
"passive"
),
wxT
(
"unspc"
),
wxT
(
"power_in"
),
wxT
(
"power_out"
),
wxT
(
"openCol"
),
wxT
(
"openEm"
),
wxT
(
"?????"
)
}
#endif
;
/* Autres bits: bits du membre .Flag des Pins */
#define PINNOTDRAW 1
/* si 1: pin invisible */
/**
* Enum DrawPinShape
* is the set of shapes allowed for pins.
*/
enum
DrawPinShape
{
NONE
=
0
,
INVERT
=
1
,
CLOCK
=
2
,
LOWLEVEL_IN
=
4
,
LOWLEVEL_OUT
=
8
};
/**
* Enum DrawPinOrient
* is the set of orientations allowed for pins.
*/
enum
DrawPinOrient
{
PIN_RIGHT
=
'R'
,
PIN_LEFT
=
'L'
,
PIN_UP
=
'U'
,
PIN_DOWN
=
'D'
,
};
// Struct to pass parameters for drawing pins, in function Draw
class
DrawPinPrms
{
public
:
EDA_LibComponentStruct
*
m_Entry
;
// Pointer to the component in lib
bool
m_DrawPinText
;
// Are pin texts drawn ?
DrawPinPrms
(
EDA_LibComponentStruct
*
entry
,
bool
drawpintext
=
true
)
{
m_Entry
=
entry
;
m_DrawPinText
=
drawpintext
;
}
};
/****************************************************************************/
/* Classes for handle the body items of a compoment: pins add graphic items */
/****************************************************************************/
/* class LibEDA_BaseStruct : Basic class for items used in a library component
* (graphic shapes, texts, fields, pins)
*/
class
LibEDA_BaseStruct
:
public
EDA_BaseStruct
{
public
:
int
m_Unit
;
/* Unit identification (for multi part per parkage)
* 0 if the item is common to all units */
int
m_Convert
;
/* Shape identification (for parts which have a convert shape)
* 0 if the item is common to all shapes */
wxPoint
m_Pos
;
/* Position or centre (Arc and Circle) or start point (segments) */
int
m_Width
;
/* Tickness */
public
:
LibEDA_BaseStruct
*
Next
()
{
return
(
LibEDA_BaseStruct
*
)
Pnext
;
}
LibEDA_BaseStruct
(
KICAD_T
struct_type
);
virtual
~
LibEDA_BaseStruct
()
{
}
/** Function Draw (virtual pure)
* Draw A body item
* @param aPanel = DrawPanel to use (can be null) mainly used for clipping purposes
* @param aDC = Device Context (can be null)
* @param aOffset = offset to draw
* @param aColor = -1 to use the normal body item color, or use this color if >= 0
* @param aDrawMode = GR_OR, GR_XOR, ...
* @param aData = pointer used to pass others parametres, depending on body items.
* 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
* or to pass refernce to the lib component for pins
* @param aTransformMatrix = Transform Matrix
*/
virtual
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
)
=
0
;
void
Display_Infos_DrawEntry
(
WinEDA_DrawFrame
*
frame
);
};
/********/
/* Pins */
/********/
class
LibDrawPin
:
public
LibEDA_BaseStruct
{
public
:
int
m_PinLen
;
/* Pin lenght */
int
m_Orient
;
/* Pin orientation (Up, Down, Left, Right) */
int
m_PinShape
;
/* Bitwise ORed: Pin shape (see enum DrawPinShape) */
int
m_PinType
;
/* Electrical pin properties */
int
m_Attributs
;
/* bit 0 != 0: pin invisible */
long
m_PinNum
;
/* Pin number: 4 Ascii code like "12" or "anod" or "G6"
* "12" is stored as "12\0\0" ans does not depend on endian type*/
wxString
m_PinName
;
int
m_PinNumSize
,
m_PinNameSize
;
/* Pin num and Pin name sizes */
// int m_PinNumWidth, m_PinNameWidth; /* (Currently Unused) Pin num and Pin name text width */
public
:
LibDrawPin
();
~
LibDrawPin
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibDrawPin"
);
}
LibDrawPin
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
void
Display_Infos
(
WinEDA_DrawFrame
*
frame
);
wxPoint
ReturnPinEndPoint
();
int
ReturnPinDrawOrient
(
int
TransMat
[
2
][
2
]
);
void
ReturnPinStringNum
(
wxString
&
buffer
);
void
SetPinNumFromString
(
wxString
&
buffer
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
void
DrawPinSymbol
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
pin_pos
,
int
orient
,
int
DrawMode
,
int
Color
=
-
1
);
void
DrawPinTexts
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
wxPoint
&
pin_pos
,
int
orient
,
int
TextInside
,
bool
DrawPinNum
,
bool
DrawPinName
,
int
Color
,
int
DrawMode
);
void
PlotPinTexts
(
wxPoint
&
pin_pos
,
int
orient
,
int
TextInside
,
bool
DrawPinNum
,
bool
DrawPinName
);
};
/**************************/
/* Graphic Body Item: Arc */
/**************************/
class
LibDrawArc
:
public
LibEDA_BaseStruct
{
public
:
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 */
wxPoint
m_ArcStart
,
m_ArcEnd
;
/* position des 2 extremites de l'arc en coord reelles*/
public
:
LibDrawArc
();
~
LibDrawArc
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibDrawArc"
);
}
LibDrawArc
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
};
/*****************************/
/* Graphic Body Item: Circle */
/*****************************/
class
LibDrawCircle
:
public
LibEDA_BaseStruct
{
public
:
int
m_Rayon
;
FILL_T
m_Fill
;
public
:
LibDrawCircle
();
~
LibDrawCircle
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibDrawCircle"
);
}
LibDrawCircle
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
};
/*********************************************/
/* Graphic Body Item: Text */
/* This is only a graphic text. */
/* Fields like Ref , value... are not Text, */
/* they are a separate class */
/*********************************************/
class
LibDrawText
:
public
LibEDA_BaseStruct
{
public
:
int
m_Horiz
;
wxSize
m_Size
;
int
m_Type
;
wxString
m_Text
;
public
:
LibDrawText
();
~
LibDrawText
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibDrawText"
);
}
LibDrawText
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
};
/********************************/
/* Graphic Body Item: Rectangle */
/********************************/
class
LibDrawSquare
:
public
LibEDA_BaseStruct
{
public
:
wxPoint
m_End
;
FILL_T
m_Fill
;
public
:
LibDrawSquare
();
~
LibDrawSquare
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibDrawSquare"
);
}
LibDrawSquare
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
};
/**********************************/
/* Graphic Body Item: single line */
/**********************************/
class
LibDrawSegment
:
public
LibEDA_BaseStruct
{
public
:
wxPoint
m_End
;
public
:
LibDrawSegment
();
~
LibDrawSegment
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibDrawSegment"
);
}
LibDrawSegment
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
};
/*********************************************/
/* Graphic Body Item: Polygon (set of lines) */
/*********************************************/
class
LibDrawPolyline
:
public
LibEDA_BaseStruct
{
public
:
int
m_CornersCount
;
int
*
m_PolyList
;
FILL_T
m_Fill
;
public
:
LibDrawPolyline
();
~
LibDrawPolyline
()
{
if
(
m_PolyList
)
free
(
m_PolyList
);
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibDrawPolyline"
);
}
LibDrawPolyline
*
GenCopy
();
void
AddPoint
(
const
wxPoint
&
point
);
bool
WriteDescr
(
FILE
*
File
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
};
/**********/
/* Fields */
/**********/
/* Fields , same as component fields.
* can be defined in libraries (mandatory for ref and value, ca be useful for footprints)
* 2 Fields are always defined :
* Prefix (U, IC..) with gives the reference in scxhematic)
* Name (74LS00..) used to find the component in libraries, and give the default value in schematic
*/
class
LibDrawField
:
public
LibEDA_BaseStruct
{
public
:
int
m_FieldId
;
// 0 a 11
// 0 = Name; 1 = Valeur; 2 .. 11 other fields
wxPoint
m_Pos
;
wxSize
m_Size
;
int
m_Orient
;
/* Orientation */
int
m_Attributs
;
/* Attributes (Non visible ...) */
int
m_HJustify
,
m_VJustify
;
/* Horiz an Vert Texte Justifications */
wxString
m_Text
;
/* Field Data */
wxString
m_Name
;
/* Field Name */
public
:
LibDrawField
(
int
idfield
=
2
);
~
LibDrawField
();
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibDrawField"
);
}
LibDrawField
*
GenCopy
();
void
Copy
(
LibDrawField
*
Target
);
bool
WriteDescr
(
FILE
*
File
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
};
#endif // CLASSES_BODY_ITEMS_H
eeschema/eelibs_draw_components.cpp
View file @
2f99ef29
...
@@ -35,18 +35,36 @@
...
@@ -35,18 +35,36 @@
* ENDDEF
* ENDDEF
*/
*/
static
int
s_ItemSelectColor
=
BROWN
;
static
EDA_LibComponentStruct
*
DummyCmp
;
static
EDA_LibComponentStruct
*
DummyCmp
;
static
int
*
Buf_Poly_Drawings
,
Buf_Poly_Size
;
// Used fo polyline drawings
static
void
DrawLibPartAux
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
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
],
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
);
/***************************************************************************/
wxPoint
TransformCoordinate
(
int
aTransformMatrix
[
2
][
2
],
wxPoint
&
aPosition
)
/***************************************************************************/
/** Function TransformCoordinate
* Calculate the wew coordinate from the old one, according to the transform matrix.
* @param aTransformMatrix = rotation, mirror .. matrix
* @param aPosition = the position to transform
* @return the new coordinate
*/
{
wxPoint
new_pos
;
new_pos
.
x
=
(
aTransformMatrix
[
0
][
0
]
*
aPosition
.
x
)
+
(
aTransformMatrix
[
0
][
1
]
*
aPosition
.
y
);
new_pos
.
y
=
(
aTransformMatrix
[
1
][
0
]
*
aPosition
.
x
)
+
(
aTransformMatrix
[
1
][
1
]
*
aPosition
.
y
);
return
new_pos
;
}
/******************************/
/******************************/
static
void
CreateDummyCmp
()
static
void
CreateDummyCmp
()
/******************************/
/******************************/
...
@@ -258,7 +276,7 @@ void PartTextStruct::Draw( WinEDA_DrawPanel* panel,
...
@@ -258,7 +276,7 @@ void PartTextStruct::Draw( WinEDA_DrawPanel* panel,
wxDC
*
DC
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
const
wxPoint
&
offset
,
int
DrawMode
,
int
DrawMode
,
int
Color
)
int
Color
)
/***********************************************************/
/***********************************************************/
/* Routine de trace des textes type Field du composant.
/* Routine de trace des textes type Field du composant.
...
@@ -357,7 +375,7 @@ EDA_LibComponentStruct* FindLibPart( const wxChar* Name, const wxString& LibName
...
@@ -357,7 +375,7 @@ EDA_LibComponentStruct* FindLibPart( const wxChar* Name, const wxString& LibName
LibraryStruct
*
Lib
=
g_LibraryList
;
LibraryStruct
*
Lib
=
g_LibraryList
;
DummyEntry
.
m_Drawings
=
NULL
;
/* Used only to call PQFind. */
DummyEntry
.
m_Drawings
=
NULL
;
/* Used only to call PQFind. */
DummyEntry
.
m_Name
.
m_Text
=
Name
;
DummyEntry
.
m_Name
.
m_Text
=
Name
;
PQCompFunc
(
(
PQCompFuncType
)
LibraryEntryCompare
);
PQCompFunc
(
(
PQCompFuncType
)
LibraryEntryCompare
);
...
@@ -416,17 +434,12 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -416,17 +434,12 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
int
Multi
,
int
convert
,
int
DrawMode
,
int
Multi
,
int
convert
,
int
DrawMode
,
int
Color
,
bool
DrawPinText
)
int
Color
,
bool
DrawPinText
)
{
{
int
i
,
x1
,
y1
,
x2
,
y2
,
t1
,
t2
,
orient
;
wxPoint
pos1
,
pos2
;
LibEDA_BaseStruct
*
DEntry
=
NULL
;
LibEDA_BaseStruct
*
DEntry
=
NULL
;
int
CharColor
;
bool
force_nofill
;
FILL_T
fill_option
;
int
SetHightColor
;
int
SetHightColor
;
int
LineWidth
;
int
LineWidth
;
//#define GETCOLOR(l) Color < 0 ? (ReturnLayerColor(l)| SetHightColor) : Color;
#define GETCOLOR( l ) Color < 0 ? SetHightColor ?\
s_ItemSelectColor : (ReturnLayerColor( l ) | SetHightColor) : Color;
if
(
Entry
->
m_Drawings
==
NULL
)
if
(
Entry
->
m_Drawings
==
NULL
)
return
;
return
;
GRSetDrawMode
(
DC
,
DrawMode
);
GRSetDrawMode
(
DC
,
DrawMode
);
...
@@ -450,231 +463,51 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -450,231 +463,51 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
{
{
case
COMPONENT_ARC_DRAW_TYPE
:
case
COMPONENT_ARC_DRAW_TYPE
:
{
{
int
xc
,
yc
,
x2
,
y2
;
LibDrawArc
*
Arc
=
(
LibDrawArc
*
)
DEntry
;
LibDrawArc
*
Arc
=
(
LibDrawArc
*
)
DEntry
;
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
force_nofill
=
false
;
xc
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Arc
->
m_Pos
.
x
+
if
(
g_IsPrinting
&&
Arc
->
m_Fill
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
()
)
TransMat
[
0
][
1
]
*
Arc
->
m_Pos
.
y
;
force_nofill
=
true
;
yc
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Arc
->
m_Pos
.
x
+
DEntry
->
Draw
(
panel
,
DC
,
Pos
,
Color
,
DrawMode
,
(
void
*
)
force_nofill
,
TransMat
);
TransMat
[
1
][
1
]
*
Arc
->
m_Pos
.
y
;
x2
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Arc
->
m_ArcStart
.
x
+
TransMat
[
0
][
1
]
*
Arc
->
m_ArcStart
.
y
;;
y2
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Arc
->
m_ArcStart
.
x
+
TransMat
[
1
][
1
]
*
Arc
->
m_ArcStart
.
y
;
x1
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Arc
->
m_ArcEnd
.
x
+
TransMat
[
0
][
1
]
*
Arc
->
m_ArcEnd
.
y
;;
y1
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Arc
->
m_ArcEnd
.
x
+
TransMat
[
1
][
1
]
*
Arc
->
m_ArcEnd
.
y
;
t1
=
Arc
->
t1
;
t2
=
Arc
->
t2
;
bool
swap
=
MapAngles
(
&
t1
,
&
t2
,
TransMat
);
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
(
Color
<
0
)
// Normal Color Layer
{
if
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
GRFilledArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
Arc
->
m_Rayon
,
Arc
->
m_Width
,
CharColor
,
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
)
);
else
if
(
fill_option
==
FILLED_SHAPE
)
GRFilledArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
Arc
->
m_Rayon
,
CharColor
,
CharColor
);
#ifdef DRAW_ARC_WITH_ANGLE
else
GRArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
Arc
->
m_Rayon
,
LineWidth
,
CharColor
);
#else
else
GRArc1
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
xc
,
yc
,
LineWidth
,
CharColor
);
#endif
}
#ifdef DRAW_ARC_WITH_ANGLE
else
GRArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
Arc
->
m_Rayon
,
Circle
->
m_Width
,
CharColor
);
#else
else
GRArc1
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
xc
,
yc
,
Arc
->
m_Width
,
CharColor
);
#endif
}
break
;
break
;
}
case
COMPONENT_CIRCLE_DRAW_TYPE
:
case
COMPONENT_CIRCLE_DRAW_TYPE
:
{
{
LibDrawCircle
*
Circle
=
(
LibDrawCircle
*
)
DEntry
;
LibDrawCircle
*
Circle
=
(
LibDrawCircle
*
)
DEntry
;
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
force_nofill
=
false
;
if
(
g_IsPrinting
&&
Circle
->
m_Fill
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
()
)
x1
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Circle
->
m_Pos
.
x
+
force_nofill
=
true
;
TransMat
[
0
][
1
]
*
Circle
->
m_Pos
.
y
;
DEntry
->
Draw
(
panel
,
DC
,
Pos
,
Color
,
DrawMode
,
(
void
*
)
force_nofill
,
TransMat
);
y1
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Circle
->
m_Pos
.
x
+
TransMat
[
1
][
1
]
*
Circle
->
m_Pos
.
y
;
fill_option
=
Circle
->
m_Fill
;
if
(
g_IsPrinting
&&
fill_option
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
(
)
)
fill_option
=
NO_FILL
;
if
(
Color
<
0
)
{
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
);
}
else
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
Circle
->
m_Rayon
,
LineWidth
,
CharColor
);
}
}
break
;
break
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
{
DEntry
->
Draw
(
panel
,
DC
,
Pos
,
Color
,
DrawMode
,
NULL
,
TransMat
);
LibDrawText
*
Text
=
(
LibDrawText
*
)
DEntry
;
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
/* The text orientation may need to be flipped if the
* transformation matrix cuases xy axes to be flipped. */
t1
=
(
TransMat
[
0
][
0
]
!=
0
)
^
(
Text
->
m_Horiz
!=
0
);
x1
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Text
->
m_Pos
.
x
+
TransMat
[
0
][
1
]
*
Text
->
m_Pos
.
y
;
y1
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Text
->
m_Pos
.
x
+
TransMat
[
1
][
1
]
*
Text
->
m_Pos
.
y
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
,
y1
),
CharColor
,
Text
->
m_Text
,
t1
?
TEXT_ORIENT_HORIZ
:
TEXT_ORIENT_VERT
,
Text
->
m_Size
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
}
break
;
break
;
case
COMPONENT_RECT_DRAW_TYPE
:
case
COMPONENT_RECT_DRAW_TYPE
:
{
{
LibDrawSquare
*
Square
=
(
LibDrawSquare
*
)
DEntry
;
LibDrawSquare
*
Square
=
(
LibDrawSquare
*
)
DEntry
;
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
force_nofill
=
false
;
if
(
g_IsPrinting
&&
Square
->
m_Fill
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
()
)
x1
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Square
->
m_Pos
.
x
force_nofill
=
true
;
+
TransMat
[
0
][
1
]
*
Square
->
m_Pos
.
y
;
DEntry
->
Draw
(
panel
,
DC
,
Pos
,
Color
,
DrawMode
,
(
void
*
)
force_nofill
,
TransMat
);
y1
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Square
->
m_Pos
.
x
+
TransMat
[
1
][
1
]
*
Square
->
m_Pos
.
y
;
x2
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Square
->
m_End
.
x
+
TransMat
[
0
][
1
]
*
Square
->
m_End
.
y
;
y2
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Square
->
m_End
.
x
+
TransMat
[
1
][
1
]
*
Square
->
m_End
.
y
;
fill_option
=
Square
->
m_Fill
;
if
(
g_IsPrinting
&&
fill_option
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
(
)
)
fill_option
=
NO_FILL
;
if
(
Color
<
0
)
{
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
);
}
else
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
LineWidth
,
CharColor
);
}
}
break
;
break
;
case
COMPONENT_PIN_DRAW_TYPE
:
/* Trace des Pins */
case
COMPONENT_PIN_DRAW_TYPE
:
/* Trace des Pins */
{
{
LibDrawPin
*
Pin
=
(
LibDrawPin
*
)
DEntry
;
DrawPinPrms
prms
(
Entry
,
DrawPinText
);
if
(
Pin
->
m_Attributs
&
PINNOTDRAW
)
DEntry
->
Draw
(
panel
,
DC
,
Pos
,
Color
,
DrawMode
,
&
prms
,
TransMat
);
{
if
(
/*(GetScreen()->m_Type == SCHEMATIC_FRAME )
&&*/
!
g_ShowAllPins
)
break
;
}
/* Calcul de l'orientation reelle de la Pin */
orient
=
Pin
->
ReturnPinDrawOrient
(
TransMat
);
/* Calcul de la position du point de reference */
x2
=
Pos
.
x
+
(
TransMat
[
0
][
0
]
*
Pin
->
m_Pos
.
x
)
+
(
TransMat
[
0
][
1
]
*
Pin
->
m_Pos
.
y
);
y2
=
Pos
.
y
+
(
TransMat
[
1
][
0
]
*
Pin
->
m_Pos
.
x
)
+
(
TransMat
[
1
][
1
]
*
Pin
->
m_Pos
.
y
);
/* Dessin de la pin et du symbole special associe */
CharColor
=
GETCOLOR
(
LAYER_PIN
);
Pin
->
DrawPinSymbol
(
panel
,
DC
,
wxPoint
(
x2
,
y2
),
orient
,
DrawMode
,
CharColor
);
if
(
DrawPinText
)
{
wxPoint
pinpos
(
x2
,
y2
);
CharColor
=
SetHightColor
?
s_ItemSelectColor
:
Color
;
Pin
->
DrawPinTexts
(
panel
,
DC
,
pinpos
,
orient
,
Entry
->
m_TextInside
,
Entry
->
m_DrawPinNum
,
Entry
->
m_DrawPinName
,
CharColor
,
DrawMode
);
}
}
}
break
;
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
{
{
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DEntry
;
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DEntry
;
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
force_nofill
=
false
;
if
(
Buf_Poly_Drawings
==
NULL
)
if
(
g_IsPrinting
&&
polyline
->
m_Fill
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
()
)
{
force_nofill
=
true
;
Buf_Poly_Size
=
polyline
->
n
;
DEntry
->
Draw
(
panel
,
DC
,
Pos
,
Color
,
DrawMode
,
(
void
*
)
force_nofill
,
TransMat
);
Buf_Poly_Drawings
=
(
int
*
)
MyMalloc
(
sizeof
(
int
)
*
2
*
Buf_Poly_Size
);
}
else
if
(
Buf_Poly_Size
<
polyline
->
n
)
{
Buf_Poly_Size
=
polyline
->
n
;
Buf_Poly_Drawings
=
(
int
*
)
realloc
(
Buf_Poly_Drawings
,
sizeof
(
int
)
*
2
*
Buf_Poly_Size
);
}
for
(
i
=
0
;
i
<
polyline
->
n
;
i
++
)
{
Buf_Poly_Drawings
[
i
*
2
]
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
polyline
->
PolyList
[
i
*
2
]
+
TransMat
[
0
][
1
]
*
polyline
->
PolyList
[
i
*
2
+
1
];
Buf_Poly_Drawings
[
i
*
2
+
1
]
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
polyline
->
PolyList
[
i
*
2
]
+
TransMat
[
1
][
1
]
*
polyline
->
PolyList
[
i
*
2
+
1
];
}
fill_option
=
polyline
->
m_Fill
;
if
(
g_IsPrinting
&&
fill_option
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
(
)
)
fill_option
=
NO_FILL
;
if
(
Color
<
0
)
{
if
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
Buf_Poly_Drawings
,
1
,
LineWidth
,
CharColor
,
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
)
);
else
if
(
fill_option
==
FILLED_SHAPE
)
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
Buf_Poly_Drawings
,
1
,
LineWidth
,
CharColor
,
CharColor
);
else
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
Buf_Poly_Drawings
,
0
,
LineWidth
,
CharColor
,
CharColor
);
}
else
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
Buf_Poly_Drawings
,
0
,
LineWidth
,
CharColor
,
CharColor
);
}
}
break
;
break
;
...
@@ -694,10 +527,10 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -694,10 +527,10 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
BoundaryBox
=
Component
->
GetBoundaryBox
();
BoundaryBox
=
Component
->
GetBoundaryBox
();
else
else
BoundaryBox
=
Entry
->
GetBoundaryBox
(
Multi
,
convert
);
BoundaryBox
=
Entry
->
GetBoundaryBox
(
Multi
,
convert
);
x1
=
BoundaryBox
.
GetX
();
int
x1
=
BoundaryBox
.
GetX
();
y1
=
BoundaryBox
.
GetY
();
int
y1
=
BoundaryBox
.
GetY
();
x2
=
BoundaryBox
.
GetRight
();
int
x2
=
BoundaryBox
.
GetRight
();
y2
=
BoundaryBox
.
GetBottom
();
int
y2
=
BoundaryBox
.
GetBottom
();
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
BROWN
);
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
BROWN
);
BoundaryBox
=
Component
->
m_Field
[
REFERENCE
].
GetBoundaryBox
();
BoundaryBox
=
Component
->
m_Field
[
REFERENCE
].
GetBoundaryBox
();
x1
=
BoundaryBox
.
GetX
();
x1
=
BoundaryBox
.
GetX
();
...
@@ -715,129 +548,6 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -715,129 +548,6 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
}
}
/********************************************************************************/
void
LibDrawPin
::
DrawPinSymbol
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
pin_pos
,
int
orient
,
int
DrawMode
,
int
Color
)
/*******************************************************************************/
/* Draw the pin symbol (without texts)
* if Color != 0 draw with Color, eles with the normal pin color
*/
{
int
MapX1
,
MapY1
,
x1
,
y1
;
int
color
;
int
width
=
MAX
(
m_Width
,
g_DrawMinimunLineWidth
);
int
posX
=
pin_pos
.
x
,
posY
=
pin_pos
.
y
,
len
=
m_PinLen
;
if
(
Color
>=
0
)
color
=
Color
;
else
color
=
ReturnLayerColor
(
LAYER_PIN
);
GRSetDrawMode
(
DC
,
DrawMode
);
MapX1
=
MapY1
=
0
;
x1
=
posX
;
y1
=
posY
;
switch
(
orient
)
{
case
PIN_UP
:
y1
=
posY
-
len
;
MapY1
=
1
;
break
;
case
PIN_DOWN
:
y1
=
posY
+
len
;
MapY1
=
-
1
;
break
;
case
PIN_LEFT
:
x1
=
posX
-
len
,
MapX1
=
1
;
break
;
case
PIN_RIGHT
:
x1
=
posX
+
len
;
MapX1
=
-
1
;
break
;
}
if
(
m_PinShape
&
INVERT
)
{
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
MapX1
*
INVERT_PIN_RADIUS
+
x1
,
MapY1
*
INVERT_PIN_RADIUS
+
y1
,
INVERT_PIN_RADIUS
,
width
,
color
);
GRMoveTo
(
MapX1
*
INVERT_PIN_RADIUS
*
2
+
x1
,
MapY1
*
INVERT_PIN_RADIUS
*
2
+
y1
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
posX
,
posY
,
width
,
color
);
}
else
{
GRMoveTo
(
x1
,
y1
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
posX
,
posY
,
width
,
color
);
}
if
(
m_PinShape
&
CLOCK
)
{
if
(
MapY1
==
0
)
/* MapX1 = +- 1 */
{
GRMoveTo
(
x1
,
y1
+
CLOCK_PIN_DIM
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
-
MapX1
*
CLOCK_PIN_DIM
,
y1
,
width
,
color
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
-
CLOCK_PIN_DIM
,
width
,
color
);
}
else
/* MapX1 = 0 */
{
GRMoveTo
(
x1
+
CLOCK_PIN_DIM
,
y1
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
-
MapY1
*
CLOCK_PIN_DIM
,
width
,
color
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
-
CLOCK_PIN_DIM
,
y1
,
width
,
color
);
}
}
if
(
m_PinShape
&
LOWLEVEL_IN
)
/* IEEE symbol "Active Low Input" */
{
if
(
MapY1
==
0
)
/* MapX1 = +- 1 */
{
GRMoveTo
(
x1
+
MapX1
*
IEEE_SYMBOL_PIN_DIM
*
2
,
y1
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
+
MapX1
*
IEEE_SYMBOL_PIN_DIM
*
2
,
y1
-
IEEE_SYMBOL_PIN_DIM
,
width
,
color
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
width
,
color
);
}
else
/* MapX1 = 0 */
{
GRMoveTo
(
x1
,
y1
+
MapY1
*
IEEE_SYMBOL_PIN_DIM
*
2
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
-
IEEE_SYMBOL_PIN_DIM
,
y1
+
MapY1
*
IEEE_SYMBOL_PIN_DIM
*
2
,
width
,
color
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
width
,
color
);
}
}
if
(
m_PinShape
&
LOWLEVEL_OUT
)
/* IEEE symbol "Active Low Output" */
{
if
(
MapY1
==
0
)
/* MapX1 = +- 1 */
{
GRMoveTo
(
x1
,
y1
-
IEEE_SYMBOL_PIN_DIM
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
+
MapX1
*
IEEE_SYMBOL_PIN_DIM
*
2
,
y1
,
width
,
color
);
}
else
/* MapX1 = 0 */
{
GRMoveTo
(
x1
-
IEEE_SYMBOL_PIN_DIM
,
y1
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
+
MapY1
*
IEEE_SYMBOL_PIN_DIM
*
2
,
width
,
color
);
}
}
/* Draw the pin end target (active end of the pin) */
if
(
!
g_IsPrinting
)
// Draw but do not print the pin end target 1 pixel width */
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
posX
,
posY
,
TARGET_PIN_DIAM
,
0
,
color
);
}
/*****************************************************************************
/*****************************************************************************
* Routine to rotate the given angular direction by the given Transformation. *
* Routine to rotate the given angular direction by the given Transformation. *
...
@@ -934,10 +644,11 @@ void DrawLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -934,10 +644,11 @@ void DrawLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC,
LibEDA_BaseStruct
*
DrawItem
,
int
Multi
,
LibEDA_BaseStruct
*
DrawItem
,
int
Multi
,
int
DrawMode
,
int
Color
)
int
DrawMode
,
int
Color
)
{
{
int
i
,
x1
,
y1
,
x2
,
y2
,
t1
,
t2
,
orient
;
int
x1
,
y1
,
x2
,
y2
,
t1
,
t2
,
orient
;
int
CharColor
;
int
CharColor
;
int
TransMat
[
2
][
2
];
int
TransMat
[
2
][
2
];
int
fill_option
;
int
fill_option
;
wxPoint
position
(
PartX
,
PartY
);
#undef GETCOLOR
#undef GETCOLOR
#define GETCOLOR( l ) Color < 0 ? ReturnLayerColor( l ) : Color;
#define GETCOLOR( l ) Color < 0 ? ReturnLayerColor( l ) : Color;
...
@@ -973,7 +684,7 @@ void DrawLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -973,7 +684,7 @@ void DrawLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC,
EXCHG
(
x1
,
x2
);
EXCHG
(
y1
,
y2
)
EXCHG
(
x1
,
x2
);
EXCHG
(
y1
,
y2
)
}
}
fill_option
=
Arc
->
m_Fill
;
fill_option
=
Arc
->
m_Fill
;
if
(
g_IsPrinting
&&
fill_option
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
(
)
)
if
(
g_IsPrinting
&&
fill_option
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
(
)
)
fill_option
=
NO_FILL
;
fill_option
=
NO_FILL
;
if
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
if
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
GRFilledArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
GRFilledArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
...
@@ -1000,7 +711,7 @@ void DrawLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -1000,7 +711,7 @@ void DrawLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC,
x1
=
PartX
+
Circle
->
m_Pos
.
x
;
x1
=
PartX
+
Circle
->
m_Pos
.
x
;
y1
=
PartY
-
Circle
->
m_Pos
.
y
;
y1
=
PartY
-
Circle
->
m_Pos
.
y
;
fill_option
=
Circle
->
m_Fill
;
fill_option
=
Circle
->
m_Fill
;
if
(
g_IsPrinting
&&
fill_option
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
(
)
)
if
(
g_IsPrinting
&&
fill_option
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
(
)
)
fill_option
=
NO_FILL
;
fill_option
=
NO_FILL
;
if
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
if
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
GRFilledCircle
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
GRFilledCircle
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
...
@@ -1035,7 +746,7 @@ void DrawLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -1035,7 +746,7 @@ void DrawLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC,
x2
=
PartX
+
Square
->
m_End
.
x
;
x2
=
PartX
+
Square
->
m_End
.
x
;
y2
=
PartY
-
Square
->
m_End
.
y
;
y2
=
PartY
-
Square
->
m_End
.
y
;
fill_option
=
Square
->
m_Fill
;
fill_option
=
Square
->
m_Fill
;
if
(
g_IsPrinting
&&
fill_option
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
(
)
)
if
(
g_IsPrinting
&&
fill_option
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
(
)
)
fill_option
=
NO_FILL
;
fill_option
=
NO_FILL
;
if
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
if
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
GRFilledRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
GRFilledRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
...
@@ -1077,36 +788,10 @@ void DrawLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -1077,36 +788,10 @@ void DrawLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC,
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
{
{
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DrawItem
;
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DrawItem
;
if
(
Buf_Poly_Drawings
==
NULL
)
fill_option
=
false
;
{
if
(
g_IsPrinting
&&
polyline
->
m_Fill
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
()
)
Buf_Poly_Size
=
polyline
->
n
;
fill_option
=
true
;
Buf_Poly_Drawings
=
(
int
*
)
MyMalloc
(
sizeof
(
int
)
*
2
*
Buf_Poly_Size
);
DrawItem
->
Draw
(
panel
,
DC
,
position
,
Color
,
DrawMode
,
(
void
*
)
fill_option
,
TransMat
);
}
else
if
(
Buf_Poly_Size
<
polyline
->
n
)
{
Buf_Poly_Size
=
polyline
->
n
;
Buf_Poly_Drawings
=
(
int
*
)
realloc
(
Buf_Poly_Drawings
,
sizeof
(
int
)
*
2
*
Buf_Poly_Size
);
}
for
(
i
=
0
;
i
<
polyline
->
n
;
i
++
)
{
Buf_Poly_Drawings
[
i
*
2
]
=
PartX
+
polyline
->
PolyList
[
i
*
2
];
Buf_Poly_Drawings
[
i
*
2
+
1
]
=
PartY
-
polyline
->
PolyList
[
i
*
2
+
1
];
}
fill_option
=
polyline
->
m_Fill
;
if
(
g_IsPrinting
&&
fill_option
==
FILLED_WITH_BG_BODYCOLOR
&&
GetGRForceBlackPenState
(
)
)
fill_option
=
NO_FILL
;
if
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
Buf_Poly_Drawings
,
1
,
LineWidth
,
CharColor
,
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
)
);
else
if
(
fill_option
==
FILLED_SHAPE
)
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
Buf_Poly_Drawings
,
1
,
LineWidth
,
CharColor
,
CharColor
);
else
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
Buf_Poly_Drawings
,
0
,
LineWidth
,
CharColor
,
CharColor
);
break
;
break
;
}
}
...
...
eeschema/eelibs_read_libraryfiles.cpp
View file @
2f99ef29
...
@@ -734,24 +734,24 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char*
...
@@ -734,24 +734,24 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char*
New
=
Polyl
;
New
=
Polyl
;
if
(
sscanf
(
&
Line
[
2
],
"%d %d %d %d"
,
if
(
sscanf
(
&
Line
[
2
],
"%d %d %d %d"
,
&
Polyl
->
n
,
&
Unit
,
&
Convert
,
&
Polyl
->
m_CornersCount
,
&
Unit
,
&
Convert
,
&
Polyl
->
m_Width
)
==
4
&
Polyl
->
m_Width
)
==
4
&&
Polyl
->
n
>
0
)
&&
Polyl
->
m_CornersCount
>
0
)
{
{
Polyl
->
m_Unit
=
Unit
;
Polyl
->
m_Convert
=
Convert
;
Polyl
->
m_Unit
=
Unit
;
Polyl
->
m_Convert
=
Convert
;
Polyl
->
PolyList
=
(
int
*
)
Polyl
->
m_
PolyList
=
(
int
*
)
MyZMalloc
(
sizeof
(
int
)
*
Polyl
->
n
*
2
);
MyZMalloc
(
sizeof
(
int
)
*
Polyl
->
m_CornersCount
*
2
);
p
=
strtok
(
&
Line
[
2
],
"
\t\n
"
);
p
=
strtok
(
&
Line
[
2
],
"
\t\n
"
);
p
=
strtok
(
NULL
,
"
\t\n
"
);
p
=
strtok
(
NULL
,
"
\t\n
"
);
p
=
strtok
(
NULL
,
"
\t\n
"
);
p
=
strtok
(
NULL
,
"
\t\n
"
);
p
=
strtok
(
NULL
,
"
\t\n
"
);
p
=
strtok
(
NULL
,
"
\t\n
"
);
for
(
i
=
0
;
i
<
Polyl
->
n
*
2
&&
!
Error
;
i
++
)
for
(
i
=
0
;
i
<
Polyl
->
m_CornersCount
*
2
&&
!
Error
;
i
++
)
{
{
p
=
strtok
(
NULL
,
"
\t\n
"
);
p
=
strtok
(
NULL
,
"
\t\n
"
);
Error
=
sscanf
(
p
,
"%d"
,
&
Polyl
->
PolyList
[
i
]
)
!=
1
;
Error
=
sscanf
(
p
,
"%d"
,
&
Polyl
->
m_
PolyList
[
i
]
)
!=
1
;
}
}
Polyl
->
m_Fill
=
NO_FILL
;
Polyl
->
m_Fill
=
NO_FILL
;
...
...
eeschema/eestring.cpp
View file @
2f99ef29
...
@@ -16,260 +16,6 @@
...
@@ -16,260 +16,6 @@
extern
void
Move_Plume
(
wxPoint
pos
,
int
plume
);
// see plot.cpp
extern
void
Move_Plume
(
wxPoint
pos
,
int
plume
);
// see plot.cpp
/*****************************************************************************
* Put out pin number and pin text info, given the pin line coordinates.
* The line must be vertical or horizontal.
* If PinText == NULL nothing is printed. If PinNum = 0 no number is printed.
* Current Zoom factor is taken into account.
* If TextInside then the text is been put inside,otherwise all is drawn outside.
* Pin Name: substring beteween '~' is negated
*****************************************************************************/
void
LibDrawPin
::
DrawPinTexts
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
wxPoint
&
pin_pos
,
int
orient
,
int
TextInside
,
bool
DrawPinNum
,
bool
DrawPinName
,
int
Color
,
int
DrawMode
)
/* DrawMode = GR_OR, XOR ... */
{
int
ii
,
x
,
y
,
x1
,
y1
,
dx
,
dy
,
len
;
wxString
StringPinNum
;
wxString
PinText
;
int
PinTextBarPos
[
256
];
int
PinTextBarCount
;
int
NameColor
,
NumColor
;
int
PinTxtLen
;
wxSize
PinNameSize
(
m_PinNameSize
,
m_PinNameSize
);
wxSize
PinNumSize
(
m_PinNumSize
,
m_PinNumSize
);
int
LineWidth
=
g_DrawMinimunLineWidth
;
GRSetDrawMode
(
DC
,
DrawMode
);
/* Get the num and name colors */
NameColor
=
Color
==
-
1
?
ReturnLayerColor
(
LAYER_PINNAM
)
:
Color
;
NumColor
=
Color
==
-
1
?
ReturnLayerColor
(
LAYER_PINNUM
)
:
Color
;
/* Create the pin num string */
ReturnPinStringNum
(
StringPinNum
);
x1
=
pin_pos
.
x
;
y1
=
pin_pos
.
y
;
switch
(
orient
)
{
case
PIN_UP
:
y1
-=
m_PinLen
;
break
;
case
PIN_DOWN
:
y1
+=
m_PinLen
;
break
;
case
PIN_LEFT
:
x1
-=
m_PinLen
;
break
;
case
PIN_RIGHT
:
x1
+=
m_PinLen
;
break
;
}
const
wxChar
*
textsrc
=
m_PinName
.
GetData
();
float
fPinTextPitch
=
PinNameSize
.
x
*
1.1
;
/* Do we need to invert the string? Is this string has only "~"? */
PinTextBarCount
=
0
;
PinTxtLen
=
0
;
ii
=
0
;
while
(
*
textsrc
)
{
if
(
*
textsrc
==
'~'
)
{
PinTextBarPos
[
PinTextBarCount
++
]
=
(
int
)
(
PinTxtLen
*
fPinTextPitch
);
}
else
{
PinText
.
Append
(
*
textsrc
);
PinTxtLen
++
;
}
textsrc
++
;
}
PinTxtLen
=
(
int
)
(
fPinTextPitch
*
PinTxtLen
);
PinTextBarPos
[
PinTextBarCount
]
=
PinTxtLen
;
// Needed if no end '~'
if
(
PinText
[
0
]
==
0
)
DrawPinName
=
FALSE
;
if
(
TextInside
)
/* Draw the text inside, but the pin numbers outside. */
{
if
(
(
orient
==
PIN_LEFT
)
||
(
orient
==
PIN_RIGHT
)
)
// It is an horizontal line
{
if
(
PinText
&&
DrawPinName
)
{
if
(
orient
==
PIN_RIGHT
)
{
x
=
x1
+
TextInside
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x
,
y1
),
NameColor
,
PinText
,
TEXT_ORIENT_HORIZ
,
PinNameSize
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
for
(
ii
=
0
;
ii
<
PinTextBarCount
;
)
{
GRMoveTo
(
x
,
y1
-
TXTMARGE
);
dy
=
-
PinNameSize
.
y
/
2
;
GRMoveRel
(
0
,
dy
);
dx
=
PinTextBarPos
[
ii
++
];
// Get the line pos
GRMoveRel
(
dx
,
0
);
len
=
PinTextBarPos
[
ii
++
]
-
dx
;
// Get the line length
GRLineRel
(
&
panel
->
m_ClipBox
,
DC
,
len
,
0
,
LineWidth
,
NameColor
);
}
}
else
// Orient == PIN_LEFT
{
x
=
x1
-
TextInside
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x
,
y1
),
NameColor
,
PinText
,
TEXT_ORIENT_HORIZ
,
PinNameSize
,
GR_TEXT_HJUSTIFY_RIGHT
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
for
(
ii
=
0
;
ii
<
PinTextBarCount
;
)
{
GRMoveTo
(
x
,
y1
-
TXTMARGE
);
dy
=
-
PinNameSize
.
y
/
2
;
GRMoveRel
(
0
,
dy
);
dx
=
PinTextBarPos
[
ii
++
];
// Get the line pos
GRMoveRel
(
dx
-
PinTxtLen
,
0
);
len
=
PinTextBarPos
[
ii
++
]
-
dx
;
// Get the line length
GRLineRel
(
&
panel
->
m_ClipBox
,
DC
,
len
,
0
,
LineWidth
,
NameColor
);
}
}
}
if
(
DrawPinNum
)
{
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
(
x1
+
pin_pos
.
x
)
/
2
,
y1
-
TXTMARGE
),
NumColor
,
StringPinNum
,
TEXT_ORIENT_HORIZ
,
PinNumSize
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_BOTTOM
,
LineWidth
);
}
}
else
/* Its a vertical line. */
{
// Text is drawn from bottom to top (i.e. to negative value for Y axis)
if
(
PinText
&&
DrawPinName
)
{
if
(
orient
==
PIN_DOWN
)
{
y
=
y1
+
TextInside
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
,
y
),
NameColor
,
PinText
,
TEXT_ORIENT_VERT
,
PinNameSize
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_TOP
,
LineWidth
);
for
(
ii
=
0
;
ii
<
PinTextBarCount
;
)
{
GRMoveTo
(
x1
-
TXTMARGE
,
y
);
dy
=
-
PinNameSize
.
y
/
2
;
GRMoveRel
(
dy
,
0
);
dx
=
PinTextBarPos
[
ii
++
];
// Get the line pos
GRMoveRel
(
0
,
PinTxtLen
-
dx
);
len
=
PinTextBarPos
[
ii
++
]
-
dx
;
// Get the line length
GRLineRel
(
&
panel
->
m_ClipBox
,
DC
,
0
,
-
len
,
LineWidth
,
NameColor
);
}
}
else
/* PIN_UP */
{
y
=
y1
-
TextInside
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
,
y
),
NameColor
,
PinText
,
TEXT_ORIENT_VERT
,
PinNameSize
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_BOTTOM
,
LineWidth
);
for
(
ii
=
0
;
ii
<
PinTextBarCount
;
)
{
GRMoveTo
(
x1
-
TXTMARGE
,
y
);
dy
=
-
PinNameSize
.
y
/
2
;
GRMoveRel
(
dy
,
0
);
dx
=
PinTextBarPos
[
ii
++
];
// Get the line pos
GRMoveRel
(
0
,
-
dx
);
len
=
PinTextBarPos
[
ii
++
]
-
dx
;
// Get the line length
GRLineRel
(
&
panel
->
m_ClipBox
,
DC
,
0
,
-
len
,
LineWidth
,
NameColor
);
}
}
}
if
(
DrawPinNum
)
{
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
-
TXTMARGE
,
(
y1
+
pin_pos
.
y
)
/
2
),
NumColor
,
StringPinNum
,
TEXT_ORIENT_VERT
,
PinNumSize
,
GR_TEXT_HJUSTIFY_RIGHT
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
}
}
}
else
/**** Draw num & text pin outside ****/
{
if
(
(
orient
==
PIN_LEFT
)
||
(
orient
==
PIN_RIGHT
)
)
/* Its an horizontal line. */
{
if
(
PinText
&&
DrawPinName
)
{
x
=
(
x1
+
pin_pos
.
x
)
/
2
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x
,
y1
-
TXTMARGE
),
NameColor
,
PinText
,
TEXT_ORIENT_HORIZ
,
PinNameSize
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_BOTTOM
,
LineWidth
);
for
(
ii
=
0
;
ii
<
PinTextBarCount
;
)
{
GRMoveTo
(
x
,
y1
-
TXTMARGE
*
2
);
GRMoveRel
(
-
PinTxtLen
/
2
,
-
PinNameSize
.
y
);
dx
=
PinTextBarPos
[
ii
++
];
// Get the line pos
GRMoveRel
(
dx
,
0
);
len
=
PinTextBarPos
[
ii
++
]
-
dx
;
// Get the line length
GRLineRel
(
&
panel
->
m_ClipBox
,
DC
,
len
,
0
,
LineWidth
,
NameColor
);
}
}
if
(
DrawPinNum
)
{
x
=
(
x1
+
pin_pos
.
x
)
/
2
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x
,
y1
+
TXTMARGE
),
NumColor
,
StringPinNum
,
TEXT_ORIENT_HORIZ
,
PinNumSize
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_TOP
,
LineWidth
);
}
}
else
/* Its a vertical line. */
{
if
(
PinText
&&
DrawPinName
)
{
y
=
(
y1
+
pin_pos
.
y
)
/
2
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
-
TXTMARGE
,
y
),
NameColor
,
PinText
,
TEXT_ORIENT_VERT
,
PinNameSize
,
GR_TEXT_HJUSTIFY_RIGHT
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
for
(
ii
=
0
;
ii
<
PinTextBarCount
;
)
{
GRMoveTo
(
x1
-
(
TXTMARGE
*
2
),
y
);
GRMoveRel
(
-
PinNameSize
.
y
,
-
PinTxtLen
/
2
);
dx
=
PinTextBarPos
[
ii
++
];
// Get the line pos
GRMoveRel
(
0
,
PinTxtLen
-
dx
);
len
=
PinTextBarPos
[
ii
++
]
-
dx
;
// Get the line length
GRLineRel
(
&
panel
->
m_ClipBox
,
DC
,
0
,
-
len
,
LineWidth
,
NameColor
);
}
}
if
(
DrawPinNum
)
{
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
+
TXTMARGE
,
(
y1
+
pin_pos
.
y
)
/
2
),
NumColor
,
StringPinNum
,
TEXT_ORIENT_VERT
,
PinNumSize
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
}
}
}
}
/*****************************************************************************
/*****************************************************************************
* Plot pin number and pin text info, given the pin line coordinates. *
* Plot pin number and pin text info, given the pin line coordinates. *
* Same as DrawPinTexts((), but output is the plotter
* Same as DrawPinTexts((), but output is the plotter
...
...
eeschema/general.h
View file @
2f99ef29
...
@@ -256,7 +256,7 @@ eda_global wxString g_NetListerCommandLine; // ligne de commande pour l'appel au
...
@@ -256,7 +256,7 @@ eda_global wxString g_NetListerCommandLine; // ligne de commande pour l'appel au
eda_global
LayerStruct
g_LayerDescr
;
/* couleurs des couches */
eda_global
LayerStruct
g_LayerDescr
;
/* couleurs des couches */
eda_global
bool
g_EditPinByPinIsOn
/* bool: TRUE si edition des pins pin a pin au lieu */
eda_global
bool
g_EditPinByPinIsOn
/* bool: TRUE si edition des pins pin a pin au lieu */
#ifdef MAIN
/* de l'edition simultan
�e des pins de meme coordonn�
es */
#ifdef MAIN
/* de l'edition simultan
ee des pins de meme coordonne
es */
=
FALSE
=
FALSE
#endif
#endif
;
;
...
@@ -265,6 +265,13 @@ eda_global int g_LibSymbolDefaultLineWidth; /* default line width (in EESCHEMA
...
@@ -265,6 +265,13 @@ eda_global int g_LibSymbolDefaultLineWidth; /* default line width (in EESCHEMA
eda_global
int
g_DrawMinimunLineWidth
;
/* Minimum line (in EESCHEMA units) width used to draw items on screen; 0 = single pixel line width */
eda_global
int
g_DrawMinimunLineWidth
;
/* Minimum line (in EESCHEMA units) width used to draw items on screen; 0 = single pixel line width */
eda_global
int
g_PlotPSMinimunLineWidth
;
/* Minimum line (in EESCHEMA units) width used to Plot items , postscript format */
eda_global
int
g_PlotPSMinimunLineWidth
;
/* Minimum line (in EESCHEMA units) width used to Plot items , postscript format */
eda_global
int
g_ItemSelectetColor
// Color to draw selected items
#ifdef MAIN
=
BROWN
#endif
;
/* Config keys */
/* Config keys */
#define MINI_DRAW_LINE_WIDTH_KEY wxT("MinimunDrawLineWidth")
#define MINI_DRAW_LINE_WIDTH_KEY wxT("MinimunDrawLineWidth")
#define MINI_PLOTPS_LINE_WIDTH_KEY wxT("MinimunPlotPSLineWidth")
#define MINI_PLOTPS_LINE_WIDTH_KEY wxT("MinimunPlotPSLineWidth")
...
...
eeschema/libclass.cpp
View file @
2f99ef29
...
@@ -337,8 +337,8 @@ EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert )
...
@@ -337,8 +337,8 @@ EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert )
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
{
{
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DrawEntry
;
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DrawEntry
;
pt
=
polyline
->
PolyList
;
pt
=
polyline
->
m_
PolyList
;
for
(
ii
=
0
;
ii
<
polyline
->
n
;
ii
++
)
for
(
ii
=
0
;
ii
<
polyline
->
m_CornersCount
;
ii
++
)
{
{
if
(
xmin
>
*
pt
)
if
(
xmin
>
*
pt
)
xmin
=
*
pt
;
xmin
=
*
pt
;
...
@@ -739,8 +739,8 @@ LibDrawSegment* LibDrawSegment::GenCopy()
...
@@ -739,8 +739,8 @@ LibDrawSegment* LibDrawSegment::GenCopy()
LibDrawPolyline
::
LibDrawPolyline
()
:
LibEDA_BaseStruct
(
COMPONENT_POLYLINE_DRAW_TYPE
)
LibDrawPolyline
::
LibDrawPolyline
()
:
LibEDA_BaseStruct
(
COMPONENT_POLYLINE_DRAW_TYPE
)
{
{
n
=
0
;
m_CornersCount
=
0
;
PolyList
=
NULL
;
m_
PolyList
=
NULL
;
m_Fill
=
NO_FILL
;
m_Fill
=
NO_FILL
;
m_Width
=
0
;
m_Width
=
0
;
}
}
...
@@ -754,12 +754,12 @@ LibDrawPolyline* LibDrawPolyline::GenCopy()
...
@@ -754,12 +754,12 @@ LibDrawPolyline* LibDrawPolyline::GenCopy()
int
size
;
int
size
;
newitem
->
n
=
n
;
newitem
->
m_CornersCount
=
m_CornersCount
;
size
=
sizeof
(
int
)
*
2
*
n
;
size
=
sizeof
(
int
)
*
2
*
m_CornersCount
;
if
(
size
)
if
(
size
)
{
{
newitem
->
PolyList
=
(
int
*
)
MyMalloc
(
size
);
newitem
->
m_
PolyList
=
(
int
*
)
MyMalloc
(
size
);
memcpy
(
newitem
->
PolyList
,
PolyList
,
size
);
memcpy
(
newitem
->
m_PolyList
,
m_
PolyList
,
size
);
}
}
newitem
->
m_Pos
=
m_Pos
;
newitem
->
m_Pos
=
m_Pos
;
newitem
->
m_Width
=
m_Width
;
newitem
->
m_Width
=
m_Width
;
...
@@ -780,13 +780,13 @@ void LibDrawPolyline::AddPoint( const wxPoint& point )
...
@@ -780,13 +780,13 @@ void LibDrawPolyline::AddPoint( const wxPoint& point )
{
{
int
allocsize
;
int
allocsize
;
n
++
;
m_CornersCount
++
;
allocsize
=
2
*
sizeof
(
int
)
*
n
;
allocsize
=
2
*
sizeof
(
int
)
*
m_CornersCount
;
if
(
PolyList
==
NULL
)
if
(
m_
PolyList
==
NULL
)
PolyList
=
(
int
*
)
MyMalloc
(
allocsize
);
m_
PolyList
=
(
int
*
)
MyMalloc
(
allocsize
);
else
else
PolyList
=
(
int
*
)
realloc
(
PolyList
,
allocsize
);
m_PolyList
=
(
int
*
)
realloc
(
m_
PolyList
,
allocsize
);
PolyList
[(
n
*
2
)
-
2
]
=
point
.
x
;
m_PolyList
[(
m_CornersCount
*
2
)
-
2
]
=
point
.
x
;
PolyList
[(
n
*
2
)
-
1
]
=
-
point
.
y
;
m_PolyList
[(
m_CornersCount
*
2
)
-
1
]
=
-
point
.
y
;
}
}
eeschema/libcmp.h
View file @
2f99ef29
/****************************************************************/
/****************************************************************
*
/
/* Headers fo library definition and lib component definitions */
/* Headers fo
r
library definition and lib component definitions */
/****************************************************************/
/****************************************************************
*
/
#ifndef LIBCMP_H
#ifndef LIBCMP_H
#define LIBCMP_H
#define LIBCMP_H
...
@@ -13,35 +13,10 @@
...
@@ -13,35 +13,10 @@
#define LIB_VERSION_MAJOR 2
#define LIB_VERSION_MAJOR 2
#define LIB_VERSION_MINOR 3
#define LIB_VERSION_MINOR 3
#define LIBFILE_IDENT
"EESchema-LIBRARY Version"
/* Must be at the lib file start
. */
#define LIBFILE_IDENT
"EESchema-LIBRARY Version"
/* Must be the first line of lib files
. */
#define DOCFILE_IDENT
"EESchema-DOCLIB Version 2.0"
/* Must be at the doc file start
. */
#define DOCFILE_IDENT
"EESchema-DOCLIB Version 2.0"
/* Must be the first line of doc files
. */
#define DOC_EXT
wxT( ".dcm" )
/* extension des fichiers de documentation
*/
#define DOC_EXT
wxT( ".dcm" )
/* Ext. of documentation files
*/
#define TARGET_PIN_DIAM 12
/* Diam cercle des extremites des pins */
#define DEFAULT_TEXT_SIZE 50
/* Default size for field texts */
#define PART_NAME_LEN 15
/* Maximum length of part name. */
#define PREFIX_NAME_LEN 5
/* Maximum length of prefix (IC, R, SW etc.). */
#define PIN_WIDTH 100
/* Width between 2 pins in internal units. */
#define PIN_LENGTH 300
/* Default Length of each pin to be drawn. */
#define INVERT_PIN_RADIUS 35
/* Radius of inverted pin circle. */
#define CLOCK_PIN_DIM 40
/* Dim of clock pin symbol. */
#define IEEE_SYMBOL_PIN_DIM 40
/* Dim of special pin symbol. */
/**
* Enum FILL_T
* is the set of fill types used in plotting or drawing enclosed areas.
*/
enum
FILL_T
{
NO_FILL
,
// Poly, Square, Circle, Arc = option No Fill
FILLED_SHAPE
,
// Poly, Square, Circle, Arc = option Fill with current color ("Solid shape")
FILLED_WITH_BG_BODYCOLOR
,
/* Poly, Square, Circle, Arc = option Fill
* with background body color, translucent (texts on this shape can be see)
* not fille in B&W plot mode
*/
};
//Offsets used in editing library component, for handle aliad dats
//Offsets used in editing library component, for handle aliad dats
#define ALIAS_NAME 0
#define ALIAS_NAME 0
...
@@ -64,431 +39,20 @@ enum LocateDrawStructType {
...
@@ -64,431 +39,20 @@ enum LocateDrawStructType {
#define LOCATE_ALL_DRAW_ITEM 0xFFFFFFFF
#define LOCATE_ALL_DRAW_ITEM 0xFFFFFFFF
/* flags utilises dans FindLibPart() : */
/* flags utilises dans FindLibPart() : */
#define FIND_ROOT 0
/* indique la recherche du composant racine si
#define FIND_ROOT 0
/* Used to search for a root component by its name
* meme si le composant specifie est un alias */
* if the name is an alias name, FindLibPart() returns the root component */
#define FIND_ALIAS 1
/* indique la recherche du composant specifie
#define FIND_ALIAS 1
/* Used to search for a component by its name
* (alias ou racine) */
* FindLibPart() returns the component (root or alias ) */
/* definition des types des structures d'elements de librairie */
enum
LibrEntryType
{
ROOT
,
/* Structure est a standard EDA_LibComponentStruct */
ALIAS
/* Structure is an alias */
};
/* valeur du membre .m_Options */
enum
LibrEntryOptions
{
ENTRY_NORMAL
,
// Libentry is standard
ENTRY_POWER
// Libentry is a power symbol
};
/**
* Enum ElectricPinType
* is the set of schematic pin types.
*/
enum
ElectricPinType
{
/* Type des Pins. si modif: modifier tableau des mgs suivant */
PIN_INPUT
,
PIN_OUTPUT
,
PIN_BIDI
,
PIN_TRISTATE
,
PIN_PASSIVE
,
PIN_UNSPECIFIED
,
PIN_POWER_IN
,
PIN_POWER_OUT
,
PIN_OPENCOLLECTOR
,
PIN_OPENEMITTER
,
PIN_NC
,
/* No connect */
PIN_NMAX
/* Valeur limite ( utilisee comme limite de tableaux) */
};
/* Messages d'affichage du type electrique */
eda_global
const
wxChar
*
MsgPinElectricType
[]
#ifdef MAIN
=
{
wxT
(
"input"
),
wxT
(
"output"
),
wxT
(
"BiDi"
),
wxT
(
"3state"
),
wxT
(
"passive"
),
wxT
(
"unspc"
),
wxT
(
"power_in"
),
wxT
(
"power_out"
),
wxT
(
"openCol"
),
wxT
(
"openEm"
),
wxT
(
"?????"
)
}
#endif
;
/* Autres bits: bits du membre .Flag des Pins */
#define PINNOTDRAW 1
/* si 1: pin invisible */
/**
* Enum DrawPinShape
* is the set of shapes allowed for pins.
*/
enum
DrawPinShape
{
NONE
=
0
,
INVERT
=
1
,
CLOCK
=
2
,
LOWLEVEL_IN
=
4
,
LOWLEVEL_OUT
=
8
};
/**
* Enum DrawPinOrient
* is the set of orientations allowed for pins.
*/
enum
DrawPinOrient
{
PIN_RIGHT
=
'R'
,
PIN_LEFT
=
'L'
,
PIN_UP
=
'U'
,
PIN_DOWN
=
'D'
,
};
/*************************************/
/* Classe representant une librairie */
/*************************************/
class
LibraryStruct
{
public
:
int
m_Type
;
/* type indicator */
wxString
m_Name
;
/* Name of library loaded. */
wxString
m_FullFileName
;
/* Full File Name (with path) of library loaded. */
wxString
m_Header
;
/* first line of library loaded. */
int
m_NumOfParts
;
/* Number of parts this library has. */
PriorQue
*
m_Entries
;
/* Parts themselves are saved here. */
LibraryStruct
*
m_Pnext
;
/* Point on next lib in chain. */
int
m_Modified
;
/* flag indicateur d'edition */
int
m_Size
;
// Size in bytes (for statistics)
unsigned
long
m_TimeStamp
;
// Signature temporelle
int
m_Flags
;
// variable used in some functions
bool
m_IsLibCache
;
// False for the "standard" libraries,
// True for the library cache
public
:
LibraryStruct
(
int
type
,
const
wxString
&
name
,
const
wxString
&
fullname
);
~
LibraryStruct
();
bool
WriteHeader
(
FILE
*
file
);
bool
ReadHeader
(
FILE
*
file
,
int
*
LineNum
);
};
/*******************************************************************/
/* Classes representant les elments d'un composant d'une libraire */
/*******************************************************************/
/* class LibEDA_BaseStruct : Basic class for items used in a library component
* (graphic shapes, texts, fields, pins)
*/
class
LibEDA_BaseStruct
:
public
EDA_BaseStruct
{
public
:
int
m_Unit
;
/* Unit identification (for multi part per parkage)
* 0 if the item is common to all units */
int
m_Convert
;
/* Shape identification (for parts which have a convert shape)
* 0 if the item is common to all shapes */
wxPoint
m_Pos
;
/* Position or centre (Arc and Circle) or start point (segments) */
int
m_Width
;
/* Width of draw lines */
public
:
LibEDA_BaseStruct
*
Next
()
{
return
(
LibEDA_BaseStruct
*
)
Pnext
;
}
LibEDA_BaseStruct
(
KICAD_T
struct_type
);
virtual
~
LibEDA_BaseStruct
()
{
}
void
Display_Infos_DrawEntry
(
WinEDA_DrawFrame
*
frame
);
};
class
LibDrawPin
:
public
LibEDA_BaseStruct
{
public
:
int
m_PinLen
;
/* Pin lenght */
int
m_Orient
;
/* Pin orientation (Up, Down, Left, Right) */
int
m_PinShape
;
/* Bitwise ORed: Pin shape (see enum DrawPinShape) */
int
m_PinType
;
/* Electrical pin properties */
int
m_Attributs
;
/* bit 0 != 0: pin invisible */
long
m_PinNum
;
/* Pin number: 4 Ascii code like "12" or "anod" or "G6"
* "12" is really "12\0\0"*/
wxString
m_PinName
;
int
m_PinNumSize
,
m_PinNameSize
;
/* Pin num and Pin name sizes */
// short m_PinNumWidth, m_PinNameWidth; /* (Unused) Pin num and Pin name text width */
public
:
LibDrawPin
();
~
LibDrawPin
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibDrawPin"
);
}
LibDrawPin
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
void
Display_Infos
(
WinEDA_DrawFrame
*
frame
);
wxPoint
ReturnPinEndPoint
();
int
ReturnPinDrawOrient
(
int
TransMat
[
2
][
2
]
);
void
ReturnPinStringNum
(
wxString
&
buffer
);
void
SetPinNumFromString
(
wxString
&
buffer
);
void
DrawPinSymbol
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
pin_pos
,
int
orient
,
int
DrawMode
,
int
Color
=
-
1
);
void
DrawPinTexts
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
wxPoint
&
pin_pos
,
int
orient
,
int
TextInside
,
bool
DrawPinNum
,
bool
DrawPinName
,
int
Color
,
int
DrawMode
);
void
PlotPinTexts
(
wxPoint
&
pin_pos
,
int
orient
,
int
TextInside
,
bool
DrawPinNum
,
bool
DrawPinName
);
};
class
LibDrawArc
:
public
LibEDA_BaseStruct
{
public
:
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 */
wxPoint
m_ArcStart
,
m_ArcEnd
;
/* position des 2 extremites de l'arc en coord reelles*/
public
:
LibDrawArc
();
~
LibDrawArc
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibDrawArc"
);
}
#include "class_library.h"
LibDrawArc
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
};
class
LibDrawCircle
:
public
LibEDA_BaseStruct
{
public
:
int
m_Rayon
;
FILL_T
m_Fill
;
public
:
LibDrawCircle
();
~
LibDrawCircle
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibDrawCircle"
);
}
LibDrawCircle
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
};
class
LibDrawText
:
public
LibEDA_BaseStruct
{
public
:
int
m_Horiz
;
wxSize
m_Size
;
int
m_Type
;
wxString
m_Text
;
public
:
LibDrawText
();
~
LibDrawText
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibDrawText"
);
}
LibDrawText
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
};
class
LibDrawSquare
:
public
LibEDA_BaseStruct
{
public
:
wxPoint
m_End
;
FILL_T
m_Fill
;
public
:
LibDrawSquare
();
~
LibDrawSquare
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibDrawSquare"
);
}
LibDrawSquare
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
};
class
LibDrawSegment
:
public
LibEDA_BaseStruct
{
public
:
wxPoint
m_End
;
public
:
LibDrawSegment
();
~
LibDrawSegment
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibDrawSegment"
);
}
LibDrawSegment
*
GenCopy
();
bool
WriteDescr
(
FILE
*
File
);
};
class
LibDrawPolyline
:
public
LibEDA_BaseStruct
{
public
:
int
n
;
int
*
PolyList
;
FILL_T
m_Fill
;
public
:
LibDrawPolyline
();
~
LibDrawPolyline
()
{
if
(
PolyList
)
free
(
PolyList
);
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibDrawPolyline"
);
}
LibDrawPolyline
*
GenCopy
();
void
AddPoint
(
const
wxPoint
&
point
);
bool
WriteDescr
(
FILE
*
File
);
};
/* Fields identiques aux fields des composants, pouvant etre predefinis en lib
* 2 Fields sont toujours presents : Prefix (U, IC..) et Name (74LS00..)*/
class
LibDrawField
:
public
LibEDA_BaseStruct
{
public
:
int
m_FieldId
;
// 0 a 11
// 0 = Name; 1 = Valeur; 2 .. 11 other fields
wxPoint
m_Pos
;
wxSize
m_Size
;
int
m_Orient
;
/* Orientation */
int
m_Attributs
;
/* Attributes (Non visible ...) */
int
m_HJustify
,
m_VJustify
;
/* Horiz an Vert Texte Justifications */
wxString
m_Text
;
/* Field Data */
wxString
m_Name
;
/* Field Name */
public
:
LibDrawField
(
int
idfield
=
2
);
~
LibDrawField
();
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibDrawField"
);
}
LibDrawField
*
GenCopy
();
void
Copy
(
LibDrawField
*
Target
);
bool
WriteDescr
(
FILE
*
File
);
};
/* basic class to describe components in libraries (true component or alias), non used directly */
class
LibCmpEntry
:
public
EDA_BaseStruct
{
public
:
LibrEntryType
Type
;
/* Type = ROOT;
* = ALIAS pour struct LibraryAliasType */
LibDrawField
m_Name
;
// name (74LS00 ..) in lib ( = VALUE )
wxString
m_Doc
;
/* documentation for info */
wxString
m_KeyWord
;
/* keyword list (used to select a group of components by keyword) */
wxString
m_DocFile
;
/* Associed doc filename */
LibrEntryOptions
m_Options
;
// special features (i.e. Entry is a POWER)
public
:
LibCmpEntry
(
LibrEntryType
CmpType
,
const
wxChar
*
CmpName
);
virtual
~
LibCmpEntry
();
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LibCmpEntry"
);
}
bool
WriteDescr
(
FILE
*
File
);
};
class
EDA_LibComponentStruct
:
public
LibCmpEntry
/* usual component in lib */
{
public
:
LibDrawField
m_Prefix
;
/* Prefix ( U, IC ... ) = REFERENCE */
wxArrayString
m_AliasList
;
/* ALIAS list for the component */
wxArrayString
m_FootprintList
;
/* list of suitable footprint names for the component (wildcard names accepted)*/
int
m_UnitCount
;
/* Units (or sections) per package */
bool
m_UnitSelectionLocked
;
// True if units are differents and their selection is locked
// (i.e. if part A cannot be automatically changed in part B
int
m_TextInside
;
/* if 0: pin name drawn on the pin itself
* if > 0 pin name drawn inside the component,
* with a distance of m_TextInside in mils */
bool
m_DrawPinNum
;
bool
m_DrawPinName
;
LibDrawField
*
Fields
;
/* Auxiliairy Field list (id = 2 a 11) */
LibEDA_BaseStruct
*
m_Drawings
;
/* How to draw this part */
long
m_LastDate
;
// Last change Date
public
:
virtual
wxString
GetClass
()
const
{
return
wxT
(
"EDA_LibComponentStruct"
);
}
EDA_LibComponentStruct
(
const
wxChar
*
CmpName
);
EDA_Rect
GetBoundaryBox
(
int
Unit
,
int
Convert
);
/* return Box around the part. */
~
EDA_LibComponentStruct
();
void
SortDrawItems
();
};
class
EDA_LibCmpAliasStruct
:
public
LibCmpEntry
/* alias of an usual component in lib (root component) */
{
public
:
wxString
m_RootName
;
/* Root component Part name */
public
:
EDA_LibCmpAliasStruct
(
const
wxChar
*
CmpName
,
const
wxChar
*
CmpRootName
);
~
EDA_LibCmpAliasStruct
();
virtual
wxString
GetClass
()
const
{
return
wxT
(
"EDA_LibCmpAliasStruct"
);
}
};
/* Variables */
/* Variables */
extern
LibraryStruct
*
LibraryList
;
/* All part libs are saved here. */
extern
LibraryStruct
*
LibraryList
;
/* All part libs are saved here. */
/* Variables used by LibEdit */
/* Variables used by LibEdit */
eda_global
LibEDA_BaseStruct
*
LibItemToRepeat
;
/* pointe
ur sur l'lment que l'on
eda_global
LibEDA_BaseStruct
*
LibItemToRepeat
;
/* pointe
r on a graphic item than can be duplicated by the Ins key
* peut rpter (Pin..;)
*/
* (usually the last created item
*/
eda_global
LibraryStruct
*
CurrentLib
;
/* Current opened library */
eda_global
LibraryStruct
*
CurrentLib
;
/* Current opened library */
eda_global
EDA_LibComponentStruct
*
CurrentLibEntry
;
/* Current component */
eda_global
EDA_LibComponentStruct
*
CurrentLibEntry
;
/* Current component */
eda_global
LibEDA_BaseStruct
*
CurrentDrawItem
;
/* current edited item */
eda_global
LibEDA_BaseStruct
*
CurrentDrawItem
;
/* current edited item */
...
@@ -506,7 +70,6 @@ eda_global int CurrentConvert /* Convert = 1 .. 255 */
...
@@ -506,7 +70,6 @@ eda_global int CurrentConvert /* Convert = 1 .. 255 */
#endif
#endif
;
;
eda_global
wxString
FindLibName
;
/* nom de la librairie ou a ete trouve le
eda_global
wxString
FindLibName
;
/* Library (name) containing the last component find by FindLibPart() */
* dernier composant recherche par FindLibPart() */
#endif // LIBCMP_H
#endif // LIBCMP_H
eeschema/libedit_onrightclick.cpp
View file @
2f99ef29
...
@@ -153,7 +153,7 @@ bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
...
@@ -153,7 +153,7 @@ bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
}
}
else
if
(
(
DrawEntry
->
m_Flags
&
IS_NEW
)
)
else
if
(
(
DrawEntry
->
m_Flags
&
IS_NEW
)
)
{
{
if
(
((
LibDrawPolyline
*
)
DrawEntry
)
->
n
>
2
)
if
(
((
LibDrawPolyline
*
)
DrawEntry
)
->
m_CornersCount
>
2
)
{
{
msg
=
AddHotkeyName
(
_
(
"Delete Segment "
),
s_Libedit_Hokeys_Descr
,
HK_DELETE_PIN
);
msg
=
AddHotkeyName
(
_
(
"Delete Segment "
),
s_Libedit_Hokeys_Descr
,
HK_DELETE_PIN
);
ADD_MENUITEM
(
PopMenu
,
ADD_MENUITEM
(
PopMenu
,
...
...
eeschema/locate.cpp
View file @
2f99ef29
...
@@ -880,8 +880,8 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
...
@@ -880,8 +880,8 @@ 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
;
ptpoly
=
polyline
->
PolyList
;
ptpoly
=
polyline
->
m_
PolyList
;
for
(
ii
=
polyline
->
n
-
1
;
ii
>
0
;
ii
--
,
ptpoly
+=
2
)
for
(
ii
=
polyline
->
m_CornersCount
-
1
;
ii
>
0
;
ii
--
,
ptpoly
+=
2
)
{
{
if
(
IsPointOnSegment
(
px
,
py
,
if
(
IsPointOnSegment
(
px
,
py
,
ptpoly
[
0
],
-
ptpoly
[
1
],
ptpoly
[
2
],
-
ptpoly
[
3
],
seuil
)
)
ptpoly
[
0
],
-
ptpoly
[
1
],
ptpoly
[
2
],
-
ptpoly
[
3
],
seuil
)
)
...
...
eeschema/makefile.include
View file @
2f99ef29
...
@@ -20,7 +20,9 @@ OBJECTS = eeschema.o\
...
@@ -20,7 +20,9 @@ OBJECTS = eeschema.o\
cross-probing.o
\
cross-probing.o
\
setpage.o
\
setpage.o
\
class_schematic_items.o
\
class_schematic_items.o
\
classes_body_items.o
\
class_drawsheet.o
\
class_drawsheet.o
\
class_pin.o
\
class_hierarchical_PIN_sheet.o
\
class_hierarchical_PIN_sheet.o
\
class_text-label.o
\
class_text-label.o
\
component_class.o
\
component_class.o
\
...
...
eeschema/plot.cpp
View file @
2f99ef29
...
@@ -326,15 +326,15 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
...
@@ -326,15 +326,15 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
{
{
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DEntry
;
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DEntry
;
Poly
=
(
int
*
)
MyMalloc
(
sizeof
(
int
)
*
2
*
polyline
->
n
);
Poly
=
(
int
*
)
MyMalloc
(
sizeof
(
int
)
*
2
*
polyline
->
m_CornersCount
);
for
(
ii
=
0
;
ii
<
polyline
->
n
;
ii
++
)
for
(
ii
=
0
;
ii
<
polyline
->
m_CornersCount
;
ii
++
)
{
{
Poly
[
ii
*
2
]
=
PartX
+
Poly
[
ii
*
2
]
=
PartX
+
TransMat
[
0
][
0
]
*
polyline
->
PolyList
[
ii
*
2
]
+
TransMat
[
0
][
0
]
*
polyline
->
m_
PolyList
[
ii
*
2
]
+
TransMat
[
0
][
1
]
*
polyline
->
PolyList
[
ii
*
2
+
1
];
TransMat
[
0
][
1
]
*
polyline
->
m_
PolyList
[
ii
*
2
+
1
];
Poly
[
ii
*
2
+
1
]
=
PartY
+
Poly
[
ii
*
2
+
1
]
=
PartY
+
TransMat
[
1
][
0
]
*
polyline
->
PolyList
[
ii
*
2
]
+
TransMat
[
1
][
0
]
*
polyline
->
m_
PolyList
[
ii
*
2
]
+
TransMat
[
1
][
1
]
*
polyline
->
PolyList
[
ii
*
2
+
1
];
TransMat
[
1
][
1
]
*
polyline
->
m_
PolyList
[
ii
*
2
+
1
];
}
}
if
(
draw_bgfill
&&
polyline
->
m_Fill
==
FILLED_WITH_BG_BODYCOLOR
)
if
(
draw_bgfill
&&
polyline
->
m_Fill
==
FILLED_WITH_BG_BODYCOLOR
)
...
...
eeschema/protos.h
View file @
2f99ef29
...
@@ -36,7 +36,7 @@ void InstallCmpeditFrame(WinEDA_SchematicFrame * parent, wxPoint & pos,
...
@@ -36,7 +36,7 @@ void InstallCmpeditFrame(WinEDA_SchematicFrame * parent, wxPoint & pos,
/**************/
/**************/
/* EELIBS
2
.CPP */
/* EELIBS
_
.CPP */
/**************/
/**************/
/* Functions common to all EELibs?.c modules: */
/* Functions common to all EELibs?.c modules: */
...
@@ -69,6 +69,14 @@ EDA_LibComponentStruct * Read_Component_Definition(WinEDA_DrawFrame * frame, cha
...
@@ -69,6 +69,14 @@ EDA_LibComponentStruct * Read_Component_Definition(WinEDA_DrawFrame * frame, cha
FILE
*
f
,
int
*
LineNum
);
FILE
*
f
,
int
*
LineNum
);
/* Routine to Read a DEF/ENDDEF part entry from given open file. */
/* Routine to Read a DEF/ENDDEF part entry from given open file. */
/** Function TransformCoordinate
* Calculate the wew coordinate from the old one, according to the transform matrix.
* @param aTransformMatrix = rotation, mirror .. matrix
* @param aPosition = the position to transform
* @return the new coordinate
*/
wxPoint
TransformCoordinate
(
int
aTransformMatrix
[
2
][
2
],
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
);
PriorQue
*
LoadLibraryAux
(
WinEDA_DrawFrame
*
frame
,
LibraryStruct
*
library
,
PriorQue
*
LoadLibraryAux
(
WinEDA_DrawFrame
*
frame
,
LibraryStruct
*
library
,
...
...
eeschema/savelib.cpp
View file @
2f99ef29
...
@@ -156,11 +156,11 @@ bool LibDrawPolyline::WriteDescr( FILE* ExportFile )
...
@@ -156,11 +156,11 @@ bool LibDrawPolyline::WriteDescr( FILE* ExportFile )
int
ii
,
*
ptpoly
;
int
ii
,
*
ptpoly
;
fprintf
(
ExportFile
,
"P %d %d %d %d"
,
fprintf
(
ExportFile
,
"P %d %d %d %d"
,
n
,
m_CornersCount
,
m_Unit
,
m_Convert
,
m_Unit
,
m_Convert
,
m_Width
);
m_Width
);
ptpoly
=
PolyList
;
ptpoly
=
m_
PolyList
;
for
(
ii
=
n
;
ii
>
0
;
ii
--
)
for
(
ii
=
m_CornersCount
;
ii
>
0
;
ii
--
)
{
{
fprintf
(
ExportFile
,
" %d %d"
,
*
ptpoly
,
*
(
ptpoly
+
1
)
);
fprintf
(
ExportFile
,
" %d %d"
,
*
ptpoly
,
*
(
ptpoly
+
1
)
);
ptpoly
+=
2
;
ptpoly
+=
2
;
...
...
eeschema/symbdraw.cpp
View file @
2f99ef29
...
@@ -261,9 +261,9 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
...
@@ -261,9 +261,9 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
LibDrawPolyline
*
polyline
=
new
LibDrawPolyline
();
LibDrawPolyline
*
polyline
=
new
LibDrawPolyline
();
CurrentDrawItem
=
polyline
;
CurrentDrawItem
=
polyline
;
polyline
->
n
=
2
;
polyline
->
m_CornersCount
=
2
;
ptpoly
=
(
int
*
)
MyZMalloc
(
4
*
sizeof
(
int
)
);
ptpoly
=
(
int
*
)
MyZMalloc
(
4
*
sizeof
(
int
)
);
polyline
->
PolyList
=
ptpoly
;
polyline
->
m_
PolyList
=
ptpoly
;
ptpoly
[
0
]
=
ptpoly
[
2
]
=
GetScreen
()
->
m_Curseur
.
x
;
ptpoly
[
0
]
=
ptpoly
[
2
]
=
GetScreen
()
->
m_Curseur
.
x
;
ptpoly
[
1
]
=
ptpoly
[
3
]
=
-
(
GetScreen
()
->
m_Curseur
.
y
);
ptpoly
[
1
]
=
ptpoly
[
3
]
=
-
(
GetScreen
()
->
m_Curseur
.
y
);
polyline
->
m_Fill
=
FlSymbol_Fill
;
polyline
->
m_Fill
=
FlSymbol_Fill
;
...
@@ -444,8 +444,8 @@ void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos )
...
@@ -444,8 +444,8 @@ void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos )
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
{
{
int
ii
,
imax
=
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
n
*
2
;
int
ii
,
imax
=
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
m_CornersCount
*
2
;
int
*
ptpoly
=
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
PolyList
;
int
*
ptpoly
=
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
m_
PolyList
;
int
dx
=
mx
-
ptpoly
[
0
];
int
dx
=
mx
-
ptpoly
[
0
];
int
dy
=
-
my
-
ptpoly
[
1
];
int
dy
=
-
my
-
ptpoly
[
1
];
for
(
ii
=
0
;
ii
<
imax
;
ii
+=
2
)
for
(
ii
=
0
;
ii
<
imax
;
ii
+=
2
)
...
@@ -497,8 +497,8 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC )
...
@@ -497,8 +497,8 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC )
break
;
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
InitPosition
.
x
=
*
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
PolyList
;
InitPosition
.
x
=
*
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
m_
PolyList
;
InitPosition
.
y
=
*
(
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
PolyList
+
1
);
InitPosition
.
y
=
*
(
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
m_
PolyList
+
1
);
break
;
break
;
case
COMPONENT_LINE_DRAW_TYPE
:
case
COMPONENT_LINE_DRAW_TYPE
:
...
@@ -589,8 +589,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
...
@@ -589,8 +589,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
break
;
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
ptpoly
=
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
PolyList
;
ptpoly
=
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
m_
PolyList
;
ptpoly
+=
2
*
(
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
n
-
1
);
ptpoly
+=
2
*
(
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
m_CornersCount
-
1
);
ptpoly
[
0
]
=
mx
;
ptpoly
[
0
]
=
mx
;
ptpoly
[
1
]
=
-
my
;
ptpoly
[
1
]
=
-
my
;
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
...
@@ -827,10 +827,10 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
...
@@ -827,10 +827,10 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
while
(
Poly
->
n
>
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
{
{
Poly
->
n
--
;
Poly
->
m_CornersCount
--
;
ptpoly
=
Poly
->
PolyList
+
(
2
*
(
Poly
->
n
-
1
)
);
ptpoly
=
Poly
->
m_PolyList
+
(
2
*
(
Poly
->
m_CornersCount
-
1
)
);
if
(
(
ptpoly
[
0
]
!=
GetScreen
()
->
m_Curseur
.
x
)
if
(
(
ptpoly
[
0
]
!=
GetScreen
()
->
m_Curseur
.
x
)
||
(
ptpoly
[
1
]
!=
-
GetScreen
()
->
m_Curseur
.
y
)
)
||
(
ptpoly
[
1
]
!=
-
GetScreen
()
->
m_Curseur
.
y
)
)
{
{
...
@@ -840,8 +840,8 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
...
@@ -840,8 +840,8 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
}
}
}
}
int
allocsize
=
2
*
sizeof
(
int
)
*
Poly
->
n
;
int
allocsize
=
2
*
sizeof
(
int
)
*
Poly
->
m_CornersCount
;
Poly
->
PolyList
=
(
int
*
)
realloc
(
Poly
->
PolyList
,
allocsize
);
Poly
->
m_PolyList
=
(
int
*
)
realloc
(
Poly
->
m_
PolyList
,
allocsize
);
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
...
...
eeschema/symbedit.cpp
View file @
2f99ef29
...
@@ -398,11 +398,11 @@ static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
...
@@ -398,11 +398,11 @@ static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
#undef CMPSTRUCT
#undef CMPSTRUCT
#define REFSTRUCT ( (LibDrawPolyline*) DEntryRef )
#define REFSTRUCT ( (LibDrawPolyline*) DEntryRef )
#define CMPSTRUCT ( (LibDrawPolyline*) DEntryCompare )
#define CMPSTRUCT ( (LibDrawPolyline*) DEntryCompare )
if
(
REFSTRUCT
->
n
!=
CMPSTRUCT
->
n
)
if
(
REFSTRUCT
->
m_CornersCount
!=
CMPSTRUCT
->
m_CornersCount
)
return
FALSE
;
return
FALSE
;
ptref
=
REFSTRUCT
->
PolyList
;
ptref
=
REFSTRUCT
->
m_
PolyList
;
ptcomp
=
CMPSTRUCT
->
PolyList
;
ptcomp
=
CMPSTRUCT
->
m_
PolyList
;
for
(
ii
=
2
*
REFSTRUCT
->
n
;
ii
>
0
;
ii
--
)
for
(
ii
=
2
*
REFSTRUCT
->
m_CornersCount
;
ii
>
0
;
ii
--
)
{
{
if
(
*
ptref
!=
*
ptcomp
)
if
(
*
ptref
!=
*
ptcomp
)
return
FALSE
;
return
FALSE
;
...
@@ -495,8 +495,8 @@ void WinEDA_LibeditFrame::PlaceAncre()
...
@@ -495,8 +495,8 @@ void WinEDA_LibeditFrame::PlaceAncre()
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
#undef STRUCT
#undef STRUCT
#define STRUCT ( (LibDrawPolyline*) DrawEntry )
#define STRUCT ( (LibDrawPolyline*) DrawEntry )
ptsegm
=
STRUCT
->
PolyList
;
ptsegm
=
STRUCT
->
m_
PolyList
;
for
(
ii
=
STRUCT
->
n
;
ii
>
0
;
ii
--
)
for
(
ii
=
STRUCT
->
m_CornersCount
;
ii
>
0
;
ii
--
)
{
{
*
ptsegm
+=
dx
;
ptsegm
++
;
*
ptsegm
+=
dx
;
ptsegm
++
;
*
ptsegm
+=
dy
;
ptsegm
++
;
*
ptsegm
+=
dy
;
ptsegm
++
;
...
...
libs.win
View file @
2f99ef29
...
@@ -22,9 +22,9 @@ DEBUG = 0
...
@@ -22,9 +22,9 @@ DEBUG = 0
#Define the wxWidget path (if not found in environment variables):
#Define the wxWidget path (if not found in environment variables):
ifndef WXWIN
ifndef WXWIN
ifeq ($(DEBUG), 1)
ifeq ($(DEBUG), 1)
WXWIN=f:/wxMSW-2.8.
8
-debug
WXWIN=f:/wxMSW-2.8.
9
-debug
else
else
WXWIN=f:/wxMSW-2.8.
8
WXWIN=f:/wxMSW-2.8.
9-rc1
endif
endif
endif
endif
LIBVERSION = 2.8
LIBVERSION = 2.8
...
...
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