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
f3c324d5
Commit
f3c324d5
authored
Aug 24, 2007
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EDA_BaseStruct::m_StructType is now type KICAD_T
parent
908f6d93
Changes
32
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
4866 additions
and
4314 deletions
+4866
-4314
3d_class.cpp
3d-viewer/3d_class.cpp
+4
-4
change_log.txt
change_log.txt
+12
-3
base_struct.cpp
common/base_struct.cpp
+5
-15
affiche.cpp
eeschema/affiche.cpp
+139
-100
block.cpp
eeschema/block.cpp
+3
-0
block_libedit.cpp
eeschema/block_libedit.cpp
+6
-0
cmpclass.cpp
eeschema/cmpclass.cpp
+1
-1
component_class.cpp
eeschema/component_class.cpp
+1
-1
component_class.h
eeschema/component_class.h
+1
-1
dangling_ends.cpp
eeschema/dangling_ends.cpp
+399
-348
eelibs_draw_components.cpp
eeschema/eelibs_draw_components.cpp
+961
-867
eelibs_read_libraryfiles.cpp
eeschema/eelibs_read_libraryfiles.cpp
+1129
-998
hotkeys.cpp
eeschema/hotkeys.cpp
+2
-0
libclass.cpp
eeschema/libclass.cpp
+575
-490
libcmp.h
eeschema/libcmp.h
+258
-248
libframe.cpp
eeschema/libframe.cpp
+1
-0
locate.cpp
eeschema/locate.cpp
+3
-0
plot.cpp
eeschema/plot.cpp
+3
-0
program.h
eeschema/program.h
+134
-105
symbdraw.cpp
eeschema/symbdraw.cpp
+740
-691
symbedit.cpp
eeschema/symbedit.cpp
+458
-410
base_struct.h
include/base_struct.h
+9
-24
pcbstruct.h
include/pcbstruct.h
+1
-1
wxstruct.h
include/wxstruct.h
+1
-1
block_module_editor.cpp
pcbnew/block_module_editor.cpp
+9
-0
class_edge_mod.cpp
pcbnew/class_edge_mod.cpp
+1
-0
class_track.cpp
pcbnew/class_track.cpp
+2
-1
class_track.h
pcbnew/class_track.h
+1
-1
classpcb.cpp
pcbnew/classpcb.cpp
+2
-2
classtrc.cpp
pcbnew/classtrc.cpp
+1
-1
dialog_track_options.cpp
pcbnew/dialog_track_options.cpp
+1
-1
ratsnest.cpp
pcbnew/ratsnest.cpp
+3
-0
No files found.
3d-viewer/3d_class.cpp
View file @
f3c324d5
...
@@ -25,8 +25,8 @@ S3D_Vertex::S3D_Vertex(void)
...
@@ -25,8 +25,8 @@ S3D_Vertex::S3D_Vertex(void)
/**************************************************************************/
/**************************************************************************/
S3D_Material
::
S3D_Material
(
Struct3D_Master
*
father
,
const
wxString
&
name
)
:
S3D_Material
::
S3D_Material
(
Struct3D_Master
*
father
,
const
wxString
&
name
)
:
EDA_BaseStruct
(
father
,
-
1
)
EDA_BaseStruct
(
father
,
NOT_USED
)
/**************************************************************************/
/**************************************************************************/
{
{
m_DiffuseColor
.
x
=
m_DiffuseColor
.
y
=
m_DiffuseColor
.
z
=
1.0
;
m_DiffuseColor
.
x
=
m_DiffuseColor
.
y
=
m_DiffuseColor
.
z
=
1.0
;
...
@@ -67,7 +67,7 @@ void Struct3D_Master::Copy(Struct3D_Master * pattern)
...
@@ -67,7 +67,7 @@ void Struct3D_Master::Copy(Struct3D_Master * pattern)
/***************************************************************/
/***************************************************************/
Struct3D_Master
::
Struct3D_Master
(
EDA_BaseStruct
*
StructFather
)
:
Struct3D_Master
::
Struct3D_Master
(
EDA_BaseStruct
*
StructFather
)
:
EDA_BaseStruct
(
StructFather
,
-
1
)
EDA_BaseStruct
(
StructFather
,
NOT_USED
)
/***************************************************************/
/***************************************************************/
{
{
m_MatScale
.
x
=
m_MatScale
.
y
=
m_MatScale
.
z
=
1.0
;
m_MatScale
.
x
=
m_MatScale
.
y
=
m_MatScale
.
z
=
1.0
;
...
@@ -100,7 +100,7 @@ S3D_Material * nextmat;
...
@@ -100,7 +100,7 @@ S3D_Material * nextmat;
/***************************************************************/
/***************************************************************/
Struct3D_Shape
::
Struct3D_Shape
(
EDA_BaseStruct
*
StructFather
)
:
Struct3D_Shape
::
Struct3D_Shape
(
EDA_BaseStruct
*
StructFather
)
:
EDA_BaseStruct
(
StructFather
,
-
1
)
EDA_BaseStruct
(
StructFather
,
NOT_USED
)
/***************************************************************/
/***************************************************************/
{
{
m_3D_Coord
=
NULL
;
m_3D_Coord
=
NULL
;
...
...
change_log.txt
View file @
f3c324d5
...
@@ -5,6 +5,18 @@ Please add newer entries at the top, list the date and your name with
...
@@ -5,6 +5,18 @@ Please add newer entries at the top, list the date and your name with
email address.
email address.
2007-Aug-23 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+ eeschema & pcbnew
* Removed class EDA_BaseLineStruct, which brought no behavioral advantage, only data.
Classes which were based on got its data members added and their initializers.
* Changed type of EDA_BaseStruct::m_StructType from int to KICAD_T which is an
enum. This makes debugging easier since gdb will show the name of the
KICAD_T rather than simply a number. Added NOT_USED = -1 to KICAD_T enum for
3d which was using -1.
* More beautification using latest uncrustify and the committed uncrustify.cfg
2007-Aug-24 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
2007-Aug-24 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
================================================================================
+ pcbnew
+ pcbnew
...
@@ -27,9 +39,6 @@ email address.
...
@@ -27,9 +39,6 @@ email address.
tomorrow I will add a new class COLLECTORS_GUIDE which can be used by a
tomorrow I will add a new class COLLECTORS_GUIDE which can be used by a
COLLECTOR to control its operation. It adds the concept of layer
COLLECTOR to control its operation. It adds the concept of layer
locking, even though PCBNEW does not support that in the UI yet.
locking, even though PCBNEW does not support that in the UI yet.
@todo:
add constructor initializers for classes that were derived from
EDA_BaseLineStruct but are now not. Its late, will do tomorrow.
2007-Aug-22 UPDATE Dick Hollenbeck <dick@softplc.com>
2007-Aug-22 UPDATE Dick Hollenbeck <dick@softplc.com>
...
...
common/base_struct.cpp
View file @
f3c324d5
...
@@ -17,8 +17,8 @@
...
@@ -17,8 +17,8 @@
#include "macros.h"
#include "macros.h"
//
DrawStructureType
names for error messages only:
//
KICAD_T
names for error messages only:
static
wxString
DrawStructureType
Name
[
MAX_STRUCT_TYPE_ID
+
1
]
=
{
static
wxString
KICAD_T
Name
[
MAX_STRUCT_TYPE_ID
+
1
]
=
{
wxT
(
"Not init"
),
wxT
(
"Not init"
),
wxT
(
"Pcb"
),
wxT
(
"Pcb"
),
...
@@ -74,7 +74,7 @@ enum textbox {
...
@@ -74,7 +74,7 @@ enum textbox {
/******************************************************************************/
/******************************************************************************/
EDA_BaseStruct
::
EDA_BaseStruct
(
EDA_BaseStruct
*
parent
,
int
idType
)
EDA_BaseStruct
::
EDA_BaseStruct
(
EDA_BaseStruct
*
parent
,
KICAD_T
idType
)
/******************************************************************************/
/******************************************************************************/
{
{
InitVars
();
InitVars
();
...
@@ -84,7 +84,7 @@ EDA_BaseStruct::EDA_BaseStruct( EDA_BaseStruct* parent, int idType )
...
@@ -84,7 +84,7 @@ EDA_BaseStruct::EDA_BaseStruct( EDA_BaseStruct* parent, int idType )
/********************************************/
/********************************************/
EDA_BaseStruct
::
EDA_BaseStruct
(
int
idType
)
EDA_BaseStruct
::
EDA_BaseStruct
(
KICAD_T
idType
)
/********************************************/
/********************************************/
{
{
InitVars
();
InitVars
();
...
@@ -183,7 +183,7 @@ wxString EDA_BaseStruct::ReturnClassName() const
...
@@ -183,7 +183,7 @@ wxString EDA_BaseStruct::ReturnClassName() const
if
(
(
ii
<
0
)
||
(
ii
>
MAX_STRUCT_TYPE_ID
)
)
if
(
(
ii
<
0
)
||
(
ii
>
MAX_STRUCT_TYPE_ID
)
)
ii
=
MAX_STRUCT_TYPE_ID
;
ii
=
MAX_STRUCT_TYPE_ID
;
classname
=
DrawStructureType
Name
[
ii
];
classname
=
KICAD_T
Name
[
ii
];
return
classname
;
return
classname
;
}
}
...
@@ -287,16 +287,6 @@ std::ostream& EDA_BaseStruct::NestedSpace( int nestLevel, std::ostream& os )
...
@@ -287,16 +287,6 @@ std::ostream& EDA_BaseStruct::NestedSpace( int nestLevel, std::ostream& os )
/**********************************************************************************************/
EDA_BaseLineStruct
::
EDA_BaseLineStruct
(
EDA_BaseStruct
*
StructFather
,
DrawStructureType
idtype
)
:
EDA_BaseStruct
(
StructFather
,
idtype
)
/**********************************************************************************************/
{
m_Layer
=
0
;
m_Width
=
0
;
// 0 = line, > 0 = tracks, bus ...
};
/*********************************************************/
/*********************************************************/
/* EDA_TextStruct (classe de base, non utilis� seule */
/* EDA_TextStruct (classe de base, non utilis� seule */
/*********************************************************/
/*********************************************************/
...
...
eeschema/affiche.cpp
View file @
f3c324d5
/**********************************************************/
/**********************************************************/
/* Routines d'affichage de parametres et caracteristiques */
/* Routines d'affichage de parametres et caracteristiques */
/**********************************************************/
/**********************************************************/
/* Fichier AFFICHE.CPP */
/* Fichier AFFICHE.CPP */
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -15,136 +15,175 @@
...
@@ -15,136 +15,175 @@
/***********************************************************/
/***********************************************************/
void
DrawSheetStruct
::
Display_Infos
(
WinEDA_DrawFrame
*
frame
)
void
DrawSheetStruct
::
Display_Infos
(
WinEDA_DrawFrame
*
frame
)
/************************************************************/
/************************************************************/
{
{
frame
->
MsgPanel
->
EraseMsgBox
();
frame
->
MsgPanel
->
EraseMsgBox
();
Affiche_1_Parametre
(
frame
,
1
,
_
(
"Name"
),
m_SheetName
,
CYAN
);
Affiche_1_Parametre
(
frame
,
1
,
_
(
"Name"
),
m_SheetName
,
CYAN
);
Affiche_1_Parametre
(
frame
,
30
,
_
(
"FileName"
),
m_FileName
,
BROWN
);
Affiche_1_Parametre
(
frame
,
30
,
_
(
"FileName"
),
m_FileName
,
BROWN
);
}
}
/***************************************************************/
/***************************************************************/
void
EDA_SchComponentStruct
::
Display_Infos
(
WinEDA_DrawFrame
*
frame
)
void
EDA_SchComponentStruct
::
Display_Infos
(
WinEDA_DrawFrame
*
frame
)
/***************************************************************/
/***************************************************************/
{
{
EDA_LibComponentStruct
*
Entry
=
FindLibPart
(
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);;
EDA_LibComponentStruct
*
Entry
=
FindLibPart
(
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);;
wxString
msg
;
frame
->
MsgPanel
->
EraseMsgBox
();
Affiche_1_Parametre
(
frame
,
1
,
_
(
"Ref"
),
wxString
msg
;
m_Field
[
REFERENCE
].
m_Text
,
DARKCYAN
);
if
(
Entry
&&
Entry
->
m_Options
==
ENTRY_POWER
)
frame
->
MsgPanel
->
EraseMsgBox
();
msg
=
_
(
"Pwr Symb"
);
else
msg
=
_
(
"Val"
);
Affiche_1_Parametre
(
frame
,
10
,
msg
,
m_Field
[
VALUE
].
m_Text
,
DARKCYAN
);
Affiche_1_Parametre
(
frame
,
28
,
_
(
"RefLib"
),
m_ChipName
.
GetData
(),
BROWN
);
Affiche_1_Parametre
(
frame
,
1
,
_
(
"Ref"
),
m_Field
[
REFERENCE
].
m_Text
,
DARKCYAN
);
msg
=
FindLibName
;
if
(
Entry
&&
Entry
->
m_Options
==
ENTRY_POWER
)
Affiche_1_Parametre
(
frame
,
40
,
_
(
"Lib"
),
msg
,
DARKRED
);
msg
=
_
(
"Pwr Symb"
);
else
msg
=
_
(
"Val"
);
Affiche_1_Parametre
(
frame
,
10
,
msg
,
m_Field
[
VALUE
].
m_Text
,
DARKCYAN
);
if
(
Entry
)
Affiche_1_Parametre
(
frame
,
28
,
_
(
"RefLib"
),
m_ChipName
.
GetData
(),
BROWN
);
{
Affiche_1_Parametre
(
frame
,
52
,
Entry
->
m_Doc
,
wxEmptyString
,
DARKCYAN
);
Affiche_1_Parametre
(
frame
,
52
,
wxEmptyString
,
Entry
->
m_KeyWord
,
DARKGREEN
);
}
}
msg
=
FindLibName
;
Affiche_1_Parametre
(
frame
,
40
,
_
(
"Lib"
),
msg
,
DARKRED
);
if
(
Entry
)
{
Affiche_1_Parametre
(
frame
,
52
,
Entry
->
m_Doc
,
wxEmptyString
,
DARKCYAN
);
Affiche_1_Parametre
(
frame
,
52
,
wxEmptyString
,
Entry
->
m_KeyWord
,
DARKGREEN
);
}
}
/*******************************************************/
/*******************************************************/
void
LibDrawPin
::
Display_Infos
(
WinEDA_DrawFrame
*
frame
)
void
LibDrawPin
::
Display_Infos
(
WinEDA_DrawFrame
*
frame
)
/*******************************************************/
/*******************************************************/
/* Affiche en bas d'ecran les caracteristiques de la pin
/* Affiche en bas d'ecran les caracteristiques de la pin
*/
*/
{
{
wxString
Text
;
wxString
Text
;
int
ii
;
int
ii
;
frame
->
MsgPanel
->
EraseMsgBox
();
/* Affichage du nom */
Affiche_1_Parametre
(
frame
,
24
,
_
(
"PinName"
),
m_PinName
,
DARKCYAN
);
frame
->
MsgPanel
->
EraseMsgBox
();
/* Affichage du numero */
if
(
m_PinNum
==
0
)
Text
=
wxT
(
"?"
);
else
ReturnPinStringNum
(
Text
);
/* Affichage du nom */
Affiche_1_Parametre
(
frame
,
40
,
_
(
"PinNum"
),
Text
,
DARKCYAN
);
Affiche_1_Parametre
(
frame
,
24
,
_
(
"PinName"
),
m_PinName
,
DARKCYAN
);
/* Affichage du numero
*/
/* Affichage du type
*/
if
(
m_PinNum
==
0
)
Text
=
wxT
(
"?"
)
;
ii
=
m_PinType
;
else
ReturnPinStringNum
(
Text
);
Affiche_1_Parametre
(
frame
,
48
,
_
(
"PinType"
),
MsgPinElectricType
[
ii
],
RED
);
Affiche_1_Parametre
(
frame
,
40
,
_
(
"PinNum"
),
Text
,
DARKCYAN
);
/* Affichage de la visiblite */
ii
=
m_Attributs
;
if
(
ii
&
1
)
Text
=
_
(
"no"
);
else
Text
=
_
(
"yes"
);
Affiche_1_Parametre
(
frame
,
58
,
_
(
"Display"
),
Text
,
DARKGREEN
);
/* Affichage du type
*/
/* Affichage de la longueur
*/
ii
=
m_PinType
;
Text
.
Printf
(
wxT
(
"%d"
),
m_PinLen
)
;
Affiche_1_Parametre
(
frame
,
48
,
_
(
"PinType"
),
MsgPinElectricType
[
ii
],
RED
);
Affiche_1_Parametre
(
frame
,
66
,
_
(
"Lengh"
),
Text
,
MAGENTA
);
/* Affichage de la visiblite
*/
/* Affichage de l'orientation
*/
ii
=
m_Attributs
;
switch
(
m_Orient
)
if
(
ii
&
1
)
Text
=
_
(
"no"
);
{
else
Text
=
_
(
"yes"
);
case
PIN_UP
:
Affiche_1_Parametre
(
frame
,
58
,
_
(
"Display"
),
Text
,
DARKGREEN
)
;
Text
=
_
(
"Up"
);
break
;
/* Affichage de la longueur */
case
PIN_DOWN
:
Text
.
Printf
(
wxT
(
"%d"
),
m_PinLen
);
Text
=
_
(
"Down"
);
break
;
Affiche_1_Parametre
(
frame
,
66
,
_
(
"Lengh"
),
Text
,
MAGENTA
);
/* Affichage de l'orientation */
case
PIN_LEFT
:
switch
(
m_Orient
)
Text
=
_
(
"Left"
);
break
;
{
case
PIN_UP
:
Text
=
_
(
"Up"
);
break
;
case
PIN_DOWN
:
Text
=
_
(
"Down"
);
break
;
case
PIN_LEFT
:
Text
=
_
(
"Left"
);
break
;
case
PIN_RIGHT
:
Text
=
_
(
"Right"
);
break
;
default
:
Text
=
wxT
(
"??"
);
break
;
}
Affiche_1_Parametre
(
frame
,
72
,
_
(
"Orient"
),
Text
,
MAGENTA
);
case
PIN_RIGHT
:
Text
=
_
(
"Right"
);
break
;
default
:
Text
=
wxT
(
"??"
);
break
;
}
Affiche_1_Parametre
(
frame
,
72
,
_
(
"Orient"
),
Text
,
MAGENTA
);
}
}
/***********************************************************************/
/***********************************************************************/
void
LibEDA_BaseStruct
::
Display_Infos_DrawEntry
(
WinEDA_DrawFrame
*
frame
)
void
LibEDA_BaseStruct
::
Display_Infos_DrawEntry
(
WinEDA_DrawFrame
*
frame
)
/***********************************************************************/
/***********************************************************************/
/* Affiche en bas d'ecran les caracteristiques de l'element
/* Affiche en bas d'ecran les caracteristiques de l'element
*/
*/
{
{
wxString
msg
;
wxString
msg
;
frame
->
MsgPanel
->
EraseMsgBox
();
frame
->
MsgPanel
->
EraseMsgBox
();
/* affichage du type */
/* affichage du type */
msg
=
wxT
(
"??"
);
msg
=
wxT
(
"??"
);
switch
(
m_StructType
)
{
case
COMPONENT_ARC_DRAW_TYPE
:
msg
=
wxT
(
"Arc"
);
break
;
case
COMPONENT_CIRCLE_DRAW_TYPE
:
msg
=
wxT
(
"Circle"
);
break
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
msg
=
wxT
(
"Text"
);
break
;
case
COMPONENT_RECT_DRAW_TYPE
:
msg
=
wxT
(
"Rect"
);
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
msg
=
wxT
(
"PolyLine"
);
break
;
case
COMPONENT_LINE_DRAW_TYPE
:
msg
=
wxT
(
"Segment"
);
break
;
case
COMPONENT_PIN_DRAW_TYPE
:
((
LibDrawPin
*
)
this
)
->
Display_Infos
(
frame
);
msg
=
wxT
(
"Pin"
);
break
;
}
Affiche_1_Parametre
(
frame
,
1
,
wxT
(
"Type"
),
msg
,
CYAN
);
/* Affichage de l'appartenance */
if
(
m_Unit
==
0
)
msg
=
_
(
"All"
);
else
msg
.
Printf
(
wxT
(
"%d"
),
m_Unit
);
Affiche_1_Parametre
(
frame
,
10
,
_
(
"Unit"
),
msg
,
BROWN
);
if
(
m_Convert
==
0
)
msg
=
_
(
"All"
);
else
if
(
m_Convert
==
1
)
msg
=
_
(
"no"
);
else
if
(
m_Convert
==
2
)
msg
=
_
(
"yes"
);
else
msg
=
wxT
(
"?"
);
Affiche_1_Parametre
(
frame
,
16
,
_
(
"Convert"
),
msg
,
BROWN
);
if
(
m_Width
)
valeur_param
(
m_Width
,
msg
);
else
msg
=
_
(
"default"
);
Affiche_1_Parametre
(
frame
,
24
,
_
(
"Width"
),
msg
,
BLUE
);
}
switch
(
m_StructType
)
{
case
COMPONENT_ARC_DRAW_TYPE
:
msg
=
wxT
(
"Arc"
);
break
;
case
COMPONENT_CIRCLE_DRAW_TYPE
:
msg
=
wxT
(
"Circle"
);
break
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
msg
=
wxT
(
"Text"
);
break
;
case
COMPONENT_RECT_DRAW_TYPE
:
msg
=
wxT
(
"Rect"
);
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
msg
=
wxT
(
"PolyLine"
);
break
;
case
COMPONENT_LINE_DRAW_TYPE
:
msg
=
wxT
(
"Segment"
);
break
;
case
COMPONENT_PIN_DRAW_TYPE
:
(
(
LibDrawPin
*
)
this
)
->
Display_Infos
(
frame
);
msg
=
wxT
(
"Pin"
);
break
;
default
:
;
}
Affiche_1_Parametre
(
frame
,
1
,
wxT
(
"Type"
),
msg
,
CYAN
);
/* Affichage de l'appartenance */
if
(
m_Unit
==
0
)
msg
=
_
(
"All"
);
else
msg
.
Printf
(
wxT
(
"%d"
),
m_Unit
);
Affiche_1_Parametre
(
frame
,
10
,
_
(
"Unit"
),
msg
,
BROWN
);
if
(
m_Convert
==
0
)
msg
=
_
(
"All"
);
else
if
(
m_Convert
==
1
)
msg
=
_
(
"no"
);
else
if
(
m_Convert
==
2
)
msg
=
_
(
"yes"
);
else
msg
=
wxT
(
"?"
);
Affiche_1_Parametre
(
frame
,
16
,
_
(
"Convert"
),
msg
,
BROWN
);
if
(
m_Width
)
valeur_param
(
m_Width
,
msg
);
else
msg
=
_
(
"default"
);
Affiche_1_Parametre
(
frame
,
24
,
_
(
"Width"
),
msg
,
BLUE
);
}
eeschema/block.cpp
View file @
f3c324d5
...
@@ -841,6 +841,9 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
...
@@ -841,6 +841,9 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
sheet
->
m_FileName
=
sheet
->
m_SheetName
+
wxT
(
".sch"
);
sheet
->
m_FileName
=
sheet
->
m_SheetName
+
wxT
(
".sch"
);
break
;
break
;
}
}
default
:
;
}
}
SetStructFather
(
Struct
,
screen
);
SetStructFather
(
Struct
,
screen
);
...
...
eeschema/block_libedit.cpp
View file @
f3c324d5
...
@@ -594,6 +594,9 @@ void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
...
@@ -594,6 +594,9 @@ void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
(
(
LibDrawText
*
)
item
)
->
m_Pos
.
x
+=
offset
.
x
;
(
(
LibDrawText
*
)
item
)
->
m_Pos
.
x
+=
offset
.
x
;
(
(
LibDrawText
*
)
item
)
->
m_Pos
.
y
+=
offset
.
y
;
(
(
LibDrawText
*
)
item
)
->
m_Pos
.
y
+=
offset
.
y
;
break
;
break
;
default
:
;
}
}
item
->
m_Flags
=
item
->
m_Selected
=
0
;
item
->
m_Flags
=
item
->
m_Selected
=
0
;
...
@@ -701,6 +704,9 @@ void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
...
@@ -701,6 +704,9 @@ void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
SETMIRROR
(
(
(
LibDrawText
*
)
item
)
->
m_Pos
.
x
);
SETMIRROR
(
(
(
LibDrawText
*
)
item
)
->
m_Pos
.
x
);
break
;
break
;
default
:
;
}
}
item
->
m_Flags
=
item
->
m_Selected
=
0
;
item
->
m_Flags
=
item
->
m_Selected
=
0
;
...
...
eeschema/cmpclass.cpp
View file @
f3c324d5
...
@@ -148,7 +148,7 @@ wxString DrawMarkerStruct::GetComment( void )
...
@@ -148,7 +148,7 @@ wxString DrawMarkerStruct::GetComment( void )
/***************************/
/***************************/
EDA_DrawLineStruct
::
EDA_DrawLineStruct
(
const
wxPoint
&
pos
,
int
layer
)
:
EDA_DrawLineStruct
::
EDA_DrawLineStruct
(
const
wxPoint
&
pos
,
int
layer
)
:
EDA_Base
Line
Struct
(
NULL
,
DRAW_SEGMENT_STRUCT_TYPE
)
EDA_BaseStruct
(
NULL
,
DRAW_SEGMENT_STRUCT_TYPE
)
{
{
m_Start
=
pos
;
m_Start
=
pos
;
m_End
=
pos
;
m_End
=
pos
;
...
...
eeschema/component_class.cpp
View file @
f3c324d5
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
/***************************/
/***************************/
/***********************************************************************************/
/***********************************************************************************/
DrawPartStruct
::
DrawPartStruct
(
DrawStructureType
struct_type
,
const
wxPoint
&
pos
)
:
DrawPartStruct
::
DrawPartStruct
(
KICAD_T
struct_type
,
const
wxPoint
&
pos
)
:
EDA_BaseStruct
(
struct_type
)
EDA_BaseStruct
(
struct_type
)
/***********************************************************************************/
/***********************************************************************************/
{
{
...
...
eeschema/component_class.h
View file @
f3c324d5
...
@@ -70,7 +70,7 @@ public:
...
@@ -70,7 +70,7 @@ public:
wxPoint
m_Pos
;
/* Exact position of part. */
wxPoint
m_Pos
;
/* Exact position of part. */
public
:
public
:
DrawPartStruct
(
DrawStructureType
struct_type
,
const
wxPoint
&
pos
);
DrawPartStruct
(
KICAD_T
struct_type
,
const
wxPoint
&
pos
);
~
DrawPartStruct
(
void
);
~
DrawPartStruct
(
void
);
};
};
...
...
eeschema/dangling_ends.cpp
View file @
f3c324d5
/*********************/
/*********************/
/* dangling_ends.cpp */
/* dangling_ends.cpp */
/*********************/
/*********************/
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -9,401 +9,452 @@
...
@@ -9,401 +9,452 @@
#include "libcmp.h"
#include "libcmp.h"
#include "general.h"
#include "general.h"
#include "netlist.h"
/* Definitions generales liees au calcul de netliste */
#include "netlist.h"
/* Definitions generales liees au calcul de netliste */
#include "protos.h"
#include "protos.h"
enum
End_Type
enum
End_Type
{
{
UNKNOWN
=
0
,
UNKNOWN
=
0
,
WIRE_START_END
,
WIRE_START_END
,
WIRE_END_END
,
WIRE_END_END
,
BUS_START_END
,
BUS_START_END
,
BUS_END_END
,
BUS_END_END
,
JUNCTION_END
,
JUNCTION_END
,
PIN_END
,
PIN_END
,
LABEL_END
,
LABEL_END
,
ENTRY_END
,
ENTRY_END
,
SHEET_LABEL_END
SHEET_LABEL_END
};
};
class
DanglingEndHandle
class
DanglingEndHandle
{
{
public
:
public
:
const
void
*
m_Item
;
const
void
*
m_Item
;
wxPoint
m_Pos
;
wxPoint
m_Pos
;
int
m_Type
;
int
m_Type
;
DanglingEndHandle
*
m_Pnext
;
DanglingEndHandle
*
m_Pnext
;
DanglingEndHandle
(
int
type
)
DanglingEndHandle
(
int
type
)
{
{
m_Item
=
NULL
;
m_Item
=
NULL
;
m_Type
=
type
;
m_Type
=
type
;
m_Pnext
=
NULL
;
m_Pnext
=
NULL
;
}
}
};
};
DanglingEndHandle
*
ItemList
;
DanglingEndHandle
*
ItemList
;
static
void
TestWireForDangling
(
EDA_DrawLineStruct
*
DrawRef
,
static
void
TestWireForDangling
(
EDA_DrawLineStruct
*
DrawRef
,
WinEDA_SchematicFrame
*
frame
,
wxDC
*
DC
);
WinEDA_SchematicFrame
*
frame
,
wxDC
*
DC
);
void
TestLabelForDangling
(
DrawTextStruct
*
label
,
void
TestLabelForDangling
(
DrawTextStruct
*
label
,
WinEDA_SchematicFrame
*
frame
,
wxDC
*
DC
);
WinEDA_SchematicFrame
*
frame
,
wxDC
*
DC
);
DanglingEndHandle
*
RebuildEndList
(
EDA_BaseStruct
*
DrawList
);
DanglingEndHandle
*
RebuildEndList
(
EDA_BaseStruct
*
DrawList
);
/**********************************************************/
/**********************************************************/
bool
SegmentIntersect
(
int
Sx1
,
int
Sy1
,
int
Sx2
,
int
Sy2
,
bool
SegmentIntersect
(
int
Sx1
,
int
Sy1
,
int
Sx2
,
int
Sy2
,
int
Px1
,
int
Py1
)
int
Px1
,
int
Py1
)
/**********************************************************/
/**********************************************************/
/* Retourne TRUE si le point P est sur le segment S.
/* Retourne TRUE si le point P est sur le segment S.
Le segment est suppose horizontal ou vertical.
*
Le segment est suppose horizontal ou vertical.
*/
*/
{
{
int
Sxmin
,
Sxmax
,
Symin
,
Symax
;
int
Sxmin
,
Sxmax
,
Symin
,
Symax
;
if
(
Sx1
==
Sx2
)
/* Line S is vertical. */
if
(
Sx1
==
Sx2
)
/* Line S is vertical. */
{
{
Symin
=
MIN
(
Sy1
,
Sy2
);
Symax
=
MAX
(
Sy1
,
Sy2
);
Symin
=
MIN
(
Sy1
,
Sy2
);
Symax
=
MAX
(
Sy1
,
Sy2
);
if
(
Px1
!=
Sx1
)
return
FALSE
;
if
(
Px1
!=
Sx1
)
if
(
Py1
>=
Symin
&&
Py1
<=
Symax
)
return
TRUE
;
return
FALSE
;
else
return
FALSE
;
if
(
Py1
>=
Symin
&&
Py1
<=
Symax
)
}
return
TRUE
;
else
else
if
(
Sy1
==
Sy2
)
/* Line S is horizontal. */
return
FALSE
;
{
}
Sxmin
=
MIN
(
Sx1
,
Sx2
);
Sxmax
=
MAX
(
Sx1
,
Sx2
);
else
if
(
Sy1
==
Sy2
)
/* Line S is horizontal. */
if
(
Py1
!=
Sy1
)
return
FALSE
;
{
if
(
Px1
>=
Sxmin
&&
Px1
<=
Sxmax
)
return
TRUE
;
Sxmin
=
MIN
(
Sx1
,
Sx2
);
Sxmax
=
MAX
(
Sx1
,
Sx2
);
else
return
FALSE
;
if
(
Py1
!=
Sy1
)
}
return
FALSE
;
else
return
FALSE
;
// Segments quelconques
if
(
Px1
>=
Sxmin
&&
Px1
<=
Sxmax
)
return
TRUE
;
else
return
FALSE
;
}
else
return
FALSE
;
// Segments quelconques
}
}
/******************************************************************************/
/******************************************************************************/
void
WinEDA_SchematicFrame
::
TestDanglingEnds
(
EDA_BaseStruct
*
DrawList
,
wxDC
*
DC
)
void
WinEDA_SchematicFrame
::
TestDanglingEnds
(
EDA_BaseStruct
*
DrawList
,
wxDC
*
DC
)
/******************************************************************************/
/******************************************************************************/
/* Met a jour les membres m_Dangling des wires, bus, labels
/* Met a jour les membres m_Dangling des wires, bus, labels
*/
*/
{
{
EDA_BaseStruct
*
DrawItem
;
EDA_BaseStruct
*
DrawItem
;
const
DanglingEndHandle
*
DanglingItem
,
*
nextitem
;
const
DanglingEndHandle
*
DanglingItem
,
*
nextitem
;
if
(
ItemList
)
if
(
ItemList
)
for
(
DanglingItem
=
ItemList
;
DanglingItem
!=
NULL
;
DanglingItem
=
nextitem
)
for
(
DanglingItem
=
ItemList
;
DanglingItem
!=
NULL
;
DanglingItem
=
nextitem
)
{
{
nextitem
=
DanglingItem
->
m_Pnext
;
nextitem
=
DanglingItem
->
m_Pnext
;
delete
DanglingItem
;
delete
DanglingItem
;
}
}
ItemList
=
RebuildEndList
(
DrawList
);
ItemList
=
RebuildEndList
(
DrawList
);
// Controle des elements
for
(
DrawItem
=
DrawList
;
DrawItem
!=
NULL
;
DrawItem
=
DrawItem
->
Pnext
)
// Controle des elements
{
for
(
DrawItem
=
DrawList
;
DrawItem
!=
NULL
;
DrawItem
=
DrawItem
->
Pnext
)
switch
(
DrawItem
->
m_StructType
)
{
{
switch
(
DrawItem
->
m_StructType
)
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
{
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
#undef STRUCT
case
DRAW_LABEL_STRUCT_TYPE
:
#define STRUCT ((DrawLabelStruct*)DrawItem)
#undef STRUCT
TestLabelForDangling
(
STRUCT
,
this
,
DC
);
#define STRUCT ( (DrawLabelStruct*) DrawItem )
break
;
TestLabelForDangling
(
STRUCT
,
this
,
DC
);
break
;
break
;
break
;
case
DRAW_SEGMENT_STRUCT_TYPE
:
#undef STRUCT
case
DRAW_SEGMENT_STRUCT_TYPE
:
#define STRUCT ((EDA_DrawLineStruct*)DrawItem)
#undef STRUCT
if
(
STRUCT
->
m_Layer
==
LAYER_WIRE
)
#define STRUCT ( (EDA_DrawLineStruct*) DrawItem )
{
if
(
STRUCT
->
m_Layer
==
LAYER_WIRE
)
TestWireForDangling
(
STRUCT
,
this
,
DC
);
{
break
;
TestWireForDangling
(
STRUCT
,
this
,
DC
);
}
break
;
if
(
STRUCT
->
m_Layer
==
LAYER_NOTES
)
break
;
}
if
(
STRUCT
->
m_Layer
==
LAYER_BUS
)
if
(
STRUCT
->
m_Layer
==
LAYER_NOTES
)
{
break
;
STRUCT
->
m_StartIsDangling
=
if
(
STRUCT
->
m_Layer
==
LAYER_BUS
)
STRUCT
->
m_EndIsDangling
=
FALSE
;
{
break
;
STRUCT
->
m_StartIsDangling
=
}
STRUCT
->
m_EndIsDangling
=
FALSE
;
break
;
break
;
}
}
}
break
;
default
:
;
}
}
}
}
/********************************************************************/
/********************************************************************/
LibDrawPin
*
WinEDA_SchematicFrame
::
LocatePinEnd
(
EDA_BaseStruct
*
DrawList
,
LibDrawPin
*
WinEDA_SchematicFrame
::
LocatePinEnd
(
EDA_BaseStruct
*
DrawList
,
const
wxPoint
&
pos
)
const
wxPoint
&
pos
)
/********************************************************************/
/********************************************************************/
/* Teste si le point de coordonnes pos est sur l'extrmit d'une PIN
/* Teste si le point de coordonnes pos est sur l'extrmit d'une PIN
retourne un pointeur sur la pin
*
retourne un pointeur sur la pin
NULL sinon
*
NULL sinon
*/
*/
{
{
EDA_SchComponentStruct
*
DrawLibItem
;
EDA_SchComponentStruct
*
DrawLibItem
;
LibDrawPin
*
Pin
;
LibDrawPin
*
Pin
;
wxPoint
pinpos
;
wxPoint
pinpos
;
Pin
=
LocateAnyPin
(
DrawList
,
pos
,
&
DrawLibItem
);
Pin
=
LocateAnyPin
(
DrawList
,
pos
,
&
DrawLibItem
);
if
(
!
Pin
)
return
NULL
;
if
(
!
Pin
)
return
NULL
;
pinpos
=
Pin
->
m_Pos
;
pinpos
=
Pin
->
m_Pos
;
if
(
DrawLibItem
==
NULL
)
pinpos
.
y
=
-
pinpos
.
y
;
if
(
DrawLibItem
==
NULL
)
else
pinpos
.
y
=
-
pinpos
.
y
;
{
int
x1
=
pinpos
.
x
,
y1
=
pinpos
.
y
;
else
pinpos
.
x
=
DrawLibItem
->
m_Pos
.
x
+
DrawLibItem
->
m_Transform
[
0
][
0
]
*
x1
{
+
DrawLibItem
->
m_Transform
[
0
][
1
]
*
y1
;
int
x1
=
pinpos
.
x
,
y1
=
pinpos
.
y
;
pinpos
.
y
=
DrawLibItem
->
m_Pos
.
y
+
DrawLibItem
->
m_Transform
[
1
][
0
]
*
x1
pinpos
.
x
=
DrawLibItem
->
m_Pos
.
x
+
DrawLibItem
->
m_Transform
[
0
][
0
]
*
x1
+
DrawLibItem
->
m_Transform
[
1
][
1
]
*
y1
;
+
DrawLibItem
->
m_Transform
[
0
][
1
]
*
y1
;
}
pinpos
.
y
=
DrawLibItem
->
m_Pos
.
y
+
DrawLibItem
->
m_Transform
[
1
][
0
]
*
x1
+
DrawLibItem
->
m_Transform
[
1
][
1
]
*
y1
;
if
(
(
pos
.
x
==
pinpos
.
x
)
&&
(
pos
.
y
==
pinpos
.
y
)
)
return
Pin
;
}
return
NULL
;
if
(
(
pos
.
x
==
pinpos
.
x
)
&&
(
pos
.
y
==
pinpos
.
y
)
)
return
Pin
;
return
NULL
;
}
}
/****************************************************************************/
/****************************************************************************/
void
TestWireForDangling
(
EDA_DrawLineStruct
*
DrawRef
,
void
TestWireForDangling
(
EDA_DrawLineStruct
*
DrawRef
,
WinEDA_SchematicFrame
*
frame
,
wxDC
*
DC
)
WinEDA_SchematicFrame
*
frame
,
wxDC
*
DC
)
/****************************************************************************/
/****************************************************************************/
{
{
DanglingEndHandle
*
terminal_item
;
DanglingEndHandle
*
terminal_item
;
bool
Sdangstate
=
TRUE
,
Edangstate
=
TRUE
;
bool
Sdangstate
=
TRUE
,
Edangstate
=
TRUE
;
for
(
terminal_item
=
ItemList
;
terminal_item
!=
NULL
;
for
(
terminal_item
=
ItemList
;
terminal_item
!=
NULL
;
terminal_item
=
terminal_item
->
m_Pnext
)
terminal_item
=
terminal_item
->
m_Pnext
)
{
{
if
(
terminal_item
->
m_Item
==
DrawRef
)
continue
;
if
(
terminal_item
->
m_Item
==
DrawRef
)
continue
;
if
(
(
DrawRef
->
m_Start
.
x
==
terminal_item
->
m_Pos
.
x
)
&&
(
DrawRef
->
m_Start
.
y
==
terminal_item
->
m_Pos
.
y
)
)
if
(
(
DrawRef
->
m_Start
.
x
==
terminal_item
->
m_Pos
.
x
)
Sdangstate
=
FALSE
;
&&
(
DrawRef
->
m_Start
.
y
==
terminal_item
->
m_Pos
.
y
)
)
Sdangstate
=
FALSE
;
if
(
(
DrawRef
->
m_End
.
x
==
terminal_item
->
m_Pos
.
x
)
&&
(
DrawRef
->
m_End
.
y
==
terminal_item
->
m_Pos
.
y
)
)
if
(
(
DrawRef
->
m_End
.
x
==
terminal_item
->
m_Pos
.
x
)
Edangstate
=
FALSE
;
&&
(
DrawRef
->
m_End
.
y
==
terminal_item
->
m_Pos
.
y
)
)
Edangstate
=
FALSE
;
if
(
(
Sdangstate
==
FALSE
)
&&
(
Edangstate
==
FALSE
)
)
break
;
if
(
(
Sdangstate
==
FALSE
)
&&
(
Edangstate
==
FALSE
)
)
}
break
;
}
if
(
(
Sdangstate
!=
DrawRef
->
m_StartIsDangling
)
||
(
Edangstate
!=
DrawRef
->
m_EndIsDangling
)
)
if
(
(
Sdangstate
!=
DrawRef
->
m_StartIsDangling
)
{
||
(
Edangstate
!=
DrawRef
->
m_EndIsDangling
)
)
if
(
DC
)
{
RedrawOneStruct
(
frame
->
DrawPanel
,
DC
,
DrawRef
,
g_XorMode
);
if
(
DC
)
DrawRef
->
m_StartIsDangling
=
Sdangstate
;
RedrawOneStruct
(
frame
->
DrawPanel
,
DC
,
DrawRef
,
g_XorMode
);
DrawRef
->
m_EndIsDangling
=
Edangstate
;
DrawRef
->
m_StartIsDangling
=
Sdangstate
;
if
(
DC
)
DrawRef
->
m_EndIsDangling
=
Edangstate
;
RedrawOneStruct
(
frame
->
DrawPanel
,
DC
,
DrawRef
,
GR_DEFAULT_DRAWMODE
);
if
(
DC
)
}
RedrawOneStruct
(
frame
->
DrawPanel
,
DC
,
DrawRef
,
GR_DEFAULT_DRAWMODE
);
}
}
}
/********************************************************/
/********************************************************/
void
TestLabelForDangling
(
DrawTextStruct
*
label
,
void
TestLabelForDangling
(
DrawTextStruct
*
label
,
WinEDA_SchematicFrame
*
frame
,
wxDC
*
DC
)
WinEDA_SchematicFrame
*
frame
,
wxDC
*
DC
)
/********************************************************/
/********************************************************/
{
{
DanglingEndHandle
*
terminal_item
;
DanglingEndHandle
*
terminal_item
;
bool
dangstate
=
TRUE
;
bool
dangstate
=
TRUE
;
for
(
terminal_item
=
ItemList
;
terminal_item
!=
NULL
;
for
(
terminal_item
=
ItemList
;
terminal_item
!=
NULL
;
terminal_item
=
terminal_item
->
m_Pnext
)
terminal_item
=
terminal_item
->
m_Pnext
)
{
{
if
(
terminal_item
->
m_Item
==
label
)
continue
;
if
(
terminal_item
->
m_Item
==
label
)
switch
(
terminal_item
->
m_Type
)
continue
;
{
case
PIN_END
:
switch
(
terminal_item
->
m_Type
)
case
LABEL_END
:
{
case
SHEET_LABEL_END
:
case
PIN_END
:
if
(
(
label
->
m_Pos
.
x
==
terminal_item
->
m_Pos
.
x
)
&&
case
LABEL_END
:
(
label
->
m_Pos
.
y
==
terminal_item
->
m_Pos
.
y
)
)
case
SHEET_LABEL_END
:
dangstate
=
FALSE
;
if
(
(
label
->
m_Pos
.
x
==
terminal_item
->
m_Pos
.
x
)
break
;
&&
(
label
->
m_Pos
.
y
==
terminal_item
->
m_Pos
.
y
)
)
dangstate
=
FALSE
;
case
WIRE_START_END
:
break
;
case
BUS_START_END
:
dangstate
=
!
SegmentIntersect
(
terminal_item
->
m_Pos
.
x
,
case
WIRE_START_END
:
terminal_item
->
m_Pos
.
y
,
case
BUS_START_END
:
terminal_item
->
m_Pnext
->
m_Pos
.
x
,
dangstate
=
!
SegmentIntersect
(
terminal_item
->
m_Pos
.
x
,
terminal_item
->
m_Pnext
->
m_Pos
.
y
,
terminal_item
->
m_Pos
.
y
,
label
->
m_Pos
.
x
,
label
->
m_Pos
.
y
);
terminal_item
->
m_Pnext
->
m_Pos
.
x
,
terminal_item
=
terminal_item
->
m_Pnext
;
terminal_item
->
m_Pnext
->
m_Pos
.
y
,
break
;
label
->
m_Pos
.
x
,
label
->
m_Pos
.
y
);
terminal_item
=
terminal_item
->
m_Pnext
;
case
UNKNOWN
:
break
;
case
JUNCTION_END
:
case
ENTRY_END
:
case
UNKNOWN
:
case
WIRE_END_END
:
case
JUNCTION_END
:
case
BUS_END_END
:
case
ENTRY_END
:
break
;
case
WIRE_END_END
:
}
case
BUS_END_END
:
break
;
if
(
dangstate
==
FALSE
)
break
;
}
}
if
(
dangstate
==
FALSE
)
if
(
dangstate
!=
label
->
m_IsDangling
)
break
;
{
}
if
(
DC
)
RedrawOneStruct
(
frame
->
DrawPanel
,
DC
,
label
,
g_XorMode
);
if
(
dangstate
!=
label
->
m_IsDangling
)
label
->
m_IsDangling
=
dangstate
;
{
if
(
DC
)
if
(
DC
)
RedrawOneStruct
(
frame
->
DrawPanel
,
DC
,
label
,
GR_DEFAULT_DRAWMODE
);
RedrawOneStruct
(
frame
->
DrawPanel
,
DC
,
label
,
g_XorMode
);
}
label
->
m_IsDangling
=
dangstate
;
if
(
DC
)
RedrawOneStruct
(
frame
->
DrawPanel
,
DC
,
label
,
GR_DEFAULT_DRAWMODE
);
}
}
}
/****************************************************/
/****************************************************/
wxPoint
ReturnPinPhysicalPosition
(
LibDrawPin
*
Pin
,
wxPoint
ReturnPinPhysicalPosition
(
LibDrawPin
*
Pin
,
EDA_SchComponentStruct
*
DrawLibItem
)
EDA_SchComponentStruct
*
DrawLibItem
)
/****************************************************/
/****************************************************/
/* Retourne la position physique de la pin, qui dpend de l'orientation
/* Retourne la position physique de la pin, qui dpend de l'orientation
du composant */
*
du composant */
{
{
wxPoint
PinPos
=
Pin
->
m_Pos
;
wxPoint
PinPos
=
Pin
->
m_Pos
;
if
(
DrawLibItem
==
NULL
)
PinPos
.
y
=
-
PinPos
.
y
;
if
(
DrawLibItem
==
NULL
)
PinPos
.
y
=
-
PinPos
.
y
;
else
{
else
int
x
=
Pin
->
m_Pos
.
x
,
y
=
Pin
->
m_Pos
.
y
;
{
PinPos
.
x
=
DrawLibItem
->
m_Pos
.
x
+
DrawLibItem
->
m_Transform
[
0
][
0
]
*
x
int
x
=
Pin
->
m_Pos
.
x
,
y
=
Pin
->
m_Pos
.
y
;
+
DrawLibItem
->
m_Transform
[
0
][
1
]
*
y
;
PinPos
.
x
=
DrawLibItem
->
m_Pos
.
x
+
DrawLibItem
->
m_Transform
[
0
][
0
]
*
x
PinPos
.
y
=
DrawLibItem
->
m_Pos
.
y
+
DrawLibItem
->
m_Transform
[
1
][
0
]
*
x
+
DrawLibItem
->
m_Transform
[
0
][
1
]
*
y
;
+
DrawLibItem
->
m_Transform
[
1
][
1
]
*
y
;
PinPos
.
y
=
DrawLibItem
->
m_Pos
.
y
+
DrawLibItem
->
m_Transform
[
1
][
0
]
*
x
}
+
DrawLibItem
->
m_Transform
[
1
][
1
]
*
y
;
}
return
PinPos
;
return
PinPos
;
}
}
/***********************************************************/
/***********************************************************/
DanglingEndHandle
*
RebuildEndList
(
EDA_BaseStruct
*
DrawList
)
DanglingEndHandle
*
RebuildEndList
(
EDA_BaseStruct
*
DrawList
)
/***********************************************************/
/***********************************************************/
{
{
DanglingEndHandle
*
StartList
=
NULL
,
*
item
,
*
lastitem
=
NULL
;
DanglingEndHandle
*
StartList
=
NULL
,
*
item
,
*
lastitem
=
NULL
;
EDA_BaseStruct
*
DrawItem
;
EDA_BaseStruct
*
DrawItem
;
for
(
DrawItem
=
DrawList
;
DrawItem
!=
NULL
;
DrawItem
=
DrawItem
->
Pnext
)
for
(
DrawItem
=
DrawList
;
DrawItem
!=
NULL
;
DrawItem
=
DrawItem
->
Pnext
)
{
{
switch
(
DrawItem
->
m_StructType
)
switch
(
DrawItem
->
m_StructType
)
{
{
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_LABEL_STRUCT_TYPE
:
break
;
break
;
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
#undef STRUCT
#undef STRUCT
#define STRUCT ((DrawGlobalLabelStruct*)DrawItem)
#define STRUCT ( (DrawGlobalLabelStruct*) DrawItem )
item
=
new
DanglingEndHandle
(
LABEL_END
);
item
=
new
DanglingEndHandle
(
LABEL_END
);
item
->
m_Item
=
DrawItem
;
item
->
m_Pos
=
STRUCT
->
m_Pos
;
item
->
m_Item
=
DrawItem
;
if
(
lastitem
)
lastitem
->
m_Pnext
=
item
;
item
->
m_Pos
=
STRUCT
->
m_Pos
;
else
StartList
=
item
;
if
(
lastitem
)
lastitem
=
item
;
lastitem
->
m_Pnext
=
item
;
break
;
else
StartList
=
item
;
case
DRAW_SEGMENT_STRUCT_TYPE
:
lastitem
=
item
;
#undef STRUCT
break
;
#define STRUCT ((EDA_DrawLineStruct*)DrawItem)
if
(
STRUCT
->
m_Layer
==
LAYER_NOTES
)
break
;
case
DRAW_SEGMENT_STRUCT_TYPE
:
if
(
(
STRUCT
->
m_Layer
==
LAYER_BUS
)
||
(
STRUCT
->
m_Layer
==
LAYER_WIRE
)
)
#undef STRUCT
{
#define STRUCT ( (EDA_DrawLineStruct*) DrawItem )
item
=
new
DanglingEndHandle
((
STRUCT
->
m_Layer
==
LAYER_BUS
)
?
if
(
STRUCT
->
m_Layer
==
LAYER_NOTES
)
BUS_START_END
:
WIRE_START_END
);
break
;
item
->
m_Item
=
DrawItem
;
if
(
(
STRUCT
->
m_Layer
==
LAYER_BUS
)
||
(
STRUCT
->
m_Layer
==
LAYER_WIRE
)
)
item
->
m_Pos
=
STRUCT
->
m_Start
;
{
if
(
lastitem
)
lastitem
->
m_Pnext
=
item
;
item
=
new
DanglingEndHandle
(
(
STRUCT
->
m_Layer
==
LAYER_BUS
)
?
else
StartList
=
item
;
BUS_START_END
:
WIRE_START_END
);
lastitem
=
item
;
item
=
new
DanglingEndHandle
((
STRUCT
->
m_Layer
==
LAYER_BUS
)
?
item
->
m_Item
=
DrawItem
;
BUS_END_END
:
WIRE_END_END
);
item
->
m_Pos
=
STRUCT
->
m_Start
;
item
->
m_Item
=
DrawItem
;
if
(
lastitem
)
item
->
m_Pos
=
STRUCT
->
m_End
;
lastitem
->
m_Pnext
=
item
;
lastitem
->
m_Pnext
=
item
;
else
lastitem
=
item
;
StartList
=
item
;
}
lastitem
=
item
;
break
;
item
=
new
DanglingEndHandle
(
(
STRUCT
->
m_Layer
==
LAYER_BUS
)
?
BUS_END_END
:
WIRE_END_END
);
case
DRAW_JUNCTION_STRUCT_TYPE
:
#undef STRUCT
item
->
m_Item
=
DrawItem
;
#define STRUCT ((DrawJunctionStruct*)DrawItem)
item
->
m_Pos
=
STRUCT
->
m_End
;
item
=
new
DanglingEndHandle
(
JUNCTION_END
);
lastitem
->
m_Pnext
=
item
;
item
->
m_Item
=
DrawItem
;
lastitem
=
item
;
item
->
m_Pos
=
STRUCT
->
m_Pos
;
}
if
(
lastitem
)
lastitem
->
m_Pnext
=
item
;
break
;
else
StartList
=
item
;
lastitem
=
item
;
case
DRAW_JUNCTION_STRUCT_TYPE
:
break
;
#undef STRUCT
#define STRUCT ( (DrawJunctionStruct*) DrawItem )
case
DRAW_BUSENTRY_STRUCT_TYPE
:
item
=
new
DanglingEndHandle
(
JUNCTION_END
);
#undef STRUCT
#define STRUCT ((DrawBusEntryStruct*)DrawItem)
item
->
m_Item
=
DrawItem
;
item
=
new
DanglingEndHandle
(
ENTRY_END
);
item
->
m_Pos
=
STRUCT
->
m_Pos
;
item
->
m_Item
=
DrawItem
;
if
(
lastitem
)
item
->
m_Pos
=
STRUCT
->
m_Pos
;
lastitem
->
m_Pnext
=
item
;
if
(
lastitem
)
lastitem
->
m_Pnext
=
item
;
else
else
StartList
=
item
;
StartList
=
item
;
lastitem
=
item
;
lastitem
=
item
;
item
=
new
DanglingEndHandle
(
ENTRY_END
);
break
;
item
->
m_Item
=
DrawItem
;
item
->
m_Pos
=
STRUCT
->
m_End
();
case
DRAW_BUSENTRY_STRUCT_TYPE
:
lastitem
->
m_Pnext
=
item
;
#undef STRUCT
lastitem
=
item
;
#define STRUCT ( (DrawBusEntryStruct*) DrawItem )
break
;
item
=
new
DanglingEndHandle
(
ENTRY_END
);
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
item
->
m_Item
=
DrawItem
;
{
item
->
m_Pos
=
STRUCT
->
m_Pos
;
#undef STRUCT
if
(
lastitem
)
#define STRUCT ((EDA_SchComponentStruct*)DrawItem)
lastitem
->
m_Pnext
=
item
;
EDA_LibComponentStruct
*
Entry
;
else
Entry
=
FindLibPart
(
STRUCT
->
m_ChipName
,
wxEmptyString
,
FIND_ROOT
);
StartList
=
item
;
if
(
Entry
==
NULL
)
break
;
lastitem
=
item
;
LibEDA_BaseStruct
*
DrawLibItem
=
Entry
->
m_Drawings
;
item
=
new
DanglingEndHandle
(
ENTRY_END
);
for
(
;
DrawLibItem
!=
NULL
;
DrawLibItem
=
DrawLibItem
->
Next
())
{
item
->
m_Item
=
DrawItem
;
if
(
DrawLibItem
->
m_StructType
!=
COMPONENT_PIN_DRAW_TYPE
)
continue
;
item
->
m_Pos
=
STRUCT
->
m_End
();
lastitem
->
m_Pnext
=
item
;
LibDrawPin
*
Pin
=
(
LibDrawPin
*
)
DrawLibItem
;
lastitem
=
item
;
break
;
if
(
Pin
->
m_Unit
&&
DrawLibItem
->
m_Unit
&&
(
DrawLibItem
->
m_Unit
!=
Pin
->
m_Unit
)
)
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
continue
;
{
#undef STRUCT
if
(
Pin
->
m_Convert
&&
DrawLibItem
->
m_Convert
&&
#define STRUCT ( (EDA_SchComponentStruct*) DrawItem )
(
DrawLibItem
->
m_Convert
!=
Pin
->
m_Convert
)
)
EDA_LibComponentStruct
*
Entry
;
continue
;
Entry
=
FindLibPart
(
STRUCT
->
m_ChipName
,
wxEmptyString
,
FIND_ROOT
);
if
(
Entry
==
NULL
)
item
=
new
DanglingEndHandle
(
PIN_END
);
break
;
item
->
m_Item
=
Pin
;
item
->
m_Pos
=
ReturnPinPhysicalPosition
(
Pin
,
STRUCT
);
LibEDA_BaseStruct
*
DrawLibItem
=
Entry
->
m_Drawings
;
if
(
lastitem
)
lastitem
->
m_Pnext
=
item
;
for
(
;
DrawLibItem
!=
NULL
;
DrawLibItem
=
DrawLibItem
->
Next
()
)
else
StartList
=
item
;
{
lastitem
=
item
;
if
(
DrawLibItem
->
m_StructType
!=
COMPONENT_PIN_DRAW_TYPE
)
}
continue
;
break
;
LibDrawPin
*
Pin
=
(
LibDrawPin
*
)
DrawLibItem
;
}
if
(
Pin
->
m_Unit
&&
DrawLibItem
->
m_Unit
case
DRAW_SHEET_STRUCT_TYPE
:
&&
(
DrawLibItem
->
m_Unit
!=
Pin
->
m_Unit
)
)
{
continue
;
#undef STRUCT
#define STRUCT ((DrawSheetStruct*)DrawItem)
if
(
Pin
->
m_Convert
&&
DrawLibItem
->
m_Convert
DrawSheetLabelStruct
*
pinsheet
=
STRUCT
->
m_Label
;
&&
(
DrawLibItem
->
m_Convert
!=
Pin
->
m_Convert
)
)
while
(
pinsheet
)
continue
;
{
item
=
new
DanglingEndHandle
(
SHEET_LABEL_END
);
item
=
new
DanglingEndHandle
(
PIN_END
);
item
->
m_Item
=
pinsheet
;
item
->
m_Pos
=
pinsheet
->
m_Pos
;
item
->
m_Item
=
Pin
;
if
(
lastitem
)
lastitem
->
m_Pnext
=
item
;
item
->
m_Pos
=
ReturnPinPhysicalPosition
(
Pin
,
STRUCT
);
else
StartList
=
item
;
if
(
lastitem
)
lastitem
=
item
;
lastitem
->
m_Pnext
=
item
;
pinsheet
=
(
DrawSheetLabelStruct
*
)
pinsheet
->
Pnext
;
else
}
StartList
=
item
;
break
;
lastitem
=
item
;
}
}
}
}
break
;
return
StartList
;
}
case
DRAW_SHEET_STRUCT_TYPE
:
{
#undef STRUCT
#define STRUCT ( (DrawSheetStruct*) DrawItem )
DrawSheetLabelStruct
*
pinsheet
=
STRUCT
->
m_Label
;
while
(
pinsheet
)
{
item
=
new
DanglingEndHandle
(
SHEET_LABEL_END
);
item
->
m_Item
=
pinsheet
;
item
->
m_Pos
=
pinsheet
->
m_Pos
;
if
(
lastitem
)
lastitem
->
m_Pnext
=
item
;
else
StartList
=
item
;
lastitem
=
item
;
pinsheet
=
(
DrawSheetLabelStruct
*
)
pinsheet
->
Pnext
;
}
break
;
}
default
:
;
}
}
return
StartList
;
}
}
eeschema/eelibs_draw_components.cpp
View file @
f3c324d5
/****************************************/
/****************************************/
/* Modules to handle component drawing. */
/* Modules to handle component drawing. */
/****************************************/
/****************************************/
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -21,339 +21,375 @@
...
@@ -21,339 +21,375 @@
/* Fonctions locales */
/* Fonctions locales */
/* Descr component <DUMMY> used when a component is not found in library,
/* Descr component <DUMMY> used when a component is not found in library,
to draw a dummy shape*/
* to draw a dummy shape*/
/*
/*
This component is a 400 mils square with the text ??
*
This component is a 400 mils square with the text ??
DEF DUMMY U 0 40 Y Y 1 0 N
*
DEF DUMMY U 0 40 Y Y 1 0 N
F0 "U" 0 -350 60 H V
*
F0 "U" 0 -350 60 H V
F1 "DUMMY" 0 350 60 H V
*
F1 "DUMMY" 0 350 60 H V
DRAW
*
DRAW
T 0 0 0 150 0 0 0 ??
*
T 0 0 0 150 0 0 0 ??
S -200 200 200 -200 0 1 0
*
S -200 200 200 -200 0 1 0
ENDDRAW
*
ENDDRAW
ENDDEF
*
ENDDEF
*/
*/
static
int
s_ItemSelectColor
=
BROWN
;
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
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
,
EDA_SchComponentStruct
*
Component
,
EDA_SchComponentStruct
*
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
);
/******************************/
/******************************/
static
void
CreateDummyCmp
(
void
)
static
void
CreateDummyCmp
(
void
)
/******************************/
/******************************/
{
{
DummyCmp
=
new
EDA_LibComponentStruct
(
NULL
);
DummyCmp
=
new
EDA_LibComponentStruct
(
NULL
);
LibDrawSquare
*
Square
=
new
LibDrawSquare
();
LibDrawSquare
*
Square
=
new
LibDrawSquare
();
Square
->
m_Pos
=
wxPoint
(
-
200
,
200
);
Square
->
m_Pos
=
wxPoint
(
-
200
,
200
);
Square
->
m_End
=
wxPoint
(
200
,
-
200
);
Square
->
m_End
=
wxPoint
(
200
,
-
200
);
Square
->
m_Width
=
4
;
Square
->
m_Width
=
4
;
LibDrawText
*
Text
=
new
LibDrawText
();
LibDrawText
*
Text
=
new
LibDrawText
();
Text
->
m_Size
.
x
=
Text
->
m_Size
.
y
=
150
;
Text
->
m_Text
=
wxT
(
"??"
);
DummyCmp
->
m_Drawings
=
Square
;
Text
->
m_Size
.
x
=
Text
->
m_Size
.
y
=
150
;
Square
->
Pnext
=
Text
;
Text
->
m_Text
=
wxT
(
"??"
);
DummyCmp
->
m_Drawings
=
Square
;
Square
->
Pnext
=
Text
;
}
}
/*************************************************************/
/*************************************************************/
void
DrawLibEntry
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
DrawLibEntry
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_LibComponentStruct
*
LibEntry
,
EDA_LibComponentStruct
*
LibEntry
,
int
posX
,
int
posY
,
int
posX
,
int
posY
,
int
Multi
,
int
convert
,
int
Multi
,
int
convert
,
int
DrawMode
,
int
Color
)
int
DrawMode
,
int
Color
)
/**************************************************************/
/**************************************************************/
/* Routine de dessin d'un composant d'une librairie
LibEntry = pointeur sur la description en librairie
posX, posY = position du composant
DrawMode = GrOR ..
Color = 0 : dessin en vraies couleurs, sinon couleur = Color
Une croix symbolise le point d'accrochage (ref position) du composant
/* Routine de dessin d'un composant d'une librairie
* LibEntry = pointeur sur la description en librairie
Le composant est toujours trace avec orientation 0
* posX, posY = position du composant
*/
* DrawMode = GrOR ..
* Color = 0 : dessin en vraies couleurs, sinon couleur = Color
*
* Une croix symbolise le point d'accrochage (ref position) du composant
*
* Le composant est toujours trace avec orientation 0
*/
{
{
int
color
;
int
color
;
int
TransMat
[
2
][
2
];
int
TransMat
[
2
][
2
];
wxString
Prefix
;
wxString
Prefix
;
LibDrawField
*
Field
;
LibDrawField
*
Field
;
wxPoint
text_pos
;
wxPoint
text_pos
;
/* Orientation normale */
/* Orientation normale */
TransMat
[
0
][
0
]
=
1
;
TransMat
[
1
][
1
]
=
-
1
;
TransMat
[
0
][
0
]
=
1
;
TransMat
[
1
][
1
]
=
-
1
;
TransMat
[
1
][
0
]
=
TransMat
[
0
][
1
]
=
0
;
TransMat
[
1
][
0
]
=
TransMat
[
0
][
1
]
=
0
;
DrawLibPartAux
(
panel
,
DC
,
NULL
,
LibEntry
,
wxPoint
(
posX
,
posY
),
DrawLibPartAux
(
panel
,
DC
,
NULL
,
LibEntry
,
wxPoint
(
posX
,
posY
),
TransMat
,
Multi
,
TransMat
,
Multi
,
convert
,
DrawMode
,
Color
);
convert
,
DrawMode
,
Color
);
/* Trace des 2 champs ref et value (Attention aux coord: la matrice
/* Trace des 2 champs ref et value (Attention aux coord: la matrice
de transformation change de signe les coord Y */
* de transformation change de signe les coord Y */
GRSetDrawMode
(
DC
,
DrawMode
);
GRSetDrawMode
(
DC
,
DrawMode
);
if
(
LibEntry
->
m_Prefix
.
m_Attributs
&
TEXT_NO_VISIBLE
)
if
(
LibEntry
->
m_Prefix
.
m_Attributs
&
TEXT_NO_VISIBLE
)
{
{
if
(
Color
>=
0
)
color
=
Color
;
if
(
Color
>=
0
)
else
color
=
UNVISIBLE_COLOR
;
color
=
Color
;
}
else
color
=
UNVISIBLE_COLOR
;
else
{
}
if
(
Color
>=
0
)
color
=
Color
;
else
else
color
=
ReturnLayerColor
(
LAYER_REFERENCEPART
);
{
}
if
(
Color
>=
0
)
color
=
Color
;
if
(
LibEntry
->
m_UnitCount
>
1
)
else
Prefix
.
Printf
(
wxT
(
"%s?%c"
),
LibEntry
->
m_Prefix
.
m_Text
.
GetData
(),
Multi
+
'A'
-
1
);
color
=
ReturnLayerColor
(
LAYER_REFERENCEPART
);
else
Prefix
=
LibEntry
->
m_Prefix
.
m_Text
+
wxT
(
"?"
);
}
text_pos
.
x
=
LibEntry
->
m_Prefix
.
m_Pos
.
x
+
posX
;
if
(
LibEntry
->
m_UnitCount
>
1
)
text_pos
.
y
=
posY
-
LibEntry
->
m_Prefix
.
m_Pos
.
y
;
Prefix
.
Printf
(
wxT
(
"%s?%c"
),
LibEntry
->
m_Prefix
.
m_Text
.
GetData
(),
Multi
+
'A'
-
1
);
int
LineWidth
=
MAX
(
LibEntry
->
m_Prefix
.
m_Width
,
g_DrawMinimunLineWidth
);
else
if
(
(
LibEntry
->
m_Prefix
.
m_Flags
&
IS_MOVED
)
==
0
)
Prefix
=
LibEntry
->
m_Prefix
.
m_Text
+
wxT
(
"?"
);
DrawGraphicText
(
panel
,
DC
,
text_pos
,
color
,
LibEntry
->
m_Prefix
.
m_Text
.
GetData
(),
text_pos
.
x
=
LibEntry
->
m_Prefix
.
m_Pos
.
x
+
posX
;
LibEntry
->
m_Prefix
.
m_Orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
text_pos
.
y
=
posY
-
LibEntry
->
m_Prefix
.
m_Pos
.
y
;
LibEntry
->
m_Prefix
.
m_Size
,
int
LineWidth
=
MAX
(
LibEntry
->
m_Prefix
.
m_Width
,
g_DrawMinimunLineWidth
);
LibEntry
->
m_Prefix
.
m_HJustify
,
LibEntry
->
m_Prefix
.
m_VJustify
,
LineWidth
);
if
(
(
LibEntry
->
m_Prefix
.
m_Flags
&
IS_MOVED
)
==
0
)
DrawGraphicText
(
panel
,
DC
,
text_pos
,
if
(
LibEntry
->
m_Name
.
m_Attributs
&
TEXT_NO_VISIBLE
)
color
,
LibEntry
->
m_Prefix
.
m_Text
.
GetData
(),
{
LibEntry
->
m_Prefix
.
m_Orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
if
(
Color
>=
0
)
color
=
Color
;
LibEntry
->
m_Prefix
.
m_Size
,
else
color
=
UNVISIBLE_COLOR
;
LibEntry
->
m_Prefix
.
m_HJustify
,
LibEntry
->
m_Prefix
.
m_VJustify
,
LineWidth
);
}
if
(
LibEntry
->
m_Name
.
m_Attributs
&
TEXT_NO_VISIBLE
)
else
{
{
if
(
Color
>=
0
)
color
=
Color
;
if
(
Color
>=
0
)
else
color
=
ReturnLayerColor
(
LAYER_VALUEPART
);
color
=
Color
;
}
else
color
=
UNVISIBLE_COLOR
;
text_pos
.
x
=
LibEntry
->
m_Name
.
m_Pos
.
x
+
posX
;
}
text_pos
.
y
=
posY
-
LibEntry
->
m_Name
.
m_Pos
.
y
;
else
LineWidth
=
MAX
(
LibEntry
->
m_Name
.
m_Width
,
g_DrawMinimunLineWidth
);
{
if
(
(
LibEntry
->
m_Name
.
m_Flags
&
IS_MOVED
)
==
0
)
if
(
Color
>=
0
)
DrawGraphicText
(
panel
,
DC
,
text_pos
,
color
=
Color
;
color
,
LibEntry
->
m_Name
.
m_Text
.
GetData
(),
else
LibEntry
->
m_Name
.
m_Orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
color
=
ReturnLayerColor
(
LAYER_VALUEPART
);
LibEntry
->
m_Name
.
m_Size
,
}
LibEntry
->
m_Name
.
m_HJustify
,
LibEntry
->
m_Name
.
m_VJustify
,
LineWidth
);
text_pos
.
x
=
LibEntry
->
m_Name
.
m_Pos
.
x
+
posX
;
for
(
Field
=
LibEntry
->
Fields
;
Field
!=
NULL
;
Field
=
(
LibDrawField
*
)
Field
->
Pnext
)
text_pos
.
y
=
posY
-
LibEntry
->
m_Name
.
m_Pos
.
y
;
{
LineWidth
=
MAX
(
LibEntry
->
m_Name
.
m_Width
,
g_DrawMinimunLineWidth
);
if
(
Field
->
m_Text
.
IsEmpty
()
)
return
;
if
(
(
LibEntry
->
m_Name
.
m_Flags
&
IS_MOVED
)
==
0
)
if
(
(
Field
->
m_Flags
&
IS_MOVED
)
!=
0
)
continue
;
DrawGraphicText
(
panel
,
DC
,
text_pos
,
if
(
Field
->
m_Attributs
&
TEXT_NO_VISIBLE
)
color
,
LibEntry
->
m_Name
.
m_Text
.
GetData
(),
{
LibEntry
->
m_Name
.
m_Orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
if
(
Color
>=
0
)
color
=
Color
;
LibEntry
->
m_Name
.
m_Size
,
else
color
=
UNVISIBLE_COLOR
;
LibEntry
->
m_Name
.
m_HJustify
,
LibEntry
->
m_Name
.
m_VJustify
,
LineWidth
);
}
else
for
(
Field
=
LibEntry
->
Fields
;
Field
!=
NULL
;
Field
=
(
LibDrawField
*
)
Field
->
Pnext
)
{
{
if
(
Color
>=
0
)
color
=
Color
;
if
(
Field
->
m_Text
.
IsEmpty
()
)
else
color
=
ReturnLayerColor
(
LAYER_FIELDS
);
return
;
}
if
(
(
Field
->
m_Flags
&
IS_MOVED
)
!=
0
)
continue
;
text_pos
.
x
=
Field
->
m_Pos
.
x
+
posX
;
if
(
Field
->
m_Attributs
&
TEXT_NO_VISIBLE
)
text_pos
.
y
=
posY
-
Field
->
m_Pos
.
y
;
{
LineWidth
=
MAX
(
Field
->
m_Width
,
g_DrawMinimunLineWidth
);
if
(
Color
>=
0
)
DrawGraphicText
(
panel
,
DC
,
text_pos
,
color
=
Color
;
color
,
Field
->
m_Text
,
else
Field
->
m_Orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
color
=
UNVISIBLE_COLOR
;
Field
->
m_Size
,
}
Field
->
m_HJustify
,
Field
->
m_VJustify
,
LineWidth
);
else
}
{
if
(
Color
>=
0
)
// Trac de l'ancre
color
=
Color
;
int
len
=
3
*
panel
->
GetZoom
();
else
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
posX
,
posY
-
len
,
posX
,
posY
+
len
,
0
,
color
);
color
=
ReturnLayerColor
(
LAYER_FIELDS
);
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
posX
-
len
,
posY
,
posX
+
len
,
posY
,
0
,
color
);
}
text_pos
.
x
=
Field
->
m_Pos
.
x
+
posX
;
text_pos
.
y
=
posY
-
Field
->
m_Pos
.
y
;
LineWidth
=
MAX
(
Field
->
m_Width
,
g_DrawMinimunLineWidth
);
DrawGraphicText
(
panel
,
DC
,
text_pos
,
color
,
Field
->
m_Text
,
Field
->
m_Orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
Field
->
m_Size
,
Field
->
m_HJustify
,
Field
->
m_VJustify
,
LineWidth
);
}
// Trac de l'ancre
int
len
=
3
*
panel
->
GetZoom
();
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
posX
,
posY
-
len
,
posX
,
posY
+
len
,
0
,
color
);
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
posX
-
len
,
posY
,
posX
+
len
,
posY
,
0
,
color
);
}
}
/*****************************************************************************
/*****************************************************************************
* Routine to draw the given part at given position, transformed/mirror as *
* Routine to draw the given part at given position, transformed/mirror as *
* specified, and in the given drawing mode. Only this one is visible... *
* specified, and in the given drawing mode. Only this one is visible... *
*****************************************************************************/
*****************************************************************************/
void
EDA_SchComponentStruct
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
EDA_SchComponentStruct
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
DrawMode
,
int
Color
)
const
wxPoint
&
offset
,
int
DrawMode
,
int
Color
)
{
{
EDA_LibComponentStruct
*
Entry
;
EDA_LibComponentStruct
*
Entry
;
int
ii
;
int
ii
;
bool
dummy
=
FALSE
;
bool
dummy
=
FALSE
;
if
(
(
Entry
=
FindLibPart
(
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
))
==
NULL
)
if
(
(
Entry
=
FindLibPart
(
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
)
)
==
NULL
)
{
/* composant non trouv, on affiche un composant "dummy" */
{
/* composant non trouv, on affiche un composant "dummy" */
dummy
=
TRUE
;
dummy
=
TRUE
;
if
(
DummyCmp
==
NULL
)
CreateDummyCmp
();
if
(
DummyCmp
==
NULL
)
Entry
=
DummyCmp
;
CreateDummyCmp
();
}
Entry
=
DummyCmp
;
}
DrawLibPartAux
(
panel
,
DC
,
this
,
Entry
,
m_Pos
+
offset
,
m_Transform
,
DrawLibPartAux
(
panel
,
DC
,
this
,
Entry
,
m_Pos
+
offset
,
dummy
?
0
:
m_Multi
,
m_Transform
,
dummy
?
0
:
m_Convert
,
dummy
?
0
:
m_Multi
,
DrawMode
);
dummy
?
0
:
m_Convert
,
DrawMode
);
/* Trace des champs, avec placement et orientation selon orient. du
composant
/* Trace des champs, avec placement et orientation selon orient. du
*/
* composant
*/
if
(
((
m_Field
[
REFERENCE
].
m_Attributs
&
TEXT_NO_VISIBLE
)
==
0
)
&&
!
(
m_Field
[
REFERENCE
].
m_Flags
&
IS_MOVED
)
)
if
(
(
(
m_Field
[
REFERENCE
].
m_Attributs
&
TEXT_NO_VISIBLE
)
==
0
)
{
&&
!
(
m_Field
[
REFERENCE
].
m_Flags
&
IS_MOVED
)
)
if
(
Entry
->
m_UnitCount
>
1
)
{
DrawTextField
(
panel
,
DC
,
&
m_Field
[
REFERENCE
],
1
,
DrawMode
);
if
(
Entry
->
m_UnitCount
>
1
)
else
DrawTextField
(
panel
,
DC
,
&
m_Field
[
REFERENCE
],
1
,
DrawMode
);
DrawTextField
(
panel
,
DC
,
&
m_Field
[
REFERENCE
],
0
,
DrawMode
);
else
}
DrawTextField
(
panel
,
DC
,
&
m_Field
[
REFERENCE
],
0
,
DrawMode
);
}
for
(
ii
=
VALUE
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
for
(
ii
=
VALUE
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
if
(
m_Field
[
ii
].
m_Flags
&
IS_MOVED
)
continue
;
{
DrawTextField
(
panel
,
DC
,
&
m_Field
[
ii
],
0
,
DrawMode
);
if
(
m_Field
[
ii
].
m_Flags
&
IS_MOVED
)
}
continue
;
DrawTextField
(
panel
,
DC
,
&
m_Field
[
ii
],
0
,
DrawMode
);
}
}
}
/***********************************************************/
/***********************************************************/
void
DrawTextField
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
DrawTextField
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
PartTextStruct
*
Field
,
int
IsMulti
,
int
DrawMode
)
PartTextStruct
*
Field
,
int
IsMulti
,
int
DrawMode
)
/***********************************************************/
/***********************************************************/
/* Routine de trace des textes type Field du composant.
/* Routine de trace des textes type Field du composant.
entree:
*
entree:
IsMulti: flag Non Null si il y a plusieurs parts par boitier.
*
IsMulti: flag Non Null si il y a plusieurs parts par boitier.
n'est utile que pour le champ reference pour ajouter a celui ci
*
n'est utile que pour le champ reference pour ajouter a celui ci
l'identification de la part ( A, B ... )
*
l'identification de la part ( A, B ... )
DrawMode: mode de trace
*
DrawMode: mode de trace
*/
*/
{
{
int
orient
,
color
;
int
orient
,
color
;
wxPoint
pos
;
/* Position des textes */
wxPoint
pos
;
/* Position des textes */
EDA_SchComponentStruct
*
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
Field
->
m_Parent
;
EDA_SchComponentStruct
*
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
Field
->
m_Parent
;
int
hjustify
,
vjustify
;
int
hjustify
,
vjustify
;
int
LineWidth
=
MAX
(
Field
->
m_Width
,
g_DrawMinimunLineWidth
);
int
LineWidth
=
MAX
(
Field
->
m_Width
,
g_DrawMinimunLineWidth
);
if
(
Field
->
m_Attributs
&
TEXT_NO_VISIBLE
)
return
;
if
(
Field
->
m_Attributs
&
TEXT_NO_VISIBLE
)
if
(
Field
->
IsVoid
()
)
return
;
return
;
if
(
Field
->
IsVoid
()
)
GRSetDrawMode
(
DC
,
DrawMode
);
return
;
/* Calcul de la position des textes, selon orientation du composant */
GRSetDrawMode
(
DC
,
DrawMode
);
orient
=
Field
->
m_Orient
;
hjustify
=
Field
->
m_HJustify
;
vjustify
=
Field
->
m_VJustify
;
/* Calcul de la position des textes, selon orientation du composant */
pos
.
x
=
Field
->
m_Pos
.
x
-
DrawLibItem
->
m_Pos
.
x
;
orient
=
Field
->
m_Orient
;
pos
.
y
=
Field
->
m_Pos
.
y
-
DrawLibItem
->
m_Pos
.
y
;
hjustify
=
Field
->
m_HJustify
;
vjustify
=
Field
->
m_VJustify
;
pos
.
x
=
Field
->
m_Pos
.
x
-
DrawLibItem
->
m_Pos
.
x
;
pos
=
DrawLibItem
->
GetScreenCoord
(
pos
);
pos
.
y
=
Field
->
m_Pos
.
y
-
DrawLibItem
->
m_Pos
.
y
;
pos
.
x
+=
DrawLibItem
->
m_Pos
.
x
;
pos
.
y
+=
DrawLibItem
->
m_Pos
.
y
;
pos
=
DrawLibItem
->
GetScreenCoord
(
pos
);
pos
.
x
+=
DrawLibItem
->
m_Pos
.
x
;
/* Y a t-il rotation (pour l'orientation, la justification)*/
pos
.
y
+=
DrawLibItem
->
m_Pos
.
y
;
if
(
DrawLibItem
->
m_Transform
[
0
][
1
])
// Rotation du composant de 90deg
{
/* Y a t-il rotation (pour l'orientation, la justification)*/
if
(
orient
==
TEXT_ORIENT_HORIZ
)
orient
=
TEXT_ORIENT_VERT
;
if
(
DrawLibItem
->
m_Transform
[
0
][
1
]
)
// Rotation du composant de 90deg
else
orient
=
TEXT_ORIENT_HORIZ
;
{
/* Y a t-il rotation, miroir (pour les justifications)*/
if
(
orient
==
TEXT_ORIENT_HORIZ
)
EXCHG
(
hjustify
,
vjustify
);
orient
=
TEXT_ORIENT_VERT
;
if
(
DrawLibItem
->
m_Transform
[
1
][
0
]
<
0
)
vjustify
=
-
vjustify
;
else
if
(
DrawLibItem
->
m_Transform
[
1
][
0
]
>
0
)
hjustify
=
-
hjustify
;
orient
=
TEXT_ORIENT_HORIZ
;
}
/* Y a t-il rotation, miroir (pour les justifications)*/
else
EXCHG
(
hjustify
,
vjustify
);
{
/* Texte horizontal: Y a t-il miroir (pour les justifications)*/
if
(
DrawLibItem
->
m_Transform
[
1
][
0
]
<
0
)
if
(
DrawLibItem
->
m_Transform
[
0
][
0
]
<
0
)
vjustify
=
-
vjustify
;
hjustify
=
-
hjustify
;
if
(
DrawLibItem
->
m_Transform
[
1
][
0
]
>
0
)
if
(
DrawLibItem
->
m_Transform
[
1
][
1
]
>
0
)
hjustify
=
-
hjustify
;
vjustify
=
-
vjustify
;
}
}
else
{
if
(
Field
->
m_FieldId
==
REFERENCE
)
/* Texte horizontal: Y a t-il miroir (pour les justifications)*/
color
=
ReturnLayerColor
(
LAYER_REFERENCEPART
);
if
(
DrawLibItem
->
m_Transform
[
0
][
0
]
<
0
)
else
if
(
Field
->
m_FieldId
==
VALUE
)
hjustify
=
-
hjustify
;
color
=
ReturnLayerColor
(
LAYER_VALUEPART
);
if
(
DrawLibItem
->
m_Transform
[
1
][
1
]
>
0
)
else
color
=
ReturnLayerColor
(
LAYER_FIELDS
);
vjustify
=
-
vjustify
;
if
(
!
IsMulti
||
(
Field
->
m_FieldId
!=
REFERENCE
)
)
}
{
DrawGraphicText
(
panel
,
DC
,
pos
,
color
,
Field
->
m_Text
.
GetData
(),
if
(
Field
->
m_FieldId
==
REFERENCE
)
orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
color
=
ReturnLayerColor
(
LAYER_REFERENCEPART
);
Field
->
m_Size
,
else
if
(
Field
->
m_FieldId
==
VALUE
)
hjustify
,
vjustify
,
LineWidth
);
color
=
ReturnLayerColor
(
LAYER_VALUEPART
);
}
else
color
=
ReturnLayerColor
(
LAYER_FIELDS
);
else
/* Le champ est la reference, et il y a plusieurs parts par boitier */
if
(
!
IsMulti
||
(
Field
->
m_FieldId
!=
REFERENCE
)
)
{
/* On ajoute alors A ou B ... a la reference */
{
wxString
fulltext
=
Field
->
m_Text
;
DrawGraphicText
(
panel
,
DC
,
pos
,
color
,
Field
->
m_Text
.
GetData
(),
fulltext
.
Append
(
'A'
-
1
+
DrawLibItem
->
m_Multi
);
orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
DrawGraphicText
(
panel
,
DC
,
pos
,
color
,
fulltext
.
GetData
(),
Field
->
m_Size
,
orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
hjustify
,
vjustify
,
LineWidth
);
Field
->
m_Size
,
}
hjustify
,
vjustify
,
LineWidth
);
else
/* Le champ est la reference, et il y a plusieurs parts par boitier */
}
{
/* On ajoute alors A ou B ... a la reference */
wxString
fulltext
=
Field
->
m_Text
;
fulltext
.
Append
(
'A'
-
1
+
DrawLibItem
->
m_Multi
);
DrawGraphicText
(
panel
,
DC
,
pos
,
color
,
fulltext
.
GetData
(),
orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
Field
->
m_Size
,
hjustify
,
vjustify
,
LineWidth
);
}
}
}
/********************************************************************************/
/********************************************************************************/
EDA_LibComponentStruct
*
FindLibPart
(
const
wxChar
*
Name
,
const
wxString
&
LibName
,
int
Alias
)
EDA_LibComponentStruct
*
FindLibPart
(
const
wxChar
*
Name
,
const
wxString
&
LibName
,
int
Alias
)
/********************************************************************************/
/********************************************************************************/
/*
/*
Routine to find a part in one of the libraries given its name.
*
Routine to find a part in one of the libraries given its name.
Name = Name of part.
*
Name = Name of part.
LibName = Name of Lib; if "": seach in all libs
*
LibName = Name of Lib; if "": seach in all libs
Alias = Flag: si flag != 0, retourne un pointeur sur une part ou un alias
*
Alias = Flag: si flag != 0, retourne un pointeur sur une part ou un alias
si flag = 0, retourne un pointeur sur une part meme si le nom
*
si flag = 0, retourne un pointeur sur une part meme si le nom
correspond a un alias
*
correspond a un alias
Alias = FIND_ROOT, ou Alias = FIND_ALIAS
*
Alias = FIND_ROOT, ou Alias = FIND_ALIAS
*/
*/
{
{
EDA_LibComponentStruct
*
Entry
;
EDA_LibComponentStruct
*
Entry
;
static
EDA_LibComponentStruct
DummyEntry
(
wxEmptyString
);
/* Used only to call PQFind. */
LibraryStruct
*
Lib
=
g_LibraryList
;
static
EDA_LibComponentStruct
DummyEntry
(
wxEmptyString
);
/* Used only to call PQFind. */
DummyEntry
.
m_Drawings
=
NULL
;
/* Used only to call PQFind. */
LibraryStruct
*
Lib
=
g_LibraryList
;
DummyEntry
.
m_Name
.
m_Text
=
Name
;
DummyEntry
.
m_Drawings
=
NULL
;
/* Used only to call PQFind. */
PQCompFunc
((
PQCompFuncType
)
LibraryEntryCompare
);
DummyEntry
.
m_Name
.
m_Text
=
Name
;
Entry
=
NULL
;
FindLibName
.
Empty
();
PQCompFunc
(
(
PQCompFuncType
)
LibraryEntryCompare
);
while
(
Lib
)
{
Entry
=
NULL
;
FindLibName
.
Empty
();
if
(
!
LibName
.
IsEmpty
()
)
while
(
Lib
)
{
{
if
(
Lib
->
m_Name
!=
LibName
)
if
(
!
LibName
.
IsEmpty
()
)
{
{
Lib
=
Lib
->
m_Pnext
;
continue
;
if
(
Lib
->
m_Name
!=
LibName
)
}
{
}
Lib
=
Lib
->
m_Pnext
;
continue
;
if
(
Lib
==
NULL
)
break
;
}
Entry
=
(
EDA_LibComponentStruct
*
)
PQFind
(
Lib
->
m_Entries
,
&
DummyEntry
);
}
if
(
Entry
!=
NULL
)
if
(
Lib
==
NULL
)
{
break
;
FindLibName
=
Lib
->
m_Name
;
Entry
=
(
EDA_LibComponentStruct
*
)
PQFind
(
Lib
->
m_Entries
,
&
DummyEntry
);
break
;
if
(
Entry
!=
NULL
)
}
{
Lib
=
Lib
->
m_Pnext
;
FindLibName
=
Lib
->
m_Name
;
}
break
;
}
/* Si le nom est un alias, recherche du vrai composant */
Lib
=
Lib
->
m_Pnext
;
if
(
Entry
)
}
{
if
(
(
Entry
->
Type
!=
ROOT
)
&&
(
Alias
==
FIND_ROOT
)
)
/* Si le nom est un alias, recherche du vrai composant */
Entry
=
FindLibPart
(
((
EDA_LibCmpAliasStruct
*
)
Entry
)
->
m_RootName
.
GetData
()
,
if
(
Entry
)
Lib
->
m_Name
,
FIND_ROOT
);
{
}
if
(
(
Entry
->
Type
!=
ROOT
)
&&
(
Alias
==
FIND_ROOT
)
)
Entry
=
FindLibPart
(
(
(
EDA_LibCmpAliasStruct
*
)
Entry
)
->
m_RootName
.
GetData
(),
return
(
Entry
);
Lib
->
m_Name
,
FIND_ROOT
);
}
return
Entry
;
}
}
/*****************************************************************************
/*****************************************************************************
* Routine to draw the given part at given position, transformed/mirror as
* Routine to draw the given part at given position, transformed/mirror as
* specified, and in the given drawing mode.
* specified, and in the given drawing mode.
...
@@ -361,375 +397,417 @@ LibraryStruct *Lib = g_LibraryList;
...
@@ -361,375 +397,417 @@ LibraryStruct *Lib = g_LibraryList;
* else draw in color = Color
* else draw in color = Color
*****************************************************************************/
*****************************************************************************/
/* DrawMode = GrXOR, GrOR ..*/
/* DrawMode = GrXOR, GrOR ..*/
void
DrawLibPartAux
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
DrawLibPartAux
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_SchComponentStruct
*
Component
,
EDA_SchComponentStruct
*
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
DrawMode
,
int
Multi
,
int
convert
,
int
DrawMode
,
int
Color
,
bool
DrawPinText
)
int
Color
,
bool
DrawPinText
)
{
{
int
i
,
x1
,
y1
,
x2
,
y2
,
t1
,
t2
,
orient
;
int
i
,
x1
,
y1
,
x2
,
y2
,
t1
,
t2
,
orient
;
LibEDA_BaseStruct
*
DEntry
=
NULL
;
LibEDA_BaseStruct
*
DEntry
=
NULL
;
int
CharColor
;
int
CharColor
;
int
fill_option
;
int
fill_option
;
int
SetHightColor
;
int
SetHightColor
;
int
LineWidth
;
int
LineWidth
;
//#define GETCOLOR(l) Color < 0 ? (ReturnLayerColor(l)| SetHightColor) : Color;
//#define GETCOLOR(l) Color < 0 ? (ReturnLayerColor(l)| SetHightColor) : Color;
#define GETCOLOR(l) Color < 0 ? SetHightColor ? s_ItemSelectColor : (ReturnLayerColor(l)| SetHightColor) : Color;
#define GETCOLOR( l ) Color < 0 ? SetHightColor ?\
s_ItemSelectColor : (ReturnLayerColor( l ) | SetHightColor) : Color;
if
(
Entry
->
m_Drawings
==
NULL
)
return
;
GRSetDrawMode
(
DC
,
DrawMode
);
if
(
Entry
->
m_Drawings
==
NULL
)
return
;
for
(
DEntry
=
Entry
->
m_Drawings
;
DEntry
!=
NULL
;
DEntry
=
DEntry
->
Next
())
GRSetDrawMode
(
DC
,
DrawMode
);
{
/* Elimination des elements non relatifs a l'unite */
for
(
DEntry
=
Entry
->
m_Drawings
;
DEntry
!=
NULL
;
DEntry
=
DEntry
->
Next
()
)
if
(
Multi
&&
DEntry
->
m_Unit
&&
(
DEntry
->
m_Unit
!=
Multi
)
)
continue
;
{
if
(
convert
&&
DEntry
->
m_Convert
&&
(
DEntry
->
m_Convert
!=
convert
)
)
/* Elimination des elements non relatifs a l'unite */
continue
;
if
(
Multi
&&
DEntry
->
m_Unit
&&
(
DEntry
->
m_Unit
!=
Multi
)
)
continue
;
if
(
DEntry
->
m_Flags
&
IS_MOVED
)
continue
;
// Element en deplacement non trace
if
(
convert
&&
DEntry
->
m_Convert
&&
(
DEntry
->
m_Convert
!=
convert
)
)
SetHightColor
=
(
DEntry
->
m_Selected
&
IS_SELECTED
)
?
HIGHT_LIGHT_FLAG
:
0
;
continue
;
LineWidth
=
MAX
(
DEntry
->
m_Width
,
g_DrawMinimunLineWidth
);
switch
(
DEntry
->
m_StructType
)
if
(
DEntry
->
m_Flags
&
IS_MOVED
)
{
continue
;
// Element en deplacement non trace
case
COMPONENT_ARC_DRAW_TYPE
:
SetHightColor
=
(
DEntry
->
m_Selected
&
IS_SELECTED
)
?
HIGHT_LIGHT_FLAG
:
0
;
{
LineWidth
=
MAX
(
DEntry
->
m_Width
,
g_DrawMinimunLineWidth
);
int
xc
,
yc
,
x2
,
y2
;
LibDrawArc
*
Arc
=
(
LibDrawArc
*
)
DEntry
;
switch
(
DEntry
->
m_StructType
)
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
{
xc
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Arc
->
m_Pos
.
x
+
case
COMPONENT_ARC_DRAW_TYPE
:
TransMat
[
0
][
1
]
*
Arc
->
m_Pos
.
y
;
{
yc
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Arc
->
m_Pos
.
x
+
int
xc
,
yc
,
x2
,
y2
;
TransMat
[
1
][
1
]
*
Arc
->
m_Pos
.
y
;
LibDrawArc
*
Arc
=
(
LibDrawArc
*
)
DEntry
;
x2
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Arc
->
m_ArcStart
.
x
+
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
TransMat
[
0
][
1
]
*
Arc
->
m_ArcStart
.
y
;;
xc
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Arc
->
m_Pos
.
x
+
y2
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Arc
->
m_ArcStart
.
x
+
TransMat
[
0
][
1
]
*
Arc
->
m_Pos
.
y
;
TransMat
[
1
][
1
]
*
Arc
->
m_ArcStart
.
y
;
yc
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Arc
->
m_Pos
.
x
+
x1
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Arc
->
m_ArcEnd
.
x
+
TransMat
[
1
][
1
]
*
Arc
->
m_Pos
.
y
;
TransMat
[
0
][
1
]
*
Arc
->
m_ArcEnd
.
y
;;
x2
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Arc
->
m_ArcStart
.
x
+
y1
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Arc
->
m_ArcEnd
.
x
+
TransMat
[
0
][
1
]
*
Arc
->
m_ArcStart
.
y
;;
TransMat
[
1
][
1
]
*
Arc
->
m_ArcEnd
.
y
;
y2
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Arc
->
m_ArcStart
.
x
+
t1
=
Arc
->
t1
;
t2
=
Arc
->
t2
;
TransMat
[
1
][
1
]
*
Arc
->
m_ArcStart
.
y
;
bool
swap
=
MapAngles
(
&
t1
,
&
t2
,
TransMat
);
x1
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Arc
->
m_ArcEnd
.
x
+
if
(
swap
)
{
EXCHG
(
x1
,
x2
);
EXCHG
(
y1
,
y2
)
}
TransMat
[
0
][
1
]
*
Arc
->
m_ArcEnd
.
y
;;
fill_option
=
Arc
->
m_Fill
&
(
~
g_PrintFillMask
);
y1
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Arc
->
m_ArcEnd
.
x
+
if
(
Color
<
0
)
// Normal Color Layer
TransMat
[
1
][
1
]
*
Arc
->
m_ArcEnd
.
y
;
{
t1
=
Arc
->
t1
;
t2
=
Arc
->
t2
;
if
(
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
&&
!
g_IsPrinting
)
bool
swap
=
MapAngles
(
&
t1
,
&
t2
,
TransMat
);
GRFilledArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
if
(
swap
)
Arc
->
m_Rayon
,
Arc
->
m_Width
,
CharColor
,
{
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
));
EXCHG
(
x1
,
x2
);
EXCHG
(
y1
,
y2
)
else
if
(
fill_option
==
FILLED_SHAPE
)
}
GRFilledArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
fill_option
=
Arc
->
m_Fill
&
(
~
g_PrintFillMask
);
Arc
->
m_Rayon
,
CharColor
,
CharColor
);
if
(
Color
<
0
)
// Normal Color Layer
{
if
(
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
&&
!
g_IsPrinting
)
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
#ifdef DRAW_ARC_WITH_ANGLE
else
GRArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
else
Arc
->
m_Rayon
,
LineWidth
,
CharColor
);
GRArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
Arc
->
m_Rayon
,
LineWidth
,
CharColor
);
#else
#else
else
GRArc1
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
else
xc
,
yc
,
LineWidth
,
CharColor
);
GRArc1
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
xc
,
yc
,
LineWidth
,
CharColor
);
#endif
#endif
}
}
#ifdef DRAW_ARC_WITH_ANGLE
#ifdef DRAW_ARC_WITH_ANGLE
else
GRArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
else
Arc
->
m_Rayon
,
Circle
->
m_Width
,
CharColor
);
GRArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
Arc
->
m_Rayon
,
Circle
->
m_Width
,
CharColor
);
#else
#else
else
GRArc1
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
else
xc
,
yc
,
Arc
->
m_Width
,
CharColor
);
GRArc1
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
xc
,
yc
,
Arc
->
m_Width
,
CharColor
);
#endif
#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
);
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
x1
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Circle
->
m_Pos
.
x
+
x1
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Circle
->
m_Pos
.
x
+
TransMat
[
0
][
1
]
*
Circle
->
m_Pos
.
y
;
TransMat
[
0
][
1
]
*
Circle
->
m_Pos
.
y
;
y1
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Circle
->
m_Pos
.
x
+
y1
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Circle
->
m_Pos
.
x
+
TransMat
[
1
][
1
]
*
Circle
->
m_Pos
.
y
;
TransMat
[
1
][
1
]
*
Circle
->
m_Pos
.
y
;
fill_option
=
Circle
->
m_Fill
&
(
~
g_PrintFillMask
);
fill_option
=
Circle
->
m_Fill
&
(
~
g_PrintFillMask
);
if
(
Color
<
0
)
if
(
Color
<
0
)
{
{
if
(
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
&&
!
g_IsPrinting
)
if
(
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
&&
!
g_IsPrinting
)
GRFilledCircle
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
GRFilledCircle
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
Circle
->
m_Rayon
,
LineWidth
,
CharColor
,
Circle
->
m_Rayon
,
LineWidth
,
CharColor
,
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
));
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
)
);
else
if
(
fill_option
==
FILLED_SHAPE
)
else
if
(
fill_option
==
FILLED_SHAPE
)
GRFilledCircle
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
GRFilledCircle
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
Circle
->
m_Rayon
,
0
,
CharColor
,
CharColor
);
Circle
->
m_Rayon
,
0
,
CharColor
,
CharColor
);
else
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
else
Circle
->
m_Rayon
,
LineWidth
,
CharColor
);
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
);
else
}
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
break
;
Circle
->
m_Rayon
,
LineWidth
,
CharColor
);
}
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
break
;
{
LibDrawText
*
Text
=
(
LibDrawText
*
)
DEntry
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
{
LibDrawText
*
Text
=
(
LibDrawText
*
)
DEntry
;
/* The text orientation may need to be flipped if the
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
transformation matrix cuases xy axes to be flipped. */
t1
=
(
TransMat
[
0
][
0
]
!=
0
)
^
(
Text
->
m_Horiz
!=
0
);
/* The text orientation may need to be flipped if the
x1
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Text
->
m_Pos
.
x
* transformation matrix cuases xy axes to be flipped. */
+
TransMat
[
0
][
1
]
*
Text
->
m_Pos
.
y
;
t1
=
(
TransMat
[
0
][
0
]
!=
0
)
^
(
Text
->
m_Horiz
!=
0
);
y1
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Text
->
m_Pos
.
x
x1
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Text
->
m_Pos
.
x
+
TransMat
[
1
][
1
]
*
Text
->
m_Pos
.
y
;
+
TransMat
[
0
][
1
]
*
Text
->
m_Pos
.
y
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
,
y1
),
CharColor
,
Text
->
m_Text
,
y1
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Text
->
m_Pos
.
x
t1
?
TEXT_ORIENT_HORIZ
:
TEXT_ORIENT_VERT
,
+
TransMat
[
1
][
1
]
*
Text
->
m_Pos
.
y
;
Text
->
m_Size
,
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
,
y1
),
CharColor
,
Text
->
m_Text
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
t1
?
TEXT_ORIENT_HORIZ
:
TEXT_ORIENT_VERT
,
}
Text
->
m_Size
,
break
;
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
}
case
COMPONENT_RECT_DRAW_TYPE
:
break
;
{
LibDrawSquare
*
Square
=
(
LibDrawSquare
*
)
DEntry
;
case
COMPONENT_RECT_DRAW_TYPE
:
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
{
LibDrawSquare
*
Square
=
(
LibDrawSquare
*
)
DEntry
;
x1
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Square
->
m_Pos
.
x
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
+
TransMat
[
0
][
1
]
*
Square
->
m_Pos
.
y
;
y1
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Square
->
m_Pos
.
x
x1
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Square
->
m_Pos
.
x
+
TransMat
[
1
][
1
]
*
Square
->
m_Pos
.
y
;
+
TransMat
[
0
][
1
]
*
Square
->
m_Pos
.
y
;
x2
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Square
->
m_End
.
x
y1
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Square
->
m_Pos
.
x
+
TransMat
[
0
][
1
]
*
Square
->
m_End
.
y
;
+
TransMat
[
1
][
1
]
*
Square
->
m_Pos
.
y
;
y2
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Square
->
m_End
.
x
x2
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Square
->
m_End
.
x
+
TransMat
[
1
][
1
]
*
Square
->
m_End
.
y
;
+
TransMat
[
0
][
1
]
*
Square
->
m_End
.
y
;
fill_option
=
Square
->
m_Fill
&
(
~
g_PrintFillMask
);
y2
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Square
->
m_End
.
x
if
(
Color
<
0
)
+
TransMat
[
1
][
1
]
*
Square
->
m_End
.
y
;
{
fill_option
=
Square
->
m_Fill
&
(
~
g_PrintFillMask
);
if
(
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
&&
!
g_IsPrinting
)
if
(
Color
<
0
)
GRFilledRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
{
CharColor
,
LineWidth
,
if
(
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
&&
!
g_IsPrinting
)
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
));
GRFilledRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
else
if
(
fill_option
==
FILLED_SHAPE
)
CharColor
,
LineWidth
,
GRFilledRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
)
);
CharColor
,
CharColor
);
else
if
(
fill_option
==
FILLED_SHAPE
)
else
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
GRFilledRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
LineWidth
,
CharColor
);
CharColor
,
CharColor
);
}
else
else
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
LineWidth
,
CharColor
);
LineWidth
,
CharColor
);
}
}
break
;
else
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
case
COMPONENT_PIN_DRAW_TYPE
:
/* Trace des Pins */
LineWidth
,
CharColor
);
{
}
LibDrawPin
*
Pin
=
(
LibDrawPin
*
)
DEntry
;
break
;
if
(
Pin
->
m_Attributs
&
PINNOTDRAW
)
{
case
COMPONENT_PIN_DRAW_TYPE
:
/* Trace des Pins */
if
(
(
ActiveScreen
->
m_Type
==
SCHEMATIC_FRAME
)
&&
{
!
g_ShowAllPins
)
LibDrawPin
*
Pin
=
(
LibDrawPin
*
)
DEntry
;
break
;
if
(
Pin
->
m_Attributs
&
PINNOTDRAW
)
}
{
/* Calcul de l'orientation reelle de la Pin */
if
(
(
ActiveScreen
->
m_Type
==
SCHEMATIC_FRAME
)
orient
=
Pin
->
ReturnPinDrawOrient
(
TransMat
);
&&
!
g_ShowAllPins
)
break
;
/* Calcul de la position du point de reference */
}
x2
=
Pos
.
x
+
(
TransMat
[
0
][
0
]
*
Pin
->
m_Pos
.
x
)
/* Calcul de l'orientation reelle de la Pin */
+
(
TransMat
[
0
][
1
]
*
Pin
->
m_Pos
.
y
);
orient
=
Pin
->
ReturnPinDrawOrient
(
TransMat
);
y2
=
Pos
.
y
+
(
TransMat
[
1
][
0
]
*
Pin
->
m_Pos
.
x
)
+
(
TransMat
[
1
][
1
]
*
Pin
->
m_Pos
.
y
);
/* Calcul de la position du point de reference */
x2
=
Pos
.
x
+
(
TransMat
[
0
][
0
]
*
Pin
->
m_Pos
.
x
)
/* Dessin de la pin et du symbole special associe */
+
(
TransMat
[
0
][
1
]
*
Pin
->
m_Pos
.
y
);
CharColor
=
GETCOLOR
(
LAYER_PIN
);
y2
=
Pos
.
y
+
(
TransMat
[
1
][
0
]
*
Pin
->
m_Pos
.
x
)
Pin
->
DrawPinSymbol
(
panel
,
DC
,
wxPoint
(
x2
,
y2
)
,
orient
,
DrawMode
,
CharColor
);
+
(
TransMat
[
1
][
1
]
*
Pin
->
m_Pos
.
y
);
if
(
DrawPinText
)
/* Dessin de la pin et du symbole special associe */
{
CharColor
=
GETCOLOR
(
LAYER_PIN
);
wxPoint
pinpos
(
x2
,
y2
);
Pin
->
DrawPinSymbol
(
panel
,
DC
,
wxPoint
(
x2
,
y2
),
orient
,
DrawMode
,
CharColor
);
CharColor
=
SetHightColor
?
s_ItemSelectColor
:
Color
;
Pin
->
DrawPinTexts
(
panel
,
DC
,
pinpos
,
orient
,
if
(
DrawPinText
)
Entry
->
m_TextInside
,
{
Entry
->
m_DrawPinNum
,
Entry
->
m_DrawPinName
,
wxPoint
pinpos
(
x2
,
y2
);
CharColor
,
DrawMode
);
}
CharColor
=
SetHightColor
?
s_ItemSelectColor
:
Color
;
}
Pin
->
DrawPinTexts
(
panel
,
DC
,
pinpos
,
orient
,
break
;
Entry
->
m_TextInside
,
Entry
->
m_DrawPinNum
,
Entry
->
m_DrawPinName
,
case
COMPONENT_POLYLINE_DRAW_TYPE
:
CharColor
,
DrawMode
);
{
}
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DEntry
;
}
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
break
;
if
(
Buf_Poly_Drawings
==
NULL
)
{
case
COMPONENT_POLYLINE_DRAW_TYPE
:
Buf_Poly_Size
=
polyline
->
n
;
{
Buf_Poly_Drawings
=
(
int
*
)
MyMalloc
(
sizeof
(
int
)
*
2
*
Buf_Poly_Size
);
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DEntry
;
}
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
else
if
(
Buf_Poly_Size
<
polyline
->
n
)
if
(
Buf_Poly_Drawings
==
NULL
)
{
{
Buf_Poly_Size
=
polyline
->
n
;
Buf_Poly_Size
=
polyline
->
n
;
Buf_Poly_Drawings
=
(
int
*
)
realloc
(
Buf_Poly_Drawings
,
Buf_Poly_Drawings
=
(
int
*
)
MyMalloc
(
sizeof
(
int
)
*
2
*
Buf_Poly_Size
);
sizeof
(
int
)
*
2
*
Buf_Poly_Size
);
}
}
else
if
(
Buf_Poly_Size
<
polyline
->
n
)
for
(
i
=
0
;
i
<
polyline
->
n
;
i
++
)
{
{
Buf_Poly_Size
=
polyline
->
n
;
Buf_Poly_Drawings
[
i
*
2
]
=
Pos
.
x
+
Buf_Poly_Drawings
=
(
int
*
)
realloc
(
Buf_Poly_Drawings
,
TransMat
[
0
][
0
]
*
polyline
->
PolyList
[
i
*
2
]
+
sizeof
(
int
)
*
2
*
Buf_Poly_Size
);
TransMat
[
0
][
1
]
*
polyline
->
PolyList
[
i
*
2
+
1
];
}
Buf_Poly_Drawings
[
i
*
2
+
1
]
=
Pos
.
y
+
for
(
i
=
0
;
i
<
polyline
->
n
;
i
++
)
TransMat
[
1
][
0
]
*
polyline
->
PolyList
[
i
*
2
]
+
{
TransMat
[
1
][
1
]
*
polyline
->
PolyList
[
i
*
2
+
1
];
Buf_Poly_Drawings
[
i
*
2
]
=
Pos
.
x
+
}
TransMat
[
0
][
0
]
*
polyline
->
PolyList
[
i
*
2
]
+
fill_option
=
polyline
->
m_Fill
&
(
~
g_PrintFillMask
);
TransMat
[
0
][
1
]
*
polyline
->
PolyList
[
i
*
2
+
1
];
if
(
Color
<
0
)
Buf_Poly_Drawings
[
i
*
2
+
1
]
=
Pos
.
y
+
{
TransMat
[
1
][
0
]
*
polyline
->
PolyList
[
i
*
2
]
+
if
(
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
&&
!
g_IsPrinting
)
TransMat
[
1
][
1
]
*
polyline
->
PolyList
[
i
*
2
+
1
];
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
}
Buf_Poly_Drawings
,
1
,
LineWidth
,
CharColor
,
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
));
fill_option
=
polyline
->
m_Fill
&
(
~
g_PrintFillMask
);
else
if
(
fill_option
==
FILLED_SHAPE
)
if
(
Color
<
0
)
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
{
Buf_Poly_Drawings
,
1
,
LineWidth
,
CharColor
,
CharColor
);
if
(
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
&&
!
g_IsPrinting
)
else
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
Buf_Poly_Drawings
,
0
,
LineWidth
,
CharColor
,
CharColor
);
Buf_Poly_Drawings
,
1
,
LineWidth
,
CharColor
,
}
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
)
);
else
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
else
if
(
fill_option
==
FILLED_SHAPE
)
Buf_Poly_Drawings
,
0
,
LineWidth
,
CharColor
,
CharColor
);
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
}
Buf_Poly_Drawings
,
1
,
LineWidth
,
CharColor
,
CharColor
);
break
;
else
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
default
:
Buf_Poly_Drawings
,
0
,
LineWidth
,
CharColor
,
CharColor
);
wxBell
();
}
break
;
else
}
/* Fin Switch */
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
}
/* Fin Boucle de dessin */
Buf_Poly_Drawings
,
0
,
LineWidth
,
CharColor
,
CharColor
);
if
(
g_DebugLevel
>
4
)
/* Draw the component boundary box */
}
{
break
;
EDA_Rect
BoundaryBox
;
if
(
Component
)
BoundaryBox
=
Component
->
GetBoundaryBox
();
default
:
else
BoundaryBox
=
Entry
->
GetBoundaryBox
(
Multi
,
convert
);
wxBell
();
x1
=
BoundaryBox
.
GetX
();
break
;
y1
=
BoundaryBox
.
GetY
();
}
x2
=
BoundaryBox
.
GetRight
();
y2
=
BoundaryBox
.
GetBottom
();
/* Fin Switch */
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
BROWN
);
}
BoundaryBox
=
Component
->
m_Field
[
REFERENCE
].
GetBoundaryBox
();
x1
=
BoundaryBox
.
GetX
();
/* Fin Boucle de dessin */
y1
=
BoundaryBox
.
GetY
();
if
(
g_DebugLevel
>
4
)
/* Draw the component boundary box */
x2
=
BoundaryBox
.
GetRight
();
{
y2
=
BoundaryBox
.
GetBottom
();
EDA_Rect
BoundaryBox
;
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
BROWN
);
if
(
Component
)
BoundaryBox
=
Component
->
m_Field
[
VALUE
].
GetBoundaryBox
();
BoundaryBox
=
Component
->
GetBoundaryBox
();
x1
=
BoundaryBox
.
GetX
();
else
y1
=
BoundaryBox
.
GetY
();
BoundaryBox
=
Entry
->
GetBoundaryBox
(
Multi
,
convert
);
x2
=
BoundaryBox
.
GetRight
();
x1
=
BoundaryBox
.
GetX
();
y2
=
BoundaryBox
.
GetBottom
();
y1
=
BoundaryBox
.
GetY
();
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
BROWN
);
x2
=
BoundaryBox
.
GetRight
();
}
y2
=
BoundaryBox
.
GetBottom
();
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
BROWN
);
BoundaryBox
=
Component
->
m_Field
[
REFERENCE
].
GetBoundaryBox
();
x1
=
BoundaryBox
.
GetX
();
y1
=
BoundaryBox
.
GetY
();
x2
=
BoundaryBox
.
GetRight
();
y2
=
BoundaryBox
.
GetBottom
();
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
BROWN
);
BoundaryBox
=
Component
->
m_Field
[
VALUE
].
GetBoundaryBox
();
x1
=
BoundaryBox
.
GetX
();
y1
=
BoundaryBox
.
GetY
();
x2
=
BoundaryBox
.
GetRight
();
y2
=
BoundaryBox
.
GetBottom
();
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
BROWN
);
}
}
}
/********************************************************************************/
/********************************************************************************/
void
LibDrawPin
::
DrawPinSymbol
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
LibDrawPin
::
DrawPinSymbol
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
pin_pos
,
int
orient
,
int
DrawMode
,
int
Color
)
const
wxPoint
&
pin_pos
,
int
orient
,
int
DrawMode
,
int
Color
)
/*******************************************************************************/
/*******************************************************************************/
/* Draw the pin symbol (without texts)
/* Draw the pin symbol (without texts)
if Color != 0 draw with Color, eles with the normal pin color
*
if Color != 0 draw with Color, eles with the normal pin color
*/
*/
{
{
int
MapX1
,
MapY1
,
x1
,
y1
;
int
MapX1
,
MapY1
,
x1
,
y1
;
int
color
;
int
color
;
int
width
=
MAX
(
m_Width
,
g_DrawMinimunLineWidth
);
int
width
=
MAX
(
m_Width
,
g_DrawMinimunLineWidth
);
int
posX
=
pin_pos
.
x
,
posY
=
pin_pos
.
y
,
len
=
m_PinLen
;
int
posX
=
pin_pos
.
x
,
posY
=
pin_pos
.
y
,
len
=
m_PinLen
;
if
(
Color
>=
0
)
color
=
Color
;
if
(
Color
>=
0
)
else
color
=
ReturnLayerColor
(
LAYER_PIN
);
color
=
Color
;
GRSetDrawMode
(
DC
,
DrawMode
);
else
color
=
ReturnLayerColor
(
LAYER_PIN
);
GRSetDrawMode
(
DC
,
DrawMode
);
MapX1
=
MapY1
=
0
;
x1
=
posX
;
y1
=
posY
;
switch
(
orient
)
{
MapX1
=
MapY1
=
0
;
x1
=
posX
;
y1
=
posY
;
case
PIN_UP
:
y1
=
posY
-
len
;
MapY1
=
1
;
switch
(
orient
)
break
;
{
case
PIN_DOWN
:
case
PIN_UP
:
y1
=
posY
+
len
;
MapY1
=
-
1
;
y1
=
posY
-
len
;
MapY1
=
1
;
break
;
break
;
case
PIN_LEFT
:
x1
=
posX
-
len
,
MapX1
=
1
;
case
PIN_DOWN
:
break
;
y1
=
posY
+
len
;
MapY1
=
-
1
;
case
PIN_RIGHT
:
break
;
x1
=
posX
+
len
;
MapX1
=
-
1
;
break
;
case
PIN_LEFT
:
}
x1
=
posX
-
len
,
MapX1
=
1
;
break
;
if
(
m_PinShape
&
INVERT
)
{
case
PIN_RIGHT
:
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
MapX1
*
INVERT_PIN_RADIUS
+
x1
,
x1
=
posX
+
len
;
MapX1
=
-
1
;
MapY1
*
INVERT_PIN_RADIUS
+
y1
,
break
;
INVERT_PIN_RADIUS
,
width
,
color
);
}
GRMoveTo
(
MapX1
*
INVERT_PIN_RADIUS
*
2
+
x1
,
if
(
m_PinShape
&
INVERT
)
MapY1
*
INVERT_PIN_RADIUS
*
2
+
y1
);
{
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
posX
,
posY
,
width
,
color
);
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
MapX1
*
INVERT_PIN_RADIUS
+
x1
,
}
MapY1
*
INVERT_PIN_RADIUS
+
y1
,
INVERT_PIN_RADIUS
,
width
,
color
);
else
{
GRMoveTo
(
MapX1
*
INVERT_PIN_RADIUS
*
2
+
x1
,
GRMoveTo
(
x1
,
y1
);
MapY1
*
INVERT_PIN_RADIUS
*
2
+
y1
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
posX
,
posY
,
width
,
color
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
posX
,
posY
,
width
,
color
);
}
}
else
if
(
m_PinShape
&
CLOCK
)
{
{
GRMoveTo
(
x1
,
y1
);
if
(
MapY1
==
0
)
/* MapX1 = +- 1 */
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
posX
,
posY
,
width
,
color
);
{
}
GRMoveTo
(
x1
,
y1
+
CLOCK_PIN_DIM
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
-
MapX1
*
CLOCK_PIN_DIM
,
y1
,
width
,
color
);
if
(
m_PinShape
&
CLOCK
)
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
-
CLOCK_PIN_DIM
,
width
,
color
);
{
}
if
(
MapY1
==
0
)
/* MapX1 = +- 1 */
else
/* MapX1 = 0 */
{
{
GRMoveTo
(
x1
,
y1
+
CLOCK_PIN_DIM
);
GRMoveTo
(
x1
+
CLOCK_PIN_DIM
,
y1
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
-
MapX1
*
CLOCK_PIN_DIM
,
y1
,
width
,
color
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
-
MapY1
*
CLOCK_PIN_DIM
,
width
,
color
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
-
CLOCK_PIN_DIM
,
width
,
color
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
-
CLOCK_PIN_DIM
,
y1
,
width
,
color
);
}
}
else
/* MapX1 = 0 */
}
{
GRMoveTo
(
x1
+
CLOCK_PIN_DIM
,
y1
);
if
(
m_PinShape
&
LOWLEVEL_IN
)
/* IEEE symbol "Active Low Input" */
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
(
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
,
if
(
m_PinShape
&
LOWLEVEL_IN
)
/* IEEE symbol "Active Low Input" */
y1
-
IEEE_SYMBOL_PIN_DIM
,
width
,
color
);
{
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
width
,
color
);
if
(
MapY1
==
0
)
/* MapX1 = +- 1 */
}
{
else
/* MapX1 = 0 */
GRMoveTo
(
x1
+
MapX1
*
IEEE_SYMBOL_PIN_DIM
*
2
,
y1
);
{
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
+
MapX1
*
IEEE_SYMBOL_PIN_DIM
*
2
,
GRMoveTo
(
x1
,
y1
+
MapY1
*
IEEE_SYMBOL_PIN_DIM
*
2
);
y1
-
IEEE_SYMBOL_PIN_DIM
,
width
,
color
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
-
IEEE_SYMBOL_PIN_DIM
,
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
width
,
color
);
y1
+
MapY1
*
IEEE_SYMBOL_PIN_DIM
*
2
,
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
);
if
(
m_PinShape
&
LOWLEVEL_OUT
)
/* IEEE symbol "Active Low Output" */
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
width
,
color
);
{
}
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
);
if
(
m_PinShape
&
LOWLEVEL_OUT
)
/* IEEE symbol "Active Low Output" */
}
{
else
/* MapX1 = 0 */
if
(
MapY1
==
0
)
/* MapX1 = +- 1 */
{
{
GRMoveTo
(
x1
-
IEEE_SYMBOL_PIN_DIM
,
y1
);
GRMoveTo
(
x1
,
y1
-
IEEE_SYMBOL_PIN_DIM
);
GRLineTo
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
+
MapY1
*
IEEE_SYMBOL_PIN_DIM
*
2
,
width
,
color
);
GRLineTo
(
&
panel
->
m_ClipBox
,
}
DC
,
}
x1
+
MapX1
*
IEEE_SYMBOL_PIN_DIM
*
2
,
y1
,
/* Draw the pin end target (active end of the pin) */
width
,
if
(
!
g_IsPrinting
)
// Draw but do not print the pin end target 1 pixel width */
color
);
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
posX
,
posY
,
TARGET_PIN_DIAM
,
0
,
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
);
}
}
...
@@ -744,56 +822,58 @@ int posX = pin_pos.x, posY = pin_pos.y, len = m_PinLen;
...
@@ -744,56 +822,58 @@ int posX = pin_pos.x, posY = pin_pos.y, len = m_PinLen;
* transform (only mirror and rotate so it remains on the unit circle) to *
* transform (only mirror and rotate so it remains on the unit circle) to *
* a new point which is used to detect new angle. *
* a new point which is used to detect new angle. *
*****************************************************************************/
*****************************************************************************/
bool
MapAngles
(
int
*
Angle1
,
int
*
Angle2
,
int
TransMat
[
2
][
2
]
)
bool
MapAngles
(
int
*
Angle1
,
int
*
Angle2
,
int
TransMat
[
2
][
2
]
)
{
{
int
Angle
,
Delta
;
int
Angle
,
Delta
;
double
x
,
y
,
t
;
double
x
,
y
,
t
;
bool
swap
=
FALSE
;
bool
swap
=
FALSE
;
Delta
=
*
Angle2
-
*
Angle1
;
Delta
=
*
Angle2
-
*
Angle1
;
if
(
Delta
>=
1800
)
if
(
Delta
>=
1800
)
{
{
*
Angle1
-=
1
;
*
Angle1
-=
1
;
*
Angle2
+=
1
;
*
Angle2
+=
1
;
}
}
x
=
cos
(
*
Angle1
*
M_PI
/
1800.0
);
x
=
cos
(
*
Angle1
*
M_PI
/
1800.0
);
y
=
sin
(
*
Angle1
*
M_PI
/
1800.0
);
y
=
sin
(
*
Angle1
*
M_PI
/
1800.0
);
t
=
x
*
TransMat
[
0
][
0
]
+
y
*
TransMat
[
0
][
1
];
t
=
x
*
TransMat
[
0
][
0
]
+
y
*
TransMat
[
0
][
1
];
y
=
x
*
TransMat
[
1
][
0
]
+
y
*
TransMat
[
1
][
1
];
y
=
x
*
TransMat
[
1
][
0
]
+
y
*
TransMat
[
1
][
1
];
x
=
t
;
x
=
t
;
*
Angle1
=
(
int
)
(
atan2
(
y
,
x
)
*
1800.0
/
M_PI
+
0.5
);
*
Angle1
=
(
int
)
(
atan2
(
y
,
x
)
*
1800.0
/
M_PI
+
0.5
);
x
=
cos
(
*
Angle2
*
M_PI
/
1800.0
);
x
=
cos
(
*
Angle2
*
M_PI
/
1800.0
);
y
=
sin
(
*
Angle2
*
M_PI
/
1800.0
);
y
=
sin
(
*
Angle2
*
M_PI
/
1800.0
);
t
=
x
*
TransMat
[
0
][
0
]
+
y
*
TransMat
[
0
][
1
];
t
=
x
*
TransMat
[
0
][
0
]
+
y
*
TransMat
[
0
][
1
];
y
=
x
*
TransMat
[
1
][
0
]
+
y
*
TransMat
[
1
][
1
];
y
=
x
*
TransMat
[
1
][
0
]
+
y
*
TransMat
[
1
][
1
];
x
=
t
;
x
=
t
;
*
Angle2
=
(
int
)
(
atan2
(
y
,
x
)
*
1800.0
/
M_PI
+
0.5
);
*
Angle2
=
(
int
)
(
atan2
(
y
,
x
)
*
1800.0
/
M_PI
+
0.5
);
NORMALIZE_ANGLE
(
*
Angle1
);
NORMALIZE_ANGLE
(
*
Angle1
);
NORMALIZE_ANGLE
(
*
Angle2
);
NORMALIZE_ANGLE
(
*
Angle2
);
if
(
*
Angle2
<
*
Angle1
)
*
Angle2
+=
3600
;
if
(
*
Angle2
<
*
Angle1
)
*
Angle2
+=
3600
;
if
(
*
Angle2
-
*
Angle1
>
1800
)
{
/* Need to swap the two angles. */
if
(
*
Angle2
-
*
Angle1
>
1800
)
Angle
=
(
*
Angle1
);
{
/* Need to swap the two angles. */
*
Angle1
=
(
*
Angle2
);
Angle
=
(
*
Angle1
);
*
Angle2
=
Angle
;
*
Angle1
=
(
*
Angle2
);
*
Angle2
=
Angle
;
NORMALIZE_ANGLE
(
*
Angle1
);
NORMALIZE_ANGLE
(
*
Angle2
);
NORMALIZE_ANGLE
(
*
Angle1
);
if
(
*
Angle2
<
*
Angle1
)
*
Angle2
+=
3600
;
NORMALIZE_ANGLE
(
*
Angle2
);
swap
=
TRUE
;
if
(
*
Angle2
<
*
Angle1
)
}
*
Angle2
+=
3600
;
swap
=
TRUE
;
if
(
Delta
>=
1800
)
}
{
*
Angle1
+=
1
;
if
(
Delta
>=
1800
)
*
Angle2
-=
1
;
{
}
*
Angle1
+=
1
;
*
Angle2
-=
1
;
return
swap
;
}
return
swap
;
}
}
...
@@ -801,186 +881,200 @@ bool swap = FALSE;
...
@@ -801,186 +881,200 @@ bool swap = FALSE;
* Routine to display an outline version of given library entry. *
* Routine to display an outline version of given library entry. *
* This routine is applied by the PlaceLibItem routine above. *
* This routine is applied by the PlaceLibItem routine above. *
*****************************************************************************/
*****************************************************************************/
void
DrawingLibInGhost
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
DrawingLibInGhost
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_LibComponentStruct
*
LibEntry
,
EDA_LibComponentStruct
*
LibEntry
,
EDA_SchComponentStruct
*
DrawLibItem
,
int
PartX
,
int
PartY
,
EDA_SchComponentStruct
*
DrawLibItem
,
int
PartX
,
int
PartY
,
int
multi
,
int
convert
,
int
Color
,
bool
DrawPinText
)
int
multi
,
int
convert
,
int
Color
,
bool
DrawPinText
)
{
{
int
DrawMode
=
g_XorMode
;
int
DrawMode
=
g_XorMode
;
DrawLibPartAux
(
panel
,
DC
,
DrawLibItem
,
LibEntry
,
wxPoint
(
PartX
,
PartY
),
DrawLibItem
->
m_Transform
,
multi
,
convert
,
DrawMode
,
Color
,
DrawPinText
);
DrawLibPartAux
(
panel
,
DC
,
DrawLibItem
,
LibEntry
,
wxPoint
(
PartX
,
PartY
),
DrawLibItem
->
m_Transform
,
multi
,
convert
,
DrawMode
,
Color
,
DrawPinText
);
}
}
/************************************************************/
/************************************************************/
/* Routine to draw One LibraryDrawStruct at given position, */
/* Routine to draw One LibraryDrawStruct at given position, */
/* matrice de transformation 1 0 0 -1 (normale) */
/* matrice de transformation 1 0 0 -1 (normale) */
/* DrawMode = GrXOR, GrOR .. */
/* DrawMode = GrXOR, GrOR .. */
/************************************************************/
/************************************************************/
/* Utilise en LibEdit et Lib Browse */
/* Utilise en LibEdit et Lib Browse */
void
DrawLibraryDrawStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
DrawLibraryDrawStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_LibComponentStruct
*
LibEntry
,
EDA_LibComponentStruct
*
LibEntry
,
int
PartX
,
int
PartY
,
int
PartX
,
int
PartY
,
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
i
,
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
;
#undef GETCOLOR
#undef GETCOLOR
#define GETCOLOR(l) Color < 0 ? ReturnLayerColor(l) : Color;
#define GETCOLOR( l ) Color < 0 ? ReturnLayerColor( l ) : Color;
Multi
=
0
;
/* unused */
Multi
=
0
;
/* unused */
/* Trace de la structure */
/* Trace de la structure */
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
GRSetDrawMode
(
DC
,
DrawMode
);
GRSetDrawMode
(
DC
,
DrawMode
);
TransMat
[
0
][
0
]
=
1
;
TransMat
[
0
][
0
]
=
1
;
TransMat
[
0
][
1
]
=
TransMat
[
1
][
0
]
=
0
;
TransMat
[
0
][
1
]
=
TransMat
[
1
][
0
]
=
0
;
TransMat
[
1
][
1
]
=
-
1
;
TransMat
[
1
][
1
]
=
-
1
;
int
LineWidth
=
MAX
(
DrawItem
->
m_Width
,
g_DrawMinimunLineWidth
);
int
LineWidth
=
MAX
(
DrawItem
->
m_Width
,
g_DrawMinimunLineWidth
);
switch
(
DrawItem
->
m_StructType
)
switch
(
DrawItem
->
m_StructType
)
{
{
case
COMPONENT_ARC_DRAW_TYPE
:
case
COMPONENT_ARC_DRAW_TYPE
:
{
{
int
xc
,
yc
,
x2
,
y2
;
int
xc
,
yc
,
x2
,
y2
;
LibDrawArc
*
Arc
=
(
LibDrawArc
*
)
DrawItem
;
LibDrawArc
*
Arc
=
(
LibDrawArc
*
)
DrawItem
;
t1
=
Arc
->
t1
;
t2
=
Arc
->
t2
;
t1
=
Arc
->
t1
;
t2
=
Arc
->
t2
;
bool
swap
=
MapAngles
(
&
t1
,
&
t2
,
TransMat
);
bool
swap
=
MapAngles
(
&
t1
,
&
t2
,
TransMat
);
xc
=
PartX
+
Arc
->
m_Pos
.
x
;
xc
=
PartX
+
Arc
->
m_Pos
.
x
;
yc
=
PartY
-
Arc
->
m_Pos
.
y
;
yc
=
PartY
-
Arc
->
m_Pos
.
y
;
x2
=
PartX
+
Arc
->
m_ArcStart
.
x
;
x2
=
PartX
+
Arc
->
m_ArcStart
.
x
;
y2
=
PartY
-
Arc
->
m_ArcStart
.
y
;
y2
=
PartY
-
Arc
->
m_ArcStart
.
y
;
x1
=
PartX
+
Arc
->
m_ArcEnd
.
x
;
x1
=
PartX
+
Arc
->
m_ArcEnd
.
x
;
y1
=
PartY
-
Arc
->
m_ArcEnd
.
y
;
y1
=
PartY
-
Arc
->
m_ArcEnd
.
y
;
if
(
swap
)
{
EXCHG
(
x1
,
x2
);
EXCHG
(
y1
,
y2
)}
if
(
swap
)
fill_option
=
Arc
->
m_Fill
&
(
~
g_PrintFillMask
);
{
if
(
(
Arc
->
m_Fill
==
FILLED_WITH_BG_BODYCOLOR
)
&&
!
g_IsPrinting
)
EXCHG
(
x1
,
x2
);
EXCHG
(
y1
,
y2
)
GRFilledArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
}
Arc
->
m_Rayon
,
CharColor
,
fill_option
=
Arc
->
m_Fill
&
(
~
g_PrintFillMask
);
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
));
if
(
(
Arc
->
m_Fill
==
FILLED_WITH_BG_BODYCOLOR
)
&&
!
g_IsPrinting
)
else
if
(
Arc
->
m_Fill
==
FILLED_SHAPE
)
GRFilledArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
GRFilledArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
Arc
->
m_Rayon
,
CharColor
,
Arc
->
m_Rayon
,
LineWidth
,
CharColor
,
CharColor
);
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
)
);
else
if
(
Arc
->
m_Fill
==
FILLED_SHAPE
)
GRFilledArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
Arc
->
m_Rayon
,
LineWidth
,
CharColor
,
CharColor
);
#ifdef DRAW_ARC_WITH_ANGLE
#ifdef DRAW_ARC_WITH_ANGLE
else
GRArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
else
Arc
->
m_Rayon
,
CharColor
);
GRArc
(
&
panel
->
m_ClipBox
,
DC
,
xc
,
yc
,
t1
,
t2
,
Arc
->
m_Rayon
,
CharColor
);
#else
#else
else
GRArc1
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
else
xc
,
yc
,
LineWidth
,
CharColor
);
GRArc1
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
xc
,
yc
,
LineWidth
,
CharColor
);
#endif
#endif
}
}
break
;
break
;
case
COMPONENT_CIRCLE_DRAW_TYPE
:
case
COMPONENT_CIRCLE_DRAW_TYPE
:
{
{
LibDrawCircle
*
Circle
=
(
LibDrawCircle
*
)
DrawItem
;
LibDrawCircle
*
Circle
=
(
LibDrawCircle
*
)
DrawItem
;
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
&
(
~
g_PrintFillMask
);
fill_option
=
Circle
->
m_Fill
&
(
~
g_PrintFillMask
);
if
(
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
&&
!
g_IsPrinting
)
if
(
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
&&
!
g_IsPrinting
)
GRFilledCircle
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
GRFilledCircle
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
Circle
->
m_Rayon
,
LineWidth
,
CharColor
,
Circle
->
m_Rayon
,
LineWidth
,
CharColor
,
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
));
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
)
);
else
if
(
fill_option
==
FILLED_SHAPE
)
else
if
(
fill_option
==
FILLED_SHAPE
)
GRFilledCircle
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
GRFilledCircle
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
Circle
->
m_Rayon
,
0
,
CharColor
,
CharColor
);
Circle
->
m_Rayon
,
0
,
CharColor
,
CharColor
);
else
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
else
Circle
->
m_Rayon
,
LineWidth
,
CharColor
);
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
:
LibDrawText
*
Text
=
(
LibDrawText
*
)
DrawItem
;
{
x1
=
PartX
+
Text
->
m_Pos
.
x
;
LibDrawText
*
Text
=
(
LibDrawText
*
)
DrawItem
;
y1
=
PartY
-
Text
->
m_Pos
.
y
;
x1
=
PartX
+
Text
->
m_Pos
.
x
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
,
y1
),
CharColor
,
Text
->
m_Text
,
y1
=
PartY
-
Text
->
m_Pos
.
y
;
Text
->
m_Horiz
,
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
,
y1
),
CharColor
,
Text
->
m_Text
,
Text
->
m_Size
,
Text
->
m_Horiz
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
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
*
)
DrawItem
;
{
x1
=
PartX
+
Square
->
m_Pos
.
x
;
LibDrawSquare
*
Square
=
(
LibDrawSquare
*
)
DrawItem
;
y1
=
PartY
-
Square
->
m_Pos
.
y
;
x1
=
PartX
+
Square
->
m_Pos
.
x
;
x2
=
PartX
+
Square
->
m_End
.
x
;
y1
=
PartY
-
Square
->
m_Pos
.
y
;
y2
=
PartY
-
Square
->
m_End
.
y
;
x2
=
PartX
+
Square
->
m_End
.
x
;
fill_option
=
Square
->
m_Fill
&
(
~
g_PrintFillMask
);
y2
=
PartY
-
Square
->
m_End
.
y
;
if
(
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
&&
!
g_IsPrinting
)
fill_option
=
Square
->
m_Fill
&
(
~
g_PrintFillMask
);
GRFilledRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
if
(
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
&&
!
g_IsPrinting
)
CharColor
,
LineWidth
,
GRFilledRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
));
CharColor
,
LineWidth
,
else
if
(
fill_option
==
FILLED_SHAPE
)
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
)
);
GRFilledRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
else
if
(
fill_option
==
FILLED_SHAPE
)
CharColor
,
CharColor
);
GRFilledRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
else
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
LineWidth
,
CharColor
,
CharColor
);
CharColor
);
else
}
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
LineWidth
,
break
;
CharColor
);
}
case
COMPONENT_PIN_DRAW_TYPE
:
/* Trace des Pins */
break
;
{
LibDrawPin
*
Pin
=
(
LibDrawPin
*
)
DrawItem
;
case
COMPONENT_PIN_DRAW_TYPE
:
/* Trace des Pins */
x2
=
PartX
+
Pin
->
m_Pos
.
x
;
{
y2
=
PartY
-
Pin
->
m_Pos
.
y
;
LibDrawPin
*
Pin
=
(
LibDrawPin
*
)
DrawItem
;
/* Compute the real pin orientation, i.e. pin orient + component orient */
x2
=
PartX
+
Pin
->
m_Pos
.
x
;
orient
=
Pin
->
ReturnPinDrawOrient
(
TransMat
);
y2
=
PartY
-
Pin
->
m_Pos
.
y
;
/* Compute the real pin orientation, i.e. pin orient + component orient */
/* Dessin de la pin et du symbole special associe */
orient
=
Pin
->
ReturnPinDrawOrient
(
TransMat
);
if
(
Pin
->
m_Attributs
&
PINNOTDRAW
)
CharColor
=
DARKGRAY
;
else
CharColor
=
-
1
;
/* Dessin de la pin et du symbole special associe */
if
(
Pin
->
m_Attributs
&
PINNOTDRAW
)
Pin
->
DrawPinSymbol
(
panel
,
DC
,
wxPoint
(
x2
,
y2
),
orient
,
DrawMode
);
CharColor
=
DARKGRAY
;
wxPoint
pinpos
(
x2
,
y2
);
else
Pin
->
DrawPinTexts
(
panel
,
DC
,
pinpos
,
orient
,
CharColor
=
-
1
;
LibEntry
->
m_TextInside
,
LibEntry
->
m_DrawPinNum
,
LibEntry
->
m_DrawPinName
,
Pin
->
DrawPinSymbol
(
panel
,
DC
,
wxPoint
(
x2
,
y2
),
orient
,
DrawMode
);
CharColor
,
DrawMode
);
wxPoint
pinpos
(
x2
,
y2
);
}
break
;
Pin
->
DrawPinTexts
(
panel
,
DC
,
pinpos
,
orient
,
LibEntry
->
m_TextInside
,
case
COMPONENT_POLYLINE_DRAW_TYPE
:
LibEntry
->
m_DrawPinNum
,
LibEntry
->
m_DrawPinName
,
{
CharColor
,
DrawMode
);
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DrawItem
;
}
if
(
Buf_Poly_Drawings
==
NULL
)
break
;
{
Buf_Poly_Size
=
polyline
->
n
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
Buf_Poly_Drawings
=
(
int
*
)
MyMalloc
(
sizeof
(
int
)
*
2
*
Buf_Poly_Size
);
{
}
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DrawItem
;
else
if
(
Buf_Poly_Size
<
polyline
->
n
)
if
(
Buf_Poly_Drawings
==
NULL
)
{
{
Buf_Poly_Size
=
polyline
->
n
;
Buf_Poly_Size
=
polyline
->
n
;
Buf_Poly_Drawings
=
(
int
*
)
realloc
(
Buf_Poly_Drawings
,
Buf_Poly_Drawings
=
(
int
*
)
MyMalloc
(
sizeof
(
int
)
*
2
*
Buf_Poly_Size
);
sizeof
(
int
)
*
2
*
Buf_Poly_Size
);
}
}
else
if
(
Buf_Poly_Size
<
polyline
->
n
)
for
(
i
=
0
;
i
<
polyline
->
n
;
i
++
)
{
{
Buf_Poly_Size
=
polyline
->
n
;
Buf_Poly_Drawings
[
i
*
2
]
=
PartX
+
polyline
->
PolyList
[
i
*
2
];
Buf_Poly_Drawings
=
(
int
*
)
realloc
(
Buf_Poly_Drawings
,
Buf_Poly_Drawings
[
i
*
2
+
1
]
=
PartY
-
polyline
->
PolyList
[
i
*
2
+
1
];
sizeof
(
int
)
*
2
*
Buf_Poly_Size
);
}
}
fill_option
=
polyline
->
m_Fill
&
(
~
g_PrintFillMask
);
for
(
i
=
0
;
i
<
polyline
->
n
;
i
++
)
if
(
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
&&
!
g_IsPrinting
)
{
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
Buf_Poly_Drawings
[
i
*
2
]
=
PartX
+
polyline
->
PolyList
[
i
*
2
];
Buf_Poly_Drawings
,
1
,
LineWidth
,
CharColor
,
Buf_Poly_Drawings
[
i
*
2
+
1
]
=
PartY
-
polyline
->
PolyList
[
i
*
2
+
1
];
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
));
}
else
if
(
fill_option
==
FILLED_SHAPE
)
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
fill_option
=
polyline
->
m_Fill
&
(
~
g_PrintFillMask
);
Buf_Poly_Drawings
,
1
,
LineWidth
,
CharColor
,
CharColor
);
if
(
(
fill_option
==
FILLED_WITH_BG_BODYCOLOR
)
&&
!
g_IsPrinting
)
else
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
polyline
->
n
,
Buf_Poly_Drawings
,
0
,
LineWidth
,
CharColor
,
CharColor
);
Buf_Poly_Drawings
,
1
,
LineWidth
,
CharColor
,
break
;
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
;
}
default
:
;
}
}
}
eeschema/eelibs_read_libraryfiles.cpp
View file @
f3c324d5
...
@@ -17,22 +17,22 @@
...
@@ -17,22 +17,22 @@
/* Fonctions locales */
/* Fonctions locales */
/* pour librairies de composants */
/* pour librairies de composants */
static
LibEDA_BaseStruct
*
GetDrawEntry
(
WinEDA_DrawFrame
*
frame
,
FILE
*
f
,
static
LibEDA_BaseStruct
*
GetDrawEntry
(
WinEDA_DrawFrame
*
frame
,
FILE
*
f
,
char
*
Line
,
int
*
LineNum
);
char
*
Line
,
int
*
LineNum
);
static
bool
GetLibEntryField
(
EDA_LibComponentStruct
*
LibEntry
,
char
*
line
);
static
bool
GetLibEntryField
(
EDA_LibComponentStruct
*
LibEntry
,
char
*
line
);
static
bool
AddAliasNames
(
EDA_LibComponentStruct
*
LibEntry
,
char
*
line
);
static
bool
AddAliasNames
(
EDA_LibComponentStruct
*
LibEntry
,
char
*
line
);
static
void
InsertAlias
(
PriorQue
**
PQ
,
static
void
InsertAlias
(
PriorQue
**
PQ
,
EDA_LibComponentStruct
*
LibEntry
,
int
*
NumOfParts
);
EDA_LibComponentStruct
*
LibEntry
,
int
*
NumOfParts
);
static
bool
ReadLibEntryDateAndTime
(
EDA_LibComponentStruct
*
LibEntry
,
char
*
Line
);
static
bool
ReadLibEntryDateAndTime
(
EDA_LibComponentStruct
*
LibEntry
,
char
*
Line
);
static
int
AddFootprintFilterList
(
EDA_LibComponentStruct
*
LibEntryLibEntry
,
static
int
AddFootprintFilterList
(
EDA_LibComponentStruct
*
LibEntryLibEntry
,
FILE
*
f
,
char
*
Line
,
int
*
LineNum
);
FILE
*
f
,
char
*
Line
,
int
*
LineNum
);
/* pour doc librairies */
/* pour doc librairies */
/****************************************************/
/****************************************************/
/* Routines de lecture des librairies de composants */
/* Routines de lecture des librairies de composants */
/****************************************************/
/****************************************************/
/*****************************************************************************
/*****************************************************************************
...
@@ -41,197 +41,222 @@ static int AddFootprintFilterList(EDA_LibComponentStruct *LibEntryLibEntry,
...
@@ -41,197 +41,222 @@ static int AddFootprintFilterList(EDA_LibComponentStruct *LibEntryLibEntry,
* IF library already exists, it is NOT reloaded. *
* IF library already exists, it is NOT reloaded. *
* return: new lib or NULL *
* return: new lib or NULL *
*****************************************************************************/
*****************************************************************************/
LibraryStruct
*
LoadLibraryName
(
WinEDA_DrawFrame
*
frame
,
LibraryStruct
*
LoadLibraryName
(
WinEDA_DrawFrame
*
frame
,
const
wxString
&
FullLibName
,
const
wxString
&
LibName
)
const
wxString
&
FullLibName
,
const
wxString
&
LibName
)
{
{
int
NumOfParts
;
int
NumOfParts
;
FILE
*
f
;
FILE
*
f
;
LibraryStruct
*
NewLib
;
LibraryStruct
*
NewLib
;
PriorQue
*
Entries
;
PriorQue
*
Entries
;
wxString
FullFileName
;
wxString
FullFileName
;
if
(
(
NewLib
=
FindLibrary
(
LibName
))
!=
NULL
)
if
(
(
NewLib
=
FindLibrary
(
LibName
)
)
!=
NULL
)
{
{
if
(
NewLib
->
m_FullFileName
==
FullLibName
)
if
(
NewLib
->
m_FullFileName
==
FullLibName
)
return
NewLib
;
return
NewLib
;
FreeCmpLibrary
(
frame
,
LibName
);
FreeCmpLibrary
(
frame
,
LibName
);
}
}
NewLib
=
NULL
;
NewLib
=
NULL
;
f
=
wxFopen
(
FullLibName
,
wxT
(
"rt"
)
);
f
=
wxFopen
(
FullLibName
,
wxT
(
"rt"
)
);
if
(
f
==
NULL
)
if
(
f
==
NULL
)
{
{
wxString
msg
;
wxString
msg
;
msg
.
Printf
(
_
(
"Library <%s> not found"
),
FullLibName
.
GetData
());
msg
.
Printf
(
_
(
"Library <%s> not found"
),
FullLibName
.
GetData
()
);
DisplayError
(
frame
,
msg
);
DisplayError
(
frame
,
msg
);
return
NULL
;
return
NULL
;
}
}
NewLib
=
new
LibraryStruct
(
LIBRARY_TYPE_EESCHEMA
,
LibName
,
FullLibName
);
NewLib
=
new
LibraryStruct
(
LIBRARY_TYPE_EESCHEMA
,
LibName
,
FullLibName
);
Entries
=
LoadLibraryAux
(
frame
,
NewLib
,
f
,
&
NumOfParts
);
if
(
Entries
!=
NULL
)
Entries
=
LoadLibraryAux
(
frame
,
NewLib
,
f
,
&
NumOfParts
);
{
if
(
Entries
!=
NULL
)
NewLib
->
m_Entries
=
Entries
;
{
NewLib
->
m_NumOfParts
=
NumOfParts
;
NewLib
->
m_Entries
=
Entries
;
NewLib
->
m_NumOfParts
=
NumOfParts
;
if
(
g_LibraryList
==
NULL
)
g_LibraryList
=
NewLib
;
else
if
(
g_LibraryList
==
NULL
)
{
g_LibraryList
=
NewLib
;
LibraryStruct
*
tmplib
=
g_LibraryList
;
else
while
(
tmplib
->
m_Pnext
)
tmplib
=
tmplib
->
m_Pnext
;
{
tmplib
->
m_Pnext
=
NewLib
;
LibraryStruct
*
tmplib
=
g_LibraryList
;
}
while
(
tmplib
->
m_Pnext
)
tmplib
=
tmplib
->
m_Pnext
;
FullFileName
=
FullLibName
;
ChangeFileNameExt
(
FullFileName
,
DOC_EXT
);
tmplib
->
m_Pnext
=
NewLib
;
LoadDocLib
(
frame
,
FullFileName
,
NewLib
->
m_Name
);
}
}
else
delete
NewLib
;
FullFileName
=
FullLibName
;
ChangeFileNameExt
(
FullFileName
,
DOC_EXT
);
fclose
(
f
);
LoadDocLib
(
frame
,
FullFileName
,
NewLib
->
m_Name
);
return
NewLib
;
}
else
delete
NewLib
;
fclose
(
f
);
return
NewLib
;
}
}
/******************************************/
/******************************************/
void
LoadLibraries
(
WinEDA_DrawFrame
*
frame
)
void
LoadLibraries
(
WinEDA_DrawFrame
*
frame
)
/******************************************/
/******************************************/
/* Delete toutes les librairies chargees et recree toutes les librairies
/* Delete toutes les librairies chargees et recree toutes les librairies
donnes dans la liste g_LibName_List
*
donnes dans la liste g_LibName_List
*/
*/
{
{
wxString
FullLibName
,
msg
;
wxString
FullLibName
,
msg
;
wxString
LibName
;
wxString
LibName
;
unsigned
ii
,
iimax
=
g_LibName_List
.
GetCount
();
unsigned
ii
,
iimax
=
g_LibName_List
.
GetCount
();
frame
->
PrintMsg
(
_
(
"Start loading schematic libs"
));
frame
->
PrintMsg
(
_
(
"Start loading schematic libs"
)
);
// Free the unwanted libraries (i.e. not in list) but keep the .cache lib
// Free the unwanted libraries (i.e. not in list) but keep the .cache lib
LibraryStruct
*
nextlib
,
*
lib
=
g_LibraryList
;
LibraryStruct
*
nextlib
,
*
lib
=
g_LibraryList
;
for
(;
lib
!=
NULL
;
lib
=
nextlib
)
for
(
;
lib
!=
NULL
;
lib
=
nextlib
)
{
{
nextlib
=
lib
->
m_Pnext
;
nextlib
=
lib
->
m_Pnext
;
if
(
lib
->
m_IsLibCache
)
continue
;
if
(
lib
->
m_IsLibCache
)
continue
;
wxString
libname
=
lib
->
m_Name
;
wxString
libname
=
lib
->
m_Name
;
// is this library in "wanted list" g_LibName_List ?
int
test
=
g_LibName_List
.
Index
(
libname
);
// is this library in "wanted list" g_LibName_List ?
if
(
test
==
wxNOT_FOUND
)
FreeCmpLibrary
(
frame
,
libname
);
int
test
=
g_LibName_List
.
Index
(
libname
);
}
if
(
test
==
wxNOT_FOUND
)
FreeCmpLibrary
(
frame
,
libname
);
// Load missing libraries (if any)
}
for
(
ii
=
0
;
ii
<
iimax
;
ii
++
)
{
// Load missing libraries (if any)
LibName
=
g_LibName_List
[
ii
];
for
(
ii
=
0
;
ii
<
iimax
;
ii
++
)
{
if
(
LibName
.
IsEmpty
()
)
continue
;
LibName
=
g_LibName_List
[
ii
];
FullLibName
=
MakeFileName
(
g_RealLibDirBuffer
,
LibName
,
g_LibExtBuffer
);
msg
=
wxT
(
"Loading "
)
+
FullLibName
;
if
(
LibName
.
IsEmpty
()
)
if
(
LoadLibraryName
(
frame
,
FullLibName
,
LibName
)
)
continue
;
msg
+=
wxT
(
" OK"
);
FullLibName
=
MakeFileName
(
g_RealLibDirBuffer
,
LibName
,
g_LibExtBuffer
);
else
msg
=
wxT
(
"Loading "
)
+
FullLibName
;
msg
+=
wxT
(
" ->Error"
);
if
(
LoadLibraryName
(
frame
,
FullLibName
,
LibName
)
)
frame
->
PrintMsg
(
msg
);
msg
+=
wxT
(
" OK"
);
}
else
msg
+=
wxT
(
" ->Error"
);
// reorder the linked list to match the order filename list:
frame
->
PrintMsg
(
msg
);
int
NumOfLibs
;
}
for
(
NumOfLibs
=
0
,
lib
=
g_LibraryList
;
lib
!=
NULL
;
lib
=
lib
->
m_Pnext
)
{
// reorder the linked list to match the order filename list:
lib
->
m_Flags
=
0
;
int
NumOfLibs
;
NumOfLibs
++
;
for
(
NumOfLibs
=
0
,
lib
=
g_LibraryList
;
lib
!=
NULL
;
lib
=
lib
->
m_Pnext
)
}
{
if
(
NumOfLibs
==
0
)
return
;
lib
->
m_Flags
=
0
;
NumOfLibs
++
;
LibraryStruct
**
libs
=
}
(
LibraryStruct
**
)
MyZMalloc
(
sizeof
(
LibraryStruct
*
)
*
(
NumOfLibs
+
2
));
if
(
NumOfLibs
==
0
)
int
jj
=
0
;
return
;
for
(
ii
=
0
;
ii
<
g_LibName_List
.
GetCount
();
ii
++
)
{
LibraryStruct
**
libs
=
if
(
jj
>=
NumOfLibs
)
break
;
(
LibraryStruct
**
)
MyZMalloc
(
sizeof
(
LibraryStruct
*
)
*
(
NumOfLibs
+
2
)
);
lib
=
FindLibrary
(
g_LibName_List
[
ii
]);
if
(
lib
)
int
jj
=
0
;
{
for
(
ii
=
0
;
ii
<
g_LibName_List
.
GetCount
();
ii
++
)
lib
->
m_Flags
=
1
;
{
libs
[
jj
++
]
=
lib
;
if
(
jj
>=
NumOfLibs
)
}
break
;
}
lib
=
FindLibrary
(
g_LibName_List
[
ii
]
);
/* Put lib cache at end of list */
if
(
lib
)
for
(
lib
=
g_LibraryList
;
lib
!=
NULL
;
lib
=
lib
->
m_Pnext
)
{
{
lib
->
m_Flags
=
1
;
if
(
lib
->
m_Flags
==
0
)
libs
[
jj
++
]
=
lib
;
libs
[
jj
++
]
=
lib
;
}
}
libs
[
jj
]
=
NULL
;
}
/* Change the linked list pointers */
/* Put lib cache at end of list */
for
(
ii
=
0
;
libs
[
ii
]
!=
NULL
;
ii
++
)
for
(
lib
=
g_LibraryList
;
lib
!=
NULL
;
lib
=
lib
->
m_Pnext
)
libs
[
ii
]
->
m_Pnext
=
libs
[
ii
+
1
];
{
if
(
lib
->
m_Flags
==
0
)
g_LibraryList
=
libs
[
0
];
libs
[
jj
++
]
=
lib
;
}
MyFree
(
libs
);
libs
[
jj
]
=
NULL
;
for
(
lib
=
g_LibraryList
;
lib
!=
NULL
;
lib
=
lib
->
m_Pnext
)
lib
->
m_Flags
=
0
;
/* Change the linked list pointers */
for
(
ii
=
0
;
libs
[
ii
]
!=
NULL
;
ii
++
)
libs
[
ii
]
->
m_Pnext
=
libs
[
ii
+
1
];
g_LibraryList
=
libs
[
0
];
MyFree
(
libs
);
for
(
lib
=
g_LibraryList
;
lib
!=
NULL
;
lib
=
lib
->
m_Pnext
)
lib
->
m_Flags
=
0
;
}
}
/*****************************************************************************
/*****************************************************************************
* Routine to free a library from the current loaded libraries. *
* Routine to free a library from the current loaded libraries. *
*****************************************************************************/
*****************************************************************************/
void
FreeCmpLibrary
(
wxWindow
*
frame
,
const
wxString
&
LibName
)
void
FreeCmpLibrary
(
wxWindow
*
frame
,
const
wxString
&
LibName
)
{
{
int
NumOfLibs
=
NumOfLibraries
();
int
NumOfLibs
=
NumOfLibraries
();
LibraryStruct
*
Lib
,
*
TempLib
;
LibraryStruct
*
Lib
,
*
TempLib
;
if
(
NumOfLibs
==
0
)
if
(
NumOfLibs
==
0
)
{
{
DisplayError
(
frame
,
wxT
(
"No libraries are loaded"
),
20
);
DisplayError
(
frame
,
wxT
(
"No libraries are loaded"
),
20
);
return
;
return
;
}
}
/* Search for this library name: */
/* Search for this library name: */
for
(
Lib
=
g_LibraryList
;
Lib
!=
NULL
;
Lib
=
Lib
->
m_Pnext
)
for
(
Lib
=
g_LibraryList
;
Lib
!=
NULL
;
Lib
=
Lib
->
m_Pnext
)
{
{
if
(
LibName
==
Lib
->
m_Name
)
break
;
if
(
LibName
==
Lib
->
m_Name
)
}
break
;
}
if
(
Lib
==
NULL
)
return
;
if
(
Lib
==
NULL
)
if
(
Lib
==
g_LibraryList
)
g_LibraryList
=
Lib
->
m_Pnext
;
return
;
else
{
if
(
Lib
==
g_LibraryList
)
for
(
TempLib
=
g_LibraryList
;
TempLib
->
m_Pnext
!=
Lib
;
TempLib
=
TempLib
->
m_Pnext
);
g_LibraryList
=
Lib
->
m_Pnext
;
TempLib
->
m_Pnext
=
TempLib
->
m_Pnext
->
m_Pnext
;
else
}
{
for
(
TempLib
=
g_LibraryList
;
TempLib
->
m_Pnext
!=
Lib
;
TempLib
=
TempLib
->
m_Pnext
)
delete
Lib
;
;
/* La librairie supprimee est peut etre celle selectee dans libedit */
TempLib
->
m_Pnext
=
TempLib
->
m_Pnext
->
m_Pnext
;
if
(
Lib
==
CurrentLib
)
CurrentLib
=
NULL
;
}
delete
Lib
;
/* La librairie supprimee est peut etre celle selectee dans libedit */
if
(
Lib
==
CurrentLib
)
CurrentLib
=
NULL
;
}
}
/******************************/
/******************************/
const
wxChar
**
GetLibNames
(
void
)
const
wxChar
**
GetLibNames
(
void
)
/******************************/
/******************************/
/* Routine to return pointers to all library names.
/* Routine to return pointers to all library names.
User is responsible to deallocate memory
*
User is responsible to deallocate memory
*/
*/
{
{
int
ii
,
NumOfLibs
=
NumOfLibraries
();
int
ii
,
NumOfLibs
=
NumOfLibraries
();
const
wxChar
**
Names
;
const
wxChar
**
Names
;
LibraryStruct
*
Lib
;
LibraryStruct
*
Lib
;
Names
=
(
const
wxChar
**
)
MyZMalloc
(
sizeof
(
wxChar
*
)
*
(
NumOfLibs
+
1
));
Names
=
(
const
wxChar
**
)
MyZMalloc
(
sizeof
(
wxChar
*
)
*
(
NumOfLibs
+
1
)
);
for
(
ii
=
0
,
Lib
=
g_LibraryList
;
Lib
!=
NULL
;
Lib
=
Lib
->
m_Pnext
,
ii
++
)
for
(
ii
=
0
,
Lib
=
g_LibraryList
;
Lib
!=
NULL
;
Lib
=
Lib
->
m_Pnext
,
ii
++
)
{
{
Names
[
ii
]
=
Lib
->
m_Name
.
GetData
();
Names
[
ii
]
=
Lib
->
m_Name
.
GetData
();
}
}
Names
[
ii
]
=
NULL
;
Names
[
ii
]
=
NULL
;
return
Names
;
return
Names
;
}
}
...
@@ -239,911 +264,1017 @@ LibraryStruct *Lib;
...
@@ -239,911 +264,1017 @@ LibraryStruct *Lib;
* Routine to compare two EDA_LibComponentStruct for the PriorQue module. *
* Routine to compare two EDA_LibComponentStruct for the PriorQue module. *
* Comparison (insensitive case) is based on Part name. *
* Comparison (insensitive case) is based on Part name. *
*****************************************************************************/
*****************************************************************************/
int
LibraryEntryCompare
(
EDA_LibComponentStruct
*
LE1
,
EDA_LibComponentStruct
*
LE2
)
int
LibraryEntryCompare
(
EDA_LibComponentStruct
*
LE1
,
EDA_LibComponentStruct
*
LE2
)
{
{
return
LE1
->
m_Name
.
m_Text
.
CmpNoCase
(
LE2
->
m_Name
.
m_Text
);
return
LE1
->
m_Name
.
m_Text
.
CmpNoCase
(
LE2
->
m_Name
.
m_Text
);
}
}
/*****************************************************************************
/*****************************************************************************
* Routine to load a library from given open file. *
* Routine to load a library from given open file. *
*****************************************************************************/
*****************************************************************************/
PriorQue
*
LoadLibraryAux
(
WinEDA_DrawFrame
*
frame
,
LibraryStruct
*
Library
,
FILE
*
libfile
,
int
*
NumOfParts
)
PriorQue
*
LoadLibraryAux
(
WinEDA_DrawFrame
*
frame
,
LibraryStruct
*
Library
,
FILE
*
libfile
,
int
*
NumOfParts
)
{
{
int
LineNum
=
0
;
int
LineNum
=
0
;
char
Line
[
1024
];
char
Line
[
1024
];
PriorQue
*
PQ
=
NULL
;
PriorQue
*
PQ
=
NULL
;
EDA_LibComponentStruct
*
LibEntry
;
EDA_LibComponentStruct
*
LibEntry
;
wxString
msg
;
wxString
msg
;
wxBusyCursor
ShowWait
;
// Display a Busy Cursor..
wxBusyCursor
ShowWait
;
// Display a Busy Cursor..
*
NumOfParts
=
0
;
*
NumOfParts
=
0
;
if
(
GetLine
(
libfile
,
Line
,
&
LineNum
,
sizeof
(
Line
)
)
==
NULL
)
if
(
GetLine
(
libfile
,
Line
,
&
LineNum
,
sizeof
(
Line
)
)
==
NULL
)
{
{
msg
=
_
(
"File <"
)
+
Library
->
m_Name
+
_
(
"> is empty!"
);
msg
=
_
(
"File <"
)
+
Library
->
m_Name
+
_
(
"> is empty!"
);
DisplayError
(
frame
,
msg
);
DisplayError
(
frame
,
msg
);
return
NULL
;
return
NULL
;
}
}
if
(
strnicmp
(
Line
,
LIBFILE_IDENT
,
10
)
!=
0
)
if
(
strnicmp
(
Line
,
LIBFILE_IDENT
,
10
)
!=
0
)
{
{
msg
=
_
(
"File <"
)
+
Library
->
m_Name
+
_
(
"> is NOT EESCHEMA library!"
);
msg
=
_
(
"File <"
)
+
Library
->
m_Name
+
_
(
"> is NOT EESCHEMA library!"
);
DisplayError
(
frame
,
msg
);
DisplayError
(
frame
,
msg
);
return
NULL
;
return
NULL
;
}
}
if
(
Library
)
Library
->
m_Header
=
CONV_FROM_UTF8
(
Line
);
if
(
Library
)
Library
->
m_Header
=
CONV_FROM_UTF8
(
Line
);
PQInit
(
&
PQ
);
PQCompFunc
((
PQCompFuncType
)
LibraryEntryCompare
);
PQInit
(
&
PQ
);
PQCompFunc
(
(
PQCompFuncType
)
LibraryEntryCompare
);
while
(
GetLine
(
libfile
,
Line
,
&
LineNum
,
sizeof
(
Line
))
)
{
while
(
GetLine
(
libfile
,
Line
,
&
LineNum
,
sizeof
(
Line
)
)
)
if
(
strnicmp
(
Line
,
"$HEADER"
,
7
)
==
0
)
{
{
if
(
strnicmp
(
Line
,
"$HEADER"
,
7
)
==
0
)
if
(
Library
)
{
{
if
(
Library
)
if
(
!
Library
->
ReadHeader
(
libfile
,
&
LineNum
)
)
{
{
if
(
!
Library
->
ReadHeader
(
libfile
,
&
LineNum
)
)
msg
=
_
(
"Library <"
)
+
Library
->
m_Name
+
_
(
"> header read error"
);
{
DisplayError
(
frame
,
msg
,
30
);
msg
=
_
(
"Library <"
)
+
Library
->
m_Name
+
_
(
"> header read error"
);
}
DisplayError
(
frame
,
msg
,
30
);
}
}
continue
;
}
}
continue
;
}
if
(
strnicmp
(
Line
,
"DEF"
,
3
)
==
0
)
{
if
(
strnicmp
(
Line
,
"DEF"
,
3
)
==
0
)
/* Read one DEF/ENDDEF part entry from library: */
{
LibEntry
=
Read_Component_Definition
(
frame
,
Line
,
libfile
,
&
LineNum
);
/* Read one DEF/ENDDEF part entry from library: */
if
(
LibEntry
)
LibEntry
=
Read_Component_Definition
(
frame
,
Line
,
libfile
,
&
LineNum
);
{
if
(
LibEntry
)
/* If we are here, this part is O.k. - put it in: */
{
++*
NumOfParts
;
/* If we are here, this part is O.k. - put it in: */
PQInsert
(
&
PQ
,
LibEntry
);
++
*
NumOfParts
;
InsertAlias
(
&
PQ
,
LibEntry
,
NumOfParts
);
PQInsert
(
&
PQ
,
LibEntry
);
}
InsertAlias
(
&
PQ
,
LibEntry
,
NumOfParts
);
}
}
}
}
}
return
PQ
;
return
PQ
;
}
}
/*********************************************************************************************/
/*********************************************************************************************/
EDA_LibComponentStruct
*
Read_Component_Definition
(
WinEDA_DrawFrame
*
frame
,
char
*
Line
,
EDA_LibComponentStruct
*
Read_Component_Definition
(
WinEDA_DrawFrame
*
frame
,
char
*
Line
,
FILE
*
f
,
int
*
LineNum
)
FILE
*
f
,
int
*
LineNum
)
/*********************************************************************************************/
/*********************************************************************************************/
/* Routine to Read a DEF/ENDDEF part entry from given open file.
/* Routine to Read a DEF/ENDDEF part entry from given open file.
*/
*/
{
{
int
unused
;
int
unused
;
char
*
p
,
*
Name
,
*
Prefix
=
NULL
;
char
*
p
,
*
Name
,
*
Prefix
=
NULL
;
EDA_LibComponentStruct
*
LibEntry
=
NULL
;
EDA_LibComponentStruct
*
LibEntry
=
NULL
;
bool
Res
;
bool
Res
;
wxString
Msg
;
wxString
Msg
;
p
=
strtok
(
Line
,
"
\t\r\n
"
);
p
=
strtok
(
Line
,
"
\t\r\n
"
);
if
(
strcmp
(
p
,
"DEF"
)
!=
0
)
if
(
strcmp
(
p
,
"DEF"
)
!=
0
)
{
{
Msg
.
Printf
(
wxT
(
"DEF command expected in line %d, aborted."
),
*
LineNum
);
Msg
.
Printf
(
wxT
(
"DEF command expected in line %d, aborted."
),
*
LineNum
);
DisplayError
(
frame
,
Msg
);
DisplayError
(
frame
,
Msg
);
return
NULL
;
return
NULL
;
}
}
/* Read DEF line: */
/* Read DEF line: */
char
drawnum
=
0
,
drawname
=
0
;
char
drawnum
=
0
,
drawname
=
0
;
LibEntry
=
new
EDA_LibComponentStruct
(
NULL
);
LibEntry
=
new
EDA_LibComponentStruct
(
NULL
);
if
((
Name
=
strtok
(
NULL
,
"
\t\n
"
))
==
NULL
||
/* Part name: */
if
(
(
Name
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/* Part name: */
(
Prefix
=
strtok
(
NULL
,
"
\t\n
"
))
==
NULL
||
/* Prefix name: */
||
(
Prefix
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/* Prefix name: */
(
p
=
strtok
(
NULL
,
"
\t\n
"
))
==
NULL
||
/* NumOfPins: */
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/* NumOfPins: */
sscanf
(
p
,
"%d"
,
&
unused
)
!=
1
||
||
sscanf
(
p
,
"%d"
,
&
unused
)
!=
1
(
p
=
strtok
(
NULL
,
"
\t\n
"
))
==
NULL
||
/* TextInside: */
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/* TextInside: */
sscanf
(
p
,
"%d"
,
&
LibEntry
->
m_TextInside
)
!=
1
||
||
sscanf
(
p
,
"%d"
,
&
LibEntry
->
m_TextInside
)
!=
1
(
p
=
strtok
(
NULL
,
"
\t\n
"
))
==
NULL
||
/* DrawNums: */
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/* DrawNums: */
sscanf
(
p
,
"%c"
,
&
drawnum
)
!=
1
||
||
sscanf
(
p
,
"%c"
,
&
drawnum
)
!=
1
(
p
=
strtok
(
NULL
,
"
\t\n
"
))
==
NULL
||
/* DrawNums: */
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/* DrawNums: */
sscanf
(
p
,
"%c"
,
&
drawname
)
!=
1
||
||
sscanf
(
p
,
"%c"
,
&
drawname
)
!=
1
(
p
=
strtok
(
NULL
,
"
\t\n
"
))
==
NULL
||
/* m_UnitCount: */
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/* m_UnitCount: */
sscanf
(
p
,
"%d"
,
&
LibEntry
->
m_UnitCount
)
!=
1
)
||
sscanf
(
p
,
"%d"
,
&
LibEntry
->
m_UnitCount
)
!=
1
)
{
{
Msg
.
Printf
(
wxT
(
"Wrong DEF format in line %d, skipped."
),
*
LineNum
);
Msg
.
Printf
(
wxT
(
"Wrong DEF format in line %d, skipped."
),
*
LineNum
);
DisplayError
(
frame
,
Msg
);
DisplayError
(
frame
,
Msg
);
while
(
GetLine
(
f
,
Line
,
LineNum
,
1024
)
)
while
(
GetLine
(
f
,
Line
,
LineNum
,
1024
)
)
{
{
p
=
strtok
(
Line
,
"
\t\n
"
);
p
=
strtok
(
Line
,
"
\t\n
"
);
if
(
stricmp
(
p
,
"ENDDEF"
)
==
0
)
break
;
if
(
stricmp
(
p
,
"ENDDEF"
)
==
0
)
}
break
;
return
NULL
;
}
}
return
NULL
;
else
/* Mise a jour des infos de la ligne "DEF" */
}
{
else
/* Mise a jour des infos de la ligne "DEF" */
LibEntry
->
m_DrawPinNum
=
(
drawnum
==
'N'
)
?
FALSE
:
TRUE
;
{
LibEntry
->
m_DrawPinName
=
(
drawname
==
'N'
)
?
FALSE
:
TRUE
;
LibEntry
->
m_DrawPinNum
=
(
drawnum
==
'N'
)
?
FALSE
:
TRUE
;
/* Copy part name and prefix. */
LibEntry
->
m_DrawPinName
=
(
drawname
==
'N'
)
?
FALSE
:
TRUE
;
strupper
(
Name
);
/* Copy part name and prefix. */
if
(
Name
[
0
]
!=
'~'
)
LibEntry
->
m_Name
.
m_Text
=
CONV_FROM_UTF8
(
Name
);
strupper
(
Name
);
else
if
(
Name
[
0
]
!=
'~'
)
{
LibEntry
->
m_Name
.
m_Text
=
CONV_FROM_UTF8
(
Name
);
LibEntry
->
m_Name
.
m_Text
=
CONV_FROM_UTF8
(
&
Name
[
1
]);
else
LibEntry
->
m_Name
.
m_Attributs
|=
TEXT_NO_VISIBLE
;
{
}
LibEntry
->
m_Name
.
m_Text
=
CONV_FROM_UTF8
(
&
Name
[
1
]
);
LibEntry
->
m_Name
.
m_Attributs
|=
TEXT_NO_VISIBLE
;
if
(
strcmp
(
Prefix
,
"~"
)
==
0
)
}
{
LibEntry
->
m_Prefix
.
m_Text
.
Empty
();
if
(
strcmp
(
Prefix
,
"~"
)
==
0
)
LibEntry
->
m_Prefix
.
m_Attributs
|=
TEXT_NO_VISIBLE
;
{
}
LibEntry
->
m_Prefix
.
m_Text
.
Empty
();
else
LibEntry
->
m_Prefix
.
m_Text
=
CONV_FROM_UTF8
(
Prefix
);
LibEntry
->
m_Prefix
.
m_Attributs
|=
TEXT_NO_VISIBLE
;
}
// Copy optional infos
else
if
(
(
p
=
strtok
(
NULL
,
"
\t\n
"
))
!=
NULL
)
// m_UnitSelectionLocked param
LibEntry
->
m_Prefix
.
m_Text
=
CONV_FROM_UTF8
(
Prefix
);
{
if
(
*
p
==
'L'
)
LibEntry
->
m_UnitSelectionLocked
=
TRUE
;
// Copy optional infos
}
if
(
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
!=
NULL
)
// m_UnitSelectionLocked param
if
(
(
p
=
strtok
(
NULL
,
"
\t\n
"
))
!=
NULL
)
/* Type Of Component */
{
{
if
(
*
p
==
'L'
)
if
(
*
p
==
'P'
)
LibEntry
->
m_Options
=
ENTRY_POWER
;
LibEntry
->
m_UnitSelectionLocked
=
TRUE
;
}
}
}
if
(
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
!=
NULL
)
/* Type Of Component */
{
/* Analyse lignes suivantes */
if
(
*
p
==
'P'
)
while
(
GetLine
(
f
,
Line
,
LineNum
,
1024
)
)
LibEntry
->
m_Options
=
ENTRY_POWER
;
{
}
p
=
strtok
(
Line
,
"
\t\n
"
);
}
Res
=
TRUE
;
/* Pour test d'erreur (Res = FALSE = erreur) */
/* Analyse lignes suivantes */
if
(
(
Line
[
0
]
==
'T'
)
&&
(
Line
[
1
]
==
'i'
)
)
while
(
GetLine
(
f
,
Line
,
LineNum
,
1024
)
)
{
{
Res
=
ReadLibEntryDateAndTime
(
LibEntry
,
Line
);
p
=
strtok
(
Line
,
"
\t\n
"
);
}
Res
=
TRUE
;
/* Pour test d'erreur (Res = FALSE = erreur) */
else
if
(
Line
[
0
]
==
'F'
)
if
(
(
Line
[
0
]
==
'T'
)
&&
(
Line
[
1
]
==
'i'
)
)
{
{
Res
=
GetLibEntryField
(
LibEntry
,
Line
);
Res
=
ReadLibEntryDateAndTime
(
LibEntry
,
Line
);
}
}
else
if
(
Line
[
0
]
==
'F'
)
else
if
(
strcmp
(
p
,
"ENDDEF"
)
==
0
)
{
{
Res
=
GetLibEntryField
(
LibEntry
,
Line
);
break
;
}
}
else
if
(
strcmp
(
p
,
"ENDDEF"
)
==
0
)
{
else
if
(
strcmp
(
p
,
"DRAW"
)
==
0
)
break
;
{
}
LibEntry
->
m_Drawings
=
GetDrawEntry
(
frame
,
f
,
Line
,
LineNum
);
else
if
(
strcmp
(
p
,
"DRAW"
)
==
0
)
}
{
LibEntry
->
m_Drawings
=
GetDrawEntry
(
frame
,
f
,
Line
,
LineNum
);
else
if
(
strncmp
(
p
,
"ALIAS"
,
5
)
==
0
)
}
{
else
if
(
strncmp
(
p
,
"ALIAS"
,
5
)
==
0
)
p
=
strtok
(
NULL
,
"
\r\n
"
);
{
Res
=
AddAliasNames
(
LibEntry
,
p
);
p
=
strtok
(
NULL
,
"
\r\n
"
);
}
Res
=
AddAliasNames
(
LibEntry
,
p
);
}
else
if
(
strncmp
(
p
,
"$FPLIST"
,
5
)
==
0
)
else
if
(
strncmp
(
p
,
"$FPLIST"
,
5
)
==
0
)
{
{
Res
=
AddFootprintFilterList
(
LibEntry
,
f
,
Line
,
LineNum
);
Res
=
AddFootprintFilterList
(
LibEntry
,
f
,
Line
,
LineNum
);
}
}
else
else
{
{
Msg
.
Printf
(
wxT
(
"Undefined command
\"
%s
\"
in line %d, skipped."
),
p
,
*
LineNum
);
Msg
.
Printf
(
wxT
(
"Undefined command
\"
%s
\"
in line %d, skipped."
),
p
,
*
LineNum
);
frame
->
PrintMsg
(
Msg
);
frame
->
PrintMsg
(
Msg
);
}
}
/* Fin analyse de la ligne ou block: test de l'info lue */
/* Fin analyse de la ligne ou block: test de l'info lue */
if
(
!
Res
)
if
(
!
Res
)
{
/* Something went wrong there. */
{
/* Something went wrong there. */
Msg
.
Printf
(
wxT
(
" Error Line %d, Library not loaded"
),
*
LineNum
);
Msg
.
Printf
(
wxT
(
" Error Line %d, Library not loaded"
),
*
LineNum
);
DisplayError
(
frame
,
Msg
);
DisplayError
(
frame
,
Msg
);
delete
LibEntry
;
delete
LibEntry
;
return
NULL
;
return
NULL
;
}
}
}
}
/* If we are here, this part is O.k. - put it in: */
/* If we are here, this part is O.k. - put it in: */
LibEntry
->
SortDrawItems
();
LibEntry
->
SortDrawItems
();
return
LibEntry
;
return
LibEntry
;
}
}
/*****************************************************************************
/*****************************************************************************
* Routine to load a DRAW definition from given file. Note "DRAW" line has *
* Routine to load a DRAW definition from given file. Note "DRAW" line has *
* been read already. Reads upto and include ENDDRAW, or an error (NULL ret). *
* been read already. Reads upto and include ENDDRAW, or an error (NULL ret). *
*****************************************************************************/
*****************************************************************************/
static
LibEDA_BaseStruct
*
GetDrawEntry
(
WinEDA_DrawFrame
*
frame
,
FILE
*
f
,
char
*
Line
,
int
*
LineNum
)
static
LibEDA_BaseStruct
*
GetDrawEntry
(
WinEDA_DrawFrame
*
frame
,
FILE
*
f
,
char
*
Line
,
int
*
LineNum
)
{
{
int
i
=
0
,
jj
,
ll
,
Unit
,
Convert
,
size1
,
size2
;
int
i
=
0
,
jj
,
ll
,
Unit
,
Convert
,
size1
,
size2
;
char
*
p
,
Buffer
[
1024
],
BufName
[
256
],
char
*
p
,
Buffer
[
1024
],
BufName
[
256
],
PinNum
[
256
],
PinNum
[
256
],
chartmp
[
256
],
chartmp1
[
256
];
chartmp
[
256
],
chartmp1
[
256
];
wxString
MsgLine
;
wxString
MsgLine
;
bool
Error
=
FALSE
;
bool
Error
=
FALSE
;
LibEDA_BaseStruct
*
Tail
=
NULL
,
LibEDA_BaseStruct
*
Tail
=
NULL
,
*
New
=
NULL
,
*
New
=
NULL
,
*
Head
=
NULL
;
*
Head
=
NULL
;
while
(
TRUE
)
while
(
TRUE
)
{
{
if
(
GetLine
(
f
,
Line
,
LineNum
,
1024
)
==
NULL
)
if
(
GetLine
(
f
,
Line
,
LineNum
,
1024
)
==
NULL
)
{
{
DisplayError
(
frame
,
wxT
(
"File ended prematurely"
));
DisplayError
(
frame
,
wxT
(
"File ended prematurely"
)
);
return
Head
;
return
Head
;
}
}
if
(
strncmp
(
Line
,
"ENDDRAW"
,
7
)
==
0
)
if
(
strncmp
(
Line
,
"ENDDRAW"
,
7
)
==
0
)
{
{
break
;
break
;
}
}
New
=
NULL
;
New
=
NULL
;
switch
(
Line
[
0
])
switch
(
Line
[
0
]
)
{
{
case
'A'
:
/* Arc */
case
'A'
:
/* Arc */
{
{
int
startx
,
starty
,
endx
,
endy
;
int
startx
,
starty
,
endx
,
endy
;
LibDrawArc
*
Arc
=
new
LibDrawArc
();
LibDrawArc
*
Arc
=
new
LibDrawArc
();
New
=
Arc
;
ll
=
0
;
New
=
Arc
;
int
nbarg
=
sscanf
(
&
Line
[
2
],
"%d %d %d %d %d %d %d %d %s %d %d %d %d"
,
ll
=
0
;
&
Arc
->
m_Pos
.
x
,
&
Arc
->
m_Pos
.
y
,
&
Arc
->
m_Rayon
,
int
nbarg
=
sscanf
(
&
Line
[
2
],
"%d %d %d %d %d %d %d %d %s %d %d %d %d"
,
&
Arc
->
t1
,
&
Arc
->
t2
,
&
Unit
,
&
Convert
,
&
Arc
->
m_Pos
.
x
,
&
Arc
->
m_Pos
.
y
,
&
Arc
->
m_Rayon
,
&
Arc
->
m_Width
,
chartmp
,
&
startx
,
&
starty
,
&
endx
,
&
endy
);
&
Arc
->
t1
,
&
Arc
->
t2
,
&
Unit
,
&
Convert
,
if
(
nbarg
<
8
)
Error
=
TRUE
;
&
Arc
->
m_Width
,
chartmp
,
&
startx
,
&
starty
,
&
endx
,
&
endy
);
Arc
->
m_Unit
=
Unit
;
Arc
->
m_Convert
=
Convert
;
if
(
nbarg
<
8
)
if
(
chartmp
[
0
]
==
'F'
)
Arc
->
m_Fill
=
FILLED_SHAPE
;
Error
=
TRUE
;
if
(
chartmp
[
0
]
==
'f'
)
Arc
->
m_Fill
=
FILLED_WITH_BG_BODYCOLOR
;
Arc
->
m_Unit
=
Unit
;
Arc
->
m_Convert
=
Convert
;
if
(
chartmp
[
0
]
==
'F'
)
NORMALIZE_ANGLE
(
Arc
->
t1
);
Arc
->
m_Fill
=
FILLED_SHAPE
;
NORMALIZE_ANGLE
(
Arc
->
t2
);
if
(
chartmp
[
0
]
==
'f'
)
Arc
->
m_Fill
=
FILLED_WITH_BG_BODYCOLOR
;
if
(
nbarg
>=
13
)
// Coord reelles des extremites de l'arc lues
{
NORMALIZE_ANGLE
(
Arc
->
t1
);
Arc
->
m_ArcStart
.
x
=
startx
;
Arc
->
m_ArcStart
.
y
=
starty
;
NORMALIZE_ANGLE
(
Arc
->
t2
);
Arc
->
m_ArcEnd
.
x
=
endx
;
Arc
->
m_ArcEnd
.
y
=
endy
;
}
if
(
nbarg
>=
13
)
// Coord reelles des extremites de l'arc lues
else
{
{
Arc
->
m_ArcStart
.
x
=
startx
;
Arc
->
m_ArcStart
.
y
=
starty
;
Arc
->
m_ArcStart
.
x
=
Arc
->
m_Rayon
;
Arc
->
m_ArcStart
.
y
=
0
;
Arc
->
m_ArcEnd
.
x
=
endx
;
Arc
->
m_ArcEnd
.
y
=
endy
;
Arc
->
m_ArcEnd
.
x
=
Arc
->
m_Rayon
;
Arc
->
m_ArcEnd
.
y
=
0
;
}
RotatePoint
(
&
Arc
->
m_ArcStart
.
x
,
&
Arc
->
m_ArcStart
.
y
,
-
Arc
->
t1
);
else
Arc
->
m_ArcStart
.
x
+=
Arc
->
m_Pos
.
x
;
Arc
->
m_ArcStart
.
y
+=
Arc
->
m_Pos
.
y
;
{
RotatePoint
(
&
Arc
->
m_ArcEnd
.
x
,
&
Arc
->
m_ArcEnd
.
y
,
-
Arc
->
t2
);
Arc
->
m_ArcStart
.
x
=
Arc
->
m_Rayon
;
Arc
->
m_ArcStart
.
y
=
0
;
Arc
->
m_ArcEnd
.
x
+=
Arc
->
m_Pos
.
x
;
Arc
->
m_ArcEnd
.
y
+=
Arc
->
m_Pos
.
y
;
Arc
->
m_ArcEnd
.
x
=
Arc
->
m_Rayon
;
Arc
->
m_ArcEnd
.
y
=
0
;
}
RotatePoint
(
&
Arc
->
m_ArcStart
.
x
,
&
Arc
->
m_ArcStart
.
y
,
-
Arc
->
t1
);
}
Arc
->
m_ArcStart
.
x
+=
Arc
->
m_Pos
.
x
;
Arc
->
m_ArcStart
.
y
+=
Arc
->
m_Pos
.
y
;
break
;
RotatePoint
(
&
Arc
->
m_ArcEnd
.
x
,
&
Arc
->
m_ArcEnd
.
y
,
-
Arc
->
t2
);
Arc
->
m_ArcEnd
.
x
+=
Arc
->
m_Pos
.
x
;
Arc
->
m_ArcEnd
.
y
+=
Arc
->
m_Pos
.
y
;
case
'C'
:
/* Circle */
}
{
}
LibDrawCircle
*
Circle
=
new
LibDrawCircle
();
break
;
New
=
Circle
;
ll
=
0
;
Error
=
sscanf
(
&
Line
[
2
],
"%d %d %d %d %d %d %s"
,
case
'C'
:
/* Circle */
&
Circle
->
m_Pos
.
x
,
&
Circle
->
m_Pos
.
y
,
&
Circle
->
m_Rayon
,
{
&
Unit
,
&
Convert
,
&
Circle
->
m_Width
,
chartmp
)
<
6
;
LibDrawCircle
*
Circle
=
new
LibDrawCircle
();
Circle
->
m_Unit
=
Unit
;
Circle
->
m_Convert
=
Convert
;
New
=
Circle
;
ll
=
0
;
if
(
chartmp
[
0
]
==
'F'
)
Circle
->
m_Fill
=
FILLED_SHAPE
;
Error
=
sscanf
(
&
Line
[
2
],
"%d %d %d %d %d %d %s"
,
if
(
chartmp
[
0
]
==
'f'
)
Circle
->
m_Fill
=
FILLED_WITH_BG_BODYCOLOR
;
&
Circle
->
m_Pos
.
x
,
&
Circle
->
m_Pos
.
y
,
&
Circle
->
m_Rayon
,
}
&
Unit
,
&
Convert
,
&
Circle
->
m_Width
,
chartmp
)
<
6
;
break
;
Circle
->
m_Unit
=
Unit
;
Circle
->
m_Convert
=
Convert
;
case
'T'
:
/* Text */
if
(
chartmp
[
0
]
==
'F'
)
{
Circle
->
m_Fill
=
FILLED_SHAPE
;
LibDrawText
*
Text
=
new
LibDrawText
();
if
(
chartmp
[
0
]
==
'f'
)
New
=
Text
;
Circle
->
m_Fill
=
FILLED_WITH_BG_BODYCOLOR
;
Buffer
[
0
]
=
0
;
}
Error
=
sscanf
(
&
Line
[
2
],
"%d %d %d %d %d %d %d %s"
,
break
;
&
Text
->
m_Horiz
,
&
Text
->
m_Pos
.
x
,
&
Text
->
m_Pos
.
y
,
case
'T'
:
/* Text */
&
Text
->
m_Size
.
x
,
&
Text
->
m_Type
,
{
&
Unit
,
&
Convert
,
Buffer
)
!=
8
;
LibDrawText
*
Text
=
new
LibDrawText
();
Text
->
m_Unit
=
Unit
;
Text
->
m_Convert
=
Convert
;
New
=
Text
;
Text
->
m_Size
.
y
=
Text
->
m_Size
.
x
;
Buffer
[
0
]
=
0
;
if
(
!
Error
)
Error
=
sscanf
(
&
Line
[
2
],
"%d %d %d %d %d %d %d %s"
,
{
/* Convert '~' to spaces. */
&
Text
->
m_Horiz
,
Text
->
m_Text
=
CONV_FROM_UTF8
(
Buffer
);
&
Text
->
m_Pos
.
x
,
&
Text
->
m_Pos
.
y
,
Text
->
m_Text
.
Replace
(
wxT
(
"~"
),
wxT
(
" "
));
// Les espaces sont restitus
&
Text
->
m_Size
.
x
,
&
Text
->
m_Type
,
}
&
Unit
,
&
Convert
,
Buffer
)
!=
8
;
}
break
;
Text
->
m_Unit
=
Unit
;
Text
->
m_Convert
=
Convert
;
Text
->
m_Size
.
y
=
Text
->
m_Size
.
x
;
case
'S'
:
/* Square */
if
(
!
Error
)
{
{
/* Convert '~' to spaces. */
LibDrawSquare
*
Square
=
new
LibDrawSquare
();
Text
->
m_Text
=
CONV_FROM_UTF8
(
Buffer
);
New
=
Square
;
ll
=
0
;
Text
->
m_Text
.
Replace
(
wxT
(
"~"
),
wxT
(
" "
)
);
// Les espaces sont restitus
Error
=
sscanf
(
&
Line
[
2
],
"%d %d %d %d %d %d %d %s"
,
}
&
Square
->
m_Pos
.
x
,
&
Square
->
m_Pos
.
y
,
}
&
Square
->
m_End
.
x
,
&
Square
->
m_End
.
y
,
break
;
&
Unit
,
&
Convert
,
&
Square
->
m_Width
,
chartmp
)
<
7
;
Square
->
m_Unit
=
Unit
;
Square
->
m_Convert
=
Convert
;
case
'S'
:
/* Square */
if
(
chartmp
[
0
]
==
'F'
)
Square
->
m_Fill
=
FILLED_SHAPE
;
{
if
(
chartmp
[
0
]
==
'f'
)
Square
->
m_Fill
=
FILLED_WITH_BG_BODYCOLOR
;
LibDrawSquare
*
Square
=
new
LibDrawSquare
();
}
break
;
New
=
Square
;
ll
=
0
;
Error
=
sscanf
(
&
Line
[
2
],
"%d %d %d %d %d %d %d %s"
,
case
'X'
:
/* Pin Description */
&
Square
->
m_Pos
.
x
,
&
Square
->
m_Pos
.
y
,
{
&
Square
->
m_End
.
x
,
&
Square
->
m_End
.
y
,
*
Buffer
=
0
;
&
Unit
,
&
Convert
,
&
Square
->
m_Width
,
chartmp
)
<
7
;
LibDrawPin
*
Pin
=
new
LibDrawPin
();
Square
->
m_Unit
=
Unit
;
Square
->
m_Convert
=
Convert
;
New
=
Pin
;
if
(
chartmp
[
0
]
==
'F'
)
i
=
sscanf
(
Line
+
2
,
"%s %s %d %d %d %s %d %d %d %d %s %s"
,
Square
->
m_Fill
=
FILLED_SHAPE
;
BufName
,
PinNum
,
if
(
chartmp
[
0
]
==
'f'
)
&
Pin
->
m_Pos
.
x
,
&
Pin
->
m_Pos
.
y
,
Square
->
m_Fill
=
FILLED_WITH_BG_BODYCOLOR
;
&
ll
,
chartmp1
,
}
&
size1
,
&
size2
,
break
;
&
Unit
,
&
Convert
,
chartmp
,
Buffer
);
case
'X'
:
/* Pin Description */
Pin
->
m_PinNumSize
=
size1
;
/* Parametres type short */
{
Pin
->
m_PinNameSize
=
size2
;
*
Buffer
=
0
;
Pin
->
m_PinLen
=
ll
;
LibDrawPin
*
Pin
=
new
LibDrawPin
();
Pin
->
m_Orient
=
chartmp1
[
0
]
&
255
;
New
=
Pin
;
Pin
->
m_Unit
=
Unit
;
Pin
->
m_Convert
=
Convert
;
i
=
sscanf
(
Line
+
2
,
"%s %s %d %d %d %s %d %d %d %d %s %s"
,
strncpy
((
char
*
)
&
Pin
->
m_PinNum
,
PinNum
,
4
);
BufName
,
PinNum
,
Error
=
(
i
!=
11
&&
i
!=
12
);
&
Pin
->
m_Pos
.
x
,
&
Pin
->
m_Pos
.
y
,
&
ll
,
chartmp1
,
Pin
->
m_PinName
=
CONV_FROM_UTF8
(
BufName
);
&
size1
,
&
size2
,
&
Unit
,
&
Convert
,
chartmp
,
Buffer
);
jj
=
*
chartmp
&
255
;
switch
(
jj
)
Pin
->
m_PinNumSize
=
size1
;
/* Parametres type short */
{
Pin
->
m_PinNameSize
=
size2
;
case
'I'
:
Pin
->
m_PinLen
=
ll
;
Pin
->
m_PinType
=
PIN_INPUT
;
break
;
Pin
->
m_Orient
=
chartmp1
[
0
]
&
255
;
case
'O'
:
Pin
->
m_PinType
=
PIN_OUTPUT
;
break
;
Pin
->
m_Unit
=
Unit
;
Pin
->
m_Convert
=
Convert
;
case
'B'
:
strncpy
(
(
char
*
)
&
Pin
->
m_PinNum
,
PinNum
,
4
);
Pin
->
m_PinType
=
PIN_BIDI
;
break
;
Error
=
(
i
!=
11
&&
i
!=
12
);
case
'T'
:
Pin
->
m_PinType
=
PIN_TRISTATE
;
break
;
Pin
->
m_PinName
=
CONV_FROM_UTF8
(
BufName
);
case
'P'
:
Pin
->
m_PinType
=
PIN_PASSIVE
;
break
;
jj
=
*
chartmp
&
255
;
case
'U'
:
Pin
->
m_PinType
=
PIN_UNSPECIFIED
;
break
;
switch
(
jj
)
case
'W'
:
{
Pin
->
m_PinType
=
PIN_POWER_IN
;
break
;
case
'I'
:
case
'w'
:
Pin
->
m_PinType
=
PIN_INPUT
;
break
;
Pin
->
m_PinType
=
PIN_POWER_OUT
;
break
;
case
'C'
:
case
'O'
:
Pin
->
m_PinType
=
PIN_OPENCOLLECTOR
;
break
;
Pin
->
m_PinType
=
PIN_OUTPUT
;
break
;
case
'E'
:
Pin
->
m_PinType
=
PIN_OPENEMITTER
;
break
;
case
'B'
:
default
:
Pin
->
m_PinType
=
PIN_BIDI
;
break
;
MsgLine
.
Printf
(
wxT
(
"Unknown Pin Type [%c] line %d"
),
jj
,
*
LineNum
);
case
'T'
:
DisplayError
(
frame
,
MsgLine
);
Pin
->
m_PinType
=
PIN_TRISTATE
;
break
;
}
if
(
i
==
12
)
/* Special Symbole defined */
case
'P'
:
for
(
jj
=
strlen
(
Buffer
);
jj
>
0
;
)
Pin
->
m_PinType
=
PIN_PASSIVE
;
break
;
{
switch
(
Buffer
[
--
jj
])
case
'U'
:
{
Pin
->
m_PinType
=
PIN_UNSPECIFIED
;
break
;
case
'~'
:
break
;
case
'N'
:
Pin
->
m_Attributs
|=
PINNOTDRAW
;
break
;
case
'W'
:
case
'I'
:
Pin
->
m_PinShape
|=
INVERT
;
break
;
Pin
->
m_PinType
=
PIN_POWER_IN
;
break
;
case
'C'
:
Pin
->
m_PinShape
|=
CLOCK
;
break
;
case
'L'
:
Pin
->
m_PinShape
|=
LOWLEVEL_IN
;
break
;
case
'w'
:
case
'V'
:
Pin
->
m_PinShape
|=
LOWLEVEL_OUT
;
break
;
Pin
->
m_PinType
=
PIN_POWER_OUT
;
break
;
default
:
MsgLine
.
Printf
(
wxT
(
"Unknown Pin Shape [%c] line %d"
),
case
'C'
:
Buffer
[
jj
],
*
LineNum
);
Pin
->
m_PinType
=
PIN_OPENCOLLECTOR
;
break
;
DisplayError
(
frame
,
MsgLine
);
break
;
}
case
'E'
:
}
Pin
->
m_PinType
=
PIN_OPENEMITTER
;
break
;
}
break
;
default
:
MsgLine
.
Printf
(
wxT
(
"Unknown Pin Type [%c] line %d"
),
case
'P'
:
/* Polyline */
jj
,
*
LineNum
);
{
DisplayError
(
frame
,
MsgLine
);
LibDrawPolyline
*
Polyl
=
new
LibDrawPolyline
();
}
New
=
Polyl
;
if
(
i
==
12
)
/* Special Symbole defined */
if
(
sscanf
(
&
Line
[
2
],
"%d %d %d %d"
,
for
(
jj
=
strlen
(
Buffer
);
jj
>
0
;
)
&
Polyl
->
n
,
&
Unit
,
&
Convert
,
{
&
Polyl
->
m_Width
)
==
4
&&
switch
(
Buffer
[
--
jj
]
)
Polyl
->
n
>
0
)
{
{
case
'~'
:
Polyl
->
m_Unit
=
Unit
;
Polyl
->
m_Convert
=
Convert
;
break
;
Polyl
->
PolyList
=
(
int
*
)
case
'N'
:
MyZMalloc
(
sizeof
(
int
)
*
Polyl
->
n
*
2
);
Pin
->
m_Attributs
|=
PINNOTDRAW
;
break
;
p
=
strtok
(
&
Line
[
2
],
"
\t\n
"
);
case
'I'
:
p
=
strtok
(
NULL
,
"
\t\n
"
);
Pin
->
m_PinShape
|=
INVERT
;
break
;
p
=
strtok
(
NULL
,
"
\t\n
"
);
p
=
strtok
(
NULL
,
"
\t\n
"
);
case
'C'
:
Pin
->
m_PinShape
|=
CLOCK
;
break
;
for
(
i
=
0
;
i
<
Polyl
->
n
*
2
&&
!
Error
;
i
++
)
{
case
'L'
:
p
=
strtok
(
NULL
,
"
\t\n
"
);
Pin
->
m_PinShape
|=
LOWLEVEL_IN
;
break
;
Error
=
sscanf
(
p
,
"%d"
,
&
Polyl
->
PolyList
[
i
])
!=
1
;
}
case
'V'
:
Polyl
->
m_Fill
=
NO_FILL
;
Pin
->
m_PinShape
|=
LOWLEVEL_OUT
;
break
;
if
(
(
p
=
strtok
(
NULL
,
"
\t\n
"
))
!=
NULL
)
{
default
:
if
(
p
[
0
]
==
'F'
)
Polyl
->
m_Fill
=
FILLED_SHAPE
;
MsgLine
.
Printf
(
wxT
(
"Unknown Pin Shape [%c] line %d"
),
if
(
p
[
0
]
==
'f'
)
Buffer
[
jj
],
*
LineNum
);
Polyl
->
m_Fill
=
FILLED_WITH_BG_BODYCOLOR
;
DisplayError
(
frame
,
MsgLine
);
break
;
}
}
}
}
else
Error
=
TRUE
;
}
}
break
;
break
;
case
'P'
:
/* Polyline */
default
:
{
MsgLine
.
Printf
(
wxT
(
"Undefined DRAW command in line %d, aborted."
),
LibDrawPolyline
*
Polyl
=
new
LibDrawPolyline
();
*
LineNum
);
DisplayError
(
frame
,
MsgLine
);
New
=
Polyl
;
return
Head
;
}
if
(
sscanf
(
&
Line
[
2
],
"%d %d %d %d"
,
&
Polyl
->
n
,
&
Unit
,
&
Convert
,
if
(
Error
)
&
Polyl
->
m_Width
)
==
4
{
&&
Polyl
->
n
>
0
)
MsgLine
.
Printf
(
wxT
(
"Error in %c DRAW command in line %d, aborted."
),
{
Line
[
0
],
*
LineNum
);
Polyl
->
m_Unit
=
Unit
;
Polyl
->
m_Convert
=
Convert
;
DisplayError
(
frame
,
MsgLine
);
delete
New
;
Polyl
->
PolyList
=
(
int
*
)
/* FLush till end of draw: */
MyZMalloc
(
sizeof
(
int
)
*
Polyl
->
n
*
2
);
do
{
if
(
GetLine
(
f
,
Line
,
LineNum
,
1024
)
==
NULL
)
p
=
strtok
(
&
Line
[
2
],
"
\t\n
"
);
{
p
=
strtok
(
NULL
,
"
\t\n
"
);
DisplayError
(
frame
,
wxT
(
"File ended prematurely"
)
);
p
=
strtok
(
NULL
,
"
\t\n
"
);
return
Head
;
p
=
strtok
(
NULL
,
"
\t\n
"
);
}
}
while
(
strncmp
(
Line
,
"ENDDRAW"
,
7
)
!=
0
);
for
(
i
=
0
;
i
<
Polyl
->
n
*
2
&&
!
Error
;
i
++
)
return
(
Head
);
{
}
p
=
strtok
(
NULL
,
"
\t\n
"
);
Error
=
sscanf
(
p
,
"%d"
,
&
Polyl
->
PolyList
[
i
]
)
!=
1
;
else
}
{
if
(
Head
==
NULL
)
Head
=
Tail
=
New
;
Polyl
->
m_Fill
=
NO_FILL
;
else
if
(
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
!=
NULL
)
{
{
Tail
->
Pnext
=
New
;
Tail
=
New
;
if
(
p
[
0
]
==
'F'
)
}
Polyl
->
m_Fill
=
FILLED_SHAPE
;
}
if
(
p
[
0
]
==
'f'
)
}
Polyl
->
m_Fill
=
FILLED_WITH_BG_BODYCOLOR
;
}
return
Head
;
}
else
Error
=
TRUE
;
}
break
;
default
:
MsgLine
.
Printf
(
wxT
(
"Undefined DRAW command in line %d, aborted."
),
*
LineNum
);
DisplayError
(
frame
,
MsgLine
);
return
Head
;
}
if
(
Error
)
{
MsgLine
.
Printf
(
wxT
(
"Error in %c DRAW command in line %d, aborted."
),
Line
[
0
],
*
LineNum
);
DisplayError
(
frame
,
MsgLine
);
delete
New
;
/* FLush till end of draw: */
do
{
if
(
GetLine
(
f
,
Line
,
LineNum
,
1024
)
==
NULL
)
{
DisplayError
(
frame
,
wxT
(
"File ended prematurely"
)
);
return
Head
;
}
}
while
(
strncmp
(
Line
,
"ENDDRAW"
,
7
)
!=
0
);
return
Head
;
}
else
{
if
(
Head
==
NULL
)
Head
=
Tail
=
New
;
else
{
Tail
->
Pnext
=
New
;
Tail
=
New
;
}
}
}
return
Head
;
}
}
/*****************************************************************************
/*****************************************************************************
* Routine to find the library given its name. *
* Routine to find the library given its name. *
*****************************************************************************/
*****************************************************************************/
LibraryStruct
*
FindLibrary
(
const
wxString
&
Name
)
LibraryStruct
*
FindLibrary
(
const
wxString
&
Name
)
{
{
LibraryStruct
*
Lib
=
g_LibraryList
;
LibraryStruct
*
Lib
=
g_LibraryList
;
while
(
Lib
)
while
(
Lib
)
{
{
if
(
Lib
->
m_Name
==
Name
)
return
Lib
;
if
(
Lib
->
m_Name
==
Name
)
Lib
=
Lib
->
m_Pnext
;
return
Lib
;
}
Lib
=
Lib
->
m_Pnext
;
return
NULL
;
}
return
NULL
;
}
}
/*****************************************************************************
/*****************************************************************************
* Routine to find the number of libraries currently loaded. *
* Routine to find the number of libraries currently loaded. *
*****************************************************************************/
*****************************************************************************/
int
NumOfLibraries
(
void
)
int
NumOfLibraries
(
void
)
{
{
int
ii
;
int
ii
;
LibraryStruct
*
Lib
=
g_LibraryList
;
LibraryStruct
*
Lib
=
g_LibraryList
;
for
(
ii
=
0
;
Lib
!=
NULL
;
Lib
=
Lib
->
m_Pnext
)
ii
++
;
for
(
ii
=
0
;
Lib
!=
NULL
;
Lib
=
Lib
->
m_Pnext
)
ii
++
;
return
ii
;
return
ii
;
}
}
/*****************************************************************************/
/*****************************************************************************/
static
bool
GetLibEntryField
(
EDA_LibComponentStruct
*
LibEntry
,
char
*
line
)
static
bool
GetLibEntryField
(
EDA_LibComponentStruct
*
LibEntry
,
char
*
line
)
/*****************************************************************************/
/*****************************************************************************/
/* Analyse la ligne de description du champ de la forme:
/* Analyse la ligne de description du champ de la forme:
Fn "CA3130" 150 -200 50 H V
*
Fn "CA3130" 150 -200 50 H V
ou n = 0 (REFERENCE), 1 (VALUE) , 2 .. 11 = autres champs, facultatifs
*
ou n = 0 (REFERENCE), 1 (VALUE) , 2 .. 11 = autres champs, facultatifs
*/
*/
{
{
int
posx
,
posy
,
size
,
orient
,
hjustify
,
vjustify
;
int
posx
,
posy
,
size
,
orient
,
hjustify
,
vjustify
;
bool
draw
;
bool
draw
;
char
*
Text
,
char
*
Text
,
Char1
[
256
],
Char2
[
256
],
Char1
[
256
],
Char2
[
256
],
Char3
[
256
],
Char4
[
256
],
Char3
[
256
],
Char4
[
256
],
FieldUserName
[
1024
];
FieldUserName
[
1024
];
int
NumOfField
,
nbparam
;
int
NumOfField
,
nbparam
;
LibDrawField
*
Field
=
NULL
;
LibDrawField
*
Field
=
NULL
;
if
(
sscanf
(
line
+
1
,
"%d"
,
&
NumOfField
)
!=
1
)
return
(
0
);
if
(
sscanf
(
line
+
1
,
"%d"
,
&
NumOfField
)
!=
1
)
return
0
;
/* Recherche du debut des donnees (debut du texte suivant) */
while
(
*
line
!=
0
)
line
++
;
/* Recherche du debut des donnees (debut du texte suivant) */
while
(
*
line
==
0
)
line
++
;
while
(
*
line
!=
0
)
line
++
;
/* recherche du texte */
while
(
*
line
&&
(
*
line
!=
'"'
)
)
line
++
;
while
(
*
line
==
0
)
if
(
*
line
==
0
)
return
(
0
);
line
++
;
line
++
;
Text
=
line
;
/* recherche du texte */
/* recherche fin de texte */
while
(
*
line
&&
(
*
line
!=
'"'
)
)
while
(
*
line
&&
(
*
line
!=
'"'
)
)
line
++
;
line
++
;
if
(
*
line
==
0
)
return
(
0
);
*
line
=
0
;
line
++
;
if
(
*
line
==
0
)
return
0
;
FieldUserName
[
0
]
=
0
;
line
++
;
Text
=
line
;
nbparam
=
sscanf
(
line
,
" %d %d %d %c %c %c %c"
,
&
posx
,
&
posy
,
&
size
,
Char1
,
Char2
,
Char3
,
Char4
);
/* recherche fin de texte */
orient
=
TEXT_ORIENT_HORIZ
;
if
(
Char1
[
0
]
==
'V'
)
orient
=
TEXT_ORIENT_VERT
;
while
(
*
line
&&
(
*
line
!=
'"'
)
)
draw
=
TRUE
;
if
(
Char2
[
0
]
==
'I'
)
draw
=
FALSE
;
line
++
;
hjustify
=
GR_TEXT_HJUSTIFY_CENTER
;
vjustify
=
GR_TEXT_VJUSTIFY_CENTER
;
if
(
*
line
==
0
)
if
(
nbparam
>=
6
)
return
0
;
{
*
line
=
0
;
line
++
;
if
(
*
Char3
==
'L'
)
hjustify
=
GR_TEXT_HJUSTIFY_LEFT
;
else
if
(
*
Char3
==
'R'
)
hjustify
=
GR_TEXT_HJUSTIFY_RIGHT
;
FieldUserName
[
0
]
=
0
;
if
(
*
Char4
==
'B'
)
vjustify
=
GR_TEXT_VJUSTIFY_BOTTOM
;
nbparam
=
sscanf
(
line
,
" %d %d %d %c %c %c %c"
,
else
if
(
*
Char4
==
'T'
)
vjustify
=
GR_TEXT_VJUSTIFY_TOP
;
&
posx
,
&
posy
,
&
size
,
Char1
,
Char2
,
Char3
,
Char4
);
}
orient
=
TEXT_ORIENT_HORIZ
;
if
(
Char1
[
0
]
==
'V'
)
switch
(
NumOfField
)
orient
=
TEXT_ORIENT_VERT
;
{
draw
=
TRUE
;
if
(
Char2
[
0
]
==
'I'
)
case
REFERENCE
:
draw
=
FALSE
;
Field
=
&
LibEntry
->
m_Prefix
;
hjustify
=
GR_TEXT_HJUSTIFY_CENTER
;
Field
->
m_FieldId
=
REFERENCE
;
vjustify
=
GR_TEXT_VJUSTIFY_CENTER
;
break
;
if
(
nbparam
>=
6
)
{
case
VALUE
:
if
(
*
Char3
==
'L'
)
Field
=
&
LibEntry
->
m_Name
;
hjustify
=
GR_TEXT_HJUSTIFY_LEFT
;
Field
->
m_FieldId
=
VALUE
;
else
if
(
*
Char3
==
'R'
)
break
;
hjustify
=
GR_TEXT_HJUSTIFY_RIGHT
;
if
(
*
Char4
==
'B'
)
default
:
vjustify
=
GR_TEXT_VJUSTIFY_BOTTOM
;
if
(
NumOfField
>=
NUMBER_OF_FIELDS
)
break
;
else
if
(
*
Char4
==
'T'
)
Field
=
new
LibDrawField
(
NumOfField
);
vjustify
=
GR_TEXT_VJUSTIFY_TOP
;
Field
->
Pnext
=
LibEntry
->
Fields
;
}
LibEntry
->
Fields
=
Field
;
break
;
switch
(
NumOfField
)
}
{
case
REFERENCE
:
if
(
Field
==
NULL
)
return
FALSE
;
Field
=
&
LibEntry
->
m_Prefix
;
Field
->
m_FieldId
=
REFERENCE
;
Field
->
m_Pos
.
x
=
posx
;
Field
->
m_Pos
.
y
=
posy
;
break
;
Field
->
m_Orient
=
orient
;
if
(
draw
==
FALSE
)
Field
->
m_Attributs
|=
TEXT_NO_VISIBLE
;
case
VALUE
:
Field
->
m_Size
.
x
=
Field
->
m_Size
.
y
=
size
;
Field
=
&
LibEntry
->
m_Name
;
Field
->
m_Text
=
CONV_FROM_UTF8
(
Text
);
Field
->
m_FieldId
=
VALUE
;
if
(
NumOfField
>=
FIELD1
)
break
;
{
ReadDelimitedText
(
FieldUserName
,
line
,
sizeof
(
FieldUserName
)
);
default
:
Field
->
m_Name
=
CONV_FROM_UTF8
(
FieldUserName
);
if
(
NumOfField
>=
NUMBER_OF_FIELDS
)
}
break
;
Field
->
m_HJustify
=
hjustify
;
Field
=
new
LibDrawField
(
NumOfField
);
Field
->
m_VJustify
=
vjustify
;
return
(
TRUE
);
Field
->
Pnext
=
LibEntry
->
Fields
;
LibEntry
->
Fields
=
Field
;
break
;
}
if
(
Field
==
NULL
)
return
FALSE
;
Field
->
m_Pos
.
x
=
posx
;
Field
->
m_Pos
.
y
=
posy
;
Field
->
m_Orient
=
orient
;
if
(
draw
==
FALSE
)
Field
->
m_Attributs
|=
TEXT_NO_VISIBLE
;
Field
->
m_Size
.
x
=
Field
->
m_Size
.
y
=
size
;
Field
->
m_Text
=
CONV_FROM_UTF8
(
Text
);
if
(
NumOfField
>=
FIELD1
)
{
ReadDelimitedText
(
FieldUserName
,
line
,
sizeof
(
FieldUserName
)
);
Field
->
m_Name
=
CONV_FROM_UTF8
(
FieldUserName
);
}
Field
->
m_HJustify
=
hjustify
;
Field
->
m_VJustify
=
vjustify
;
return
TRUE
;
}
}
/********************************************************************/
/********************************************************************/
static
bool
AddAliasNames
(
EDA_LibComponentStruct
*
LibEntry
,
char
*
line
)
static
bool
AddAliasNames
(
EDA_LibComponentStruct
*
LibEntry
,
char
*
line
)
/********************************************************************/
/********************************************************************/
/* Read the alias names (in buffer line) and add them in alias list
/* Read the alias names (in buffer line) and add them in alias list
names are separated by spaces
*
names are separated by spaces
*/
*/
{
{
char
*
text
;
char
*
text
;
wxString
name
;
wxString
name
;
text
=
strtok
(
line
,
"
\t\r\n
"
);
text
=
strtok
(
line
,
"
\t\r\n
"
);
while
(
text
)
{
while
(
text
)
name
=
CONV_FROM_UTF8
(
text
);
{
LibEntry
->
m_AliasList
.
Add
(
name
);
name
=
CONV_FROM_UTF8
(
text
);
text
=
strtok
(
NULL
,
"
\t\r\n
"
);
LibEntry
->
m_AliasList
.
Add
(
name
);
}
text
=
strtok
(
NULL
,
"
\t\r\n
"
);
return
(
TRUE
);
}
return
TRUE
;
}
}
/********************************************************************/
/********************************************************************/
static
void
InsertAlias
(
PriorQue
**
PQ
,
EDA_LibComponentStruct
*
LibEntry
,
static
void
InsertAlias
(
PriorQue
**
PQ
,
EDA_LibComponentStruct
*
LibEntry
,
int
*
NumOfParts
)
int
*
NumOfParts
)
/********************************************************************/
/********************************************************************/
/* create in library (in list PQ) aliases of the "root" component LibEntry*/
/* create in library (in list PQ) aliases of the "root" component LibEntry*/
{
{
EDA_LibCmpAliasStruct
*
AliasEntry
;
EDA_LibCmpAliasStruct
*
AliasEntry
;
unsigned
ii
;
unsigned
ii
;
if
(
LibEntry
->
m_AliasList
.
GetCount
()
==
0
)
if
(
LibEntry
->
m_AliasList
.
GetCount
()
==
0
)
return
;
/* No alias for this component */
return
;
/* No alias for this component */
for
(
ii
=
0
;
ii
<
LibEntry
->
m_AliasList
.
GetCount
();
ii
++
)
for
(
ii
=
0
;
ii
<
LibEntry
->
m_AliasList
.
GetCount
();
ii
++
)
{
{
AliasEntry
=
new
EDA_LibCmpAliasStruct
(
LibEntry
->
m_AliasList
[
ii
],
AliasEntry
=
new
EDA_LibCmpAliasStruct
(
LibEntry
->
m_AliasList
[
ii
],
LibEntry
->
m_Name
.
m_Text
.
GetData
());
LibEntry
->
m_Name
.
m_Text
.
GetData
()
);
++*
NumOfParts
;
PQInsert
(
PQ
,
AliasEntry
);
++
*
NumOfParts
;
}
PQInsert
(
PQ
,
AliasEntry
);
}
}
}
/*******************************************************/
/* Routines de lecture des Documentation de composants */
/*******************************************************/
/*******************************************************/
/* Routines de lecture des Documentation de composants */
/*******************************************************/
/**********************************************************************************************/
/**********************************************************************************************/
int
LoadDocLib
(
WinEDA_DrawFrame
*
frame
,
const
wxString
&
FullDocLibName
,
const
wxString
&
Libname
)
int
LoadDocLib
(
WinEDA_DrawFrame
*
frame
,
const
wxString
&
FullDocLibName
,
const
wxString
&
Libname
)
/**********************************************************************************************/
/**********************************************************************************************/
/* Routine to load a library from given open file.*/
/* Routine to load a library from given open file.*/
{
{
int
LineNum
=
0
;
int
LineNum
=
0
;
char
Line
[
1024
],
*
Name
,
*
Text
;
char
Line
[
1024
],
*
Name
,
*
Text
;
EDA_LibComponentStruct
*
Entry
;
EDA_LibComponentStruct
*
Entry
;
FILE
*
f
;
FILE
*
f
;
wxString
msg
;
wxString
msg
;
f
=
wxFopen
(
FullDocLibName
,
wxT
(
"rt"
)
);
f
=
wxFopen
(
FullDocLibName
,
wxT
(
"rt"
)
);
if
(
f
==
NULL
)
return
(
0
);
if
(
f
==
NULL
)
return
0
;
if
(
GetLine
(
f
,
Line
,
&
LineNum
,
sizeof
(
Line
)
)
==
NULL
)
{
/* pas de lignes utiles */
if
(
GetLine
(
f
,
Line
,
&
LineNum
,
sizeof
(
Line
)
)
==
NULL
)
fclose
(
f
);
{
/* pas de lignes utiles */
return
0
;
fclose
(
f
);
}
return
0
;
}
if
(
strnicmp
(
Line
,
DOCFILE_IDENT
,
10
)
!=
0
)
{
if
(
strnicmp
(
Line
,
DOCFILE_IDENT
,
10
)
!=
0
)
DisplayError
(
frame
,
wxT
(
"File is NOT EESCHEMA doclib!"
)
);
{
fclose
(
f
);
DisplayError
(
frame
,
wxT
(
"File is NOT EESCHEMA doclib!"
)
);
return
0
;
fclose
(
f
);
}
return
0
;
}
while
(
GetLine
(
f
,
Line
,
&
LineNum
,
sizeof
(
Line
))
)
{
while
(
GetLine
(
f
,
Line
,
&
LineNum
,
sizeof
(
Line
)
)
)
if
(
strncmp
(
Line
,
"$CMP"
,
4
)
!=
0
)
{
{
if
(
strncmp
(
Line
,
"$CMP"
,
4
)
!=
0
)
msg
.
Printf
(
wxT
(
"$CMP command expected in line %d, aborted."
),
LineNum
);
{
DisplayError
(
frame
,
msg
);
msg
.
Printf
(
wxT
(
"$CMP command expected in line %d, aborted."
),
LineNum
);
fclose
(
f
);
DisplayError
(
frame
,
msg
);
return
0
;
fclose
(
f
);
}
return
0
;
}
/* Read one $CMP/$ENDCMP part entry from library: */
Name
=
strtok
(
Line
+
5
,
"
\n\r
"
);
/* Read one $CMP/$ENDCMP part entry from library: */
wxString
cmpname
;
cmpname
=
CONV_FROM_UTF8
(
Name
);
Name
=
strtok
(
Line
+
5
,
"
\n\r
"
);
Entry
=
FindLibPart
(
cmpname
.
GetData
(),
Libname
,
FIND_ALIAS
);
wxString
cmpname
;
cmpname
=
CONV_FROM_UTF8
(
Name
);
while
(
GetLine
(
f
,
Line
,
&
LineNum
,
sizeof
(
Line
))
)
Entry
=
FindLibPart
(
cmpname
.
GetData
(),
Libname
,
FIND_ALIAS
);
{
while
(
GetLine
(
f
,
Line
,
&
LineNum
,
sizeof
(
Line
)
)
)
if
(
strncmp
(
Line
,
"$ENDCMP"
,
7
)
==
0
)
break
;
{
Text
=
strtok
(
Line
+
2
,
"
\n\r
"
);
if
(
strncmp
(
Line
,
"$ENDCMP"
,
7
)
==
0
)
switch
(
Line
[
0
]
)
break
;
{
Text
=
strtok
(
Line
+
2
,
"
\n\r
"
);
case
'D'
:
if
(
Entry
)
Entry
->
m_Doc
=
CONV_FROM_UTF8
(
Text
);
switch
(
Line
[
0
]
)
break
;
{
case
'D'
:
case
'K'
:
if
(
Entry
)
if
(
Entry
)
Entry
->
m_KeyWord
=
CONV_FROM_UTF8
(
Text
);
Entry
->
m_Doc
=
CONV_FROM_UTF8
(
Text
);
break
;
break
;
case
'F'
:
case
'K'
:
if
(
Entry
)
Entry
->
m_DocFile
=
CONV_FROM_UTF8
(
Text
);
if
(
Entry
)
break
;
Entry
->
m_KeyWord
=
CONV_FROM_UTF8
(
Text
);
}
break
;
}
}
case
'F'
:
fclose
(
f
);
if
(
Entry
)
return
1
;
Entry
->
m_DocFile
=
CONV_FROM_UTF8
(
Text
);
break
;
}
}
}
fclose
(
f
);
return
1
;
}
}
/*********************************************************************************/
/*********************************************************************************/
static
bool
ReadLibEntryDateAndTime
(
EDA_LibComponentStruct
*
LibEntry
,
char
*
Line
)
static
bool
ReadLibEntryDateAndTime
(
EDA_LibComponentStruct
*
LibEntry
,
char
*
Line
)
/*********************************************************************************/
/*********************************************************************************/
/* lit date et time de modif composant sous le format:
/* lit date et time de modif composant sous le format:
"Ti yy/mm/jj hh:mm:ss"
*
"Ti yy/mm/jj hh:mm:ss"
*/
*/
{
{
int
year
,
mon
,
day
,
hour
,
min
,
sec
;
int
year
,
mon
,
day
,
hour
,
min
,
sec
;
char
*
text
;
char
*
text
;
year
=
mon
=
day
=
hour
=
min
=
sec
=
0
;
year
=
mon
=
day
=
hour
=
min
=
sec
=
0
;
text
=
strtok
(
Line
,
"
\r\t\n
"
);
text
=
strtok
(
Line
,
"
\r\t\n
"
);
text
=
strtok
(
NULL
,
"
\r\t\n
"
);
// text pointe donnees utiles
text
=
strtok
(
NULL
,
"
\r\t\n
"
);
// text pointe donnees utiles
sscanf
(
Line
,
"%d/%d/%d %d:%d:%d"
,
&
year
,
&
mon
,
&
day
,
&
hour
,
&
min
,
&
sec
);
sscanf
(
Line
,
"%d/%d/%d %d:%d:%d"
,
&
year
,
&
mon
,
&
day
,
&
hour
,
&
min
,
&
sec
);
LibEntry
->
m_LastDate
=
(
sec
&
63
)
LibEntry
->
m_LastDate
=
(
sec
&
63
)
+
((
min
&
63
)
<<
6
)
+
(
(
min
&
63
)
<<
6
)
+
((
hour
&
31
)
<<
12
)
+
(
(
hour
&
31
)
<<
12
)
+
((
day
&
31
)
<<
17
)
+
(
(
day
&
31
)
<<
17
)
+
((
mon
&
15
)
<<
22
)
+
(
(
mon
&
15
)
<<
22
)
+
((
year
-
1990
)
<<
26
);
+
(
(
year
-
1990
)
<<
26
);
return
TRUE
;
return
TRUE
;
}
}
/*******************************************/
/*******************************************/
static
int
SortItemsFct
(
const
void
*
ref
,
const
void
*
item
);
static
int
SortItemsFct
(
const
void
*
ref
,
const
void
*
item
);
void
EDA_LibComponentStruct
::
SortDrawItems
(
void
)
void
EDA_LibComponentStruct
::
SortDrawItems
(
void
)
/*******************************************/
/*******************************************/
/* Trie les lments graphiques d'un composant lib pour amliorer
/* Trie les lments graphiques d'un composant lib pour amliorer
le trac:
*
le trac:
items remplis en premier, pins en dernier
*
items remplis en premier, pins en dernier
En cas de superposition d'items, c'est plus lisible
*
En cas de superposition d'items, c'est plus lisible
*/
*/
{
{
LibEDA_BaseStruct
**
Bufentry
,
**
BufentryBase
,
*
Entry
=
m_Drawings
;
LibEDA_BaseStruct
**
Bufentry
,
**
BufentryBase
,
*
Entry
=
m_Drawings
;
int
ii
,
nbitems
;
int
ii
,
nbitems
;
if
(
Entry
==
NULL
)
return
;
/* Pas d'alias pour ce composant */
if
(
Entry
==
NULL
)
/* calcul du nombre d'items */
return
;
/* Pas d'alias pour ce composant */
for
(
nbitems
=
0
;
Entry
!=
NULL
;
Entry
=
Entry
->
Next
())
nbitems
++
;
/* calcul du nombre d'items */
for
(
nbitems
=
0
;
Entry
!=
NULL
;
Entry
=
Entry
->
Next
()
)
BufentryBase
=
nbitems
++
;
(
LibEDA_BaseStruct
**
)
MyZMalloc
(
(
nbitems
+
1
)
*
sizeof
(
LibEDA_BaseStruct
*
));
/* memorisation du chainage : */
BufentryBase
=
for
(
Entry
=
m_Drawings
,
ii
=
0
;
Entry
!=
NULL
;
Entry
=
Entry
->
Next
())
(
LibEDA_BaseStruct
**
)
MyZMalloc
(
(
nbitems
+
1
)
*
sizeof
(
LibEDA_BaseStruct
*
)
);
BufentryBase
[
ii
++
]
=
Entry
;
/* memorisation du chainage : */
for
(
Entry
=
m_Drawings
,
ii
=
0
;
Entry
!=
NULL
;
Entry
=
Entry
->
Next
()
)
/* Tri du chainage */
BufentryBase
[
ii
++
]
=
Entry
;
qsort
(
BufentryBase
,
nbitems
,
sizeof
(
LibEDA_BaseStruct
*
),
SortItemsFct
);
/* Tri du chainage */
/* Mise a jour du chainage. Remarque:
qsort
(
BufentryBase
,
nbitems
,
sizeof
(
LibEDA_BaseStruct
*
),
SortItemsFct
);
le dernier element de BufEntryBase (BufEntryBase[nbitems]) est NULL*/
m_Drawings
=
*
BufentryBase
;
/* Mise a jour du chainage. Remarque:
Bufentry
=
BufentryBase
;
* le dernier element de BufEntryBase (BufEntryBase[nbitems]) est NULL*/
for
(
ii
=
0
;
ii
<
nbitems
;
ii
++
)
m_Drawings
=
*
BufentryBase
;
{
Bufentry
=
BufentryBase
;
(
*
Bufentry
)
->
Pnext
=
*
(
Bufentry
+
1
);
for
(
ii
=
0
;
ii
<
nbitems
;
ii
++
)
Bufentry
++
;
{
}
(
*
Bufentry
)
->
Pnext
=
*
(
Bufentry
+
1
);
Bufentry
++
;
MyFree
(
BufentryBase
);
}
MyFree
(
BufentryBase
);
}
}
int
SortItemsFct
(
const
void
*
ref
,
const
void
*
item
)
int
SortItemsFct
(
const
void
*
ref
,
const
void
*
item
)
{
{
#define Ref
(*(LibEDA_BaseStruct **)(ref)
)
#define Ref
( *(LibEDA_BaseStruct**) (ref)
)
#define Item
(*(LibEDA_BaseStruct **)(item)
)
#define Item
( *(LibEDA_BaseStruct**) (item)
)
#define BEFORE -1
#define BEFORE -1
#define AFTER 1
#define AFTER 1
int
fill_ref
=
0
,
fill_item
=
0
;
int
fill_ref
=
0
,
fill_item
=
0
;
switch
(
Ref
->
m_StructType
)
switch
(
Ref
->
m_StructType
)
{
{
case
COMPONENT_ARC_DRAW_TYPE
:
case
COMPONENT_ARC_DRAW_TYPE
:
{
{
const
LibDrawArc
*
draw
=
(
const
LibDrawArc
*
)
Ref
;
const
LibDrawArc
*
draw
=
(
const
LibDrawArc
*
)
Ref
;
fill_ref
=
draw
->
m_Fill
;
fill_ref
=
draw
->
m_Fill
;
break
;
break
;
}
}
case
COMPONENT_CIRCLE_DRAW_TYPE
:
case
COMPONENT_CIRCLE_DRAW_TYPE
:
{
{
const
LibDrawCircle
*
draw
=
(
const
LibDrawCircle
*
)
Ref
;
const
LibDrawCircle
*
draw
=
(
const
LibDrawCircle
*
)
Ref
;
fill_ref
=
draw
->
m_Fill
;
fill_ref
=
draw
->
m_Fill
;
break
;
break
;
}
}
case
COMPONENT_RECT_DRAW_TYPE
:
case
COMPONENT_RECT_DRAW_TYPE
:
{
{
const
LibDrawSquare
*
draw
=
(
const
LibDrawSquare
*
)
Ref
;
const
LibDrawSquare
*
draw
=
(
const
LibDrawSquare
*
)
Ref
;
fill_ref
=
draw
->
m_Fill
;
fill_ref
=
draw
->
m_Fill
;
break
;
break
;
}
}
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
{
{
const
LibDrawPolyline
*
draw
=
(
const
LibDrawPolyline
*
)
Ref
;
const
LibDrawPolyline
*
draw
=
(
const
LibDrawPolyline
*
)
Ref
;
fill_ref
=
draw
->
m_Fill
;
fill_ref
=
draw
->
m_Fill
;
break
;
break
;
}
}
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
if
(
Item
->
m_StructType
==
COMPONENT_PIN_DRAW_TYPE
)
return
BEFORE
;
if
(
Item
->
m_StructType
==
COMPONENT_PIN_DRAW_TYPE
)
if
(
Item
->
m_StructType
==
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
)
return
0
;
return
BEFORE
;
return
1
;
if
(
Item
->
m_StructType
==
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
)
break
;
return
0
;
return
1
;
case
COMPONENT_PIN_DRAW_TYPE
:
break
;
if
(
Item
->
m_StructType
==
COMPONENT_PIN_DRAW_TYPE
)
{
case
COMPONENT_PIN_DRAW_TYPE
:
int
ii
;
if
(
Item
->
m_StructType
==
COMPONENT_PIN_DRAW_TYPE
)
// We sort the pins by orientation
{
ii
=
((
LibDrawPin
*
)
Ref
)
->
m_Orient
-
((
LibDrawPin
*
)
Item
)
->
m_Orient
;
int
ii
;
if
(
ii
)
return
ii
;
// We sort the pins by orientation
/* We sort the pins by position (x or y).
ii
=
(
(
LibDrawPin
*
)
Ref
)
->
m_Orient
-
(
(
LibDrawPin
*
)
Item
)
->
m_Orient
;
note: at this point, most of pins have same x pos or y pos,
if
(
ii
)
because they are sorted by orientation and generally are vertically or
return
ii
;
horizontally aligned */
wxPoint
pos_ref
,
pos_tst
;
/* We sort the pins by position (x or y).
pos_ref
=
((
LibDrawPin
*
)
Ref
)
->
m_Pos
;
* note: at this point, most of pins have same x pos or y pos,
pos_tst
=
((
LibDrawPin
*
)
Item
)
->
m_Pos
;
* because they are sorted by orientation and generally are vertically or
if
(
(
ii
=
pos_ref
.
x
-
pos_tst
.
x
)
)
return
ii
;
* horizontally aligned */
ii
=
pos_ref
.
y
-
pos_tst
.
y
;
wxPoint
pos_ref
,
pos_tst
;
return
ii
;
pos_ref
=
(
(
LibDrawPin
*
)
Ref
)
->
m_Pos
;
}
pos_tst
=
(
(
LibDrawPin
*
)
Item
)
->
m_Pos
;
else
return
AFTER
;
if
(
(
ii
=
pos_ref
.
x
-
pos_tst
.
x
)
)
break
;
return
ii
;
}
ii
=
pos_ref
.
y
-
pos_tst
.
y
;
return
ii
;
/* Test de l'item */
}
switch
(
Item
->
m_StructType
)
else
{
return
AFTER
;
case
COMPONENT_ARC_DRAW_TYPE
:
break
;
{
const
LibDrawArc
*
draw
=
(
const
LibDrawArc
*
)
Item
;
default
:
fill_item
=
draw
->
m_Fill
;
;
break
;
}
}
/* Test de l'item */
case
COMPONENT_CIRCLE_DRAW_TYPE
:
switch
(
Item
->
m_StructType
)
{
{
const
LibDrawCircle
*
draw
=
(
const
LibDrawCircle
*
)
Item
;
case
COMPONENT_ARC_DRAW_TYPE
:
fill_item
=
draw
->
m_Fill
;
{
break
;
const
LibDrawArc
*
draw
=
(
const
LibDrawArc
*
)
Item
;
}
fill_item
=
draw
->
m_Fill
;
break
;
case
COMPONENT_RECT_DRAW_TYPE
:
}
{
const
LibDrawSquare
*
draw
=
(
const
LibDrawSquare
*
)
Item
;
case
COMPONENT_CIRCLE_DRAW_TYPE
:
fill_item
=
draw
->
m_Fill
;
{
break
;
const
LibDrawCircle
*
draw
=
(
const
LibDrawCircle
*
)
Item
;
}
fill_item
=
draw
->
m_Fill
;
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
}
{
const
LibDrawPolyline
*
draw
=
(
const
LibDrawPolyline
*
)
Item
;
case
COMPONENT_RECT_DRAW_TYPE
:
fill_item
=
draw
->
m_Fill
;
{
break
;
const
LibDrawSquare
*
draw
=
(
const
LibDrawSquare
*
)
Item
;
}
fill_item
=
draw
->
m_Fill
;
break
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
}
return
BEFORE
;
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
{
case
COMPONENT_PIN_DRAW_TYPE
:
const
LibDrawPolyline
*
draw
=
(
const
LibDrawPolyline
*
)
Item
;
return
BEFORE
;
fill_item
=
draw
->
m_Fill
;
break
;
break
;
}
}
if
(
fill_ref
&
fill_item
)
return
0
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
if
(
fill_ref
)
return
BEFORE
;
return
BEFORE
;
return
AFTER
;
break
;
case
COMPONENT_PIN_DRAW_TYPE
:
return
BEFORE
;
break
;
default
:
;
}
if
(
fill_ref
&
fill_item
)
return
0
;
if
(
fill_ref
)
return
BEFORE
;
return
AFTER
;
}
}
/*****************************************************************************/
/*****************************************************************************/
int
AddFootprintFilterList
(
EDA_LibComponentStruct
*
LibEntryLibEntry
,
FILE
*
f
,
int
AddFootprintFilterList
(
EDA_LibComponentStruct
*
LibEntryLibEntry
,
FILE
*
f
,
char
*
Line
,
int
*
LineNum
)
char
*
Line
,
int
*
LineNum
)
/******************************************************************************/
/******************************************************************************/
/* read the FootprintFilter List stating with:
/* read the FootprintFilter List stating with:
FPLIST
*
FPLIST
and ending with:
*
and ending with:
ENDFPLIST
*
ENDFPLIST
*/
*/
{
{
for
(
;
;
)
for
(
;
;
)
{
{
if
(
GetLine
(
f
,
Line
,
LineNum
,
1024
)
==
NULL
)
if
(
GetLine
(
f
,
Line
,
LineNum
,
1024
)
==
NULL
)
{
{
DisplayError
(
NULL
,
wxT
(
"File ended prematurely"
)
);
DisplayError
(
NULL
,
wxT
(
"File ended prematurely"
)
);
return
0
;
return
0
;
}
}
if
(
stricmp
(
Line
,
"$ENDFPLIST"
)
==
0
)
if
(
stricmp
(
Line
,
"$ENDFPLIST"
)
==
0
)
{
{
break
;
/*normal exit on end of list */
break
;
/*normal exit on end of list */
}
}
LibEntryLibEntry
->
m_FootprintList
.
Add
(
CONV_FROM_UTF8
(
Line
+
1
)
);
LibEntryLibEntry
->
m_FootprintList
.
Add
(
CONV_FROM_UTF8
(
Line
+
1
)
);
}
}
return
1
;
return
1
;
}
}
eeschema/hotkeys.cpp
View file @
f3c324d5
...
@@ -212,6 +212,8 @@ wxPoint MousePos = m_CurrentScreen->m_MousePosition;
...
@@ -212,6 +212,8 @@ wxPoint MousePos = m_CurrentScreen->m_MousePosition;
}
}
ChangeTextOrient
(
(
DrawTextStruct
*
)
DrawStruct
,
DC
);
ChangeTextOrient
(
(
DrawTextStruct
*
)
DrawStruct
,
DC
);
break
;
break
;
default
:
;
}
}
break
;
break
;
...
...
eeschema/libclass.cpp
View file @
f3c324d5
...
@@ -13,695 +13,780 @@
...
@@ -13,695 +13,780 @@
#include "protos.h"
#include "protos.h"
/*******************************************************/
/*******************************************************/
/* Methodes relatives a la manipulation des librairies */
/* Methodes relatives a la manipulation des librairies */
/*******************************************************/
/*******************************************************/
/***************************************************************************************/
/***************************************************************************************/
LibraryStruct
::
LibraryStruct
(
int
type
,
const
wxString
&
name
,
const
wxString
&
fullname
)
LibraryStruct
::
LibraryStruct
(
int
type
,
const
wxString
&
name
,
const
wxString
&
fullname
)
/***************************************************************************************/
/***************************************************************************************/
{
{
m_Type
=
type
;
/* type indicator */
m_Type
=
type
;
/* type indicator */
m_Name
=
name
;
/* Name of library loaded. */
m_Name
=
name
;
/* Name of library loaded. */
m_FullFileName
=
fullname
;
/* Full File Name (with path) of library loaded. */
m_FullFileName
=
fullname
;
/* Full File Name (with path) of library loaded. */
m_NumOfParts
=
0
;
/* Number of parts this library has. */
m_NumOfParts
=
0
;
/* Number of parts this library has. */
m_Entries
=
NULL
;
/* Parts themselves are saved here. */
m_Entries
=
NULL
;
/* Parts themselves are saved here. */
m_Pnext
=
NULL
;
/* Point on next lib in chain. */
m_Pnext
=
NULL
;
/* Point on next lib in chain. */
m_Modified
=
FALSE
;
/* flag indicateur d'edition */
m_Modified
=
FALSE
;
/* flag indicateur d'edition */
m_TimeStamp
=
0
;
m_TimeStamp
=
0
;
m_Flags
=
0
;
m_Flags
=
0
;
m_IsLibCache
=
FALSE
;
m_IsLibCache
=
FALSE
;
}
}
/*****************************************/
/*****************************************/
void
FreeLibraryEntry
(
LibCmpEntry
*
Entry
)
void
FreeLibraryEntry
(
LibCmpEntry
*
Entry
)
/*****************************************/
/*****************************************/
/* Used by PQFreeFunc() to delete all entries
/* Used by PQFreeFunc() to delete all entries
*/
*/
{
{
delete
Entry
;
delete
Entry
;
}
}
/******************************/
/******************************/
LibraryStruct
::~
LibraryStruct
()
LibraryStruct
::~
LibraryStruct
()
/******************************/
/******************************/
{
{
if
(
m_Entries
)
PQFreeFunc
(
m_Entries
,
(
void
(
*
)(
void
*
))
FreeLibraryEntry
);
if
(
m_Entries
)
PQFreeFunc
(
m_Entries
,
(
void
(
*
)
(
void
*
)
)
FreeLibraryEntry
);
}
}
/*******************************************/
/*******************************************/
bool
LibraryStruct
::
WriteHeader
(
FILE
*
file
)
bool
LibraryStruct
::
WriteHeader
(
FILE
*
file
)
/*******************************************/
/*******************************************/
/* Ecrit l'entete du fichier librairie
/* Ecrit l'entete du fichier librairie
*/
*/
{
{
char
BufLine
[
1024
];
char
BufLine
[
1024
];
bool
succes
=
TRUE
;
bool
succes
=
TRUE
;
DateAndTime
(
BufLine
);
DateAndTime
(
BufLine
);
if
(
fprintf
(
file
,
"%s %d.%d Date: %s
\n
"
,
LIBFILE_IDENT
,
if
(
fprintf
(
file
,
"%s %d.%d Date: %s
\n
"
,
LIBFILE_IDENT
,
LIB_VERSION_MAJOR
,
LIB_VERSION_MINOR
,
LIB_VERSION_MAJOR
,
LIB_VERSION_MINOR
,
BufLine
)
!=
5
)
BufLine
)
!=
5
)
succes
=
FALSE
;
succes
=
FALSE
;
#if 0
#if 0
if ( fprintf(file,"$HEADER\n") != 1 ) succes = FALSE;
if( fprintf( file, "$HEADER\n" ) != 1 )
if ( fprintf(file,"TimeStamp %8.8lX\n", m_TimeStamp) != 2 ) succes = FALSE;
succes = FALSE;
if ( fprintf(file,"Parts %d\n", m_NumOfParts) != 2 ) succes = FALSE;
if( fprintf( file, "TimeStamp %8.8lX\n", m_TimeStamp ) != 2 )
if ( fprintf(file,"$ENDHEADER\n") != 1 ) succes = FALSE;
succes = FALSE;
if( fprintf( file, "Parts %d\n", m_NumOfParts ) != 2 )
succes = FALSE;
if( fprintf( file, "$ENDHEADER\n" ) != 1 )
succes = FALSE;
#endif
#endif
return
(
succes
)
;
return
succes
;
}
}
/***********************************************************/
/***********************************************************/
bool
LibraryStruct
::
ReadHeader
(
FILE
*
libfile
,
int
*
LineNum
)
bool
LibraryStruct
::
ReadHeader
(
FILE
*
libfile
,
int
*
LineNum
)
/***********************************************************/
/***********************************************************/
/* Ecrit l'entete du fichier librairie
/* Ecrit l'entete du fichier librairie
*/
*/
{
{
char
Line
[
1024
],
*
text
,
*
data
;
char
Line
[
1024
],
*
text
,
*
data
;
while
(
GetLine
(
libfile
,
Line
,
LineNum
,
sizeof
(
Line
)
)
)
{
text
=
strtok
(
Line
,
"
\t\r\n
"
);
data
=
strtok
(
NULL
,
"
\t\r\n
"
);
if
(
stricmp
(
text
,
"TimeStamp"
)
==
0
)
m_TimeStamp
=
atol
(
data
);
if
(
stricmp
(
text
,
"$ENDHEADER"
)
==
0
)
return
TRUE
;
}
while
(
GetLine
(
libfile
,
Line
,
LineNum
,
sizeof
(
Line
))
)
return
FALSE
;
{
text
=
strtok
(
Line
,
"
\t\r\n
"
);
data
=
strtok
(
NULL
,
"
\t\r\n
"
);
if
(
stricmp
(
text
,
"TimeStamp"
)
==
0
)
m_TimeStamp
=
atol
(
data
);
if
(
stricmp
(
text
,
"$ENDHEADER"
)
==
0
)
return
TRUE
;
}
return
FALSE
;
}
}
/*********************/
/*********************/
/* class LibCmpEntry */
/* class LibCmpEntry */
/*********************/
/*********************/
/* Basic class for librarty oomponent description
/* Basic class for librarty oomponent description
Not directly used
*
Not directly used
Used to create the 2 derived classes :
*
Used to create the 2 derived classes :
- EDA_LibCmpAliasStruct
*
- EDA_LibCmpAliasStruct
- EDA_LibComponentStruct
*
- EDA_LibComponentStruct
*/
*/
/********************************************************************/
/********************************************************************/
LibCmpEntry
::
LibCmpEntry
(
LibrEntryType
CmpType
,
const
wxChar
*
CmpName
)
:
LibCmpEntry
::
LibCmpEntry
(
LibrEntryType
CmpType
,
const
wxChar
*
CmpName
)
:
EDA_BaseStruct
(
LIBCOMPONENT_STRUCT_TYPE
)
EDA_BaseStruct
(
LIBCOMPONENT_STRUCT_TYPE
)
/********************************************************************/
/********************************************************************/
{
{
Type
=
CmpType
;
Type
=
CmpType
;
m_Name
.
m_FieldId
=
VALUE
;
m_Name
.
m_FieldId
=
VALUE
;
if
(
CmpName
)
m_Name
.
m_Text
=
CmpName
;
if
(
CmpName
)
m_Name
.
m_Text
=
CmpName
;
}
}
/******************************/
/******************************/
LibCmpEntry
::~
LibCmpEntry
(
void
)
LibCmpEntry
::~
LibCmpEntry
(
void
)
/******************************/
/******************************/
{
{
}
}
/*******************************/
/*******************************/
/* class EDA_LibCmpAliasStruct */
/* class EDA_LibCmpAliasStruct */
/*******************************/
/*******************************/
/* Class to define an alias of a component
/* Class to define an alias of a component
An alias uses the component defintion (graphic, pins...)
*
An alias uses the component defintion (graphic, pins...)
but has its own name and documentation.
*
but has its own name and documentation.
Therefore, when the component is modified, alias of this component are modified.
*
Therefore, when the component is modified, alias of this component are modified.
This is a simple method to create components with differs very few
*
This is a simple method to create components with differs very few
(like 74LS00, 74HC00 ... and many op amps )
*
(like 74LS00, 74HC00 ... and many op amps )
*/
*/
EDA_LibCmpAliasStruct
::
EDA_LibCmpAliasStruct
(
const
wxChar
*
CmpName
,
EDA_LibCmpAliasStruct
::
EDA_LibCmpAliasStruct
(
const
wxChar
*
CmpName
,
const
wxChar
*
CmpRootName
)
:
const
wxChar
*
CmpRootName
)
:
LibCmpEntry
(
ALIAS
,
CmpName
)
LibCmpEntry
(
ALIAS
,
CmpName
)
{
{
if
(
CmpRootName
==
NULL
)
m_RootName
.
Empty
();
if
(
CmpRootName
==
NULL
)
else
m_RootName
=
CmpRootName
;
m_RootName
.
Empty
();
else
m_RootName
=
CmpRootName
;
}
}
EDA_LibCmpAliasStruct
::~
EDA_LibCmpAliasStruct
(
void
)
EDA_LibCmpAliasStruct
::~
EDA_LibCmpAliasStruct
(
void
)
{
{
}
}
/********************************/
/********************************/
/* class EDA_LibComponentStruct */
/* class EDA_LibComponentStruct */
/********************************/
/********************************/
/* This is a standard component (in library)
/* This is a standard component (in library)
*/
*/
EDA_LibComponentStruct
::
EDA_LibComponentStruct
(
const
wxChar
*
CmpName
)
:
EDA_LibComponentStruct
::
EDA_LibComponentStruct
(
const
wxChar
*
CmpName
)
:
LibCmpEntry
(
ROOT
,
CmpName
)
LibCmpEntry
(
ROOT
,
CmpName
)
{
{
m_Drawings
=
NULL
;
m_Drawings
=
NULL
;
m_LastDate
=
0
;
m_LastDate
=
0
;
m_UnitCount
=
1
;
m_UnitCount
=
1
;
m_TextInside
=
40
;
m_TextInside
=
40
;
m_Options
=
ENTRY_NORMAL
;
m_Options
=
ENTRY_NORMAL
;
m_UnitSelectionLocked
=
FALSE
;
m_UnitSelectionLocked
=
FALSE
;
m_DrawPinNum
=
m_DrawPinName
=
1
;
m_DrawPinNum
=
m_DrawPinName
=
1
;
Fields
=
NULL
;
Fields
=
NULL
;
m_Prefix
.
m_FieldId
=
REFERENCE
;
m_Prefix
.
m_FieldId
=
REFERENCE
;
}
}
/******************************************************/
/******************************************************/
EDA_LibComponentStruct
::~
EDA_LibComponentStruct
(
void
)
EDA_LibComponentStruct
::~
EDA_LibComponentStruct
(
void
)
/******************************************************/
/******************************************************/
{
{
LibEDA_BaseStruct
*
DrawItem
,
*
NextDrawItem
;
LibEDA_BaseStruct
*
DrawItem
,
*
NextDrawItem
;
LibDrawField
*
TempField
,
*
field
;
LibDrawField
*
TempField
,
*
field
;
field
=
Fields
;
Fields
=
NULL
;
field
=
Fields
;
Fields
=
NULL
;
while
(
field
)
while
(
field
)
{
{
TempField
=
field
;
field
=
(
LibDrawField
*
)
field
->
Pnext
;
TempField
=
field
;
field
=
(
LibDrawField
*
)
field
->
Pnext
;
delete
TempField
;
delete
TempField
;
}
}
/* suppression des elements dependants */
/* suppression des elements dependants */
DrawItem
=
m_Drawings
;
m_Drawings
=
NULL
;
DrawItem
=
m_Drawings
;
m_Drawings
=
NULL
;
while
(
DrawItem
)
while
(
DrawItem
)
{
{
NextDrawItem
=
DrawItem
->
Next
();
NextDrawItem
=
DrawItem
->
Next
();
delete
DrawItem
;
delete
DrawItem
;
DrawItem
=
NextDrawItem
;
DrawItem
=
NextDrawItem
;
}
}
}
}
/**********************************************************************/
/**********************************************************************/
EDA_Rect
EDA_LibComponentStruct
::
GetBoundaryBox
(
int
Unit
,
int
Convert
)
EDA_Rect
EDA_LibComponentStruct
::
GetBoundaryBox
(
int
Unit
,
int
Convert
)
/**********************************************************************/
/**********************************************************************/
/* Return the componenty boundary box ( in user coordinates )
/* Return the componenty boundary box ( in user coordinates )
The unit Unit, and the shape Convert are considered.
* The unit Unit, and the shape Convert are considered.
If Unit == 0, Unit is not used
* If Unit == 0, Unit is not used
if Convert == 0 Convert is non used
* if Convert == 0 Convert is non used
**/
**/
{
{
int
xmin
,
xmax
,
ymin
,
ymax
,
x1
,
y1
;
int
xmin
,
xmax
,
ymin
,
ymax
,
x1
,
y1
;
int
*
pt
,
ii
;
int
*
pt
,
ii
;
LibEDA_BaseStruct
*
DrawEntry
;
LibEDA_BaseStruct
*
DrawEntry
;
EDA_Rect
BoundaryBox
;
EDA_Rect
BoundaryBox
;
DrawEntry
=
m_Drawings
;
DrawEntry
=
m_Drawings
;
if
(
DrawEntry
)
if
(
DrawEntry
)
{
{
xmin
=
ymin
=
0x7FFFFFFF
;
xmax
=
ymax
=
0x80000000
;
xmin
=
ymin
=
0x7FFFFFFF
;
}
xmax
=
ymax
=
0x80000000
;
else
}
{
else
xmin
=
ymin
=
-
50
;
xmax
=
ymax
=
50
;
// Min size in 1/1000 inch
{
}
xmin
=
ymin
=
-
50
;
xmax
=
ymax
=
50
;
// Min size in 1/1000 inch
for
(
;
DrawEntry
!=
NULL
;
DrawEntry
=
DrawEntry
->
Next
()
)
}
{
if
(
DrawEntry
->
m_Unit
>
0
)
// The item is non common to units
for
(
;
DrawEntry
!=
NULL
;
DrawEntry
=
DrawEntry
->
Next
()
)
if
(
(
m_UnitCount
>
1
)
&&
(
Unit
>
0
)
&&
(
Unit
!=
DrawEntry
->
m_Unit
)
)
{
continue
;
if
(
DrawEntry
->
m_Unit
>
0
)
// The item is non common to units
if
(
DrawEntry
->
m_Convert
>
0
)
//The item is not common to alls convert
if
(
(
m_UnitCount
>
1
)
&&
(
Unit
>
0
)
&&
(
Unit
!=
DrawEntry
->
m_Unit
)
)
if
(
(
Convert
>
0
)
&&
(
Convert
!=
DrawEntry
->
m_Convert
)
)
continue
;
continue
;
if
(
DrawEntry
->
m_Convert
>
0
)
//The item is not common to alls convert
if
(
(
Convert
>
0
)
&&
(
Convert
!=
DrawEntry
->
m_Convert
)
)
switch
(
DrawEntry
->
m_StructType
)
continue
;
{
case
COMPONENT_ARC_DRAW_TYPE
:
switch
(
DrawEntry
->
m_StructType
)
{
{
// Arc is reduced to a line from m_Start to m_End.
case
COMPONENT_ARC_DRAW_TYPE
:
// TO DO better.
{
LibDrawArc
*
Arc
=
(
LibDrawArc
*
)
DrawEntry
;
// Arc is reduced to a line from m_Start to m_End.
x1
=
Arc
->
m_ArcStart
.
x
;
// TO DO better.
y1
=
Arc
->
m_ArcStart
.
y
;
LibDrawArc
*
Arc
=
(
LibDrawArc
*
)
DrawEntry
;
xmin
=
MIN
(
xmin
,
x1
);
x1
=
Arc
->
m_ArcStart
.
x
;
ymin
=
MIN
(
ymin
,
y1
);
y1
=
Arc
->
m_ArcStart
.
y
;
xmax
=
MAX
(
xmax
,
x1
);
xmin
=
MIN
(
xmin
,
x1
);
ymax
=
MAX
(
ymax
,
y1
);
ymin
=
MIN
(
ymin
,
y1
);
x1
=
Arc
->
m_ArcEnd
.
x
;
xmax
=
MAX
(
xmax
,
x1
);
y1
=
Arc
->
m_ArcEnd
.
y
;
ymax
=
MAX
(
ymax
,
y1
);
xmin
=
MIN
(
xmin
,
x1
);
x1
=
Arc
->
m_ArcEnd
.
x
;
ymin
=
MIN
(
ymin
,
y1
);
y1
=
Arc
->
m_ArcEnd
.
y
;
xmax
=
MAX
(
xmax
,
x1
);
xmin
=
MIN
(
xmin
,
x1
);
ymax
=
MAX
(
ymax
,
y1
);
ymin
=
MIN
(
ymin
,
y1
);
}
xmax
=
MAX
(
xmax
,
x1
);
break
;
ymax
=
MAX
(
ymax
,
y1
);
}
case
COMPONENT_CIRCLE_DRAW_TYPE
:
break
;
{
LibDrawCircle
*
Circle
=
(
LibDrawCircle
*
)
DrawEntry
;
case
COMPONENT_CIRCLE_DRAW_TYPE
:
x1
=
Circle
->
m_Pos
.
x
-
Circle
->
m_Rayon
;
{
y1
=
Circle
->
m_Pos
.
y
-
Circle
->
m_Rayon
;
LibDrawCircle
*
Circle
=
(
LibDrawCircle
*
)
DrawEntry
;
xmin
=
MIN
(
xmin
,
x1
);
x1
=
Circle
->
m_Pos
.
x
-
Circle
->
m_Rayon
;
ymin
=
MIN
(
ymin
,
y1
);
y1
=
Circle
->
m_Pos
.
y
-
Circle
->
m_Rayon
;
x1
=
Circle
->
m_Pos
.
x
+
Circle
->
m_Rayon
;
xmin
=
MIN
(
xmin
,
x1
);
y1
=
Circle
->
m_Pos
.
y
+
Circle
->
m_Rayon
;
ymin
=
MIN
(
ymin
,
y1
);
xmax
=
MAX
(
xmax
,
x1
);
x1
=
Circle
->
m_Pos
.
x
+
Circle
->
m_Rayon
;
ymax
=
MAX
(
ymax
,
y1
);
y1
=
Circle
->
m_Pos
.
y
+
Circle
->
m_Rayon
;
}
xmax
=
MAX
(
xmax
,
x1
);
break
;
ymax
=
MAX
(
ymax
,
y1
);
}
case
COMPONENT_RECT_DRAW_TYPE
:
break
;
{
LibDrawSquare
*
Square
=
(
LibDrawSquare
*
)
DrawEntry
;
case
COMPONENT_RECT_DRAW_TYPE
:
xmin
=
MIN
(
xmin
,
Square
->
m_Pos
.
x
);
{
xmin
=
MIN
(
xmin
,
Square
->
m_End
.
x
);
LibDrawSquare
*
Square
=
(
LibDrawSquare
*
)
DrawEntry
;
xmax
=
MAX
(
xmax
,
Square
->
m_Pos
.
x
);
xmin
=
MIN
(
xmin
,
Square
->
m_Pos
.
x
);
xmax
=
MAX
(
xmax
,
Square
->
m_End
.
x
);
xmin
=
MIN
(
xmin
,
Square
->
m_End
.
x
);
ymin
=
MIN
(
ymin
,
Square
->
m_Pos
.
y
);
xmax
=
MAX
(
xmax
,
Square
->
m_Pos
.
x
);
ymin
=
MIN
(
ymin
,
Square
->
m_End
.
y
);
xmax
=
MAX
(
xmax
,
Square
->
m_End
.
x
);
ymax
=
MAX
(
ymax
,
Square
->
m_Pos
.
y
);
ymin
=
MIN
(
ymin
,
Square
->
m_Pos
.
y
);
ymax
=
MAX
(
ymax
,
Square
->
m_End
.
y
);
ymin
=
MIN
(
ymin
,
Square
->
m_End
.
y
);
}
ymax
=
MAX
(
ymax
,
Square
->
m_Pos
.
y
);
break
;
ymax
=
MAX
(
ymax
,
Square
->
m_End
.
y
);
}
case
COMPONENT_PIN_DRAW_TYPE
:
break
;
{
LibDrawPin
*
Pin
=
(
LibDrawPin
*
)
DrawEntry
;
case
COMPONENT_PIN_DRAW_TYPE
:
x1
=
Pin
->
m_Pos
.
x
;
{
y1
=
Pin
->
m_Pos
.
y
;
LibDrawPin
*
Pin
=
(
LibDrawPin
*
)
DrawEntry
;
xmin
=
MIN
(
xmin
,
x1
);
x1
=
Pin
->
m_Pos
.
x
;
xmax
=
MAX
(
xmax
,
x1
);
y1
=
Pin
->
m_Pos
.
y
;
ymin
=
MIN
(
ymin
,
y1
);
xmin
=
MIN
(
xmin
,
x1
);
ymax
=
MAX
(
ymax
,
y1
);
xmax
=
MAX
(
xmax
,
x1
);
#if 0 // 0 pour englober le point origine de la pin, 1 pour englober toute la pin
ymin
=
MIN
(
ymin
,
y1
);
switch ( Pin->Orient )
ymax
=
MAX
(
ymax
,
y1
);
{
#if 0 \
case PIN_UP: y1 += Pin->Len; break;
// 0 pour englober le point origine de la pin, 1 pour englober toute la pin
case PIN_DOWN: y1 -= Pin->Len; break;
switch( Pin->Orient )
case PIN_LEFT: x1 -= Pin->Len; break;
{
case PIN_RIGHT: x1 += Pin->Len; break;
case PIN_UP:
}
y1 += Pin->Len; break;
xmin = MIN(xmin, x1);
xmax = MAX(xmax, x1);
case PIN_DOWN:
ymin = MIN(ymin, y1);
y1 -= Pin->Len; break;
ymax = MAX(ymax, y1);
case PIN_LEFT:
x1 -= Pin->Len; break;
case PIN_RIGHT:
x1 += Pin->Len; break;
}
xmin = MIN( xmin, x1 );
xmax = MAX( xmax, x1 );
ymin = MIN( ymin, y1 );
ymax = MAX( ymax, y1 );
#endif
#endif
}
}
break
;
break
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
break
;
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
{
{
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DrawEntry
;
LibDrawPolyline
*
polyline
=
(
LibDrawPolyline
*
)
DrawEntry
;
pt
=
polyline
->
PolyList
;
pt
=
polyline
->
PolyList
;
for
(
ii
=
0
;
ii
<
polyline
->
n
;
ii
++
)
for
(
ii
=
0
;
ii
<
polyline
->
n
;
ii
++
)
{
{
if
(
xmin
>
*
pt
)
xmin
=
*
pt
;
if
(
xmin
>
*
pt
)
if
(
xmax
<
*
pt
)
xmax
=
*
pt
;
xmin
=
*
pt
;
pt
++
;
if
(
xmax
<
*
pt
)
if
(
ymin
>
*
pt
)
ymin
=
*
pt
;
xmax
=
*
pt
;
if
(
ymax
<
*
pt
)
ymax
=
*
pt
;
pt
++
;
pt
++
;
if
(
ymin
>
*
pt
)
}
ymin
=
*
pt
;
}
if
(
ymax
<
*
pt
)
break
;
ymax
=
*
pt
;
}
pt
++
;
}
}
}
// Update the BoundaryBox. Remenber the fact the screen Y axis is the reverse */
break
;
ymax
=
-
ymax
;
ymin
=
-
ymin
;
// Y is is screen axis sense
// Ensure w and H > 0 (wxRect assume it)
default
:
if
(
xmax
<
xmin
)
EXCHG
(
xmax
,
xmin
);
;
if
(
ymax
<
ymin
)
EXCHG
(
ymax
,
ymin
);
}
BoundaryBox
.
SetX
(
xmin
);
BoundaryBox
.
SetWidth
(
xmax
-
xmin
);
}
BoundaryBox
.
SetY
(
ymin
);
BoundaryBox
.
SetHeight
(
ymax
-
ymin
);
// Update the BoundaryBox. Remenber the fact the screen Y axis is the reverse */
return
BoundaryBox
;
ymax
=
-
ymax
;
ymin
=
-
ymin
;
// Y is is screen axis sense
}
// Ensure w and H > 0 (wxRect assume it)
if
(
xmax
<
xmin
)
EXCHG
(
xmax
,
xmin
);
/***************************/
if
(
ymax
<
ymin
)
/* class LibraryFieldEntry */
EXCHG
(
ymax
,
ymin
);
/***************************/
BoundaryBox
.
SetX
(
xmin
);
BoundaryBox
.
SetWidth
(
xmax
-
xmin
);
/* a Field is a string linked to a component.
BoundaryBox
.
SetY
(
ymin
);
BoundaryBox
.
SetHeight
(
ymax
-
ymin
);
Unlike a pure graphic text, fields can be used in netlist generation
and other things.
return
BoundaryBox
;
}
/***************************/
/* class LibraryFieldEntry */
/***************************/
4 fields have a special meaning:
/* a Field is a string linked to a component.
REFERENCE
* Unlike a pure graphic text, fields can be used in netlist generation
VALUE
* and other things.
FOOTPRINT NAME
*
SCHEMATIC LINK (reserved but not used in kicad)
* 4 fields have a special meaning:
*/
* REFERENCE
LibDrawField
::
LibDrawField
(
int
idfield
)
:
LibEDA_BaseStruct
(
COMPONENT_FIELD_DRAW_TYPE
)
* VALUE
* FOOTPRINT NAME
* SCHEMATIC LINK (reserved but not used in kicad)
*/
LibDrawField
::
LibDrawField
(
int
idfield
)
:
LibEDA_BaseStruct
(
COMPONENT_FIELD_DRAW_TYPE
)
{
{
m_FieldId
=
idfield
;
/* 0 a 11, 0 = REFERENCE, 1 = VALUE*/
m_FieldId
=
idfield
;
/* 0 a 11, 0 = REFERENCE, 1 = VALUE*/
if
(
m_FieldId
<
0
)
m_FieldId
=
0
;
if
(
m_FieldId
<
0
)
if
(
m_FieldId
>=
NUMBER_OF_FIELDS
)
m_FieldId
=
NUMBER_OF_FIELDS
-
1
;
m_FieldId
=
0
;
m_Size
.
x
=
m_Size
.
y
=
DEFAULT_SIZE_TEXT
;
if
(
m_FieldId
>=
NUMBER_OF_FIELDS
)
m_Orient
=
0
;
/* Orientation */
m_FieldId
=
NUMBER_OF_FIELDS
-
1
;
m_Attributs
=
0
;
/* Attributs = unvisible ... */
m_Size
.
x
=
m_Size
.
y
=
DEFAULT_SIZE_TEXT
;
m_Width
=
0
;
m_Orient
=
0
;
/* Orientation */
m_HJustify
=
GR_TEXT_HJUSTIFY_CENTER
;
m_Attributs
=
0
;
/* Attributs = unvisible ... */
m_VJustify
=
GR_TEXT_VJUSTIFY_CENTER
;
/* Horizontal and vertical text justification */
m_Width
=
0
;
m_HJustify
=
GR_TEXT_HJUSTIFY_CENTER
;
m_VJustify
=
GR_TEXT_VJUSTIFY_CENTER
;
/* Horizontal and vertical text justification */
}
}
LibDrawField
::~
LibDrawField
(
void
)
LibDrawField
::~
LibDrawField
(
void
)
{
{
}
}
// Creation et Duplication d'un field
LibDrawField
*
LibDrawField
::
GenCopy
(
void
)
// Creation et Duplication d'un field
LibDrawField
*
LibDrawField
::
GenCopy
(
void
)
{
{
LibDrawField
*
newfield
=
new
LibDrawField
(
m_FieldId
);
LibDrawField
*
newfield
=
new
LibDrawField
(
m_FieldId
);
Copy
(
newfield
);
return
newfield
;
Copy
(
newfield
);
return
newfield
;
}
}
// copie du field dans le field Target
void
LibDrawField
::
Copy
(
LibDrawField
*
Target
)
// copie du field dans le field Target
void
LibDrawField
::
Copy
(
LibDrawField
*
Target
)
{
{
Target
->
m_Pos
=
m_Pos
;
Target
->
m_Pos
=
m_Pos
;
Target
->
m_Size
=
m_Size
;
Target
->
m_Size
=
m_Size
;
Target
->
m_Width
=
m_Width
;
Target
->
m_Width
=
m_Width
;
Target
->
m_Orient
=
m_Orient
;
Target
->
m_Orient
=
m_Orient
;
Target
->
m_Attributs
=
m_Attributs
;
Target
->
m_Attributs
=
m_Attributs
;
Target
->
m_Text
=
m_Text
;
Target
->
m_Text
=
m_Text
;
Target
->
m_Name
=
m_Name
;
Target
->
m_Name
=
m_Name
;
Target
->
m_HJustify
=
m_HJustify
;
Target
->
m_HJustify
=
m_HJustify
;
Target
->
m_VJustify
=
m_VJustify
;
Target
->
m_VJustify
=
m_VJustify
;
}
}
/* Elements Graphiques */
/* Elements Graphiques */
LibEDA_BaseStruct
::
LibEDA_BaseStruct
(
int
struct_type
)
:
LibEDA_BaseStruct
::
LibEDA_BaseStruct
(
KICAD_T
struct_type
)
:
EDA_BaseStruct
(
struct_type
)
EDA_BaseStruct
(
struct_type
)
{
{
m_Unit
=
0
;
/* Unit identification (for multi part per package)
m_Unit
=
0
;
/* Unit identification (for multi part per package)
0 if the item is common to all units */
*
0 if the item is common to all units */
m_Convert
=
0
;
/* Shape identification (for parts which have a convert shape)
m_Convert
=
0
;
/* Shape identification (for parts which have a convert shape)
0 if the item is common to all shapes */
*
0 if the item is common to all shapes */
m_Width
=
0
;
/* Default value to draw lines or arc ... */
m_Width
=
0
;
/* Default value to draw lines or arc ... */
}
}
/***************************************************************/
/***************************************************************/
LibDrawPin
::
LibDrawPin
(
void
)
:
LibEDA_BaseStruct
(
COMPONENT_PIN_DRAW_TYPE
)
LibDrawPin
::
LibDrawPin
(
void
)
:
LibEDA_BaseStruct
(
COMPONENT_PIN_DRAW_TYPE
)
/***************************************************************/
/***************************************************************/
{
{
m_PinLen
=
300
;
/* default Pin len */
m_PinLen
=
300
;
/* default Pin len */
m_Orient
=
PIN_RIGHT
;
/* Pin oprient: Up, Down, Left, Right */
m_Orient
=
PIN_RIGHT
;
/* Pin oprient: Up, Down, Left, Right */
m_PinShape
=
NONE
;
/* Bit a bit: Pin shape (voir enum prec) */
m_PinShape
=
NONE
;
/* Bit a bit: Pin shape (voir enum prec) */
m_PinType
=
PIN_UNSPECIFIED
;
/* electrical type of pin */
m_PinType
=
PIN_UNSPECIFIED
;
/* electrical type of pin */
m_Attributs
=
0
;
/* bit 0 != 0: pin invisible */
m_Attributs
=
0
;
/* bit 0 != 0: pin invisible */
m_PinNum
=
0
;
/*pin number ( i.e. 4 codes Ascii ) */
m_PinNum
=
0
;
/*pin number ( i.e. 4 codes Ascii ) */
m_PinNumSize
=
50
;
m_PinNumSize
=
50
;
m_PinNameSize
=
50
;
/* Default size for pin name and num */
m_PinNameSize
=
50
;
/* Default size for pin name and num */
m_Width
=
0
;
m_Width
=
0
;
// m_PinNumWidth = m_PinNameWidth = 0; // Unused
// m_PinNumWidth = m_PinNameWidth = 0; // Unused
}
}
/******************************************/
/******************************************/
wxPoint
LibDrawPin
::
ReturnPinEndPoint
(
void
)
wxPoint
LibDrawPin
::
ReturnPinEndPoint
(
void
)
/******************************************/
/******************************************/
/* return the pin end position, for a component in normal orient
/* return the pin end position, for a component in normal orient
*/
*/
{
{
wxPoint
pos
=
m_Pos
;
wxPoint
pos
=
m_Pos
;
switch
(
m_Orient
)
{
case
PIN_UP
:
pos
.
y
+=
m_PinLen
;
break
;
case
PIN_DOWN
:
pos
.
y
-=
m_PinLen
;
break
;
case
PIN_LEFT
:
pos
.
x
-=
m_PinLen
;
break
;
case
PIN_RIGHT
:
pos
.
x
+=
m_PinLen
;
break
;
}
return
pos
;
switch
(
m_Orient
)
{
case
PIN_UP
:
pos
.
y
+=
m_PinLen
;
break
;
case
PIN_DOWN
:
pos
.
y
-=
m_PinLen
;
break
;
case
PIN_LEFT
:
pos
.
x
-=
m_PinLen
;
break
;
case
PIN_RIGHT
:
pos
.
x
+=
m_PinLen
;
break
;
}
return
pos
;
}
}
/********************************************************/
/********************************************************/
int
LibDrawPin
::
ReturnPinDrawOrient
(
int
TransMat
[
2
][
2
]
)
int
LibDrawPin
::
ReturnPinDrawOrient
(
int
TransMat
[
2
][
2
]
)
/********************************************************/
/********************************************************/
/* Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT),
/* Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT),
according to its orientation,
* according to its orientation,
AND the matrix transform (rot, mirror) TransMat
* AND the matrix transform (rot, mirror) TransMat
*/
*/
{
{
int
orient
;
int
orient
;
int
x1
=
0
,
y1
=
0
;
int
x1
=
0
,
y1
=
0
;
int
t1
,
t2
;
int
t1
,
t2
;
switch
(
m_Orient
)
switch
(
m_Orient
)
{
{
case
PIN_UP
:
y1
=
1
;
break
;
case
PIN_UP
:
case
PIN_DOWN
:
y1
=
-
1
;
break
;
y1
=
1
;
break
;
case
PIN_LEFT
:
x1
=
-
1
;
break
;
case
PIN_RIGHT
:
x1
=
1
;
break
;
case
PIN_DOWN
:
}
y1
=
-
1
;
break
;
t1
=
TransMat
[
0
][
0
]
*
x1
+
TransMat
[
0
][
1
]
*
y1
;
t2
=
TransMat
[
1
][
0
]
*
x1
+
TransMat
[
1
][
1
]
*
y1
;
case
PIN_LEFT
:
orient
=
PIN_UP
;
x1
=
-
1
;
break
;
if
(
t1
==
0
)
{
case
PIN_RIGHT
:
if
(
t2
>
0
)
orient
=
PIN_DOWN
;
x1
=
1
;
break
;
}
}
else
{
t1
=
TransMat
[
0
][
0
]
*
x1
+
TransMat
[
0
][
1
]
*
y1
;
orient
=
PIN_RIGHT
;
t2
=
TransMat
[
1
][
0
]
*
x1
+
TransMat
[
1
][
1
]
*
y1
;
if
(
t1
<
0
)
orient
=
PIN_LEFT
;
orient
=
PIN_UP
;
}
if
(
t1
==
0
)
{
return
orient
;
if
(
t2
>
0
)
orient
=
PIN_DOWN
;
}
else
{
orient
=
PIN_RIGHT
;
if
(
t1
<
0
)
orient
=
PIN_LEFT
;
}
return
orient
;
}
}
/****************************************************/
/****************************************************/
void
LibDrawPin
::
ReturnPinStringNum
(
wxString
&
buffer
)
void
LibDrawPin
::
ReturnPinStringNum
(
wxString
&
buffer
)
/****************************************************/
/****************************************************/
/* fill the buffer with pin num as a wxString
/* fill the buffer with pin num as a wxString
Pin num is coded as a long
*
Pin num is coded as a long
Used to print/draw the pin num
*
Used to print/draw the pin num
*/
*/
{
{
char
ascii_buf
[
5
];
char
ascii_buf
[
5
];
strncpy
(
ascii_buf
,
(
char
*
)
&
m_PinNum
,
4
);
strncpy
(
ascii_buf
,
(
char
*
)
&
m_PinNum
,
4
);
ascii_buf
[
4
]
=
0
;
ascii_buf
[
4
]
=
0
;
buffer
=
CONV_FROM_UTF8
(
ascii_buf
);
buffer
=
CONV_FROM_UTF8
(
ascii_buf
);
}
}
/****************************************************/
/****************************************************/
void
LibDrawPin
::
SetPinNumFromString
(
wxString
&
buffer
)
void
LibDrawPin
::
SetPinNumFromString
(
wxString
&
buffer
)
/****************************************************/
/****************************************************/
/* fill the buffer with pin num as a wxString
/* fill the buffer with pin num as a wxString
Pin num is coded as a long
* Pin num is coded as a long
Used to print/draw the pin num
* Used to print/draw the pin num
*/
*/
{
{
char
ascii_buf
[
4
];
char
ascii_buf
[
4
];
unsigned
ii
,
len
=
buffer
.
Len
();
unsigned
ii
,
len
=
buffer
.
Len
();
ascii_buf
[
0
]
=
ascii_buf
[
1
]
=
ascii_buf
[
2
]
=
ascii_buf
[
3
]
=
0
;
ascii_buf
[
0
]
=
ascii_buf
[
1
]
=
ascii_buf
[
2
]
=
ascii_buf
[
3
]
=
0
;
if
(
len
>
4
)
len
=
4
;
if
(
len
>
4
)
for
(
ii
=
0
;
ii
<
len
;
ii
++
)
len
=
4
;
{
for
(
ii
=
0
;
ii
<
len
;
ii
++
)
ascii_buf
[
ii
]
=
buffer
.
GetChar
(
ii
)
&
0xFF
;
{
}
ascii_buf
[
ii
]
=
buffer
.
GetChar
(
ii
)
&
0xFF
;
strncpy
((
char
*
)
&
m_PinNum
,
ascii_buf
,
4
);
}
strncpy
(
(
char
*
)
&
m_PinNum
,
ascii_buf
,
4
);
}
}
/*************************************/
/*************************************/
LibDrawPin
*
LibDrawPin
::
GenCopy
(
void
)
LibDrawPin
*
LibDrawPin
::
GenCopy
(
void
)
/*************************************/
/*************************************/
{
{
LibDrawPin
*
newpin
=
new
LibDrawPin
();
LibDrawPin
*
newpin
=
new
LibDrawPin
();
newpin
->
m_Pos
=
m_Pos
;
newpin
->
m_Pos
=
m_Pos
;
newpin
->
m_PinLen
=
m_PinLen
;
newpin
->
m_PinLen
=
m_PinLen
;
newpin
->
m_Orient
=
m_Orient
;
newpin
->
m_Orient
=
m_Orient
;
newpin
->
m_PinShape
=
m_PinShape
;
newpin
->
m_PinShape
=
m_PinShape
;
newpin
->
m_PinType
=
m_PinType
;
newpin
->
m_PinType
=
m_PinType
;
newpin
->
m_Attributs
=
m_Attributs
;
newpin
->
m_Attributs
=
m_Attributs
;
newpin
->
m_PinNum
=
m_PinNum
;
newpin
->
m_PinNum
=
m_PinNum
;
newpin
->
m_PinNumSize
=
m_PinNumSize
;
newpin
->
m_PinNumSize
=
m_PinNumSize
;
newpin
->
m_PinNameSize
=
m_PinNameSize
;
newpin
->
m_PinNameSize
=
m_PinNameSize
;
newpin
->
m_Unit
=
m_Unit
;
newpin
->
m_Unit
=
m_Unit
;
newpin
->
m_Convert
=
m_Convert
;
newpin
->
m_Convert
=
m_Convert
;
newpin
->
m_Flags
=
m_Flags
;
newpin
->
m_Flags
=
m_Flags
;
newpin
->
m_Width
=
m_Width
;
newpin
->
m_Width
=
m_Width
;
newpin
->
m_PinName
=
m_PinName
;
newpin
->
m_PinName
=
m_PinName
;
return
newpin
;
return
newpin
;
}
}
/**************************************************************/
/**************************************************************/
LibDrawArc
::
LibDrawArc
(
void
)
:
LibEDA_BaseStruct
(
COMPONENT_ARC_DRAW_TYPE
)
LibDrawArc
::
LibDrawArc
(
void
)
:
LibEDA_BaseStruct
(
COMPONENT_ARC_DRAW_TYPE
)
/**************************************************************/
/**************************************************************/
{
{
m_Rayon
=
0
;
m_Rayon
=
0
;
t1
=
t2
=
0
;
t1
=
t2
=
0
;
m_Width
=
0
;
m_Width
=
0
;
m_Fill
=
NO_FILL
;
m_Fill
=
NO_FILL
;
}
}
/************************************/
/************************************/
LibDrawArc
*
LibDrawArc
::
GenCopy
(
void
)
LibDrawArc
*
LibDrawArc
::
GenCopy
(
void
)
/************************************/
/************************************/
{
{
LibDrawArc
*
newitem
=
new
LibDrawArc
();
LibDrawArc
*
newitem
=
new
LibDrawArc
();
newitem
->
m_Pos
=
m_Pos
;
newitem
->
m_Pos
=
m_Pos
;
newitem
->
m_ArcStart
=
m_ArcStart
;
newitem
->
m_ArcStart
=
m_ArcStart
;
newitem
->
m_ArcEnd
=
m_ArcEnd
;
newitem
->
m_ArcEnd
=
m_ArcEnd
;
newitem
->
m_Rayon
=
m_Rayon
;
newitem
->
m_Rayon
=
m_Rayon
;
newitem
->
t1
=
t1
;
newitem
->
t1
=
t1
;
newitem
->
t2
=
t2
;
newitem
->
t2
=
t2
;
newitem
->
m_Width
=
m_Width
;
newitem
->
m_Width
=
m_Width
;
newitem
->
m_Unit
=
m_Unit
;
newitem
->
m_Unit
=
m_Unit
;
newitem
->
m_Convert
=
m_Convert
;
newitem
->
m_Convert
=
m_Convert
;
newitem
->
m_Flags
=
m_Flags
;
newitem
->
m_Flags
=
m_Flags
;
newitem
->
m_Fill
=
m_Fill
;
newitem
->
m_Fill
=
m_Fill
;
return
newitem
;
return
newitem
;
}
}
/**********************************************************************/
/**********************************************************************/
LibDrawCircle
::
LibDrawCircle
(
void
)
:
LibEDA_BaseStruct
(
COMPONENT_CIRCLE_DRAW_TYPE
)
LibDrawCircle
::
LibDrawCircle
(
void
)
:
LibEDA_BaseStruct
(
COMPONENT_CIRCLE_DRAW_TYPE
)
/**********************************************************************/
/**********************************************************************/
{
{
m_Rayon
=
0
;
m_Rayon
=
0
;
m_Fill
=
NO_FILL
;
m_Fill
=
NO_FILL
;
}
}
/*******************************************/
/*******************************************/
LibDrawCircle
*
LibDrawCircle
::
GenCopy
(
void
)
LibDrawCircle
*
LibDrawCircle
::
GenCopy
(
void
)
/*******************************************/
/*******************************************/
{
{
LibDrawCircle
*
newitem
=
new
LibDrawCircle
();
LibDrawCircle
*
newitem
=
new
LibDrawCircle
();
newitem
->
m_Pos
=
m_Pos
;
newitem
->
m_Pos
=
m_Pos
;
newitem
->
m_Rayon
=
m_Rayon
;
newitem
->
m_Rayon
=
m_Rayon
;
newitem
->
m_Width
=
m_Width
;
newitem
->
m_Width
=
m_Width
;
newitem
->
m_Unit
=
m_Unit
;
newitem
->
m_Unit
=
m_Unit
;
newitem
->
m_Convert
=
m_Convert
;
newitem
->
m_Convert
=
m_Convert
;
newitem
->
m_Flags
=
m_Flags
;
newitem
->
m_Flags
=
m_Flags
;
newitem
->
m_Fill
=
m_Fill
;
newitem
->
m_Fill
=
m_Fill
;
return
newitem
;
return
newitem
;
}
}
/*****************************************************************/
/*****************************************************************/
LibDrawText
::
LibDrawText
(
void
)
:
LibEDA_BaseStruct
(
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
)
LibDrawText
::
LibDrawText
(
void
)
:
LibEDA_BaseStruct
(
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
)
/*****************************************************************/
/*****************************************************************/
{
{
m_Horiz
=
TEXT_ORIENT_HORIZ
;
m_Horiz
=
TEXT_ORIENT_HORIZ
;
m_Size
=
wxSize
(
50
,
50
);
m_Size
=
wxSize
(
50
,
50
);
m_Type
=
0
;
m_Type
=
0
;
m_Width
=
0
;
m_Width
=
0
;
}
}
/***************************************/
/***************************************/
LibDrawText
*
LibDrawText
::
GenCopy
(
void
)
LibDrawText
*
LibDrawText
::
GenCopy
(
void
)
/***************************************/
/***************************************/
{
{
LibDrawText
*
newitem
=
new
LibDrawText
();
LibDrawText
*
newitem
=
new
LibDrawText
();
newitem
->
m_Pos
=
m_Pos
;
newitem
->
m_Pos
=
m_Pos
;
newitem
->
m_Horiz
=
m_Horiz
;
newitem
->
m_Horiz
=
m_Horiz
;
newitem
->
m_Size
=
m_Size
;
newitem
->
m_Size
=
m_Size
;
newitem
->
m_Type
=
m_Type
;
newitem
->
m_Type
=
m_Type
;
newitem
->
m_Unit
=
m_Unit
;
newitem
->
m_Unit
=
m_Unit
;
newitem
->
m_Convert
=
m_Convert
;
newitem
->
m_Convert
=
m_Convert
;
newitem
->
m_Flags
=
m_Flags
;
newitem
->
m_Flags
=
m_Flags
;
newitem
->
m_Text
=
m_Text
;
newitem
->
m_Text
=
m_Text
;
newitem
->
m_Width
=
m_Width
;
newitem
->
m_Width
=
m_Width
;
return
newitem
;
return
newitem
;
}
}
LibDrawSquare
::
LibDrawSquare
(
void
)
:
LibEDA_BaseStruct
(
COMPONENT_RECT_DRAW_TYPE
)
LibDrawSquare
::
LibDrawSquare
(
void
)
:
LibEDA_BaseStruct
(
COMPONENT_RECT_DRAW_TYPE
)
{
{
m_Width
=
0
;
m_Width
=
0
;
m_Fill
=
NO_FILL
;
m_Fill
=
NO_FILL
;
}
}
LibDrawSquare
*
LibDrawSquare
::
GenCopy
(
void
)
LibDrawSquare
*
LibDrawSquare
::
GenCopy
(
void
)
{
{
LibDrawSquare
*
newitem
=
new
LibDrawSquare
();
LibDrawSquare
*
newitem
=
new
LibDrawSquare
();
newitem
->
m_Pos
=
m_Pos
;
newitem
->
m_Pos
=
m_Pos
;
newitem
->
m_End
=
m_End
;
newitem
->
m_End
=
m_End
;
newitem
->
m_Width
=
m_Width
;
newitem
->
m_Width
=
m_Width
;
newitem
->
m_Unit
=
m_Unit
;
newitem
->
m_Unit
=
m_Unit
;
newitem
->
m_Convert
=
m_Convert
;
newitem
->
m_Convert
=
m_Convert
;
newitem
->
m_Flags
=
m_Flags
;
newitem
->
m_Flags
=
m_Flags
;
newitem
->
m_Fill
=
m_Fill
;
newitem
->
m_Fill
=
m_Fill
;
return
newitem
;
return
newitem
;
}
}
LibDrawSegment
::
LibDrawSegment
(
void
)
:
LibEDA_BaseStruct
(
COMPONENT_LINE_DRAW_TYPE
)
LibDrawSegment
::
LibDrawSegment
(
void
)
:
LibEDA_BaseStruct
(
COMPONENT_LINE_DRAW_TYPE
)
{
{
m_Width
=
0
;
m_Width
=
0
;
}
}
LibDrawSegment
*
LibDrawSegment
::
GenCopy
(
void
)
LibDrawSegment
*
LibDrawSegment
::
GenCopy
(
void
)
{
{
LibDrawSegment
*
newitem
=
new
LibDrawSegment
();
LibDrawSegment
*
newitem
=
new
LibDrawSegment
();
newitem
->
m_Pos
=
m_Pos
;
newitem
->
m_Pos
=
m_Pos
;
newitem
->
m_End
=
m_End
;
newitem
->
m_End
=
m_End
;
newitem
->
m_Width
=
m_Width
;
newitem
->
m_Width
=
m_Width
;
newitem
->
m_Unit
=
m_Unit
;
newitem
->
m_Unit
=
m_Unit
;
newitem
->
m_Convert
=
m_Convert
;
newitem
->
m_Convert
=
m_Convert
;
newitem
->
m_Flags
=
m_Flags
;
newitem
->
m_Flags
=
m_Flags
;
return
newitem
;
return
newitem
;
}
}
LibDrawPolyline
::
LibDrawPolyline
(
void
)
:
LibEDA_BaseStruct
(
COMPONENT_POLYLINE_DRAW_TYPE
)
LibDrawPolyline
::
LibDrawPolyline
(
void
)
:
LibEDA_BaseStruct
(
COMPONENT_POLYLINE_DRAW_TYPE
)
{
{
n
=
0
;
n
=
0
;
PolyList
=
NULL
;
PolyList
=
NULL
;
m_Fill
=
NO_FILL
;
m_Fill
=
NO_FILL
;
m_Width
=
0
;
m_Width
=
0
;
}
}
/************************************************/
/************************************************/
LibDrawPolyline
*
LibDrawPolyline
::
GenCopy
(
void
)
LibDrawPolyline
*
LibDrawPolyline
::
GenCopy
(
void
)
/************************************************/
/************************************************/
{
{
LibDrawPolyline
*
newitem
=
new
LibDrawPolyline
();
LibDrawPolyline
*
newitem
=
new
LibDrawPolyline
();
int
size
;
int
size
;
newitem
->
n
=
n
;
size
=
sizeof
(
int
)
*
2
*
n
;
newitem
->
n
=
n
;
if
(
size
)
size
=
sizeof
(
int
)
*
2
*
n
;
{
if
(
size
)
newitem
->
PolyList
=
(
int
*
)
MyMalloc
(
size
);
{
memcpy
(
newitem
->
PolyList
,
PolyList
,
size
);
newitem
->
PolyList
=
(
int
*
)
MyMalloc
(
size
);
}
memcpy
(
newitem
->
PolyList
,
PolyList
,
size
);
newitem
->
m_Pos
=
m_Pos
;
}
newitem
->
m_Width
=
m_Width
;
newitem
->
m_Pos
=
m_Pos
;
newitem
->
m_Unit
=
m_Unit
;
newitem
->
m_Width
=
m_Width
;
newitem
->
m_Convert
=
m_Convert
;
newitem
->
m_Unit
=
m_Unit
;
newitem
->
m_Flags
=
m_Flags
;
newitem
->
m_Convert
=
m_Convert
;
newitem
->
m_Fill
=
m_Fill
;
newitem
->
m_Flags
=
m_Flags
;
return
newitem
;
newitem
->
m_Fill
=
m_Fill
;
return
newitem
;
}
}
/***************************************************/
/***************************************************/
void
LibDrawPolyline
::
AddPoint
(
const
wxPoint
&
point
)
void
LibDrawPolyline
::
AddPoint
(
const
wxPoint
&
point
)
/***************************************************/
/***************************************************/
/* add a point to the polyline coordinate list, and realloc the memory
/* add a point to the polyline coordinate list, and realloc the memory
*/
*/
{
{
int
allocsize
;
int
allocsize
;
n
++
;
n
++
;
allocsize
=
2
*
sizeof
(
int
)
*
n
;
allocsize
=
2
*
sizeof
(
int
)
*
n
;
if
(
PolyList
==
NULL
)
if
(
PolyList
==
NULL
)
PolyList
=
(
int
*
)
MyMalloc
(
allocsize
);
PolyList
=
(
int
*
)
MyMalloc
(
allocsize
);
else
else
PolyList
=
(
int
*
)
realloc
(
PolyList
,
allocsize
);
PolyList
=
(
int
*
)
realloc
(
PolyList
,
allocsize
);
PolyList
[(
n
*
2
)
-
2
]
=
point
.
x
;
PolyList
[(
n
*
2
)
-
2
]
=
point
.
x
;
PolyList
[(
n
*
2
)
-
1
]
=
-
point
.
y
;
PolyList
[(
n
*
2
)
-
1
]
=
-
point
.
y
;
}
}
eeschema/libcmp.h
View file @
f3c324d5
...
@@ -13,118 +13,120 @@
...
@@ -13,118 +13,120 @@
#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 at the lib file start. */
#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 at the doc file start. */
#define DOC_EXT
wxT(".dcm")
/* extension des fichiers de documentation */
#define DOC_EXT
wxT( ".dcm" )
/* extension des fichiers de documentation */
#define TARGET_PIN_DIAM 12
/* Diam cercle des extremites des pins */
#define TARGET_PIN_DIAM 12
/* Diam cercle des extremites des pins */
#define DEFAULT_TEXT_SIZE 50
/* Default size for field texts */
#define DEFAULT_TEXT_SIZE 50
/* Default size for field texts */
#define PART_NAME_LEN
15
/* Maximum length of part name. */
#define PART_NAME_LEN
15
/* Maximum length of part name. */
#define PREFIX_NAME_LEN
5
/* Maximum length of prefix (IC, R, SW etc.). */
#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_WIDTH
100
/* Width between 2 pins in internal units. */
#define PIN_LENGTH
300
/* Default Length of each pin to be drawn. */
#define PIN_LENGTH
300
/* Default Length of each pin to be drawn. */
#define INVERT_PIN_RADIUS
35
/* Radius of inverted pin circle. */
#define INVERT_PIN_RADIUS
35
/* Radius of inverted pin circle. */
#define CLOCK_PIN_DIM
40
/* Dim of clock pin symbol. */
#define CLOCK_PIN_DIM
40
/* Dim of clock pin symbol. */
#define IEEE_SYMBOL_PIN_DIM 40
/* Dim of special pin symbol. */
#define IEEE_SYMBOL_PIN_DIM 40
/* Dim of special pin symbol. */
#define NO_FILL
0
// Poly, Squar, Circle, Arc = option No Fill
#define NO_FILL
0
// Poly, Squar, Circle, Arc = option No Fill
#define FILLED_SHAPE
1
// Poly, Squar, Circle, Arc = option Fill with current color
#define FILLED_SHAPE
1
// Poly, Squar, Circle, Arc = option Fill with current color
#define FILLED_WITH_BG_BODYCOLOR 2
// Poly, Squar, Circle, Arc = option Fill
#define FILLED_WITH_BG_BODYCOLOR 2
// Poly, Squar, Circle, Arc = option Fill
// with background body color
// with background body color
//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
#define ALIAS_DOC 1
#define ALIAS_DOC
1
#define ALIAS_KEYWORD 2
#define ALIAS_KEYWORD
2
#define ALIAS_DOC_FILENAME 3
#define ALIAS_DOC_FILENAME 3
#define ALIAS_NEXT 4
#define ALIAS_NEXT
4
typedef
enum
{
typedef
enum
{
LOCATE_COMPONENT_ARC_DRAW_TYPE
=
1
,
LOCATE_COMPONENT_ARC_DRAW_TYPE
=
1
,
LOCATE_COMPONENT_CIRCLE_DRAW_TYPE
=
2
,
LOCATE_COMPONENT_CIRCLE_DRAW_TYPE
=
2
,
LOCATE_COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
=
4
,
LOCATE_COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
=
4
,
LOCATE_COMPONENT_RECT_DRAW_TYPE
=
8
,
LOCATE_COMPONENT_RECT_DRAW_TYPE
=
8
,
LOCATE_LINE_DRAW_TYPE
=
0x10
,
LOCATE_LINE_DRAW_TYPE
=
0x10
,
LOCATE_COMPONENT_POLYLINE_DRAW_TYPE
=
0x20
,
LOCATE_COMPONENT_POLYLINE_DRAW_TYPE
=
0x20
,
LOCATE_COMPONENT_LINE_DRAW_TYPE
=
0x40
LOCATE_COMPONENT_LINE_DRAW_TYPE
=
0x40
}
LocateDrawStructType
;
}
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
/* indique la recherche du composant racine si
meme si le composant specifie est un alias */
*
meme si le composant specifie est un alias */
#define FIND_ALIAS 1
/* indique la recherche du composant specifie
#define FIND_ALIAS 1
/* indique la recherche du composant specifie
(alias ou racine) */
*
(alias ou racine) */
/* definition des types des structures d'elements de librairie */
/* definition des types des structures d'elements de librairie */
typedef
enum
{
typedef
enum
{
ROOT
,
/* Structure est a standard EDA_LibComponentStruct */
ROOT
,
/* Structure est a standard EDA_LibComponentStruct */
ALIAS
/* Structure is an alias */
ALIAS
/* Structure is an alias */
}
LibrEntryType
;
}
LibrEntryType
;
/* valeur du membre .m_Options */
/* valeur du membre .m_Options */
typedef
enum
{
typedef
enum
{
ENTRY_NORMAL
,
// Libentry is standard
ENTRY_NORMAL
,
// Libentry is standard
ENTRY_POWER
// Libentry is a power symbol
ENTRY_POWER
// Libentry is a power symbol
}
LibrEntryOptions
;
}
LibrEntryOptions
;
/* Definitions des Pins */
/* Definitions des Pins */
typedef
enum
{
/* Type des Pins. si modif: modifier tableau des mgs suivant */
typedef
enum
{
/* Type des Pins. si modif: modifier tableau des mgs suivant */
PIN_INPUT
,
PIN_INPUT
,
PIN_OUTPUT
,
PIN_OUTPUT
,
PIN_BIDI
,
PIN_BIDI
,
PIN_TRISTATE
,
PIN_TRISTATE
,
PIN_PASSIVE
,
PIN_PASSIVE
,
PIN_UNSPECIFIED
,
PIN_UNSPECIFIED
,
PIN_POWER_IN
,
PIN_POWER_IN
,
PIN_POWER_OUT
,
PIN_POWER_OUT
,
PIN_OPENCOLLECTOR
,
PIN_OPENCOLLECTOR
,
PIN_OPENEMITTER
,
PIN_OPENEMITTER
,
PIN_NC
,
/* No connect */
PIN_NC
,
/* No connect */
PIN_NMAX
/* Valeur limite ( utilisee comme limite de tableaux) */
PIN_NMAX
/* Valeur limite ( utilisee comme limite de tableaux) */
}
ElectricPinType
;
}
ElectricPinType
;
/* Messages d'affichage du type electrique */
/* Messages d'affichage du type electrique */
eda_global
wxChar
*
MsgPinElectricType
[]
eda_global
wxChar
*
MsgPinElectricType
[]
#ifdef MAIN
#ifdef MAIN
=
{
=
{
wxT
(
"input"
),
wxT
(
"input"
),
wxT
(
"output"
),
wxT
(
"output"
),
wxT
(
"BiDi"
),
wxT
(
"BiDi"
),
wxT
(
"3state"
),
wxT
(
"3state"
),
wxT
(
"passive"
),
wxT
(
"passive"
),
wxT
(
"unspc"
),
wxT
(
"unspc"
),
wxT
(
"power_in"
),
wxT
(
"power_in"
),
wxT
(
"power_out"
),
wxT
(
"power_out"
),
wxT
(
"openCol"
),
wxT
(
"openCol"
),
wxT
(
"openEm"
),
wxT
(
"openEm"
),
wxT
(
"?????"
)
wxT
(
"?????"
)
}
}
#endif
#endif
;
;
/* Autres bits: bits du membre .Flag des Pins */
/* Autres bits: bits du membre .Flag des Pins */
#define PINNOTDRAW 1
/* si 1: pin invisible */
#define PINNOTDRAW 1
/* si 1: pin invisible */
typedef
enum
{
/* Forme des Pins */
typedef
enum
{
/* Forme des Pins */
NONE
=
0
,
NONE
=
0
,
INVERT
=
1
,
INVERT
=
1
,
CLOCK
=
2
,
CLOCK
=
2
,
LOWLEVEL_IN
=
4
,
LOWLEVEL_IN
=
4
,
LOWLEVEL_OUT
=
8
LOWLEVEL_OUT
=
8
}
DrawPinShape
;
}
DrawPinShape
;
typedef
enum
{
/* Orientation des Pins */
typedef
enum
{
/* Orientation des Pins */
PIN_RIGHT
=
'R'
,
PIN_RIGHT
=
'R'
,
PIN_LEFT
=
'L'
,
PIN_LEFT
=
'L'
,
PIN_UP
=
'U'
,
PIN_UP
=
'U'
,
PIN_DOWN
=
'D'
,
PIN_DOWN
=
'D'
,
}
DrawPinOrient
;
}
DrawPinOrient
;
/*************************************/
/*************************************/
/* Classe representant une librairie */
/* Classe representant une librairie */
...
@@ -133,25 +135,25 @@ typedef enum { /* Orientation des Pins */
...
@@ -133,25 +135,25 @@ typedef enum { /* Orientation des Pins */
class
LibraryStruct
class
LibraryStruct
{
{
public
:
public
:
int
m_Type
;
/* type indicator */
int
m_Type
;
/* type indicator */
wxString
m_Name
;
/* Name of library loaded. */
wxString
m_Name
;
/* Name of library loaded. */
wxString
m_FullFileName
;
/* Full File Name (with path) of library loaded. */
wxString
m_FullFileName
;
/* Full File Name (with path) of library loaded. */
wxString
m_Header
;
/* first line of library loaded. */
wxString
m_Header
;
/* first line of library loaded. */
int
m_NumOfParts
;
/* Number of parts this library has. */
int
m_NumOfParts
;
/* Number of parts this library has. */
PriorQue
*
m_Entries
;
/* Parts themselves are saved here. */
PriorQue
*
m_Entries
;
/* Parts themselves are saved here. */
LibraryStruct
*
m_Pnext
;
/* Point on next lib in chain. */
LibraryStruct
*
m_Pnext
;
/* Point on next lib in chain. */
int
m_Modified
;
/* flag indicateur d'edition */
int
m_Modified
;
/* flag indicateur d'edition */
int
m_Size
;
// Size in bytes (for statistics)
int
m_Size
;
// Size in bytes (for statistics)
unsigned
long
m_TimeStamp
;
// Signature temporelle
unsigned
long
m_TimeStamp
;
// Signature temporelle
int
m_Flags
;
// variable used in some functions
int
m_Flags
;
// variable used in some functions
bool
m_IsLibCache
;
// False for the "standard" libraries,
bool
m_IsLibCache
;
// False for the "standard" libraries,
// True for the library cache
// True for the library cache
public
:
public
:
LibraryStruct
(
int
type
,
const
wxString
&
name
,
const
wxString
&
fullname
);
LibraryStruct
(
int
type
,
const
wxString
&
name
,
const
wxString
&
fullname
);
~
LibraryStruct
();
~
LibraryStruct
();
bool
WriteHeader
(
FILE
*
file
);
bool
WriteHeader
(
FILE
*
file
);
bool
ReadHeader
(
FILE
*
file
,
int
*
LineNum
);
bool
ReadHeader
(
FILE
*
file
,
int
*
LineNum
);
};
};
...
@@ -161,252 +163,260 @@ public:
...
@@ -161,252 +163,260 @@ public:
/* class LibEDA_BaseStruct : Basic class for items used in a library component
/* class LibEDA_BaseStruct : Basic class for items used in a library component
(graphic shapes, texts, fields, pins)
*
(graphic shapes, texts, fields, pins)
*/
*/
class
LibEDA_BaseStruct
:
public
EDA_BaseStruct
class
LibEDA_BaseStruct
:
public
EDA_BaseStruct
{
{
public
:
public
:
int
m_Unit
;
/* Unit identification (for multi part per parkage)
int
m_Unit
;
/* Unit identification (for multi part per parkage)
0 if the item is common to all units */
*
0 if the item is common to all units */
int
m_Convert
;
/* Shape identification (for parts which have a convert shape)
int
m_Convert
;
/* Shape identification (for parts which have a convert shape)
0 if the item is common to all shapes */
*
0 if the item is common to all shapes */
wxPoint
m_Pos
;
/* Position or centre (Arc and Circle) or start point (segments) */
wxPoint
m_Pos
;
/* Position or centre (Arc and Circle) or start point (segments) */
int
m_Width
;
/* Width of draw lines */
int
m_Width
;
/* Width of draw lines */
public
:
public
:
LibEDA_BaseStruct
*
Next
(
void
)
{
return
(
LibEDA_BaseStruct
*
)
Pnext
;}
LibEDA_BaseStruct
*
Next
(
void
)
LibEDA_BaseStruct
(
int
struct_type
);
{
virtual
~
LibEDA_BaseStruct
(
void
){}
return
(
LibEDA_BaseStruct
*
)
Pnext
;
void
Display_Infos_DrawEntry
(
WinEDA_DrawFrame
*
frame
);
}
LibEDA_BaseStruct
(
KICAD_T
struct_type
);
virtual
~
LibEDA_BaseStruct
(
void
)
{
}
void
Display_Infos_DrawEntry
(
WinEDA_DrawFrame
*
frame
);
};
};
class
LibDrawPin
:
public
LibEDA_BaseStruct
class
LibDrawPin
:
public
LibEDA_BaseStruct
{
{
public
:
public
:
int
m_PinLen
;
/* Pin lenght */
int
m_PinLen
;
/* Pin lenght */
int
m_Orient
;
/* Pin orientation (Up, Down, Left, Right) */
int
m_Orient
;
/* Pin orientation (Up, Down, Left, Right) */
int
m_PinShape
;
/* Bitwise ORed: Pin shape (see enum DrawPinShape) */
int
m_PinShape
;
/* Bitwise ORed: Pin shape (see enum DrawPinShape) */
int
m_PinType
;
/* Electrical pin properties */
int
m_PinType
;
/* Electrical pin properties */
int
m_Attributs
;
/* bit 0 != 0: pin invisible */
int
m_Attributs
;
/* bit 0 != 0: pin invisible */
long
m_PinNum
;
/* Pin number: 4 Ascii code like "12" or "anod" or "G6"
long
m_PinNum
;
/* Pin number: 4 Ascii code like "12" or "anod" or "G6"
"12" is really "12\0\0"*/
* "12" is really "12\0\0"*/
wxString
m_PinName
;
wxString
m_PinName
;
int
m_PinNumSize
,
m_PinNameSize
;
/* Pin num and Pin name sizes */
int
m_PinNumSize
,
m_PinNameSize
;
/* Pin num and Pin name sizes */
// short m_PinNumWidth, m_PinNameWidth; /* (Unused) Pin num and Pin name text width */
// short m_PinNumWidth, m_PinNameWidth; /* (Unused) Pin num and Pin name text width */
public
:
public
:
LibDrawPin
(
void
);
LibDrawPin
(
void
);
~
LibDrawPin
(
void
)
{}
~
LibDrawPin
(
void
)
{
}
LibDrawPin
*
GenCopy
(
void
);
LibDrawPin
*
GenCopy
(
void
);
bool
WriteDescr
(
FILE
*
File
);
bool
WriteDescr
(
FILE
*
File
);
void
Display_Infos
(
WinEDA_DrawFrame
*
frame
);
void
Display_Infos
(
WinEDA_DrawFrame
*
frame
);
wxPoint
ReturnPinEndPoint
(
void
);
wxPoint
ReturnPinEndPoint
(
void
);
int
ReturnPinDrawOrient
(
int
TransMat
[
2
][
2
]);
int
ReturnPinDrawOrient
(
int
TransMat
[
2
][
2
]
);
void
ReturnPinStringNum
(
wxString
&
buffer
);
void
ReturnPinStringNum
(
wxString
&
buffer
);
void
SetPinNumFromString
(
wxString
&
buffer
);
void
SetPinNumFromString
(
wxString
&
buffer
);
void
DrawPinSymbol
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
pin_pos
,
int
orient
,
void
DrawPinSymbol
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
pin_pos
,
int
DrawMode
,
int
Color
=
-
1
);
int
orient
,
int
DrawMode
,
int
Color
=
-
1
);
void
DrawPinTexts
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
wxPoint
&
pin_pos
,
int
orient
,
void
DrawPinTexts
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
int
TextInside
,
bool
DrawPinNum
,
bool
DrawPinName
,
wxPoint
&
pin_pos
,
int
orient
,
int
Color
,
int
DrawMode
);
int
TextInside
,
bool
DrawPinNum
,
bool
DrawPinName
,
void
PlotPinTexts
(
wxPoint
&
pin_pos
,
int
orient
,
int
Color
,
int
DrawMode
);
int
TextInside
,
bool
DrawPinNum
,
bool
DrawPinName
);
void
PlotPinTexts
(
wxPoint
&
pin_pos
,
int
orient
,
int
TextInside
,
bool
DrawPinNum
,
bool
DrawPinName
);
};
};
class
LibDrawArc
:
public
LibEDA_BaseStruct
class
LibDrawArc
:
public
LibEDA_BaseStruct
{
{
public
:
public
:
int
m_Rayon
;
int
m_Rayon
;
int
m_Fill
;
int
m_Fill
;
int
t1
,
t2
;
/* position des 2 extremites de l'arc en 0,1 degres */
int
t1
,
t2
;
/* position des 2 extremites de l'arc en 0,1 degres */
wxPoint
m_ArcStart
,
m_ArcEnd
;
/* position des 2 extremites de l'arc en coord reelles*/
wxPoint
m_ArcStart
,
m_ArcEnd
;
/* position des 2 extremites de l'arc en coord reelles*/
public
:
public
:
LibDrawArc
(
void
);
LibDrawArc
(
void
);
~
LibDrawArc
(
void
){
}
~
LibDrawArc
(
void
)
{
}
LibDrawArc
*
GenCopy
(
void
);
LibDrawArc
*
GenCopy
(
void
);
bool
WriteDescr
(
FILE
*
File
);
bool
WriteDescr
(
FILE
*
File
);
};
};
class
LibDrawCircle
:
public
LibEDA_BaseStruct
class
LibDrawCircle
:
public
LibEDA_BaseStruct
{
{
public
:
public
:
int
m_Rayon
;
int
m_Rayon
;
int
m_Fill
;
int
m_Fill
;
public
:
public
:
LibDrawCircle
(
void
);
LibDrawCircle
(
void
);
~
LibDrawCircle
(
void
){
}
~
LibDrawCircle
(
void
)
{
}
LibDrawCircle
*
GenCopy
(
void
);
LibDrawCircle
*
GenCopy
(
void
);
bool
WriteDescr
(
FILE
*
File
);
bool
WriteDescr
(
FILE
*
File
);
};
};
class
LibDrawText
:
public
LibEDA_BaseStruct
class
LibDrawText
:
public
LibEDA_BaseStruct
{
{
public
:
public
:
int
m_Horiz
;
int
m_Horiz
;
wxSize
m_Size
;
wxSize
m_Size
;
int
m_Type
;
int
m_Type
;
wxString
m_Text
;
wxString
m_Text
;
public
:
public
:
LibDrawText
(
void
);
LibDrawText
(
void
);
~
LibDrawText
(
void
){
}
~
LibDrawText
(
void
)
{
}
LibDrawText
*
GenCopy
(
void
);
LibDrawText
*
GenCopy
(
void
);
bool
WriteDescr
(
FILE
*
File
);
bool
WriteDescr
(
FILE
*
File
);
};
};
class
LibDrawSquare
:
public
LibEDA_BaseStruct
class
LibDrawSquare
:
public
LibEDA_BaseStruct
{
{
public
:
public
:
wxPoint
m_End
;
wxPoint
m_End
;
int
m_Fill
;
int
m_Fill
;
public
:
public
:
LibDrawSquare
(
void
);
LibDrawSquare
(
void
);
~
LibDrawSquare
(
void
){
}
~
LibDrawSquare
(
void
)
{
}
LibDrawSquare
*
GenCopy
(
void
);
LibDrawSquare
*
GenCopy
(
void
);
bool
WriteDescr
(
FILE
*
File
);
bool
WriteDescr
(
FILE
*
File
);
};
};
class
LibDrawSegment
:
public
LibEDA_BaseStruct
class
LibDrawSegment
:
public
LibEDA_BaseStruct
{
{
public
:
public
:
wxPoint
m_End
;
wxPoint
m_End
;
public
:
public
:
LibDrawSegment
(
void
);
LibDrawSegment
(
void
);
~
LibDrawSegment
(
void
){
}
~
LibDrawSegment
(
void
)
{
}
LibDrawSegment
*
GenCopy
(
void
);
LibDrawSegment
*
GenCopy
(
void
);
bool
WriteDescr
(
FILE
*
File
);
bool
WriteDescr
(
FILE
*
File
);
};
};
class
LibDrawPolyline
:
public
LibEDA_BaseStruct
class
LibDrawPolyline
:
public
LibEDA_BaseStruct
{
{
public
:
public
:
int
n
,
*
PolyList
;
int
n
,
*
PolyList
;
int
m_Fill
;
int
m_Fill
;
public
:
public
:
LibDrawPolyline
(
void
);
LibDrawPolyline
(
void
);
~
LibDrawPolyline
(
void
){
if
(
PolyList
)
free
(
PolyList
);}
~
LibDrawPolyline
(
void
)
{
LibDrawPolyline
*
GenCopy
(
void
);
if
(
PolyList
)
void
AddPoint
(
const
wxPoint
&
point
);
free
(
PolyList
);
bool
WriteDescr
(
FILE
*
File
);
}
LibDrawPolyline
*
GenCopy
(
void
);
void
AddPoint
(
const
wxPoint
&
point
);
bool
WriteDescr
(
FILE
*
File
);
};
};
/* Fields identiques aux fields des composants, pouvant etre predefinis en lib
/* Fields identiques aux fields des composants, pouvant etre predefinis en lib
2 Fields sont toujours presents : Prefix (U, IC..) et Name (74LS00..)*/
*
2 Fields sont toujours presents : Prefix (U, IC..) et Name (74LS00..)*/
class
LibDrawField
:
public
LibEDA_BaseStruct
class
LibDrawField
:
public
LibEDA_BaseStruct
{
{
public
:
public
:
int
m_FieldId
;
// 0 a 11
int
m_FieldId
;
// 0 a 11
// 0 = Name 1 = Valeur 2 .. 11 autres fields
// 0 = Name 1 = Valeur 2 .. 11 autres fields
wxPoint
m_Pos
;
wxPoint
m_Pos
;
wxSize
m_Size
;
wxSize
m_Size
;
int
m_Orient
;
/* Orientation */
int
m_Orient
;
/* Orientation */
int
m_Attributs
;
/* Attributs (Non visible ...) */
int
m_Attributs
;
/* Attributs (Non visible ...) */
int
m_HJustify
,
m_VJustify
;
/* Justifications Horiz et Vert du texte */
int
m_HJustify
,
m_VJustify
;
/* Justifications Horiz et Vert du texte */
wxString
m_Text
;
/* Field Data */
wxString
m_Text
;
/* Field Data */
wxString
m_Name
;
/* Field Name */
wxString
m_Name
;
/* Field Name */
public
:
public
:
LibDrawField
(
int
idfield
=
2
);
LibDrawField
(
int
idfield
=
2
);
~
LibDrawField
(
void
);
~
LibDrawField
(
void
);
LibDrawField
*
GenCopy
(
void
);
LibDrawField
*
GenCopy
(
void
);
void
Copy
(
LibDrawField
*
Target
);
void
Copy
(
LibDrawField
*
Target
);
bool
WriteDescr
(
FILE
*
File
);
bool
WriteDescr
(
FILE
*
File
);
};
};
/* classe de base de description des composants en librairie */
/* classe de base de description des composants en librairie */
class
LibCmpEntry
:
public
EDA_BaseStruct
class
LibCmpEntry
:
public
EDA_BaseStruct
{
{
public
:
public
:
LibrEntryType
Type
;
/* Type = ROOT;
LibrEntryType
Type
;
/* Type = ROOT;
= ALIAS pour struct LibraryAliasType */
*
= ALIAS pour struct LibraryAliasType */
LibDrawField
m_Name
;
// name (74LS00 ..) in lib ( = VALUE )
LibDrawField
m_Name
;
// name (74LS00 ..) in lib ( = VALUE )
wxString
m_Doc
;
/* ligne de documentation */
wxString
m_Doc
;
/* ligne de documentation */
wxString
m_KeyWord
;
/* liste des mots cles */
wxString
m_KeyWord
;
/* liste des mots cles */
wxString
m_DocFile
;
/* nom du fichier Doc Associe */
wxString
m_DocFile
;
/* nom du fichier Doc Associe */
LibrEntryOptions
m_Options
;
// special features (i.e. Entry is a POWER)
LibrEntryOptions
m_Options
;
// special features (i.e. Entry is a POWER)
public
:
public
:
LibCmpEntry
(
LibrEntryType
CmpType
,
const
wxChar
*
CmpName
);
LibCmpEntry
(
LibrEntryType
CmpType
,
const
wxChar
*
CmpName
);
virtual
~
LibCmpEntry
(
void
);
virtual
~
LibCmpEntry
(
void
);
bool
WriteDescr
(
FILE
*
File
);
bool
WriteDescr
(
FILE
*
File
);
};
};
class
EDA_LibComponentStruct
:
public
LibCmpEntry
/* composant "racine" */
class
EDA_LibComponentStruct
:
public
LibCmpEntry
/* composant "racine" */
{
{
public
:
public
:
LibDrawField
m_Prefix
;
/* Prefix ( U, IC ... ) = REFERENCE */
LibDrawField
m_Prefix
;
/* Prefix ( U, IC ... ) = REFERENCE */
wxArrayString
m_AliasList
;
/* ALIAS list for the component */
wxArrayString
m_AliasList
;
/* ALIAS list for the component */
wxArrayString
m_FootprintList
;
/* list of suitable footprint names for the component (wildcard names accepted)*/
wxArrayString
m_FootprintList
;
/* list of suitable footprint names for the component (wildcard names accepted)*/
int
m_UnitCount
;
/* Units (or sections) per package */
int
m_UnitCount
;
/* Units (or sections) per package */
bool
m_UnitSelectionLocked
;
// True if units are differents and their selection is locked
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
// (i.e. if part A cannot be automatically changed in part B
int
m_TextInside
;
/* if 0: pin name drawn on the pin itself
int
m_TextInside
;
/* if 0: pin name drawn on the pin itself
if > 0 pin name drawn inside the component,
*
if > 0 pin name drawn inside the component,
with a distance of m_TextInside in mils */
*
with a distance of m_TextInside in mils */
bool
m_DrawPinNum
;
bool
m_DrawPinNum
;
bool
m_DrawPinName
;
bool
m_DrawPinName
;
LibDrawField
*
Fields
;
/* Auxiliairy Field list (id = 2 a 11*/
LibDrawField
*
Fields
;
/* Auxiliairy Field list (id = 2 a 11*/
LibEDA_BaseStruct
*
m_Drawings
;
/* How to draw this part */
LibEDA_BaseStruct
*
m_Drawings
;
/* How to draw this part */
long
m_LastDate
;
// Last change Date
long
m_LastDate
;
// Last change Date
public
:
public
:
EDA_LibComponentStruct
(
const
wxChar
*
CmpName
);
EDA_LibComponentStruct
(
const
wxChar
*
CmpName
);
EDA_Rect
GetBoundaryBox
(
int
Unit
,
int
Convert
);
/* return Box around the part. */
EDA_Rect
GetBoundaryBox
(
int
Unit
,
int
Convert
);
/* return Box around the part. */
~
EDA_LibComponentStruct
(
void
);
void
SortDrawItems
(
void
);
~
EDA_LibComponentStruct
(
void
);
void
SortDrawItems
(
void
);
};
};
class
EDA_LibCmpAliasStruct
:
public
LibCmpEntry
class
EDA_LibCmpAliasStruct
:
public
LibCmpEntry
{
{
public
:
public
:
wxString
m_RootName
;
/* Part name pour le composant de reference */
wxString
m_RootName
;
/* Part name pour le composant de reference */
public
:
public
:
EDA_LibCmpAliasStruct
(
const
wxChar
*
CmpName
,
const
wxChar
*
CmpRootName
);
EDA_LibCmpAliasStruct
(
const
wxChar
*
CmpName
,
const
wxChar
*
CmpRootName
);
~
EDA_LibCmpAliasStruct
(
void
);
~
EDA_LibCmpAliasStruct
(
void
);
};
};
/* Variables */
/* Variables */
extern
LibraryStruct
*
LibraryList
;
/* All part libs are saved here. */
extern
LibraryStruct
*
LibraryList
;
/* All part libs are saved here. */
/* Variables Utiles pour les editions de composants en librairie */
/* Variables Utiles pour les editions de composants en librairie */
eda_global
LibEDA_BaseStruct
*
LibItemToRepeat
;
/* pointeur sur l'lment que l'on
eda_global
LibEDA_BaseStruct
*
LibItemToRepeat
;
/* pointeur sur l'lment que l'on
peut rpter (Pin..;) */
*
peut rpter (Pin..;) */
eda_global
LibraryStruct
*
CurrentLib
;
/* Pointeur sur la librairie du
eda_global
LibraryStruct
*
CurrentLib
;
/* Pointeur sur la librairie du
composant en cours d'edition */
*
composant en cours d'edition */
eda_global
EDA_LibComponentStruct
*
CurrentLibEntry
;
/* pointeur sur le composant en
eda_global
EDA_LibComponentStruct
*
CurrentLibEntry
;
/* pointeur sur le composant en
cours d'edition */
*
cours d'edition */
eda_global
LibEDA_BaseStruct
*
CurrentDrawItem
;
/* pointeur sur les
eda_global
LibEDA_BaseStruct
*
CurrentDrawItem
;
/* pointeur sur les
elements de dessin du comp. en edition */
*
elements de dessin du comp. en edition */
eda_global
wxString
CurrentAliasName
;
// Nom de l'alias selectionn
eda_global
wxString
CurrentAliasName
;
// Nom de l'alias selectionn
eda_global
bool
g_AsDeMorgan
;
// Pour libedit:
eda_global
bool
g_AsDeMorgan
;
// Pour libedit:
eda_global
int
CurrentUnit
eda_global
int
CurrentUnit
#ifdef MAIN
#ifdef MAIN
=
1
=
1
#endif
#endif
;
;
eda_global
int
CurrentConvert
/* Convert = 1 .. 255 */
eda_global
int
CurrentConvert
/* Convert = 1 .. 255 */
#ifdef MAIN
#ifdef MAIN
=
1
=
1
#endif
#endif
;
;
eda_global
wxString
FindLibName
;
/* nom de la librairie ou a ete trouve le
eda_global
wxString
FindLibName
;
/* nom de la librairie ou a ete trouve le
dernier composant recherche par FindLibPart() */
*
dernier composant recherche par FindLibPart() */
#endif // LIBCMP_H
#endif // LIBCMP_H
eeschema/libframe.cpp
View file @
f3c324d5
...
@@ -543,6 +543,7 @@ wxClientDC dc(DrawPanel);
...
@@ -543,6 +543,7 @@ wxClientDC dc(DrawPanel);
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
EditSymbolText
(
&
dc
,
CurrentDrawItem
);
EditSymbolText
(
&
dc
,
CurrentDrawItem
);
break
;
break
;
default
:
;
}
}
DrawPanel
->
CursorOn
(
&
dc
);
DrawPanel
->
CursorOn
(
&
dc
);
}
}
...
...
eeschema/locate.cpp
View file @
f3c324d5
...
@@ -839,6 +839,9 @@ int seuil;
...
@@ -839,6 +839,9 @@ int seuil;
return
(
DrawItem
);
/* Texte trouve */
return
(
DrawItem
);
/* Texte trouve */
}
}
break
;
break
;
default
:
;
}
}
}
}
return
(
NULL
);
return
(
NULL
);
...
...
eeschema/plot.cpp
View file @
f3c324d5
...
@@ -290,6 +290,9 @@ wxPoint pos;
...
@@ -290,6 +290,9 @@ wxPoint pos;
MyFree
(
Poly
);
MyFree
(
Poly
);
}
}
break
;
break
;
default
:
;
}
/* Fin Switch */
}
/* Fin Switch */
Plume
(
'U'
);
Plume
(
'U'
);
}
/* Fin Boucle de dessin */
}
/* Fin Boucle de dessin */
...
...
eeschema/program.h
View file @
f3c324d5
/********************************************/
/********************************************/
/* Definitions for the EESchema program: */
/* Definitions for the EESchema program: */
/********************************************/
/********************************************/
#ifndef PROGRAM_H
#ifndef PROGRAM_H
#define PROGRAM_H
#define PROGRAM_H
...
@@ -15,9 +15,9 @@
...
@@ -15,9 +15,9 @@
#include "component_class.h"
#include "component_class.h"
#include "class_screen.h"
#include "class_screen.h"
#define DRAWJUNCTION_SIZE
16
/* Rayon du symbole connexion */
#define DRAWJUNCTION_SIZE
16
/* Rayon du symbole connexion */
#define DRAWMARKER_SIZE
16
/* Rayon du symbole marqueur */
#define DRAWMARKER_SIZE
16
/* Rayon du symbole marqueur */
#define DRAWNOCONNECT_SIZE 48
/* Rayon du symbole No Connexion */
#define DRAWNOCONNECT_SIZE 48
/* Rayon du symbole No Connexion */
#define HIGHLIGHT_COLOR WHITE
#define HIGHLIGHT_COLOR WHITE
...
@@ -26,161 +26,191 @@
...
@@ -26,161 +26,191 @@
/* flags pour BUS ENTRY (bus to bus ou wire to bus */
/* flags pour BUS ENTRY (bus to bus ou wire to bus */
#define WIRE_TO_BUS 0
#define WIRE_TO_BUS 0
#define BUS_TO_BUS 1
#define BUS_TO_BUS
1
typedef
enum
{
/* Type des Marqueurs */
typedef
enum
{
/* Type des Marqueurs */
MARQ_UNSPEC
,
MARQ_UNSPEC
,
MARQ_ERC
,
MARQ_ERC
,
MARQ_PCB
,
MARQ_PCB
,
MARQ_SIMUL
,
MARQ_SIMUL
,
MARQ_NMAX
/* Derniere valeur: fin de tableau */
MARQ_NMAX
/* Derniere valeur: fin de tableau */
}
TypeMarker
;
}
TypeMarker
;
/* Messages correspondants aux types des marqueurs */
/* Messages correspondants aux types des marqueurs */
#ifdef MAIN
#ifdef MAIN
const
wxChar
*
NameMarqueurType
[]
=
const
wxChar
*
NameMarqueurType
[]
=
{
{
wxT
(
""
),
wxT
(
""
),
wxT
(
"ERC"
),
wxT
(
"ERC"
),
wxT
(
"PCB"
),
wxT
(
"PCB"
),
wxT
(
"SIMUL"
),
wxT
(
"SIMUL"
),
wxT
(
"?????"
)
wxT
(
"?????"
)
};
};
#else
#else
extern
const
wxChar
*
NameMarqueurType
[];
extern
const
wxChar
*
NameMarqueurType
[];
#endif
#endif
/* Forward declarations */
/* Forward declarations */
class
DrawSheetStruct
;
class
DrawSheetStruct
;
class
EDA_DrawLineStruct
:
public
EDA_BaseLineStruct
/* Segment decription
base class to describe items which have 2 end points (track, wire, draw line ...) */
/**
* Class EDA_DrawLineStruct
* is a segment decription base class to describe items which have 2 end
* points (track, wire, draw line ...)
*/
class
EDA_DrawLineStruct
:
public
EDA_BaseStruct
{
{
public
:
public
:
bool
m_StartIsDangling
,
m_EndIsDangling
;
// TRUE si Start ou End not connected (wires, tracks...)
int
m_Layer
;
// Layer number
int
m_Width
;
// 0 = line, > 0 = tracks, bus ...
wxPoint
m_Start
;
// Line start point
wxPoint
m_End
;
// Line end point
bool
m_StartIsDangling
;
bool
m_EndIsDangling
;
// TRUE si Start ou End not connected (wires, tracks...)
public
:
public
:
EDA_DrawLineStruct
(
const
wxPoint
&
pos
,
int
layer
);
EDA_DrawLineStruct
(
const
wxPoint
&
pos
,
int
layer
);
~
EDA_DrawLineStruct
(
void
)
{}
~
EDA_DrawLineStruct
(
void
)
{
}
bool
IsOneEndPointAt
(
const
wxPoint
&
pos
);
bool
IsOneEndPointAt
(
const
wxPoint
&
pos
);
EDA_DrawLineStruct
*
GenCopy
(
void
);
EDA_DrawLineStruct
*
GenCopy
(
void
);
bool
IsNull
(
void
)
{
bool
IsNull
(
void
)
return
(
m_Start
==
m_End
);
{
}
return
m_Start
==
m_End
;
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
}
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
};
};
class
DrawMarkerStruct
:
public
EDA_BaseStruct
/* marqueurs */
class
DrawMarkerStruct
:
public
EDA_BaseStruct
/* marqueurs */
{
{
public
:
public
:
wxPoint
m_Pos
;
/* XY coordinates of marker. */
wxPoint
m_Pos
;
/* XY coordinates of marker. */
TypeMarker
m_Type
;
TypeMarker
m_Type
;
int
m_MarkFlags
;
// complements d'information
int
m_MarkFlags
;
// complements d'information
wxString
m_Comment
;
/* Texte (commentaireassocie eventuel */
wxString
m_Comment
;
/* Texte (commentaireassocie eventuel */
public
:
public
:
DrawMarkerStruct
(
const
wxPoint
&
pos
,
const
wxString
&
text
);
DrawMarkerStruct
(
const
wxPoint
&
pos
,
const
wxString
&
text
);
~
DrawMarkerStruct
(
void
);
~
DrawMarkerStruct
(
void
);
DrawMarkerStruct
*
GenCopy
(
void
);
DrawMarkerStruct
*
GenCopy
(
void
);
wxString
GetComment
(
void
);
wxString
GetComment
(
void
);
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
};
};
class
DrawNoConnectStruct
:
public
EDA_BaseStruct
/* Symboles de non connexion */
class
DrawNoConnectStruct
:
public
EDA_BaseStruct
/* Symboles de non connexion */
{
{
public
:
public
:
wxPoint
m_Pos
;
/* XY coordinates of NoConnect. */
wxPoint
m_Pos
;
/* XY coordinates of NoConnect. */
public
:
public
:
DrawNoConnectStruct
(
const
wxPoint
&
pos
);
DrawNoConnectStruct
(
const
wxPoint
&
pos
);
~
DrawNoConnectStruct
(
void
)
{}
~
DrawNoConnectStruct
(
void
)
{
}
DrawNoConnectStruct
*
GenCopy
(
void
);
DrawNoConnectStruct
*
GenCopy
(
void
);
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
};
};
class
DrawBusEntryStruct
:
public
EDA_BaseStruct
/* Struct de descr 1 raccord
a 45 degres de BUS ou WIRE */
/**
* Class DrawBusEntryStruct
* Struct de descr 1 raccord a 45 degres de BUS ou WIRE
*/
class
DrawBusEntryStruct
:
public
EDA_BaseStruct
{
{
public
:
public
:
int
m_Layer
;
int
m_Layer
;
int
m_Width
;
int
m_Width
;
wxPoint
m_Pos
;
wxPoint
m_Pos
;
wxSize
m_Size
;
wxSize
m_Size
;
public
:
public
:
DrawBusEntryStruct
(
const
wxPoint
&
pos
,
int
shape
,
int
id
);
DrawBusEntryStruct
(
const
wxPoint
&
pos
,
int
shape
,
int
id
);
~
DrawBusEntryStruct
(
void
)
{}
~
DrawBusEntryStruct
(
void
)
{
}
DrawBusEntryStruct
*
GenCopy
(
void
);
DrawBusEntryStruct
*
GenCopy
(
void
);
wxPoint
m_End
(
void
);
// retourne la coord de fin du raccord
wxPoint
m_End
(
void
);
// retourne la coord de fin du raccord
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
};
};
class
DrawPolylineStruct
:
public
EDA_BaseStruct
/* Polyligne (serie de segments) */
class
DrawPolylineStruct
:
public
EDA_BaseStruct
/* Polyligne (serie de segments) */
{
{
public
:
public
:
int
m_Layer
;
int
m_Layer
;
int
m_Width
;
int
m_Width
;
int
m_NumOfPoints
;
/* Number of XY pairs in Points array. */
int
m_NumOfPoints
;
/* Number of XY pairs in Points array. */
int
*
m_Points
;
/* XY pairs that forms the polyline. */
int
*
m_Points
;
/* XY pairs that forms the polyline. */
public
:
public
:
DrawPolylineStruct
(
int
layer
);
DrawPolylineStruct
(
int
layer
);
~
DrawPolylineStruct
(
void
);
~
DrawPolylineStruct
(
void
);
DrawPolylineStruct
*
GenCopy
(
void
);
DrawPolylineStruct
*
GenCopy
(
void
);
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
};
};
class
DrawJunctionStruct
:
public
EDA_BaseStruct
class
DrawJunctionStruct
:
public
EDA_BaseStruct
{
{
public
:
public
:
int
m_Layer
;
int
m_Layer
;
wxPoint
m_Pos
;
/* XY coordinates of connection. */
wxPoint
m_Pos
;
/* XY coordinates of connection. */
public
:
public
:
DrawJunctionStruct
(
const
wxPoint
&
pos
);
DrawJunctionStruct
(
const
wxPoint
&
pos
);
~
DrawJunctionStruct
(
void
){}
~
DrawJunctionStruct
(
void
)
{
}
DrawJunctionStruct
*
GenCopy
(
void
);
DrawJunctionStruct
*
GenCopy
(
void
);
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
};
};
class
DrawTextStruct
:
public
EDA_BaseStruct
,
public
EDA_TextStruct
class
DrawTextStruct
:
public
EDA_BaseStruct
,
public
EDA_TextStruct
{
{
public
:
public
:
int
m_Layer
;
int
m_Layer
;
int
m_Shape
;
int
m_Shape
;
bool
m_IsDangling
;
// TRUE si non connect
bool
m_IsDangling
;
// TRUE si non connect
public
:
public
:
DrawTextStruct
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
const
wxString
&
text
=
wxEmptyString
);
DrawTextStruct
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
const
wxString
&
text
=
wxEmptyString
);
~
DrawTextStruct
(
void
)
{}
~
DrawTextStruct
(
void
)
{
}
DrawTextStruct
*
GenCopy
(
void
);
DrawTextStruct
*
GenCopy
(
void
);
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
void
SwapData
(
DrawTextStruct
*
copyitem
);
int
Color
=
-
1
);
virtual
void
Place
(
WinEDA_DrawFrame
*
frame
,
wxDC
*
DC
);
void
SwapData
(
DrawTextStruct
*
copyitem
);
virtual
void
Place
(
WinEDA_DrawFrame
*
frame
,
wxDC
*
DC
);
private
:
private
:
void
DrawAsText
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
);
void
DrawAsText
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
void
DrawAsLabel
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
);
int
draw_mode
,
int
Color
);
void
DrawAsGlobalLabel
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
);
void
DrawAsLabel
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
);
void
DrawAsGlobalLabel
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
);
};
};
class
DrawLabelStruct
:
public
DrawTextStruct
class
DrawLabelStruct
:
public
DrawTextStruct
{
{
public
:
public
:
DrawLabelStruct
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
const
wxString
&
text
=
wxEmptyString
);
DrawLabelStruct
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
const
wxString
&
text
=
wxEmptyString
);
~
DrawLabelStruct
(
void
)
{
}
~
DrawLabelStruct
(
void
)
{
}
};
};
class
DrawGlobalLabelStruct
:
public
DrawTextStruct
class
DrawGlobalLabelStruct
:
public
DrawTextStruct
{
{
public
:
public
:
DrawGlobalLabelStruct
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
const
wxString
&
text
=
wxEmptyString
);
DrawGlobalLabelStruct
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
~
DrawGlobalLabelStruct
(
void
)
{}
const
wxString
&
text
=
wxEmptyString
);
~
DrawGlobalLabelStruct
(
void
)
{
}
};
};
...
@@ -188,16 +218,15 @@ public:
...
@@ -188,16 +218,15 @@ public:
class
LayerStruct
class
LayerStruct
{
{
public
:
public
:
char
LayerNames
[
MAX_LAYERS
+
1
][
8
];
char
LayerNames
[
MAX_LAYERS
+
1
][
8
];
int
LayerColor
[
MAX_LAYERS
+
1
];
int
LayerColor
[
MAX_LAYERS
+
1
];
char
LayerStatus
[
MAX_LAYERS
+
1
];
char
LayerStatus
[
MAX_LAYERS
+
1
];
int
NumberOfLayers
;
int
NumberOfLayers
;
int
CurrentLayer
;
int
CurrentLayer
;
int
CurrentWidth
;
int
CurrentWidth
;
int
CommonColor
;
int
CommonColor
;
int
Flags
;
int
Flags
;
};
};
#endif
/* PROGRAM_H */
#endif
/* PROGRAM_H */
eeschema/symbdraw.cpp
View file @
f3c324d5
/*********************************************************************/
/*********************************************************************/
/* EESchema - symbdraw.cpp */
/* EESchema - symbdraw.cpp */
/* Create, move .. graphic shapes used to build and draw a component */
/* Create, move .. graphic shapes used to build and draw a component */
/* (lines, arcs .. */
/* (lines, arcs .. */
/*********************************************************************/
/*********************************************************************/
#include "fctsys.h"
#include "fctsys.h"
...
@@ -19,784 +19,833 @@
...
@@ -19,784 +19,833 @@
#include "id.h"
#include "id.h"
/* Routines locales */
/* Routines locales */
static
void
SymbolDisplayDraw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
static
void
SymbolDisplayDraw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
static
void
ComputeArc
(
LibDrawArc
*
DrawItem
,
wxPoint
ArcCentre
);
static
void
ComputeArc
(
LibDrawArc
*
DrawItem
,
wxPoint
ArcCentre
);
static
void
RedrawWhileMovingCursor
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
static
void
RedrawWhileMovingCursor
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
static
void
MoveLibDrawItemAt
(
LibEDA_BaseStruct
*
DrawItem
,
wxPoint
newpos
);
static
void
MoveLibDrawItemAt
(
LibEDA_BaseStruct
*
DrawItem
,
wxPoint
newpos
);
/* Variables locales */
/* Variables locales */
static
int
StateDrawArc
,
ArcStartX
,
ArcStartY
,
ArcEndX
,
ArcEndY
;
static
int
StateDrawArc
,
ArcStartX
,
ArcStartY
,
ArcEndX
,
ArcEndY
;
static
wxPoint
InitPosition
,
StartCursor
,
ItemPreviousPos
;
static
wxPoint
InitPosition
,
StartCursor
,
ItemPreviousPos
;
static
int
FlSymbol_Fill
=
NO_FILL
;
static
int
FlSymbol_Fill
=
NO_FILL
;
/************************************/
/************************************/
/* class WinEDA_PartPropertiesFrame */
/* class WinEDA_PartPropertiesFrame */
/************************************/
/************************************/
#include "dialog_cmp_graphic_properties.cpp"
#include "dialog_cmp_graphic_properties.cpp"
/************************************************************/
/************************************************************/
void
WinEDA_bodygraphics_PropertiesFrame
::
void
WinEDA_bodygraphics_PropertiesFrame
::
bodygraphics_PropertiesAccept
(
wxCommandEvent
&
event
)
bodygraphics_PropertiesAccept
(
wxCommandEvent
&
event
)
/************************************************************/
/************************************************************/
/* Update the current draw item
/* Update the current draw item
*/
*/
{
{
g_FlDrawSpecificConvert
=
m_CommonConvert
->
GetValue
()
?
FALSE
:
TRUE
;
g_FlDrawSpecificConvert
=
m_CommonConvert
->
GetValue
()
?
FALSE
:
TRUE
;
g_FlDrawSpecificUnit
=
m_CommonUnit
->
GetValue
()
?
FALSE
:
TRUE
;
g_FlDrawSpecificUnit
=
m_CommonUnit
->
GetValue
()
?
FALSE
:
TRUE
;
if
(
m_Filled
)
if
(
m_Filled
)
FlSymbol_Fill
=
m_Filled
->
GetSelection
();
FlSymbol_Fill
=
m_Filled
->
GetSelection
();
g_LibSymbolDefaultLineWidth
=
m_GraphicShapeWidthCtrl
->
GetValue
();
g_LibSymbolDefaultLineWidth
=
m_GraphicShapeWidthCtrl
->
GetValue
();
if
(
CurrentDrawItem
)
if
(
CurrentDrawItem
)
{
{
if
(
!
(
CurrentDrawItem
->
m_Flags
&
IS_NEW
)
)
// if IS_NEW, copy for undo is done before place
if
(
!
(
CurrentDrawItem
->
m_Flags
&
IS_NEW
)
)
// if IS_NEW, copy for undo is done before place
m_Parent
->
SaveCopyInUndoList
(
CurrentLibEntry
);
m_Parent
->
SaveCopyInUndoList
(
CurrentLibEntry
);
wxClientDC
dc
(
m_Parent
->
DrawPanel
);
wxClientDC
dc
(
m_Parent
->
DrawPanel
);
m_Parent
->
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
m_Parent
->
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
DrawLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
CurrentLibEntry
,
0
,
0
,
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
DrawLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
CurrentLibEntry
,
0
,
0
,
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
if
(
g_FlDrawSpecificUnit
)
CurrentDrawItem
->
m_Unit
=
CurrentUnit
;
else
CurrentDrawItem
->
m_Unit
=
0
;
if
(
g_FlDrawSpecificUnit
)
if
(
g_FlDrawSpecificConvert
)
CurrentDrawItem
->
m_Convert
=
CurrentConvert
;
CurrentDrawItem
->
m_Unit
=
CurrentUnit
;
else
CurrentDrawItem
->
m_Convert
=
0
;
else
if
(
m_Filled
)
CurrentDrawItem
->
m_Unit
=
0
;
{
if
(
g_FlDrawSpecificConvert
)
switch
(
CurrentDrawItem
->
m_StructType
)
CurrentDrawItem
->
m_Convert
=
CurrentConvert
;
{
else
case
COMPONENT_ARC_DRAW_TYPE
:
CurrentDrawItem
->
m_Convert
=
0
;
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
if
(
m_Filled
)
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Width
=
m_GraphicShapeWidthCtrl
->
GetValue
();
{
break
;
switch
(
CurrentDrawItem
->
m_StructType
)
{
case
COMPONENT_CIRCLE_DRAW_TYPE
:
case
COMPONENT_ARC_DRAW_TYPE
:
((
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
((
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Width
=
m_GraphicShapeWidthCtrl
->
GetValue
();
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Width
=
m_GraphicShapeWidthCtrl
->
GetValue
();
break
;
break
;
case
COMPONENT_RECT_DRAW_TYPE
:
case
COMPONENT_CIRCLE_DRAW_TYPE
:
((
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
(
(
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
((
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Width
=
m_GraphicShapeWidthCtrl
->
GetValue
();
(
(
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Width
=
m_GraphicShapeWidthCtrl
->
GetValue
();
break
;
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_RECT_DRAW_TYPE
:
((
LibDrawPolyline
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
(
(
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
((
LibDrawPolyline
*
)
CurrentDrawItem
)
->
m_Width
=
m_GraphicShapeWidthCtrl
->
GetValue
();
(
(
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Width
=
m_GraphicShapeWidthCtrl
->
GetValue
();
break
;
break
;
default
:
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
}
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
}
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
m_Width
=
m_GraphicShapeWidthCtrl
->
CurrentLibEntry
->
SortDrawItems
();
GetValue
();
break
;
m_Parent
->
m_CurrentScreen
->
SetModify
();
default
:
DrawLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
CurrentLibEntry
,
0
,
0
,
break
;
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
}
}
}
CurrentLibEntry
->
SortDrawItems
();
Close
();
m_Parent
->
m_CurrentScreen
->
SetModify
();
if
(
CurrentDrawItem
)
CurrentDrawItem
->
Display_Infos_DrawEntry
(
m_Parent
);
DrawLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
CurrentLibEntry
,
0
,
0
,
m_Parent
->
ReDrawPanel
();
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
}
Close
();
if
(
CurrentDrawItem
)
CurrentDrawItem
->
Display_Infos_DrawEntry
(
m_Parent
);
m_Parent
->
ReDrawPanel
();
}
}
/**********************************************************/
/**********************************************************/
void
WinEDA_LibeditFrame
::
EditGraphicSymbol
(
wxDC
*
DC
,
void
WinEDA_LibeditFrame
::
EditGraphicSymbol
(
wxDC
*
DC
,
LibEDA_BaseStruct
*
DrawItem
)
LibEDA_BaseStruct
*
DrawItem
)
/**********************************************************/
/**********************************************************/
/* Install the dialog box for editing a graphical item properties
/* Install the dialog box for editing a graphical item properties
*/
*/
{
{
if
(
DrawItem
==
NULL
)
return
;
if
(
DrawItem
==
NULL
)
return
;
WinEDA_bodygraphics_PropertiesFrame
*
frame
=
new
WinEDA_bodygraphics_PropertiesFrame
(
this
);
WinEDA_bodygraphics_PropertiesFrame
*
frame
=
new
WinEDA_bodygraphics_PropertiesFrame
(
this
);
frame
->
ShowModal
();
frame
->
Destroy
();
frame
->
ShowModal
();
frame
->
Destroy
();
}
}
/****************************************************************/
/****************************************************************/
static
void
AbortSymbolTraceOn
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
static
void
AbortSymbolTraceOn
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
/****************************************************************/
/****************************************************************/
{
{
StateDrawArc
=
0
;
StateDrawArc
=
0
;
Panel
->
ManageCurseur
=
NULL
;
Panel
->
ManageCurseur
=
NULL
;
Panel
->
ForceClose
ManageCurseur
=
NULL
;
Panel
->
ForceCloseManageCurseur
=
NULL
;
if
(
CurrentDrawItem
==
NULL
)
if
(
CurrentDrawItem
==
NULL
)
return
;
return
;
if
(
CurrentDrawItem
->
m_Flags
&
IS_NEW
)
if
(
CurrentDrawItem
->
m_Flags
&
IS_NEW
)
{
{
if
(
CurrentDrawItem
->
m_StructType
==
COMPONENT_ARC_DRAW_TYPE
)
if
(
CurrentDrawItem
->
m_StructType
==
COMPONENT_ARC_DRAW_TYPE
)
{
{
Panel
->
m_Parent
->
RedrawActiveWindow
(
DC
,
TRUE
);
Panel
->
m_Parent
->
RedrawActiveWindow
(
DC
,
TRUE
);
}
}
else
DrawLibraryDrawStruct
(
Panel
,
DC
,
CurrentLibEntry
,
0
,
0
,
else
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
DrawLibraryDrawStruct
(
Panel
,
DC
,
CurrentLibEntry
,
0
,
0
,
delete
CurrentDrawItem
;
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
)
;
}
delete
CurrentDrawItem
;
}
else
else
{
{
wxPoint
curpos
;
wxPoint
curpos
;
curpos
=
Panel
->
GetScreen
()
->
m_Curseur
;
curpos
=
Panel
->
GetScreen
()
->
m_Curseur
;
Panel
->
GetScreen
()
->
m_Curseur
=
StartCursor
;
Panel
->
GetScreen
()
->
m_Curseur
=
StartCursor
;
RedrawWhileMovingCursor
(
Panel
,
DC
,
TRUE
);
RedrawWhileMovingCursor
(
Panel
,
DC
,
TRUE
);
Panel
->
GetScreen
()
->
m_Curseur
=
curpos
;
Panel
->
GetScreen
()
->
m_Curseur
=
curpos
;
DrawLibraryDrawStruct
(
Panel
,
DC
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
Panel
,
DC
,
CurrentLibEntry
,
0
,
0
,
CurrentDrawItem
,
CurrentUnit
,
GR_DEFAULT_DRAWMODE
);
CurrentDrawItem
,
CurrentUnit
,
GR_DEFAULT_DRAWMODE
);
CurrentDrawItem
->
m_Flags
=
0
;
CurrentDrawItem
->
m_Flags
=
0
;
}
}
CurrentDrawItem
=
NULL
;
CurrentDrawItem
=
NULL
;
}
}
/*********************************************************************/
/*********************************************************************/
LibEDA_BaseStruct
*
WinEDA_LibeditFrame
::
CreateGraphicItem
(
wxDC
*
DC
)
LibEDA_BaseStruct
*
WinEDA_LibeditFrame
::
CreateGraphicItem
(
wxDC
*
DC
)
/*********************************************************************/
/*********************************************************************/
/* Routine de creation d'un nouvel element type LibraryDrawStruct
/* Routine de creation d'un nouvel element type LibraryDrawStruct
POLYLINE
*
POLYLINE
ARC
*
ARC
CIRCLE
*
CIRCLE
RECTANGLE
*
RECTANGLE
*/
*/
{
{
int
DrawType
;
int
DrawType
;
int
*
ptpoly
;
int
*
ptpoly
;
if
(
CurrentDrawItem
)
return
NULL
;
if
(
CurrentDrawItem
)
return
NULL
;
DrawPanel
->
m_IgnoreMouseEvents
=
TRUE
;
// Creation du nouvel element
DrawPanel
->
m_IgnoreMouseEvents
=
TRUE
;
switch
(
m_ID_current_state
)
{
// Creation du nouvel element
case
ID_LIBEDIT_BODY_LINE_BUTT
:
switch
(
m_ID_current_state
)
DrawType
=
COMPONENT_POLYLINE_DRAW_TYPE
;
{
break
;
case
ID_LIBEDIT_BODY_LINE_BUTT
:
DrawType
=
COMPONENT_POLYLINE_DRAW_TYPE
;
case
ID_LIBEDIT_BODY_ARC_BUTT
:
break
;
DrawType
=
COMPONENT_ARC_DRAW_TYPE
;
break
;
case
ID_LIBEDIT_BODY_ARC_BUTT
:
DrawType
=
COMPONENT_ARC_DRAW_TYPE
;
case
ID_LIBEDIT_BODY_CIRCLE_BUTT
:
break
;
DrawType
=
COMPONENT_CIRCLE_DRAW_TYPE
;
break
;
case
ID_LIBEDIT_BODY_CIRCLE_BUTT
:
DrawType
=
COMPONENT_CIRCLE_DRAW_TYPE
;
case
ID_LIBEDIT_BODY_RECT_BUTT
:
break
;
DrawType
=
COMPONENT_RECT_DRAW_TYPE
;
break
;
case
ID_LIBEDIT_BODY_RECT_BUTT
:
DrawType
=
COMPONENT_RECT_DRAW_TYPE
;
case
ID_LIBEDIT_BODY_TEXT_BUTT
:
break
;
DrawType
=
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
;
break
;
case
ID_LIBEDIT_BODY_TEXT_BUTT
:
DrawType
=
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
;
default
:
break
;
DisplayError
(
this
,
wxT
(
"SymbolBeginDrawItem Internal err: Id error"
));
return
NULL
;
default
:
}
DisplayError
(
this
,
wxT
(
"SymbolBeginDrawItem Internal err: Id error"
)
);
return
NULL
;
DrawPanel
->
ManageCurseur
=
SymbolDisplayDraw
;
}
DrawPanel
->
ForceCloseManageCurseur
=
AbortSymbolTraceOn
;
DrawPanel
->
ManageCurseur
=
SymbolDisplayDraw
;
switch
(
DrawType
)
DrawPanel
->
ForceCloseManageCurseur
=
AbortSymbolTraceOn
;
{
case
COMPONENT_ARC_DRAW_TYPE
:
switch
(
DrawType
)
{
{
LibDrawArc
*
Arc
=
new
LibDrawArc
();
case
COMPONENT_ARC_DRAW_TYPE
:
CurrentDrawItem
=
Arc
;
{
ArcStartX
=
ArcEndX
=
m_CurrentScreen
->
m_Curseur
.
x
;
LibDrawArc
*
Arc
=
new
LibDrawArc
();
ArcStartY
=
ArcEndY
=
-
m_CurrentScreen
->
m_Curseur
.
y
;
StateDrawArc
=
1
;
CurrentDrawItem
=
Arc
;
Arc
->
m_Fill
=
FlSymbol_Fill
;
ArcStartX
=
ArcEndX
=
m_CurrentScreen
->
m_Curseur
.
x
;
Arc
->
m_Width
=
g_LibSymbolDefaultLineWidth
;
ArcStartY
=
ArcEndY
=
-
m_CurrentScreen
->
m_Curseur
.
y
;
}
StateDrawArc
=
1
;
break
;
Arc
->
m_Fill
=
FlSymbol_Fill
;
Arc
->
m_Width
=
g_LibSymbolDefaultLineWidth
;
case
COMPONENT_CIRCLE_DRAW_TYPE
:
}
{
break
;
LibDrawCircle
*
Circle
=
new
LibDrawCircle
();
CurrentDrawItem
=
Circle
;
case
COMPONENT_CIRCLE_DRAW_TYPE
:
Circle
->
m_Pos
.
x
=
m_CurrentScreen
->
m_Curseur
.
x
;
{
Circle
->
m_Pos
.
y
=
-
m_CurrentScreen
->
m_Curseur
.
y
;
LibDrawCircle
*
Circle
=
new
LibDrawCircle
();
Circle
->
m_Fill
=
FlSymbol_Fill
;
Circle
->
m_Width
=
g_LibSymbolDefaultLineWidth
;
CurrentDrawItem
=
Circle
;
}
Circle
->
m_Pos
.
x
=
m_CurrentScreen
->
m_Curseur
.
x
;
break
;
Circle
->
m_Pos
.
y
=
-
m_CurrentScreen
->
m_Curseur
.
y
;
Circle
->
m_Fill
=
FlSymbol_Fill
;
case
COMPONENT_RECT_DRAW_TYPE
:
Circle
->
m_Width
=
g_LibSymbolDefaultLineWidth
;
{
}
LibDrawSquare
*
Square
=
new
LibDrawSquare
();
break
;
CurrentDrawItem
=
Square
;
Square
->
m_Pos
.
x
=
m_CurrentScreen
->
m_Curseur
.
x
;
case
COMPONENT_RECT_DRAW_TYPE
:
Square
->
m_Pos
.
y
=
-
m_CurrentScreen
->
m_Curseur
.
y
;
{
Square
->
m_End
=
Square
->
m_Pos
;
LibDrawSquare
*
Square
=
new
LibDrawSquare
();
Square
->
m_Fill
=
FlSymbol_Fill
;
Square
->
m_Width
=
g_LibSymbolDefaultLineWidth
;
CurrentDrawItem
=
Square
;
}
Square
->
m_Pos
.
x
=
m_CurrentScreen
->
m_Curseur
.
x
;
break
;
Square
->
m_Pos
.
y
=
-
m_CurrentScreen
->
m_Curseur
.
y
;
Square
->
m_End
=
Square
->
m_Pos
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
Square
->
m_Fill
=
FlSymbol_Fill
;
{
Square
->
m_Width
=
g_LibSymbolDefaultLineWidth
;
LibDrawPolyline
*
polyline
=
new
LibDrawPolyline
();
}
CurrentDrawItem
=
polyline
;
break
;
polyline
->
n
=
2
;
ptpoly
=
(
int
*
)
MyZMalloc
(
4
*
sizeof
(
int
));
case
COMPONENT_POLYLINE_DRAW_TYPE
:
polyline
->
PolyList
=
ptpoly
;
{
ptpoly
[
0
]
=
ptpoly
[
2
]
=
m_CurrentScreen
->
m_Curseur
.
x
;
LibDrawPolyline
*
polyline
=
new
LibDrawPolyline
();
ptpoly
[
1
]
=
ptpoly
[
3
]
=
-
m_CurrentScreen
->
m_Curseur
.
y
;
polyline
->
m_Fill
=
FlSymbol_Fill
;
CurrentDrawItem
=
polyline
;
polyline
->
m_Width
=
g_LibSymbolDefaultLineWidth
;
polyline
->
n
=
2
;
}
ptpoly
=
(
int
*
)
MyZMalloc
(
4
*
sizeof
(
int
)
);
break
;
polyline
->
PolyList
=
ptpoly
;
ptpoly
[
0
]
=
ptpoly
[
2
]
=
m_CurrentScreen
->
m_Curseur
.
x
;
case
COMPONENT_LINE_DRAW_TYPE
:
ptpoly
[
1
]
=
ptpoly
[
3
]
=
-
m_CurrentScreen
->
m_Curseur
.
y
;
{
polyline
->
m_Fill
=
FlSymbol_Fill
;
LibDrawSegment
*
Segment
=
new
LibDrawSegment
();
polyline
->
m_Width
=
g_LibSymbolDefaultLineWidth
;
CurrentDrawItem
=
Segment
;
}
Segment
->
m_Pos
.
x
=
m_CurrentScreen
->
m_Curseur
.
x
;
break
;
Segment
->
m_Pos
.
y
=
-
m_CurrentScreen
->
m_Curseur
.
y
;
Segment
->
m_End
=
Segment
->
m_Pos
;
case
COMPONENT_LINE_DRAW_TYPE
:
Segment
->
m_Width
=
g_LibSymbolDefaultLineWidth
;
{
}
LibDrawSegment
*
Segment
=
new
LibDrawSegment
();
break
;
CurrentDrawItem
=
Segment
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
Segment
->
m_Pos
.
x
=
m_CurrentScreen
->
m_Curseur
.
x
;
{
Segment
->
m_Pos
.
y
=
-
m_CurrentScreen
->
m_Curseur
.
y
;
LibDrawText
*
Text
=
new
LibDrawText
();
Segment
->
m_End
=
Segment
->
m_Pos
;
CurrentDrawItem
=
Text
;
Segment
->
m_Width
=
g_LibSymbolDefaultLineWidth
;
Text
->
m_Size
.
x
=
Text
->
m_Size
.
y
=
g_LastTextSize
;
}
Text
->
m_Horiz
=
g_LastTextOrient
;
break
;
Text
->
m_Pos
.
x
=
m_CurrentScreen
->
m_Curseur
.
x
;
Text
->
m_Pos
.
y
=
-
m_CurrentScreen
->
m_Curseur
.
y
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
EditSymbolText
(
NULL
,
Text
);
{
if
(
Text
->
m_Text
.
IsEmpty
()
)
LibDrawText
*
Text
=
new
LibDrawText
();
{
delete
Text
;
CurrentDrawItem
=
Text
;
CurrentDrawItem
=
NULL
;
Text
->
m_Size
.
x
=
Text
->
m_Size
.
y
=
g_LastTextSize
;
DrawPanel
->
ManageCurseur
=
NULL
;
Text
->
m_Horiz
=
g_LastTextOrient
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
Text
->
m_Pos
.
x
=
m_CurrentScreen
->
m_Curseur
.
x
;
}
Text
->
m_Pos
.
y
=
-
m_CurrentScreen
->
m_Curseur
.
y
;
else
EditSymbolText
(
NULL
,
Text
);
{
if
(
Text
->
m_Text
.
IsEmpty
()
)
StartMoveDrawSymbol
(
DC
);
{
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
delete
Text
;
Text
,
CurrentUnit
,
g_XorMode
);
CurrentDrawItem
=
NULL
;
}
DrawPanel
->
ManageCurseur
=
NULL
;
}
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
break
;
}
}
else
{
if
(
CurrentDrawItem
)
StartMoveDrawSymbol
(
DC
);
{
DrawLibraryDrawStruct
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
CurrentDrawItem
->
m_Flags
|=
IS_NEW
;
Text
,
CurrentUnit
,
g_XorMode
);
if
(
g_FlDrawSpecificUnit
)
CurrentDrawItem
->
m_Unit
=
CurrentUnit
;
}
if
(
g_FlDrawSpecificConvert
)
CurrentDrawItem
->
m_Convert
=
CurrentConvert
;
}
}
break
;
}
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
m_IgnoreMouseEvents
=
FALSE
;
if
(
CurrentDrawItem
)
{
return
CurrentDrawItem
;
CurrentDrawItem
->
m_Flags
|=
IS_NEW
;
if
(
g_FlDrawSpecificUnit
)
CurrentDrawItem
->
m_Unit
=
CurrentUnit
;
if
(
g_FlDrawSpecificConvert
)
CurrentDrawItem
->
m_Convert
=
CurrentConvert
;
}
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
m_IgnoreMouseEvents
=
FALSE
;
return
CurrentDrawItem
;
}
}
/********************************************************/
/********************************************************/
void
WinEDA_LibeditFrame
::
GraphicItemBeginDraw
(
wxDC
*
DC
)
void
WinEDA_LibeditFrame
::
GraphicItemBeginDraw
(
wxDC
*
DC
)
/********************************************************/
/********************************************************/
/* Routine de creation d'un nouvel element type LibraryDrawStruct
/* Routine de creation d'un nouvel element type LibraryDrawStruct
*/
*/
{
{
if
(
CurrentDrawItem
==
NULL
)
return
;
if
(
CurrentDrawItem
==
NULL
)
return
;
switch
(
CurrentDrawItem
->
m_StructType
)
{
switch
(
CurrentDrawItem
->
m_StructType
)
case
COMPONENT_ARC_DRAW_TYPE
:
{
if
(
StateDrawArc
==
1
)
case
COMPONENT_ARC_DRAW_TYPE
:
{
if
(
StateDrawArc
==
1
)
SymbolDisplayDraw
(
DrawPanel
,
DC
,
FALSE
);
{
StateDrawArc
=
2
;
SymbolDisplayDraw
(
DrawPanel
,
DC
,
FALSE
);
SymbolDisplayDraw
(
DrawPanel
,
DC
,
FALSE
);
StateDrawArc
=
2
;
break
;
SymbolDisplayDraw
(
DrawPanel
,
DC
,
FALSE
);
}
break
;
if
(
StateDrawArc
>
1
)
}
{
if
(
StateDrawArc
>
1
)
EndDrawGraphicItem
(
DC
);
{
return
;
EndDrawGraphicItem
(
DC
);
}
return
;
break
;
}
break
;
case
COMPONENT_CIRCLE_DRAW_TYPE
:
case
COMPONENT_RECT_DRAW_TYPE
:
case
COMPONENT_CIRCLE_DRAW_TYPE
:
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
case
COMPONENT_RECT_DRAW_TYPE
:
EndDrawGraphicItem
(
DC
);
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
return
;
EndDrawGraphicItem
(
DC
);
return
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
{
case
COMPONENT_POLYLINE_DRAW_TYPE
:
wxPoint
pos
=
m_CurrentScreen
->
m_Curseur
;
{
((
LibDrawPolyline
*
)
CurrentDrawItem
)
->
AddPoint
(
pos
);
wxPoint
pos
=
m_CurrentScreen
->
m_Curseur
;
}
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
AddPoint
(
pos
);
break
;
}
break
;
case
COMPONENT_LINE_DRAW_TYPE
:
break
;
case
COMPONENT_LINE_DRAW_TYPE
:
}
break
;
default
:
;
}
}
}
/**************************************************************************/
/**************************************************************************/
static
void
RedrawWhileMovingCursor
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
static
void
RedrawWhileMovingCursor
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
/**************************************************************************/
/**************************************************************************/
/* Redraw the graphoc shape while moving
/* Redraw the graphoc shape while moving
*/
*/
{
{
BASE_SCREEN
*
Screen
=
panel
->
m_Parent
->
m_CurrentScreen
;
BASE_SCREEN
*
Screen
=
panel
->
m_Parent
->
m_CurrentScreen
;
int
mx
,
my
;
int
mx
,
my
;
/* Erase shape in the old positon*/
/* Erase shape in the old positon*/
if
(
erase
)
if
(
erase
)
{
{
mx
=
ItemPreviousPos
.
x
-
StartCursor
.
x
,
mx
=
ItemPreviousPos
.
x
-
StartCursor
.
x
,
my
=
ItemPreviousPos
.
y
-
StartCursor
.
y
;
my
=
ItemPreviousPos
.
y
-
StartCursor
.
y
;
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
mx
,
my
,
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
mx
,
my
,
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
}
}
/* Redraw moved shape */
/* Redraw moved shape */
mx
=
Screen
->
m_Curseur
.
x
-
StartCursor
.
x
,
mx
=
Screen
->
m_Curseur
.
x
-
StartCursor
.
x
,
my
=
Screen
->
m_Curseur
.
y
-
StartCursor
.
y
;
my
=
Screen
->
m_Curseur
.
y
-
StartCursor
.
y
;
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
mx
,
my
,
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
mx
,
my
,
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
CurrentDrawItem
,
CurrentUnit
,
g_XorMode
);
ItemPreviousPos
=
Screen
->
m_Curseur
;
ItemPreviousPos
=
Screen
->
m_Curseur
;
}
}
/*****************************************************************/
/*****************************************************************/
void
MoveLibDrawItemAt
(
LibEDA_BaseStruct
*
DrawItem
,
wxPoint
newpos
)
void
MoveLibDrawItemAt
(
LibEDA_BaseStruct
*
DrawItem
,
wxPoint
newpos
)
/*****************************************************************/
/*****************************************************************/
{
{
int
mx
=
newpos
.
x
,
my
=
newpos
.
y
;
int
mx
=
newpos
.
x
,
my
=
newpos
.
y
;
wxSize
size
;
wxSize
size
;
switch
(
DrawItem
->
m_StructType
)
switch
(
DrawItem
->
m_StructType
)
{
{
case
COMPONENT_ARC_DRAW_TYPE
:
case
COMPONENT_ARC_DRAW_TYPE
:
{
{
int
dx
=
mx
-
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
x
;
int
dx
=
mx
-
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
x
;
int
dy
=
-
my
-
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
y
;
int
dy
=
-
my
-
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
y
;
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
x
=
mx
;
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
x
=
mx
;
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
y
=
-
my
;
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
y
=
-
my
;
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_ArcStart
.
x
+=
dx
;
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_ArcStart
.
x
+=
dx
;
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_ArcStart
.
y
+=
dy
;
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_ArcStart
.
y
+=
dy
;
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_ArcEnd
.
x
+=
dx
;
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_ArcEnd
.
x
+=
dx
;
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_ArcEnd
.
y
+=
dy
;
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_ArcEnd
.
y
+=
dy
;
break
;
break
;
}
}
case
COMPONENT_CIRCLE_DRAW_TYPE
:
case
COMPONENT_CIRCLE_DRAW_TYPE
:
((
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Pos
.
x
=
mx
;
(
(
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Pos
.
x
=
mx
;
((
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Pos
.
y
=
-
my
;
(
(
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Pos
.
y
=
-
my
;
break
;
break
;
case
COMPONENT_RECT_DRAW_TYPE
:
case
COMPONENT_RECT_DRAW_TYPE
:
size
.
x
=
((
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_End
.
x
-
size
.
x
=
(
(
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_End
.
x
-
((
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Pos
.
x
;
(
(
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Pos
.
x
;
size
.
y
=
((
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_End
.
y
-
size
.
y
=
(
(
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_End
.
y
-
((
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Pos
.
y
;
(
(
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Pos
.
y
;
((
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Pos
.
x
=
mx
;
(
(
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Pos
.
x
=
mx
;
((
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Pos
.
y
=
-
my
;
(
(
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Pos
.
y
=
-
my
;
((
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_End
.
x
=
mx
+
size
.
x
;
(
(
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_End
.
x
=
mx
+
size
.
x
;
((
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_End
.
y
=
-
my
+
size
.
y
;
(
(
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_End
.
y
=
-
my
+
size
.
y
;
break
;
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
{
{
int
ii
,
imax
=
((
LibDrawPolyline
*
)
CurrentDrawItem
)
->
n
*
2
;
int
ii
,
imax
=
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
n
*
2
;
int
*
ptpoly
=
((
LibDrawPolyline
*
)
CurrentDrawItem
)
->
PolyList
;
int
*
ptpoly
=
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
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
)
{
{
ptpoly
[
ii
]
+=
dx
;
ptpoly
[
ii
]
+=
dx
;
ptpoly
[
ii
+
1
]
+=
dy
;
ptpoly
[
ii
+
1
]
+=
dy
;
}
}
}
}
break
;
break
;
case
COMPONENT_LINE_DRAW_TYPE
:
case
COMPONENT_LINE_DRAW_TYPE
:
break
;
break
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
((
LibDrawText
*
)
CurrentDrawItem
)
->
m_Pos
.
x
=
mx
;
(
(
LibDrawText
*
)
CurrentDrawItem
)
->
m_Pos
.
x
=
mx
;
((
LibDrawText
*
)
CurrentDrawItem
)
->
m_Pos
.
y
=
-
my
;
(
(
LibDrawText
*
)
CurrentDrawItem
)
->
m_Pos
.
y
=
-
my
;
break
;
break
;
}
default
:
;
}
}
}
/************************************************************/
/************************************************************/
void
WinEDA_LibeditFrame
::
StartMoveDrawSymbol
(
wxDC
*
DC
)
void
WinEDA_LibeditFrame
::
StartMoveDrawSymbol
(
wxDC
*
DC
)
/************************************************************/
/************************************************************/
{
{
if
(
CurrentDrawItem
==
NULL
)
return
;
if
(
CurrentDrawItem
==
NULL
)
return
;
SetCursor
(
wxCURSOR_HAND
);
SetCursor
(
wxCURSOR_HAND
);
CurrentDrawItem
->
m_Flags
|=
IS_MOVED
;
CurrentDrawItem
->
m_Flags
|=
IS_MOVED
;
StartCursor
=
m_CurrentScreen
->
m_Curseur
;
StartCursor
=
m_CurrentScreen
->
m_Curseur
;
switch
(
CurrentDrawItem
->
m_StructType
)
switch
(
CurrentDrawItem
->
m_StructType
)
{
{
case
COMPONENT_ARC_DRAW_TYPE
:
case
COMPONENT_ARC_DRAW_TYPE
:
InitPosition
=
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
;
InitPosition
=
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
;
break
;
break
;
case
COMPONENT_CIRCLE_DRAW_TYPE
:
case
COMPONENT_CIRCLE_DRAW_TYPE
:
InitPosition
=
((
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Pos
;
InitPosition
=
(
(
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Pos
;
break
;
break
;
case
COMPONENT_RECT_DRAW_TYPE
:
case
COMPONENT_RECT_DRAW_TYPE
:
InitPosition
=
((
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Pos
;
InitPosition
=
(
(
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Pos
;
break
;
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
InitPosition
.
x
=
*
((
LibDrawPolyline
*
)
CurrentDrawItem
)
->
PolyList
;
InitPosition
.
x
=
*
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
PolyList
;
InitPosition
.
y
=
*
(((
LibDrawPolyline
*
)
CurrentDrawItem
)
->
PolyList
+
1
);
InitPosition
.
y
=
*
(
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
PolyList
+
1
);
break
;
break
;
case
COMPONENT_LINE_DRAW_TYPE
:
case
COMPONENT_LINE_DRAW_TYPE
:
break
;
break
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
InitPosition
=
((
LibDrawText
*
)
CurrentDrawItem
)
->
m_Pos
;
InitPosition
=
(
(
LibDrawText
*
)
CurrentDrawItem
)
->
m_Pos
;
break
;
break
;
}
ItemPreviousPos
=
m_CurrentScreen
->
m_Curseur
;
default
:
DrawPanel
->
ManageCurseur
=
RedrawWhileMovingCursor
;
;
DrawPanel
->
ForceCloseManageCurseur
=
AbortSymbolTraceOn
;
}
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
TRUE
);
}
ItemPreviousPos
=
m_CurrentScreen
->
m_Curseur
;
DrawPanel
->
ManageCurseur
=
RedrawWhileMovingCursor
;
DrawPanel
->
ForceCloseManageCurseur
=
AbortSymbolTraceOn
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
TRUE
);
}
/****************************************************************/
/****************************************************************/
/* Routine de Gestion des evenements souris lors de la creation */
/* Routine de Gestion des evenements souris lors de la creation */
/* d'un nouvel element type LibraryDrawStruct */
/* d'un nouvel element type LibraryDrawStruct */
/****************************************************************/
/****************************************************************/
static
void
SymbolDisplayDraw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
static
void
SymbolDisplayDraw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
{
{
int
DrawMode
=
g_XorMode
;
int
DrawMode
=
g_XorMode
;
int
*
ptpoly
;
int
*
ptpoly
;
int
dx
,
dy
;
int
dx
,
dy
;
BASE_SCREEN
*
Screen
=
panel
->
m_Parent
->
m_CurrentScreen
;
BASE_SCREEN
*
Screen
=
panel
->
m_Parent
->
m_CurrentScreen
;
int
mx
=
Screen
->
m_Curseur
.
x
,
int
mx
=
Screen
->
m_Curseur
.
x
,
my
=
Screen
->
m_Curseur
.
y
;
my
=
Screen
->
m_Curseur
.
y
;
GRSetDrawMode
(
DC
,
DrawMode
);
GRSetDrawMode
(
DC
,
DrawMode
);
if
(
erase
)
if
(
erase
)
{
{
if
(
StateDrawArc
==
1
)
if
(
StateDrawArc
==
1
)
{
{
int
Color
=
ReturnLayerColor
(
LAYER_DEVICE
);
int
Color
=
ReturnLayerColor
(
LAYER_DEVICE
);
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
ArcStartX
,
-
ArcStartY
,
ArcEndX
,
-
ArcEndY
,
0
,
Color
);
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
ArcStartX
,
-
ArcStartY
,
ArcEndX
,
-
ArcEndY
,
0
,
Color
);
}
}
else
else
{
{
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
0
,
0
,
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
0
,
0
,
CurrentDrawItem
,
CurrentUnit
,
DrawMode
);
CurrentDrawItem
,
CurrentUnit
,
DrawMode
);
if
(
CurrentDrawItem
->
m_StructType
==
COMPONENT_ARC_DRAW_TYPE
)
if
(
CurrentDrawItem
->
m_StructType
==
COMPONENT_ARC_DRAW_TYPE
)
{
{
int
Color
=
ReturnLayerColor
(
LAYER_DEVICE
);
int
Color
=
ReturnLayerColor
(
LAYER_DEVICE
);
GRDashedLine
(
&
panel
->
m_ClipBox
,
DC
,
ArcStartX
,
-
ArcStartY
,
GRDashedLine
(
&
panel
->
m_ClipBox
,
DC
,
ArcStartX
,
-
ArcStartY
,
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
x
,
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
x
,
-
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
y
,
-
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
y
,
0
,
Color
);
0
,
Color
);
GRDashedLine
(
&
panel
->
m_ClipBox
,
DC
,
ArcEndX
,
-
ArcEndY
,
GRDashedLine
(
&
panel
->
m_ClipBox
,
DC
,
ArcEndX
,
-
ArcEndY
,
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
x
,
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
x
,
-
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
y
,
-
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
y
,
0
,
Color
);
0
,
Color
);
}
}
}
}
}
}
switch
(
CurrentDrawItem
->
m_StructType
)
switch
(
CurrentDrawItem
->
m_StructType
)
{
{
case
COMPONENT_ARC_DRAW_TYPE
:
case
COMPONENT_ARC_DRAW_TYPE
:
if
(
StateDrawArc
==
1
)
if
(
StateDrawArc
==
1
)
{
{
ArcEndX
=
mx
;
ArcEndY
=
-
my
;
ArcEndX
=
mx
;
ArcEndY
=
-
my
;
}
}
if
(
StateDrawArc
==
2
)
if
(
StateDrawArc
==
2
)
{
{
ComputeArc
((
LibDrawArc
*
)
CurrentDrawItem
,
Screen
->
m_Curseur
);
ComputeArc
(
(
LibDrawArc
*
)
CurrentDrawItem
,
Screen
->
m_Curseur
);
}
}
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
break
;
break
;
case
COMPONENT_CIRCLE_DRAW_TYPE
:
case
COMPONENT_CIRCLE_DRAW_TYPE
:
dx
=
((
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Pos
.
x
-
mx
;
dx
=
(
(
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Pos
.
x
-
mx
;
dy
=
((
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Pos
.
y
+
my
;
dy
=
(
(
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Pos
.
y
+
my
;
((
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Rayon
=
(
int
)
sqrt
(
(
dx
*
dx
)
+
(
dy
*
dy
)
);
(
(
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Rayon
=
(
int
)
sqrt
(
(
dx
*
dx
)
+
(
dy
*
dy
)
);
((
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
(
(
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
break
;
break
;
case
COMPONENT_RECT_DRAW_TYPE
:
case
COMPONENT_RECT_DRAW_TYPE
:
((
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_End
.
x
=
mx
;
(
(
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_End
.
x
=
mx
;
((
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_End
.
y
=
-
my
;
(
(
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_End
.
y
=
-
my
;
((
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
(
(
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
break
;
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
ptpoly
=
((
LibDrawPolyline
*
)
CurrentDrawItem
)
->
PolyList
;
ptpoly
=
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
PolyList
;
ptpoly
+=
2
*
(((
LibDrawPolyline
*
)
CurrentDrawItem
)
->
n
-
1
);
ptpoly
+=
2
*
(
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
n
-
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
;
break
;
break
;
case
COMPONENT_LINE_DRAW_TYPE
:
case
COMPONENT_LINE_DRAW_TYPE
:
((
LibDrawSegment
*
)
CurrentDrawItem
)
->
m_End
.
x
=
mx
;
(
(
LibDrawSegment
*
)
CurrentDrawItem
)
->
m_End
.
x
=
mx
;
((
LibDrawSegment
*
)
CurrentDrawItem
)
->
m_End
.
y
=
-
my
;
(
(
LibDrawSegment
*
)
CurrentDrawItem
)
->
m_End
.
y
=
-
my
;
break
;
break
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
/* Traite par des routines specifiques */
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
/* Traite par des routines specifiques */
break
;
break
;
}
default
:
if
(
StateDrawArc
==
1
)
;
{
}
int
Color
=
ReturnLayerColor
(
LAYER_DEVICE
);
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
ArcStartX
,
-
ArcStartY
,
ArcEndX
,
-
ArcEndY
,
0
,
Color
);
if
(
StateDrawArc
==
1
)
}
{
else
int
Color
=
ReturnLayerColor
(
LAYER_DEVICE
);
{
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
ArcStartX
,
-
ArcStartY
,
ArcEndX
,
-
ArcEndY
,
0
,
Color
);
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
0
,
0
,
}
CurrentDrawItem
,
CurrentUnit
,
DrawMode
);
else
if
(
CurrentDrawItem
->
m_StructType
==
COMPONENT_ARC_DRAW_TYPE
)
{
{
DrawLibraryDrawStruct
(
panel
,
DC
,
CurrentLibEntry
,
0
,
0
,
int
Color
=
ReturnLayerColor
(
LAYER_DEVICE
);
CurrentDrawItem
,
CurrentUnit
,
DrawMode
);
GRDashedLine
(
&
panel
->
m_ClipBox
,
DC
,
ArcStartX
,
-
ArcStartY
,
if
(
CurrentDrawItem
->
m_StructType
==
COMPONENT_ARC_DRAW_TYPE
)
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
x
,
{
-
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
y
,
int
Color
=
ReturnLayerColor
(
LAYER_DEVICE
);
0
,
Color
);
GRDashedLine
(
&
panel
->
m_ClipBox
,
DC
,
ArcStartX
,
-
ArcStartY
,
GRDashedLine
(
&
panel
->
m_ClipBox
,
DC
,
ArcEndX
,
-
ArcEndY
,
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
x
,
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
x
,
-
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
y
,
-
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
y
,
0
,
Color
);
0
,
Color
);
GRDashedLine
(
&
panel
->
m_ClipBox
,
DC
,
ArcEndX
,
-
ArcEndY
,
}
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
x
,
}
-
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Pos
.
y
,
0
,
Color
);
}
}
}
}
/******************************************************/
/******************************************************/
void
WinEDA_LibeditFrame
::
EndDrawGraphicItem
(
wxDC
*
DC
)
void
WinEDA_LibeditFrame
::
EndDrawGraphicItem
(
wxDC
*
DC
)
/******************************************************/
/******************************************************/
/* Place la structure courante en liste des structures du composant
/* Place la structure courante en liste des structures du composant
courant, si elle existe et redessine toujours celle ci
*
courant, si elle existe et redessine toujours celle ci
Parametres: (tous globaux)
*
Parametres: (tous globaux)
CurrentDrawItem
*
CurrentDrawItem
CurrentLibEntry
*
CurrentLibEntry
*/
*/
{
{
if
(
CurrentLibEntry
==
NULL
)
return
;
if
(
CurrentLibEntry
==
NULL
)
if
(
CurrentDrawItem
==
NULL
)
return
;
return
;
if
(
CurrentDrawItem
==
NULL
)
if
(
CurrentDrawItem
->
m_StructType
==
COMPONENT_ARC_DRAW_TYPE
)
return
;
{
if
(
StateDrawArc
==
1
)
/* Trace d'arc en cours: doit etre termine */
if
(
CurrentDrawItem
->
m_StructType
==
COMPONENT_ARC_DRAW_TYPE
)
{
{
DisplayError
(
this
,
wxT
(
"Arc in progress.."
),
10
);
return
;
if
(
StateDrawArc
==
1
)
/* Trace d'arc en cours: doit etre termine */
}
{
else
DisplayError
(
this
,
wxT
(
"Arc in progress.."
),
10
);
return
;
{
}
if
(
(
CurrentDrawItem
->
m_Flags
&
IS_MOVED
)
==
0
)
else
SymbolDisplayDraw
(
DrawPanel
,
DC
,
FALSE
);
{
}
if
(
(
CurrentDrawItem
->
m_Flags
&
IS_MOVED
)
==
0
)
}
SymbolDisplayDraw
(
DrawPanel
,
DC
,
FALSE
);
}
StateDrawArc
=
0
;
}
if
(
CurrentDrawItem
->
m_Flags
&
IS_NEW
)
StateDrawArc
=
0
;
{
SaveCopyInUndoList
(
CurrentLibEntry
);
if
(
CurrentDrawItem
->
m_Flags
&
IS_NEW
)
CurrentDrawItem
->
Pnext
=
CurrentLibEntry
->
m_Drawings
;
{
CurrentLibEntry
->
m_Drawings
=
CurrentDrawItem
;
SaveCopyInUndoList
(
CurrentLibEntry
);
switch
(
CurrentDrawItem
->
m_StructType
)
CurrentDrawItem
->
Pnext
=
CurrentLibEntry
->
m_Drawings
;
{
CurrentLibEntry
->
m_Drawings
=
CurrentDrawItem
;
case
COMPONENT_ARC_DRAW_TYPE
:
((
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
switch
(
CurrentDrawItem
->
m_StructType
)
break
;
{
case
COMPONENT_ARC_DRAW_TYPE
:
case
COMPONENT_CIRCLE_DRAW_TYPE
:
(
(
LibDrawArc
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
((
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
break
;
break
;
case
COMPONENT_CIRCLE_DRAW_TYPE
:
case
COMPONENT_RECT_DRAW_TYPE
:
(
(
LibDrawCircle
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
((
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
break
;
break
;
case
COMPONENT_RECT_DRAW_TYPE
:
case
COMPONENT_POLYLINE_DRAW_TYPE
:
(
(
LibDrawSquare
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
((
LibDrawPolyline
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
break
;
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
case
COMPONENT_PIN_DRAW_TYPE
:
(
(
LibDrawPolyline
*
)
CurrentDrawItem
)
->
m_Fill
=
FlSymbol_Fill
;
case
COMPONENT_LINE_DRAW_TYPE
:
break
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
break
;
case
COMPONENT_PIN_DRAW_TYPE
:
}
case
COMPONENT_LINE_DRAW_TYPE
:
CurrentLibEntry
->
SortDrawItems
();
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
}
break
;
if
(
m_ID_current_state
)
SetCursor
(
wxCURSOR_PENCIL
);
default
:
else
SetCursor
(
wxCURSOR_ARROW
);
;
}
if
(
(
CurrentDrawItem
->
m_Flags
&
IS_MOVED
)
)
{
CurrentLibEntry
->
SortDrawItems
();
wxPoint
pos
;
}
pos
.
x
=
GetScreen
()
->
m_Curseur
.
x
+
InitPosition
.
x
-
StartCursor
.
x
,
pos
.
y
=
GetScreen
()
->
m_Curseur
.
y
-
InitPosition
.
y
-
StartCursor
.
y
;
if
(
m_ID_current_state
)
MoveLibDrawItemAt
(
CurrentDrawItem
,
pos
);
SetCursor
(
wxCURSOR_PENCIL
);
}
else
SetCursor
(
wxCURSOR_ARROW
);
DrawLibEntry
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
CurrentUnit
,
CurrentConvert
,
GR_DEFAULT_DRAWMODE
);
if
(
(
CurrentDrawItem
->
m_Flags
&
IS_MOVED
)
)
{
CurrentDrawItem
->
m_Flags
=
0
;
wxPoint
pos
;
CurrentDrawItem
=
NULL
;
pos
.
x
=
GetScreen
()
->
m_Curseur
.
x
+
InitPosition
.
x
-
StartCursor
.
x
,
pos
.
y
=
GetScreen
()
->
m_Curseur
.
y
-
InitPosition
.
y
-
StartCursor
.
y
;
m_CurrentScreen
->
SetModify
();
MoveLibDrawItemAt
(
CurrentDrawItem
,
pos
);
}
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
DrawLibEntry
(
DrawPanel
,
DC
,
CurrentLibEntry
,
0
,
0
,
CurrentUnit
,
CurrentConvert
,
GR_DEFAULT_DRAWMODE
);
CurrentDrawItem
->
m_Flags
=
0
;
CurrentDrawItem
=
NULL
;
m_CurrentScreen
->
SetModify
();
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
}
}
/***************************************************************/
/***************************************************************/
static
void
ComputeArc
(
LibDrawArc
*
DrawItem
,
wxPoint
ArcCentre
)
static
void
ComputeArc
(
LibDrawArc
*
DrawItem
,
wxPoint
ArcCentre
)
/***************************************************************/
/***************************************************************/
/* routine d'ajustage des parametres de l'arc en cours de trace
/* routine d'ajustage des parametres de l'arc en cours de trace
calcule le centre, rayon, angles pour que l'arc en cours
*
calcule le centre, rayon, angles pour que l'arc en cours
passe par les points ArcStartX,Y et ArcEndX,Y avec le centre le plus proche
*
passe par les points ArcStartX,Y et ArcEndX,Y avec le centre le plus proche
de la pos souris
*
de la pos souris
Remarque: le centre n'est evidemment pas sur la grille
*
Remarque: le centre n'est evidemment pas sur la grille
*/
*/
{
{
int
dx
,
dy
;
int
dx
,
dy
;
int
cX
,
cY
;
/* Coord centre de l'arc */
int
cX
,
cY
;
/* Coord centre de l'arc */
int
angle
;
int
angle
;
cX
=
ArcCentre
.
x
;
cY
=
ArcCentre
.
y
;
cX
=
ArcCentre
.
x
;
cY
=
ArcCentre
.
y
;
cY
=
-
cY
;
/* Attention a l'orientation de l'axe Y */
cY
=
-
cY
;
/* Attention a l'orientation de l'axe Y */
/* calcul de cX et cY pour que l'arc passe par ArcStartX,Y et ArcEndX,Y */
/* calcul de cX et cY pour que l'arc passe par ArcStartX,Y et ArcEndX,Y */
dx
=
ArcEndX
-
ArcStartX
;
dy
=
ArcEndY
-
ArcStartY
;
dx
=
ArcEndX
-
ArcStartX
;
dy
=
ArcEndY
-
ArcStartY
;
cX
-=
ArcStartX
;
cY
-=
ArcStartY
;
cX
-=
ArcStartX
;
cY
-=
ArcStartY
;
angle
=
(
int
)(
atan2
(
dy
,
dx
)
*
1800
/
M_PI
);
angle
=
(
int
)
(
atan2
(
dy
,
dx
)
*
1800
/
M_PI
);
RotatePoint
(
&
dx
,
&
dy
,
angle
);
/* Le segment dx, dy est horizontal */
RotatePoint
(
&
dx
,
&
dy
,
angle
);
/* Le segment dx, dy est horizontal */
/* -> dx = longueur, dy = 0 */
/* -> dx = longueur, dy = 0 */
RotatePoint
(
&
cX
,
&
cY
,
angle
);
RotatePoint
(
&
cX
,
&
cY
,
angle
);
cX
=
dx
/
2
;
/* cX, cY est sur la mediane du segment 0,0 a dx,0 */
cX
=
dx
/
2
;
/* cX, cY est sur la mediane du segment 0,0 a dx,0 */
RotatePoint
(
&
cX
,
&
cY
,
-
angle
);
RotatePoint
(
&
cX
,
&
cY
,
-
angle
);
cX
+=
ArcStartX
;
cY
+=
ArcStartY
;
cX
+=
ArcStartX
;
cY
+=
ArcStartY
;
DrawItem
->
m_Pos
.
x
=
cX
;
DrawItem
->
m_Pos
.
y
=
cY
;
DrawItem
->
m_Pos
.
x
=
cX
;
DrawItem
->
m_Pos
.
y
=
cY
;
dx
=
ArcStartX
-
DrawItem
->
m_Pos
.
x
;
dx
=
ArcStartX
-
DrawItem
->
m_Pos
.
x
;
dy
=
ArcStartY
-
DrawItem
->
m_Pos
.
y
;
dy
=
ArcStartY
-
DrawItem
->
m_Pos
.
y
;
DrawItem
->
m_Rayon
=
(
int
)
sqrt
(
(
dx
*
dx
)
+
(
dy
*
dy
)
);
DrawItem
->
m_Rayon
=
(
int
)
sqrt
(
(
dx
*
dx
)
+
(
dy
*
dy
)
);
DrawItem
->
t1
=
(
int
)(
atan2
(
dy
,
dx
)
*
1800
/
M_PI
);
DrawItem
->
t1
=
(
int
)
(
atan2
(
dy
,
dx
)
*
1800
/
M_PI
);
dx
=
ArcEndX
-
DrawItem
->
m_Pos
.
x
;
dx
=
ArcEndX
-
DrawItem
->
m_Pos
.
x
;
dy
=
ArcEndY
-
DrawItem
->
m_Pos
.
y
;
dy
=
ArcEndY
-
DrawItem
->
m_Pos
.
y
;
DrawItem
->
t2
=
(
int
)(
atan2
(
dy
,
dx
)
*
1800
/
M_PI
);
DrawItem
->
m_ArcStart
.
x
=
ArcStartX
;
DrawItem
->
m_ArcStart
.
y
=
ArcStartY
;
DrawItem
->
m_ArcEnd
.
x
=
ArcEndX
;
DrawItem
->
m_ArcEnd
.
y
=
ArcEndY
;
NORMALIZE_ANGLE
(
DrawItem
->
t1
);
NORMALIZE_ANGLE
(
DrawItem
->
t2
);
// angles = 0 .. 3600
// limitation val abs a < 1800 (1/2 cercle) pour eviter Pbs d'affichage en miroir
// car en trace on suppose que l'arc fait moins de 180 deg pour trouver
// son orientation apres rot, miroir...
if
(
(
DrawItem
->
t2
-
DrawItem
->
t1
)
>
1800
)
DrawItem
->
t2
-=
3600
;
else
if
(
(
DrawItem
->
t2
-
DrawItem
->
t1
)
<=
-
1800
)
DrawItem
->
t2
+=
3600
;
wxString
msg
;
angle
=
DrawItem
->
t2
-
DrawItem
->
t1
;
msg
.
Printf
(
_
(
"Arc %.1f deg"
),
(
float
)
angle
/
10
);
EDA_Appl
->
LibeditFrame
->
PrintMsg
(
msg
);
while
(
(
DrawItem
->
t2
-
DrawItem
->
t1
)
>=
1800
)
{
DrawItem
->
t2
--
;
DrawItem
->
t1
++
;
}
while
(
(
DrawItem
->
t1
-
DrawItem
->
t2
)
>=
1800
)
{
DrawItem
->
t2
++
;
DrawItem
->
t1
--
;
}
NORMALIZE_ANGLE
(
DrawItem
->
t1
);
NORMALIZE_ANGLE
(
DrawItem
->
t2
);
DrawItem
->
t2
=
(
int
)
(
atan2
(
dy
,
dx
)
*
1800
/
M_PI
);
DrawItem
->
m_ArcStart
.
x
=
ArcStartX
;
DrawItem
->
m_ArcStart
.
y
=
ArcStartY
;
DrawItem
->
m_ArcEnd
.
x
=
ArcEndX
;
DrawItem
->
m_ArcEnd
.
y
=
ArcEndY
;
NORMALIZE_ANGLE
(
DrawItem
->
t1
);
NORMALIZE_ANGLE
(
DrawItem
->
t2
);
// angles = 0 .. 3600
// limitation val abs a < 1800 (1/2 cercle) pour eviter Pbs d'affichage en miroir
// car en trace on suppose que l'arc fait moins de 180 deg pour trouver
// son orientation apres rot, miroir...
if
(
(
DrawItem
->
t2
-
DrawItem
->
t1
)
>
1800
)
DrawItem
->
t2
-=
3600
;
else
if
(
(
DrawItem
->
t2
-
DrawItem
->
t1
)
<=
-
1800
)
DrawItem
->
t2
+=
3600
;
wxString
msg
;
angle
=
DrawItem
->
t2
-
DrawItem
->
t1
;
msg
.
Printf
(
_
(
"Arc %.1f deg"
),
(
float
)
angle
/
10
);
EDA_Appl
->
LibeditFrame
->
PrintMsg
(
msg
);
while
(
(
DrawItem
->
t2
-
DrawItem
->
t1
)
>=
1800
)
{
DrawItem
->
t2
--
;
DrawItem
->
t1
++
;
}
while
(
(
DrawItem
->
t1
-
DrawItem
->
t2
)
>=
1800
)
{
DrawItem
->
t2
++
;
DrawItem
->
t1
--
;
}
NORMALIZE_ANGLE
(
DrawItem
->
t1
);
NORMALIZE_ANGLE
(
DrawItem
->
t2
);
}
}
/***************************************************/
/***************************************************/
void
WinEDA_LibeditFrame
::
DeleteDrawPoly
(
wxDC
*
DC
)
void
WinEDA_LibeditFrame
::
DeleteDrawPoly
(
wxDC
*
DC
)
/**************************************************/
/**************************************************/
/* Used for deleting last entered segment while creating a Polyline
/* Used for deleting last entered segment while creating a Polyline
*/
*/
{
{
if
(
CurrentDrawItem
==
NULL
)
if
(
CurrentDrawItem
==
NULL
)
return
;
return
;
if
(
CurrentDrawItem
->
m_StructType
!=
COMPONENT_POLYLINE_DRAW_TYPE
)
if
(
CurrentDrawItem
->
m_StructType
!=
COMPONENT_POLYLINE_DRAW_TYPE
)
return
;
return
;
int
*
ptpoly
;
int
*
ptpoly
;
LibDrawPolyline
*
Poly
=
(
LibDrawPolyline
*
)
CurrentDrawItem
;
LibDrawPolyline
*
Poly
=
(
LibDrawPolyline
*
)
CurrentDrawItem
;
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
->
n
>
2
)
// First segment is kept, only its end point is changed
{
{
Poly
->
n
--
;
Poly
->
n
--
;
ptpoly
=
Poly
->
PolyList
+
(
2
*
(
Poly
->
n
-
1
)
);
ptpoly
=
Poly
->
PolyList
+
(
2
*
(
Poly
->
n
-
1
)
);
if
(
(
ptpoly
[
0
]
!=
m_CurrentScreen
->
m_Curseur
.
x
)
||
if
(
(
ptpoly
[
0
]
!=
m_CurrentScreen
->
m_Curseur
.
x
)
(
ptpoly
[
1
]
!=
-
m_CurrentScreen
->
m_Curseur
.
y
)
)
||
(
ptpoly
[
1
]
!=
-
m_CurrentScreen
->
m_Curseur
.
y
)
)
{
{
ptpoly
[
0
]
=
m_CurrentScreen
->
m_Curseur
.
x
;
ptpoly
[
0
]
=
m_CurrentScreen
->
m_Curseur
.
x
;
ptpoly
[
1
]
=
-
m_CurrentScreen
->
m_Curseur
.
y
;
ptpoly
[
1
]
=
-
m_CurrentScreen
->
m_Curseur
.
y
;
break
;
break
;
}
}
}
}
int
allocsize
=
2
*
sizeof
(
int
)
*
Poly
->
n
;
int
allocsize
=
2
*
sizeof
(
int
)
*
Poly
->
n
;
Poly
->
PolyList
=
(
int
*
)
realloc
(
Poly
->
PolyList
,
allocsize
);
Poly
->
PolyList
=
(
int
*
)
realloc
(
Poly
->
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 @
f3c324d5
/*************************************************/
/*************************************************/
/* Functions to Load from file and save to file */
/* Functions to Load from file and save to file */
/* the graphic shapes used to draw a component */
/* the graphic shapes used to draw a component */
/* When using the import/export symbol options */
/* When using the import/export symbol options */
/* files are the *.sym files */
/* files are the *.sym files */
/*************************************************/
/*************************************************/
/* fichier symbedit.cpp */
/* fichier symbedit.cpp */
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -19,362 +19,406 @@
...
@@ -19,362 +19,406 @@
/* Routines locales */
/* Routines locales */
static
bool
CompareSymbols
(
LibEDA_BaseStruct
*
DEntryRef
,
static
bool
CompareSymbols
(
LibEDA_BaseStruct
*
DEntryRef
,
LibEDA_BaseStruct
*
DEntryCompare
);
LibEDA_BaseStruct
*
DEntryCompare
);
/* Variables locales */
/* Variables locales */
/***************************************************/
/***************************************************/
void
WinEDA_LibeditFrame
::
LoadOneSymbol
(
wxDC
*
DC
)
void
WinEDA_LibeditFrame
::
LoadOneSymbol
(
wxDC
*
DC
)
/***************************************************/
/***************************************************/
/* Read a component shape file and add data (graphic items) to the current
/* Read a component shape file and add data (graphic items) to the current
component.
*
component.
*/
*/
{
{
int
NumOfParts
;
int
NumOfParts
;
PriorQue
*
Entries
;
PriorQue
*
Entries
;
EDA_LibComponentStruct
*
LibEntry
=
NULL
;
EDA_LibComponentStruct
*
LibEntry
=
NULL
;
LibEDA_BaseStruct
*
DrawEntry
;
LibEDA_BaseStruct
*
DrawEntry
;
wxString
FullFileName
,
mask
;
wxString
FullFileName
,
mask
;
FILE
*
ImportFile
;
FILE
*
ImportFile
;
wxString
msg
;
wxString
msg
;
if
(
CurrentDrawItem
)
return
;
if
(
CurrentDrawItem
)
if
(
CurrentLibEntry
==
NULL
)
return
;
return
;
if
(
CurrentLibEntry
==
NULL
)
DrawPanel
->
m_IgnoreMouseEvents
=
TRUE
;
return
;
mask
=
wxT
(
"*"
)
+
g_SymbolExtBuffer
;
DrawPanel
->
m_IgnoreMouseEvents
=
TRUE
;
FullFileName
=
EDA_FileSelector
(
_
(
"Import symbol drawings:"
),
g_RealLibDirBuffer
,
/* Chemin par defaut */
mask
=
wxT
(
"*"
)
+
g_SymbolExtBuffer
;
wxEmptyString
,
/* nom fichier par defaut */
FullFileName
=
EDA_FileSelector
(
_
(
"Import symbol drawings:"
),
g_SymbolExtBuffer
,
/* extension par defaut */
g_RealLibDirBuffer
,
/* Chemin par defaut */
mask
,
/* Masque d'affichage */
wxEmptyString
,
/* nom fichier par defaut */
this
,
g_SymbolExtBuffer
,
/* extension par defaut */
0
,
mask
,
/* Masque d'affichage */
TRUE
this
,
);
0
,
TRUE
GetScreen
()
->
m_Curseur
=
wxPoint
(
0
,
0
);
);
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
m_IgnoreMouseEvents
=
FALSE
;
GetScreen
()
->
m_Curseur
=
wxPoint
(
0
,
0
);
DrawPanel
->
MouseToCursorSchema
();
if
(
FullFileName
.
IsEmpty
()
)
return
;
DrawPanel
->
m_IgnoreMouseEvents
=
FALSE
;
if
(
FullFileName
.
IsEmpty
()
)
/* Load data */
return
;
ImportFile
=
wxFopen
(
FullFileName
,
wxT
(
"rt"
));
if
(
ImportFile
==
NULL
)
{
/* Load data */
msg
.
Printf
(
_
(
"Failed to open Symbol File <%s>"
),
FullFileName
.
GetData
());
ImportFile
=
wxFopen
(
FullFileName
,
wxT
(
"rt"
)
);
DisplayError
(
this
,
msg
,
20
);
if
(
ImportFile
==
NULL
)
return
;
{
}
msg
.
Printf
(
_
(
"Failed to open Symbol File <%s>"
),
FullFileName
.
GetData
()
);
DisplayError
(
this
,
msg
,
20
);
return
;
Entries
=
LoadLibraryAux
(
this
,
NULL
,
ImportFile
,
&
NumOfParts
);
}
fclose
(
ImportFile
);
if
(
Entries
==
NULL
)
return
;
Entries
=
LoadLibraryAux
(
this
,
NULL
,
ImportFile
,
&
NumOfParts
);
fclose
(
ImportFile
);
if
(
NumOfParts
>
1
)
DisplayError
(
this
,
_
(
"Warning: more than 1 part in Symbol File"
),
20
);
if
(
Entries
==
NULL
)
return
;
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQFirst
(
&
Entries
,
FALSE
);
if
(
NumOfParts
>
1
)
if
(
LibEntry
==
NULL
)
DisplayError
(
this
,
_
(
"Warning: more than 1 part in Symbol File"
),
20
);
DisplayError
(
this
,
_
(
"Symbol File is void"
),
20
);
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQFirst
(
&
Entries
,
FALSE
);
else
/* add data to the current symbol */
{
if
(
LibEntry
==
NULL
)
DrawEntry
=
LibEntry
->
m_Drawings
;
DisplayError
(
this
,
_
(
"Symbol File is void"
),
20
);
while
(
DrawEntry
)
{
else
/* add data to the current symbol */
if
(
DrawEntry
->
m_Unit
)
DrawEntry
->
m_Unit
=
CurrentUnit
;
{
if
(
DrawEntry
->
m_Convert
)
DrawEntry
->
m_Convert
=
CurrentConvert
;
DrawEntry
=
LibEntry
->
m_Drawings
;
DrawEntry
->
m_Flags
=
IS_NEW
;
while
(
DrawEntry
)
DrawEntry
->
m_Selected
=
IS_SELECTED
;
{
if
(
DrawEntry
->
m_Unit
)
if
(
DrawEntry
->
Pnext
==
NULL
)
DrawEntry
->
m_Unit
=
CurrentUnit
;
{
/* Fin de liste trouvee */
if
(
DrawEntry
->
m_Convert
)
DrawEntry
->
Pnext
=
CurrentLibEntry
->
m_Drawings
;
DrawEntry
->
m_Convert
=
CurrentConvert
;
CurrentLibEntry
->
m_Drawings
=
LibEntry
->
m_Drawings
;
DrawEntry
->
m_Flags
=
IS_NEW
;
LibEntry
->
m_Drawings
=
NULL
;
DrawEntry
->
m_Selected
=
IS_SELECTED
;
break
;
}
if
(
DrawEntry
->
Pnext
==
NULL
)
DrawEntry
=
DrawEntry
->
Next
();
{
/* Fin de liste trouvee */
}
DrawEntry
->
Pnext
=
CurrentLibEntry
->
m_Drawings
;
SuppressDuplicateDrawItem
(
CurrentLibEntry
);
CurrentLibEntry
->
m_Drawings
=
LibEntry
->
m_Drawings
;
m_CurrentScreen
->
SetModify
();
LibEntry
->
m_Drawings
=
NULL
;
// Move (and place ) the new draw items:
break
;
HandleBlockBegin
(
DC
,
-
1
,
GetScreen
()
->
m_Curseur
);
}
HandleBlockEnd
(
DC
);
DrawEntry
=
DrawEntry
->
Next
();
RedrawActiveWindow
(
DC
,
TRUE
);
}
}
SuppressDuplicateDrawItem
(
CurrentLibEntry
);
PQFreeFunc
(
Entries
,
(
void
(
*
)(
void
*
))
FreeLibraryEntry
);
m_CurrentScreen
->
SetModify
();
// Move (and place ) the new draw items:
HandleBlockBegin
(
DC
,
-
1
,
GetScreen
()
->
m_Curseur
);
HandleBlockEnd
(
DC
);
RedrawActiveWindow
(
DC
,
TRUE
);
}
PQFreeFunc
(
Entries
,
(
void
(
*
)
(
void
*
)
)
FreeLibraryEntry
);
}
}
/********************************************/
/********************************************/
void
WinEDA_LibeditFrame
::
SaveOneSymbol
(
void
)
void
WinEDA_LibeditFrame
::
SaveOneSymbol
(
void
)
/********************************************/
/********************************************/
/* Save in file the current symbol
/* Save in file the current symbol
file format is like the standard libraries, but there is only one symbol
*
file format is like the standard libraries, but there is only one symbol
Invisible pins are not saved
*
Invisible pins are not saved
*/
*/
{
{
EDA_LibComponentStruct
*
LibEntry
=
CurrentLibEntry
;
EDA_LibComponentStruct
*
LibEntry
=
CurrentLibEntry
;
int
Unit
=
CurrentUnit
,
convert
=
CurrentConvert
;
int
Unit
=
CurrentUnit
,
convert
=
CurrentConvert
;
int
SymbUnit
,
SymbConvert
;
int
SymbUnit
,
SymbConvert
;
LibEDA_BaseStruct
*
DrawEntry
;
LibEDA_BaseStruct
*
DrawEntry
;
wxString
FullFileName
,
mask
;
wxString
FullFileName
,
mask
;
wxString
msg
;
wxString
msg
;
FILE
*
ExportFile
;
FILE
*
ExportFile
;
if
(
LibEntry
->
m_Drawings
==
NULL
)
return
;
if
(
LibEntry
->
m_Drawings
==
NULL
)
return
;
/* Creation du fichier symbole */
mask
=
wxT
(
"*"
)
+
g_SymbolExtBuffer
;
/* Creation du fichier symbole */
FullFileName
=
EDA_FileSelector
(
_
(
"Export symbol drawings:"
),
mask
=
wxT
(
"*"
)
+
g_SymbolExtBuffer
;
g_RealLibDirBuffer
,
/* Chemin par defaut */
FullFileName
=
EDA_FileSelector
(
_
(
"Export symbol drawings:"
),
wxEmptyString
,
/* nom fichier par defaut */
g_RealLibDirBuffer
,
/* Chemin par defaut */
g_SymbolExtBuffer
,
/* extension par defaut */
wxEmptyString
,
/* nom fichier par defaut */
mask
,
/* Masque d'affichage */
g_SymbolExtBuffer
,
/* extension par defaut */
this
,
mask
,
/* Masque d'affichage */
wxFD_SAVE
,
this
,
TRUE
wxFD_SAVE
,
);
TRUE
if
(
FullFileName
.
IsEmpty
()
)
return
;
);
if
(
FullFileName
.
IsEmpty
()
)
ExportFile
=
wxFopen
(
FullFileName
,
wxT
(
"wt"
)
);
return
;
if
(
ExportFile
==
NULL
)
{
ExportFile
=
wxFopen
(
FullFileName
,
wxT
(
"wt"
)
);
msg
.
Printf
(
_
(
"Unable to create <%s>"
),
FullFileName
.
GetData
());
if
(
ExportFile
==
NULL
)
DisplayError
(
this
,
msg
);
{
return
;
msg
.
Printf
(
_
(
"Unable to create <%s>"
),
FullFileName
.
GetData
()
);
}
DisplayError
(
this
,
msg
);
return
;
msg
.
Printf
(
_
(
"Save Symbol in [%s]"
),
FullFileName
.
GetData
());
}
Affiche_Message
(
msg
);
msg
.
Printf
(
_
(
"Save Symbol in [%s]"
),
FullFileName
.
GetData
()
);
/* Creation de l'entete de la librairie */
Affiche_Message
(
msg
);
char
Line
[
256
];
fprintf
(
ExportFile
,
"%s %d.%d %s Date: %s
\n
"
,
LIBFILE_IDENT
,
/* Creation de l'entete de la librairie */
LIB_VERSION_MAJOR
,
LIB_VERSION_MINOR
,
char
Line
[
256
];
"SYMBOL"
,
DateAndTime
(
Line
));
fprintf
(
ExportFile
,
"%s %d.%d %s Date: %s
\n
"
,
LIBFILE_IDENT
,
LIB_VERSION_MAJOR
,
LIB_VERSION_MINOR
,
/* Creation du commentaire donnant le nom du composant */
"SYMBOL"
,
DateAndTime
(
Line
)
);
fprintf
(
ExportFile
,
"# SYMBOL %s
\n
#
\n
"
,
(
const
char
*
)
LibEntry
->
m_Name
.
m_Text
.
GetData
());
/* Creation du commentaire donnant le nom du composant */
fprintf
(
ExportFile
,
"# SYMBOL %s
\n
#
\n
"
,
/* Generation des lignes utiles */
(
const
char
*
)
LibEntry
->
m_Name
.
m_Text
.
GetData
()
);
fprintf
(
ExportFile
,
"DEF %s"
,
(
const
char
*
)
LibEntry
->
m_Name
.
m_Text
.
GetData
());
if
(
!
LibEntry
->
m_Prefix
.
m_Text
.
IsEmpty
())
/* Generation des lignes utiles */
fprintf
(
ExportFile
,
" %s"
,
(
const
char
*
)
LibEntry
->
m_Prefix
.
m_Text
.
GetData
());
fprintf
(
ExportFile
,
"DEF %s"
,
(
const
char
*
)
LibEntry
->
m_Name
.
m_Text
.
GetData
()
);
else
fprintf
(
ExportFile
,
" ~"
);
if
(
!
LibEntry
->
m_Prefix
.
m_Text
.
IsEmpty
()
)
fprintf
(
ExportFile
,
" %s"
,
(
const
char
*
)
LibEntry
->
m_Prefix
.
m_Text
.
GetData
()
);
fprintf
(
ExportFile
,
" %d %d %c %c %d %d %c
\n
"
,
else
0
,
/* unused */
fprintf
(
ExportFile
,
" ~"
);
LibEntry
->
m_TextInside
,
LibEntry
->
m_DrawPinNum
?
'Y'
:
'N'
,
fprintf
(
ExportFile
,
" %d %d %c %c %d %d %c
\n
"
,
LibEntry
->
m_DrawPinName
?
'Y'
:
'N'
,
0
,
/* unused */
1
,
0
/* unused */
,
'N'
);
LibEntry
->
m_TextInside
,
LibEntry
->
m_DrawPinNum
?
'Y'
:
'N'
,
/* Position / orientation / visibilite des champs */
LibEntry
->
m_DrawPinName
?
'Y'
:
'N'
,
1
,
0
/* unused */
,
'N'
);
/* Position / orientation / visibilite des champs */
LibEntry
->
m_Prefix
.
WriteDescr
(
ExportFile
);
LibEntry
->
m_Prefix
.
WriteDescr
(
ExportFile
);
LibEntry
->
m_Name
.
WriteDescr
(
ExportFile
);
LibEntry
->
m_Name
.
WriteDescr
(
ExportFile
);
DrawEntry
=
LibEntry
->
m_Drawings
;
DrawEntry
=
LibEntry
->
m_Drawings
;
if
(
DrawEntry
)
if
(
DrawEntry
)
{
{
fprintf
(
ExportFile
,
"DRAW
\n
"
);
fprintf
(
ExportFile
,
"DRAW
\n
"
);
for
(
;
DrawEntry
!=
NULL
;
DrawEntry
=
DrawEntry
->
Next
())
for
(
;
DrawEntry
!=
NULL
;
DrawEntry
=
DrawEntry
->
Next
()
)
{
{
/* Elimination des elements non relatifs a l'unite */
/* Elimination des elements non relatifs a l'unite */
if
(
Unit
&&
DrawEntry
->
m_Unit
&&
(
DrawEntry
->
m_Unit
!=
Unit
)
)
if
(
Unit
&&
DrawEntry
->
m_Unit
&&
(
DrawEntry
->
m_Unit
!=
Unit
)
)
continue
;
continue
;
if
(
convert
&&
DrawEntry
->
m_Convert
&&
(
DrawEntry
->
m_Convert
!=
convert
)
)
if
(
convert
&&
DrawEntry
->
m_Convert
&&
(
DrawEntry
->
m_Convert
!=
convert
)
)
continue
;
continue
;
/* .Unit , . Convert est laisse a 0 ou mis a 1 */
/* .Unit , . Convert est laisse a 0 ou mis a 1 */
SymbUnit
=
DrawEntry
->
m_Unit
;
if
(
SymbUnit
>
1
)
SymbUnit
=
1
;
SymbUnit
=
DrawEntry
->
m_Unit
;
if
(
SymbUnit
>
1
)
SymbConvert
=
DrawEntry
->
m_Convert
;
SymbUnit
=
1
;
if
(
SymbConvert
>
1
)
SymbConvert
=
1
;
SymbConvert
=
DrawEntry
->
m_Convert
;
switch
(
DrawEntry
->
m_StructType
)
if
(
SymbConvert
>
1
)
{
SymbConvert
=
1
;
case
COMPONENT_ARC_DRAW_TYPE
:
#define DRAWSTRUCT ((LibDrawArc *) DrawEntry)
switch
(
DrawEntry
->
m_StructType
)
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
{
break
;
case
COMPONENT_ARC_DRAW_TYPE
:
#define DRAWSTRUCT ( (LibDrawArc*) DrawEntry )
case
COMPONENT_CIRCLE_DRAW_TYPE
:
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
#undef DRAWSTRUCT
break
;
#define DRAWSTRUCT ((LibDrawCircle *) DrawEntry)
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
case
COMPONENT_CIRCLE_DRAW_TYPE
:
break
;
#undef DRAWSTRUCT
#define DRAWSTRUCT ( (LibDrawCircle*) DrawEntry )
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
#undef DRAWSTRUCT
break
;
#define DRAWSTRUCT ((LibDrawText *) DrawEntry)
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
break
;
#undef DRAWSTRUCT
#define DRAWSTRUCT ( (LibDrawText*) DrawEntry )
case
COMPONENT_RECT_DRAW_TYPE
:
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
#undef DRAWSTRUCT
break
;
#define DRAWSTRUCT ((LibDrawSquare *) DrawEntry)
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
case
COMPONENT_RECT_DRAW_TYPE
:
break
;
#undef DRAWSTRUCT
#define DRAWSTRUCT ( (LibDrawSquare*) DrawEntry )
case
COMPONENT_PIN_DRAW_TYPE
:
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
#undef DRAWSTRUCT
break
;
#define DRAWSTRUCT ((LibDrawPin *) DrawEntry)
if
(
DRAWSTRUCT
->
m_Attributs
&
PINNOTDRAW
)
break
;
case
COMPONENT_PIN_DRAW_TYPE
:
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
#undef DRAWSTRUCT
break
;
#define DRAWSTRUCT ( (LibDrawPin*) DrawEntry )
if
(
DRAWSTRUCT
->
m_Attributs
&
PINNOTDRAW
)
case
COMPONENT_POLYLINE_DRAW_TYPE
:
break
;
#undef DRAWSTRUCT
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
#define DRAWSTRUCT ((LibDrawPolyline *) DrawEntry)
break
;
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
}
#undef DRAWSTRUCT
}
#define DRAWSTRUCT ( (LibDrawPolyline*) DrawEntry )
fprintf
(
ExportFile
,
"ENDDRAW
\n
"
);
DRAWSTRUCT
->
WriteDescr
(
ExportFile
);
}
break
;
fprintf
(
ExportFile
,
"ENDDEF
\n
"
);
fclose
(
ExportFile
);
default
:
;
}
}
fprintf
(
ExportFile
,
"ENDDRAW
\n
"
);
}
fprintf
(
ExportFile
,
"ENDDEF
\n
"
);
fclose
(
ExportFile
);
}
}
/*****************************************************************/
/*****************************************************************/
void
SuppressDuplicateDrawItem
(
EDA_LibComponentStruct
*
LibEntry
)
void
SuppressDuplicateDrawItem
(
EDA_LibComponentStruct
*
LibEntry
)
/*****************************************************************/
/*****************************************************************/
/* Delete redundant graphic items.
/* Delete redundant graphic items.
Useful after loading asymbole from a file symbol, because some graphic items
*
Useful after loading asymbole from a file symbol, because some graphic items
can be duplicated.
*
can be duplicated.
*/
*/
{
{
LibEDA_BaseStruct
*
DEntryRef
,
*
DEntryCompare
;
LibEDA_BaseStruct
*
DEntryRef
,
*
DEntryCompare
;
bool
deleted
;
bool
deleted
;
wxDC
*
DC
=
NULL
;
wxDC
*
DC
=
NULL
;
DEntryRef
=
LibEntry
->
m_Drawings
;
DEntryRef
=
LibEntry
->
m_Drawings
;
while
(
DEntryRef
)
while
(
DEntryRef
)
{
{
if
(
DEntryRef
->
Pnext
==
NULL
)
return
;
if
(
DEntryRef
->
Pnext
==
NULL
)
DEntryCompare
=
DEntryRef
->
Next
();
return
;
if
(
DEntryCompare
==
NULL
)
return
;
DEntryCompare
=
DEntryRef
->
Next
();
deleted
=
0
;
if
(
DEntryCompare
==
NULL
)
while
(
DEntryCompare
)
return
;
{
deleted
=
0
;
if
(
CompareSymbols
(
DEntryRef
,
DEntryCompare
)
==
TRUE
)
while
(
DEntryCompare
)
{
{
DeleteOneLibraryDrawStruct
(
NULL
,
DC
,
LibEntry
,
DEntryRef
,
1
);
if
(
CompareSymbols
(
DEntryRef
,
DEntryCompare
)
==
TRUE
)
deleted
=
TRUE
;
{
break
;
DeleteOneLibraryDrawStruct
(
NULL
,
DC
,
LibEntry
,
DEntryRef
,
1
);
}
deleted
=
TRUE
;
DEntryCompare
=
DEntryCompare
->
Next
();
break
;
}
}
if
(
!
deleted
)
DEntryRef
=
DEntryRef
->
Next
();
DEntryCompare
=
DEntryCompare
->
Next
();
else
DEntryRef
=
LibEntry
->
m_Drawings
;
}
}
if
(
!
deleted
)
DEntryRef
=
DEntryRef
->
Next
();
else
DEntryRef
=
LibEntry
->
m_Drawings
;
}
}
}
/********************************************************************/
/********************************************************************/
static
bool
CompareSymbols
(
LibEDA_BaseStruct
*
DEntryRef
,
static
bool
CompareSymbols
(
LibEDA_BaseStruct
*
DEntryRef
,
LibEDA_BaseStruct
*
DEntryCompare
)
LibEDA_BaseStruct
*
DEntryCompare
)
/********************************************************************/
/********************************************************************/
/* Compare 2 graphic items (arc, lines ...).
/* Compare 2 graphic items (arc, lines ...).
return FALSE si different
*
return FALSE si different
TRUE si they are identical, and therefore redundant
*
TRUE si they are identical, and therefore redundant
*/
*/
{
{
int
ii
;
int
ii
;
int
*
ptref
,
*
ptcomp
;
int
*
ptref
,
*
ptcomp
;
/* Comparaison des proprietes generales */
/* Comparaison des proprietes generales */
if
(
DEntryRef
->
m_StructType
!=
DEntryCompare
->
m_StructType
)
return
(
FALSE
);
if
(
DEntryRef
->
m_StructType
!=
DEntryCompare
->
m_StructType
)
if
(
DEntryRef
->
m_Unit
!=
DEntryCompare
->
m_Unit
)
return
(
FALSE
);
return
FALSE
;
if
(
DEntryRef
->
m_Convert
!=
DEntryCompare
->
m_Convert
)
return
(
FALSE
);
if
(
DEntryRef
->
m_Unit
!=
DEntryCompare
->
m_Unit
)
return
FALSE
;
switch
(
DEntryRef
->
m_StructType
)
if
(
DEntryRef
->
m_Convert
!=
DEntryCompare
->
m_Convert
)
{
return
FALSE
;
case
COMPONENT_ARC_DRAW_TYPE
:
#undef REFSTRUCT
switch
(
DEntryRef
->
m_StructType
)
#undef CMPSTRUCT
{
#define REFSTRUCT ((LibDrawArc *) DEntryRef)
case
COMPONENT_ARC_DRAW_TYPE
:
#define CMPSTRUCT ((LibDrawArc *) DEntryCompare)
#undef REFSTRUCT
if
(
REFSTRUCT
->
m_Pos
.
x
!=
CMPSTRUCT
->
m_Pos
.
x
)
return
(
FALSE
);
#undef CMPSTRUCT
if
(
REFSTRUCT
->
m_Pos
.
y
!=
CMPSTRUCT
->
m_Pos
.
y
)
return
(
FALSE
);
#define REFSTRUCT ( (LibDrawArc*) DEntryRef )
if
(
REFSTRUCT
->
t1
!=
CMPSTRUCT
->
t1
)
return
(
FALSE
);
#define CMPSTRUCT ( (LibDrawArc*) DEntryCompare )
if
(
REFSTRUCT
->
t2
!=
CMPSTRUCT
->
t2
)
return
(
FALSE
);
if
(
REFSTRUCT
->
m_Pos
.
x
!=
CMPSTRUCT
->
m_Pos
.
x
)
break
;
return
FALSE
;
if
(
REFSTRUCT
->
m_Pos
.
y
!=
CMPSTRUCT
->
m_Pos
.
y
)
case
COMPONENT_CIRCLE_DRAW_TYPE
:
return
FALSE
;
#undef REFSTRUCT
if
(
REFSTRUCT
->
t1
!=
CMPSTRUCT
->
t1
)
#undef CMPSTRUCT
return
FALSE
;
#define REFSTRUCT ((LibDrawCircle *) DEntryRef)
if
(
REFSTRUCT
->
t2
!=
CMPSTRUCT
->
t2
)
#define CMPSTRUCT ((LibDrawCircle *) DEntryCompare)
return
FALSE
;
if
(
REFSTRUCT
->
m_Pos
.
x
!=
CMPSTRUCT
->
m_Pos
.
x
)
return
(
FALSE
);
break
;
if
(
REFSTRUCT
->
m_Pos
.
y
!=
CMPSTRUCT
->
m_Pos
.
y
)
return
(
FALSE
);
if
(
REFSTRUCT
->
m_Rayon
!=
CMPSTRUCT
->
m_Rayon
)
return
(
FALSE
);
case
COMPONENT_CIRCLE_DRAW_TYPE
:
break
;
#undef REFSTRUCT
#undef CMPSTRUCT
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
#define REFSTRUCT ( (LibDrawCircle*) DEntryRef )
#undef REFSTRUCT
#define CMPSTRUCT ( (LibDrawCircle*) DEntryCompare )
#undef CMPSTRUCT
if
(
REFSTRUCT
->
m_Pos
.
x
!=
CMPSTRUCT
->
m_Pos
.
x
)
#define REFSTRUCT ((LibDrawText *) DEntryRef)
return
FALSE
;
#define CMPSTRUCT ((LibDrawText *) DEntryCompare)
if
(
REFSTRUCT
->
m_Pos
.
y
!=
CMPSTRUCT
->
m_Pos
.
y
)
if
(
REFSTRUCT
->
m_Pos
!=
CMPSTRUCT
->
m_Pos
)
return
(
FALSE
);
return
FALSE
;
if
(
REFSTRUCT
->
m_Size
!=
CMPSTRUCT
->
m_Size
)
return
(
FALSE
);
if
(
REFSTRUCT
->
m_Rayon
!=
CMPSTRUCT
->
m_Rayon
)
if
(
REFSTRUCT
->
m_Text
!=
CMPSTRUCT
->
m_Text
)
return
FALSE
;
return
(
FALSE
);
break
;
break
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
case
COMPONENT_RECT_DRAW_TYPE
:
#undef REFSTRUCT
#undef REFSTRUCT
#undef CMPSTRUCT
#undef CMPSTRUCT
#define REFSTRUCT ( (LibDrawText*) DEntryRef )
#define REFSTRUCT ((LibDrawSquare *) DEntryRef)
#define CMPSTRUCT ( (LibDrawText*) DEntryCompare )
#define CMPSTRUCT ((LibDrawSquare *) DEntryCompare)
if
(
REFSTRUCT
->
m_Pos
!=
CMPSTRUCT
->
m_Pos
)
if
(
REFSTRUCT
->
m_Pos
!=
CMPSTRUCT
->
m_Pos
)
return
(
FALSE
);
return
FALSE
;
if
(
REFSTRUCT
->
m_End
!=
CMPSTRUCT
->
m_End
)
return
(
FALSE
);
if
(
REFSTRUCT
->
m_Size
!=
CMPSTRUCT
->
m_Size
)
break
;
return
FALSE
;
if
(
REFSTRUCT
->
m_Text
!=
CMPSTRUCT
->
m_Text
)
case
COMPONENT_PIN_DRAW_TYPE
:
return
FALSE
;
#undef REFSTRUCT
break
;
#undef CMPSTRUCT
#define REFSTRUCT ((LibDrawPin *) DEntryRef)
case
COMPONENT_RECT_DRAW_TYPE
:
#define CMPSTRUCT ((LibDrawPin *) DEntryCompare)
#undef REFSTRUCT
if
(
REFSTRUCT
->
m_Pos
!=
CMPSTRUCT
->
m_Pos
)
return
(
FALSE
);
#undef CMPSTRUCT
break
;
#define REFSTRUCT ( (LibDrawSquare*) DEntryRef )
#define CMPSTRUCT ( (LibDrawSquare*) DEntryCompare )
case
COMPONENT_POLYLINE_DRAW_TYPE
:
if
(
REFSTRUCT
->
m_Pos
!=
CMPSTRUCT
->
m_Pos
)
#undef REFSTRUCT
return
FALSE
;
#undef CMPSTRUCT
if
(
REFSTRUCT
->
m_End
!=
CMPSTRUCT
->
m_End
)
#define REFSTRUCT ((LibDrawPolyline *) DEntryRef)
return
FALSE
;
#define CMPSTRUCT ((LibDrawPolyline *) DEntryCompare)
break
;
if
(
REFSTRUCT
->
n
!=
CMPSTRUCT
->
n
)
return
(
FALSE
);
ptref
=
REFSTRUCT
->
PolyList
;
case
COMPONENT_PIN_DRAW_TYPE
:
ptcomp
=
CMPSTRUCT
->
PolyList
;
#undef REFSTRUCT
for
(
ii
=
2
*
REFSTRUCT
->
n
;
ii
>
0
;
ii
--
)
#undef CMPSTRUCT
{
#define REFSTRUCT ( (LibDrawPin*) DEntryRef )
if
(
*
ptref
!=
*
ptcomp
)
return
(
FALSE
);
#define CMPSTRUCT ( (LibDrawPin*) DEntryCompare )
ptref
++
;
ptcomp
++
;
if
(
REFSTRUCT
->
m_Pos
!=
CMPSTRUCT
->
m_Pos
)
}
return
FALSE
;
break
;
break
;
}
return
(
TRUE
);
case
COMPONENT_POLYLINE_DRAW_TYPE
:
#undef REFSTRUCT
#undef CMPSTRUCT
#define REFSTRUCT ( (LibDrawPolyline*) DEntryRef )
#define CMPSTRUCT ( (LibDrawPolyline*) DEntryCompare )
if
(
REFSTRUCT
->
n
!=
CMPSTRUCT
->
n
)
return
FALSE
;
ptref
=
REFSTRUCT
->
PolyList
;
ptcomp
=
CMPSTRUCT
->
PolyList
;
for
(
ii
=
2
*
REFSTRUCT
->
n
;
ii
>
0
;
ii
--
)
{
if
(
*
ptref
!=
*
ptcomp
)
return
FALSE
;
ptref
++
;
ptcomp
++
;
}
break
;
default
:
;
}
return
TRUE
;
}
}
/***************************************************************************/
/***************************************************************************/
/* Routine de placement du point d'ancrage ( reference des coordonnes pour */
/* Routine de placement du point d'ancrage ( reference des coordonnes pour */
/* le trace) du composant courant */
/* le trace) du composant courant */
...
@@ -383,86 +427,90 @@ int * ptref, *ptcomp;
...
@@ -383,86 +427,90 @@ int * ptref, *ptcomp;
/* d'ancrage ( coord 0,0 ). */
/* d'ancrage ( coord 0,0 ). */
/***************************************************************************/
/***************************************************************************/
void
WinEDA_LibeditFrame
::
PlaceAncre
(
void
)
void
WinEDA_LibeditFrame
::
PlaceAncre
(
void
)
{
{
int
ii
,
*
ptsegm
;
int
ii
,
*
ptsegm
;
int
dx
,
dy
;
/* Offsets de deplacement */
int
dx
,
dy
;
/* Offsets de deplacement */
EDA_LibComponentStruct
*
LibEntry
;
EDA_LibComponentStruct
*
LibEntry
;
LibEDA_BaseStruct
*
DrawEntry
;
LibEDA_BaseStruct
*
DrawEntry
;
dx
=
-
m_CurrentScreen
->
m_Curseur
.
x
;
dx
=
-
m_CurrentScreen
->
m_Curseur
.
x
;
dy
=
m_CurrentScreen
->
m_Curseur
.
y
;
dy
=
m_CurrentScreen
->
m_Curseur
.
y
;
LibEntry
=
CurrentLibEntry
;
LibEntry
=
CurrentLibEntry
;
if
(
LibEntry
==
NULL
)
return
;
if
(
LibEntry
==
NULL
)
return
;
m_CurrentScreen
->
SetModify
();
m_CurrentScreen
->
SetModify
();
LibEntry
->
m_Name
.
m_Pos
.
x
+=
dx
;
LibEntry
->
m_Name
.
m_Pos
.
y
+=
dy
;
LibEntry
->
m_Prefix
.
m_Pos
.
x
+=
dx
;
LibEntry
->
m_Prefix
.
m_Pos
.
y
+=
dy
;
LibEntry
->
m_Name
.
m_Pos
.
x
+=
dx
;
LibEntry
->
m_Name
.
m_Pos
.
y
+=
dy
;
LibEntry
->
m_Prefix
.
m_Pos
.
x
+=
dx
;
LibEntry
->
m_Prefix
.
m_Pos
.
y
+=
dy
;
DrawEntry
=
LibEntry
->
m_Drawings
;
while
(
DrawEntry
)
DrawEntry
=
LibEntry
->
m_Drawings
;
{
while
(
DrawEntry
)
switch
(
DrawEntry
->
m_StructType
)
{
{
switch
(
DrawEntry
->
m_StructType
)
case
COMPONENT_ARC_DRAW_TYPE
:
{
#undef STRUCT
case
COMPONENT_ARC_DRAW_TYPE
:
#define STRUCT ((LibDrawArc *) DrawEntry)
#undef STRUCT
STRUCT
->
m_Pos
.
x
+=
dx
;
#define STRUCT ( (LibDrawArc*) DrawEntry )
STRUCT
->
m_Pos
.
y
+=
dy
;
STRUCT
->
m_Pos
.
x
+=
dx
;
STRUCT
->
m_ArcStart
.
x
+=
dx
;
STRUCT
->
m_Pos
.
y
+=
dy
;
STRUCT
->
m_ArcStart
.
y
+=
dy
;
STRUCT
->
m_ArcStart
.
x
+=
dx
;
STRUCT
->
m_ArcEnd
.
x
+=
dx
;
STRUCT
->
m_ArcStart
.
y
+=
dy
;
STRUCT
->
m_ArcEnd
.
y
+=
dy
;
STRUCT
->
m_ArcEnd
.
x
+=
dx
;
break
;
STRUCT
->
m_ArcEnd
.
y
+=
dy
;
break
;
case
COMPONENT_CIRCLE_DRAW_TYPE
:
#undef STRUCT
case
COMPONENT_CIRCLE_DRAW_TYPE
:
#define STRUCT ((LibDrawCircle *) DrawEntry)
#undef STRUCT
STRUCT
->
m_Pos
.
x
+=
dx
;
#define STRUCT ( (LibDrawCircle*) DrawEntry )
STRUCT
->
m_Pos
.
y
+=
dy
;
STRUCT
->
m_Pos
.
x
+=
dx
;
break
;
STRUCT
->
m_Pos
.
y
+=
dy
;
break
;
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
#undef STRUCT
case
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
:
#define STRUCT ((LibDrawText *) DrawEntry)
#undef STRUCT
STRUCT
->
m_Pos
.
x
+=
dx
;
#define STRUCT ( (LibDrawText*) DrawEntry )
STRUCT
->
m_Pos
.
y
+=
dy
;
STRUCT
->
m_Pos
.
x
+=
dx
;
break
;
STRUCT
->
m_Pos
.
y
+=
dy
;
break
;
case
COMPONENT_RECT_DRAW_TYPE
:
#undef STRUCT
case
COMPONENT_RECT_DRAW_TYPE
:
#define STRUCT ((LibDrawSquare *) DrawEntry)
#undef STRUCT
STRUCT
->
m_Pos
.
x
+=
dx
;
#define STRUCT ( (LibDrawSquare*) DrawEntry )
STRUCT
->
m_Pos
.
y
+=
dy
;
STRUCT
->
m_Pos
.
x
+=
dx
;
STRUCT
->
m_End
.
x
+=
dx
;
STRUCT
->
m_Pos
.
y
+=
dy
;
STRUCT
->
m_End
.
y
+=
dy
;
STRUCT
->
m_End
.
x
+=
dx
;
break
;
STRUCT
->
m_End
.
y
+=
dy
;
break
;
case
COMPONENT_PIN_DRAW_TYPE
:
#undef STRUCT
case
COMPONENT_PIN_DRAW_TYPE
:
#define STRUCT ((LibDrawPin *) DrawEntry)
#undef STRUCT
STRUCT
->
m_Pos
.
x
+=
dx
;
#define STRUCT ( (LibDrawPin*) DrawEntry )
STRUCT
->
m_Pos
.
y
+=
dy
;
STRUCT
->
m_Pos
.
x
+=
dx
;
break
;
STRUCT
->
m_Pos
.
y
+=
dy
;
break
;
case
COMPONENT_POLYLINE_DRAW_TYPE
:
#undef STRUCT
case
COMPONENT_POLYLINE_DRAW_TYPE
:
#define STRUCT ((LibDrawPolyline *) DrawEntry)
#undef STRUCT
ptsegm
=
STRUCT
->
PolyList
;
#define STRUCT ( (LibDrawPolyline*) DrawEntry )
for
(
ii
=
STRUCT
->
n
;
ii
>
0
;
ii
--
)
ptsegm
=
STRUCT
->
PolyList
;
{
for
(
ii
=
STRUCT
->
n
;
ii
>
0
;
ii
--
)
*
ptsegm
+=
dx
;
ptsegm
++
;
{
*
ptsegm
+=
dy
;
ptsegm
++
;
*
ptsegm
+=
dx
;
ptsegm
++
;
}
*
ptsegm
+=
dy
;
ptsegm
++
;
break
;
}
}
break
;
DrawEntry
=
DrawEntry
->
Next
();
}
default
:
/* Redraw the symbol */
;
m_CurrentScreen
->
m_Curseur
.
x
=
m_CurrentScreen
->
m_Curseur
.
y
=
0
;
}
Recadre_Trace
(
TRUE
);
DrawEntry
=
DrawEntry
->
Next
();
m_CurrentScreen
->
SetRefreshReq
();
}
/* Redraw the symbol */
m_CurrentScreen
->
m_Curseur
.
x
=
m_CurrentScreen
->
m_Curseur
.
y
=
0
;
Recadre_Trace
(
TRUE
);
m_CurrentScreen
->
SetRefreshReq
();
}
}
include/base_struct.h
View file @
f3c324d5
...
@@ -14,8 +14,10 @@ extern std::ostream& operator<<( std::ostream& out, const wxPoint& pt );
...
@@ -14,8 +14,10 @@ extern std::ostream& operator<<( std::ostream& out, const wxPoint& pt );
/* Id for class identification, at run time */
/* Id for class identification, at run time */
enum
DrawStructureType
{
enum
KICAD_T
{
NOT_USED
=
-
1
,
// the 3d code uses this value
EOT
=
0
,
// search types array terminator (End Of Types)
EOT
=
0
,
// search types array terminator (End Of Types)
TYPE_NOT_INIT
=
0
,
TYPE_NOT_INIT
=
0
,
...
@@ -80,7 +82,6 @@ enum SEARCH_RESULT {
...
@@ -80,7 +82,6 @@ enum SEARCH_RESULT {
SEARCH_CONTINUE
SEARCH_CONTINUE
};
};
typedef
DrawStructureType
KICAD_T
;
// shorter name
class
EDA_BaseStruct
;
class
EDA_BaseStruct
;
class
WinEDA_DrawFrame
;
class
WinEDA_DrawFrame
;
...
@@ -126,7 +127,7 @@ public:
...
@@ -126,7 +127,7 @@ public:
class
EDA_BaseStruct
/* Basic class, not directly used */
class
EDA_BaseStruct
/* Basic class, not directly used */
{
{
public
:
public
:
int
m_StructType
;
/* Struct ident for run time identification */
KICAD_T
m_StructType
;
/* Struct ident for run time identification */
EDA_BaseStruct
*
Pnext
;
/* Linked list: Link (next struct) */
EDA_BaseStruct
*
Pnext
;
/* Linked list: Link (next struct) */
EDA_BaseStruct
*
Pback
;
/* Linked list: Link (previous struct) */
EDA_BaseStruct
*
Pback
;
/* Linked list: Link (previous struct) */
EDA_BaseStruct
*
m_Parent
;
/* Linked list: Link (parent struct) */
EDA_BaseStruct
*
m_Parent
;
/* Linked list: Link (parent struct) */
...
@@ -163,11 +164,11 @@ private:
...
@@ -163,11 +164,11 @@ private:
public
:
public
:
EDA_BaseStruct
(
EDA_BaseStruct
*
parent
,
int
idType
);
EDA_BaseStruct
(
EDA_BaseStruct
*
parent
,
KICAD_T
idType
);
EDA_BaseStruct
(
int
struct_type
);
EDA_BaseStruct
(
KICAD_T
struct_type
);
virtual
~
EDA_BaseStruct
()
{
};
virtual
~
EDA_BaseStruct
()
{
};
EDA_BaseStruct
*
Next
(
void
)
{
return
Pnext
;
}
EDA_BaseStruct
*
Next
(
)
{
return
Pnext
;
}
/* Gestion de l'etat (status) de la structure (active, deleted..) */
/* Gestion de l'etat (status) de la structure (active, deleted..) */
int
GetState
(
int
type
);
int
GetState
(
int
type
);
...
@@ -381,7 +382,7 @@ protected:
...
@@ -381,7 +382,7 @@ protected:
public
:
public
:
BOARD_ITEM
(
BOARD_ITEM
*
StructFather
,
DrawStructureType
idtype
)
:
BOARD_ITEM
(
BOARD_ITEM
*
StructFather
,
KICAD_T
idtype
)
:
EDA_BaseStruct
(
StructFather
,
idtype
),
EDA_BaseStruct
(
StructFather
,
idtype
),
m_Layer
(
0
)
m_Layer
(
0
)
{
{
...
@@ -450,22 +451,6 @@ public:
...
@@ -450,22 +451,6 @@ public:
};
};
/* Base class for building items like lines, which have 1 start point and 1 end point.
* Arc and circles can use this class.
*/
class
EDA_BaseLineStruct
:
public
EDA_BaseStruct
{
public
:
int
m_Layer
;
// Layer number
int
m_Width
;
// 0 = line, > 0 = tracks, bus ...
wxPoint
m_Start
;
// Line start point
wxPoint
m_End
;
// Line end point
public
:
EDA_BaseLineStruct
(
EDA_BaseStruct
*
StructFather
,
DrawStructureType
idtype
);
};
/**************************/
/**************************/
/* class DrawPickedStruct */
/* class DrawPickedStruct */
/**************************/
/**************************/
...
...
include/pcbstruct.h
View file @
f3c324d5
...
@@ -358,7 +358,7 @@ public:
...
@@ -358,7 +358,7 @@ public:
int
m_Angle
;
// pour les arcs: "longueur" de l'arc en 1/10 deg
int
m_Angle
;
// pour les arcs: "longueur" de l'arc en 1/10 deg
public
:
public
:
DRAWSEGMENT
(
BOARD_ITEM
*
StructFather
,
DrawStructureType
idtype
=
TYPEDRAWSEGMENT
);
DRAWSEGMENT
(
BOARD_ITEM
*
StructFather
,
KICAD_T
idtype
=
TYPEDRAWSEGMENT
);
~
DRAWSEGMENT
(
void
);
~
DRAWSEGMENT
(
void
);
// Read/write data
// Read/write data
...
...
include/wxstruct.h
View file @
f3c324d5
...
@@ -501,7 +501,7 @@ public:
...
@@ -501,7 +501,7 @@ public:
virtual
void
SwitchLayer
(
wxDC
*
DC
,
int
layer
);
virtual
void
SwitchLayer
(
wxDC
*
DC
,
int
layer
);
// divers
// divers
void
AddHistory
(
int
value
,
DrawStructureType
type
);
// Add value in data list history
void
AddHistory
(
int
value
,
KICAD_T
type
);
// Add value in data list history
void
InstallGridFrame
(
const
wxPoint
&
pos
);
void
InstallGridFrame
(
const
wxPoint
&
pos
);
};
};
...
...
pcbnew/block_module_editor.cpp
View file @
f3c324d5
...
@@ -502,6 +502,9 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
...
@@ -502,6 +502,9 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
(
(
EDGE_MODULE
*
)
item
)
->
m_End0
.
x
+=
offset
.
x
;
(
(
EDGE_MODULE
*
)
item
)
->
m_End0
.
x
+=
offset
.
x
;
(
(
EDGE_MODULE
*
)
item
)
->
m_End0
.
y
+=
offset
.
y
;
(
(
EDGE_MODULE
*
)
item
)
->
m_End0
.
y
+=
offset
.
y
;
break
;
break
;
default
:
;
}
}
item
->
m_Flags
=
item
->
m_Selected
=
0
;
item
->
m_Flags
=
item
->
m_Selected
=
0
;
...
@@ -588,6 +591,9 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
...
@@ -588,6 +591,9 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
SETMIRROR
(
(
(
TEXTE_MODULE
*
)
item
)
->
m_Pos
.
x
);
SETMIRROR
(
(
(
TEXTE_MODULE
*
)
item
)
->
m_Pos
.
x
);
(
(
TEXTE_MODULE
*
)
item
)
->
m_Pos0
.
x
=
(
(
TEXTE_MODULE
*
)
item
)
->
m_Pos
.
x
;
(
(
TEXTE_MODULE
*
)
item
)
->
m_Pos0
.
x
=
(
(
TEXTE_MODULE
*
)
item
)
->
m_Pos
.
x
;
break
;
break
;
default
:
;
}
}
item
->
m_Flags
=
item
->
m_Selected
=
0
;
item
->
m_Flags
=
item
->
m_Selected
=
0
;
...
@@ -639,6 +645,9 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
...
@@ -639,6 +645,9 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
(
(
TEXTE_MODULE
*
)
item
)
->
m_Pos0
=
(
(
TEXTE_MODULE
*
)
item
)
->
m_Pos
;
(
(
TEXTE_MODULE
*
)
item
)
->
m_Pos0
=
(
(
TEXTE_MODULE
*
)
item
)
->
m_Pos
;
(
(
TEXTE_MODULE
*
)
item
)
->
m_Orient
+=
900
;
(
(
TEXTE_MODULE
*
)
item
)
->
m_Orient
+=
900
;
break
;
break
;
default
:
;
}
}
item
->
m_Flags
=
item
->
m_Selected
=
0
;
item
->
m_Flags
=
item
->
m_Selected
=
0
;
...
...
pcbnew/class_edge_mod.cpp
View file @
f3c324d5
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
EDGE_MODULE
::
EDGE_MODULE
(
MODULE
*
parent
)
:
EDGE_MODULE
::
EDGE_MODULE
(
MODULE
*
parent
)
:
BOARD_ITEM
(
parent
,
TYPEEDGEMODULE
)
BOARD_ITEM
(
parent
,
TYPEEDGEMODULE
)
{
{
m_Width
=
0
;
m_Shape
=
S_SEGMENT
;
m_Shape
=
S_SEGMENT
;
m_Angle
=
0
;
m_Angle
=
0
;
m_Width
=
120
;
m_Width
=
120
;
...
...
pcbnew/class_track.cpp
View file @
f3c324d5
...
@@ -22,9 +22,10 @@
...
@@ -22,9 +22,10 @@
/* Constructeur des classes type pistes, vias et zones */
/* Constructeur des classes type pistes, vias et zones */
TRACK
::
TRACK
(
BOARD_ITEM
*
StructFather
,
DrawStructureType
idtype
)
:
TRACK
::
TRACK
(
BOARD_ITEM
*
StructFather
,
KICAD_T
idtype
)
:
BOARD_ITEM
(
StructFather
,
idtype
)
BOARD_ITEM
(
StructFather
,
idtype
)
{
{
m_Width
=
0
;
m_Shape
=
S_SEGMENT
;
m_Shape
=
S_SEGMENT
;
start
=
end
=
NULL
;
start
=
end
=
NULL
;
m_NetCode
=
0
;
m_NetCode
=
0
;
...
...
pcbnew/class_track.h
View file @
f3c324d5
...
@@ -40,7 +40,7 @@ public:
...
@@ -40,7 +40,7 @@ public:
int
m_Param
;
// Auxiliary variable ( used in some computations )
int
m_Param
;
// Auxiliary variable ( used in some computations )
public
:
public
:
TRACK
(
BOARD_ITEM
*
StructFather
,
DrawStructureType
idtype
=
TYPETRACK
);
TRACK
(
BOARD_ITEM
*
StructFather
,
KICAD_T
idtype
=
TYPETRACK
);
TRACK
(
const
TRACK
&
track
);
TRACK
(
const
TRACK
&
track
);
TRACK
*
Next
()
{
return
(
TRACK
*
)
Pnext
;
}
TRACK
*
Next
()
{
return
(
TRACK
*
)
Pnext
;
}
...
...
pcbnew/classpcb.cpp
View file @
f3c324d5
...
@@ -52,10 +52,10 @@ EDGE_ZONE:: ~EDGE_ZONE( void )
...
@@ -52,10 +52,10 @@ EDGE_ZONE:: ~EDGE_ZONE( void )
/**********************/
/**********************/
/* Classe DRAWSEGMENT: constructeur */
/* Classe DRAWSEGMENT: constructeur */
DRAWSEGMENT
::
DRAWSEGMENT
(
BOARD_ITEM
*
StructFather
,
DrawStructureType
idtype
)
:
DRAWSEGMENT
::
DRAWSEGMENT
(
BOARD_ITEM
*
StructFather
,
KICAD_T
idtype
)
:
BOARD_ITEM
(
StructFather
,
idtype
)
BOARD_ITEM
(
StructFather
,
idtype
)
{
{
m_Flags
=
m_Shape
=
m_Type
=
m_Angle
=
0
;
m_
Width
=
m_
Flags
=
m_Shape
=
m_Type
=
m_Angle
=
0
;
}
}
...
...
pcbnew/classtrc.cpp
View file @
f3c324d5
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
/* Constructeur des classes type pistes, vias et zones */
/* Constructeur des classes type pistes, vias et zones */
TRACK
::
TRACK
(
EDA_BaseStruct
*
StructFather
,
DrawStructureType
idtype
)
:
TRACK
::
TRACK
(
EDA_BaseStruct
*
StructFather
,
KICAD_T
idtype
)
:
SEGDRAW_Struct
(
StructFather
,
idtype
)
SEGDRAW_Struct
(
StructFather
,
idtype
)
{
{
m_Shape
=
S_SEGMENT
;
m_Shape
=
S_SEGMENT
;
...
...
pcbnew/dialog_track_options.cpp
View file @
f3c324d5
...
@@ -281,7 +281,7 @@ void WinEDA_PcbTracksDialog::AcceptPcbOptions(wxCommandEvent& event)
...
@@ -281,7 +281,7 @@ void WinEDA_PcbTracksDialog::AcceptPcbOptions(wxCommandEvent& event)
/*********************************************************************/
/*********************************************************************/
void
WinEDA_BasePcbFrame
::
AddHistory
(
int
value
,
DrawStructureType
type
)
void
WinEDA_BasePcbFrame
::
AddHistory
(
int
value
,
KICAD_T
type
)
/**********************************************************************/
/**********************************************************************/
// Mise a jour des listes des dernieres epaisseurs de via et track utilisées
// Mise a jour des listes des dernieres epaisseurs de via et track utilisées
{
{
...
...
pcbnew/ratsnest.cpp
View file @
f3c324d5
...
@@ -1254,6 +1254,9 @@ int* WinEDA_BasePcbFrame::build_ratsnest_pad( EDA_BaseStruct* ref,
...
@@ -1254,6 +1254,9 @@ int* WinEDA_BasePcbFrame::build_ratsnest_pad( EDA_BaseStruct* ref,
conn_number
=
track_ref
->
m_Sous_Netcode
;
conn_number
=
track_ref
->
m_Sous_Netcode
;
break
;
break
;
}
}
default
:
;
}
}
if
(
current_net_code
<=
0
)
if
(
current_net_code
<=
0
)
...
...
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