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
5748b791
Commit
5748b791
authored
17 years ago
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added some conditional DEBUG code for showing the pcb object tree in simple XML format
parent
02a2268f
teardrops
master
review
copy-of-subversion-repo
April-2010-release
No related merge requests found
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
2636 additions
and
2326 deletions
+2636
-2326
base_struct.cpp
common/base_struct.cpp
+45
-4
base_struct.h
include/base_struct.h
+27
-0
pcbstruct.h
include/pcbstruct.h
+16
-3
class_board.cpp
pcbnew/class_board.cpp
+33
-0
class_module.cpp
pcbnew/class_module.cpp
+1053
-951
class_module.h
pcbnew/class_module.h
+84
-71
files.cpp
pcbnew/files.cpp
+315
-303
ioascii.cpp
pcbnew/ioascii.cpp
+1063
-994
No files found.
common/base_struct.cpp
View file @
5748b791
...
@@ -18,8 +18,7 @@
...
@@ -18,8 +18,7 @@
// DrawStructureType names for error messages only:
// DrawStructureType names for error messages only:
static
wxString
DrawStructureTypeName
[
MAX_STRUCT_TYPE_ID
+
1
]
static
wxString
DrawStructureTypeName
[
MAX_STRUCT_TYPE_ID
+
1
]
=
{
=
{
wxT
(
"Not init"
),
wxT
(
"Not init"
),
wxT
(
"Pcb"
),
wxT
(
"Pcb"
),
...
@@ -168,10 +167,9 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
...
@@ -168,10 +167,9 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
*/
*/
{
{
}
}
#endif
#endif
/*********************************************/
/*********************************************/
wxString
EDA_BaseStruct
::
ReturnClassName
(
void
)
wxString
EDA_BaseStruct
::
ReturnClassName
(
void
)
/*********************************************/
/*********************************************/
...
@@ -191,6 +189,48 @@ wxString EDA_BaseStruct::ReturnClassName( void )
...
@@ -191,6 +189,48 @@ wxString EDA_BaseStruct::ReturnClassName( void )
}
}
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void
EDA_BaseStruct
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
{
// for now, make it look like XML:
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
ReturnClassName
().
mb_str
()
<<
">
\n
"
;
EDA_BaseStruct
*
kid
=
m_Son
;
for
(
;
kid
;
kid
=
kid
->
Pnext
)
{
kid
->
Show
(
nestLevel
+
1
,
os
);
}
NestedSpace
(
nestLevel
,
os
)
<<
"</"
<<
ReturnClassName
().
mb_str
()
<<
">
\n
"
;
}
/**
* Function NestedSpace
* outputs nested space for pretty indenting.
* @param nestLevel The nest count
* @param os The ostream&, where to output
* @return std::ostream& - for continuation.
**/
std
::
ostream
&
EDA_BaseStruct
::
NestedSpace
(
int
nestLevel
,
std
::
ostream
&
os
)
{
for
(
int
i
=
0
;
i
<
nestLevel
;
++
i
)
os
<<
' '
;
// number of spaces here controls indent per nest level
return
os
;
}
#endif
/**********************************************************************************************/
/**********************************************************************************************/
EDA_BaseLineStruct
::
EDA_BaseLineStruct
(
EDA_BaseStruct
*
StructFather
,
DrawStructureType
idtype
)
:
EDA_BaseLineStruct
::
EDA_BaseLineStruct
(
EDA_BaseStruct
*
StructFather
,
DrawStructureType
idtype
)
:
EDA_BaseStruct
(
StructFather
,
idtype
)
EDA_BaseStruct
(
StructFather
,
idtype
)
...
@@ -721,3 +761,4 @@ void DrawPickedStruct::DeleteWrapperList( void )
...
@@ -721,3 +761,4 @@ void DrawPickedStruct::DeleteWrapperList( void )
delete
wrapp_struct
;
delete
wrapp_struct
;
}
}
}
}
This diff is collapsed.
Click to expand it.
include/base_struct.h
View file @
5748b791
...
@@ -6,6 +6,11 @@
...
@@ -6,6 +6,11 @@
#define BASE_STRUCT_H
#define BASE_STRUCT_H
#if defined(DEBUG)
#include <iostream> // needed for Show()
#endif
/* Id for class identification, at run time */
/* Id for class identification, at run time */
enum
DrawStructureType
{
enum
DrawStructureType
{
TYPE_NOT_INIT
=
0
,
TYPE_NOT_INIT
=
0
,
...
@@ -123,8 +128,30 @@ public:
...
@@ -123,8 +128,30 @@ public:
const
wxPoint
&
offset
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
draw_mode
,
int
Color
=
-
1
);
int
Color
=
-
1
);
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
/**
* Function NestedSpace
* outputs nested space for pretty indenting.
* @param nestLevel The nest count
* @param os The ostream&, where to output
* @return std::ostream& - for continuation.
**/
static
std
::
ostream
&
NestedSpace
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
};
};
// Text justify:
// Text justify:
// Values -1,0,1 are used in computations, do not change them
// Values -1,0,1 are used in computations, do not change them
typedef
enum
{
typedef
enum
{
...
...
This diff is collapsed.
Click to expand it.
include/pcbstruct.h
View file @
5748b791
...
@@ -176,15 +176,16 @@ public:
...
@@ -176,15 +176,16 @@ public:
EDA_BoardDesignSettings
(
void
);
EDA_BoardDesignSettings
(
void
);
};
};
// Values for m_DisplayViaMode member:
// Values for m_DisplayViaMode member:
enum
DisplayViaMode
{
enum
DisplayViaMode
{
VIA_HOLE_NOT_SHOW
=
0
,
VIA_HOLE_NOT_SHOW
=
0
,
VIA_SPECIAL_HOLE_SHOW
,
VIA_SPECIAL_HOLE_SHOW
,
ALL_VIA_HOLE_SHOW
,
ALL_VIA_HOLE_SHOW
,
OPT_VIA_HOLE_END
OPT_VIA_HOLE_END
};
};
class
BOARD
:
public
EDA_BaseStruct
class
BOARD
:
public
EDA_BaseStruct
{
{
public
:
public
:
...
@@ -212,7 +213,7 @@ public:
...
@@ -212,7 +213,7 @@ public:
CHEVELU
*
m_Ratsnest
;
// pointeur liste des chevelus
CHEVELU
*
m_Ratsnest
;
// pointeur liste des chevelus
CHEVELU
*
m_LocalRatsnest
;
// pointeur liste des chevelus d'un module
CHEVELU
*
m_LocalRatsnest
;
// pointeur liste des chevelus d'un module
EDGE_ZONE
*
m_CurrentLimitZone
;
/* pointeur sur la liste des segments
EDGE_ZONE
*
m_CurrentLimitZone
;
/* pointeur sur la liste des segments
* de delimitation de la zone en cours de trace */
* de delimitation de la zone en cours de trace */
BOARD
(
EDA_BaseStruct
*
StructFather
,
WinEDA_BasePcbFrame
*
frame
);
BOARD
(
EDA_BaseStruct
*
StructFather
,
WinEDA_BasePcbFrame
*
frame
);
...
@@ -230,6 +231,18 @@ public:
...
@@ -230,6 +231,18 @@ public:
// Calcul du rectangle d'encadrement:
// Calcul du rectangle d'encadrement:
bool
ComputeBoundaryBox
(
void
);
bool
ComputeBoundaryBox
(
void
);
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
};
};
...
...
This diff is collapsed.
Click to expand it.
pcbnew/class_board.cpp
View file @
5748b791
...
@@ -254,3 +254,36 @@ bool BOARD::ComputeBoundaryBox( void )
...
@@ -254,3 +254,36 @@ bool BOARD::ComputeBoundaryBox( void )
return
Has_Items
;
return
Has_Items
;
}
}
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void
BOARD
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
{
// for now, make it look like XML:
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
ReturnClassName
().
mb_str
()
<<
">
\n
"
;
// specialization of the output:
EDA_BaseStruct
*
p
=
m_Modules
;
for
(
;
p
;
p
=
p
->
Pnext
)
p
->
Show
(
nestLevel
+
1
,
os
);
p
=
m_Drawings
;
for
(
;
p
;
p
=
p
->
Pnext
)
p
->
Show
(
nestLevel
+
1
,
os
);
EDA_BaseStruct
*
kid
=
m_Son
;
for
(
;
kid
;
kid
=
kid
->
Pnext
)
{
kid
->
Show
(
nestLevel
+
1
,
os
);
}
NestedSpace
(
nestLevel
,
os
)
<<
"</"
<<
ReturnClassName
().
mb_str
()
<<
">
\n
"
;
}
#endif
This diff is collapsed.
Click to expand it.
pcbnew/class_module.cpp
View file @
5748b791
/****************************************************/
/****************************************************/
/* class_module.cpp : fonctions de la classe MODULE */
/* class_module.cpp : fonctions de la classe MODULE */
/****************************************************/
/****************************************************/
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -26,38 +26,39 @@
...
@@ -26,38 +26,39 @@
#define MAX_WIDTH 10000 // Epaisseur (en 1/10000 ") max raisonnable des traits, textes...
#define MAX_WIDTH 10000 // Epaisseur (en 1/10000 ") max raisonnable des traits, textes...
/*********************************************************************************/
/*********************************************************************************/
void
MODULE
::
DrawAncre
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
void
MODULE
::
DrawAncre
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
dim_ancre
,
int
draw_mode
)
int
dim_ancre
,
int
draw_mode
)
/*********************************************************************************/
/*********************************************************************************/
/* trace de l'ancre (croix verticale)
/* trace de l'ancre (croix verticale)
(doit etre fait apres les pads,
*
(doit etre fait apres les pads,
car le trace du trou efface tout donc peut etre l'ancre */
*
car le trace du trou efface tout donc peut etre l'ancre */
{
{
int
zoom
=
panel
->
GetZoom
();
int
zoom
=
panel
->
GetZoom
();
int
anchor_size
=
dim_ancre
*
zoom
;
int
anchor_size
=
dim_ancre
*
zoom
;
GRSetDrawMode
(
DC
,
draw_mode
);
GRSetDrawMode
(
DC
,
draw_mode
);
if
(
(
g_AnchorColor
&
ITEM_NOT_SHOW
)
==
0
)
if
(
(
g_AnchorColor
&
ITEM_NOT_SHOW
)
==
0
)
{
{
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
m_Pos
.
x
-
offset
.
x
-
anchor_size
,
m_Pos
.
y
-
offset
.
y
,
m_Pos
.
x
-
offset
.
x
-
anchor_size
,
m_Pos
.
y
-
offset
.
y
,
m_Pos
.
x
-
offset
.
x
+
anchor_size
,
m_Pos
.
y
-
offset
.
y
,
m_Pos
.
x
-
offset
.
x
+
anchor_size
,
m_Pos
.
y
-
offset
.
y
,
0
,
g_AnchorColor
);
0
,
g_AnchorColor
);
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
m_Pos
.
x
-
offset
.
x
,
m_Pos
.
y
-
offset
.
y
-
anchor_size
,
m_Pos
.
x
-
offset
.
x
,
m_Pos
.
y
-
offset
.
y
-
anchor_size
,
m_Pos
.
x
-
offset
.
x
,
m_Pos
.
y
-
offset
.
y
+
anchor_size
,
m_Pos
.
x
-
offset
.
x
,
m_Pos
.
y
-
offset
.
y
+
anchor_size
,
0
,
g_AnchorColor
);
0
,
g_AnchorColor
);
}
}
}
}
/*************************************************/
/*************************************************/
/* Class MODULE : description d'un composant pcb */
/* Class MODULE : description d'un composant pcb */
/*************************************************/
/*************************************************/
/* Constructeur de la classe MODULE */
/* Constructeur de la classe MODULE */
MODULE
::
MODULE
(
BOARD
*
parent
)
:
EDA_BaseStruct
(
parent
,
TYPEMODULE
)
MODULE
::
MODULE
(
BOARD
*
parent
)
:
EDA_BaseStruct
(
parent
,
TYPEMODULE
)
{
{
m_Pads
=
NULL
;
m_Pads
=
NULL
;
m_Drawings
=
NULL
;
m_Drawings
=
NULL
;
...
@@ -70,62 +71,65 @@ MODULE::MODULE(BOARD * parent): EDA_BaseStruct( parent, TYPEMODULE)
...
@@ -70,62 +71,65 @@ MODULE::MODULE(BOARD * parent): EDA_BaseStruct( parent, TYPEMODULE)
m_CntRot90
=
m_CntRot180
=
0
;
m_CntRot90
=
m_CntRot180
=
0
;
m_Surface
=
0
;
m_Surface
=
0
;
m_Link
=
0
;
m_Link
=
0
;
m_LastEdit_Time
=
time
(
NULL
);
m_LastEdit_Time
=
time
(
NULL
);
m_Reference
=
new
TEXTE_MODULE
(
this
,
TEXT_is_REFERENCE
);
m_Reference
=
new
TEXTE_MODULE
(
this
,
TEXT_is_REFERENCE
);
m_Reference
->
Pback
=
this
;
m_Reference
->
Pback
=
this
;
m_Value
=
new
TEXTE_MODULE
(
this
,
TEXT_is_VALUE
);
m_Value
=
new
TEXTE_MODULE
(
this
,
TEXT_is_VALUE
);
m_Value
->
Pback
=
this
;
m_Value
->
Pback
=
this
;
m_3D_Drawings
=
new
Struct3D_Master
(
this
);
m_3D_Drawings
=
new
Struct3D_Master
(
this
);
}
}
/* Destructeur */
MODULE
::~
MODULE
(
void
)
/* Destructeur */
MODULE
::~
MODULE
(
void
)
{
{
D_PAD
*
Pad
;
D_PAD
*
Pad
;
EDA_BaseStruct
*
Struct
,
*
NextStruct
;
EDA_BaseStruct
*
Struct
,
*
NextStruct
;
delete
m_Reference
;
delete
m_Reference
;
delete
m_Value
;
delete
m_Value
;
for
(
Struct
=
m_3D_Drawings
;
Struct
!=
NULL
;
Struct
=
NextStruct
)
for
(
Struct
=
m_3D_Drawings
;
Struct
!=
NULL
;
Struct
=
NextStruct
)
{
{
NextStruct
=
Struct
->
Pnext
;
NextStruct
=
Struct
->
Pnext
;
delete
Struct
;
delete
Struct
;
}
}
/* effacement des pads */
/* effacement des pads */
for
(
Pad
=
m_Pads
;
Pad
!=
NULL
;
Pad
=
(
D_PAD
*
)
NextStruct
)
for
(
Pad
=
m_Pads
;
Pad
!=
NULL
;
Pad
=
(
D_PAD
*
)
NextStruct
)
{
{
NextStruct
=
Pad
->
Pnext
;
NextStruct
=
Pad
->
Pnext
;
delete
Pad
;
delete
Pad
;
}
}
/* effacement des elements de trace */
/* effacement des elements de trace */
for
(
Struct
=
m_Drawings
;
Struct
!=
NULL
;
Struct
=
NextStruct
)
for
(
Struct
=
m_Drawings
;
Struct
!=
NULL
;
Struct
=
NextStruct
)
{
{
NextStruct
=
Struct
->
Pnext
;
NextStruct
=
Struct
->
Pnext
;
switch
(
(
Struct
->
m_StructType
)
)
switch
(
(
Struct
->
m_StructType
)
)
{
{
case
TYPEEDGEMODULE
:
case
TYPEEDGEMODULE
:
delete
(
EDGE_MODULE
*
)
Struct
;
delete
(
EDGE_MODULE
*
)
Struct
;
break
;
break
;
case
TYPETEXTEMODULE
:
case
TYPETEXTEMODULE
:
delete
(
TEXTE_MODULE
*
)
Struct
;
delete
(
TEXTE_MODULE
*
)
Struct
;
break
;
break
;
default
:
default
:
DisplayError
(
NULL
,
wxT
(
"Warn: ItemType not handled in delete MODULE"
)
);
DisplayError
(
NULL
,
wxT
(
"Warn: ItemType not handled in delete MODULE"
)
);
NextStruct
=
NULL
;
NextStruct
=
NULL
;
break
;
break
;
}
}
}
}
}
}
/*********************************/
/*********************************/
void
MODULE
::
Copy
(
MODULE
*
Module
)
void
MODULE
::
Copy
(
MODULE
*
Module
)
/*********************************/
/*********************************/
{
{
D_PAD
*
pad
,
*
lastpad
;
D_PAD
*
pad
,
*
lastpad
;
m_Pos
=
Module
->
m_Pos
;
m_Pos
=
Module
->
m_Pos
;
m_Layer
=
Module
->
m_Layer
;
m_Layer
=
Module
->
m_Layer
;
...
@@ -140,20 +144,20 @@ D_PAD * pad,* lastpad;
...
@@ -140,20 +144,20 @@ D_PAD * pad,* lastpad;
m_TimeStamp
=
GetTimeStamp
();
m_TimeStamp
=
GetTimeStamp
();
/* Copy des structures auxiliaires: Reference et value */
/* Copy des structures auxiliaires: Reference et value */
m_Reference
->
Copy
(
Module
->
m_Reference
);
m_Reference
->
Copy
(
Module
->
m_Reference
);
m_Value
->
Copy
(
Module
->
m_Value
);
m_Value
->
Copy
(
Module
->
m_Value
);
/* Copie des structures auxiliaires: Pads */
/* Copie des structures auxiliaires: Pads */
lastpad
=
NULL
;
pad
=
Module
->
m_Pads
;
lastpad
=
NULL
;
pad
=
Module
->
m_Pads
;
for
(
;
pad
!=
NULL
;
pad
=
(
D_PAD
*
)
pad
->
Pnext
)
for
(
;
pad
!=
NULL
;
pad
=
(
D_PAD
*
)
pad
->
Pnext
)
{
{
D_PAD
*
newpad
=
new
D_PAD
(
this
);
D_PAD
*
newpad
=
new
D_PAD
(
this
);
newpad
->
Copy
(
pad
);
newpad
->
Copy
(
pad
);
if
(
m_Pads
==
NULL
)
if
(
m_Pads
==
NULL
)
{
{
newpad
->
Pback
=
this
;
newpad
->
Pback
=
this
;
m_Pads
=
(
D_PAD
*
)
newpad
;
m_Pads
=
(
D_PAD
*
)
newpad
;
}
}
else
else
{
{
...
@@ -165,27 +169,31 @@ D_PAD * pad,* lastpad;
...
@@ -165,27 +169,31 @@ D_PAD * pad,* lastpad;
/* Copy des structures auxiliaires: Drawings */
/* Copy des structures auxiliaires: Drawings */
EDA_BaseStruct
*
OldStruct
=
(
EDA_BaseStruct
*
)
Module
->
m_Drawings
;
EDA_BaseStruct
*
OldStruct
=
(
EDA_BaseStruct
*
)
Module
->
m_Drawings
;
EDA_BaseStruct
*
NewStruct
,
*
LastStruct
=
NULL
;
EDA_BaseStruct
*
NewStruct
,
*
LastStruct
=
NULL
;
for
(
;
OldStruct
;
OldStruct
=
OldStruct
->
Pnext
)
for
(
;
OldStruct
;
OldStruct
=
OldStruct
->
Pnext
)
{
{
NewStruct
=
NULL
;
NewStruct
=
NULL
;
switch
(
OldStruct
->
m_StructType
)
switch
(
OldStruct
->
m_StructType
)
{
{
case
TYPETEXTEMODULE
:
case
TYPETEXTEMODULE
:
NewStruct
=
new
TEXTE_MODULE
(
this
);
NewStruct
=
new
TEXTE_MODULE
(
this
);
((
TEXTE_MODULE
*
)
NewStruct
)
->
Copy
((
TEXTE_MODULE
*
)
OldStruct
);
(
(
TEXTE_MODULE
*
)
NewStruct
)
->
Copy
(
(
TEXTE_MODULE
*
)
OldStruct
);
break
;
break
;
case
TYPEEDGEMODULE
:
case
TYPEEDGEMODULE
:
NewStruct
=
new
EDGE_MODULE
(
this
);
NewStruct
=
new
EDGE_MODULE
(
this
);
((
EDGE_MODULE
*
)
NewStruct
)
->
Copy
((
EDGE_MODULE
*
)
OldStruct
);
(
(
EDGE_MODULE
*
)
NewStruct
)
->
Copy
(
(
EDGE_MODULE
*
)
OldStruct
);
break
;
break
;
default
:
default
:
DisplayError
(
NULL
,
wxT
(
"Internal Err: CopyModule: type indefini"
)
);
DisplayError
(
NULL
,
wxT
(
"Internal Err: CopyModule: type indefini"
)
);
break
;
break
;
}
}
if
(
NewStruct
==
NULL
)
break
;
if
(
m_Drawings
==
NULL
)
if
(
NewStruct
==
NULL
)
break
;
if
(
m_Drawings
==
NULL
)
{
{
NewStruct
->
Pback
=
this
;
NewStruct
->
Pback
=
this
;
m_Drawings
=
NewStruct
;
m_Drawings
=
NewStruct
;
...
@@ -199,14 +207,14 @@ D_PAD * pad,* lastpad;
...
@@ -199,14 +207,14 @@ D_PAD * pad,* lastpad;
}
}
/* Copy des elements complementaires Drawings 3D */
/* Copy des elements complementaires Drawings 3D */
m_3D_Drawings
->
Copy
(
Module
->
m_3D_Drawings
);
m_3D_Drawings
->
Copy
(
Module
->
m_3D_Drawings
);
Struct3D_Master
*
Struct3D
,
*
NewStruct3D
,
*
CurrStruct3D
;
Struct3D_Master
*
Struct3D
,
*
NewStruct3D
,
*
CurrStruct3D
;
Struct3D
=
(
Struct3D_Master
*
)
Module
->
m_3D_Drawings
->
Pnext
;
Struct3D
=
(
Struct3D_Master
*
)
Module
->
m_3D_Drawings
->
Pnext
;
CurrStruct3D
=
m_3D_Drawings
;
CurrStruct3D
=
m_3D_Drawings
;
for
(
;
Struct3D
!=
NULL
;
Struct3D
=
(
Struct3D_Master
*
)
Struct3D
->
Pnext
)
for
(
;
Struct3D
!=
NULL
;
Struct3D
=
(
Struct3D_Master
*
)
Struct3D
->
Pnext
)
{
{
NewStruct3D
=
new
Struct3D_Master
(
this
);
NewStruct3D
=
new
Struct3D_Master
(
this
);
NewStruct3D
->
Copy
(
Struct3D
);
NewStruct3D
->
Copy
(
Struct3D
);
CurrStruct3D
->
Pnext
=
NewStruct3D
;
CurrStruct3D
->
Pnext
=
NewStruct3D
;
NewStruct3D
->
Pback
=
CurrStruct3D
;
NewStruct3D
->
Pback
=
CurrStruct3D
;
CurrStruct3D
=
NewStruct3D
;
CurrStruct3D
=
NewStruct3D
;
...
@@ -215,221 +223,234 @@ Struct3D_Master * Struct3D, *NewStruct3D, *CurrStruct3D;
...
@@ -215,221 +223,234 @@ Struct3D_Master * Struct3D, *NewStruct3D, *CurrStruct3D;
/* Copie des elements complementaires */
/* Copie des elements complementaires */
m_Doc
=
Module
->
m_Doc
;
m_Doc
=
Module
->
m_Doc
;
m_KeyWord
=
Module
->
m_KeyWord
;
m_KeyWord
=
Module
->
m_KeyWord
;
}
}
/* supprime du chainage la structure Struct
/* supprime du chainage la structure Struct
les structures arrieres et avant sont chainees directement
*
les structures arrieres et avant sont chainees directement
*/
*/
void
MODULE
::
UnLink
(
void
)
void
MODULE
::
UnLink
(
void
)
{
{
/* Modification du chainage arriere */
/* Modification du chainage arriere */
if
(
Pback
)
if
(
Pback
)
{
{
if
(
Pback
->
m_StructType
!=
TYPEPCB
)
if
(
Pback
->
m_StructType
!=
TYPEPCB
)
{
{
Pback
->
Pnext
=
Pnext
;
Pback
->
Pnext
=
Pnext
;
}
}
else
/* Le chainage arriere pointe sur la structure "Pere" */
else
/* Le chainage arriere pointe sur la structure "Pere" */
{
{
if
(
GetState
(
DELETED
)
)
// A REVOIR car Pback = NULL si place en undelete
if
(
GetState
(
DELETED
)
)
// A REVOIR car Pback = NULL si place en undelete
{
{
if
(
g_UnDeleteStack
)
g_UnDeleteStack
[
g_UnDeleteStackPtr
-
1
]
=
Pnext
;
if
(
g_UnDeleteStack
)
g_UnDeleteStack
[
g_UnDeleteStackPtr
-
1
]
=
Pnext
;
}
}
else
((
BOARD
*
)
Pback
)
->
m_Modules
=
(
MODULE
*
)
Pnext
;
else
(
(
BOARD
*
)
Pback
)
->
m_Modules
=
(
MODULE
*
)
Pnext
;
}
}
}
}
/* Modification du chainage avant */
/* Modification du chainage avant */
if
(
Pnext
)
Pnext
->
Pback
=
Pback
;
if
(
Pnext
)
Pnext
->
Pback
=
Pback
;
Pnext
=
Pback
=
NULL
;
Pnext
=
Pback
=
NULL
;
}
}
/**********************************************************/
/**********************************************************/
void
MODULE
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
MODULE
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
)
const
wxPoint
&
offset
,
int
draw_mode
)
/**********************************************************/
/**********************************************************/
/* Dessin d'une empreinte sur l'ecran actif:
/* Dessin d'une empreinte sur l'ecran actif:
Entree :
*
Entree :
Module: pointeur sur le module
*
Module: pointeur sur le module
ox, oy = offset de trace
*
ox, oy = offset de trace
draw_mode = mode de trace ( GR_OR, GR_XOR, GR_AND)
*
draw_mode = mode de trace ( GR_OR, GR_XOR, GR_AND)
Utilise par ailleur:
*
Utilise par ailleur:
Description des parametres de l'empreinte calcules par caract() ;
*
Description des parametres de l'empreinte calcules par caract() ;
*/
*/
{
{
D_PAD
*
pt_pad
;
D_PAD
*
pt_pad
;
EDA_BaseStruct
*
PtStruct
;
EDA_BaseStruct
*
PtStruct
;
TEXTE_MODULE
*
PtTexte
;
TEXTE_MODULE
*
PtTexte
;
/* trace des pastilles */
/* trace des pastilles */
pt_pad
=
m_Pads
;
pt_pad
=
m_Pads
;
for
(
;
pt_pad
!=
NULL
;
pt_pad
=
(
D_PAD
*
)
pt_pad
->
Pnext
)
for
(
;
pt_pad
!=
NULL
;
pt_pad
=
(
D_PAD
*
)
pt_pad
->
Pnext
)
{
{
if
(
pt_pad
->
m_Flags
&
IS_MOVED
)
continue
;
if
(
pt_pad
->
m_Flags
&
IS_MOVED
)
pt_pad
->
Draw
(
panel
,
DC
,
offset
,
draw_mode
);
continue
;
pt_pad
->
Draw
(
panel
,
DC
,
offset
,
draw_mode
);
}
}
/* Impression de l'ancre du module */
/* Impression de l'ancre du module */
DrawAncre
(
panel
,
DC
,
offset
,
DIM_ANCRE_MODULE
,
draw_mode
)
;
DrawAncre
(
panel
,
DC
,
offset
,
DIM_ANCRE_MODULE
,
draw_mode
)
;
/* impression des graphismes */
/* impression des graphismes */
if
(
!
(
m_Reference
->
m_Flags
&
IS_MOVED
)
)
if
(
!
(
m_Reference
->
m_Flags
&
IS_MOVED
)
)
m_Reference
->
Draw
(
panel
,
DC
,
offset
,
draw_mode
);
m_Reference
->
Draw
(
panel
,
DC
,
offset
,
draw_mode
);
if
(
!
(
m_Value
->
m_Flags
&
IS_MOVED
)
)
if
(
!
(
m_Value
->
m_Flags
&
IS_MOVED
)
)
m_Value
->
Draw
(
panel
,
DC
,
offset
,
draw_mode
);
m_Value
->
Draw
(
panel
,
DC
,
offset
,
draw_mode
);
PtStruct
=
m_Drawings
;
PtStruct
=
m_Drawings
;
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
{
{
if
(
PtStruct
->
m_Flags
&
IS_MOVED
)
continue
;
if
(
PtStruct
->
m_Flags
&
IS_MOVED
)
continue
;
switch
(
PtStruct
->
m_StructType
)
switch
(
PtStruct
->
m_StructType
)
{
{
case
TYPETEXTEMODULE
:
case
TYPETEXTEMODULE
:
PtTexte
=
(
TEXTE_MODULE
*
)
PtStruct
;
PtTexte
=
(
TEXTE_MODULE
*
)
PtStruct
;
PtTexte
->
Draw
(
panel
,
DC
,
offset
,
draw_mode
);
PtTexte
->
Draw
(
panel
,
DC
,
offset
,
draw_mode
);
break
;
break
;
case
TYPEEDGEMODULE
:
case
TYPEEDGEMODULE
:
((
EDGE_MODULE
*
)
PtStruct
)
->
Draw
(
panel
,
DC
,
offset
,
draw_mode
);
(
(
EDGE_MODULE
*
)
PtStruct
)
->
Draw
(
panel
,
DC
,
offset
,
draw_mode
);
break
;
break
;
default
:
break
;
default
:
break
;
}
}
}
}
}
}
/**************************************************************/
/**************************************************************/
void
MODULE
::
DrawEdgesOnly
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
MODULE
::
DrawEdgesOnly
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
)
const
wxPoint
&
offset
,
int
draw_mode
)
/**************************************************************/
/**************************************************************/
{
{
EDA_BaseStruct
*
PtStruct
;
EDA_BaseStruct
*
PtStruct
;
/* impression des graphismes */
/* impression des graphismes */
PtStruct
=
m_Drawings
;
PtStruct
=
m_Drawings
;
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
{
{
switch
(
PtStruct
->
m_StructType
)
switch
(
PtStruct
->
m_StructType
)
{
{
case
TYPEEDGEMODULE
:
case
TYPEEDGEMODULE
:
((
EDGE_MODULE
*
)
PtStruct
)
->
Draw
(
panel
,
DC
,
offset
,
draw_mode
);
(
(
EDGE_MODULE
*
)
PtStruct
)
->
Draw
(
panel
,
DC
,
offset
,
draw_mode
);
break
;
break
;
default
:
break
;
default
:
break
;
}
}
}
}
}
}
/*************************************/
/*************************************/
int
MODULE
::
WriteDescr
(
FILE
*
File
)
int
MODULE
::
WriteDescr
(
FILE
*
File
)
/*************************************/
/*************************************/
/* Sauvegarde de la description d'un MODULE
/* Sauvegarde de la description d'un MODULE
*/
*/
{
{
char
StringStat
[
20
];
char
StringStat
[
20
];
TEXTE_MODULE
*
PtText
;
TEXTE_MODULE
*
PtText
;
EDGE_MODULE
*
PtEdge
;
EDGE_MODULE
*
PtEdge
;
D_PAD
*
ptpad
;
D_PAD
*
ptpad
;
EDA_BaseStruct
*
PtStruct
;
EDA_BaseStruct
*
PtStruct
;
int
ii
,
NbLigne
=
0
;
int
ii
,
NbLigne
=
0
;
wxString
msg
;
wxString
msg
;
if
(
GetState
(
DELETED
)
)
return
(
NbLigne
);
if
(
GetState
(
DELETED
)
)
return
NbLigne
;
/* Generation du fichier module: */
/* Generation du fichier module: */
fprintf
(
File
,
"$MODULE %s
\n
"
,
CONV_TO_UTF8
(
m_LibRef
)
);
fprintf
(
File
,
"$MODULE %s
\n
"
,
CONV_TO_UTF8
(
m_LibRef
)
);
NbLigne
++
;
NbLigne
++
;
/* Generation des coord et caracteristiques */
/* Generation des coord et caracteristiques */
memset
(
StringStat
,
0
,
sizeof
(
StringStat
)
);
memset
(
StringStat
,
0
,
sizeof
(
StringStat
)
);
if
(
m_ModuleStatus
&
MODULE_is_LOCKED
)
if
(
m_ModuleStatus
&
MODULE_is_LOCKED
)
StringStat
[
0
]
=
'F'
;
StringStat
[
0
]
=
'F'
;
else
StringStat
[
0
]
=
'~'
;
else
if
(
m_ModuleStatus
&
MODULE_is_PLACED
)
StringStat
[
0
]
=
'~'
;
if
(
m_ModuleStatus
&
MODULE_is_PLACED
)
StringStat
[
1
]
=
'P'
;
StringStat
[
1
]
=
'P'
;
else
StringStat
[
1
]
=
'~'
;
else
StringStat
[
1
]
=
'~'
;
fprintf
(
File
,
"Po %d %d %d %d %8.8lX %8.8lX %s
\n
"
,
fprintf
(
File
,
"Po %d %d %d %d %8.8lX %8.8lX %s
\n
"
,
m_Pos
.
x
,
m_Pos
.
y
,
m_Pos
.
x
,
m_Pos
.
y
,
m_Orient
,
m_Layer
,
m_LastEdit_Time
,
m_Orient
,
m_Layer
,
m_LastEdit_Time
,
m_TimeStamp
,
StringStat
);
m_TimeStamp
,
StringStat
);
NbLigne
++
;
NbLigne
++
;
fprintf
(
File
,
"Li %s
\n
"
,
CONV_TO_UTF8
(
m_LibRef
)
);
fprintf
(
File
,
"Li %s
\n
"
,
CONV_TO_UTF8
(
m_LibRef
)
);
NbLigne
++
;
NbLigne
++
;
if
(
!
m_Doc
.
IsEmpty
()
)
if
(
!
m_Doc
.
IsEmpty
()
)
{
{
fprintf
(
File
,
"Cd %s
\n
"
,
CONV_TO_UTF8
(
m_Doc
)
);
fprintf
(
File
,
"Cd %s
\n
"
,
CONV_TO_UTF8
(
m_Doc
)
);
NbLigne
++
;
NbLigne
++
;
}
}
if
(
!
m_KeyWord
.
IsEmpty
()
)
if
(
!
m_KeyWord
.
IsEmpty
()
)
{
{
fprintf
(
File
,
"Kw %s
\n
"
,
CONV_TO_UTF8
(
m_KeyWord
)
);
fprintf
(
File
,
"Kw %s
\n
"
,
CONV_TO_UTF8
(
m_KeyWord
)
);
NbLigne
++
;
NbLigne
++
;
}
}
fprintf
(
File
,
"Sc %8.8lX
\n
"
,
m_TimeStamp
);
fprintf
(
File
,
"Sc %8.8lX
\n
"
,
m_TimeStamp
);
NbLigne
++
;
NbLigne
++
;
fprintf
(
File
,
"Op %X %X 0
\n
"
,
m_CntRot90
,
m_CntRot180
);
fprintf
(
File
,
"Op %X %X 0
\n
"
,
m_CntRot90
,
m_CntRot180
);
NbLigne
++
;
NbLigne
++
;
/* Attributs du module */
/* Attributs du module */
if
(
m_Attributs
!=
MOD_DEFAULT
)
if
(
m_Attributs
!=
MOD_DEFAULT
)
{
{
fprintf
(
File
,
"At "
);
fprintf
(
File
,
"At "
);
if
(
m_Attributs
&
MOD_CMS
)
fprintf
(
File
,
"SMD "
);
if
(
m_Attributs
&
MOD_CMS
)
if
(
m_Attributs
&
MOD_VIRTUAL
)
fprintf
(
File
,
"VIRTUAL "
);
fprintf
(
File
,
"SMD "
);
fprintf
(
File
,
"
\n
"
);
if
(
m_Attributs
&
MOD_VIRTUAL
)
fprintf
(
File
,
"VIRTUAL "
);
fprintf
(
File
,
"
\n
"
);
}
}
/* Texte Reference du module */
/* Texte Reference du module */
fprintf
(
File
,
"T%d %d %d %d %d %d %d %c %c %d
\"
%.16s
\"\n
"
,
fprintf
(
File
,
"T%d %d %d %d %d %d %d %c %c %d
\"
%.16s
\"\n
"
,
m_Reference
->
m_Type
,
m_Reference
->
m_Type
,
m_Reference
->
m_Pos0
.
x
,
m_Reference
->
m_Pos0
.
y
,
m_Reference
->
m_Pos0
.
x
,
m_Reference
->
m_Pos0
.
y
,
m_Reference
->
m_Size
.
y
,
m_Reference
->
m_Size
.
x
,
m_Reference
->
m_Size
.
y
,
m_Reference
->
m_Size
.
x
,
m_Reference
->
m_Orient
+
m_Orient
,
m_Reference
->
m_Width
,
m_Reference
->
m_Orient
+
m_Orient
,
m_Reference
->
m_Width
,
m_Reference
->
m_Miroir
?
'N'
:
'M'
,
m_Reference
->
m_NoShow
?
'I'
:
'V'
,
m_Reference
->
m_Miroir
?
'N'
:
'M'
,
m_Reference
->
m_NoShow
?
'I'
:
'V'
,
m_Reference
->
m_Layer
,
m_Reference
->
m_Layer
,
CONV_TO_UTF8
(
m_Reference
->
m_Text
)
);
CONV_TO_UTF8
(
m_Reference
->
m_Text
)
);
NbLigne
++
;
NbLigne
++
;
/* Texte Value du module */
/* Texte Value du module */
fprintf
(
File
,
"T%d %d %d %d %d %d %d %c %c %d
\"
%.16s
\"\n
"
,
fprintf
(
File
,
"T%d %d %d %d %d %d %d %c %c %d
\"
%.16s
\"\n
"
,
m_Value
->
m_Type
,
m_Value
->
m_Type
,
m_Value
->
m_Pos0
.
x
,
m_Value
->
m_Pos0
.
y
,
m_Value
->
m_Pos0
.
x
,
m_Value
->
m_Pos0
.
y
,
m_Value
->
m_Size
.
y
,
m_Value
->
m_Size
.
x
,
m_Value
->
m_Size
.
y
,
m_Value
->
m_Size
.
x
,
m_Value
->
m_Orient
+
m_Orient
,
m_Value
->
m_Width
,
m_Value
->
m_Orient
+
m_Orient
,
m_Value
->
m_Width
,
m_Value
->
m_Miroir
?
'N'
:
'M'
,
m_Value
->
m_NoShow
?
'I'
:
'V'
,
m_Value
->
m_Miroir
?
'N'
:
'M'
,
m_Value
->
m_NoShow
?
'I'
:
'V'
,
m_Value
->
m_Layer
,
m_Value
->
m_Layer
,
CONV_TO_UTF8
(
m_Value
->
m_Text
)
);
CONV_TO_UTF8
(
m_Value
->
m_Text
)
);
NbLigne
++
;
NbLigne
++
;
/* Generation des elements Drawing modules */
/* Generation des elements Drawing modules */
PtStruct
=
m_Drawings
;
PtStruct
=
m_Drawings
;
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
{
{
switch
(
PtStruct
->
m_StructType
)
switch
(
PtStruct
->
m_StructType
)
{
{
case
TYPETEXTEMODULE
:
case
TYPETEXTEMODULE
:
PtText
=
((
TEXTE_MODULE
*
)
PtStruct
);
PtText
=
(
(
TEXTE_MODULE
*
)
PtStruct
);
fprintf
(
File
,
"T%d %d %d %d %d %d %d %c %c %d
\"
%s
\"\n
"
,
fprintf
(
File
,
"T%d %d %d %d %d %d %d %c %c %d
\"
%s
\"\n
"
,
PtText
->
m_Type
,
PtText
->
m_Type
,
PtText
->
m_Pos0
.
x
,
PtText
->
m_Pos0
.
y
,
PtText
->
m_Pos0
.
x
,
PtText
->
m_Pos0
.
y
,
PtText
->
m_Size
.
y
,
PtText
->
m_Size
.
x
,
PtText
->
m_Size
.
y
,
PtText
->
m_Size
.
x
,
PtText
->
m_Orient
+
m_Orient
,
PtText
->
m_Width
,
PtText
->
m_Orient
+
m_Orient
,
PtText
->
m_Width
,
PtText
->
m_Miroir
?
'N'
:
'M'
,
PtText
->
m_Miroir
?
'N'
:
'M'
,
PtText
->
m_NoShow
?
'I'
:
'V'
,
PtText
->
m_NoShow
?
'I'
:
'V'
,
PtText
->
m_Layer
,
CONV_TO_UTF8
(
PtText
->
m_Text
)
);
PtText
->
m_Layer
,
CONV_TO_UTF8
(
PtText
->
m_Text
)
);
NbLigne
++
;
NbLigne
++
;
break
;
break
;
...
@@ -439,237 +460,261 @@ wxString msg;
...
@@ -439,237 +460,261 @@ wxString msg;
break
;
break
;
default
:
default
:
msg
.
Printf
(
wxT
(
"Type (%d) Draw Module inconnu"
),
msg
.
Printf
(
wxT
(
"Type (%d) Draw Module inconnu"
),
PtStruct
->
m_StructType
);
PtStruct
->
m_StructType
);
DisplayError
(
NULL
,
msg
);
DisplayError
(
NULL
,
msg
);
break
;
break
;
}
/* Fin switch gestion des Items draw */
}
/* Fin switch gestion des Items draw */
}
}
/* Generation de la liste des pads */
/* Generation de la liste des pads */
ptpad
=
m_Pads
;
ptpad
=
m_Pads
;
for
(
;
ptpad
!=
NULL
;
ptpad
=
(
D_PAD
*
)
ptpad
->
Pnext
)
for
(
;
ptpad
!=
NULL
;
ptpad
=
(
D_PAD
*
)
ptpad
->
Pnext
)
{
{
ii
=
ptpad
->
WriteDescr
(
File
);
ii
=
ptpad
->
WriteDescr
(
File
);
NbLigne
+=
ii
;
NbLigne
+=
ii
;
}
}
/* Generation des informations de trac
3D */
/* Generation des informations de trac�
3D */
Write_3D_Descr
(
File
);
Write_3D_Descr
(
File
);
/* Fin de description: */
/* Fin de description: */
fprintf
(
File
,
"$EndMODULE %s
\n
"
,
CONV_TO_UTF8
(
m_LibRef
)
);
fprintf
(
File
,
"$EndMODULE %s
\n
"
,
CONV_TO_UTF8
(
m_LibRef
)
);
NbLigne
++
;
NbLigne
++
;
return
(
NbLigne
)
;
return
NbLigne
;
}
}
/***************************************/
/***************************************/
int
MODULE
::
Write_3D_Descr
(
FILE
*
File
)
int
MODULE
::
Write_3D_Descr
(
FILE
*
File
)
/***************************************/
/***************************************/
/* Sauvegarde de la description 3D du MODULE
/* Sauvegarde de la description 3D du MODULE
*/
*/
{
{
char
buf
[
512
];
char
buf
[
512
];
Struct3D_Master
*
Struct3D
=
m_3D_Drawings
;
Struct3D_Master
*
Struct3D
=
m_3D_Drawings
;
for
(
;
Struct3D
!=
NULL
;
Struct3D
=
(
Struct3D_Master
*
)
Struct3D
->
Pnext
)
for
(
;
Struct3D
!=
NULL
;
Struct3D
=
(
Struct3D_Master
*
)
Struct3D
->
Pnext
)
{
{
if
(
!
Struct3D
->
m_Shape3DName
.
IsEmpty
()
)
if
(
!
Struct3D
->
m_Shape3DName
.
IsEmpty
()
)
{
{
fprintf
(
File
,
"$SHAPE3D
\n
"
);
fprintf
(
File
,
"$SHAPE3D
\n
"
);
fprintf
(
File
,
"Na
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
Struct3D
->
m_Shape3DName
)
);
fprintf
(
File
,
"Na
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
Struct3D
->
m_Shape3DName
)
);
sprintf
(
buf
,
"Sc %lf %lf %lf
\n
"
,
sprintf
(
buf
,
"Sc %lf %lf %lf
\n
"
,
Struct3D
->
m_MatScale
.
x
,
Struct3D
->
m_MatScale
.
x
,
Struct3D
->
m_MatScale
.
y
,
Struct3D
->
m_MatScale
.
y
,
Struct3D
->
m_MatScale
.
z
);
Struct3D
->
m_MatScale
.
z
);
fprintf
(
File
,
to_point
(
buf
)
);
fprintf
(
File
,
to_point
(
buf
)
);
sprintf
(
buf
,
"Of %lf %lf %lf
\n
"
,
sprintf
(
buf
,
"Of %lf %lf %lf
\n
"
,
Struct3D
->
m_MatPosition
.
x
,
Struct3D
->
m_MatPosition
.
x
,
Struct3D
->
m_MatPosition
.
y
,
Struct3D
->
m_MatPosition
.
y
,
Struct3D
->
m_MatPosition
.
z
);
Struct3D
->
m_MatPosition
.
z
);
fprintf
(
File
,
to_point
(
buf
)
);
fprintf
(
File
,
to_point
(
buf
)
);
sprintf
(
buf
,
"Ro %lf %lf %lf
\n
"
,
sprintf
(
buf
,
"Ro %lf %lf %lf
\n
"
,
Struct3D
->
m_MatRotation
.
x
,
Struct3D
->
m_MatRotation
.
x
,
Struct3D
->
m_MatRotation
.
y
,
Struct3D
->
m_MatRotation
.
y
,
Struct3D
->
m_MatRotation
.
z
);
Struct3D
->
m_MatRotation
.
z
);
fprintf
(
File
,
to_point
(
buf
)
);
fprintf
(
File
,
to_point
(
buf
)
);
fprintf
(
File
,
"$EndSHAPE3D
\n
"
);
fprintf
(
File
,
"$EndSHAPE3D
\n
"
);
}
}
}
}
return
0
;
return
0
;
}
}
/****************************************************/
/****************************************************/
int
MODULE
::
Read_3D_Descr
(
FILE
*
File
,
int
*
LineNum
)
int
MODULE
::
Read_3D_Descr
(
FILE
*
File
,
int
*
LineNum
)
/****************************************************/
/****************************************************/
/* Lecture de la description d'un MODULE (format Ascii)
/* Lecture de la description d'un MODULE (format Ascii)
la 1ere ligne de descr ($MODULE) est supposee etre deja lue
*
la 1ere ligne de descr ($MODULE) est supposee etre deja lue
retourne 0 si OK
*
retourne 0 si OK
*/
*/
{
{
char
Line
[
1024
];
char
Line
[
1024
];
char
*
text
=
Line
+
3
;
char
*
text
=
Line
+
3
;
Struct3D_Master
*
Struct3D
=
m_3D_Drawings
;
Struct3D_Master
*
Struct3D
=
m_3D_Drawings
;
if
(
!
Struct3D
->
m_Shape3DName
.
IsEmpty
()
)
if
(
!
Struct3D
->
m_Shape3DName
.
IsEmpty
()
)
{
{
Struct3D_Master
*
NewStruct3D
;
Struct3D_Master
*
NewStruct3D
;
while
(
Struct3D
->
Pnext
)
while
(
Struct3D
->
Pnext
)
Struct3D
=
(
Struct3D_Master
*
)
Struct3D
->
Pnext
;
Struct3D
=
(
Struct3D_Master
*
)
Struct3D
->
Pnext
;
Struct3D
->
Pnext
=
NewStruct3D
=
new
Struct3D_Master
(
this
);
Struct3D
->
Pnext
=
NewStruct3D
=
new
Struct3D_Master
(
this
);
NewStruct3D
->
Pback
=
Struct3D
;
NewStruct3D
->
Pback
=
Struct3D
;
Struct3D
=
NewStruct3D
;
Struct3D
=
NewStruct3D
;
}
}
while
(
GetLine
(
File
,
Line
,
LineNum
,
sizeof
(
Line
)
-
1
)
!=
NULL
)
while
(
GetLine
(
File
,
Line
,
LineNum
,
sizeof
(
Line
)
-
1
)
!=
NULL
)
{
{
switch
(
Line
[
0
]
)
switch
(
Line
[
0
]
)
{
{
case
'$'
:
// Fin de description
case
'$'
:
// Fin de description
if
(
Line
[
1
]
==
'E'
)
return
0
;
if
(
Line
[
1
]
==
'E'
)
return
0
;
return
1
;
return
1
;
case
'N'
:
// Shape File Name
case
'N'
:
// Shape File Name
{
{
char
buf
[
512
];
char
buf
[
512
];
ReadDelimitedText
(
buf
,
text
,
512
);
ReadDelimitedText
(
buf
,
text
,
512
);
Struct3D
->
m_Shape3DName
=
CONV_FROM_UTF8
(
buf
);
Struct3D
->
m_Shape3DName
=
CONV_FROM_UTF8
(
buf
);
break
;
break
;
}
}
case
'S'
:
// Scale
case
'S'
:
// Scale
sscanf
(
text
,
"%lf %lf %lf
\n
"
,
sscanf
(
text
,
"%lf %lf %lf
\n
"
,
&
Struct3D
->
m_MatScale
.
x
,
&
Struct3D
->
m_MatScale
.
x
,
&
Struct3D
->
m_MatScale
.
y
,
&
Struct3D
->
m_MatScale
.
y
,
&
Struct3D
->
m_MatScale
.
z
);
&
Struct3D
->
m_MatScale
.
z
);
break
;
break
;
case
'O'
:
// Offset
case
'O'
:
// Offset
sscanf
(
text
,
"%lf %lf %lf
\n
"
,
sscanf
(
text
,
"%lf %lf %lf
\n
"
,
&
Struct3D
->
m_MatPosition
.
x
,
&
Struct3D
->
m_MatPosition
.
x
,
&
Struct3D
->
m_MatPosition
.
y
,
&
Struct3D
->
m_MatPosition
.
y
,
&
Struct3D
->
m_MatPosition
.
z
);
&
Struct3D
->
m_MatPosition
.
z
);
break
;
break
;
case
'R'
:
// Rotation
case
'R'
:
// Rotation
sscanf
(
text
,
"%lf %lf %lf
\n
"
,
sscanf
(
text
,
"%lf %lf %lf
\n
"
,
&
Struct3D
->
m_MatRotation
.
x
,
&
Struct3D
->
m_MatRotation
.
x
,
&
Struct3D
->
m_MatRotation
.
y
,
&
Struct3D
->
m_MatRotation
.
y
,
&
Struct3D
->
m_MatRotation
.
z
);
&
Struct3D
->
m_MatRotation
.
z
);
break
;
break
;
default
:
default
:
break
;
break
;
}
}
}
}
return
1
;
return
1
;
}
}
/**************************************************/
/**************************************************/
int
MODULE
::
ReadDescr
(
FILE
*
File
,
int
*
LineNum
)
int
MODULE
::
ReadDescr
(
FILE
*
File
,
int
*
LineNum
)
/**************************************************/
/**************************************************/
/* Lecture de la description d'un MODULE (format Ascii)
/* Lecture de la description d'un MODULE (format Ascii)
la 1ere ligne de descr ($MODULE) est supposee etre deja lue
*
la 1ere ligne de descr ($MODULE) est supposee etre deja lue
retourne 0 si OK
*
retourne 0 si OK
*/
*/
{
{
D_PAD
*
LastPad
=
NULL
,
*
ptpad
;
D_PAD
*
LastPad
=
NULL
,
*
ptpad
;
EDA_BaseStruct
*
LastModStruct
=
NULL
;
EDA_BaseStruct
*
LastModStruct
=
NULL
;
EDGE_MODULE
*
DrawSegm
;
EDGE_MODULE
*
DrawSegm
;
TEXTE_MODULE
*
DrawText
;
TEXTE_MODULE
*
DrawText
;
char
Line
[
256
],
BufLine
[
256
],
BufCar1
[
128
],
BufCar2
[
128
],
*
PtLine
;
char
Line
[
256
],
BufLine
[
256
],
BufCar1
[
128
],
BufCar2
[
128
],
*
PtLine
;
int
itmp1
,
itmp2
;
int
itmp1
,
itmp2
;
while
(
GetLine
(
File
,
Line
,
LineNum
,
sizeof
(
Line
)
-
1
)
!=
NULL
)
while
(
GetLine
(
File
,
Line
,
LineNum
,
sizeof
(
Line
)
-
1
)
!=
NULL
)
{
{
if
(
Line
[
0
]
==
'$'
)
if
(
Line
[
0
]
==
'$'
)
{
{
if
(
Line
[
1
]
==
'E'
)
break
;
if
(
Line
[
1
]
==
'E'
)
break
;
if
(
Line
[
1
]
==
'P'
)
if
(
Line
[
1
]
==
'P'
)
{
{
ptpad
=
new
D_PAD
(
this
);
ptpad
=
new
D_PAD
(
this
);
ptpad
->
ReadDescr
(
File
,
LineNum
);
ptpad
->
ReadDescr
(
File
,
LineNum
);
RotatePoint
(
&
ptpad
->
m_Pos
.
x
,
&
ptpad
->
m_Pos
.
y
,
m_Orient
);
RotatePoint
(
&
ptpad
->
m_Pos
.
x
,
&
ptpad
->
m_Pos
.
y
,
m_Orient
);
ptpad
->
m_Pos
.
x
+=
m_Pos
.
x
;
ptpad
->
m_Pos
.
x
+=
m_Pos
.
x
;
ptpad
->
m_Pos
.
y
+=
m_Pos
.
y
;
ptpad
->
m_Pos
.
y
+=
m_Pos
.
y
;
if
(
LastPad
==
NULL
)
if
(
LastPad
==
NULL
)
{
{
ptpad
->
Pback
=
(
EDA_BaseStruct
*
)
this
;
ptpad
->
Pback
=
(
EDA_BaseStruct
*
)
this
;
m_Pads
=
ptpad
;
m_Pads
=
ptpad
;
}
}
else
else
{
{
ptpad
->
Pback
=
(
EDA_BaseStruct
*
)
LastPad
;
ptpad
->
Pback
=
(
EDA_BaseStruct
*
)
LastPad
;
LastPad
->
Pnext
=
(
EDA_BaseStruct
*
)
ptpad
;
LastPad
->
Pnext
=
(
EDA_BaseStruct
*
)
ptpad
;
}
}
LastPad
=
ptpad
;
LastPad
=
ptpad
;
continue
;
continue
;
}
}
if
(
Line
[
1
]
==
'S'
)
Read_3D_Descr
(
File
,
LineNum
);
if
(
Line
[
1
]
==
'S'
)
Read_3D_Descr
(
File
,
LineNum
);
}
}
if
(
strlen
(
Line
)
<
4
)
continue
;
if
(
strlen
(
Line
)
<
4
)
PtLine
=
Line
+
3
;
/* Pointe 1er code utile de la ligne */
continue
;
PtLine
=
Line
+
3
;
/* Pointe 1er code utile de la ligne */
switch
(
Line
[
0
]
)
switch
(
Line
[
0
]
)
{
{
case
'P'
:
case
'P'
:
memset
(
BufCar1
,
0
,
sizeof
(
BufCar1
)
);
memset
(
BufCar1
,
0
,
sizeof
(
BufCar1
)
);
sscanf
(
PtLine
,
"%d %d %d %d %lX %lX %s"
,
sscanf
(
PtLine
,
"%d %d %d %d %lX %lX %s"
,
&
m_Pos
.
x
,
&
m_Pos
.
y
,
&
m_Pos
.
x
,
&
m_Pos
.
y
,
&
m_Orient
,
&
m_Layer
,
&
m_Orient
,
&
m_Layer
,
&
m_LastEdit_Time
,
&
m_TimeStamp
,
BufCar1
);
&
m_LastEdit_Time
,
&
m_TimeStamp
,
BufCar1
);
m_ModuleStatus
=
0
;
m_ModuleStatus
=
0
;
if
(
BufCar1
[
0
]
==
'F'
)
m_ModuleStatus
|=
MODULE_is_LOCKED
;
if
(
BufCar1
[
0
]
==
'F'
)
if
(
BufCar1
[
1
]
==
'P'
)
m_ModuleStatus
|=
MODULE_is_PLACED
;
m_ModuleStatus
|=
MODULE_is_LOCKED
;
if
(
BufCar1
[
1
]
==
'P'
)
m_ModuleStatus
|=
MODULE_is_PLACED
;
break
;
break
;
case
'L'
:
/* Li = Lecture du nom librairie du module */
case
'L'
:
/* Li = Lecture du nom librairie du module */
*
BufLine
=
0
;
*
BufLine
=
0
;
sscanf
(
PtLine
,
" %s"
,
BufLine
);
sscanf
(
PtLine
,
" %s"
,
BufLine
);
m_LibRef
=
CONV_FROM_UTF8
(
BufLine
);
m_LibRef
=
CONV_FROM_UTF8
(
BufLine
);
break
;
break
;
case
'S'
:
case
'S'
:
sscanf
(
PtLine
,
" %lX"
,
&
m_TimeStamp
);
sscanf
(
PtLine
,
" %lX"
,
&
m_TimeStamp
);
break
;
break
;
case
'O'
:
/* (Op)tions de placement auto */
case
'O'
:
/* (Op)tions de placement auto */
itmp1
=
itmp2
=
0
;
itmp1
=
itmp2
=
0
;
sscanf
(
PtLine
,
" %X %X"
,
&
itmp1
,
&
itmp2
);
sscanf
(
PtLine
,
" %X %X"
,
&
itmp1
,
&
itmp2
);
m_CntRot180
=
itmp2
&
0x0F
;
m_CntRot180
=
itmp2
&
0x0F
;
if
(
m_CntRot180
>
10
)
m_CntRot180
=
10
;
if
(
m_CntRot180
>
10
)
m_CntRot180
=
10
;
m_CntRot90
=
itmp1
&
0x0F
;
m_CntRot90
=
itmp1
&
0x0F
;
if
(
m_CntRot90
>
10
)
m_CntRot90
=
0
;
if
(
m_CntRot90
>
10
)
m_CntRot90
=
0
;
itmp1
=
(
itmp1
>>
4
)
&
0x0F
;
itmp1
=
(
itmp1
>>
4
)
&
0x0F
;
if
(
itmp1
>
10
)
itmp1
=
0
;
if
(
itmp1
>
10
)
itmp1
=
0
;
m_CntRot90
|=
itmp1
<<
4
;
m_CntRot90
|=
itmp1
<<
4
;
break
;
break
;
case
'A'
:
/* At = (At)tributs du module */
case
'A'
:
/* At = (At)tributs du module */
if
(
strstr
(
PtLine
,
"SMD"
)
)
m_Attributs
|=
MOD_CMS
;
if
(
strstr
(
PtLine
,
"SMD"
)
)
if
(
strstr
(
PtLine
,
"VIRTUAL"
)
)
m_Attributs
|=
MOD_VIRTUAL
;
m_Attributs
|=
MOD_CMS
;
if
(
strstr
(
PtLine
,
"VIRTUAL"
)
)
m_Attributs
|=
MOD_VIRTUAL
;
break
;
break
;
case
'T'
:
/* lecture des textes modules */
case
'T'
:
/* lecture des textes modules */
sscanf
(
Line
+
1
,
"%d"
,
&
itmp1
);
sscanf
(
Line
+
1
,
"%d"
,
&
itmp1
);
if
(
itmp1
==
TEXT_is_REFERENCE
)
if
(
itmp1
==
TEXT_is_REFERENCE
)
DrawText
=
m_Reference
;
DrawText
=
m_Reference
;
else
if
(
itmp1
==
TEXT_is_VALUE
)
else
if
(
itmp1
==
TEXT_is_VALUE
)
DrawText
=
m_Value
;
DrawText
=
m_Value
;
else
/* text is a drawing */
else
/* text is a drawing */
{
DrawText
=
new
TEXTE_MODULE
(
this
);
{
if
(
LastModStruct
==
NULL
)
DrawText
=
new
TEXTE_MODULE
(
this
);
if
(
LastModStruct
==
NULL
)
{
{
DrawText
->
Pback
=
this
;
DrawText
->
Pback
=
this
;
m_Drawings
=
(
EDA_BaseStruct
*
)
DrawText
;
m_Drawings
=
(
EDA_BaseStruct
*
)
DrawText
;
...
@@ -682,37 +727,46 @@ int itmp1, itmp2;
...
@@ -682,37 +727,46 @@ int itmp1, itmp2;
LastModStruct
=
(
EDA_BaseStruct
*
)
DrawText
;
LastModStruct
=
(
EDA_BaseStruct
*
)
DrawText
;
}
}
sscanf
(
Line
+
1
,
"%d %d %d %d %d %d %d %s %s %d"
,
sscanf
(
Line
+
1
,
"%d %d %d %d %d %d %d %s %s %d"
,
&
itmp1
,
&
itmp1
,
&
DrawText
->
m_Pos0
.
x
,
&
DrawText
->
m_Pos0
.
y
,
&
DrawText
->
m_Pos0
.
x
,
&
DrawText
->
m_Pos0
.
y
,
&
DrawText
->
m_Size
.
y
,
&
DrawText
->
m_Size
.
x
,
&
DrawText
->
m_Size
.
y
,
&
DrawText
->
m_Size
.
x
,
&
DrawText
->
m_Orient
,
&
DrawText
->
m_Width
,
&
DrawText
->
m_Orient
,
&
DrawText
->
m_Width
,
BufCar1
,
BufCar2
,
&
DrawText
->
m_Layer
);
BufCar1
,
BufCar2
,
&
DrawText
->
m_Layer
);
DrawText
->
m_Type
=
itmp1
;
DrawText
->
m_Type
=
itmp1
;
DrawText
->
m_Orient
-=
m_Orient
;
// m_Orient texte relative au module
DrawText
->
m_Orient
-=
m_Orient
;
// m_Orient texte relative au module
if
(
BufCar1
[
0
]
==
'M'
)
DrawText
->
m_Miroir
=
0
;
if
(
BufCar1
[
0
]
==
'M'
)
else
DrawText
->
m_Miroir
=
1
;
DrawText
->
m_Miroir
=
0
;
if
(
BufCar2
[
0
]
==
'I'
)
DrawText
->
m_NoShow
=
1
;
else
else
DrawText
->
m_NoShow
=
0
;
DrawText
->
m_Miroir
=
1
;
if
(
BufCar2
[
0
]
==
'I'
)
DrawText
->
m_NoShow
=
1
;
else
DrawText
->
m_NoShow
=
0
;
if
(
m_Layer
==
CUIVRE_N
)
DrawText
->
m_Layer
=
SILKSCREEN_N_CU
;
if
(
m_Layer
==
CUIVRE_N
)
if
(
m_Layer
==
CMP_N
)
DrawText
->
m_Layer
=
SILKSCREEN_N_CMP
;
DrawText
->
m_Layer
=
SILKSCREEN_N_CU
;
if
(
m_Layer
==
CMP_N
)
DrawText
->
m_Layer
=
SILKSCREEN_N_CMP
;
/* calcul de la position vraie */
/* calcul de la position vraie */
DrawText
->
SetDrawCoord
();
DrawText
->
SetDrawCoord
();
/* Lecture de la chaine "text" */
/* Lecture de la chaine "text" */
ReadDelimitedText
(
BufLine
,
Line
,
sizeof
(
BufLine
)
);
ReadDelimitedText
(
BufLine
,
Line
,
sizeof
(
BufLine
)
);
DrawText
->
m_Text
=
CONV_FROM_UTF8
(
BufLine
);
DrawText
->
m_Text
=
CONV_FROM_UTF8
(
BufLine
);
// Controle d'epaisseur raisonnable:
// Controle d'epaisseur raisonnable:
if
(
DrawText
->
m_Width
<=
1
)
DrawText
->
m_Width
=
1
;
if
(
DrawText
->
m_Width
<=
1
)
if
(
DrawText
->
m_Width
>
MAX_WIDTH
)
DrawText
->
m_Width
=
MAX_WIDTH
;
DrawText
->
m_Width
=
1
;
if
(
DrawText
->
m_Width
>
MAX_WIDTH
)
DrawText
->
m_Width
=
MAX_WIDTH
;
break
;
break
;
case
'D'
:
/* lecture du contour */
case
'D'
:
/* lecture du contour */
DrawSegm
=
new
EDGE_MODULE
(
this
);
DrawSegm
=
new
EDGE_MODULE
(
this
);
if
(
LastModStruct
==
NULL
)
if
(
LastModStruct
==
NULL
)
{
{
DrawSegm
->
Pback
=
this
;
DrawSegm
->
Pback
=
this
;
m_Drawings
=
DrawSegm
;
m_Drawings
=
DrawSegm
;
...
@@ -724,72 +778,76 @@ int itmp1, itmp2;
...
@@ -724,72 +778,76 @@ int itmp1, itmp2;
}
}
LastModStruct
=
DrawSegm
;
LastModStruct
=
DrawSegm
;
DrawSegm
->
ReadDescr
(
Line
,
File
,
LineNum
);
DrawSegm
->
ReadDescr
(
Line
,
File
,
LineNum
);
DrawSegm
->
SetDrawCoord
();
DrawSegm
->
SetDrawCoord
();
break
;
break
;
case
'C'
:
/* Lecture de la doc */
case
'C'
:
/* Lecture de la doc */
m_Doc
=
CONV_FROM_UTF8
(
StrPurge
(
PtLine
)
);
m_Doc
=
CONV_FROM_UTF8
(
StrPurge
(
PtLine
)
);
break
;
break
;
case
'K'
:
/* Lecture de la liste des mots cle */
case
'K'
:
/* Lecture de la liste des mots cle */
m_KeyWord
=
CONV_FROM_UTF8
(
StrPurge
(
PtLine
)
);
m_KeyWord
=
CONV_FROM_UTF8
(
StrPurge
(
PtLine
)
);
break
;
break
;
default
:
default
:
break
;
break
;
}
}
}
}
/* Recalcul de l'encadrement */
/* Recalcul de l'encadrement */
Set_Rectangle_Encadrement
();
Set_Rectangle_Encadrement
();
return
(
0
)
;
return
0
;
}
}
/****************************************************/
/****************************************************/
void
MODULE
::
SetPosition
(
const
wxPoint
&
newpos
)
void
MODULE
::
SetPosition
(
const
wxPoint
&
newpos
)
/****************************************************/
/****************************************************/
// replace le module en position newpos
// replace le module en position newpos
{
{
int
deltaX
=
newpos
.
x
-
m_Pos
.
x
;
int
deltaX
=
newpos
.
x
-
m_Pos
.
x
;
int
deltaY
=
newpos
.
y
-
m_Pos
.
y
;
int
deltaY
=
newpos
.
y
-
m_Pos
.
y
;
/* deplacement de l'ancre */
/* deplacement de l'ancre */
m_Pos
.
x
+=
deltaX
;
m_Pos
.
y
+=
deltaY
;
m_Pos
.
x
+=
deltaX
;
m_Pos
.
y
+=
deltaY
;
/* deplacement de la reference */
/* deplacement de la reference */
m_Reference
->
m_Pos
.
x
+=
deltaX
;
m_Reference
->
m_Pos
.
y
+=
deltaY
;
m_Reference
->
m_Pos
.
x
+=
deltaX
;
m_Reference
->
m_Pos
.
y
+=
deltaY
;
/* deplacement de la Valeur */
/* deplacement de la Valeur */
m_Value
->
m_Pos
.
x
+=
deltaX
;
m_Value
->
m_Pos
.
y
+=
deltaY
;
m_Value
->
m_Pos
.
x
+=
deltaX
;
m_Value
->
m_Pos
.
y
+=
deltaY
;
/* deplacement des pastilles */
/* deplacement des pastilles */
D_PAD
*
pad
=
m_Pads
;
D_PAD
*
pad
=
m_Pads
;
for
(
;
pad
!=
NULL
;
pad
=
(
D_PAD
*
)
pad
->
Pnext
)
for
(
;
pad
!=
NULL
;
pad
=
(
D_PAD
*
)
pad
->
Pnext
)
{
{
pad
->
m_Pos
.
x
+=
deltaX
;
pad
->
m_Pos
.
y
+=
deltaY
;
pad
->
m_Pos
.
x
+=
deltaX
;
pad
->
m_Pos
.
y
+=
deltaY
;
}
}
/* deplacement des dessins de l'empreinte : */
/* deplacement des dessins de l'empreinte : */
EDA_BaseStruct
*
PtStruct
=
m_Drawings
;
EDA_BaseStruct
*
PtStruct
=
m_Drawings
;
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
{
{
switch
(
PtStruct
->
m_StructType
)
switch
(
PtStruct
->
m_StructType
)
{
{
case
TYPEEDGEMODULE
:
case
TYPEEDGEMODULE
:
{
{
EDGE_MODULE
*
pt_edgmod
=
(
EDGE_MODULE
*
)
PtStruct
;
EDGE_MODULE
*
pt_edgmod
=
(
EDGE_MODULE
*
)
PtStruct
;
pt_edgmod
->
SetDrawCoord
();
pt_edgmod
->
SetDrawCoord
();
break
;
break
;
}
}
case
TYPETEXTEMODULE
:
case
TYPETEXTEMODULE
:
{
{
TEXTE_MODULE
*
pt_texte
=
(
TEXTE_MODULE
*
)
PtStruct
;
TEXTE_MODULE
*
pt_texte
=
(
TEXTE_MODULE
*
)
PtStruct
;
pt_texte
->
m_Pos
.
x
+=
deltaX
;
pt_texte
->
m_Pos
.
y
+=
deltaY
;
pt_texte
->
m_Pos
.
x
+=
deltaX
;
pt_texte
->
m_Pos
.
y
+=
deltaY
;
break
;
break
;
}
}
default
:
DisplayError
(
NULL
,
wxT
(
"Type Draw Indefini"
));
break
;
default
:
DisplayError
(
NULL
,
wxT
(
"Type Draw Indefini"
)
);
break
;
}
}
}
}
...
@@ -797,29 +855,29 @@ int deltaY = newpos.y - m_Pos.y;
...
@@ -797,29 +855,29 @@ int deltaY = newpos.y - m_Pos.y;
}
}
/*********************************************/
/*********************************************/
void
MODULE
::
SetOrientation
(
int
newangle
)
void
MODULE
::
SetOrientation
(
int
newangle
)
/*********************************************/
/*********************************************/
/* Tourne de newangle (en 0.1 degres) le module
/* Tourne de newangle (en 0.1 degres) le module
*/
*/
{
{
int
px
,
py
;
int
px
,
py
;
newangle
-=
m_Orient
;
// = delta de rotation
newangle
-=
m_Orient
;
// = delta de rotation
m_Orient
+=
newangle
;
m_Orient
+=
newangle
;
NORMALIZE_ANGLE_POS
(
m_Orient
);
NORMALIZE_ANGLE_POS
(
m_Orient
);
/* deplacement et rotation des pastilles */
/* deplacement et rotation des pastilles */
D_PAD
*
pad
=
m_Pads
;
D_PAD
*
pad
=
m_Pads
;
for
(
;
pad
!=
NULL
;
pad
=
(
D_PAD
*
)
pad
->
Pnext
)
for
(
;
pad
!=
NULL
;
pad
=
(
D_PAD
*
)
pad
->
Pnext
)
{
{
px
=
pad
->
m_Pos0
.
x
;
px
=
pad
->
m_Pos0
.
x
;
py
=
pad
->
m_Pos0
.
y
;
py
=
pad
->
m_Pos0
.
y
;
pad
->
m_Orient
+=
newangle
;
/* change m_Orientation */
pad
->
m_Orient
+=
newangle
;
/* change m_Orientation */
NORMALIZE_ANGLE_POS
(
pad
->
m_Orient
);
NORMALIZE_ANGLE_POS
(
pad
->
m_Orient
);
RotatePoint
(
&
px
,
&
py
,
(
int
)
m_Orient
);
RotatePoint
(
&
px
,
&
py
,
(
int
)
m_Orient
);
pad
->
m_Pos
.
x
=
m_Pos
.
x
+
px
;
pad
->
m_Pos
.
x
=
m_Pos
.
x
+
px
;
...
@@ -831,18 +889,18 @@ int px ,py;
...
@@ -831,18 +889,18 @@ int px ,py;
m_Value
->
SetDrawCoord
();
m_Value
->
SetDrawCoord
();
/* deplacement des contours et textes de l'empreinte : */
/* deplacement des contours et textes de l'empreinte : */
EDA_BaseStruct
*
PtStruct
=
m_Drawings
;
EDA_BaseStruct
*
PtStruct
=
m_Drawings
;
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
{
{
if
(
PtStruct
->
m_StructType
==
TYPEEDGEMODULE
)
if
(
PtStruct
->
m_StructType
==
TYPEEDGEMODULE
)
{
{
EDGE_MODULE
*
pt_edgmod
=
(
EDGE_MODULE
*
)
PtStruct
;
EDGE_MODULE
*
pt_edgmod
=
(
EDGE_MODULE
*
)
PtStruct
;
pt_edgmod
->
SetDrawCoord
();
pt_edgmod
->
SetDrawCoord
();
}
}
if
(
PtStruct
->
m_StructType
==
TYPETEXTEMODULE
)
if
(
PtStruct
->
m_StructType
==
TYPETEXTEMODULE
)
{
{
/* deplacement des inscriptions : */
/* deplacement des inscriptions : */
TEXTE_MODULE
*
pt_texte
=
(
TEXTE_MODULE
*
)
PtStruct
;
TEXTE_MODULE
*
pt_texte
=
(
TEXTE_MODULE
*
)
PtStruct
;
pt_texte
->
SetDrawCoord
();
pt_texte
->
SetDrawCoord
();
}
}
}
}
...
@@ -851,23 +909,25 @@ int px ,py;
...
@@ -851,23 +909,25 @@ int px ,py;
Set_Rectangle_Encadrement
();
Set_Rectangle_Encadrement
();
}
}
/************************************************/
/************************************************/
void
MODULE
::
Set_Rectangle_Encadrement
(
void
)
void
MODULE
::
Set_Rectangle_Encadrement
(
void
)
/************************************************/
/************************************************/
/* Mise a jour du rectangle d'encadrement du module
/* Mise a jour du rectangle d'encadrement du module
Entree : pointeur sur module
*
Entree : pointeur sur module
Le rectangle d'encadrement est le rectangle comprenant les contours et les
*
Le rectangle d'encadrement est le rectangle comprenant les contours et les
pads.
*
pads.
Le rectangle est calcule:
*
Le rectangle est calcule:
pour orient 0
*
pour orient 0
en coord relatives / position ancre
*
en coord relatives / position ancre
*/
*/
{
{
EDGE_MODULE
*
pt_edge_mod
;
EDGE_MODULE
*
pt_edge_mod
;
D_PAD
*
pad
;
D_PAD
*
pad
;
int
width
;
int
width
;
int
cx
,
cy
,
uxf
,
uyf
,
rayon
;
int
cx
,
cy
,
uxf
,
uyf
,
rayon
;
int
xmax
,
ymax
;
int
xmax
,
ymax
;
/* Init des pointeurs */
/* Init des pointeurs */
...
@@ -878,195 +938,237 @@ int xmax, ymax;
...
@@ -878,195 +938,237 @@ int xmax, ymax;
m_BoundaryBox
.
m_Pos
.
y
=
-
500
;
ymax
=
500
;
m_BoundaryBox
.
m_Pos
.
y
=
-
500
;
ymax
=
500
;
/* Contours: Recherche des coord min et max et mise a jour du cadre */
/* Contours: Recherche des coord min et max et mise a jour du cadre */
for
(
;
pt_edge_mod
!=
NULL
;
pt_edge_mod
=
(
EDGE_MODULE
*
)
pt_edge_mod
->
Pnext
)
for
(
;
pt_edge_mod
!=
NULL
;
pt_edge_mod
=
(
EDGE_MODULE
*
)
pt_edge_mod
->
Pnext
)
{
{
if
(
pt_edge_mod
->
m_StructType
!=
TYPEEDGEMODULE
)
continue
;
if
(
pt_edge_mod
->
m_StructType
!=
TYPEEDGEMODULE
)
continue
;
width
=
pt_edge_mod
->
m_Width
/
2
;
width
=
pt_edge_mod
->
m_Width
/
2
;
switch
(
pt_edge_mod
->
m_Shape
)
switch
(
pt_edge_mod
->
m_Shape
)
{
{
case
S_ARC
:
case
S_ARC
:
case
S_CIRCLE
:
case
S_CIRCLE
:
{
{
cx
=
pt_edge_mod
->
m_Start0
.
x
;
cy
=
pt_edge_mod
->
m_Start0
.
y
;
// centre
cx
=
pt_edge_mod
->
m_Start0
.
x
;
cy
=
pt_edge_mod
->
m_Start0
.
y
;
// centre
uxf
=
pt_edge_mod
->
m_End0
.
x
;
uyf
=
pt_edge_mod
->
m_End0
.
y
;
uxf
=
pt_edge_mod
->
m_End0
.
x
;
uyf
=
pt_edge_mod
->
m_End0
.
y
;
rayon
=
(
int
)
hypot
((
double
)(
cx
-
uxf
),(
double
)
(
cy
-
uyf
)
);
rayon
=
(
int
)
hypot
(
(
double
)
(
cx
-
uxf
),
(
double
)
(
cy
-
uyf
)
);
rayon
+=
width
;
rayon
+=
width
;
m_BoundaryBox
.
m_Pos
.
x
=
min
(
m_BoundaryBox
.
m_Pos
.
x
,
cx
-
rayon
);
m_BoundaryBox
.
m_Pos
.
x
=
min
(
m_BoundaryBox
.
m_Pos
.
x
,
cx
-
rayon
);
m_BoundaryBox
.
m_Pos
.
y
=
min
(
m_BoundaryBox
.
m_Pos
.
y
,
cy
-
rayon
);
m_BoundaryBox
.
m_Pos
.
y
=
min
(
m_BoundaryBox
.
m_Pos
.
y
,
cy
-
rayon
);
xmax
=
max
(
xmax
,
cx
+
rayon
);
xmax
=
max
(
xmax
,
cx
+
rayon
);
ymax
=
max
(
ymax
,
cy
+
rayon
);
ymax
=
max
(
ymax
,
cy
+
rayon
);
break
;
break
;
}
}
default
:
default
:
m_BoundaryBox
.
m_Pos
.
x
=
min
(
m_BoundaryBox
.
m_Pos
.
x
,
pt_edge_mod
->
m_Start0
.
x
-
width
);
m_BoundaryBox
.
m_Pos
.
x
=
min
(
m_BoundaryBox
.
m_Pos
.
x
,
pt_edge_mod
->
m_Start0
.
x
-
width
);
m_BoundaryBox
.
m_Pos
.
x
=
min
(
m_BoundaryBox
.
m_Pos
.
x
,
pt_edge_mod
->
m_End0
.
x
-
width
);
m_BoundaryBox
.
m_Pos
.
x
=
min
(
m_BoundaryBox
.
m_Pos
.
x
,
pt_edge_mod
->
m_End0
.
x
-
width
);
m_BoundaryBox
.
m_Pos
.
y
=
min
(
m_BoundaryBox
.
m_Pos
.
y
,
pt_edge_mod
->
m_Start0
.
y
-
width
);
m_BoundaryBox
.
m_Pos
.
y
=
min
(
m_BoundaryBox
.
m_Pos
.
y
,
pt_edge_mod
->
m_Start0
.
y
-
width
);
m_BoundaryBox
.
m_Pos
.
y
=
min
(
m_BoundaryBox
.
m_Pos
.
y
,
pt_edge_mod
->
m_End0
.
y
-
width
);
m_BoundaryBox
.
m_Pos
.
y
=
min
(
m_BoundaryBox
.
m_Pos
.
y
,
pt_edge_mod
->
m_End0
.
y
-
width
);
xmax
=
max
(
xmax
,
pt_edge_mod
->
m_Start0
.
x
+
width
);
xmax
=
max
(
xmax
,
pt_edge_mod
->
m_Start0
.
x
+
width
);
xmax
=
max
(
xmax
,
pt_edge_mod
->
m_End0
.
x
+
width
);
xmax
=
max
(
xmax
,
pt_edge_mod
->
m_End0
.
x
+
width
);
ymax
=
max
(
ymax
,
pt_edge_mod
->
m_Start0
.
y
+
width
);
ymax
=
max
(
ymax
,
pt_edge_mod
->
m_Start0
.
y
+
width
);
ymax
=
max
(
ymax
,
pt_edge_mod
->
m_End0
.
y
+
width
);
ymax
=
max
(
ymax
,
pt_edge_mod
->
m_End0
.
y
+
width
);
break
;
break
;
}
}
}
}
/* Pads: Recherche des coord min et max et mise a jour du cadre */
/* Pads: Recherche des coord min et max et mise a jour du cadre */
for
(
pad
=
m_Pads
;
pad
!=
NULL
;
pad
=
(
D_PAD
*
)
pad
->
Pnext
)
for
(
pad
=
m_Pads
;
pad
!=
NULL
;
pad
=
(
D_PAD
*
)
pad
->
Pnext
)
{
{
rayon
=
pad
->
m_Rayon
;
rayon
=
pad
->
m_Rayon
;
cx
=
pad
->
m_Pos0
.
x
;
cy
=
pad
->
m_Pos0
.
y
;
cx
=
pad
->
m_Pos0
.
x
;
cy
=
pad
->
m_Pos0
.
y
;
m_BoundaryBox
.
m_Pos
.
x
=
min
(
m_BoundaryBox
.
m_Pos
.
x
,
cx
-
rayon
);
m_BoundaryBox
.
m_Pos
.
x
=
min
(
m_BoundaryBox
.
m_Pos
.
x
,
cx
-
rayon
);
m_BoundaryBox
.
m_Pos
.
y
=
min
(
m_BoundaryBox
.
m_Pos
.
y
,
cy
-
rayon
);
m_BoundaryBox
.
m_Pos
.
y
=
min
(
m_BoundaryBox
.
m_Pos
.
y
,
cy
-
rayon
);
xmax
=
max
(
xmax
,
cx
+
rayon
);
xmax
=
max
(
xmax
,
cx
+
rayon
);
ymax
=
max
(
ymax
,
cy
+
rayon
);
ymax
=
max
(
ymax
,
cy
+
rayon
);
}
}
m_BoundaryBox
.
SetWidth
(
xmax
-
m_BoundaryBox
.
m_Pos
.
x
);
m_BoundaryBox
.
SetWidth
(
xmax
-
m_BoundaryBox
.
m_Pos
.
x
);
m_BoundaryBox
.
SetHeight
(
ymax
-
m_BoundaryBox
.
m_Pos
.
y
);
m_BoundaryBox
.
SetHeight
(
ymax
-
m_BoundaryBox
.
m_Pos
.
y
);
}
}
/****************************************/
/****************************************/
void
MODULE
::
SetRectangleExinscrit
(
void
)
void
MODULE
::
SetRectangleExinscrit
(
void
)
/****************************************/
/****************************************/
/* Analogue a MODULE::Set_Rectangle_Encadrement() mais en coord reelles:
/* Analogue a MODULE::Set_Rectangle_Encadrement() mais en coord reelles:
Mise a jour du rectangle d'encadrement reel du module c.a.d en coord PCB
*
Mise a jour du rectangle d'encadrement reel du module c.a.d en coord PCB
Entree : pointeur sur module
*
Entree : pointeur sur module
Le rectangle d'encadrement est le rectangle comprenant les contours et les
*
Le rectangle d'encadrement est le rectangle comprenant les contours et les
pads.
*
pads.
Met egalement a jour la surface (.m_Surface) du module.
*
Met egalement a jour la surface (.m_Surface) du module.
*/
*/
{
{
EDGE_MODULE
*
EdgeMod
;
EDGE_MODULE
*
EdgeMod
;
D_PAD
*
Pad
;
D_PAD
*
Pad
;
int
width
;
int
width
;
int
cx
,
cy
,
uxf
,
uyf
,
rayon
;
int
cx
,
cy
,
uxf
,
uyf
,
rayon
;
int
xmax
,
ymax
;
int
xmax
,
ymax
;
m_RealBoundaryBox
.
m_Pos
.
x
=
xmax
=
m_Pos
.
x
;
m_RealBoundaryBox
.
m_Pos
.
x
=
xmax
=
m_Pos
.
x
;
m_RealBoundaryBox
.
m_Pos
.
y
=
ymax
=
m_Pos
.
y
;
m_RealBoundaryBox
.
m_Pos
.
y
=
ymax
=
m_Pos
.
y
;
/* Contours: Recherche des coord min et max et mise a jour du cadre */
/* Contours: Recherche des coord min et max et mise a jour du cadre */
EdgeMod
=
(
EDGE_MODULE
*
)
m_Drawings
;
EdgeMod
=
(
EDGE_MODULE
*
)
m_Drawings
;
for
(
;
EdgeMod
!=
NULL
;
EdgeMod
=
(
EDGE_MODULE
*
)
EdgeMod
->
Pnext
)
for
(
;
EdgeMod
!=
NULL
;
EdgeMod
=
(
EDGE_MODULE
*
)
EdgeMod
->
Pnext
)
{
{
if
(
EdgeMod
->
m_StructType
!=
TYPEEDGEMODULE
)
continue
;
if
(
EdgeMod
->
m_StructType
!=
TYPEEDGEMODULE
)
continue
;
width
=
EdgeMod
->
m_Width
/
2
;
width
=
EdgeMod
->
m_Width
/
2
;
switch
(
EdgeMod
->
m_Shape
)
switch
(
EdgeMod
->
m_Shape
)
{
{
case
S_ARC
:
case
S_ARC
:
case
S_CIRCLE
:
case
S_CIRCLE
:
{
{
cx
=
EdgeMod
->
m_Start
.
x
;
cy
=
EdgeMod
->
m_Start
.
y
;
// centre
cx
=
EdgeMod
->
m_Start
.
x
;
cy
=
EdgeMod
->
m_Start
.
y
;
// centre
uxf
=
EdgeMod
->
m_End
.
x
;
uyf
=
EdgeMod
->
m_End
.
y
;
uxf
=
EdgeMod
->
m_End
.
x
;
uyf
=
EdgeMod
->
m_End
.
y
;
rayon
=
(
int
)
hypot
((
double
)(
cx
-
uxf
),(
double
)
(
cy
-
uyf
)
);
rayon
=
(
int
)
hypot
(
(
double
)
(
cx
-
uxf
),
(
double
)
(
cy
-
uyf
)
);
rayon
+=
width
;
rayon
+=
width
;
m_RealBoundaryBox
.
m_Pos
.
x
=
min
(
m_RealBoundaryBox
.
m_Pos
.
x
,
cx
-
rayon
);
m_RealBoundaryBox
.
m_Pos
.
x
=
min
(
m_RealBoundaryBox
.
m_Pos
.
x
,
cx
-
rayon
);
m_RealBoundaryBox
.
m_Pos
.
y
=
min
(
m_RealBoundaryBox
.
m_Pos
.
y
,
cy
-
rayon
);
m_RealBoundaryBox
.
m_Pos
.
y
=
min
(
m_RealBoundaryBox
.
m_Pos
.
y
,
cy
-
rayon
);
xmax
=
max
(
xmax
,
cx
+
rayon
);
xmax
=
max
(
xmax
,
cx
+
rayon
);
ymax
=
max
(
ymax
,
cy
+
rayon
);
ymax
=
max
(
ymax
,
cy
+
rayon
);
break
;
break
;
}
}
default
:
default
:
m_RealBoundaryBox
.
m_Pos
.
x
=
min
(
m_RealBoundaryBox
.
m_Pos
.
x
,
EdgeMod
->
m_Start
.
x
-
width
);
m_RealBoundaryBox
.
m_Pos
.
x
=
min
(
m_RealBoundaryBox
.
m_Pos
.
x
,
EdgeMod
->
m_Start
.
x
-
width
);
m_RealBoundaryBox
.
m_Pos
.
x
=
min
(
m_RealBoundaryBox
.
m_Pos
.
x
,
EdgeMod
->
m_End
.
x
-
width
);
m_RealBoundaryBox
.
m_Pos
.
x
=
min
(
m_RealBoundaryBox
.
m_Pos
.
x
,
EdgeMod
->
m_End
.
x
-
width
);
m_RealBoundaryBox
.
m_Pos
.
y
=
min
(
m_RealBoundaryBox
.
m_Pos
.
y
,
EdgeMod
->
m_Start
.
y
-
width
);
m_RealBoundaryBox
.
m_Pos
.
y
=
min
(
m_RealBoundaryBox
.
m_Pos
.
y
,
EdgeMod
->
m_Start
.
y
-
width
);
m_RealBoundaryBox
.
m_Pos
.
y
=
min
(
m_RealBoundaryBox
.
m_Pos
.
y
,
EdgeMod
->
m_End
.
y
-
width
);
m_RealBoundaryBox
.
m_Pos
.
y
=
min
(
m_RealBoundaryBox
.
m_Pos
.
y
,
EdgeMod
->
m_End
.
y
-
width
);
xmax
=
max
(
xmax
,
EdgeMod
->
m_Start
.
x
+
width
);
xmax
=
max
(
xmax
,
EdgeMod
->
m_Start
.
x
+
width
);
xmax
=
max
(
xmax
,
EdgeMod
->
m_End
.
x
+
width
);
xmax
=
max
(
xmax
,
EdgeMod
->
m_End
.
x
+
width
);
ymax
=
max
(
ymax
,
EdgeMod
->
m_Start
.
y
+
width
);
ymax
=
max
(
ymax
,
EdgeMod
->
m_Start
.
y
+
width
);
ymax
=
max
(
ymax
,
EdgeMod
->
m_End
.
y
+
width
);
ymax
=
max
(
ymax
,
EdgeMod
->
m_End
.
y
+
width
);
break
;
break
;
}
}
}
}
/* Pads: Recherche des coord min et max et mise a jour du cadre */
/* Pads: Recherche des coord min et max et mise a jour du cadre */
for
(
Pad
=
m_Pads
;
Pad
!=
NULL
;
Pad
=
(
D_PAD
*
)
Pad
->
Pnext
)
for
(
Pad
=
m_Pads
;
Pad
!=
NULL
;
Pad
=
(
D_PAD
*
)
Pad
->
Pnext
)
{
{
rayon
=
Pad
->
m_Rayon
;
rayon
=
Pad
->
m_Rayon
;
cx
=
Pad
->
m_Pos
.
x
;
cy
=
Pad
->
m_Pos
.
y
;
cx
=
Pad
->
m_Pos
.
x
;
cy
=
Pad
->
m_Pos
.
y
;
m_RealBoundaryBox
.
m_Pos
.
x
=
min
(
m_RealBoundaryBox
.
m_Pos
.
x
,
cx
-
rayon
);
m_RealBoundaryBox
.
m_Pos
.
x
=
min
(
m_RealBoundaryBox
.
m_Pos
.
x
,
cx
-
rayon
);
m_RealBoundaryBox
.
m_Pos
.
y
=
min
(
m_RealBoundaryBox
.
m_Pos
.
y
,
cy
-
rayon
);
m_RealBoundaryBox
.
m_Pos
.
y
=
min
(
m_RealBoundaryBox
.
m_Pos
.
y
,
cy
-
rayon
);
xmax
=
max
(
xmax
,
cx
+
rayon
);
xmax
=
max
(
xmax
,
cx
+
rayon
);
ymax
=
max
(
ymax
,
cy
+
rayon
);
ymax
=
max
(
ymax
,
cy
+
rayon
);
}
}
m_RealBoundaryBox
.
SetWidth
(
xmax
-
m_RealBoundaryBox
.
m_Pos
.
x
);
m_RealBoundaryBox
.
SetHeight
(
ymax
-
m_RealBoundaryBox
.
m_Pos
.
y
);
m_RealBoundaryBox
.
SetWidth
(
xmax
-
m_RealBoundaryBox
.
m_Pos
.
x
);
m_Surface
=
ABS
((
float
)
m_RealBoundaryBox
.
GetWidth
()
*
m_RealBoundaryBox
.
GetHeight
());
m_RealBoundaryBox
.
SetHeight
(
ymax
-
m_RealBoundaryBox
.
m_Pos
.
y
);
m_Surface
=
ABS
(
(
float
)
m_RealBoundaryBox
.
GetWidth
()
*
m_RealBoundaryBox
.
GetHeight
()
);
}
}
/*******************************************************/
/*******************************************************/
void
MODULE
::
Display_Infos
(
WinEDA_BasePcbFrame
*
frame
)
void
MODULE
::
Display_Infos
(
WinEDA_BasePcbFrame
*
frame
)
/*******************************************************/
/*******************************************************/
{
{
int
nbpad
;
int
nbpad
;
char
bufcar
[
512
],
Line
[
512
];
char
bufcar
[
512
],
Line
[
512
];
int
pos
;
int
pos
;
bool
flag
=
FALSE
;
bool
flag
=
FALSE
;
wxString
msg
;
wxString
msg
;
frame
->
MsgPanel
->
EraseMsgBox
()
;
/* Effacement de la zone message */
frame
->
MsgPanel
->
EraseMsgBox
();
/* Effacement de la zone message */
if
(
frame
->
m_Ident
!=
PCB_FRAME
)
flag
=
TRUE
;
if
(
frame
->
m_Ident
!=
PCB_FRAME
)
flag
=
TRUE
;
pos
=
1
;
pos
=
1
;
Affiche_1_Parametre
(
frame
,
pos
,
m_Reference
->
m_Text
,
m_Value
->
m_Text
,
DARKCYAN
);
Affiche_1_Parametre
(
frame
,
pos
,
m_Reference
->
m_Text
,
m_Value
->
m_Text
,
DARKCYAN
);
/* Affiche signature temporelle ou date de modif (en edition de modules) */
/* Affiche signature temporelle ou date de modif (en edition de modules) */
pos
+=
14
;
pos
+=
14
;
if
(
flag
)
// Affichage date de modification (utile en Module Editor)
if
(
flag
)
// Affichage date de modification (utile en Module Editor)
{
{
strcpy
(
Line
,
ctime
(
&
m_LastEdit_Time
)
);
strcpy
(
Line
,
ctime
(
&
m_LastEdit_Time
)
);
strtok
(
Line
,
"
\n\r
"
);
strtok
(
Line
,
"
\n\r
"
);
strcpy
(
bufcar
,
strtok
(
NULL
,
"
\n\r
"
)
);
strcat
(
bufcar
,
" "
);
strcpy
(
bufcar
,
strtok
(
NULL
,
"
\n\r
"
)
);
strcat
(
bufcar
,
" "
);
strcat
(
bufcar
,
strtok
(
NULL
,
"
\n\r
"
)
);
strcat
(
bufcar
,
", "
);
strcat
(
bufcar
,
strtok
(
NULL
,
"
\n\r
"
)
);
strcat
(
bufcar
,
", "
);
strtok
(
NULL
,
"
\n\r
"
);
strtok
(
NULL
,
"
\n\r
"
);
strcat
(
bufcar
,
strtok
(
NULL
,
"
\n\r
"
)
);
strcat
(
bufcar
,
strtok
(
NULL
,
"
\n\r
"
)
);
msg
=
CONV_FROM_UTF8
(
bufcar
);
msg
=
CONV_FROM_UTF8
(
bufcar
);
Affiche_1_Parametre
(
frame
,
pos
,
_
(
"Last Change"
),
msg
,
BROWN
);
Affiche_1_Parametre
(
frame
,
pos
,
_
(
"Last Change"
),
msg
,
BROWN
);
pos
+=
4
;
pos
+=
4
;
}
}
else
else
{
{
msg
.
Printf
(
wxT
(
"%8.8lX"
),
m_TimeStamp
);
msg
.
Printf
(
wxT
(
"%8.8lX"
),
m_TimeStamp
);
Affiche_1_Parametre
(
frame
,
pos
,
_
(
"TimeStamp"
),
msg
,
BROWN
);
Affiche_1_Parametre
(
frame
,
pos
,
_
(
"TimeStamp"
),
msg
,
BROWN
);
}
}
pos
+=
6
;
pos
+=
6
;
Affiche_1_Parametre
(
frame
,
pos
,
_
(
"Layer"
),
ReturnPcbLayerName
(
m_Layer
),
RED
)
;
Affiche_1_Parametre
(
frame
,
pos
,
_
(
"Layer"
),
ReturnPcbLayerName
(
m_Layer
),
RED
)
;
pos
+=
6
;
pos
+=
6
;
EDA_BaseStruct
*
PtStruct
=
m_Pads
;
EDA_BaseStruct
*
PtStruct
=
m_Pads
;
nbpad
=
0
;
nbpad
=
0
;
while
(
PtStruct
)
{
nbpad
++
;
PtStruct
=
PtStruct
->
Pnext
;
}
while
(
PtStruct
)
msg
.
Printf
(
wxT
(
"%d"
),
nbpad
);
{
Affiche_1_Parametre
(
frame
,
pos
,
_
(
"Pads"
),
msg
,
BLUE
);
nbpad
++
;
PtStruct
=
PtStruct
->
Pnext
;
}
msg
.
Printf
(
wxT
(
"%d"
),
nbpad
);
Affiche_1_Parametre
(
frame
,
pos
,
_
(
"Pads"
),
msg
,
BLUE
);
pos
+=
4
;
pos
+=
4
;
msg
=
wxT
(
".."
);
msg
=
wxT
(
".."
);
if
(
m_ModuleStatus
&
MODULE_is_LOCKED
)
msg
[
0
]
=
'F'
;
if
(
m_ModuleStatus
&
MODULE_is_LOCKED
)
if
(
m_ModuleStatus
&
MODULE_is_PLACED
)
msg
[
1
]
=
'P'
;
msg
[
0
]
=
'F'
;
Affiche_1_Parametre
(
frame
,
pos
,
_
(
"Stat"
),
msg
,
MAGENTA
);
if
(
m_ModuleStatus
&
MODULE_is_PLACED
)
msg
[
1
]
=
'P'
;
Affiche_1_Parametre
(
frame
,
pos
,
_
(
"Stat"
),
msg
,
MAGENTA
);
pos
+=
4
;
pos
+=
4
;
msg
.
Printf
(
wxT
(
"%.1f"
),(
float
)
m_Orient
/
10
);
msg
.
Printf
(
wxT
(
"%.1f"
),
(
float
)
m_Orient
/
10
);
Affiche_1_Parametre
(
frame
,
pos
,
_
(
"Orient"
),
msg
,
BROWN
);
Affiche_1_Parametre
(
frame
,
pos
,
_
(
"Orient"
),
msg
,
BROWN
);
pos
+=
5
;
pos
+=
5
;
Affiche_1_Parametre
(
frame
,
pos
,
_
(
"Module"
),
m_LibRef
,
BLUE
);
Affiche_1_Parametre
(
frame
,
pos
,
_
(
"Module"
),
m_LibRef
,
BLUE
);
pos
+=
9
;
pos
+=
9
;
Affiche_1_Parametre
(
frame
,
pos
,
_
(
"3D-Shape"
),
Affiche_1_Parametre
(
frame
,
pos
,
_
(
"3D-Shape"
),
m_3D_Drawings
->
m_Shape3DName
,
RED
);
m_3D_Drawings
->
m_Shape3DName
,
RED
);
pos
+=
14
;
pos
+=
14
;
wxString
doc
=
_
(
"Doc: "
)
+
m_Doc
;
wxString
doc
=
_
(
"Doc: "
)
+
m_Doc
;
wxString
keyword
=
_
(
"KeyW: "
)
+
m_KeyWord
;
wxString
keyword
=
_
(
"KeyW: "
)
+
m_KeyWord
;
Affiche_1_Parametre
(
frame
,
pos
,
doc
,
keyword
,
BLACK
);
Affiche_1_Parametre
(
frame
,
pos
,
doc
,
keyword
,
BLACK
);
}
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void
MODULE
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
{
// for now, make it look like XML, expand on this later.
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
ReturnClassName
().
mb_str
()
<<
" ref=
\"
"
<<
m_Reference
->
m_Text
.
mb_str
()
<<
"
\"
value=
\"
"
<<
m_Value
->
m_Text
.
mb_str
()
<<
"
\"
>
\n
"
;
EDA_BaseStruct
*
p
=
m_Drawings
;
for
(
;
p
;
p
=
p
->
Pnext
)
p
->
Show
(
nestLevel
+
1
,
os
);
EDA_BaseStruct
*
kid
=
m_Son
;
for
(
;
kid
;
kid
=
kid
->
Pnext
)
{
kid
->
Show
(
nestLevel
+
1
,
os
);
}
NestedSpace
(
nestLevel
,
os
)
<<
"</"
<<
ReturnClassName
().
mb_str
()
<<
">
\n
"
;
}
}
#endif
This diff is collapsed.
Click to expand it.
pcbnew/class_module.h
View file @
5748b791
/*******************************************************/
/*******************************************************/
/* class_module.h : module description (excepted pads) */
/* class_module.h : module description (excepted pads) */
/*******************************************************/
/*******************************************************/
class
Pcb3D_GLCanvas
;
class
Pcb3D_GLCanvas
;
class
Struct3D_Master
;
class
Struct3D_Master
;
/************************************/
/************************************/
/* Modules (footprints) description */
/* Modules (footprints) description */
/* pad are in class_pad.xx */
/* pad are in class_pad.xx */
/************************************/
/************************************/
/* Format des modules:
/* Format des modules:
Description generale
*
Description generale
Description segments contour
*
Description segments contour
Description textes
*
Description textes
Description pastilles
*
Description pastilles
*/
*/
/* Flags :*/
/* Flags :*/
...
@@ -24,9 +24,10 @@ enum Mod_Attribut /* Attributs d'un module */
...
@@ -24,9 +24,10 @@ enum Mod_Attribut /* Attributs d'un module */
{
{
MOD_DEFAULT
=
0
,
/* Type default */
MOD_DEFAULT
=
0
,
/* Type default */
MOD_CMS
=
1
,
/* Pour module apparaissant dans les
MOD_CMS
=
1
,
/* Pour module apparaissant dans les
fichiers de placement automatique (principalement modules CMS */
*
fichiers de placement automatique (principalement modules CMS */
MOD_VIRTUAL
=
2
/* Module virtuel constitue par un dessin sur circuit
MOD_VIRTUAL
=
2
/* Module virtuel constitue par un dessin sur circuit
(connecteur, trou de percage..) */
* (connecteur, trou de percage..) */
};
};
/* flags for autoplace and autoroute (.m_ModuleStatus member) */
/* flags for autoplace and autoroute (.m_ModuleStatus member) */
...
@@ -34,24 +35,24 @@ enum Mod_Attribut /* Attributs d'un module */
...
@@ -34,24 +35,24 @@ enum Mod_Attribut /* Attributs d'un module */
#define MODULE_is_PLACED 0x02
/* In autoplace: module automatically placed */
#define MODULE_is_PLACED 0x02
/* In autoplace: module automatically placed */
#define MODULE_to_PLACE 0x04
/* In autoplace: module waiting for autoplace */
#define MODULE_to_PLACE 0x04
/* In autoplace: module waiting for autoplace */
class
MODULE
:
public
EDA_BaseStruct
class
MODULE
:
public
EDA_BaseStruct
{
{
public
:
public
:
int
m_Layer
;
// layer number
int
m_Layer
;
// layer number
wxPoint
m_Pos
;
// Real coord on board
wxPoint
m_Pos
;
// Real coord on board
D_PAD
*
m_Pads
;
/* Pad list (linked list) */
D_PAD
*
m_Pads
;
/* Pad list (linked list) */
EDA_BaseStruct
*
m_Drawings
;
/* Graphic items list (linked list) */
EDA_BaseStruct
*
m_Drawings
;
/* Graphic items list (linked list) */
Struct3D_Master
*
m_3D_Drawings
;
/* Pointeur sur la liste des elements de trace 3D*/
Struct3D_Master
*
m_3D_Drawings
;
/* Pointeur sur la liste des elements de trace 3D*/
TEXTE_MODULE
*
m_Reference
;
// texte reference du composant (U34, R18..)
TEXTE_MODULE
*
m_Reference
;
// texte reference du composant (U34, R18..)
TEXTE_MODULE
*
m_Value
;
// texte valeur du composant (74LS00, 22K..)
TEXTE_MODULE
*
m_Value
;
// texte valeur du composant (74LS00, 22K..)
wxString
m_LibRef
;
/* nom du module en librairie */
wxString
m_LibRef
;
/* nom du module en librairie */
int
m_Attributs
;
/* Flags bits a bit ( voir enum Mod_Attribut ) */
int
m_Attributs
;
/* Flags bits a bit ( voir enum Mod_Attribut ) */
int
m_Orient
;
/* orientation en 1/10 degres */
int
m_Orient
;
/* orientation en 1/10 degres */
int
flag
;
/* flag utilise en trace rastnest et routage auto */
int
flag
;
/* flag utilise en trace rastnest et routage auto */
int
m_ModuleStatus
;
/* For autoplace: flags (LOCKED, AUTOPLACED) */
int
m_ModuleStatus
;
/* For autoplace: flags (LOCKED, AUTOPLACED) */
EDA_Rect
m_BoundaryBox
;
/* position/taille du cadre de reperage (coord locales)*/
EDA_Rect
m_BoundaryBox
;
/* position/taille du cadre de reperage (coord locales)*/
EDA_Rect
m_RealBoundaryBox
;
/* position/taille du module (coord relles) */
EDA_Rect
m_RealBoundaryBox
;
/* position/taille du module (coord relles) */
int
m_PadNum
;
// Nombre total de pads
int
m_PadNum
;
// Nombre total de pads
int
m_AltPadNum
;
// en placement auto Nombre de pads actifs pour
int
m_AltPadNum
;
// en placement auto Nombre de pads actifs pour
// les calculs
// les calculs
...
@@ -67,23 +68,24 @@ public:
...
@@ -67,23 +68,24 @@ public:
wxString
m_KeyWord
;
// Liste des mots cles relatifs au module
wxString
m_KeyWord
;
// Liste des mots cles relatifs au module
public
:
public
:
MODULE
(
BOARD
*
parent
);
MODULE
(
BOARD
*
parent
);
MODULE
(
MODULE
*
module
);
MODULE
(
MODULE
*
module
);
~
MODULE
(
void
);
~
MODULE
(
void
);
void
Copy
(
MODULE
*
Module
);
// Copy structure
void
Copy
(
MODULE
*
Module
);
// Copy structure
MODULE
*
Next
(
void
)
{
return
(
MODULE
*
)
Pnext
;
}
void
Set_Rectangle_Encadrement
(
void
);
/* mise a jour du rect d'encadrement
MODULE
*
Next
(
void
)
{
return
(
MODULE
*
)
Pnext
;
}
en coord locales (orient 0 et origine = pos module) */
void
SetRectangleExinscrit
(
void
);
/* mise a jour du rect d'encadrement
void
Set_Rectangle_Encadrement
(
void
);
/* mise a jour du rect d'encadrement
et de la surface en coord reelles */
* en coord locales (orient 0 et origine = pos module) */
void
SetRectangleExinscrit
(
void
);
/* mise a jour du rect d'encadrement
* et de la surface en coord reelles */
// deplacements
// deplacements
void
SetPosition
(
const
wxPoint
&
newpos
);
void
SetPosition
(
const
wxPoint
&
newpos
);
void
SetOrientation
(
int
newangle
);
void
SetOrientation
(
int
newangle
);
/* supprime du chainage la structure Struct */
/* supprime du chainage la structure Struct */
void
UnLink
(
void
);
void
UnLink
(
void
);
...
@@ -114,21 +116,32 @@ public:
...
@@ -114,21 +116,32 @@ public:
/* Readind and writing data on files */
/* Readind and writing data on files */
int
WriteDescr
(
FILE
*
File
);
int
WriteDescr
(
FILE
*
File
);
int
Write_3D_Descr
(
FILE
*
File
);
int
Write_3D_Descr
(
FILE
*
File
);
int
ReadDescr
(
FILE
*
File
,
int
*
LineNum
=
NULL
);
int
ReadDescr
(
FILE
*
File
,
int
*
LineNum
=
NULL
);
int
Read_3D_Descr
(
FILE
*
File
,
int
*
LineNum
=
NULL
);
int
Read_3D_Descr
(
FILE
*
File
,
int
*
LineNum
=
NULL
);
/* drawing functions */
/* drawing functions */
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
);
const
wxPoint
&
offset
,
int
draw_mode
);
void
Draw3D
(
Pcb3D_GLCanvas
*
glcanvas
);
void
Draw3D
(
Pcb3D_GLCanvas
*
glcanvas
);
void
DrawEdgesOnly
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
DrawEdgesOnly
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
);
const
wxPoint
&
offset
,
int
draw_mode
);
void
DrawAncre
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
DrawAncre
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
dim_ancre
,
int
draw_mode
);
const
wxPoint
&
offset
,
int
dim_ancre
,
int
draw_mode
);
/* miscellaneous */
/* miscellaneous */
void
Display_Infos
(
WinEDA_BasePcbFrame
*
frame
);
void
Display_Infos
(
WinEDA_BasePcbFrame
*
frame
);
};
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
};
This diff is collapsed.
Click to expand it.
pcbnew/files.cpp
View file @
5748b791
/***************************************************/
/***************************************************/
/* Files.cpp: Lecture / Sauvegarde des fichiers PCB */
/* Files.cpp: Lecture / Sauvegarde des fichiers PCB */
/***************************************************/
/***************************************************/
#include "fctsys.h"
#include "fctsys.h"
...
@@ -11,30 +11,31 @@
...
@@ -11,30 +11,31 @@
/****************************************************/
/****************************************************/
void
WinEDA_PcbFrame
::
Files_io
(
wxCommandEvent
&
event
)
void
WinEDA_PcbFrame
::
Files_io
(
wxCommandEvent
&
event
)
/****************************************************/
/****************************************************/
/* Gestion generale des commandes de lecture de fichiers
/* Gestion generale des commandes de lecture de fichiers
*/
*/
{
{
int
id
=
event
.
GetId
();
int
id
=
event
.
GetId
();
wxClientDC
dc
(
DrawPanel
);
wxClientDC
dc
(
DrawPanel
);
wxString
msg
;
wxString
msg
;
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
// Arret des commandes en cours
// Arret des commandes en cours
if
(
DrawPanel
->
ManageCurseur
&&
DrawPanel
->
ForceCloseManageCurseur
)
if
(
DrawPanel
->
ManageCurseur
&&
DrawPanel
->
ForceCloseManageCurseur
)
{
{
DrawPanel
->
ForceCloseManageCurseur
(
DrawPanel
,
&
dc
);
DrawPanel
->
ForceCloseManageCurseur
(
DrawPanel
,
&
dc
);
}
}
SetToolID
(
0
,
wxCURSOR_ARROW
,
wxEmptyString
);
SetToolID
(
0
,
wxCURSOR_ARROW
,
wxEmptyString
);
switch
(
id
)
switch
(
id
)
{
{
case
ID_MENU_LOAD_FILE
:
case
ID_MENU_LOAD_FILE
:
case
ID_LOAD_FILE
:
case
ID_LOAD_FILE
:
Clear_Pcb
(
&
dc
,
TRUE
);
Clear_Pcb
(
&
dc
,
TRUE
);
LoadOnePcbFile
(
wxEmptyString
,
&
dc
,
FALSE
);
LoadOnePcbFile
(
wxEmptyString
,
&
dc
,
FALSE
);
ReCreateAuxiliaryToolbar
();
ReCreateAuxiliaryToolbar
();
break
;
break
;
...
@@ -42,45 +43,46 @@ wxString msg;
...
@@ -42,45 +43,46 @@ wxString msg;
case
ID_MENU_RECOVER_BOARD
:
case
ID_MENU_RECOVER_BOARD
:
{
{
wxString
filename
,
oldfilename
=
GetScreen
()
->
m_FileName
;
wxString
filename
,
oldfilename
=
GetScreen
()
->
m_FileName
;
if
(
id
==
ID_MENU_RECOVER_BOARD
)
if
(
id
==
ID_MENU_RECOVER_BOARD
)
{
{
filename
=
g_SaveFileName
+
PcbExtBuffer
;
filename
=
g_SaveFileName
+
PcbExtBuffer
;
}
}
else
else
{
{
filename
=
oldfilename
;
filename
=
oldfilename
;
ChangeFileNameExt
(
filename
,
wxT
(
".000"
)
);
ChangeFileNameExt
(
filename
,
wxT
(
".000"
)
);
}
}
if
(
!
wxFileExists
(
filename
)
)
if
(
!
wxFileExists
(
filename
)
)
{
{
msg
=
_
(
"Recovery file "
)
+
filename
+
_
(
" not found"
);
msg
=
_
(
"Recovery file "
)
+
filename
+
_
(
" not found"
);
DisplayInfo
(
this
,
msg
);
DisplayInfo
(
this
,
msg
);
break
;
break
;
}
}
else
else
{
{
msg
=
_
(
"Ok to load Recovery file "
)
+
filename
;
msg
=
_
(
"Ok to load Recovery file "
)
+
filename
;
if
(
!
IsOK
(
this
,
msg
)
)
break
;
if
(
!
IsOK
(
this
,
msg
)
)
break
;
}
}
Clear_Pcb
(
&
dc
,
TRUE
);
Clear_Pcb
(
&
dc
,
TRUE
);
LoadOnePcbFile
(
filename
,
&
dc
,
FALSE
);
LoadOnePcbFile
(
filename
,
&
dc
,
FALSE
);
GetScreen
()
->
m_FileName
=
oldfilename
;
GetScreen
()
->
m_FileName
=
oldfilename
;
SetTitle
(
GetScreen
()
->
m_FileName
);
SetTitle
(
GetScreen
()
->
m_FileName
);
ReCreateAuxiliaryToolbar
();
ReCreateAuxiliaryToolbar
();
}
}
break
;
break
;
case
ID_MENU_APPEND_FILE
:
case
ID_MENU_APPEND_FILE
:
case
ID_APPEND_FILE
:
case
ID_APPEND_FILE
:
LoadOnePcbFile
(
wxEmptyString
,
&
dc
,
TRUE
);
LoadOnePcbFile
(
wxEmptyString
,
&
dc
,
TRUE
);
break
;
break
;
case
ID_MENU_NEW_BOARD
:
case
ID_MENU_NEW_BOARD
:
case
ID_NEW_BOARD
:
case
ID_NEW_BOARD
:
Clear_Pcb
(
&
dc
,
TRUE
);
Clear_Pcb
(
&
dc
,
TRUE
);
GetScreen
()
->
m_FileName
.
Printf
(
wxT
(
"%s%cnoname%s"
),
GetScreen
()
->
m_FileName
.
Printf
(
wxT
(
"%s%cnoname%s"
),
wxGetCwd
().
GetData
(),
DIR_SEP
,
PcbExtBuffer
.
GetData
()
);
wxGetCwd
().
GetData
(),
DIR_SEP
,
PcbExtBuffer
.
GetData
()
);
SetTitle
(
GetScreen
()
->
m_FileName
);
SetTitle
(
GetScreen
()
->
m_FileName
);
break
;
break
;
case
ID_LOAD_FILE_1
:
case
ID_LOAD_FILE_1
:
...
@@ -93,53 +95,53 @@ wxString msg;
...
@@ -93,53 +95,53 @@ wxString msg;
case
ID_LOAD_FILE_8
:
case
ID_LOAD_FILE_8
:
case
ID_LOAD_FILE_9
:
case
ID_LOAD_FILE_9
:
case
ID_LOAD_FILE_10
:
case
ID_LOAD_FILE_10
:
Clear_Pcb
(
&
dc
,
TRUE
);
Clear_Pcb
(
&
dc
,
TRUE
);
wxSetWorkingDirectory
(
wxPathOnly
(
GetLastProject
(
id
-
ID_LOAD_FILE_1
))
);
wxSetWorkingDirectory
(
wxPathOnly
(
GetLastProject
(
id
-
ID_LOAD_FILE_1
)
)
);
LoadOnePcbFile
(
GetLastProject
(
id
-
ID_LOAD_FILE_1
).
GetData
(),
LoadOnePcbFile
(
GetLastProject
(
id
-
ID_LOAD_FILE_1
).
GetData
(),
&
dc
,
FALSE
);
&
dc
,
FALSE
);
ReCreateAuxiliaryToolbar
();
ReCreateAuxiliaryToolbar
();
break
;
break
;
case
ID_SAVE_BOARD
:
case
ID_SAVE_BOARD
:
case
ID_MENU_SAVE_BOARD
:
case
ID_MENU_SAVE_BOARD
:
SavePcbFile
(
GetScreen
()
->
m_FileName
);
SavePcbFile
(
GetScreen
()
->
m_FileName
);
break
;
break
;
case
ID_MENU_SAVE_BOARD_AS
:
case
ID_MENU_SAVE_BOARD_AS
:
SavePcbFile
(
wxEmptyString
);
SavePcbFile
(
wxEmptyString
);
break
;
break
;
case
ID_PCB_GEN_CMP_FILE
:
case
ID_PCB_GEN_CMP_FILE
:
RecreateCmpFileFromBoard
();
RecreateCmpFileFromBoard
();
break
;
break
;
default
:
DisplayError
(
this
,
wxT
(
"File_io Internal Error"
)
);
break
;
default
:
DisplayError
(
this
,
wxT
(
"File_io Internal Error"
)
);
break
;
}
}
}
}
/*****************************************************************************************/
/*****************************************************************************************/
int
WinEDA_PcbFrame
::
LoadOnePcbFile
(
const
wxString
&
FullFileName
,
wxDC
*
DC
,
bool
Append
)
int
WinEDA_PcbFrame
::
LoadOnePcbFile
(
const
wxString
&
FullFileName
,
wxDC
*
DC
,
bool
Append
)
/******************************************************************************************/
/******************************************************************************************/
/*
/*
Lecture d'un fichier PCB, le nom etant dans PcbNameBuffer.s
*
Lecture d'un fichier PCB, le nom etant dans PcbNameBuffer.s
retourne:
*
retourne:
0 si fichier non lu ( annulation de commande ... )
*
0 si fichier non lu ( annulation de commande ... )
1 si OK
*
1 si OK
*/
*/
{
{
int
ii
;
int
ii
;
FILE
*
source
;
FILE
*
source
;
wxString
msg
;
wxString
msg
;
ActiveScreen
=
GetScreen
();
ActiveScreen
=
GetScreen
();
if
(
GetScreen
()
->
IsModify
()
&&
!
Append
)
if
(
GetScreen
()
->
IsModify
()
&&
!
Append
)
{
{
if
(
!
IsOK
(
this
,
_
(
"Board Modified: Continue ?"
))
)
if
(
!
IsOK
(
this
,
_
(
"Board Modified: Continue ?"
)
)
)
return
(
0
)
;
return
0
;
}
}
m_SelTrackWidthBox_Changed
=
TRUE
;
m_SelTrackWidthBox_Changed
=
TRUE
;
...
@@ -152,11 +154,11 @@ wxString msg;
...
@@ -152,11 +154,11 @@ wxString msg;
m_Pcb
->
m_Status_Pcb
=
0
;
m_Pcb
->
m_Status_Pcb
=
0
;
}
}
if
(
FullFileName
==
wxEmptyString
)
if
(
FullFileName
==
wxEmptyString
)
{
{
msg
=
wxT
(
"*"
)
+
PcbExtBuffer
;
msg
=
wxT
(
"*"
)
+
PcbExtBuffer
;
wxString
FileName
=
wxString
FileName
=
EDA_FileSelector
(
_
(
"Board files:"
),
EDA_FileSelector
(
_
(
"Board files:"
),
wxEmptyString
,
/* Chemin par defaut */
wxEmptyString
,
/* Chemin par defaut */
GetScreen
()
->
m_FileName
,
/* nom fichier par defaut */
GetScreen
()
->
m_FileName
,
/* nom fichier par defaut */
PcbExtBuffer
,
/* extension par defaut */
PcbExtBuffer
,
/* extension par defaut */
...
@@ -165,90 +167,98 @@ wxString msg;
...
@@ -165,90 +167,98 @@ wxString msg;
wxFD_OPEN
,
wxFD_OPEN
,
FALSE
FALSE
);
);
if
(
FileName
==
wxEmptyString
)
return
FALSE
;
if
(
FileName
==
wxEmptyString
)
return
FALSE
;
GetScreen
()
->
m_FileName
=
FileName
;
GetScreen
()
->
m_FileName
=
FileName
;
}
}
else
else
GetScreen
()
->
m_FileName
=
FullFileName
;
GetScreen
()
->
m_FileName
=
FullFileName
;
/////////////////////////
/////////////////////////
/* Lecture Fichier PCB */
/* Lecture Fichier PCB */
/////////////////////////
/////////////////////////
source
=
wxFopen
(
GetScreen
()
->
m_FileName
,
wxT
(
"rt"
)
);
source
=
wxFopen
(
GetScreen
()
->
m_FileName
,
wxT
(
"rt"
)
);
if
(
source
==
NULL
)
if
(
source
==
NULL
)
{
{
msg
.
Printf
(
_
(
"File <%s> not found"
),
GetScreen
()
->
m_FileName
.
GetData
())
;
msg
.
Printf
(
_
(
"File <%s> not found"
),
GetScreen
()
->
m_FileName
.
GetData
()
)
;
DisplayError
(
this
,
msg
)
;
DisplayError
(
this
,
msg
)
;
return
(
0
)
;
return
0
;
}
}
/* Lecture de l'entete et TEST si PCB format ASCII */
/* Lecture de l'entete et TEST si PCB format ASCII */
GetLine
(
source
,
cbuf
,
&
ii
);
GetLine
(
source
,
cbuf
,
&
ii
);
if
(
strncmp
(
cbuf
,
"PCBNEW-BOARD"
,
12
)
!=
0
)
if
(
strncmp
(
cbuf
,
"PCBNEW-BOARD"
,
12
)
!=
0
)
{
{
fclose
(
source
);
fclose
(
source
);
DisplayError
(
this
,
wxT
(
"Unknown file type"
)
);
DisplayError
(
this
,
wxT
(
"Unknown file type"
)
);
return
(
0
)
;
return
0
;
}
}
SetTitle
(
GetScreen
()
->
m_FileName
);
SetTitle
(
GetScreen
()
->
m_FileName
);
SetLastProject
(
GetScreen
()
->
m_FileName
);
SetLastProject
(
GetScreen
()
->
m_FileName
);
// Rechargement de la configuration:
// Rechargement de la configuration:
wxSetWorkingDirectory
(
wxPathOnly
(
GetScreen
()
->
m_FileName
)
);
wxSetWorkingDirectory
(
wxPathOnly
(
GetScreen
()
->
m_FileName
)
);
if
(
Append
)
ReadPcbFile
(
DC
,
source
,
TRUE
);
if
(
Append
)
ReadPcbFile
(
DC
,
source
,
TRUE
);
else
else
{
{
Read_Config
(
GetScreen
()
->
m_FileName
);
Read_Config
(
GetScreen
()
->
m_FileName
);
// Mise a jour du toolbar d'options
// Mise a jour du toolbar d'options
m_DisplayPcbTrackFill
=
DisplayOpt
.
DisplayPcbTrackFill
;
m_DisplayPcbTrackFill
=
DisplayOpt
.
DisplayPcbTrackFill
;
m_DisplayModText
=
DisplayOpt
.
DisplayModText
;
m_DisplayModText
=
DisplayOpt
.
DisplayModText
;
m_DisplayModEdge
=
DisplayOpt
.
DisplayModEdge
;
m_DisplayModEdge
=
DisplayOpt
.
DisplayModEdge
;
m_DisplayPadFill
=
DisplayOpt
.
DisplayPadFill
;
m_DisplayPadFill
=
DisplayOpt
.
DisplayPadFill
;
ReadPcbFile
(
DC
,
source
,
FALSE
);
ReadPcbFile
(
DC
,
source
,
FALSE
);
}
}
fclose
(
source
);
fclose
(
source
);
GetScreen
()
->
ClrModify
();
GetScreen
()
->
ClrModify
();
if
(
Append
)
if
(
Append
)
{
{
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
GetScreen
()
->
m_FileName
.
Printf
(
wxT
(
"%s%cnoname%s"
),
GetScreen
()
->
m_FileName
.
Printf
(
wxT
(
"%s%cnoname%s"
),
wxGetCwd
().
GetData
(),
DIR_SEP
,
PcbExtBuffer
.
GetData
()
);
wxGetCwd
().
GetData
(),
DIR_SEP
,
PcbExtBuffer
.
GetData
()
);
}
}
/* liste des pads recalculee avec Affichage des messages d'erreur */
/* liste des pads recalculee avec Affichage des messages d'erreur */
build_liste_pads
();
build_liste_pads
();
Affiche_Infos_Status_Pcb
(
this
);
Affiche_Infos_Status_Pcb
(
this
);
g_SaveTime
=
time
(
NULL
);
g_SaveTime
=
time
(
NULL
);
return
(
1
);
}
#if defined(DEBUG)
// output the board object tree to stdout:
m_Pcb
->
Show
(
0
,
std
::
cout
);
#endif
return
1
;
}
/***********************************************************/
/***********************************************************/
bool
WinEDA_PcbFrame
::
SavePcbFile
(
const
wxString
&
FileName
)
bool
WinEDA_PcbFrame
::
SavePcbFile
(
const
wxString
&
FileName
)
/************************************************************/
/************************************************************/
/* Sauvegarde du fichier PCB en format ASCII
/* Sauvegarde du fichier PCB en format ASCII
*/
*/
{
{
wxString
old_name
,
FullFileName
,
msg
;
wxString
old_name
,
FullFileName
,
msg
;
bool
saveok
=
TRUE
;
bool
saveok
=
TRUE
;
FILE
*
dest
;
FILE
*
dest
;
if
(
FileName
==
wxEmptyString
)
if
(
FileName
==
wxEmptyString
)
{
{
msg
=
wxT
(
"*"
)
+
PcbExtBuffer
;
msg
=
wxT
(
"*"
)
+
PcbExtBuffer
;
FullFileName
=
EDA_FileSelector
(
_
(
"Board files:"
),
FullFileName
=
EDA_FileSelector
(
_
(
"Board files:"
),
wxEmptyString
,
/* Chemin par defaut */
wxEmptyString
,
/* Chemin par defaut */
GetScreen
()
->
m_FileName
,
/* nom fichier par defaut */
GetScreen
()
->
m_FileName
,
/* nom fichier par defaut */
PcbExtBuffer
,
/* extension par defaut */
PcbExtBuffer
,
/* extension par defaut */
...
@@ -257,57 +267,58 @@ FILE * dest;
...
@@ -257,57 +267,58 @@ FILE * dest;
wxFD_SAVE
,
wxFD_SAVE
,
FALSE
FALSE
);
);
if
(
FullFileName
==
wxEmptyString
)
return
FALSE
;
if
(
FullFileName
==
wxEmptyString
)
return
FALSE
;
GetScreen
()
->
m_FileName
=
FullFileName
;
GetScreen
()
->
m_FileName
=
FullFileName
;
}
}
else
GetScreen
()
->
m_FileName
=
FileName
;
else
GetScreen
()
->
m_FileName
=
FileName
;
/* mise a jour date si modifications */
/* mise a jour date si modifications */
if
(
GetScreen
()
->
IsModify
()
)
if
(
GetScreen
()
->
IsModify
()
)
{
{
GetScreen
()
->
m_Date
=
GenDate
();
GetScreen
()
->
m_Date
=
GenDate
();
}
}
/* Calcul du nom du fichier a creer */
/* Calcul du nom du fichier a creer */
FullFileName
=
MakeFileName
(
wxEmptyString
,
GetScreen
()
->
m_FileName
,
PcbExtBuffer
);
FullFileName
=
MakeFileName
(
wxEmptyString
,
GetScreen
()
->
m_FileName
,
PcbExtBuffer
);
/* Calcul du nom du fichier de sauvegarde */
/* Calcul du nom du fichier de sauvegarde */
old_name
=
FullFileName
;
old_name
=
FullFileName
;
ChangeFileNameExt
(
old_name
,
wxT
(
".000"
)
);
ChangeFileNameExt
(
old_name
,
wxT
(
".000"
)
);
/* Changement du nom de l'ancien fichier s'il existe */
/* Changement du nom de l'ancien fichier s'il existe */
if
(
wxFileExists
(
FullFileName
)
)
if
(
wxFileExists
(
FullFileName
)
)
{
{
/* conversion en *.000 de l'ancien fichier */
/* conversion en *.000 de l'ancien fichier */
wxRemoveFile
(
old_name
);
/* S'il y a une ancienne sauvegarde */
wxRemoveFile
(
old_name
);
/* S'il y a une ancienne sauvegarde */
if
(
!
wxRenameFile
(
FullFileName
,
old_name
)
)
if
(
!
wxRenameFile
(
FullFileName
,
old_name
)
)
{
{
msg
=
_
(
"Warning: unable to create bakfile "
)
+
old_name
;
msg
=
_
(
"Warning: unable to create bakfile "
)
+
old_name
;
DisplayError
(
this
,
msg
,
15
)
;
DisplayError
(
this
,
msg
,
15
)
;
saveok
=
FALSE
;
saveok
=
FALSE
;
}
}
}
}
else
else
{
{
old_name
=
wxEmptyString
;
saveok
=
FALSE
;
old_name
=
wxEmptyString
;
saveok
=
FALSE
;
}
}
/* Sauvegarde de l'ancien fichier */
/* Sauvegarde de l'ancien fichier */
dest
=
wxFopen
(
FullFileName
,
wxT
(
"wt"
)
);
dest
=
wxFopen
(
FullFileName
,
wxT
(
"wt"
)
);
if
(
dest
==
0
)
if
(
dest
==
0
)
{
{
msg
=
_
(
"Unable to create "
)
+
FullFileName
;
msg
=
_
(
"Unable to create "
)
+
FullFileName
;
DisplayError
(
this
,
msg
)
;
DisplayError
(
this
,
msg
)
;
saveok
=
FALSE
;
saveok
=
FALSE
;
}
}
if
(
dest
)
if
(
dest
)
{
{
GetScreen
()
->
m_FileName
=
FullFileName
;
GetScreen
()
->
m_FileName
=
FullFileName
;
SetTitle
(
GetScreen
()
->
m_FileName
);
SetTitle
(
GetScreen
()
->
m_FileName
);
SavePcbFormatAscii
(
dest
);
SavePcbFormatAscii
(
dest
);
fclose
(
dest
)
;
fclose
(
dest
)
;
}
}
/* Affichage des fichiers crees: */
/* Affichage des fichiers crees: */
...
@@ -315,17 +326,18 @@ FILE * dest;
...
@@ -315,17 +326,18 @@ FILE * dest;
if
(
saveok
)
if
(
saveok
)
{
{
msg
=
_
(
"Backup file: "
)
+
old_name
;
msg
=
_
(
"Backup file: "
)
+
old_name
;
Affiche_1_Parametre
(
this
,
1
,
msg
,
wxEmptyString
,
CYAN
);
Affiche_1_Parametre
(
this
,
1
,
msg
,
wxEmptyString
,
CYAN
);
}
}
if
(
dest
)
msg
=
_
(
"Write Board file: "
);
if
(
dest
)
else
msg
=
_
(
"Failed to create "
);
msg
=
_
(
"Write Board file: "
);
else
msg
=
_
(
"Failed to create "
);
msg
+=
FullFileName
;
msg
+=
FullFileName
;
Affiche_1_Parametre
(
this
,
1
,
wxEmptyString
,
msg
,
CYAN
);
Affiche_1_Parametre
(
this
,
1
,
wxEmptyString
,
msg
,
CYAN
);
g_SaveTime
=
time
(
NULL
);
/* Reset delai pour sauvegarde automatique */
g_SaveTime
=
time
(
NULL
);
/* Reset delai pour sauvegarde automatique */
GetScreen
()
->
ClrModify
();
GetScreen
()
->
ClrModify
();
return
TRUE
;
return
TRUE
;
}
}
This diff is collapsed.
Click to expand it.
pcbnew/ioascii.cpp
View file @
5748b791
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
/* Fichier common a PCBNEW et CVPCB */
/* Fichier common a PCBNEW et CVPCB */
/********************************************************************/
/********************************************************************/
/* ioascii.cpp */
/* ioascii.cpp */
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -24,783 +24,835 @@
...
@@ -24,783 +24,835 @@
/* Format des structures de sauvegarde type ASCII :
/* Format des structures de sauvegarde type ASCII :
Structure PAD:
Structure PAD:
$PAD
$PAD
Sh "name" forme dimv dimH dV dH orient :forme generale dV, dH = delta dimensions
Sh "name" forme dimv dimH dV dH orient :forme generale dV, dH = delta dimensions
Dr diam, dV dH :drill : diametre offsets de percage
Dr diam, dV dH :drill : diametre offsets de percage
At type S/N layers : type standard,cms,conn,hole,meca.,
At type S/N layers : type standard,cms,conn,hole,meca.,
Stack/Normal,
Stack/Normal,
Hexadecimal 32 bits: occupation des couches
Hexadecimal 32 bits: occupation des couches
Nm net_code netname
Nm net_code netname
Po posrefX posrefy : position refX,Y (= position orient 0 / ancre)
Po posrefX posrefy : position refX,Y (= position orient 0 / ancre)
$EndPAD
$EndPAD
******
**
Structure module ***********
****** Structure module ***********
$MODULE namelib
$MODULE namelib
Po ax ay orient layer masquelayer m_TimeCode
Po ax ay orient layer masquelayer m_TimeCode
ax ay = coord ancre (position module)
ax ay = coord ancre (position module)
orient = orient en 0.1 degre
orient = orient en 0.1 degre
layer = numero de couche
layer = numero de couche
masquelayer = couche pour serigraphie
masquelayer = couche pour serigraphie
m_TimeCode a usage interne (groupements)
m_TimeCode a usage interne (groupements)
Li <namelib>
Li <namelib>
Cd <text> Description du composant (Composant Doc)
Cd <text> Description du composant (Composant Doc)
Kw <text> Liste des mots cle
Kw <text> Liste des mots cle
Sc schematimestamp de reference schematique
Sc schematimestamp de reference schematique
Op rot90 rot180 Options de placement auto (cout rot 90, 180 )
Op rot90 rot180 Options de placement auto (cout rot 90, 180 )
rot90 est sur 2x4 bits:
rot90 est sur 2x4 bits:
lsb = cout rot 90, msb = cout rot -90;
lsb = cout rot 90, msb = cout rot -90;
Tn px py dimv dimh orient epaisseur miroir visible "texte"
Tn px py dimv dimh orient epaisseur miroir visible "texte"
n = type (0 = ref, 1 = val, > 1 =qcq
n = type (0 = ref, 1 = val, > 1 =qcq
Textes POS x,y / ancre et orient module 0
Textes POS x,y / ancre et orient module 0
dimv dimh orient
dimv dimh orient
epaisseur miroir (Normal/miroir)
epaisseur miroir (Normal/miroir)
visible V/I
visible V/I
DS ox oy fx fy w
DS ox oy fx fy w
edge: segment coord ox,oy a fx,fy, relatives
edge: segment coord ox,oy a fx,fy, relatives
a l'ancre et orient 0
a l'ancre et orient 0
epaisseur w
epaisseur w
DC ox oy fx fy w descr cercle (centre, 1 point, epaisseur)
DC ox oy fx fy w descr cercle (centre, 1 point, epaisseur)
$PAD
$PAD
$EndPAD section pads s'il y en a
$EndPAD section pads s'il y en a
$EndMODULE
$EndMODULE
*/
*/
extern
Ki_PageDescr
*
SheetList
[];
extern
Ki_PageDescr
*
SheetList
[];
/* Variables locales, utilisees pour la lecture des fichiers PCB */
/* Variables locales, utilisees pour la lecture des fichiers PCB */
int
NbDraw
,
NbTrack
,
NbZone
,
NbMod
,
NbNets
;
int
NbDraw
,
NbTrack
,
NbZone
,
NbMod
,
NbNets
;
/**********************************************************************/
/**********************************************************************/
int
WinEDA_BasePcbFrame
::
ReadListeSegmentDescr
(
wxDC
*
DC
,
FILE
*
File
,
int
WinEDA_BasePcbFrame
::
ReadListeSegmentDescr
(
wxDC
*
DC
,
FILE
*
File
,
TRACK
*
PtSegm
,
int
StructType
,
TRACK
*
PtSegm
,
int
StructType
,
int
*
LineNum
,
int
NumSegm
)
int
*
LineNum
,
int
NumSegm
)
/**********************************************************************/
/**********************************************************************/
/* Lecture de la description d'une liste de segments (Tracks, zones)
/* Lecture de la description d'une liste de segments (Tracks, zones)
Retourne:
*
Retourne:
si ok nombre d'items lus.
*
si ok nombre d'items lus.
si pas de fin de block ($..) - nombre.
*
si pas de fin de block ($..) - nombre.
*/
*/
{
{
int
shape
,
width
,
layer
,
type
,
flags
,
net_code
;
int
shape
,
width
,
layer
,
type
,
flags
,
net_code
;
int
ii
=
0
,
PerCent
,
Pas
;
int
ii
=
0
,
PerCent
,
Pas
;
char
Line
[
256
];
char
Line
[
256
];
TRACK
*
NewTrack
;
TRACK
*
NewTrack
;
PerCent
=
0
;
Pas
=
NumSegm
/
99
;
PerCent
=
0
;
Pas
=
NumSegm
/
99
;
#ifdef PCBNEW
#ifdef PCBNEW
switch
(
StructType
)
switch
(
StructType
)
{
{
case
TYPETRACK
:
case
TYPETRACK
:
case
TYPEVIA
:
case
TYPEVIA
:
DisplayActivity
(
PerCent
,
wxT
(
"Tracks:"
)
);
DisplayActivity
(
PerCent
,
wxT
(
"Tracks:"
)
);
break
;
break
;
case
TYPEZONE
:
case
TYPEZONE
:
DisplayActivity
(
PerCent
,
wxT
(
"Zones:"
)
);
DisplayActivity
(
PerCent
,
wxT
(
"Zones:"
)
);
break
;
break
;
}
}
#endif
#endif
while
(
GetLine
(
File
,
Line
,
LineNum
)
)
while
(
GetLine
(
File
,
Line
,
LineNum
)
)
{
{
if
(
Line
[
0
]
==
'$'
)
if
(
Line
[
0
]
==
'$'
)
{
{
return
(
ii
);
/* fin de liste OK */
return
ii
;
/* fin de liste OK */
}
}
switch
(
StructType
)
switch
(
StructType
)
{
{
default
:
default
:
case
TYPETRACK
:
NewTrack
=
new
TRACK
(
m_Pcb
);
case
TYPETRACK
:
NewTrack
=
new
TRACK
(
m_Pcb
);
break
;
break
;
case
TYPEVIA
:
NewTrack
=
new
SEGVIA
(
m_Pcb
);
case
TYPEVIA
:
NewTrack
=
new
SEGVIA
(
m_Pcb
);
break
;
break
;
case
TYPEZONE
:
NewTrack
=
new
SEGZONE
(
m_Pcb
);
case
TYPEZONE
:
NewTrack
=
new
SEGZONE
(
m_Pcb
);
break
;
break
;
}
}
NewTrack
->
Insert
(
m_Pcb
,
PtSegm
);
PtSegm
=
NewTrack
;
int
arg_count
=
sscanf
(
Line
+
2
,
" %d %d %d %d %d %d %d"
,
&
shape
,
NewTrack
->
Insert
(
m_Pcb
,
PtSegm
);
PtSegm
=
NewTrack
;
int
arg_count
=
sscanf
(
Line
+
2
,
" %d %d %d %d %d %d %d"
,
&
shape
,
&
PtSegm
->
m_Start
.
x
,
&
PtSegm
->
m_Start
.
y
,
&
PtSegm
->
m_Start
.
x
,
&
PtSegm
->
m_Start
.
y
,
&
PtSegm
->
m_End
.
x
,
&
PtSegm
->
m_End
.
y
,
&
width
,
&
PtSegm
->
m_End
.
x
,
&
PtSegm
->
m_End
.
y
,
&
width
,
&
PtSegm
->
m_Drill
);
&
PtSegm
->
m_Drill
);
PtSegm
->
m_Width
=
width
;
PtSegm
->
m_Shape
=
shape
;
PtSegm
->
m_Width
=
width
;
PtSegm
->
m_Shape
=
shape
;
if
(
arg_count
<
7
)
PtSegm
->
m_Drill
=
-
1
;
if
(
arg_count
<
7
)
PtSegm
->
m_Drill
=
-
1
;
if
(
GetLine
(
File
,
Line
,
LineNum
)
==
NULL
)
break
;
if
(
GetLine
(
File
,
Line
,
LineNum
)
==
NULL
)
if
(
Line
[
0
]
==
'$'
)
break
;
break
;
if
(
Line
[
0
]
==
'$'
)
break
;
sscanf
(
Line
+
2
,
" %d %d %d %lX %X"
,
&
layer
,
&
type
,
&
net_code
,
sscanf
(
Line
+
2
,
" %d %d %d %lX %X"
,
&
layer
,
&
type
,
&
net_code
,
&
PtSegm
->
m_TimeStamp
,
&
flags
);
&
PtSegm
->
m_TimeStamp
,
&
flags
);
if
(
type
==
1
)
PtSegm
->
m_StructType
=
TYPEVIA
;
if
(
type
==
1
)
PtSegm
->
m_StructType
=
TYPEVIA
;
PtSegm
->
m_Layer
=
layer
;
PtSegm
->
m_Layer
=
layer
;
PtSegm
->
m_NetCode
=
net_code
;
PtSegm
->
SetState
(
flags
,
ON
);
PtSegm
->
m_NetCode
=
net_code
;
PtSegm
->
SetState
(
flags
,
ON
);
#ifdef PCBNEW
#ifdef PCBNEW
PtSegm
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
PtSegm
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
#endif
#endif
ii
++
;
ii
++
;
if
(
(
Pas
&&
(
ii
%
Pas
)
==
0
)
)
if
(
(
Pas
&&
(
ii
%
Pas
)
==
0
)
)
{
{
PerCent
++
;
PerCent
++
;
#ifdef PCBNEW
#ifdef PCBNEW
switch
(
StructType
)
switch
(
StructType
)
{
{
case
TYPETRACK
:
case
TYPETRACK
:
case
TYPEVIA
:
case
TYPEVIA
:
DisplayActivity
(
PerCent
,
wxT
(
"Tracks:"
)
);
DisplayActivity
(
PerCent
,
wxT
(
"Tracks:"
)
);
break
;
break
;
case
TYPEZONE
:
case
TYPEZONE
:
DisplayActivity
(
PerCent
,
wxT
(
"Zones:"
)
);
DisplayActivity
(
PerCent
,
wxT
(
"Zones:"
)
);
break
;
break
;
}
}
#endif
#endif
}
}
}
}
DisplayError
(
this
,
_
(
"Error: Unexpected end of file !"
)
);
return
(
-
ii
);
}
DisplayError
(
this
,
_
(
"Error: Unexpected end of file !"
)
);
return
-
ii
;
}
/**********************************************************************************/
/**********************************************************************************/
int
WinEDA_BasePcbFrame
::
ReadGeneralDescrPcb
(
wxDC
*
DC
,
FILE
*
File
,
int
*
LineNum
)
int
WinEDA_BasePcbFrame
::
ReadGeneralDescrPcb
(
wxDC
*
DC
,
FILE
*
File
,
int
*
LineNum
)
/**********************************************************************************/
/**********************************************************************************/
{
{
char
Line
[
1024
],
*
data
;
char
Line
[
1024
],
*
data
;
BASE_SCREEN
*
screen
=
m_CurrentScreen
;
BASE_SCREEN
*
screen
=
m_CurrentScreen
;
while
(
GetLine
(
File
,
Line
,
LineNum
)
!=
NULL
)
while
(
GetLine
(
File
,
Line
,
LineNum
)
!=
NULL
)
{
{
data
=
strtok
(
Line
,
" =
\n\r
"
);
data
=
strtok
(
Line
,
" =
\n\r
"
);
if
(
strnicmp
(
data
,
"$EndGENERAL"
,
10
)
==
0
)
break
;
if
(
strnicmp
(
data
,
"$EndGENERAL"
,
10
)
==
0
)
break
;
if
(
strncmp
(
data
,
"Ly"
,
2
)
==
0
)
// Old format for Layer count
if
(
strncmp
(
data
,
"Ly"
,
2
)
==
0
)
// Old format for Layer count
{
{
int
Masque_Layer
=
1
,
ii
;
int
Masque_Layer
=
1
,
ii
;
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
sscanf
(
data
,
"%X"
,
&
Masque_Layer
);
sscanf
(
data
,
"%X"
,
&
Masque_Layer
);
// Setup layer count
// Setup layer count
m_Pcb
->
m_BoardSettings
->
m_CopperLayerCount
=
0
;
m_Pcb
->
m_BoardSettings
->
m_CopperLayerCount
=
0
;
for
(
ii
=
0
;
ii
<
NB_COPPER_LAYERS
;
ii
++
)
for
(
ii
=
0
;
ii
<
NB_COPPER_LAYERS
;
ii
++
)
{
{
if
(
Masque_Layer
&
1
)
m_Pcb
->
m_BoardSettings
->
m_CopperLayerCount
++
;
if
(
Masque_Layer
&
1
)
m_Pcb
->
m_BoardSettings
->
m_CopperLayerCount
++
;
Masque_Layer
>>=
1
;
Masque_Layer
>>=
1
;
}
}
continue
;
continue
;
}
}
if
(
strnicmp
(
data
,
"Links"
,
5
)
==
0
)
if
(
strnicmp
(
data
,
"Links"
,
5
)
==
0
)
{
{
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
m_Pcb
->
m_NbLinks
=
atoi
(
data
);
m_Pcb
->
m_NbLinks
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
strnicmp
(
data
,
"NoConn"
,
6
)
==
0
)
if
(
strnicmp
(
data
,
"NoConn"
,
6
)
==
0
)
{
{
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
m_Pcb
->
m_NbNoconnect
=
atoi
(
data
);
m_Pcb
->
m_NbNoconnect
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
strnicmp
(
data
,
"Di"
,
2
)
==
0
)
if
(
strnicmp
(
data
,
"Di"
,
2
)
==
0
)
{
{
int
ii
,
jj
,
bestzoom
;
int
ii
,
jj
,
bestzoom
;
wxSize
pcbsize
,
screensize
;
wxSize
pcbsize
,
screensize
;
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
m_Pcb
->
m_BoundaryBox
.
SetX
(
atoi
(
data
)
);
m_Pcb
->
m_BoundaryBox
.
SetX
(
atoi
(
data
)
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
m_Pcb
->
m_BoundaryBox
.
SetY
(
atoi
(
data
)
);
m_Pcb
->
m_BoundaryBox
.
SetY
(
atoi
(
data
)
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
m_Pcb
->
m_BoundaryBox
.
SetWidth
(
atoi
(
data
)
-
m_Pcb
->
m_BoundaryBox
.
GetX
()
);
m_Pcb
->
m_BoundaryBox
.
SetWidth
(
atoi
(
data
)
-
m_Pcb
->
m_BoundaryBox
.
GetX
()
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
m_Pcb
->
m_BoundaryBox
.
SetHeight
(
atoi
(
data
)
-
m_Pcb
->
m_BoundaryBox
.
GetY
()
);
m_Pcb
->
m_BoundaryBox
.
SetHeight
(
atoi
(
data
)
-
m_Pcb
->
m_BoundaryBox
.
GetY
()
);
/* calcul du zoom optimal */
/* calcul du zoom optimal */
pcbsize
=
m_Pcb
->
m_BoundaryBox
.
GetSize
();
pcbsize
=
m_Pcb
->
m_BoundaryBox
.
GetSize
();
screensize
=
DrawPanel
->
GetClientSize
();
screensize
=
DrawPanel
->
GetClientSize
();
ii
=
pcbsize
.
x
/
screensize
.
x
;
ii
=
pcbsize
.
x
/
screensize
.
x
;
jj
=
pcbsize
.
y
/
screensize
.
y
;
jj
=
pcbsize
.
y
/
screensize
.
y
;
bestzoom
=
max
(
ii
,
jj
);
bestzoom
=
max
(
ii
,
jj
);
screen
->
m_Curseur
=
m_Pcb
->
m_BoundaryBox
.
Centre
();
screen
->
m_Curseur
=
m_Pcb
->
m_BoundaryBox
.
Centre
();
screen
->
SetZoom
(
bestzoom
);
screen
->
SetZoom
(
bestzoom
);
// la position des tracs a chang: mise a jour dans le DC courant
// la position des trac� a chang� mise a jour dans le DC courant
wxPoint
org
;
wxPoint
org
;
DrawPanel
->
GetViewStart
(
&
org
.
x
,
&
org
.
y
);
DrawPanel
->
GetViewStart
(
&
org
.
x
,
&
org
.
y
);
DrawPanel
->
GetScrollPixelsPerUnit
(
&
ii
,
&
jj
);
DrawPanel
->
GetScrollPixelsPerUnit
(
&
ii
,
&
jj
);
org
.
x
*=
ii
;
org
.
y
*=
jj
;
org
.
x
*=
ii
;
org
.
y
*=
jj
;
#ifdef WX_ZOOM
#ifdef WX_ZOOM
DC
->
SetUserScale
(
1.0
/
(
double
)
screen
->
GetZoom
(),
1.0
/
screen
->
GetZoom
()
);
DC
->
SetUserScale
(
1.0
/
(
double
)
screen
->
GetZoom
(),
1.0
/
screen
->
GetZoom
()
);
org
.
x
*=
screen
->
GetZoom
();
org
.
y
*=
screen
->
GetZoom
();
org
.
x
*=
screen
->
GetZoom
();
org
.
y
*=
screen
->
GetZoom
();
DC
->
SetDeviceOrigin
(
-
org
.
x
,
-
org
.
y
);
DC
->
SetDeviceOrigin
(
-
org
.
x
,
-
org
.
y
);
#endif
#endif
DrawPanel
->
SetBoundaryBox
();
DrawPanel
->
SetBoundaryBox
();
Recadre_Trace
(
TRUE
);
Recadre_Trace
(
TRUE
);
continue
;
continue
;
}
}
/* Lecture du nombre de segments type DRAW , TRACT, ZONE */
/* Lecture du nombre de segments type DRAW , TRACT, ZONE */
if
(
stricmp
(
data
,
"Ndraw"
)
==
0
)
if
(
stricmp
(
data
,
"Ndraw"
)
==
0
)
{
{
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
NbDraw
=
atoi
(
data
);;
NbDraw
=
atoi
(
data
);;
continue
;
continue
;
}
}
if
(
stricmp
(
data
,
"Ntrack"
)
==
0
)
if
(
stricmp
(
data
,
"Ntrack"
)
==
0
)
{
{
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
NbTrack
=
atoi
(
data
);
NbTrack
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
stricmp
(
data
,
"Nzone"
)
==
0
)
if
(
stricmp
(
data
,
"Nzone"
)
==
0
)
{
{
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
NbZone
=
atoi
(
data
);
NbZone
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
stricmp
(
data
,
"Nmodule"
)
==
0
)
if
(
stricmp
(
data
,
"Nmodule"
)
==
0
)
{
{
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
NbMod
=
atoi
(
data
);
NbMod
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
stricmp
(
data
,
"Nnets"
)
==
0
)
if
(
stricmp
(
data
,
"Nnets"
)
==
0
)
{
{
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
NbNets
=
atoi
(
data
);
NbNets
=
atoi
(
data
);
continue
;
continue
;
}
}
}
}
return
(
1
);
return
1
;
}
}
/*************************************************************/
/*************************************************************/
int
WinEDA_BasePcbFrame
::
ReadSetup
(
FILE
*
File
,
int
*
LineNum
)
int
WinEDA_BasePcbFrame
::
ReadSetup
(
FILE
*
File
,
int
*
LineNum
)
/*************************************************************/
/*************************************************************/
{
{
char
Line
[
1024
],
*
data
;
char
Line
[
1024
],
*
data
;
while
(
GetLine
(
File
,
Line
,
LineNum
)
!=
NULL
)
while
(
GetLine
(
File
,
Line
,
LineNum
)
!=
NULL
)
{
{
strtok
(
Line
,
" =
\n\r
"
);
strtok
(
Line
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
if
(
stricmp
(
Line
,
"$EndSETUP"
)
==
0
)
if
(
stricmp
(
Line
,
"$EndSETUP"
)
==
0
)
{
{
return
0
;
return
0
;
}
}
if
(
stricmp
(
Line
,
"AuxiliaryAxisOrg"
)
==
0
)
if
(
stricmp
(
Line
,
"AuxiliaryAxisOrg"
)
==
0
)
{
{
int
gx
=
0
,
gy
=
0
;
int
gx
=
0
,
gy
=
0
;
gx
=
atoi
(
data
);
gx
=
atoi
(
data
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
if
(
data
)
gy
=
atoi
(
data
);
if
(
data
)
gy
=
atoi
(
data
);
m_Auxiliary_Axis_Position
.
x
=
gx
;
m_Auxiliary_Axis_Position
.
y
=
gy
;
m_Auxiliary_Axis_Position
.
x
=
gx
;
m_Auxiliary_Axis_Position
.
y
=
gy
;
continue
;
continue
;
}
}
#ifdef PCBNEW
#ifdef PCBNEW
if
(
stricmp
(
Line
,
"Layers"
)
==
0
)
if
(
stricmp
(
Line
,
"Layers"
)
==
0
)
{
{
int
tmp
;
int
tmp
;
sscanf
(
data
,
"%d"
,
&
tmp
);
sscanf
(
data
,
"%d"
,
&
tmp
);
m_Pcb
->
m_BoardSettings
->
m_CopperLayerCount
=
tmp
;
m_Pcb
->
m_BoardSettings
->
m_CopperLayerCount
=
tmp
;
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"TrackWidth"
)
==
0
)
if
(
stricmp
(
Line
,
"TrackWidth"
)
==
0
)
{
{
g_DesignSettings
.
m_CurrentTrackWidth
=
atoi
(
data
);
g_DesignSettings
.
m_CurrentTrackWidth
=
atoi
(
data
);
AddHistory
(
g_DesignSettings
.
m_CurrentTrackWidth
,
TYPETRACK
);
AddHistory
(
g_DesignSettings
.
m_CurrentTrackWidth
,
TYPETRACK
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"TrackWidthHistory"
)
==
0
)
if
(
stricmp
(
Line
,
"TrackWidthHistory"
)
==
0
)
{
{
int
tmp
=
atoi
(
data
);
int
tmp
=
atoi
(
data
);
AddHistory
(
tmp
,
TYPETRACK
);
AddHistory
(
tmp
,
TYPETRACK
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"TrackClearence"
)
==
0
)
if
(
stricmp
(
Line
,
"TrackClearence"
)
==
0
)
{
{
g_DesignSettings
.
m_TrackClearence
=
atoi
(
data
);
g_DesignSettings
.
m_TrackClearence
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"ZoneClearence"
)
==
0
)
if
(
stricmp
(
Line
,
"ZoneClearence"
)
==
0
)
{
{
g_DesignSettings
.
m_ZoneClearence
=
atoi
(
data
);
g_DesignSettings
.
m_ZoneClearence
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"GridSize"
)
==
0
)
if
(
stricmp
(
Line
,
"GridSize"
)
==
0
)
{
{
wxSize
Grid
;
wxSize
Grid
;
Grid
.
x
=
atoi
(
data
);
Grid
.
x
=
atoi
(
data
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
if
(
data
)
Grid
.
y
=
atoi
(
data
);
if
(
data
)
else
Grid
.
y
=
Grid
.
x
;
Grid
.
y
=
atoi
(
data
);
GetScreen
()
->
SetGrid
(
Grid
);
else
Grid
.
y
=
Grid
.
x
;
GetScreen
()
->
SetGrid
(
Grid
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"ZoneGridSize"
)
==
0
)
if
(
stricmp
(
Line
,
"ZoneGridSize"
)
==
0
)
{
{
g_GridRoutingSize
=
atoi
(
data
);
g_GridRoutingSize
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"UserGridSize"
)
==
0
)
if
(
stricmp
(
Line
,
"UserGridSize"
)
==
0
)
{
{
wxString
msg
;
wxString
msg
;
if
(
data
)
if
(
data
)
{
{
msg
=
CONV_FROM_UTF8
(
data
);
msg
=
CONV_FROM_UTF8
(
data
);
msg
.
ToDouble
(
&
g_UserGrid
.
x
);
msg
.
ToDouble
(
&
g_UserGrid
.
x
);
}
}
else
continue
;
else
data
=
strtok
(
NULL
,
" =
\n\r
"
);
continue
;
if
(
data
)
data
=
strtok
(
NULL
,
" =
\n\r
"
);
if
(
data
)
{
{
msg
=
CONV_FROM_UTF8
(
data
);
msg
=
CONV_FROM_UTF8
(
data
);
msg
.
ToDouble
(
&
g_UserGrid
.
y
);
msg
.
ToDouble
(
&
g_UserGrid
.
y
);
}
}
else
g_UserGrid
.
y
=
g_UserGrid
.
x
;
else
g_UserGrid
.
y
=
g_UserGrid
.
x
;
GetScreen
()
->
m_UserGrid
=
g_UserGrid
;
GetScreen
()
->
m_UserGrid
=
g_UserGrid
;
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
if
(
data
)
if
(
data
)
{
{
if
(
stricmp
(
data
,
"mm"
)
==
0
)
if
(
stricmp
(
data
,
"mm"
)
==
0
)
g_UserGrid_Unit
=
MILLIMETRE
;
g_UserGrid_Unit
=
MILLIMETRE
;
else
g_UserGrid_Unit
=
INCHES
;
else
g_UserGrid_Unit
=
INCHES
;
GetScreen
()
->
m_UserGridUnit
=
g_UserGrid_Unit
;
GetScreen
()
->
m_UserGridUnit
=
g_UserGrid_Unit
;
}
}
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"DrawSegmWidth"
)
==
0
)
if
(
stricmp
(
Line
,
"DrawSegmWidth"
)
==
0
)
{
{
g_DesignSettings
.
m_DrawSegmentWidth
=
atoi
(
data
);
g_DesignSettings
.
m_DrawSegmentWidth
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"EdgeSegmWidth"
)
==
0
)
if
(
stricmp
(
Line
,
"EdgeSegmWidth"
)
==
0
)
{
{
g_DesignSettings
.
m_EdgeSegmentWidth
=
atoi
(
data
);
g_DesignSettings
.
m_EdgeSegmentWidth
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"ViaSize"
)
==
0
)
if
(
stricmp
(
Line
,
"ViaSize"
)
==
0
)
{
{
g_DesignSettings
.
m_CurrentViaSize
=
atoi
(
data
);
g_DesignSettings
.
m_CurrentViaSize
=
atoi
(
data
);
AddHistory
(
g_DesignSettings
.
m_CurrentViaSize
,
TYPEVIA
);
AddHistory
(
g_DesignSettings
.
m_CurrentViaSize
,
TYPEVIA
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"ViaSizeHistory"
)
==
0
)
if
(
stricmp
(
Line
,
"ViaSizeHistory"
)
==
0
)
{
{
int
tmp
=
atoi
(
data
);
int
tmp
=
atoi
(
data
);
AddHistory
(
tmp
,
TYPEVIA
);
AddHistory
(
tmp
,
TYPEVIA
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"ViaDrill"
)
==
0
)
if
(
stricmp
(
Line
,
"ViaDrill"
)
==
0
)
{
{
g_DesignSettings
.
m_ViaDrill
=
atoi
(
data
);
g_DesignSettings
.
m_ViaDrill
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"TextPcbWidth"
)
==
0
)
if
(
stricmp
(
Line
,
"TextPcbWidth"
)
==
0
)
{
{
g_DesignSettings
.
m_PcbTextWidth
=
atoi
(
data
);
g_DesignSettings
.
m_PcbTextWidth
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"TextPcbSize"
)
==
0
)
if
(
stricmp
(
Line
,
"TextPcbSize"
)
==
0
)
{
{
g_DesignSettings
.
m_PcbTextSize
.
x
=
atoi
(
data
);
g_DesignSettings
.
m_PcbTextSize
.
x
=
atoi
(
data
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
g_DesignSettings
.
m_PcbTextSize
.
y
=
atoi
(
data
);
g_DesignSettings
.
m_PcbTextSize
.
y
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"EdgeModWidth"
)
==
0
)
if
(
stricmp
(
Line
,
"EdgeModWidth"
)
==
0
)
{
{
ModuleSegmentWidth
=
atoi
(
data
);
ModuleSegmentWidth
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"TextModWidth"
)
==
0
)
if
(
stricmp
(
Line
,
"TextModWidth"
)
==
0
)
{
{
ModuleTextWidth
=
atoi
(
data
);
ModuleTextWidth
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"TextModSize"
)
==
0
)
if
(
stricmp
(
Line
,
"TextModSize"
)
==
0
)
{
{
ModuleTextSize
.
x
=
atoi
(
data
);
ModuleTextSize
.
x
=
atoi
(
data
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
ModuleTextSize
.
y
=
atoi
(
data
);
ModuleTextSize
.
y
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"PadSize"
)
==
0
)
if
(
stricmp
(
Line
,
"PadSize"
)
==
0
)
{
{
g_Pad_Master
.
m_Size
.
x
=
atoi
(
data
);
g_Pad_Master
.
m_Size
.
x
=
atoi
(
data
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
g_Pad_Master
.
m_Size
.
y
=
atoi
(
data
);
g_Pad_Master
.
m_Size
.
y
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"PadDrill"
)
==
0
)
if
(
stricmp
(
Line
,
"PadDrill"
)
==
0
)
{
{
g_Pad_Master
.
m_Drill
.
x
=
atoi
(
data
);
g_Pad_Master
.
m_Drill
.
x
=
atoi
(
data
);
g_Pad_Master
.
m_Drill
.
y
=
g_Pad_Master
.
m_Drill
.
x
;
g_Pad_Master
.
m_Drill
.
y
=
g_Pad_Master
.
m_Drill
.
x
;
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"PadDeltaSize"
)
==
0
)
if
(
stricmp
(
Line
,
"PadDeltaSize"
)
==
0
)
{
{
g_Pad_Master
.
m_DeltaSize
.
x
=
atoi
(
data
);
g_Pad_Master
.
m_DeltaSize
.
x
=
atoi
(
data
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
g_Pad_Master
.
m_DeltaSize
.
y
=
atoi
(
data
);
g_Pad_Master
.
m_DeltaSize
.
y
=
atoi
(
data
);
continue
;
continue
;
}
}
if
(
stricmp
(
Line
,
"PadShapeOffset"
)
==
0
)
if
(
stricmp
(
Line
,
"PadShapeOffset"
)
==
0
)
{
{
g_Pad_Master
.
m_Offset
.
x
=
atoi
(
data
);
g_Pad_Master
.
m_Offset
.
x
=
atoi
(
data
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
data
=
strtok
(
NULL
,
" =
\n\r
"
);
g_Pad_Master
.
m_Offset
.
y
=
atoi
(
data
);
g_Pad_Master
.
m_Offset
.
y
=
atoi
(
data
);
continue
;
continue
;
}
}
#endif
#endif
}
}
return
(
1
);
return
1
;
}
}
#ifdef PCBNEW
#ifdef PCBNEW
/***************************************************************/
/***************************************************************/
static
int
WriteSetup
(
FILE
*
File
,
WinEDA_BasePcbFrame
*
frame
)
static
int
WriteSetup
(
FILE
*
File
,
WinEDA_BasePcbFrame
*
frame
)
/***************************************************************/
/***************************************************************/
{
{
char
text
[
1024
];
char
text
[
1024
];
int
ii
,
jj
;
int
ii
,
jj
;
fprintf
(
File
,
"$SETUP
\n
"
);
fprintf
(
File
,
"$SETUP
\n
"
);
sprintf
(
text
,
"InternalUnit %f INCH
\n
"
,
1.0
/
PCB_INTERNAL_UNIT
);
sprintf
(
text
,
"InternalUnit %f INCH
\n
"
,
1.0
/
PCB_INTERNAL_UNIT
);
fprintf
(
File
,
text
);
fprintf
(
File
,
text
);
if
(
frame
->
GetScreen
()
->
m_UserGridIsON
)
ii
=
jj
=
-
1
;
if
(
frame
->
GetScreen
()
->
m_UserGridIsON
)
ii
=
jj
=
-
1
;
else
else
{
{
ii
=
frame
->
GetScreen
()
->
GetGrid
().
x
;
ii
=
frame
->
GetScreen
()
->
GetGrid
().
x
;
jj
=
frame
->
GetScreen
()
->
GetGrid
().
y
;
jj
=
frame
->
GetScreen
()
->
GetGrid
().
y
;
}
}
sprintf
(
text
,
"GridSize %d %d
\n
"
,
ii
,
jj
);
sprintf
(
text
,
"GridSize %d %d
\n
"
,
ii
,
jj
);
fprintf
(
File
,
text
);
fprintf
(
File
,
text
);
sprintf
(
text
,
"UserGridSize %lf %lf %s
\n
"
,
sprintf
(
text
,
"UserGridSize %lf %lf %s
\n
"
,
frame
->
GetScreen
()
->
m_UserGrid
.
x
,
frame
->
GetScreen
()
->
m_UserGrid
.
y
,
frame
->
GetScreen
()
->
m_UserGrid
.
x
,
frame
->
GetScreen
()
->
m_UserGrid
.
y
,
(
g_UserGrid_Unit
==
0
)
?
"INCH"
:
"mm"
);
(
g_UserGrid_Unit
==
0
)
?
"INCH"
:
"mm"
);
fprintf
(
File
,
text
);
fprintf
(
File
,
text
);
fprintf
(
File
,
"ZoneGridSize %d
\n
"
,
g_GridRoutingSize
);
fprintf
(
File
,
"ZoneGridSize %d
\n
"
,
g_GridRoutingSize
);
fprintf
(
File
,
"Layers %d
\n
"
,
g_DesignSettings
.
m_CopperLayerCount
);
fprintf
(
File
,
"Layers %d
\n
"
,
g_DesignSettings
.
m_CopperLayerCount
);
fprintf
(
File
,
"TrackWidth %d
\n
"
,
g_DesignSettings
.
m_CurrentTrackWidth
);
fprintf
(
File
,
"TrackWidth %d
\n
"
,
g_DesignSettings
.
m_CurrentTrackWidth
);
for
(
ii
=
0
;
ii
<
HIST0RY_NUMBER
;
ii
++
)
for
(
ii
=
0
;
ii
<
HIST0RY_NUMBER
;
ii
++
)
{
{
if
(
g_DesignSettings
.
m_TrackWidhtHistory
[
ii
]
==
0
)
break
;
if
(
g_DesignSettings
.
m_TrackWidhtHistory
[
ii
]
==
0
)
fprintf
(
File
,
"TrackWidthHistory %d
\n
"
,
break
;
g_DesignSettings
.
m_TrackWidhtHistory
[
ii
]);
fprintf
(
File
,
"TrackWidthHistory %d
\n
"
,
}
g_DesignSettings
.
m_TrackWidhtHistory
[
ii
]
);
fprintf
(
File
,
"TrackClearence %d
\n
"
,
g_DesignSettings
.
m_TrackClearence
);
}
fprintf
(
File
,
"ZoneClearence %d
\n
"
,
g_DesignSettings
.
m_ZoneClearence
);
fprintf
(
File
,
"TrackClearence %d
\n
"
,
g_DesignSettings
.
m_TrackClearence
);
fprintf
(
File
,
"DrawSegmWidth %d
\n
"
,
g_DesignSettings
.
m_DrawSegmentWidth
);
fprintf
(
File
,
"ZoneClearence %d
\n
"
,
g_DesignSettings
.
m_ZoneClearence
);
fprintf
(
File
,
"EdgeSegmWidth %d
\n
"
,
g_DesignSettings
.
m_EdgeSegmentWidth
);
fprintf
(
File
,
"ViaSize %d
\n
"
,
g_DesignSettings
.
m_CurrentViaSize
);
fprintf
(
File
,
"DrawSegmWidth %d
\n
"
,
g_DesignSettings
.
m_DrawSegmentWidth
);
fprintf
(
File
,
"ViaDrill %d
\n
"
,
g_DesignSettings
.
m_ViaDrill
);
fprintf
(
File
,
"EdgeSegmWidth %d
\n
"
,
g_DesignSettings
.
m_EdgeSegmentWidth
);
for
(
ii
=
0
;
ii
<
HIST0RY_NUMBER
;
ii
++
)
fprintf
(
File
,
"ViaSize %d
\n
"
,
g_DesignSettings
.
m_CurrentViaSize
);
{
fprintf
(
File
,
"ViaDrill %d
\n
"
,
g_DesignSettings
.
m_ViaDrill
);
if
(
g_DesignSettings
.
m_ViaSizeHistory
[
ii
]
==
0
)
break
;
for
(
ii
=
0
;
ii
<
HIST0RY_NUMBER
;
ii
++
)
fprintf
(
File
,
"ViaSizeHistory %d
\n
"
,
g_DesignSettings
.
m_ViaSizeHistory
[
ii
]);
{
}
if
(
g_DesignSettings
.
m_ViaSizeHistory
[
ii
]
==
0
)
fprintf
(
File
,
"TextPcbWidth %d
\n
"
,
g_DesignSettings
.
m_PcbTextWidth
);
break
;
fprintf
(
File
,
"TextPcbSize %d %d
\n
"
,
fprintf
(
File
,
"ViaSizeHistory %d
\n
"
,
g_DesignSettings
.
m_ViaSizeHistory
[
ii
]
);
g_DesignSettings
.
m_PcbTextSize
.
x
,
g_DesignSettings
.
m_PcbTextSize
.
y
);
}
fprintf
(
File
,
"EdgeModWidth %d
\n
"
,
ModuleSegmentWidth
);
fprintf
(
File
,
"TextModSize %d %d
\n
"
,
ModuleTextSize
.
x
,
ModuleTextSize
.
y
);
fprintf
(
File
,
"TextPcbWidth %d
\n
"
,
g_DesignSettings
.
m_PcbTextWidth
);
fprintf
(
File
,
"TextModWidth %d
\n
"
,
ModuleTextWidth
);
fprintf
(
File
,
"TextPcbSize %d %d
\n
"
,
fprintf
(
File
,
"PadSize %d %d
\n
"
,
g_Pad_Master
.
m_Size
.
x
,
g_Pad_Master
.
m_Size
.
y
);
g_DesignSettings
.
m_PcbTextSize
.
x
,
g_DesignSettings
.
m_PcbTextSize
.
y
);
fprintf
(
File
,
"PadDrill %d
\n
"
,
g_Pad_Master
.
m_Drill
.
x
);
fprintf
(
File
,
"EdgeModWidth %d
\n
"
,
ModuleSegmentWidth
);
fprintf
(
File
,
"TextModSize %d %d
\n
"
,
ModuleTextSize
.
x
,
ModuleTextSize
.
y
);
fprintf
(
File
,
"TextModWidth %d
\n
"
,
ModuleTextWidth
);
fprintf
(
File
,
"PadSize %d %d
\n
"
,
g_Pad_Master
.
m_Size
.
x
,
g_Pad_Master
.
m_Size
.
y
);
fprintf
(
File
,
"PadDrill %d
\n
"
,
g_Pad_Master
.
m_Drill
.
x
);
// fprintf(File, "PadDeltaSize %d %d\n", Pad_DeltaSize.x, Pad_DeltaSize.y);
// fprintf(File, "PadDeltaSize %d %d\n", Pad_DeltaSize.x, Pad_DeltaSize.y);
// fprintf(File, "PadDrillOffset %d %d\n", Pad_OffsetSize.x, Pad_OffsetSize.y);
// fprintf(File, "PadDrillOffset %d %d\n", Pad_OffsetSize.x, Pad_OffsetSize.y);
fprintf
(
File
,
"AuxiliaryAxisOrg %d %d
\n
"
,
fprintf
(
File
,
"AuxiliaryAxisOrg %d %d
\n
"
,
frame
->
m_Auxiliary_Axis_Position
.
x
,
frame
->
m_Auxiliary_Axis_Position
.
y
);
frame
->
m_Auxiliary_Axis_Position
.
x
,
frame
->
m_Auxiliary_Axis_Position
.
y
);
fprintf
(
File
,
"$EndSETUP
\n\n
"
);
fprintf
(
File
,
"$EndSETUP
\n\n
"
);
return
(
1
)
;
return
1
;
}
}
#endif
#endif
/******************************************************/
/******************************************************/
bool
WinEDA_PcbFrame
::
WriteGeneralDescrPcb
(
FILE
*
File
)
bool
WinEDA_PcbFrame
::
WriteGeneralDescrPcb
(
FILE
*
File
)
/******************************************************/
/******************************************************/
{
{
EDA_BaseStruct
*
PtStruct
=
m_Pcb
->
m_Modules
;
EDA_BaseStruct
*
PtStruct
=
m_Pcb
->
m_Modules
;
int
NbModules
,
NbDrawItem
,
NbLayers
;
int
NbModules
,
NbDrawItem
,
NbLayers
;
/* Calcul du nombre des modules */
/* Calcul du nombre des modules */
for
(
NbModules
=
0
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
NbModules
++
;
for
(
NbModules
=
0
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
NbModules
++
;
/* generation du masque des couches autorisees */
/* generation du masque des couches autorisees */
NbLayers
=
m_Pcb
->
m_BoardSettings
->
m_CopperLayerCount
;
NbLayers
=
m_Pcb
->
m_BoardSettings
->
m_CopperLayerCount
;
fprintf
(
File
,
"$GENERAL
\n
"
);
fprintf
(
File
,
"$GENERAL
\n
"
);
fprintf
(
File
,
"LayerCount %d
\n
"
,
NbLayers
);
fprintf
(
File
,
"LayerCount %d
\n
"
,
NbLayers
);
// Write old format for Layer count (for compatibility with old versions of pcbnew
// Write old format for Layer count (for compatibility with old versions of pcbnew
fprintf
(
File
,
"Ly %8X
\n
"
,
g_TabAllCopperLayerMask
[
NbLayers
-
1
]
|
ALL_NO_CU_LAYERS
);
// For compatibility with old version of pcbnew
fprintf
(
File
,
"Ly %8X
\n
"
,
g_TabAllCopperLayerMask
[
NbLayers
-
1
]
|
ALL_NO_CU_LAYERS
);
// For compatibility with old version of pcbnew
fprintf
(
File
,
"Links %d
\n
"
,
m_Pcb
->
m_NbLinks
);
fprintf
(
File
,
"Links %d
\n
"
,
m_Pcb
->
m_NbLinks
);
fprintf
(
File
,
"NoConn %d
\n
"
,
m_Pcb
->
m_NbNoconnect
);
fprintf
(
File
,
"NoConn %d
\n
"
,
m_Pcb
->
m_NbNoconnect
);
/* Generation des coord du rectangle d'encadrement */
/* Generation des coord du rectangle d'encadrement */
m_Pcb
->
ComputeBoundaryBox
();
m_Pcb
->
ComputeBoundaryBox
();
fprintf
(
File
,
"Di %d %d %d %d
\n
"
,
fprintf
(
File
,
"Di %d %d %d %d
\n
"
,
m_Pcb
->
m_BoundaryBox
.
GetX
(),
m_Pcb
->
m_BoundaryBox
.
GetY
(),
m_Pcb
->
m_BoundaryBox
.
GetX
(),
m_Pcb
->
m_BoundaryBox
.
GetY
(),
m_Pcb
->
m_BoundaryBox
.
GetRight
(),
m_Pcb
->
m_BoundaryBox
.
GetRight
(),
m_Pcb
->
m_BoundaryBox
.
GetBottom
()
);
m_Pcb
->
m_BoundaryBox
.
GetBottom
()
);
/* Generation du nombre de segments type DRAW , TRACT ZONE */
/* Generation du nombre de segments type DRAW , TRACT ZONE */
PtStruct
=
m_Pcb
->
m_Drawings
;
NbDrawItem
=
0
;
PtStruct
=
m_Pcb
->
m_Drawings
;
NbDrawItem
=
0
;
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
NbDrawItem
++
;
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
NbDrawItem
++
;
fprintf
(
File
,
"Ndraw %d
\n
"
,
NbDrawItem
);
fprintf
(
File
,
"Ndraw %d
\n
"
,
NbDrawItem
);
fprintf
(
File
,
"Ntrack %d
\n
"
,
m_Pcb
->
GetNumSegmTrack
()
);
fprintf
(
File
,
"Ntrack %d
\n
"
,
m_Pcb
->
GetNumSegmTrack
()
);
fprintf
(
File
,
"Nzone %d
\n
"
,
m_Pcb
->
GetNumSegmZone
()
);
fprintf
(
File
,
"Nzone %d
\n
"
,
m_Pcb
->
GetNumSegmZone
()
);
fprintf
(
File
,
"Nmodule %d
\n
"
,
NbModules
);
fprintf
(
File
,
"Nmodule %d
\n
"
,
NbModules
);
fprintf
(
File
,
"Nnets %d
\n
"
,
m_Pcb
->
m_NbNets
);
fprintf
(
File
,
"Nnets %d
\n
"
,
m_Pcb
->
m_NbNets
);
fprintf
(
File
,
"$EndGENERAL
\n\n
"
);
fprintf
(
File
,
"$EndGENERAL
\n\n
"
);
return
TRUE
;
return
TRUE
;
}
}
/******************************************************/
/******************************************************/
bool
WriteSheetDescr
(
BASE_SCREEN
*
screen
,
FILE
*
File
)
bool
WriteSheetDescr
(
BASE_SCREEN
*
screen
,
FILE
*
File
)
/******************************************************/
/******************************************************/
{
{
/* Sauvegarde des dimensions de la feuille de dessin, des textes du cartouche.. */
/* Sauvegarde des dimensions de la feuille de dessin, des textes du cartouche.. */
Ki_PageDescr
*
sheet
=
screen
->
m_CurrentSheet
;
Ki_PageDescr
*
sheet
=
screen
->
m_CurrentSheet
;
fprintf
(
File
,
"$SHEETDESCR
\n
"
);
fprintf
(
File
,
"$SHEETDESCR
\n
"
);
fprintf
(
File
,
"Sheet %s %d %d
\n
"
,
fprintf
(
File
,
"Sheet %s %d %d
\n
"
,
CONV_TO_UTF8
(
sheet
->
m_Name
),
sheet
->
m_Size
.
x
,
sheet
->
m_Size
.
y
);
CONV_TO_UTF8
(
sheet
->
m_Name
),
sheet
->
m_Size
.
x
,
sheet
->
m_Size
.
y
);
fprintf
(
File
,
"Title
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Title
)
);
fprintf
(
File
,
"Title
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Title
)
);
fprintf
(
File
,
"Date
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Date
)
);
fprintf
(
File
,
"Date
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Date
)
);
fprintf
(
File
,
"Rev
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Revision
)
);
fprintf
(
File
,
"Rev
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Revision
)
);
fprintf
(
File
,
"Comp
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Company
)
);
fprintf
(
File
,
"Comp
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Company
)
);
fprintf
(
File
,
"Comment1
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Commentaire1
)
);
fprintf
(
File
,
"Comment1
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Commentaire1
)
);
fprintf
(
File
,
"Comment2
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Commentaire2
)
);
fprintf
(
File
,
"Comment2
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Commentaire2
)
);
fprintf
(
File
,
"Comment3
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Commentaire3
)
);
fprintf
(
File
,
"Comment3
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Commentaire3
)
);
fprintf
(
File
,
"Comment4
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Commentaire4
)
);
fprintf
(
File
,
"Comment4
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Commentaire4
)
);
fprintf
(
File
,
"$EndSHEETDESCR
\n\n
"
);
fprintf
(
File
,
"$EndSHEETDESCR
\n\n
"
);
return
TRUE
;
return
TRUE
;
}
}
/***************************************************************************/
/***************************************************************************/
static
bool
ReadSheetDescr
(
BASE_SCREEN
*
screen
,
FILE
*
File
,
int
*
LineNum
)
static
bool
ReadSheetDescr
(
BASE_SCREEN
*
screen
,
FILE
*
File
,
int
*
LineNum
)
/***************************************************************************/
/***************************************************************************/
{
{
char
Line
[
1024
],
buf
[
1024
],
*
text
;
char
Line
[
1024
],
buf
[
1024
],
*
text
;
/* Recheche suite et fin de descr */
/* Recheche suite et fin de descr */
while
(
GetLine
(
File
,
Line
,
LineNum
)
!=
NULL
)
while
(
GetLine
(
File
,
Line
,
LineNum
)
!=
NULL
)
{
{
if
(
strnicmp
(
Line
,
"$End"
,
4
)
==
0
)
return
TRUE
;
if
(
strnicmp
(
Line
,
"$End"
,
4
)
==
0
)
return
TRUE
;
if
(
strnicmp
(
Line
,
"Sheet"
,
4
)
==
0
)
if
(
strnicmp
(
Line
,
"Sheet"
,
4
)
==
0
)
{
{
text
=
strtok
(
Line
,
"
\t\n\r
"
);
text
=
strtok
(
Line
,
"
\t\n\r
"
);
text
=
strtok
(
NULL
,
"
\t\n\r
"
);
text
=
strtok
(
NULL
,
"
\t\n\r
"
);
Ki_PageDescr
*
sheet
=
SheetList
[
0
];
Ki_PageDescr
*
sheet
=
SheetList
[
0
];
int
ii
;
int
ii
;
for
(
ii
=
0
;
sheet
!=
NULL
;
ii
++
,
sheet
=
SheetList
[
ii
]
)
for
(
ii
=
0
;
sheet
!=
NULL
;
ii
++
,
sheet
=
SheetList
[
ii
]
)
{
{
if
(
stricmp
(
CONV_TO_UTF8
(
sheet
->
m_Name
),
text
)
==
0
)
if
(
stricmp
(
CONV_TO_UTF8
(
sheet
->
m_Name
),
text
)
==
0
)
{
{
screen
->
m_CurrentSheet
=
sheet
;
screen
->
m_CurrentSheet
=
sheet
;
if
(
sheet
==
&
g_Sheet_user
)
if
(
sheet
==
&
g_Sheet_user
)
{
{
text
=
strtok
(
NULL
,
"
\t\n\r
"
);
text
=
strtok
(
NULL
,
"
\t\n\r
"
);
if
(
text
)
sheet
->
m_Size
.
x
=
atoi
(
text
);
if
(
text
)
text
=
strtok
(
NULL
,
"
\t\n\r
"
);
sheet
->
m_Size
.
x
=
atoi
(
text
);
if
(
text
)
sheet
->
m_Size
.
y
=
atoi
(
text
);
text
=
strtok
(
NULL
,
"
\t\n\r
"
);
if
(
text
)
sheet
->
m_Size
.
y
=
atoi
(
text
);
}
}
break
;
break
;
}
}
}
}
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"Title"
,
2
)
==
0
)
if
(
strnicmp
(
Line
,
"Title"
,
2
)
==
0
)
{
{
ReadDelimitedText
(
buf
,
Line
,
256
);
ReadDelimitedText
(
buf
,
Line
,
256
);
screen
->
m_Title
=
CONV_FROM_UTF8
(
buf
);
screen
->
m_Title
=
CONV_FROM_UTF8
(
buf
);
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"Date"
,
2
)
==
0
)
if
(
strnicmp
(
Line
,
"Date"
,
2
)
==
0
)
{
{
ReadDelimitedText
(
buf
,
Line
,
256
);
ReadDelimitedText
(
buf
,
Line
,
256
);
screen
->
m_Date
=
CONV_FROM_UTF8
(
buf
);
screen
->
m_Date
=
CONV_FROM_UTF8
(
buf
);
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"Rev"
,
2
)
==
0
)
if
(
strnicmp
(
Line
,
"Rev"
,
2
)
==
0
)
{
{
ReadDelimitedText
(
buf
,
Line
,
256
);
ReadDelimitedText
(
buf
,
Line
,
256
);
screen
->
m_Revision
=
CONV_FROM_UTF8
(
buf
);
screen
->
m_Revision
=
CONV_FROM_UTF8
(
buf
);
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"Comp"
,
4
)
==
0
)
if
(
strnicmp
(
Line
,
"Comp"
,
4
)
==
0
)
{
{
ReadDelimitedText
(
buf
,
Line
,
256
);
ReadDelimitedText
(
buf
,
Line
,
256
);
screen
->
m_Company
=
CONV_FROM_UTF8
(
buf
);
screen
->
m_Company
=
CONV_FROM_UTF8
(
buf
);
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"Comment1"
,
8
)
==
0
)
if
(
strnicmp
(
Line
,
"Comment1"
,
8
)
==
0
)
{
{
ReadDelimitedText
(
buf
,
Line
,
256
);
ReadDelimitedText
(
buf
,
Line
,
256
);
screen
->
m_Commentaire1
=
CONV_FROM_UTF8
(
buf
);
screen
->
m_Commentaire1
=
CONV_FROM_UTF8
(
buf
);
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"Comment2"
,
8
)
==
0
)
if
(
strnicmp
(
Line
,
"Comment2"
,
8
)
==
0
)
{
{
ReadDelimitedText
(
buf
,
Line
,
256
);
ReadDelimitedText
(
buf
,
Line
,
256
);
screen
->
m_Commentaire2
=
CONV_FROM_UTF8
(
buf
);
screen
->
m_Commentaire2
=
CONV_FROM_UTF8
(
buf
);
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"Comment3"
,
8
)
==
0
)
if
(
strnicmp
(
Line
,
"Comment3"
,
8
)
==
0
)
{
{
ReadDelimitedText
(
buf
,
Line
,
256
);
ReadDelimitedText
(
buf
,
Line
,
256
);
screen
->
m_Commentaire3
=
CONV_FROM_UTF8
(
buf
);
screen
->
m_Commentaire3
=
CONV_FROM_UTF8
(
buf
);
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"Comment4"
,
8
)
==
0
)
if
(
strnicmp
(
Line
,
"Comment4"
,
8
)
==
0
)
{
{
ReadDelimitedText
(
buf
,
Line
,
256
);
ReadDelimitedText
(
buf
,
Line
,
256
);
screen
->
m_Commentaire4
=
CONV_FROM_UTF8
(
buf
);
screen
->
m_Commentaire4
=
CONV_FROM_UTF8
(
buf
);
continue
;
continue
;
}
}
}
}
return
(
FALSE
);
return
FALSE
;
}
}
/********************************************************************/
/********************************************************************/
int
WinEDA_PcbFrame
::
ReadPcbFile
(
wxDC
*
DC
,
FILE
*
File
,
bool
Append
)
int
WinEDA_PcbFrame
::
ReadPcbFile
(
wxDC
*
DC
,
FILE
*
File
,
bool
Append
)
/********************************************************************/
/********************************************************************/
/* Lit un fichier PCB .brd
/* Lit un fichier PCB .brd
Si Append == 0: l'ancien pcb en memoire est supprime
*
Si Append == 0: l'ancien pcb en memoire est supprime
Sinon il y a ajout des elements
*
Sinon il y a ajout des elements
*/
*/
{
{
char
Line
[
1024
];
char
Line
[
1024
];
int
LineNum
=
0
;
int
LineNum
=
0
;
int
nbsegm
,
nbmod
;
int
nbsegm
,
nbmod
;
EDA_BaseStruct
*
LastStructPcb
=
NULL
,
*
StructPcb
;
EDA_BaseStruct
*
LastStructPcb
=
NULL
,
*
StructPcb
;
MODULE
*
LastModule
=
NULL
,
*
Module
;
MODULE
*
LastModule
=
NULL
,
*
Module
;
EQUIPOT
*
LastEquipot
=
NULL
,
*
Equipot
;
EQUIPOT
*
LastEquipot
=
NULL
,
*
Equipot
;
wxBusyCursor
dummy
;
wxBusyCursor
dummy
;
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
setlocale
(
LC_NUMERIC
,
"C"
);
setlocale
(
LC_NUMERIC
,
"C"
);
NbDraw
=
NbTrack
=
NbZone
=
NbMod
=
NbNets
=
-
1
;
NbDraw
=
NbTrack
=
NbZone
=
NbMod
=
NbNets
=
-
1
;
m_Pcb
->
m_NbNets
=
0
;
m_Pcb
->
m_NbNets
=
0
;
m_Pcb
->
m_Status_Pcb
=
0
;
m_Pcb
->
m_Status_Pcb
=
0
;
nbmod
=
0
;
nbmod
=
0
;
if
(
Append
)
if
(
Append
)
{
{
LastModule
=
m_Pcb
->
m_Modules
;
LastModule
=
m_Pcb
->
m_Modules
;
for
(
;
LastModule
!=
NULL
;
LastModule
=
(
MODULE
*
)
LastModule
->
Pnext
)
for
(
;
LastModule
!=
NULL
;
LastModule
=
(
MODULE
*
)
LastModule
->
Pnext
)
{
{
if
(
LastModule
->
Pnext
==
NULL
)
break
;
if
(
LastModule
->
Pnext
==
NULL
)
break
;
}
}
LastStructPcb
=
m_Pcb
->
m_Drawings
;
LastStructPcb
=
m_Pcb
->
m_Drawings
;
for
(
;
LastStructPcb
!=
NULL
;
LastStructPcb
=
LastStructPcb
->
Pnext
)
for
(
;
LastStructPcb
!=
NULL
;
LastStructPcb
=
LastStructPcb
->
Pnext
)
{
{
if
(
LastStructPcb
->
Pnext
==
NULL
)
break
;
if
(
LastStructPcb
->
Pnext
==
NULL
)
break
;
}
}
LastEquipot
=
m_Pcb
->
m_Equipots
;
LastEquipot
=
m_Pcb
->
m_Equipots
;
for
(
;
LastEquipot
!=
NULL
;
LastEquipot
=
(
EQUIPOT
*
)
LastEquipot
->
Pnext
)
for
(
;
LastEquipot
!=
NULL
;
LastEquipot
=
(
EQUIPOT
*
)
LastEquipot
->
Pnext
)
{
{
if
(
LastEquipot
->
Pnext
==
NULL
)
break
;
if
(
LastEquipot
->
Pnext
==
NULL
)
break
;
}
}
}
}
while
(
GetLine
(
File
,
Line
,
&
LineNum
)
!=
NULL
)
while
(
GetLine
(
File
,
Line
,
&
LineNum
)
!=
NULL
)
{
{
if
(
strnicmp
(
Line
,
"$EndPCB"
,
6
)
==
0
)
break
;
if
(
strnicmp
(
Line
,
"$EndPCB"
,
6
)
==
0
)
break
;
if
(
strnicmp
(
Line
,
"$GENERAL"
,
8
)
==
0
)
if
(
strnicmp
(
Line
,
"$GENERAL"
,
8
)
==
0
)
{
{
ReadGeneralDescrPcb
(
DC
,
File
,
&
LineNum
);
ReadGeneralDescrPcb
(
DC
,
File
,
&
LineNum
);
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"$SHEETDESCR"
,
11
)
==
0
)
if
(
strnicmp
(
Line
,
"$SHEETDESCR"
,
11
)
==
0
)
{
{
ReadSheetDescr
(
m_CurrentScreen
,
File
,
&
LineNum
);
ReadSheetDescr
(
m_CurrentScreen
,
File
,
&
LineNum
);
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"$SETUP"
,
6
)
==
0
)
if
(
strnicmp
(
Line
,
"$SETUP"
,
6
)
==
0
)
{
{
if
(
!
Append
)
if
(
!
Append
)
{
{
ReadSetup
(
File
,
&
LineNum
);
ReadSetup
(
File
,
&
LineNum
);
}
}
else
else
{
{
while
(
GetLine
(
File
,
Line
,
&
LineNum
)
!=
NULL
)
while
(
GetLine
(
File
,
Line
,
&
LineNum
)
!=
NULL
)
if
(
strnicmp
(
Line
,
"$EndSETUP"
,
6
)
==
0
)
break
;
if
(
strnicmp
(
Line
,
"$EndSETUP"
,
6
)
==
0
)
break
;
}
}
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"$EQUIPOT"
,
7
)
==
0
)
if
(
strnicmp
(
Line
,
"$EQUIPOT"
,
7
)
==
0
)
{
{
Equipot
=
new
EQUIPOT
(
m_Pcb
);
Equipot
=
new
EQUIPOT
(
m_Pcb
);
Equipot
->
ReadEquipotDescr
(
File
,
&
LineNum
);
Equipot
->
ReadEquipotDescr
(
File
,
&
LineNum
);
if
(
LastEquipot
==
NULL
)
if
(
LastEquipot
==
NULL
)
{
{
m_Pcb
->
m_Equipots
=
Equipot
;
m_Pcb
->
m_Equipots
=
Equipot
;
...
@@ -815,14 +867,17 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
...
@@ -815,14 +867,17 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
m_Pcb
->
m_NbNets
++
;
m_Pcb
->
m_NbNets
++
;
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"$MODULE"
,
7
)
==
0
)
if
(
strnicmp
(
Line
,
"$MODULE"
,
7
)
==
0
)
{
{
float
Pas
;
float
Pas
;
Pas
=
100.0
;
if
(
NbMod
>
1
)
Pas
/=
NbMod
;
Pas
=
100.0
;
if
(
NbMod
>
1
)
Pas
/=
NbMod
;
Module
=
new
MODULE
(
m_Pcb
);
Module
=
new
MODULE
(
m_Pcb
);
if
(
Module
==
NULL
)
continue
;
if
(
Module
==
NULL
)
Module
->
ReadDescr
(
File
,
&
LineNum
);
continue
;
Module
->
ReadDescr
(
File
,
&
LineNum
);
if
(
LastModule
==
NULL
)
if
(
LastModule
==
NULL
)
{
{
...
@@ -837,17 +892,17 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
...
@@ -837,17 +892,17 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
LastModule
=
Module
;
LastModule
=
Module
;
nbmod
++
;
nbmod
++
;
#ifdef PCBNEW
#ifdef PCBNEW
DisplayActivity
((
int
)(
Pas
*
nbmod
),
wxT
(
"Modules:"
)
);
DisplayActivity
(
(
int
)
(
Pas
*
nbmod
),
wxT
(
"Modules:"
)
);
#endif
#endif
Module
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
Module
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"$TEXTPCB"
,
8
)
==
0
)
if
(
strnicmp
(
Line
,
"$TEXTPCB"
,
8
)
==
0
)
{
{
TEXTE_PCB
*
pcbtxt
=
new
TEXTE_PCB
(
m_Pcb
);
TEXTE_PCB
*
pcbtxt
=
new
TEXTE_PCB
(
m_Pcb
);
StructPcb
=
(
EDA_BaseStruct
*
)
pcbtxt
;
StructPcb
=
(
EDA_BaseStruct
*
)
pcbtxt
;
pcbtxt
->
ReadTextePcbDescr
(
File
,
&
LineNum
);
pcbtxt
->
ReadTextePcbDescr
(
File
,
&
LineNum
);
if
(
LastStructPcb
==
NULL
)
if
(
LastStructPcb
==
NULL
)
{
{
m_Pcb
->
m_Drawings
=
StructPcb
;
m_Pcb
->
m_Drawings
=
StructPcb
;
...
@@ -860,15 +915,15 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
...
@@ -860,15 +915,15 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
}
}
LastStructPcb
=
StructPcb
;
LastStructPcb
=
StructPcb
;
#ifdef PCBNEW
#ifdef PCBNEW
((
TEXTE_PCB
*
)
StructPcb
)
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
(
(
TEXTE_PCB
*
)
StructPcb
)
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
#endif
#endif
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"$DRAWSEGMENT"
,
10
)
==
0
)
if
(
strnicmp
(
Line
,
"$DRAWSEGMENT"
,
10
)
==
0
)
{
{
DRAWSEGMENT
*
DrawSegm
=
new
DRAWSEGMENT
(
m_Pcb
);
DRAWSEGMENT
*
DrawSegm
=
new
DRAWSEGMENT
(
m_Pcb
);
DrawSegm
->
ReadDrawSegmentDescr
(
File
,
&
LineNum
);
DrawSegm
->
ReadDrawSegmentDescr
(
File
,
&
LineNum
);
if
(
LastStructPcb
==
NULL
)
if
(
LastStructPcb
==
NULL
)
{
{
m_Pcb
->
m_Drawings
=
DrawSegm
;
m_Pcb
->
m_Drawings
=
DrawSegm
;
...
@@ -881,16 +936,16 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
...
@@ -881,16 +936,16 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
}
}
LastStructPcb
=
DrawSegm
;
LastStructPcb
=
DrawSegm
;
#ifdef PCBNEW
#ifdef PCBNEW
Trace_DrawSegmentPcb
(
DrawPanel
,
DC
,
DrawSegm
,
GR_OR
);
Trace_DrawSegmentPcb
(
DrawPanel
,
DC
,
DrawSegm
,
GR_OR
);
#endif
#endif
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"$COTATION"
,
9
)
==
0
)
if
(
strnicmp
(
Line
,
"$COTATION"
,
9
)
==
0
)
{
{
COTATION
*
Cotation
=
new
COTATION
(
m_Pcb
);
COTATION
*
Cotation
=
new
COTATION
(
m_Pcb
);
Cotation
->
ReadCotationDescr
(
File
,
&
LineNum
);
Cotation
->
ReadCotationDescr
(
File
,
&
LineNum
);
if
(
LastStructPcb
==
NULL
)
if
(
LastStructPcb
==
NULL
)
{
{
m_Pcb
->
m_Drawings
=
Cotation
;
m_Pcb
->
m_Drawings
=
Cotation
;
...
@@ -903,15 +958,15 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
...
@@ -903,15 +958,15 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
}
}
LastStructPcb
=
Cotation
;
LastStructPcb
=
Cotation
;
#ifdef PCBNEW
#ifdef PCBNEW
Cotation
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
Cotation
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
#endif
#endif
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"$MIREPCB"
,
8
)
==
0
)
if
(
strnicmp
(
Line
,
"$MIREPCB"
,
8
)
==
0
)
{
{
MIREPCB
*
Mire
=
new
MIREPCB
(
m_Pcb
);
MIREPCB
*
Mire
=
new
MIREPCB
(
m_Pcb
);
Mire
->
ReadMirePcbDescr
(
File
,
&
LineNum
);
Mire
->
ReadMirePcbDescr
(
File
,
&
LineNum
);
if
(
LastStructPcb
==
NULL
)
if
(
LastStructPcb
==
NULL
)
{
{
...
@@ -925,193 +980,207 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
...
@@ -925,193 +980,207 @@ EQUIPOT * LastEquipot = NULL, * Equipot;
}
}
LastStructPcb
=
Mire
;
LastStructPcb
=
Mire
;
#ifdef PCBNEW
#ifdef PCBNEW
Mire
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
Mire
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
#endif
#endif
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"$TRACK"
,
6
)
==
0
)
if
(
strnicmp
(
Line
,
"$TRACK"
,
6
)
==
0
)
{
{
TRACK
*
StartTrack
=
m_Pcb
->
m_Track
;
TRACK
*
StartTrack
=
m_Pcb
->
m_Track
;
nbsegm
=
0
;
nbsegm
=
0
;
if
(
Append
)
if
(
Append
)
{
{
for
(
;
StartTrack
!=
NULL
;
StartTrack
=
(
TRACK
*
)
StartTrack
->
Pnext
)
for
(
;
StartTrack
!=
NULL
;
StartTrack
=
(
TRACK
*
)
StartTrack
->
Pnext
)
{
{
if
(
StartTrack
->
Pnext
==
NULL
)
break
;
if
(
StartTrack
->
Pnext
==
NULL
)
break
;
}
}
}
}
#ifdef PCBNEW
#ifdef PCBNEW
int
ii
=
ReadListeSegmentDescr
(
DC
,
File
,
StartTrack
,
TYPETRACK
,
int
ii
=
ReadListeSegmentDescr
(
DC
,
File
,
StartTrack
,
TYPETRACK
,
&
LineNum
,
NbTrack
);
&
LineNum
,
NbTrack
);
m_Pcb
->
m_NbSegmTrack
+=
ii
;
m_Pcb
->
m_NbSegmTrack
+=
ii
;
#endif
#endif
continue
;
continue
;
}
}
if
(
strnicmp
(
Line
,
"$ZONE"
,
5
)
==
0
)
if
(
strnicmp
(
Line
,
"$ZONE"
,
5
)
==
0
)
{
{
TRACK
*
StartZone
=
m_Pcb
->
m_Zone
;
TRACK
*
StartZone
=
m_Pcb
->
m_Zone
;
if
(
Append
)
if
(
Append
)
{
{
for
(
;
StartZone
!=
NULL
;
StartZone
=
(
TRACK
*
)
StartZone
->
Pnext
)
for
(
;
StartZone
!=
NULL
;
StartZone
=
(
TRACK
*
)
StartZone
->
Pnext
)
{
{
if
(
StartZone
->
Pnext
==
NULL
)
break
;
if
(
StartZone
->
Pnext
==
NULL
)
break
;
}
}
}
}
#ifdef PCBNEW
#ifdef PCBNEW
int
ii
=
ReadListeSegmentDescr
(
DC
,
File
,
StartZone
,
TYPEZONE
,
int
ii
=
ReadListeSegmentDescr
(
DC
,
File
,
StartZone
,
TYPEZONE
,
&
LineNum
,
NbZone
);
&
LineNum
,
NbZone
);
m_Pcb
->
m_NbSegmZone
+=
ii
;
m_Pcb
->
m_NbSegmZone
+=
ii
;
#endif
#endif
continue
;
continue
;
}
}
}
}
setlocale
(
LC_NUMERIC
,
""
);
// revert to the current locale
setlocale
(
LC_NUMERIC
,
""
);
// revert to the current locale
Affiche_Message
(
wxEmptyString
);
Affiche_Message
(
wxEmptyString
);
#ifdef PCBNEW
#ifdef PCBNEW
Compile_Ratsnest
(
DC
,
TRUE
);
Compile_Ratsnest
(
DC
,
TRUE
);
#endif
#endif
return
(
1
)
;
return
1
;
}
}
#ifdef PCBNEW
#ifdef PCBNEW
/***************************************************/
/***************************************************/
int
WinEDA_PcbFrame
::
SavePcbFormatAscii
(
FILE
*
File
)
int
WinEDA_PcbFrame
::
SavePcbFormatAscii
(
FILE
*
File
)
/****************************************************/
/****************************************************/
/* Routine de sauvegarde du PCB courant sous format ASCII
/* Routine de sauvegarde du PCB courant sous format ASCII
retourne
*
retourne
1 si OK
*
1 si OK
0 si sauvegarde non faite
*
0 si sauvegarde non faite
*/
*/
{
{
int
ii
,
NbModules
,
nseg
;
int
ii
,
NbModules
,
nseg
;
float
Pas
;
float
Pas
;
char
Line
[
256
];
char
Line
[
256
];
EQUIPOT
*
Equipot
;
EQUIPOT
*
Equipot
;
TRACK
*
PtSegm
;
TRACK
*
PtSegm
;
EDA_BaseStruct
*
PtStruct
;
EDA_BaseStruct
*
PtStruct
;
MODULE
*
Module
;
MODULE
*
Module
;
wxBeginBusyCursor
();
wxBeginBusyCursor
();
m_Pcb
->
m_Status_Pcb
&=
~
CONNEXION_OK
;
m_Pcb
->
m_Status_Pcb
&=
~
CONNEXION_OK
;
/* Calcul du nombre des modules */
/* Calcul du nombre des modules */
PtStruct
=
(
EDA_BaseStruct
*
)
m_Pcb
->
m_Modules
;
PtStruct
=
(
EDA_BaseStruct
*
)
m_Pcb
->
m_Modules
;
NbModules
=
0
;
NbModules
=
0
;
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
NbModules
++
;
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
NbModules
++
;
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
setlocale
(
LC_NUMERIC
,
"C"
);
setlocale
(
LC_NUMERIC
,
"C"
);
/* Ecriture de l'entete PCB : */
/* Ecriture de l'entete PCB : */
fprintf
(
File
,
"PCBNEW-BOARD Version %d date %s
\n\n
"
,
g_CurrentVersionPCB
,
fprintf
(
File
,
"PCBNEW-BOARD Version %d date %s
\n\n
"
,
g_CurrentVersionPCB
,
DateAndTime
(
Line
)
);
DateAndTime
(
Line
)
);
WriteGeneralDescrPcb
(
File
);
WriteGeneralDescrPcb
(
File
);
WriteSheetDescr
(
m_CurrentScreen
,
File
);
WriteSheetDescr
(
m_CurrentScreen
,
File
);
WriteSetup
(
File
,
this
);
WriteSetup
(
File
,
this
);
/* Ecriture des donnes utiles du pcb */
/* Ecriture des donnes utiles du pcb */
Equipot
=
m_Pcb
->
m_Equipots
;
Equipot
=
m_Pcb
->
m_Equipots
;
Pas
=
100.0
;
if
(
m_Pcb
->
m_NbNets
)
Pas
/=
m_Pcb
->
m_NbNets
;
Pas
=
100.0
;
if
(
m_Pcb
->
m_NbNets
)
for
(
ii
=
0
;
Equipot
!=
NULL
;
ii
++
,
Equipot
=
(
EQUIPOT
*
)
Equipot
->
Pnext
)
Pas
/=
m_Pcb
->
m_NbNets
;
for
(
ii
=
0
;
Equipot
!=
NULL
;
ii
++
,
Equipot
=
(
EQUIPOT
*
)
Equipot
->
Pnext
)
{
{
Equipot
->
WriteEquipotDescr
(
File
);
Equipot
->
WriteEquipotDescr
(
File
);
DisplayActivity
((
int
)(
Pas
*
ii
),
wxT
(
"Equipot:"
)
);
DisplayActivity
(
(
int
)
(
Pas
*
ii
),
wxT
(
"Equipot:"
)
);
}
}
Pas
=
100.0
;
if
(
NbModules
)
Pas
/=
NbModules
;
Pas
=
100.0
;
if
(
NbModules
)
Pas
/=
NbModules
;
Module
=
m_Pcb
->
m_Modules
;
Module
=
m_Pcb
->
m_Modules
;
for
(
ii
=
1
;
Module
!=
NULL
;
Module
=
Module
->
Next
(),
ii
++
)
for
(
ii
=
1
;
Module
!=
NULL
;
Module
=
Module
->
Next
(),
ii
++
)
{
{
Module
->
WriteDescr
(
File
);
Module
->
WriteDescr
(
File
);
DisplayActivity
((
int
)(
ii
*
Pas
)
,
wxT
(
"Modules:"
)
);
DisplayActivity
(
(
int
)
(
ii
*
Pas
),
wxT
(
"Modules:"
)
);
}
}
/* sortie des inscriptions du PCB: */
/* sortie des inscriptions du PCB: */
PtStruct
=
m_Pcb
->
m_Drawings
;
PtStruct
=
m_Pcb
->
m_Drawings
;
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
{
{
switch
(
PtStruct
->
m_StructType
)
switch
(
PtStruct
->
m_StructType
)
{
{
case
TYPETEXTE
:
case
TYPETEXTE
:
((
TEXTE_PCB
*
)
PtStruct
)
->
WriteTextePcbDescr
(
File
)
;
(
(
TEXTE_PCB
*
)
PtStruct
)
->
WriteTextePcbDescr
(
File
)
;
break
;
break
;
case
TYPEDRAWSEGMENT
:
case
TYPEDRAWSEGMENT
:
((
DRAWSEGMENT
*
)
PtStruct
)
->
WriteDrawSegmentDescr
(
File
);
(
(
DRAWSEGMENT
*
)
PtStruct
)
->
WriteDrawSegmentDescr
(
File
);
break
;
break
;
case
TYPEMIRE
:
case
TYPEMIRE
:
((
MIREPCB
*
)
PtStruct
)
->
WriteMirePcbDescr
(
File
);
(
(
MIREPCB
*
)
PtStruct
)
->
WriteMirePcbDescr
(
File
);
break
;
break
;
case
TYPECOTATION
:
case
TYPECOTATION
:
((
COTATION
*
)
PtStruct
)
->
WriteCotationDescr
(
File
);
(
(
COTATION
*
)
PtStruct
)
->
WriteCotationDescr
(
File
);
break
;
break
;
case
TYPEMARQUEUR
:
/* sauvegarde inutile */
case
TYPEMARQUEUR
:
/* sauvegarde inutile */
break
;
break
;
default
:
default
:
DisplayError
(
this
,
wxT
(
"Unknown Draw Type"
)
);
DisplayError
(
this
,
wxT
(
"Unknown Draw Type"
)
);
break
;
break
;
}
}
}
}
Pas
=
100.0
;
Pas
=
100.0
;
if
(
m_Pcb
->
m_NbSegmTrack
)
Pas
/=
(
m_Pcb
->
m_NbSegmTrack
);
if
(
m_Pcb
->
m_NbSegmTrack
)
fprintf
(
File
,
"$TRACK
\n
"
);
Pas
/=
(
m_Pcb
->
m_NbSegmTrack
);
fprintf
(
File
,
"$TRACK
\n
"
);
PtSegm
=
m_Pcb
->
m_Track
;
PtSegm
=
m_Pcb
->
m_Track
;
DisplayActivity
(
0
,
wxT
(
"Tracks:"
));
for
(
nseg
=
0
,
ii
=
0
;
PtSegm
!=
NULL
;
ii
++
,
PtSegm
=
(
TRACK
*
)
PtSegm
->
Pnext
)
DisplayActivity
(
0
,
wxT
(
"Tracks:"
)
);
for
(
nseg
=
0
,
ii
=
0
;
PtSegm
!=
NULL
;
ii
++
,
PtSegm
=
(
TRACK
*
)
PtSegm
->
Pnext
)
{
{
((
TRACK
*
)
PtSegm
)
->
WriteTrackDescr
(
File
);
(
(
TRACK
*
)
PtSegm
)
->
WriteTrackDescr
(
File
);
if
(
nseg
!=
(
int
)
(
ii
*
Pas
)
)
if
(
nseg
!=
(
int
)
(
ii
*
Pas
)
)
{
{
nseg
=
(
int
)
(
ii
*
Pas
);
nseg
=
(
int
)
(
ii
*
Pas
);
DisplayActivity
(
nseg
,
wxT
(
"Tracks:"
)
);
DisplayActivity
(
nseg
,
wxT
(
"Tracks:"
)
);
}
}
}
}
fprintf
(
File
,
"$EndTRACK
\n
"
);
fprintf
(
File
,
"$ZONE
\n
"
);
fprintf
(
File
,
"$EndTRACK
\n
"
);
fprintf
(
File
,
"$ZONE
\n
"
);
PtSegm
=
(
TRACK
*
)
m_Pcb
->
m_Zone
;
PtSegm
=
(
TRACK
*
)
m_Pcb
->
m_Zone
;
ii
=
m_Pcb
->
m_NbSegmZone
;
ii
=
m_Pcb
->
m_NbSegmZone
;
Pas
=
100.0
;
if
(
ii
)
Pas
/=
ii
;
Pas
=
100.0
;
if
(
ii
)
Pas
/=
ii
;
PtSegm
=
m_Pcb
->
m_Zone
;
PtSegm
=
m_Pcb
->
m_Zone
;
DisplayActivity
(
0
,
wxT
(
"Zones:"
));
for
(
nseg
=
0
,
ii
=
0
;
PtSegm
!=
NULL
;
ii
++
,
PtSegm
=
(
TRACK
*
)
PtSegm
->
Pnext
)
DisplayActivity
(
0
,
wxT
(
"Zones:"
)
);
for
(
nseg
=
0
,
ii
=
0
;
PtSegm
!=
NULL
;
ii
++
,
PtSegm
=
(
TRACK
*
)
PtSegm
->
Pnext
)
{
{
((
TRACK
*
)
PtSegm
)
->
WriteTrackDescr
(
File
);
(
(
TRACK
*
)
PtSegm
)
->
WriteTrackDescr
(
File
);
if
(
nseg
!=
(
int
)
(
ii
*
Pas
)
)
if
(
nseg
!=
(
int
)
(
ii
*
Pas
)
)
{
{
nseg
=
(
int
)
(
ii
*
Pas
);
nseg
=
(
int
)
(
ii
*
Pas
);
DisplayActivity
(
nseg
,
wxT
(
"Zones:"
)
);
DisplayActivity
(
nseg
,
wxT
(
"Zones:"
)
);
}
}
}
}
fprintf
(
File
,
"$EndZONE
\n
"
);
fprintf
(
File
,
"$EndZONE
\n
"
);
fprintf
(
File
,
"$EndBOARD
\n
"
);
fprintf
(
File
,
"$EndBOARD
\n
"
);
setlocale
(
LC_NUMERIC
,
""
);
// revert to the current locale
setlocale
(
LC_NUMERIC
,
""
);
// revert to the current locale
wxEndBusyCursor
();
wxEndBusyCursor
();
Affiche_Message
(
wxEmptyString
);
Affiche_Message
(
wxEmptyString
);
return
1
;
return
1
;
}
}
#endif
#endif
This diff is collapsed.
Click to expand it.
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