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
ff193f18
Commit
ff193f18
authored
Oct 06, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
variable number of fields per schematic component
parent
22c50612
Changes
26
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
711 additions
and
532 deletions
+711
-532
CMakeLists.txt
eeschema/CMakeLists.txt
+3
-1
affiche.cpp
eeschema/affiche.cpp
+2
-1
annotate.cpp
eeschema/annotate.cpp
+3
-3
backanno.cpp
eeschema/backanno.cpp
+10
-9
block.cpp
eeschema/block.cpp
+7
-6
build_BOM.cpp
eeschema/build_BOM.cpp
+18
-15
bus-wire-junction.cpp
eeschema/bus-wire-junction.cpp
+19
-18
class_drawsheet.cpp
eeschema/class_drawsheet.cpp
+2
-8
class_drawsheet.h
eeschema/class_drawsheet.h
+6
-4
class_sch_cmp_field.cpp
eeschema/class_sch_cmp_field.cpp
+19
-22
class_sch_cmp_field.h
eeschema/class_sch_cmp_field.h
+23
-29
component_class.cpp
eeschema/component_class.cpp
+127
-106
component_class.h
eeschema/component_class.h
+97
-16
controle.cpp
eeschema/controle.cpp
+3
-3
cross-probing.cpp
eeschema/cross-probing.cpp
+4
-4
edit_component_in_schematic.cpp
eeschema/edit_component_in_schematic.cpp
+59
-54
eelibs_draw_components.cpp
eeschema/eelibs_draw_components.cpp
+21
-12
find.cpp
eeschema/find.cpp
+6
-6
getpart.cpp
eeschema/getpart.cpp
+30
-25
load_one_schematic_file.cpp
eeschema/load_one_schematic_file.cpp
+210
-154
locate.cpp
eeschema/locate.cpp
+9
-7
netform.cpp
eeschema/netform.cpp
+10
-10
onrightclick.cpp
eeschema/onrightclick.cpp
+1
-1
plot.cpp
eeschema/plot.cpp
+11
-11
protos.h
eeschema/protos.h
+1
-1
base_struct.h
include/base_struct.h
+10
-6
No files found.
eeschema/CMakeLists.txt
View file @
ff193f18
add_definitions
(
-DEESCHEMA
)
add_definitions
(
-DEESCHEMA
)
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
)
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
# ${Boost_INCLUDE_DIR}
)
set
(
EESCHEMA_SRCS
set
(
EESCHEMA_SRCS
affiche.cpp
affiche.cpp
...
...
eeschema/affiche.cpp
View file @
ff193f18
...
@@ -41,7 +41,8 @@ void SCH_COMPONENT::Display_Infos( WinEDA_DrawFrame* frame )
...
@@ -41,7 +41,8 @@ void SCH_COMPONENT::Display_Infos( WinEDA_DrawFrame* frame )
msg
=
_
(
"Pwr Symb"
);
msg
=
_
(
"Pwr Symb"
);
else
else
msg
=
_
(
"Val"
);
msg
=
_
(
"Val"
);
Affiche_1_Parametre
(
frame
,
10
,
msg
,
m_Field
[
VALUE
].
m_Text
,
DARKCYAN
);
Affiche_1_Parametre
(
frame
,
10
,
msg
,
GetField
(
VALUE
)
->
m_Text
,
DARKCYAN
);
Affiche_1_Parametre
(
frame
,
28
,
_
(
"RefLib"
),
m_ChipName
.
GetData
(),
BROWN
);
Affiche_1_Parametre
(
frame
,
28
,
_
(
"RefLib"
),
m_ChipName
.
GetData
(),
BROWN
);
...
...
eeschema/annotate.cpp
View file @
ff193f18
...
@@ -382,11 +382,11 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet )
...
@@ -382,11 +382,11 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet )
BaseListeCmp
[
NbrCmp
].
m_NumRef
=
-
1
;
BaseListeCmp
[
NbrCmp
].
m_NumRef
=
-
1
;
if
(
DrawLibItem
->
m_Field
[
VALUE
].
m_Text
.
IsEmpty
()
)
if
(
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
.
IsEmpty
()
)
DrawLibItem
->
m_Field
[
VALUE
].
m_Text
=
wxT
(
"~"
);
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
=
wxT
(
"~"
);
strncpy
(
BaseListeCmp
[
NbrCmp
].
m_TextValue
,
strncpy
(
BaseListeCmp
[
NbrCmp
].
m_TextValue
,
CONV_TO_UTF8
(
DrawLibItem
->
m_Field
[
VALUE
].
m_Text
),
32
);
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
),
32
);
NbrCmp
++
;
NbrCmp
++
;
}
}
}
}
...
...
eeschema/backanno.cpp
View file @
ff193f18
...
@@ -48,22 +48,23 @@ bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent(
...
@@ -48,22 +48,23 @@ bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent(
Cmp
=
(
SCH_COMPONENT
*
)
DrawList
;
Cmp
=
(
SCH_COMPONENT
*
)
DrawList
;
if
(
aReference
.
CmpNoCase
(
Cmp
->
GetRef
(
sheet
)
)
==
0
)
if
(
aReference
.
CmpNoCase
(
Cmp
->
GetRef
(
sheet
)
)
==
0
)
{
// Found: Init Footprint Field
{
// Found: Init Footprint Field
/* Give a reasonnable value to the fied position and orientation, if
/* Give a reasonnable value to the fied position and orientation, if
* the text is empty at position 0, because it is probably not yet initialised
* the text is empty at position 0, because it is probably not yet initialised
*/
*/
if
(
Cmp
->
m_Field
[
FOOTPRINT
].
m_Text
.
IsEmpty
()
if
(
Cmp
->
GetField
(
FOOTPRINT
)
->
m_Text
.
IsEmpty
()
&&
(
Cmp
->
m_Field
[
FOOTPRINT
].
m_Pos
==
wxPoint
(
0
,
0
)
)
)
&&
(
Cmp
->
GetField
(
FOOTPRINT
)
->
m_Pos
==
wxPoint
(
0
,
0
)
)
)
{
{
Cmp
->
m_Field
[
FOOTPRINT
].
m_Orient
=
Cmp
->
m_Field
[
VALUE
].
m_Orient
;
Cmp
->
GetField
(
FOOTPRINT
)
->
m_Orient
=
Cmp
->
GetField
(
VALUE
)
->
m_Orient
;
Cmp
->
m_Field
[
FOOTPRINT
].
m_Pos
=
Cmp
->
m_Field
[
VALUE
].
m_Pos
;
Cmp
->
GetField
(
FOOTPRINT
)
->
m_Pos
=
Cmp
->
GetField
(
VALUE
)
->
m_Pos
;
Cmp
->
m_Field
[
FOOTPRINT
].
m_Pos
.
y
-=
100
;
Cmp
->
GetField
(
FOOTPRINT
)
->
m_Pos
.
y
-=
100
;
}
}
Cmp
->
m_Field
[
FOOTPRINT
].
m_Text
=
aFootPrint
;
Cmp
->
GetField
(
FOOTPRINT
)
->
m_Text
=
aFootPrint
;
if
(
aSetVisible
)
if
(
aSetVisible
)
Cmp
->
m_Field
[
FOOTPRINT
].
m_Attributs
&=
~
TEXT_NO_VISIBLE
;
Cmp
->
GetField
(
FOOTPRINT
)
->
m_Attributs
&=
~
TEXT_NO_VISIBLE
;
else
else
Cmp
->
m_Field
[
FOOTPRINT
].
m_Attributs
|=
TEXT_NO_VISIBLE
;
Cmp
->
GetField
(
FOOTPRINT
)
->
m_Attributs
|=
TEXT_NO_VISIBLE
;
found
=
true
;
found
=
true
;
}
}
}
}
...
...
eeschema/block.cpp
View file @
ff193f18
...
@@ -711,11 +711,12 @@ void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center )
...
@@ -711,11 +711,12 @@ void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center )
NULL
,
CMP_MIROIR_Y
);
NULL
,
CMP_MIROIR_Y
);
MirrorYPoint
(
DrawLibItem
->
m_Pos
,
Center
);
MirrorYPoint
(
DrawLibItem
->
m_Pos
,
Center
);
dx
-=
DrawLibItem
->
m_Pos
.
x
;
dx
-=
DrawLibItem
->
m_Pos
.
x
;
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
/* move the fields to the new position because the component itself has moved */
DrawLibItem
->
m_Field
[
ii
].
m_Pos
.
x
-=
dx
;
}
for
(
ii
=
0
;
ii
<
DrawLibItem
->
GetFieldCount
();
ii
++
)
{
/* move the fields to the new position because the component itself has moved */
DrawLibItem
->
GetField
(
ii
)
->
m_Pos
.
x
-=
dx
;
}
break
;
break
;
case
DRAW_SHEET_STRUCT_TYPE
:
case
DRAW_SHEET_STRUCT_TYPE
:
...
@@ -1232,9 +1233,9 @@ void MoveOneStruct( SCH_ITEM * DrawStruct, const wxPoint& move_vector )
...
@@ -1232,9 +1233,9 @@ void MoveOneStruct( SCH_ITEM * DrawStruct, const wxPoint& move_vector )
case
TYPE_SCH_COMPONENT
:
case
TYPE_SCH_COMPONENT
:
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawStruct
;
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawStruct
;
DrawLibItem
->
m_Pos
+=
move_vector
;
DrawLibItem
->
m_Pos
+=
move_vector
;
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
for
(
ii
=
0
;
ii
<
DrawLibItem
->
GetFieldCount
()
;
ii
++
)
{
{
DrawLibItem
->
m_Field
[
ii
].
m_Pos
+=
move_vector
;
DrawLibItem
->
GetField
(
ii
)
->
m_Pos
+=
move_vector
;
}
}
break
;
break
;
...
...
eeschema/build_BOM.cpp
View file @
ff193f18
...
@@ -420,8 +420,8 @@ static int ListTriComposantByVal( ListComponent* obj1,
...
@@ -420,8 +420,8 @@ static int ListTriComposantByVal( ListComponent* obj1,
if
(
obj2
->
m_Comp
==
NULL
)
if
(
obj2
->
m_Comp
==
NULL
)
return
1
;
return
1
;
Text1
=
&
(
obj1
->
m_Comp
->
m_Field
[
VALUE
].
m_Text
);
Text1
=
&
(
obj1
->
m_Comp
->
GetField
(
VALUE
)
->
m_Text
);
Text2
=
&
(
obj2
->
m_Comp
->
m_Field
[
VALUE
].
m_Text
);
Text2
=
&
(
obj2
->
m_Comp
->
GetField
(
VALUE
)
->
m_Text
);
ii
=
Text1
->
CmpNoCase
(
*
Text2
);
ii
=
Text1
->
CmpNoCase
(
*
Text2
);
if
(
ii
==
0
)
if
(
ii
==
0
)
...
@@ -471,8 +471,8 @@ static int ListTriComposantByRef( ListComponent* obj1,
...
@@ -471,8 +471,8 @@ static int ListTriComposantByRef( ListComponent* obj1,
if
(
ii
==
0
)
if
(
ii
==
0
)
{
{
Text1
=
&
(
obj1
->
m_Comp
->
m_Field
[
VALUE
].
m_Text
);
Text1
=
&
(
obj1
->
m_Comp
->
GetField
(
VALUE
)
->
m_Text
);
Text2
=
&
(
obj2
->
m_Comp
->
m_Field
[
VALUE
].
m_Text
);
Text2
=
&
(
obj2
->
m_Comp
->
GetField
(
VALUE
)
->
m_Text
);
ii
=
Text1
->
CmpNoCase
(
*
Text2
);
ii
=
Text1
->
CmpNoCase
(
*
Text2
);
}
}
...
@@ -594,7 +594,8 @@ void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem
...
@@ -594,7 +594,8 @@ void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem
bool
CompactForm
)
bool
CompactForm
)
/*******************************************************************************************/
/*******************************************************************************************/
{
{
const
wxCheckBox
*
FieldListCtrl
[]
=
{
// @todo make this variable length
static
const
wxCheckBox
*
FieldListCtrl
[]
=
{
m_AddField1
,
m_AddField1
,
m_AddField2
,
m_AddField2
,
m_AddField3
,
m_AddField3
,
...
@@ -613,24 +614,26 @@ void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem
...
@@ -613,24 +614,26 @@ void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem
if
(
CompactForm
)
if
(
CompactForm
)
{
{
fprintf
(
f
,
"%c%s"
,
s_ExportSeparatorSymbol
,
fprintf
(
f
,
"%c%s"
,
s_ExportSeparatorSymbol
,
CONV_TO_UTF8
(
DrawLibItem
->
m_Field
[
FOOTPRINT
].
m_Text
)
);
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
FOOTPRINT
)
->
m_Text
)
);
}
}
else
else
fprintf
(
f
,
"; %-12s"
,
CONV_TO_UTF8
(
DrawLibItem
->
m_Field
[
FOOTPRINT
].
m_Text
)
);
fprintf
(
f
,
"; %-12s"
,
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
FOOTPRINT
)
->
m_Text
)
);
}
}
for
(
ii
=
FIELD1
;
ii
<
=
FIELD8
;
ii
++
)
for
(
ii
=
FIELD1
;
ii
<
DrawLibItem
->
GetFieldCount
()
;
ii
++
)
{
{
FieldCtrl
=
FieldListCtrl
[
ii
-
FIELD1
];
FieldCtrl
=
FieldListCtrl
[
ii
-
FIELD1
];
if
(
FieldCtrl
==
NULL
)
if
(
FieldCtrl
==
NULL
)
continue
;
continue
;
if
(
!
FieldCtrl
->
IsChecked
()
)
if
(
!
FieldCtrl
->
IsChecked
()
)
continue
;
continue
;
if
(
CompactForm
)
if
(
CompactForm
)
fprintf
(
f
,
"%c%s"
,
s_ExportSeparatorSymbol
,
fprintf
(
f
,
"%c%s"
,
s_ExportSeparatorSymbol
,
CONV_TO_UTF8
(
DrawLibItem
->
m_Field
[
ii
].
m_Text
)
);
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
ii
)
->
m_Text
)
);
else
else
fprintf
(
f
,
"; %-12s"
,
CONV_TO_UTF8
(
DrawLibItem
->
m_Field
[
ii
].
m_Text
)
);
fprintf
(
f
,
"; %-12s"
,
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
ii
)
->
m_Text
)
);
}
}
}
}
...
@@ -655,7 +658,8 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f,
...
@@ -655,7 +658,8 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f,
if
(
CompactForm
)
if
(
CompactForm
)
{
{
const
wxCheckBox
*
FieldListCtrl
[
FIELD8
-
FIELD1
+
1
]
=
{
// @todo make this variable length
static
const
wxCheckBox
*
FieldListCtrl
[
FIELD8
-
FIELD1
+
1
]
=
{
m_AddField1
,
m_AddField1
,
m_AddField2
,
m_AddField2
,
m_AddField3
,
m_AddField3
,
...
@@ -673,7 +677,6 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f,
...
@@ -673,7 +677,6 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f,
{
{
fprintf
(
f
,
"%csheet path"
,
s_ExportSeparatorSymbol
);
fprintf
(
f
,
"%csheet path"
,
s_ExportSeparatorSymbol
);
fprintf
(
f
,
"%clocation"
,
s_ExportSeparatorSymbol
);
fprintf
(
f
,
"%clocation"
,
s_ExportSeparatorSymbol
);
}
}
if
(
m_AddFootprintField
->
IsChecked
()
)
if
(
m_AddFootprintField
->
IsChecked
()
)
...
@@ -732,10 +735,10 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f,
...
@@ -732,10 +735,10 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f,
if
(
CompactForm
)
if
(
CompactForm
)
fprintf
(
f
,
"%s%c%s"
,
CmpName
,
s_ExportSeparatorSymbol
,
fprintf
(
f
,
"%s%c%s"
,
CmpName
,
s_ExportSeparatorSymbol
,
CONV_TO_UTF8
(
DrawLibItem
->
m_Field
[
VALUE
].
m_Text
)
);
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
)
);
else
else
fprintf
(
f
,
"| %-10s %-12s"
,
CmpName
,
fprintf
(
f
,
"| %-10s %-12s"
,
CmpName
,
CONV_TO_UTF8
(
DrawLibItem
->
m_Field
[
VALUE
].
m_Text
)
);
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
)
);
if
(
aIncludeSubComponents
)
if
(
aIncludeSubComponents
)
{
{
...
@@ -816,7 +819,7 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByVal( FILE* f,
...
@@ -816,7 +819,7 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByVal( FILE* f,
}
}
sprintf
(
CmpName
,
"%s%c"
,
aList
[
ii
].
m_Ref
,
Unit
);
sprintf
(
CmpName
,
"%s%c"
,
aList
[
ii
].
m_Ref
,
Unit
);
fprintf
(
f
,
"| %-12s %-10s"
,
CONV_TO_UTF8
(
DrawLibItem
->
m_Field
[
VALUE
].
m_Text
),
CmpName
);
fprintf
(
f
,
"| %-12s %-10s"
,
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
),
CmpName
);
// print the sheet path
// print the sheet path
if
(
aIncludeSubComponents
)
if
(
aIncludeSubComponents
)
...
...
eeschema/bus-wire-junction.cpp
View file @
ff193f18
...
@@ -710,9 +710,10 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
...
@@ -710,9 +710,10 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
STRUCT
->
m_Pos
=
GetScreen
()
->
m_Curseur
;
STRUCT
->
m_Pos
=
GetScreen
()
->
m_Curseur
;
STRUCT
->
m_Flags
=
IS_NEW
;
STRUCT
->
m_Flags
=
IS_NEW
;
STRUCT
->
m_TimeStamp
=
GetTimeStamp
();
STRUCT
->
m_TimeStamp
=
GetTimeStamp
();
for
(
int
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
for
(
int
ii
=
0
;
ii
<
STRUCT
->
GetFieldCount
();
ii
++
)
{
{
STRUCT
->
m_Field
[
ii
].
m_Pos
+=
new_pos
;
STRUCT
->
GetField
(
ii
)
->
m_Pos
+=
new_pos
;
}
}
RedrawOneStruct
(
DrawPanel
,
DC
,
STRUCT
,
g_XorMode
);
RedrawOneStruct
(
DrawPanel
,
DC
,
STRUCT
,
g_XorMode
);
...
...
eeschema/class_drawsheet.cpp
View file @
ff193f18
...
@@ -380,7 +380,7 @@ int DrawSheetStruct::ComponentCount()
...
@@ -380,7 +380,7 @@ int DrawSheetStruct::ComponentCount()
if
(
bs
->
Type
()
==
TYPE_SCH_COMPONENT
)
if
(
bs
->
Type
()
==
TYPE_SCH_COMPONENT
)
{
{
SCH_COMPONENT
*
Cmp
=
(
SCH_COMPONENT
*
)
bs
;
SCH_COMPONENT
*
Cmp
=
(
SCH_COMPONENT
*
)
bs
;
if
(
Cmp
->
m_Field
[
VALUE
].
m_Text
.
GetChar
(
0
)
!=
'#'
)
if
(
Cmp
->
GetField
(
VALUE
)
->
m_Text
.
GetChar
(
0
)
!=
'#'
)
n
++
;
n
++
;
}
}
if
(
bs
->
Type
()
==
DRAW_SHEET_STRUCT_TYPE
)
if
(
bs
->
Type
()
==
DRAW_SHEET_STRUCT_TYPE
)
...
@@ -776,12 +776,6 @@ wxString DrawSheetPath::PathHumanReadable()
...
@@ -776,12 +776,6 @@ wxString DrawSheetPath::PathHumanReadable()
/***********************************************/
/***********************************************/
void
DrawSheetPath
::
UpdateAllScreenReferences
()
void
DrawSheetPath
::
UpdateAllScreenReferences
()
/***********************************************/
/***********************************************/
/** Function UpdateAllScreenReferences
* Update the reference and the m_Multi parameter (part selection) for all components on a screen
* depending on the actual sheet path.
* Mandatory in complex hierarchies sheets use the same screen (basic schematic)
* but with different references and part selection according to the displayed sheet
*/
{
{
EDA_BaseStruct
*
t
=
LastDrawList
();
EDA_BaseStruct
*
t
=
LastDrawList
();
...
@@ -790,7 +784,7 @@ void DrawSheetPath::UpdateAllScreenReferences()
...
@@ -790,7 +784,7 @@ void DrawSheetPath::UpdateAllScreenReferences()
if
(
t
->
Type
()
==
TYPE_SCH_COMPONENT
)
if
(
t
->
Type
()
==
TYPE_SCH_COMPONENT
)
{
{
SCH_COMPONENT
*
component
=
(
SCH_COMPONENT
*
)
t
;
SCH_COMPONENT
*
component
=
(
SCH_COMPONENT
*
)
t
;
component
->
m_Field
[
REFERENCE
].
m_Text
=
component
->
GetRef
(
this
);
component
->
GetField
(
REFERENCE
)
->
m_Text
=
component
->
GetRef
(
this
);
component
->
m_Multi
=
component
->
GetUnitSelection
(
this
);
component
->
m_Multi
=
component
->
GetUnitSelection
(
this
);
}
}
t
=
t
->
Pnext
;
t
=
t
->
Pnext
;
...
...
eeschema/class_drawsheet.h
View file @
ff193f18
...
@@ -138,11 +138,12 @@ public:
...
@@ -138,11 +138,12 @@ public:
/* class to handle a series of sheets *********/
/* class to handle a series of sheets *********/
/* a 'path' so to speak.. *********************/
/* a 'path' so to speak.. *********************/
/**********************************************/
/**********************************************/
#define DSLSZ 32 // Max number of levels for a sheet path
class
DrawSheetPath
class
DrawSheetPath
{
{
public
:
public
:
int
m_numSheets
;
int
m_numSheets
;
#define DSLSZ 32 // Max number of levels for a sheet path
DrawSheetStruct
*
m_sheets
[
DSLSZ
];
DrawSheetStruct
*
m_sheets
[
DSLSZ
];
DrawSheetPath
();
DrawSheetPath
();
...
@@ -168,9 +169,10 @@ public:
...
@@ -168,9 +169,10 @@ public:
*/
*/
wxString
PathHumanReadable
();
wxString
PathHumanReadable
();
/** Function UpdateAllScreenReferences
/**
* Update the reference and the m_Multi parameter (part selection) for all components on a screen
* Function UpdateAllScreenReferences
* depending on the actual sheet path.
* updates the reference and the m_Multi parameter (part selection) for all
* components on a screen depending on the actual sheet path.
* Mandatory in complex hierarchies because sheets use the same screen (basic schematic)
* Mandatory in complex hierarchies because sheets use the same screen (basic schematic)
* but with different references and part selection according to the displayed sheet
* but with different references and part selection according to the displayed sheet
*/
*/
...
...
eeschema/class_sch_cmp_field.cpp
View file @
ff193f18
...
@@ -15,14 +15,18 @@
...
@@ -15,14 +15,18 @@
/***************************************************************************/
/***************************************************************************/
SCH_CMP_FIELD
::
SCH_CMP_FIELD
(
const
wxPoint
&
pos
,
const
wxString
&
text
)
:
SCH_CMP_FIELD
::
SCH_CMP_FIELD
(
const
wxPoint
&
aPos
,
int
aFieldId
,
SCH_COMPONENT
*
aParent
,
wxString
aName
)
:
SCH_ITEM
(
NULL
,
DRAW_PART_TEXT_STRUCT_TYPE
),
SCH_ITEM
(
aParent
,
DRAW_PART_TEXT_STRUCT_TYPE
),
EDA_TextStruct
(
text
)
EDA_TextStruct
()
/***************************************************************************/
/***************************************************************************/
{
{
m_Pos
=
p
os
;
m_Pos
=
aP
os
;
m_FieldId
=
0
;
m_FieldId
=
aFieldId
;
m_AddExtraText
=
false
;
m_AddExtraText
=
false
;
m_Attributs
=
TEXT_NO_VISIBLE
;
m_Name
=
aName
;
SetLayer
(
LAYER_FIELDS
);
}
}
...
@@ -58,6 +62,7 @@ void SCH_CMP_FIELD::SwapData( SCH_CMP_FIELD* copyitem )
...
@@ -58,6 +62,7 @@ void SCH_CMP_FIELD::SwapData( SCH_CMP_FIELD* copyitem )
}
}
#if 0
/***********************************************************/
/***********************************************************/
void SCH_CMP_FIELD::PartTextCopy( SCH_CMP_FIELD* target )
void SCH_CMP_FIELD::PartTextCopy( SCH_CMP_FIELD* target )
/***********************************************************/
/***********************************************************/
...
@@ -75,6 +80,7 @@ void SCH_CMP_FIELD::PartTextCopy( SCH_CMP_FIELD* target )
...
@@ -75,6 +80,7 @@ void SCH_CMP_FIELD::PartTextCopy( SCH_CMP_FIELD* target )
target->m_VJustify = m_VJustify;
target->m_VJustify = m_VJustify;
target->m_Flags = m_Flags;
target->m_Flags = m_Flags;
}
}
#endif
/*********************************/
/*********************************/
...
@@ -200,26 +206,22 @@ EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const
...
@@ -200,26 +206,22 @@ EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const
}
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
SCH_CMP_FIELD
::
Save
(
FILE
*
aFile
)
const
bool
SCH_CMP_FIELD
::
Save
(
FILE
*
aFile
)
const
{
{
char
hjustify
=
'C'
;
char
hjustify
=
'C'
;
if
(
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
if
(
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
hjustify
=
'L'
;
hjustify
=
'L'
;
else
if
(
m_HJustify
==
GR_TEXT_HJUSTIFY_RIGHT
)
else
if
(
m_HJustify
==
GR_TEXT_HJUSTIFY_RIGHT
)
hjustify
=
'R'
;
hjustify
=
'R'
;
char
vjustify
=
'C'
;
char
vjustify
=
'C'
;
if
(
m_VJustify
==
GR_TEXT_VJUSTIFY_BOTTOM
)
if
(
m_VJustify
==
GR_TEXT_VJUSTIFY_BOTTOM
)
vjustify
=
'B'
;
vjustify
=
'B'
;
else
if
(
m_VJustify
==
GR_TEXT_VJUSTIFY_TOP
)
else
if
(
m_VJustify
==
GR_TEXT_VJUSTIFY_TOP
)
vjustify
=
'T'
;
vjustify
=
'T'
;
if
(
fprintf
(
aFile
,
"F %d
\"
%s
\"
%c %-3d %-3d %-3d %4.4X %c %c"
,
m_FieldId
,
if
(
fprintf
(
aFile
,
"F %d
\"
%s
\"
%c %-3d %-3d %-3d %4.4X %c %c"
,
m_FieldId
,
CONV_TO_UTF8
(
m_Text
),
CONV_TO_UTF8
(
m_Text
),
m_Orient
==
TEXT_ORIENT_HORIZ
?
'H'
:
'V'
,
m_Orient
==
TEXT_ORIENT_HORIZ
?
'H'
:
'V'
,
m_Pos
.
x
,
m_Pos
.
y
,
m_Pos
.
x
,
m_Pos
.
y
,
...
@@ -230,19 +232,14 @@ bool SCH_CMP_FIELD::Save( FILE* aFile ) const
...
@@ -230,19 +232,14 @@ bool SCH_CMP_FIELD::Save( FILE* aFile ) const
return
false
;
return
false
;
}
}
// Save field name, if the name is user definable
// Save field name, if necessary
if
(
m_FieldId
>=
FIELD1
)
if
(
m_FieldId
>=
FIELD1
&&
!
m_Name
.
IsEmpty
()
)
{
wxString
fieldname
=
ReturnDefaultFieldName
(
m_FieldId
);
if
(
fieldname
!=
m_Name
)
{
{
if
(
fprintf
(
aFile
,
"
\"
%s
\"
"
,
CONV_TO_UTF8
(
m_Name
)
)
==
EOF
)
if
(
fprintf
(
aFile
,
"
\"
%s
\"
"
,
CONV_TO_UTF8
(
m_Name
)
)
==
EOF
)
{
{
return
false
;
return
false
;
}
}
}
}
}
if
(
fprintf
(
aFile
,
"
\n
"
)
==
EOF
)
if
(
fprintf
(
aFile
,
"
\n
"
)
==
EOF
)
{
{
...
...
eeschema/class_sch_cmp_field.h
View file @
ff193f18
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
#ifndef CLASS_SCH_CMP_FIELD_H
#ifndef CLASS_SCH_CMP_FIELD_H
#define CLASS_SCH_CMP_FIELD_H
#define CLASS_SCH_CMP_FIELD_H
/*Fields are texts attached to a component, having a specuial meaning
/*
Fields are texts attached to a component, having a specuial meaning
* Fields 0 and 1 are very important: reference and value
* Fields 0 and 1 are very important: reference and value
* Field 2 is used as default footprint name.
* Field 2 is used as default footprint name.
* Field 3 is reserved (not currently used
* Field 3 is reserved (not currently used
...
@@ -13,35 +13,29 @@
...
@@ -13,35 +13,29 @@
* They can be renamed and can appear in reports
* They can be renamed and can appear in reports
*/
*/
/* Fields identifiers */
enum
NumFieldType
{
REFERENCE
=
0
,
/* Field Reference of part, i.e. "IC21" */
VALUE
,
/* Field Value of part, i.e. "3.3K" */
FOOTPRINT
,
/* Field Name Module PCB, i.e. "16DIP300" */
SHEET_FILENAME
,
/* Field Name Schema component, i.e. "cnt16.sch" */
FIELD1
,
FIELD2
,
FIELD3
,
FIELD4
,
FIELD5
,
FIELD6
,
FIELD7
,
FIELD8
,
NUMBER_OF_FIELDS
/* used as Field count, not a field identifier */
};
/*************************************************************/
class
SCH_COMPONENT
;
/**
* Class SCH_CMP_FIELD
* instances are attached to a component and provide a place for the component's value,
* reference designator, footprint, and user definable name-value pairs of
* arbitrary purpose.
*/
class
SCH_CMP_FIELD
:
public
SCH_ITEM
,
public
EDA_TextStruct
class
SCH_CMP_FIELD
:
public
SCH_ITEM
,
public
EDA_TextStruct
/*************************************************************/
{
{
public
:
public
:
int
m_FieldId
;
// Field indicator type (REFERENCE, VALUE or other id)
int
m_FieldId
;
// Field indicator type (REFERENCE, VALUE or other id)
wxString
m_Name
;
/* Field name (ref, value,pcb, sheet, filed 1..
wxString
m_Name
;
/* Field name (ref, value,pcb, sheet, filed 1..
* and for fields 1 to 8 the name is editable */
* and for fields 1 to 8 the name is editable
bool
m_AddExtraText
;
// Mainly for REFERENCE, add extar info (for REFERENCE: add part selection text
*/
bool
m_AddExtraText
;
// Mainly for REFERENCE, add extra info (for REFERENCE: add part selection text
public
:
public
:
SCH_CMP_FIELD
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
const
wxString
&
text
=
wxEmptyString
);
SCH_CMP_FIELD
(
const
wxPoint
&
aPos
,
int
aFieldId
,
SCH_COMPONENT
*
aParent
,
wxString
aName
=
wxEmptyString
);
~
SCH_CMP_FIELD
();
~
SCH_CMP_FIELD
();
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
...
@@ -68,7 +62,7 @@ public:
...
@@ -68,7 +62,7 @@ public:
/**
/**
* Function Save
* Function Save
* writes the data structures for this object out to a FILE in "*.
brd
" format.
* writes the data structures for this object out to a FILE in "*.
sch
" format.
* @param aFile The FILE to write to.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
* @return bool - true if success writing else false.
*/
*/
...
...
eeschema/component_class.cpp
View file @
ff193f18
...
@@ -22,8 +22,47 @@ WX_DEFINE_OBJARRAY( ArrayOfSheetLists );
...
@@ -22,8 +22,47 @@ WX_DEFINE_OBJARRAY( ArrayOfSheetLists );
/* class SCH_COMPONENT */
/* class SCH_COMPONENT */
/***************************/
/***************************/
/** Function AddHierarchicalReference
* Add a full hierachical reference (path + local reference)
/*******************************************************************/
SCH_COMPONENT
::
SCH_COMPONENT
(
const
wxPoint
&
aPos
,
SCH_ITEM
*
aParent
)
:
SCH_ITEM
(
aParent
,
TYPE_SCH_COMPONENT
)
/*******************************************************************/
{
m_Multi
=
0
;
/* In multi unit chip - which unit to draw. */
m_Pos
=
aPos
;
m_Convert
=
0
;
/* De Morgan Handling */
/* The rotation/mirror transformation matrix. pos normal */
m_Transform
[
0
][
0
]
=
1
;
m_Transform
[
0
][
1
]
=
0
;
m_Transform
[
1
][
0
]
=
0
;
m_Transform
[
1
][
1
]
=
-
1
;
m_Fields
.
reserve
(
NUMBER_OF_FIELDS
);
for
(
int
i
=
0
;
i
<
NUMBER_OF_FIELDS
;
++
i
)
{
SCH_CMP_FIELD
field
(
aPos
,
i
,
this
,
ReturnDefaultFieldName
(
i
)
);
if
(
i
==
REFERENCE
)
field
.
SetLayer
(
LAYER_REFERENCEPART
);
else
if
(
i
==
VALUE
)
field
.
SetLayer
(
LAYER_VALUEPART
);
// else keep LAYER_FIELDS from SCH_CMP_FIELD constructor
// SCH_CMP_FIELD's implicitly created copy constructor is called in here
AddField
(
field
);
}
m_PrefixString
=
wxString
(
_
(
"U"
)
);
}
/**
* Function AddHierarchicalReference
* adds a full hierachical reference (path + local reference)
* @param aPath = hierarchical path (/<sheet timestamp>/component timestamp> like /05678E50/A23EF560)
* @param aPath = hierarchical path (/<sheet timestamp>/component timestamp> like /05678E50/A23EF560)
* @param aRef = local reference like C45, R56
* @param aRef = local reference like C45, R56
* @param aMulti = part selection, used in multi part per package (0 or 1 for non multi)
* @param aMulti = part selection, used in multi part per package (0 or 1 for non multi)
...
@@ -56,7 +95,7 @@ void SCH_COMPONENT::AddHierarchicalReference( const wxString& aPath,
...
@@ -56,7 +95,7 @@ void SCH_COMPONENT::AddHierarchicalReference( const wxString& aPath,
/****************************************************************/
/****************************************************************/
const
wxString
&
ReturnDefaultFieldName
(
int
aFieldNdx
)
wxString
ReturnDefaultFieldName
(
int
aFieldNdx
)
/****************************************************************/
/****************************************************************/
/* Return the default field name from its index (REFERENCE, VALUE ..)
/* Return the default field name from its index (REFERENCE, VALUE ..)
...
@@ -65,42 +104,40 @@ const wxString& ReturnDefaultFieldName( int aFieldNdx )
...
@@ -65,42 +104,40 @@ const wxString& ReturnDefaultFieldName( int aFieldNdx )
*/
*/
{
{
// avoid unnecessarily copying wxStrings at runtime.
// avoid unnecessarily copying wxStrings at runtime.
static
const
wxString
FieldDefaultNameList
[]
=
{
static
const
wxString
defaults
[]
=
{
_
(
"Ref"
),
/* Reference of part, i.e. "IC21" */
_
(
"Ref"
),
// Reference of part, i.e. "IC21"
_
(
"Value"
),
/* Value of part, i.e. "3.3K" */
_
(
"Value"
),
// Value of part, i.e. "3.3K"
_
(
"Footprint"
),
/* Footprint, used by cvpcb or pcbnew, i.e. "16DIP300" */
_
(
"Footprint"
),
// Footprint, used by cvpcb or pcbnew, i.e. "16DIP300"
_
(
"Sheet"
),
/* for components which are a schematic file, schematic file name, i.e. "cnt16.sch" */
_
(
"Datasheet"
),
wxString
(
_
(
"Field"
)
)
+
wxT
(
"1"
),
wxString
(
_
(
"Field"
)
)
+
wxT
(
"2"
),
wxString
(
_
(
"Field"
)
)
+
wxT
(
"3"
),
wxString
(
_
(
"Field"
)
)
+
wxT
(
"4"
),
wxString
(
_
(
"Field"
)
)
+
wxT
(
"5"
),
wxString
(
_
(
"Field"
)
)
+
wxT
(
"6"
),
wxString
(
_
(
"Field"
)
)
+
wxT
(
"7"
),
wxString
(
_
(
"Field"
)
)
+
wxT
(
"8"
),
wxT
(
"badFieldNdx!"
)
// error, and "sentinel" value
};
};
if
(
(
unsigned
)
aFieldNdx
>
FIELD8
)
// catches < 0 also
if
(
(
unsigned
)
aFieldNdx
<=
DATASHEET
)
aFieldNdx
=
FIELD8
+
1
;
// return the sentinel text
return
defaults
[
aFieldNdx
];
return
FieldDefaultNameList
[
aFieldNdx
];
else
{
wxString
ret
=
_
(
"Field"
);
ret
<<
(
aFieldNdx
-
FIELD1
+
1
);
return
ret
;
}
}
}
/****************************************************************/
/****************************************************************/
const
wxString
&
SCH_COMPONENT
::
ReturnFieldName
(
int
aFieldNdx
)
const
wxString
SCH_COMPONENT
::
ReturnFieldName
(
int
aFieldNdx
)
const
/****************************************************************/
/****************************************************************/
/* Return the Field name from its index (REFERENCE, VALUE ..)
*/
{
{
// avoid unnecessarily copying wxStrings.
SCH_CMP_FIELD
*
field
=
GetField
(
aFieldNdx
);
if
(
aFieldNdx
<
FIELD1
||
m_Field
[
aFieldNdx
].
m_Name
.
IsEmpty
()
)
if
(
field
)
{
if
(
!
field
->
m_Name
.
IsEmpty
()
)
return
field
->
m_Name
;
else
return
ReturnDefaultFieldName
(
aFieldNdx
);
return
ReturnDefaultFieldName
(
aFieldNdx
);
}
return
m_Field
[
aFieldNdx
].
m_Name
;
return
wxEmptyString
;
}
}
...
@@ -137,15 +174,15 @@ const wxString SCH_COMPONENT::GetRef( DrawSheetPath* sheet )
...
@@ -137,15 +174,15 @@ const wxString SCH_COMPONENT::GetRef( DrawSheetPath* sheet )
}
}
}
}
//if it was not found in m_Paths array, then see if it is in
//
if it was not found in m_Paths array, then see if it is in
// m_Field[REFERENCE] -- if so, use this as a default for this path.
// m_Field[REFERENCE] -- if so, use this as a default for this path.
// this will happen if we load a version 1 schematic file.
// this will happen if we load a version 1 schematic file.
// it will also mean that multiple instances of the same sheet by default
// it will also mean that multiple instances of the same sheet by default
// all have the same component references, but perhaps this is best.
// all have the same component references, but perhaps this is best.
if
(
!
m_Field
[
REFERENCE
].
m_Text
.
IsEmpty
()
)
if
(
!
GetField
(
REFERENCE
)
->
m_Text
.
IsEmpty
()
)
{
{
SetRef
(
sheet
,
m_Field
[
REFERENCE
].
m_Text
);
SetRef
(
sheet
,
GetField
(
REFERENCE
)
->
m_Text
);
return
m_Field
[
REFERENCE
].
m_Text
;
return
GetField
(
REFERENCE
)
->
m_Text
;
}
}
return
m_PrefixString
;
return
m_PrefixString
;
}
}
...
@@ -184,16 +221,19 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref )
...
@@ -184,16 +221,19 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref )
if
(
notInArray
)
if
(
notInArray
)
AddHierarchicalReference
(
path
,
ref
,
m_Multi
);
AddHierarchicalReference
(
path
,
ref
,
m_Multi
);
if
(
m_Field
[
REFERENCE
].
m_Text
.
IsEmpty
()
SCH_CMP_FIELD
*
rf
=
GetField
(
REFERENCE
);
||
(
abs
(
m_Field
[
REFERENCE
].
m_Pos
.
x
-
m_Pos
.
x
)
+
abs
(
m_Field
[
REFERENCE
].
m_Pos
.
y
-
m_Pos
.
y
)
>
10000
)
)
if
(
rf
->
m_Text
.
IsEmpty
()
||
(
abs
(
rf
->
m_Pos
.
x
-
m_Pos
.
x
)
+
abs
(
rf
->
m_Pos
.
y
-
m_Pos
.
y
)
>
10000
)
)
{
{
//
move it to a reasonable position..
//
move it to a reasonable position
m_Field
[
REFERENCE
].
m_Pos
=
m_Pos
;
rf
->
m_Pos
=
m_Pos
;
m_Field
[
REFERENCE
].
m_Pos
.
x
+=
50
;
//a slight offset..
rf
->
m_Pos
.
x
+=
50
;
// a slight offset
m_Field
[
REFERENCE
].
m_Pos
.
y
+=
50
;
rf
->
m_Pos
.
y
+=
50
;
}
}
m_Field
[
REFERENCE
].
m_Text
=
ref
;
//for drawing.
rf
->
m_Text
=
ref
;
// for drawing.
}
}
...
@@ -266,51 +306,28 @@ void SCH_COMPONENT::SetUnitSelection( DrawSheetPath* aSheet, int aUnitSelection
...
@@ -266,51 +306,28 @@ void SCH_COMPONENT::SetUnitSelection( DrawSheetPath* aSheet, int aUnitSelection
/******************************************************************/
/******************************************************************/
const
wxString
&
SCH_COMPONENT
::
GetFieldValue
(
int
aFieldNdx
)
const
SCH_CMP_FIELD
*
SCH_COMPONENT
::
GetField
(
int
aFieldNdx
)
const
/******************************************************************/
/******************************************************************/
{
{
// avoid unnecessarily copying wxStrings.
const
SCH_CMP_FIELD
*
field
;
static
const
wxString
myEmpty
=
wxEmptyString
;
if
(
(
unsigned
)
aFieldNdx
<
m_Fields
.
size
()
)
field
=
&
m_Fields
[
aFieldNdx
];
else
field
=
NULL
;
if
(
(
unsigned
)
aFieldNdx
>
FIELD8
||
m_Field
[
aFieldNdx
].
m_Text
.
IsEmpty
()
)
wxASSERT
(
field
);
return
myEmpty
;
return
m_Field
[
aFieldNdx
].
m_Text
;
// use case to remove const-ness
return
(
SCH_CMP_FIELD
*
)
field
;
}
}
/*******************************************************************/
/******************************************************************/
SCH_COMPONENT
::
SCH_COMPONENT
(
const
wxPoint
&
aPos
)
:
void
SCH_COMPONENT
::
AddField
(
const
SCH_CMP_FIELD
&
aField
)
SCH_ITEM
(
NULL
,
TYPE_SCH_COMPONENT
)
/******************************************************************/
/*******************************************************************/
{
{
int
ii
;
m_Fields
.
push_back
(
aField
);
m_Multi
=
0
;
/* In multi unit chip - which unit to draw. */
m_Pos
=
aPos
;
m_Convert
=
0
;
/* De Morgan Handling */
/* The rotation/mirror transformation matrix. pos normal*/
m_Transform
[
0
][
0
]
=
1
;
m_Transform
[
0
][
1
]
=
0
;
m_Transform
[
1
][
0
]
=
0
;
m_Transform
[
1
][
1
]
=
-
1
;
/* initialisation des Fields */
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
m_Field
[
ii
].
m_Pos
=
m_Pos
;
m_Field
[
ii
].
SetLayer
(
LAYER_FIELDS
);
m_Field
[
ii
].
m_FieldId
=
REFERENCE
+
ii
;
m_Field
[
ii
].
m_Parent
=
this
;
}
m_Field
[
VALUE
].
SetLayer
(
LAYER_VALUEPART
);
m_Field
[
REFERENCE
].
SetLayer
(
LAYER_REFERENCEPART
);
m_PrefixString
=
wxString
(
_
(
"U"
)
);
}
}
...
@@ -380,10 +397,10 @@ void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
...
@@ -380,10 +397,10 @@ void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
EXCHG
(
m_Transform
[
0
][
1
],
copyitem
->
m_Transform
[
0
][
1
]
);
EXCHG
(
m_Transform
[
0
][
1
],
copyitem
->
m_Transform
[
0
][
1
]
);
EXCHG
(
m_Transform
[
1
][
0
],
copyitem
->
m_Transform
[
1
][
0
]
);
EXCHG
(
m_Transform
[
1
][
0
],
copyitem
->
m_Transform
[
1
][
0
]
);
EXCHG
(
m_Transform
[
1
][
1
],
copyitem
->
m_Transform
[
1
][
1
]
);
EXCHG
(
m_Transform
[
1
][
1
],
copyitem
->
m_Transform
[
1
][
1
]
);
for
(
int
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
SCH_CMP_FIELDS
tmp
=
copyitem
->
m_Fields
;
m_Field
[
ii
].
SwapData
(
&
copyitem
->
m_Field
[
ii
]
)
;
copyitem
->
m_Fields
=
m_Fields
;
}
m_Fields
=
tmp
;
}
}
...
@@ -471,7 +488,7 @@ void SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet )
...
@@ -471,7 +488,7 @@ void SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet )
// When a clear annotation is made, the calling function must call a
// When a clear annotation is made, the calling function must call a
// UpdateAllScreenReferences for the active sheet.
// UpdateAllScreenReferences for the active sheet.
// But this call cannot made here.
// But this call cannot made here.
m_Field
[
REFERENCE
].
m_Text
=
defRef
;
//for drawing.
m_Field
s
[
REFERENCE
].
m_Text
=
defRef
;
//for drawing.
}
}
...
@@ -480,9 +497,9 @@ void SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet )
...
@@ -480,9 +497,9 @@ void SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet )
SCH_COMPONENT
*
SCH_COMPONENT
::
GenCopy
()
SCH_COMPONENT
*
SCH_COMPONENT
::
GenCopy
()
/**************************************************************/
/**************************************************************/
{
{
SCH_COMPONENT
*
new_item
=
new
SCH_COMPONENT
(
m_Pos
);
int
ii
;
#if 0
SCH_COMPONENT* new_item = new SCH_COMPONENT( m_Pos );
new_item->m_Multi = m_Multi;
new_item->m_Multi = m_Multi;
new_item->m_ChipName = m_ChipName;
new_item->m_ChipName = m_ChipName;
...
@@ -495,12 +512,11 @@ SCH_COMPONENT* SCH_COMPONENT::GenCopy()
...
@@ -495,12 +512,11 @@ SCH_COMPONENT* SCH_COMPONENT::GenCopy()
new_item->m_Transform[1][1] = m_Transform[1][1];
new_item->m_Transform[1][1] = m_Transform[1][1];
new_item->m_TimeStamp = m_TimeStamp;
new_item->m_TimeStamp = m_TimeStamp;
new_item->m_Fields = m_Fields;
#else
SCH_COMPONENT
*
new_item
=
new
SCH_COMPONENT
(
*
this
);
/* initialisation des Fields */
#endif
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
m_Field
[
ii
].
PartTextCopy
(
&
new_item
->
m_Field
[
ii
]
);
}
return
new_item
;
return
new_item
;
}
}
...
@@ -752,9 +768,9 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os )
...
@@ -752,9 +768,9 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os )
"/>
\n
"
;
"/>
\n
"
;
// skip the reference, it's been output already.
// skip the reference, it's been output already.
for
(
int
i
=
1
;
i
<
NUMBER_OF_FIELDS
;
++
i
)
for
(
int
i
=
1
;
i
<
GetFieldCount
()
;
++
i
)
{
{
wxString
value
=
GetField
Value
(
i
)
;
wxString
value
=
GetField
(
i
)
->
m_Text
;
if
(
!
value
.
IsEmpty
()
)
if
(
!
value
.
IsEmpty
()
)
{
{
...
@@ -775,17 +791,11 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os )
...
@@ -775,17 +791,11 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os )
/****************************************/
/****************************************/
bool
SCH_COMPONENT
::
Save
(
FILE
*
f
)
const
bool
SCH_COMPONENT
::
Save
(
FILE
*
f
)
const
/****************************************/
/****************************************/
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
{
{
int
ii
,
Success
=
true
;
int
ii
,
Success
=
true
;
char
Name1
[
256
],
Name2
[
256
];
char
Name1
[
256
],
Name2
[
256
];
wxArrayString
reference_fields
;
wxArrayString
reference_fields
;
static
wxString
delimiters
(
wxT
(
" "
)
);
static
wxString
delimiters
(
wxT
(
" "
)
);
//this is redundant with the AR entries below, but it makes the
//this is redundant with the AR entries below, but it makes the
...
@@ -797,10 +807,10 @@ bool SCH_COMPONENT::Save( FILE* f ) const
...
@@ -797,10 +807,10 @@ bool SCH_COMPONENT::Save( FILE* f ) const
}
}
else
else
{
{
if
(
m_Field
[
REFERENCE
].
m_Text
.
IsEmpty
()
)
if
(
GetField
(
REFERENCE
)
->
m_Text
.
IsEmpty
()
)
strncpy
(
Name1
,
CONV_TO_UTF8
(
m_PrefixString
),
sizeof
(
Name1
)
);
strncpy
(
Name1
,
CONV_TO_UTF8
(
m_PrefixString
),
sizeof
(
Name1
)
);
else
else
strncpy
(
Name1
,
CONV_TO_UTF8
(
m_Field
[
REFERENCE
].
m_Text
),
sizeof
(
Name1
)
);
strncpy
(
Name1
,
CONV_TO_UTF8
(
GetField
(
REFERENCE
)
->
m_Text
),
sizeof
(
Name1
)
);
}
}
for
(
ii
=
0
;
ii
<
(
int
)
strlen
(
Name1
);
ii
++
)
for
(
ii
=
0
;
ii
<
(
int
)
strlen
(
Name1
);
ii
++
)
{
{
...
@@ -870,14 +880,25 @@ bool SCH_COMPONENT::Save( FILE* f ) const
...
@@ -870,14 +880,25 @@ bool SCH_COMPONENT::Save( FILE* f ) const
}
}
}
}
for
(
i
i
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
for
(
i
nt
fieldNdx
=
0
;
fieldNdx
<
GetFieldCount
();
++
fieldNdx
)
{
{
const
SCH_CMP_FIELD
*
field
=
&
m_Field
[
ii
];
SCH_CMP_FIELD
*
field
=
GetField
(
fieldNdx
);
if
(
field
->
m_Text
.
IsEmpty
()
)
wxString
defaultName
=
ReturnDefaultFieldName
(
fieldNdx
);
// only save the field if there is a value in the field or if field name
// is different than the default field name
if
(
field
->
m_Text
.
IsEmpty
()
&&
defaultName
==
field
->
m_Name
)
continue
;
continue
;
// re-number the fields on disk so they are contiguously numbered.
// The field index is probably not needed long term.
field
->
m_FieldId
=
fieldNdx
;
if
(
!
field
->
Save
(
f
)
)
if
(
!
field
->
Save
(
f
)
)
{
{
Success
=
false
;
break
;
Success
=
false
;
break
;
}
}
}
}
...
@@ -914,9 +935,9 @@ EDA_Rect SCH_COMPONENT::GetBoundingBox()
...
@@ -914,9 +935,9 @@ EDA_Rect SCH_COMPONENT::GetBoundingBox()
EDA_Rect
bbox
=
GetBoundaryBox
();
EDA_Rect
bbox
=
GetBoundaryBox
();
// Include BoundingBoxes of fields
// Include BoundingBoxes of fields
for
(
int
ii
=
REFERENCE
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
for
(
int
ii
=
0
;
ii
<
GetFieldCount
()
;
ii
++
)
{
{
bbox
.
Merge
(
m_Field
[
ii
].
GetBoundaryBox
()
);
bbox
.
Merge
(
GetField
(
ii
)
->
GetBoundaryBox
()
);
}
}
// ... add padding
// ... add padding
...
...
eeschema/component_class.h
View file @
ff193f18
...
@@ -16,8 +16,49 @@
...
@@ -16,8 +16,49 @@
#include "class_sch_cmp_field.h"
#include "class_sch_cmp_field.h"
WX_DECLARE_OBJARRAY
(
DrawSheetPath
,
ArrayOfSheetLists
);
WX_DECLARE_OBJARRAY
(
DrawSheetPath
,
ArrayOfSheetLists
);
/**
* Struct Error
* is a holder of an error message and may be thrown from functions.
*/
struct
Error
{
wxString
errorText
;
Error
(
const
wxChar
*
aMsg
)
:
errorText
(
aMsg
)
{
}
Error
(
const
wxString
&
aMsg
)
:
errorText
(
aMsg
)
{
}
};
/* Fields identifiers */
enum
NumFieldType
{
REFERENCE
=
0
,
///< Field Reference of part, i.e. "IC21"
VALUE
,
///< Field Value of part, i.e. "3.3K"
FOOTPRINT
,
///< Field Name Module PCB, i.e. "16DIP300"
DATASHEET
,
///< name of datasheet
FIELD1
,
FIELD2
,
FIELD3
,
FIELD4
,
FIELD5
,
FIELD6
,
FIELD7
,
FIELD8
,
NUMBER_OF_FIELDS
};
/**
/**
* Class SCH_COMPONENT
* Class SCH_COMPONENT
* describes a real schematic component
* describes a real schematic component
...
@@ -33,13 +74,18 @@ public:
...
@@ -33,13 +74,18 @@ public:
wxString
m_PrefixString
;
/* C, R, U, Q etc - the first character which typically indicates what the component is.
wxString
m_PrefixString
;
/* C, R, U, Q etc - the first character which typically indicates what the component is.
* determined, upon placement, from the library component.
* determined, upon placement, from the library component.
* determined, upon file load, by the first non-digits in the reference fields. */
* determined, upon file load, by the first non-digits in the reference fields. */
SCH_CMP_FIELD
m_Field
[
NUMBER_OF_FIELDS
];
int
m_Convert
;
/* Gestion (management) des mutiples representations (ex: conversion De Morgan) */
int
m_Convert
;
/* Gestion (management) des mutiples representations (ex: conversion De Morgan) */
int
m_Transform
[
2
][
2
];
/* The rotation/mirror transformation matrix. */
int
m_Transform
[
2
][
2
];
/* The rotation/mirror transformation matrix. */
private
:
private
:
/** how many fields are fixed, or automatic and pre-made in the SCH_COMPONENT class */
typedef
std
::
vector
<
SCH_CMP_FIELD
>
SCH_CMP_FIELDS
;
SCH_CMP_FIELDS
m_Fields
;
/* Hierarchical references.
/* Hierarchical references.
* format is
* format is
* path reference multi
* path reference multi
...
@@ -51,7 +97,7 @@ private:
...
@@ -51,7 +97,7 @@ private:
wxArrayString
m_PathsAndReferences
;
wxArrayString
m_PathsAndReferences
;
public
:
public
:
SCH_COMPONENT
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
)
);
SCH_COMPONENT
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
)
,
SCH_ITEM
*
aParent
=
NULL
);
~
SCH_COMPONENT
()
{
}
~
SCH_COMPONENT
()
{
}
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
...
@@ -68,11 +114,23 @@ public:
...
@@ -68,11 +114,23 @@ public:
*/
*/
bool
Save
(
FILE
*
aFile
)
const
;
bool
Save
(
FILE
*
aFile
)
const
;
/**
* Function Load
* reads a component in from a file. The file stream must be positioned at the
* first field of the file, not at the component tag.
* @param aFile The FILE to read from.
* @throw Error containing the error message text if there is a file format
* error or if the disk read has failed.
void Load( FILE* aFile ) throw( Error );
*/
SCH_COMPONENT
*
GenCopy
();
SCH_COMPONENT
*
GenCopy
();
void
SetRotationMiroir
(
int
type
);
void
SetRotationMiroir
(
int
type
);
int
GetRotationMiroir
();
int
GetRotationMiroir
();
wxPoint
GetScreenCoord
(
const
wxPoint
&
coord
);
wxPoint
GetScreenCoord
(
const
wxPoint
&
coord
);
void
Display_Infos
(
WinEDA_DrawFrame
*
frame
);
void
Display_Infos
(
WinEDA_DrawFrame
*
frame
);
/**
/**
* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1)
* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1)
* @param aSheet: DrawSheetPath value: if NULL remove all annotations,
* @param aSheet: DrawSheetPath value: if NULL remove all annotations,
...
@@ -83,17 +141,34 @@ public:
...
@@ -83,17 +141,34 @@ public:
EDA_Rect
GetBoundaryBox
()
const
;
EDA_Rect
GetBoundaryBox
()
const
;
EDA_Rect
GetBoundingBox
();
EDA_Rect
GetBoundingBox
();
const
wxString
&
ReturnFieldName
(
int
aFieldNdx
)
const
;
/**
* Function ReturnFieldName
* returns the Field name given a field index like (REFERENCE, VALUE ..)
* @reeturn wxString - the field name or wxEmptyString if invalid field index.
*/
wxString
ReturnFieldName
(
int
aFieldNdx
)
const
;
/**
* Function GetField
* returns a field.
* @param aFieldNdx An index into the array of fields
* @return SCH_CMP_FIELD* - the field value or NULL if does not exist
*/
SCH_CMP_FIELD
*
GetField
(
int
aFieldNdx
)
const
;
/**
/**
* Function
GetFieldValue
* Function
AddField
*
returns a reference to the field value.
*
adds a field to the component. The component takes over ownership
*
@param aFieldNdx An index into the array of fields, 0 - FIELD8
*
of the field.
* @
return const wxString& - the field value or wxEmptyString
* @
param aField A const reference to the SCH_CMP_FIELD to add.
*/
*/
const
wxString
&
GetFieldValue
(
int
aFieldNdx
)
const
;
void
AddField
(
const
SCH_CMP_FIELD
&
aField
)
;
/**
* Function GetFieldCount
* returns the number of fields in this component.
*/
int
GetFieldCount
()
const
{
return
(
int
)
m_Fields
.
size
();
}
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
wxDC
*
DC
,
...
@@ -109,18 +184,24 @@ public:
...
@@ -109,18 +184,24 @@ public:
//returns a unique ID, in the form of a path.
//returns a unique ID, in the form of a path.
wxString
GetPath
(
DrawSheetPath
*
sheet
);
wxString
GetPath
(
DrawSheetPath
*
sheet
);
//returns the reference, for the given sheet path.
//returns the reference, for the given sheet path.
const
wxString
GetRef
(
DrawSheetPath
*
sheet
);
const
wxString
GetRef
(
DrawSheetPath
*
sheet
);
//Set the reference, for the given sheet path.
//Set the reference, for the given sheet path.
void
SetRef
(
DrawSheetPath
*
sheet
,
const
wxString
&
ref
);
void
SetRef
(
DrawSheetPath
*
sheet
,
const
wxString
&
ref
);
/** Function AddHierarchicalReference
* Add a full hierachical reference (path + local reference)
/**
* Function AddHierarchicalReference
* adds a full hierachical reference (path + local reference)
* @param aPath = hierarchical path (/<sheet timestamp>/component timestamp> like /05678E50/A23EF560)
* @param aPath = hierarchical path (/<sheet timestamp>/component timestamp> like /05678E50/A23EF560)
* @param aRef = local reference like C45, R56
* @param aRef = local reference like C45, R56
* @param aMulti = part selection, used in multi part per package (0 or 1 for non multi)
* @param aMulti = part selection, used in multi part per package (0 or 1 for non multi)
*/
*/
void
AddHierarchicalReference
(
const
wxString
&
aPath
,
const
wxString
&
aRef
,
int
aMulti
);
void
AddHierarchicalReference
(
const
wxString
&
aPath
,
const
wxString
&
aRef
,
int
aMulti
);
//returns the unit selection, for the given sheet path.
//returns the unit selection, for the given sheet path.
int
GetUnitSelection
(
DrawSheetPath
*
aSheet
);
int
GetUnitSelection
(
DrawSheetPath
*
aSheet
);
//Set the unit selection, for the given sheet path.
//Set the unit selection, for the given sheet path.
void
SetUnitSelection
(
DrawSheetPath
*
aSheet
,
int
aUnitSelection
);
void
SetUnitSelection
(
DrawSheetPath
*
aSheet
,
int
aUnitSelection
);
...
...
eeschema/controle.cpp
View file @
ff193f18
...
@@ -82,7 +82,7 @@ SCH_ITEM * WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Includ
...
@@ -82,7 +82,7 @@ SCH_ITEM * WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Includ
if
(
LibItem
)
if
(
LibItem
)
Affiche_1_Parametre
(
this
,
1
,
Affiche_1_Parametre
(
this
,
1
,
LibItem
->
GetRef
(
GetSheet
()),
LibItem
->
GetRef
(
GetSheet
()),
LibItem
->
m_Field
[
VALUE
].
m_Text
,
LibItem
->
GetField
(
VALUE
)
->
m_Text
,
CYAN
);
CYAN
);
// Cross probing:2 - pin found, and send a locate pin command to pcbnew (hightlight net)
// Cross probing:2 - pin found, and send a locate pin command to pcbnew (hightlight net)
...
@@ -156,7 +156,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
...
@@ -156,7 +156,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
if
(
LibItem
)
if
(
LibItem
)
Affiche_1_Parametre
(
this
,
1
,
Affiche_1_Parametre
(
this
,
1
,
LibItem
->
GetRef
(
GetSheet
()),
LibItem
->
GetRef
(
GetSheet
()),
LibItem
->
m_Field
[
VALUE
].
m_Text
,
LibItem
->
GetField
(
VALUE
)
->
m_Text
,
CYAN
);
CYAN
);
}
}
else
else
...
@@ -182,7 +182,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
...
@@ -182,7 +182,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
if
(
LibItem
)
if
(
LibItem
)
Affiche_1_Parametre
(
this
,
1
,
Affiche_1_Parametre
(
this
,
1
,
LibItem
->
GetRef
(
GetSheet
()),
LibItem
->
GetRef
(
GetSheet
()),
LibItem
->
m_Field
[
VALUE
].
m_Text
,
LibItem
->
GetField
(
VALUE
)
->
m_Text
,
CYAN
);
CYAN
);
if
(
IncludePin
==
TRUE
)
if
(
IncludePin
==
TRUE
)
return
LibItem
;
return
LibItem
;
...
...
eeschema/cross-probing.cpp
View file @
ff193f18
...
@@ -109,14 +109,14 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT
...
@@ -109,14 +109,14 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT
{
{
if
(
LibItem
==
NULL
)
if
(
LibItem
==
NULL
)
break
;
break
;
sprintf
(
Line
,
"$PART: %s"
,
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
)
);
sprintf
(
Line
,
"$PART: %s"
,
CONV_TO_UTF8
(
LibItem
->
GetField
(
REFERENCE
)
->
m_Text
)
);
SendCommand
(
MSG_TO_PCB
,
Line
);
SendCommand
(
MSG_TO_PCB
,
Line
);
}
}
break
;
break
;
case
TYPE_SCH_COMPONENT
:
case
TYPE_SCH_COMPONENT
:
LibItem
=
(
SCH_COMPONENT
*
)
objectToSync
;
LibItem
=
(
SCH_COMPONENT
*
)
objectToSync
;
sprintf
(
Line
,
"$PART: %s"
,
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
)
);
sprintf
(
Line
,
"$PART: %s"
,
CONV_TO_UTF8
(
LibItem
->
GetField
(
REFERENCE
)
->
m_Text
)
);
SendCommand
(
MSG_TO_PCB
,
Line
);
SendCommand
(
MSG_TO_PCB
,
Line
);
break
;
break
;
...
@@ -130,10 +130,10 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT
...
@@ -130,10 +130,10 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT
wxString
pinnum
;
wxString
pinnum
;
Pin
->
ReturnPinStringNum
(
pinnum
);
Pin
->
ReturnPinStringNum
(
pinnum
);
sprintf
(
Line
,
"$PIN: %s $PART: %s"
,
CONV_TO_UTF8
(
pinnum
),
sprintf
(
Line
,
"$PIN: %s $PART: %s"
,
CONV_TO_UTF8
(
pinnum
),
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
)
);
CONV_TO_UTF8
(
LibItem
->
GetField
(
REFERENCE
)
->
m_Text
)
);
}
}
else
else
sprintf
(
Line
,
"$PART: %s"
,
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
)
);
sprintf
(
Line
,
"$PART: %s"
,
CONV_TO_UTF8
(
LibItem
->
GetField
(
REFERENCE
)
->
m_Text
)
);
SendCommand
(
MSG_TO_PCB
,
Line
);
SendCommand
(
MSG_TO_PCB
,
Line
);
break
;
break
;
...
...
eeschema/edit_component_in_schematic.cpp
View file @
ff193f18
...
@@ -88,20 +88,21 @@ void WinEDA_ComponentPropertiesFrame::InitBuffers()
...
@@ -88,20 +88,21 @@ void WinEDA_ComponentPropertiesFrame::InitBuffers()
for
(
ii
=
REFERENCE
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
for
(
ii
=
REFERENCE
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
{
m_FieldName
[
ii
]
=
m_Cmp
->
ReturnFieldName
(
ii
);
m_FieldName
[
ii
]
=
m_Cmp
->
ReturnFieldName
(
ii
);
if
(
ii
==
REFERENCE
)
if
(
ii
==
REFERENCE
)
m_FieldText
[
ii
]
=
m_Cmp
->
GetRef
(
m_Parent
->
GetSheet
()
);
m_FieldText
[
ii
]
=
m_Cmp
->
GetRef
(
m_Parent
->
GetSheet
()
);
else
else
m_FieldText
[
ii
]
=
m_Cmp
->
m_Field
[
ii
].
m_Text
;
m_FieldText
[
ii
]
=
m_Cmp
->
GetField
(
ii
)
->
m_Text
;
m_FieldSize
[
ii
]
=
m_Cmp
->
m_Field
[
ii
].
m_Size
.
x
;
m_Field
Flags
[
ii
]
=
m_Field
Size
[
ii
]
=
m_Cmp
->
GetField
(
ii
)
->
m_Size
.
x
;
(
m_Cmp
->
m_Field
[
ii
].
m_Attributs
&
TEXT_NO_VISIBLE
)
?
0
:
1
;
m_FieldFlags
[
ii
]
=
(
m_Cmp
->
GetField
(
ii
)
->
m_Attributs
&
TEXT_NO_VISIBLE
)
?
0
:
1
;
m_FieldOrient
[
ii
]
=
m_Cmp
->
m_Field
[
ii
].
m_Orient
==
TEXT_ORIENT_VERT
?
1
:
0
;
m_FieldOrient
[
ii
]
=
m_Cmp
->
GetField
(
ii
)
->
m_Orient
==
TEXT_ORIENT_VERT
?
1
:
0
;
if
(
m_Cmp
->
m_Field
[
ii
].
m_Text
.
IsEmpty
()
)
if
(
m_Cmp
->
GetField
(
ii
)
->
m_Text
.
IsEmpty
()
)
continue
;
continue
;
// These values have meaning only if this field is not void:
// These values have meaning only if this field is not void:
m_FieldPosition
[
ii
]
=
m_Cmp
->
m_Field
[
ii
].
m_Pos
;
m_FieldPosition
[
ii
]
=
m_Cmp
->
GetField
(
ii
)
->
m_Pos
;
m_FieldPosition
[
ii
].
x
-=
m_Cmp
->
m_Pos
.
x
;
m_FieldPosition
[
ii
].
x
-=
m_Cmp
->
m_Pos
.
x
;
m_FieldPosition
[
ii
].
y
-=
m_Cmp
->
m_Pos
.
y
;
m_FieldPosition
[
ii
].
y
-=
m_Cmp
->
m_Pos
.
y
;
}
}
...
@@ -403,30 +404,30 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent&
...
@@ -403,30 +404,30 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent&
EDA_LibComponentStruct
*
Entry
=
FindLibPart
(
m_Cmp
->
m_ChipName
.
GetData
(
EDA_LibComponentStruct
*
Entry
=
FindLibPart
(
m_Cmp
->
m_ChipName
.
GetData
(
),
wxEmptyString
,
FIND_ROOT
);
),
wxEmptyString
,
FIND_ROOT
);
if
(
Entry
&&
(
Entry
->
m_Options
==
ENTRY_POWER
)
)
if
(
Entry
&&
(
Entry
->
m_Options
==
ENTRY_POWER
)
)
m_Cmp
->
m_Field
[
ii
].
m_Text
=
m_Cmp
->
m_ChipName
;
m_Cmp
->
GetField
(
ii
)
->
m_Text
=
m_Cmp
->
m_ChipName
;
else
if
(
!
m_FieldText
[
ii
].
IsEmpty
()
)
else
if
(
!
m_FieldText
[
ii
].
IsEmpty
()
)
{
{
m_Cmp
->
m_Field
[
ii
].
m_Text
=
m_FieldText
[
ii
];
m_Cmp
->
GetField
(
ii
)
->
m_Text
=
m_FieldText
[
ii
];
}
}
}
}
else
else
m_Cmp
->
m_Field
[
ii
].
m_Text
=
m_FieldText
[
ii
];
m_Cmp
->
GetField
(
ii
)
->
m_Text
=
m_FieldText
[
ii
];
if
(
ii
>=
FIELD1
&&
m_FieldName
[
ii
]
!=
ReturnDefaultFieldName
(
ii
)
)
if
(
ii
>=
FIELD1
&&
m_FieldName
[
ii
]
!=
ReturnDefaultFieldName
(
ii
)
)
m_Cmp
->
m_Field
[
ii
].
m_Name
=
m_FieldName
[
ii
];
m_Cmp
->
GetField
(
ii
)
->
m_Name
=
m_FieldName
[
ii
];
else
else
m_Cmp
->
m_Field
[
ii
].
m_Name
.
Empty
();
m_Cmp
->
GetField
(
ii
)
->
m_Name
.
Empty
();
m_Cmp
->
m_Field
[
ii
].
m_Size
.
x
=
m_Cmp
->
GetField
(
ii
)
->
m_Size
.
x
=
m_Cmp
->
m_Field
[
ii
].
m_Size
.
y
=
m_FieldSize
[
ii
];
m_Cmp
->
GetField
(
ii
)
->
m_Size
.
y
=
m_FieldSize
[
ii
];
if
(
m_FieldFlags
[
ii
]
)
if
(
m_FieldFlags
[
ii
]
)
m_Cmp
->
m_Field
[
ii
].
m_Attributs
&=
~
TEXT_NO_VISIBLE
;
m_Cmp
->
GetField
(
ii
)
->
m_Attributs
&=
~
TEXT_NO_VISIBLE
;
else
else
m_Cmp
->
m_Field
[
ii
].
m_Attributs
|=
TEXT_NO_VISIBLE
;
m_Cmp
->
GetField
(
ii
)
->
m_Attributs
|=
TEXT_NO_VISIBLE
;
m_Cmp
->
m_Field
[
ii
].
m_Orient
=
m_FieldOrient
[
ii
]
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
;
m_Cmp
->
GetField
(
ii
)
->
m_Orient
=
m_FieldOrient
[
ii
]
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
;
m_Cmp
->
m_Field
[
ii
].
m_Pos
=
m_FieldPosition
[
ii
];
m_Cmp
->
GetField
(
ii
)
->
m_Pos
=
m_FieldPosition
[
ii
];
m_Cmp
->
m_Field
[
ii
].
m_Pos
.
x
+=
cmp_pos
.
x
;
m_Cmp
->
GetField
(
ii
)
->
m_Pos
.
x
+=
cmp_pos
.
x
;
m_Cmp
->
m_Field
[
ii
].
m_Pos
.
y
+=
cmp_pos
.
y
;
m_Cmp
->
GetField
(
ii
)
->
m_Pos
.
y
+=
cmp_pos
.
y
;
}
}
m_Parent
->
GetScreen
()
->
SetModify
();
m_Parent
->
GetScreen
()
->
SetModify
();
...
@@ -764,10 +765,10 @@ void WinEDA_SchematicFrame::EditComponentReference( SCH_COMPONENT* Cmp, wxDC* DC
...
@@ -764,10 +765,10 @@ void WinEDA_SchematicFrame::EditComponentReference( SCH_COMPONENT* Cmp, wxDC* DC
SaveCopyInUndoList
(
Cmp
,
IS_CHANGED
);
SaveCopyInUndoList
(
Cmp
,
IS_CHANGED
);
Cmp
->
SetRef
(
GetSheet
(),
ref
);
Cmp
->
SetRef
(
GetSheet
(),
ref
);
Cmp
->
m_Field
[
REFERENCE
].
m_AddExtraText
=
flag
;
Cmp
->
GetField
(
REFERENCE
)
->
m_AddExtraText
=
flag
;
Cmp
->
m_Field
[
REFERENCE
].
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
g_XorMode
);
Cmp
->
GetField
(
REFERENCE
)
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
g_XorMode
);
Cmp
->
SetRef
(
GetSheet
(),
ref
);
Cmp
->
SetRef
(
GetSheet
(),
ref
);
Cmp
->
m_Field
[
REFERENCE
].
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
Cmp
->
GetField
(
REFERENCE
)
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
Cmp
->
m_Flags
?
g_XorMode
:
GR_DEFAULT_DRAWMODE
);
Cmp
->
m_Flags
?
g_XorMode
:
GR_DEFAULT_DRAWMODE
);
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
}
}
...
@@ -790,7 +791,7 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC )
...
@@ -790,7 +791,7 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC )
if
(
Entry
==
NULL
)
if
(
Entry
==
NULL
)
return
;
return
;
SCH_CMP_FIELD
*
TextField
=
&
Cmp
->
m_Field
[
VALUE
]
;
SCH_CMP_FIELD
*
TextField
=
Cmp
->
GetField
(
VALUE
)
;
message
=
TextField
->
m_Text
;
message
=
TextField
->
m_Text
;
if
(
Get_Message
(
_
(
"Value"
),
_
(
"Component Value"
),
message
,
this
)
)
if
(
Get_Message
(
_
(
"Value"
),
_
(
"Component Value"
),
message
,
this
)
)
...
@@ -827,35 +828,39 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC
...
@@ -827,35 +828,39 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC
if
(
Entry
==
NULL
)
if
(
Entry
==
NULL
)
return
;
return
;
SCH_CMP_FIELD
*
TextField
=
&
Cmp
->
m_Field
[
FOOTPRINT
]
;
SCH_CMP_FIELD
*
TextField
=
Cmp
->
GetField
(
FOOTPRINT
)
;
message
=
TextField
->
m_Text
;
message
=
TextField
->
m_Text
;
if
(
message
.
IsEmpty
()
)
if
(
message
.
IsEmpty
()
)
wasEmpty
=
true
;
wasEmpty
=
true
;
if
(
Get_Message
(
_
(
"Footprint"
),
_
(
"Component Footprint"
),
message
,
this
)
)
if
(
Get_Message
(
_
(
"Footprint"
),
_
(
"Component Footprint"
),
message
,
this
)
)
message
.
Empty
();
//
allow the user to remove the value.
message
.
Empty
();
//
allow the user to remove the value.
/
* save old cmp in undo list if not already in edit, or moving ... */
/
/ save old cmp in undo list if not already in edit, or moving ...
if
(
Cmp
->
m_Flags
==
0
)
if
(
Cmp
->
m_Flags
==
0
)
SaveCopyInUndoList
(
Cmp
,
IS_CHANGED
);
SaveCopyInUndoList
(
Cmp
,
IS_CHANGED
);
Cmp
->
m_Field
[
FOOTPRINT
].
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
g_XorMode
);
Cmp
->
GetField
(
FOOTPRINT
)
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
g_XorMode
);
//move the field if it was new.
if
(
wasEmpty
&&
!
message
.
IsEmpty
())
// move the field if it was new.
if
(
wasEmpty
&&
!
message
.
IsEmpty
()
)
{
{
Cmp
->
m_Field
[
FOOTPRINT
].
m_Pos
=
Cmp
->
m_Field
[
REFERENCE
].
m_Pos
;
Cmp
->
GetField
(
FOOTPRINT
)
->
m_Pos
=
Cmp
->
GetField
(
REFERENCE
)
->
m_Pos
;
//add offset here - ? suitable heuristic below?
Cmp
->
m_Field
[
FOOTPRINT
].
m_Pos
.
x
+=
// add offset here - ? suitable heuristic below?
(
Cmp
->
m_Field
[
REFERENCE
].
m_Pos
.
x
-
Cmp
->
m_Pos
.
x
)
>
0
?
Cmp
->
GetField
(
FOOTPRINT
)
->
m_Pos
.
x
+=
(
Cmp
->
m_Field
[
REFERENCE
].
m_Size
.
x
)
:
(
-
1
*
Cmp
->
m_Field
[
REFERENCE
].
m_Size
.
x
);
(
Cmp
->
GetField
(
REFERENCE
)
->
m_Pos
.
x
-
Cmp
->
m_Pos
.
x
)
>
0
?
Cmp
->
m_Field
[
FOOTPRINT
].
m_Pos
.
y
+=
(
Cmp
->
GetField
(
REFERENCE
)
->
m_Size
.
x
)
:
(
-
1
*
Cmp
->
GetField
(
REFERENCE
)
->
m_Size
.
x
);
(
Cmp
->
m_Field
[
REFERENCE
].
m_Pos
.
y
-
Cmp
->
m_Pos
.
y
)
>
0
?
(
Cmp
->
m_Field
[
REFERENCE
].
m_Size
.
y
)
:
(
-
1
*
Cmp
->
m_Field
[
REFERENCE
].
m_Size
.
y
);
Cmp
->
GetField
(
FOOTPRINT
)
->
m_Pos
.
y
+=
(
Cmp
->
GetField
(
REFERENCE
)
->
m_Pos
.
y
-
Cmp
->
m_Pos
.
y
)
>
0
?
(
Cmp
->
GetField
(
REFERENCE
)
->
m_Size
.
y
)
:
(
-
1
*
Cmp
->
GetField
(
REFERENCE
)
->
m_Size
.
y
);
Cmp
->
m_Field
[
FOOTPRINT
].
m_Orient
=
Cmp
->
m_Field
[
REFERENCE
].
m_Orient
;
Cmp
->
GetField
(
FOOTPRINT
)
->
m_Orient
=
Cmp
->
GetField
(
REFERENCE
)
->
m_Orient
;
}
}
TextField
->
m_Text
=
message
;
TextField
->
m_Text
=
message
;
Cmp
->
m_Field
[
FOOTPRINT
].
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
Cmp
->
GetField
(
FOOTPRINT
)
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
Cmp
->
m_Flags
?
g_XorMode
:
GR_DEFAULT_DRAWMODE
);
Cmp
->
m_Flags
?
g_XorMode
:
GR_DEFAULT_DRAWMODE
);
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
...
@@ -885,23 +890,23 @@ void WinEDA_ComponentPropertiesFrame::SetInitCmp( wxCommandEvent& event )
...
@@ -885,23 +890,23 @@ void WinEDA_ComponentPropertiesFrame::SetInitCmp( wxCommandEvent& event )
RedrawOneStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
m_Cmp
,
g_XorMode
);
RedrawOneStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
m_Cmp
,
g_XorMode
);
/* Mise aux valeurs par defaut des champs et orientation */
/* Mise aux valeurs par defaut des champs et orientation */
m_Cmp
->
m_Field
[
REFERENCE
].
m_Pos
.
x
=
m_Cmp
->
GetField
(
REFERENCE
)
->
m_Pos
.
x
=
Entry
->
m_Prefix
.
m_Pos
.
x
+
m_Cmp
->
m_Pos
.
x
;
Entry
->
m_Prefix
.
m_Pos
.
x
+
m_Cmp
->
m_Pos
.
x
;
m_Cmp
->
m_Field
[
REFERENCE
].
m_Pos
.
y
=
m_Cmp
->
GetField
(
REFERENCE
)
->
m_Pos
.
y
=
Entry
->
m_Prefix
.
m_Pos
.
y
+
m_Cmp
->
m_Pos
.
y
;
Entry
->
m_Prefix
.
m_Pos
.
y
+
m_Cmp
->
m_Pos
.
y
;
m_Cmp
->
m_Field
[
REFERENCE
].
m_Orient
=
Entry
->
m_Prefix
.
m_Orient
;
m_Cmp
->
GetField
(
REFERENCE
)
->
m_Orient
=
Entry
->
m_Prefix
.
m_Orient
;
m_Cmp
->
m_Field
[
REFERENCE
].
m_Size
=
Entry
->
m_Prefix
.
m_Size
;
m_Cmp
->
GetField
(
REFERENCE
)
->
m_Size
=
Entry
->
m_Prefix
.
m_Size
;
m_Cmp
->
m_Field
[
REFERENCE
].
m_HJustify
=
Entry
->
m_Prefix
.
m_HJustify
;
m_Cmp
->
GetField
(
REFERENCE
)
->
m_HJustify
=
Entry
->
m_Prefix
.
m_HJustify
;
m_Cmp
->
m_Field
[
REFERENCE
].
m_VJustify
=
Entry
->
m_Prefix
.
m_VJustify
;
m_Cmp
->
GetField
(
REFERENCE
)
->
m_VJustify
=
Entry
->
m_Prefix
.
m_VJustify
;
m_Cmp
->
m_Field
[
VALUE
].
m_Pos
.
x
=
m_Cmp
->
GetField
(
VALUE
)
->
m_Pos
.
x
=
Entry
->
m_Name
.
m_Pos
.
x
+
m_Cmp
->
m_Pos
.
x
;
Entry
->
m_Name
.
m_Pos
.
x
+
m_Cmp
->
m_Pos
.
x
;
m_Cmp
->
m_Field
[
VALUE
].
m_Pos
.
y
=
m_Cmp
->
GetField
(
VALUE
)
->
m_Pos
.
y
=
Entry
->
m_Name
.
m_Pos
.
y
+
m_Cmp
->
m_Pos
.
y
;
Entry
->
m_Name
.
m_Pos
.
y
+
m_Cmp
->
m_Pos
.
y
;
m_Cmp
->
m_Field
[
VALUE
].
m_Orient
=
Entry
->
m_Name
.
m_Orient
;
m_Cmp
->
GetField
(
VALUE
)
->
m_Orient
=
Entry
->
m_Name
.
m_Orient
;
m_Cmp
->
m_Field
[
VALUE
].
m_Size
=
Entry
->
m_Name
.
m_Size
;
m_Cmp
->
GetField
(
VALUE
)
->
m_Size
=
Entry
->
m_Name
.
m_Size
;
m_Cmp
->
m_Field
[
VALUE
].
m_HJustify
=
Entry
->
m_Name
.
m_HJustify
;
m_Cmp
->
GetField
(
VALUE
)
->
m_HJustify
=
Entry
->
m_Name
.
m_HJustify
;
m_Cmp
->
m_Field
[
VALUE
].
m_VJustify
=
Entry
->
m_Name
.
m_VJustify
;
m_Cmp
->
GetField
(
VALUE
)
->
m_VJustify
=
Entry
->
m_Name
.
m_VJustify
;
m_Cmp
->
SetRotationMiroir
(
CMP_NORMAL
);
m_Cmp
->
SetRotationMiroir
(
CMP_NORMAL
);
...
...
eeschema/eelibs_draw_components.cpp
View file @
ff193f18
...
@@ -185,7 +185,8 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -185,7 +185,8 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
bool
dummy
=
FALSE
;
bool
dummy
=
FALSE
;
if
(
(
Entry
=
FindLibPart
(
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
)
)
==
NULL
)
if
(
(
Entry
=
FindLibPart
(
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
)
)
==
NULL
)
{
/* composant non trouve, on affiche un composant "dummy" */
{
/* composant non trouve, on affiche un composant "dummy" */
dummy
=
TRUE
;
dummy
=
TRUE
;
if
(
DummyCmp
==
NULL
)
if
(
DummyCmp
==
NULL
)
CreateDummyCmp
();
CreateDummyCmp
();
...
@@ -202,26 +203,31 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -202,26 +203,31 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
* composant
* composant
*/
*/
if
(
(
(
m_Field
[
REFERENCE
].
m_Attributs
&
TEXT_NO_VISIBLE
)
==
0
)
SCH_CMP_FIELD
*
field
=
GetField
(
REFERENCE
);
&&
!
(
m_Field
[
REFERENCE
].
m_Flags
&
IS_MOVED
)
)
if
(
(
(
field
->
m_Attributs
&
TEXT_NO_VISIBLE
)
==
0
)
&&
!
(
field
->
m_Flags
&
IS_MOVED
)
)
{
{
if
(
Entry
->
m_UnitCount
>
1
)
if
(
Entry
->
m_UnitCount
>
1
)
{
{
m_Field
[
REFERENCE
].
m_AddExtraText
=
true
;
field
->
m_AddExtraText
=
true
;
m_Field
[
REFERENCE
].
Draw
(
panel
,
DC
,
offset
,
DrawMode
);
field
->
Draw
(
panel
,
DC
,
offset
,
DrawMode
);
}
}
else
else
{
{
m_Field
[
REFERENCE
].
m_AddExtraText
=
false
;
field
->
m_AddExtraText
=
false
;
m_Field
[
REFERENCE
].
Draw
(
panel
,
DC
,
offset
,
DrawMode
);
field
->
Draw
(
panel
,
DC
,
offset
,
DrawMode
);
}
}
}
}
for
(
ii
=
VALUE
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
for
(
ii
=
VALUE
;
ii
<
GetFieldCount
()
;
ii
++
)
{
{
if
(
m_Field
[
ii
].
m_Flags
&
IS_MOVED
)
field
=
GetField
(
ii
);
if
(
field
->
m_Flags
&
IS_MOVED
)
continue
;
continue
;
m_Field
[
ii
].
Draw
(
panel
,
DC
,
offset
,
DrawMode
);
field
->
Draw
(
panel
,
DC
,
offset
,
DrawMode
);
}
}
}
}
...
@@ -248,6 +254,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel,
...
@@ -248,6 +254,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel,
if
(
m_Attributs
&
TEXT_NO_VISIBLE
)
if
(
m_Attributs
&
TEXT_NO_VISIBLE
)
return
;
return
;
if
(
IsVoid
()
)
if
(
IsVoid
()
)
return
;
return
;
...
@@ -290,6 +297,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel,
...
@@ -290,6 +297,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel,
color
=
ReturnLayerColor
(
LAYER_VALUEPART
);
color
=
ReturnLayerColor
(
LAYER_VALUEPART
);
else
else
color
=
ReturnLayerColor
(
LAYER_FIELDS
);
color
=
ReturnLayerColor
(
LAYER_FIELDS
);
if
(
!
m_AddExtraText
||
(
m_FieldId
!=
REFERENCE
)
)
if
(
!
m_AddExtraText
||
(
m_FieldId
!=
REFERENCE
)
)
{
{
DrawGraphicText
(
panel
,
DC
,
pos
,
color
,
m_Text
.
GetData
(),
DrawGraphicText
(
panel
,
DC
,
pos
,
color
,
m_Text
.
GetData
(),
...
@@ -302,6 +310,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel,
...
@@ -302,6 +310,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel,
/* On ajoute alors A ou B ... a la reference */
/* On ajoute alors A ou B ... a la reference */
wxString
fulltext
=
m_Text
;
wxString
fulltext
=
m_Text
;
fulltext
.
Append
(
'A'
-
1
+
DrawLibItem
->
m_Multi
);
fulltext
.
Append
(
'A'
-
1
+
DrawLibItem
->
m_Multi
);
DrawGraphicText
(
panel
,
DC
,
pos
,
color
,
fulltext
.
GetData
(),
DrawGraphicText
(
panel
,
DC
,
pos
,
color
,
fulltext
.
GetData
(),
orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
m_Size
,
m_Size
,
...
@@ -446,13 +455,13 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -446,13 +455,13 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
int
x2
=
BoundaryBox
.
GetRight
();
int
x2
=
BoundaryBox
.
GetRight
();
int
y2
=
BoundaryBox
.
GetBottom
();
int
y2
=
BoundaryBox
.
GetBottom
();
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
BROWN
);
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
BROWN
);
BoundaryBox
=
Component
->
m_Field
[
REFERENCE
].
GetBoundaryBox
();
BoundaryBox
=
Component
->
GetField
(
REFERENCE
)
->
GetBoundaryBox
();
x1
=
BoundaryBox
.
GetX
();
x1
=
BoundaryBox
.
GetX
();
y1
=
BoundaryBox
.
GetY
();
y1
=
BoundaryBox
.
GetY
();
x2
=
BoundaryBox
.
GetRight
();
x2
=
BoundaryBox
.
GetRight
();
y2
=
BoundaryBox
.
GetBottom
();
y2
=
BoundaryBox
.
GetBottom
();
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
BROWN
);
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
x1
,
y1
,
x2
,
y2
,
BROWN
);
BoundaryBox
=
Component
->
m_Field
[
VALUE
].
GetBoundaryBox
();
BoundaryBox
=
Component
->
GetField
(
VALUE
)
->
GetBoundaryBox
();
x1
=
BoundaryBox
.
GetX
();
x1
=
BoundaryBox
.
GetX
();
y1
=
BoundaryBox
.
GetY
();
y1
=
BoundaryBox
.
GetY
();
x2
=
BoundaryBox
.
GetRight
();
x2
=
BoundaryBox
.
GetRight
();
...
...
eeschema/find.cpp
View file @
ff193f18
...
@@ -117,15 +117,15 @@ SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem(
...
@@ -117,15 +117,15 @@ SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem(
case
2
:
// find reference
case
2
:
// find reference
NotFound
=
FALSE
;
NotFound
=
FALSE
;
pos
=
pSch
->
m_Field
[
REFERENCE
].
m_Pos
;
pos
=
pSch
->
GetField
(
REFERENCE
)
->
m_Pos
;
break
;
break
;
case
3
:
// find value
case
3
:
// find value
pos
=
pSch
->
m_Pos
;
pos
=
pSch
->
m_Pos
;
if
(
text_to_find
.
CmpNoCase
(
pSch
->
m_Field
[
VALUE
].
m_Text
)
!=
0
)
if
(
text_to_find
.
CmpNoCase
(
pSch
->
GetField
(
VALUE
)
->
m_Text
)
!=
0
)
break
;
break
;
NotFound
=
FALSE
;
NotFound
=
FALSE
;
pos
=
pSch
->
m_Field
[
VALUE
].
m_Pos
;
pos
=
pSch
->
GetField
(
VALUE
)
->
m_Pos
;
break
;
break
;
}
}
}
}
...
@@ -469,13 +469,13 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
...
@@ -469,13 +469,13 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
if
(
WildCompareString
(
WildText
,
pSch
->
GetRef
(
Sheet
),
FALSE
)
)
if
(
WildCompareString
(
WildText
,
pSch
->
GetRef
(
Sheet
),
FALSE
)
)
{
{
NotFound
=
FALSE
;
NotFound
=
FALSE
;
pos
=
pSch
->
m_Field
[
REFERENCE
].
m_Pos
;
pos
=
pSch
->
GetField
(
REFERENCE
)
->
m_Pos
;
break
;
break
;
}
}
if
(
WildCompareString
(
WildText
,
pSch
->
m_Field
[
VALUE
].
m_Text
,
FALSE
)
)
if
(
WildCompareString
(
WildText
,
pSch
->
GetField
(
VALUE
)
->
m_Text
,
FALSE
)
)
{
{
NotFound
=
FALSE
;
NotFound
=
FALSE
;
pos
=
pSch
->
m_Field
[
VALUE
].
m_Pos
;
pos
=
pSch
->
GetField
(
VALUE
)
->
m_Pos
;
}
}
break
;
break
;
...
...
eeschema/getpart.cpp
View file @
ff193f18
...
@@ -186,16 +186,16 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
...
@@ -186,16 +186,16 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
DrawLibItem
->
m_Flags
=
IS_NEW
|
IS_MOVED
;
DrawLibItem
->
m_Flags
=
IS_NEW
|
IS_MOVED
;
/* Init champ Valeur */
/* Init champ Valeur */
DrawLibItem
->
m_Field
[
VALUE
].
m_Pos
.
x
=
DrawLibItem
->
GetField
(
VALUE
)
->
m_Pos
.
x
=
Entry
->
m_Name
.
m_Pos
.
x
+
DrawLibItem
->
m_Pos
.
x
;
Entry
->
m_Name
.
m_Pos
.
x
+
DrawLibItem
->
m_Pos
.
x
;
DrawLibItem
->
m_Field
[
VALUE
].
m_Pos
.
y
=
DrawLibItem
->
GetField
(
VALUE
)
->
m_Pos
.
y
=
Entry
->
m_Name
.
m_Pos
.
y
+
DrawLibItem
->
m_Pos
.
y
;
Entry
->
m_Name
.
m_Pos
.
y
+
DrawLibItem
->
m_Pos
.
y
;
DrawLibItem
->
m_Field
[
VALUE
].
m_Orient
=
Entry
->
m_Name
.
m_Orient
;
DrawLibItem
->
GetField
(
VALUE
)
->
m_Orient
=
Entry
->
m_Name
.
m_Orient
;
DrawLibItem
->
m_Field
[
VALUE
].
m_Size
=
Entry
->
m_Name
.
m_Size
;
DrawLibItem
->
GetField
(
VALUE
)
->
m_Size
=
Entry
->
m_Name
.
m_Size
;
DrawLibItem
->
m_Field
[
VALUE
].
m_Text
=
DrawLibItem
->
m_ChipName
;
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
=
DrawLibItem
->
m_ChipName
;
DrawLibItem
->
m_Field
[
VALUE
].
m_Attributs
=
Entry
->
m_Name
.
m_Attributs
;
DrawLibItem
->
GetField
(
VALUE
)
->
m_Attributs
=
Entry
->
m_Name
.
m_Attributs
;
DrawLibItem
->
m_Field
[
VALUE
].
m_HJustify
=
Entry
->
m_Name
.
m_HJustify
;
DrawLibItem
->
GetField
(
VALUE
)
->
m_HJustify
=
Entry
->
m_Name
.
m_HJustify
;
DrawLibItem
->
m_Field
[
VALUE
].
m_VJustify
=
Entry
->
m_Name
.
m_VJustify
;
DrawLibItem
->
GetField
(
VALUE
)
->
m_VJustify
=
Entry
->
m_Name
.
m_VJustify
;
msg
=
Entry
->
m_Prefix
.
m_Text
;
msg
=
Entry
->
m_Prefix
.
m_Text
;
if
(
msg
.
IsEmpty
()
)
if
(
msg
.
IsEmpty
()
)
...
@@ -206,36 +206,41 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
...
@@ -206,36 +206,41 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
DrawLibItem
->
SetRef
(
GetSheet
(),
msg
);
DrawLibItem
->
SetRef
(
GetSheet
(),
msg
);
/* Init champ Reference */
/* Init champ Reference */
DrawLibItem
->
m_Field
[
REFERENCE
].
m_Pos
.
x
=
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_Pos
.
x
=
Entry
->
m_Prefix
.
m_Pos
.
x
+
DrawLibItem
->
m_Pos
.
x
;
Entry
->
m_Prefix
.
m_Pos
.
x
+
DrawLibItem
->
m_Pos
.
x
;
DrawLibItem
->
m_Field
[
REFERENCE
].
m_Pos
.
y
=
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_Pos
.
y
=
Entry
->
m_Prefix
.
m_Pos
.
y
+
DrawLibItem
->
m_Pos
.
y
;
Entry
->
m_Prefix
.
m_Pos
.
y
+
DrawLibItem
->
m_Pos
.
y
;
DrawLibItem
->
m_Field
[
REFERENCE
].
m_Orient
=
Entry
->
m_Prefix
.
m_Orient
;
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_Orient
=
Entry
->
m_Prefix
.
m_Orient
;
DrawLibItem
->
m_Field
[
REFERENCE
].
m_Size
=
Entry
->
m_Prefix
.
m_Size
;
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_Size
=
Entry
->
m_Prefix
.
m_Size
;
DrawLibItem
->
m_PrefixString
=
Entry
->
m_Prefix
.
m_Text
;
DrawLibItem
->
m_PrefixString
=
Entry
->
m_Prefix
.
m_Text
;
DrawLibItem
->
m_Field
[
REFERENCE
].
m_Attributs
=
Entry
->
m_Prefix
.
m_Attributs
;
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_Attributs
=
Entry
->
m_Prefix
.
m_Attributs
;
DrawLibItem
->
m_Field
[
REFERENCE
].
m_HJustify
=
Entry
->
m_Prefix
.
m_HJustify
;
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_HJustify
=
Entry
->
m_Prefix
.
m_HJustify
;
DrawLibItem
->
m_Field
[
REFERENCE
].
m_VJustify
=
Entry
->
m_Prefix
.
m_VJustify
;
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_VJustify
=
Entry
->
m_Prefix
.
m_VJustify
;
/* Init des autres champs si predefinis dans la librairie */
/* Init des autres champs si predefinis dans la librairie */
for
(
Field
=
Entry
->
Fields
;
Field
!=
NULL
;
Field
=
(
LibDrawField
*
)
Field
->
Pnext
)
for
(
Field
=
Entry
->
Fields
;
Field
!=
NULL
;
Field
=
(
LibDrawField
*
)
Field
->
Pnext
)
{
{
if
(
Field
->
m_Text
.
IsEmpty
()
&&
Field
->
m_Name
.
IsEmpty
()
)
if
(
Field
->
m_Text
.
IsEmpty
()
&&
Field
->
m_Name
.
IsEmpty
()
)
continue
;
continue
;
ii
=
Field
->
m_FieldId
;
ii
=
Field
->
m_FieldId
;
if
(
ii
<
2
)
if
(
ii
<
2
)
continue
;
continue
;
if
(
ii
>=
NUMBER_OF_FIELDS
)
if
(
ii
>=
DrawLibItem
->
GetFieldCount
()
)
continue
;
continue
;
DrawLibItem
->
m_Field
[
ii
].
m_Pos
.
x
+=
Field
->
m_Pos
.
x
;
DrawLibItem
->
m_Field
[
ii
].
m_Pos
.
y
+=
Field
->
m_Pos
.
y
;
SCH_CMP_FIELD
*
f
=
DrawLibItem
->
GetField
(
ii
);
DrawLibItem
->
m_Field
[
ii
].
m_Size
=
Field
->
m_Size
;
DrawLibItem
->
m_Field
[
ii
].
m_Attributs
=
Field
->
m_Attributs
;
f
->
m_Pos
.
x
+=
Field
->
m_Pos
.
x
;
DrawLibItem
->
m_Field
[
ii
].
m_Orient
=
Field
->
m_Orient
;
f
->
m_Pos
.
y
+=
Field
->
m_Pos
.
y
;
DrawLibItem
->
m_Field
[
ii
].
m_Text
=
Field
->
m_Text
;
f
->
m_Size
=
Field
->
m_Size
;
DrawLibItem
->
m_Field
[
ii
].
m_Name
=
Field
->
m_Name
;
f
->
m_Attributs
=
Field
->
m_Attributs
;
DrawLibItem
->
m_Field
[
ii
].
m_HJustify
=
Field
->
m_HJustify
;
f
->
m_Orient
=
Field
->
m_Orient
;
DrawLibItem
->
m_Field
[
ii
].
m_VJustify
=
Field
->
m_VJustify
;
f
->
m_Text
=
Field
->
m_Text
;
f
->
m_Name
=
Field
->
m_Name
;
f
->
m_HJustify
=
Field
->
m_HJustify
;
f
->
m_VJustify
=
Field
->
m_VJustify
;
}
}
DrawStructsInGhost
(
DrawPanel
,
DC
,
DrawLibItem
,
0
,
0
);
DrawStructsInGhost
(
DrawPanel
,
DC
,
DrawLibItem
,
0
,
0
);
...
...
eeschema/load_one_schematic_file.cpp
View file @
ff193f18
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
/****************************************/
/****************************************/
#include "fctsys.h"
#include "fctsys.h"
//#include "gr_basic.h"
//#include "gr_basic.h"
#include "common.h"
#include "common.h"
...
@@ -58,7 +59,7 @@
...
@@ -58,7 +59,7 @@
/* Fonctions locales */
/* Fonctions locales */
static
int
ReadPartDescr
(
wxWindow
*
frame
,
char
*
Line
,
FILE
*
f
,
BASE_SCREEN
*
Window
);
static
int
ReadPartDescr
(
wxWindow
*
frame
,
char
*
Line
,
FILE
*
f
,
BASE_SCREEN
*
Window
);
static
int
ReadSheetDescr
(
wxWindow
*
frame
,
char
*
Line
,
FILE
*
f
,
BASE_SCREEN
*
Window
);
static
int
ReadSheetDescr
(
wxWindow
*
frame
,
char
*
Line
,
FILE
*
f
,
BASE_SCREEN
*
Window
);
static
int
ReadSchemaDescr
(
wxWindow
*
frame
,
char
*
Line
,
FILE
*
f
,
BASE_SCREEN
*
Window
);
static
int
ReadSchemaDescr
(
wxWindow
*
frame
,
char
*
Line
,
FILE
*
f
,
BASE_SCREEN
*
Window
);
static
void
LoadLayers
(
FILE
*
f
,
int
*
linecnt
);
static
void
LoadLayers
(
FILE
*
f
,
int
*
linecnt
);
...
@@ -118,20 +119,24 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -118,20 +119,24 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
fclose
(
f
);
fclose
(
f
);
return
FALSE
;
return
FALSE
;
}
}
//get the file version here. TODO: Support version numbers > 9
//get the file version here. TODO: Support version numbers > 9
char
version
=
Line
[
9
+
sizeof
(
SCHEMATIC_HEAD_STRING
)];
char
version
=
Line
[
9
+
sizeof
(
SCHEMATIC_HEAD_STRING
)];
int
ver
=
version
-
'0'
;
int
ver
=
version
-
'0'
;
if
(
ver
>
EESCHEMA_VERSION
)
if
(
ver
>
EESCHEMA_VERSION
)
{
{
MsgDiag
=
FullFileName
+
_
(
" was created by a more recent version of EESchema and may not load correctly. Please consider updating!"
);
MsgDiag
=
FullFileName
+
_
(
DisplayInfo
(
this
,
MsgDiag
);
" was created by a more recent version of EESchema and may not load correctly. Please consider updating!"
);
DisplayInfo
(
this
,
MsgDiag
);
}
}
#if 0
#if 0
// Compile it if the new versiopn is unreadable by previous eeschema versions
// Compile it if the new versiopn is unreadable by previous eeschema versions
else if
( ver < EESCHEMA_VERSION )
else if( ver < EESCHEMA_VERSION )
{
{
MsgDiag = FullFileName + _( " was created by an older version of EESchema. It will be stored in the new file format when you save this file again.");
MsgDiag = FullFileName + _(
DisplayInfo( this, MsgDiag);
" was created by an older version of EESchema. It will be stored in the new file format when you save this file again." );
DisplayInfo( this, MsgDiag );
}
}
#endif
#endif
...
@@ -201,7 +206,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -201,7 +206,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
wxT
(
"EESchema file Segment struct error at line %d, aborted"
),
wxT
(
"EESchema file Segment struct error at line %d, aborted"
),
LineCount
);
LineCount
);
Failed
=
TRUE
;
Failed
=
TRUE
;
SAFE_DELETE
(
SegmentStruct
)
;
SAFE_DELETE
(
SegmentStruct
);
break
;
break
;
}
}
...
@@ -227,6 +232,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -227,6 +232,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
if
(
Name1
[
0
]
==
'B'
)
if
(
Name1
[
0
]
==
'B'
)
ii
=
BUS_TO_BUS
;
ii
=
BUS_TO_BUS
;
RaccordStruct
=
new
DrawBusEntryStruct
(
wxPoint
(
0
,
0
),
'\\'
,
ii
);
RaccordStruct
=
new
DrawBusEntryStruct
(
wxPoint
(
0
,
0
),
'\\'
,
ii
);
LineCount
++
;
LineCount
++
;
if
(
fgets
(
Line
,
256
-
1
,
f
)
==
NULL
if
(
fgets
(
Line
,
256
-
1
,
f
)
==
NULL
||
sscanf
(
Line
,
"%d %d %d %d "
,
||
sscanf
(
Line
,
"%d %d %d %d "
,
...
@@ -237,7 +243,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -237,7 +243,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
wxT
(
"EESchema file Raccord struct error at line %d, aborted"
),
wxT
(
"EESchema file Raccord struct error at line %d, aborted"
),
LineCount
);
LineCount
);
Failed
=
TRUE
;
Failed
=
TRUE
;
SAFE_DELETE
(
RaccordStruct
)
;
SAFE_DELETE
(
RaccordStruct
);
break
;
break
;
}
}
...
@@ -281,7 +287,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -281,7 +287,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
wxT
(
"EESchema file polyline struct error at line %d, aborted"
),
wxT
(
"EESchema file polyline struct error at line %d, aborted"
),
LineCount
);
LineCount
);
Failed
=
TRUE
;
Failed
=
TRUE
;
SAFE_DELETE
(
PolylineStruct
)
;
SAFE_DELETE
(
PolylineStruct
);
break
;
break
;
}
}
}
}
...
@@ -295,6 +301,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -295,6 +301,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
case
'C'
:
/* Its a connection item. */
case
'C'
:
/* Its a connection item. */
ConnectionStruct
=
new
DrawJunctionStruct
(
wxPoint
(
0
,
0
)
);
ConnectionStruct
=
new
DrawJunctionStruct
(
wxPoint
(
0
,
0
)
);
if
(
sscanf
(
SLine
,
"%s %d %d"
,
Name1
,
if
(
sscanf
(
SLine
,
"%s %d %d"
,
Name1
,
&
ConnectionStruct
->
m_Pos
.
x
,
&
ConnectionStruct
->
m_Pos
.
x
,
&
ConnectionStruct
->
m_Pos
.
y
)
!=
3
)
&
ConnectionStruct
->
m_Pos
.
y
)
!=
3
)
...
@@ -303,7 +310,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -303,7 +310,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
wxT
(
"EESchema file connection struct error at line %d, aborted"
),
wxT
(
"EESchema file connection struct error at line %d, aborted"
),
LineCount
);
LineCount
);
Failed
=
TRUE
;
Failed
=
TRUE
;
SAFE_DELETE
(
ConnectionStruct
)
;
SAFE_DELETE
(
ConnectionStruct
);
}
}
else
else
{
{
...
@@ -323,6 +330,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -323,6 +330,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
else
else
{
{
NoConnectStruct
=
new
DrawNoConnectStruct
(
pos
);
NoConnectStruct
=
new
DrawNoConnectStruct
(
pos
);
NoConnectStruct
->
Pnext
=
screen
->
EEDrawList
;
NoConnectStruct
->
Pnext
=
screen
->
EEDrawList
;
screen
->
EEDrawList
=
NoConnectStruct
;
screen
->
EEDrawList
=
NoConnectStruct
;
}
}
...
@@ -341,6 +349,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -341,6 +349,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
char
*
text
;
char
*
text
;
char
BufLine
[
1024
];
char
BufLine
[
1024
];
MarkerStruct
=
new
DrawMarkerStruct
(
pos
,
wxEmptyString
);
MarkerStruct
=
new
DrawMarkerStruct
(
pos
,
wxEmptyString
);
ii
=
ReadDelimitedText
(
BufLine
,
Line
,
256
);
ii
=
ReadDelimitedText
(
BufLine
,
Line
,
256
);
MarkerStruct
->
m_Type
=
(
TypeMarker
)
(
(
Name1
[
0
]
&
255
)
-
'A'
);
MarkerStruct
->
m_Type
=
(
TypeMarker
)
(
(
Name1
[
0
]
&
255
)
-
'A'
);
if
(
MarkerStruct
->
m_Type
<
0
)
if
(
MarkerStruct
->
m_Type
<
0
)
...
@@ -392,14 +401,16 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -392,14 +401,16 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
if
(
Name1
[
0
]
==
'L'
)
if
(
Name1
[
0
]
==
'L'
)
{
{
SCH_LABEL
*
TextStruct
=
SCH_LABEL
*
TextStruct
=
new
SCH_LABEL
(
pos
,
CONV_FROM_UTF8
(
text
)
);
new
SCH_LABEL
(
pos
,
CONV_FROM_UTF8
(
text
)
);
TextStruct
->
m_Size
.
x
=
TextStruct
->
m_Size
.
y
=
size
;
TextStruct
->
m_Size
.
x
=
TextStruct
->
m_Size
.
y
=
size
;
TextStruct
->
m_Orient
=
orient
;
TextStruct
->
m_Orient
=
orient
;
Struct
=
TextStruct
;
Struct
=
TextStruct
;
}
}
else
if
(
Name1
[
0
]
==
'G'
&&
version
>
'1'
)
else
if
(
Name1
[
0
]
==
'G'
&&
version
>
'1'
)
{
{
SCH_GLOBALLABEL
*
TextStruct
=
new
SCH_GLOBALLABEL
(
pos
,
CONV_FROM_UTF8
(
text
)
);
SCH_GLOBALLABEL
*
TextStruct
=
new
SCH_GLOBALLABEL
(
pos
,
CONV_FROM_UTF8
(
text
)
);
Struct
=
TextStruct
;
Struct
=
TextStruct
;
TextStruct
->
m_Size
.
x
=
TextStruct
->
m_Size
.
y
=
size
;
TextStruct
->
m_Size
.
x
=
TextStruct
->
m_Size
.
y
=
size
;
TextStruct
->
m_Orient
=
orient
;
TextStruct
->
m_Orient
=
orient
;
...
@@ -413,9 +424,10 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -413,9 +424,10 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_UNSPECIFIED
]
)
==
0
)
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_UNSPECIFIED
]
)
==
0
)
TextStruct
->
m_Shape
=
NET_UNSPECIFIED
;
TextStruct
->
m_Shape
=
NET_UNSPECIFIED
;
}
}
else
if
(
(
Name1
[
0
]
==
'H'
)
||
(
Name1
[
0
]
==
'G'
&&
version
==
'1'
))
else
if
(
(
Name1
[
0
]
==
'H'
)
||
(
Name1
[
0
]
==
'G'
&&
version
==
'1'
)
)
{
//in schematic file version 1, glabels were actually hierarchal labels.
{
//in schematic file version 1, glabels were actually hierarchal labels.
SCH_HIERLABEL
*
TextStruct
=
new
SCH_HIERLABEL
(
pos
,
CONV_FROM_UTF8
(
text
)
);
SCH_HIERLABEL
*
TextStruct
=
new
SCH_HIERLABEL
(
pos
,
CONV_FROM_UTF8
(
text
)
);
Struct
=
TextStruct
;
Struct
=
TextStruct
;
TextStruct
->
m_Size
.
x
=
TextStruct
->
m_Size
.
y
=
size
;
TextStruct
->
m_Size
.
x
=
TextStruct
->
m_Size
.
y
=
size
;
TextStruct
->
m_Orient
=
orient
;
TextStruct
->
m_Orient
=
orient
;
...
@@ -432,7 +444,8 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -432,7 +444,8 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
else
else
{
{
SCH_TEXT
*
TextStruct
=
SCH_TEXT
*
TextStruct
=
new
SCH_TEXT
(
pos
,
CONV_FROM_UTF8
(
text
)
);
new
SCH_TEXT
(
pos
,
CONV_FROM_UTF8
(
text
)
);
TextStruct
->
m_Size
.
x
=
TextStruct
->
m_Size
.
y
=
size
;
TextStruct
->
m_Size
.
x
=
TextStruct
->
m_Size
.
y
=
size
;
TextStruct
->
m_Orient
=
orient
;
TextStruct
->
m_Orient
=
orient
;
Struct
=
TextStruct
;
Struct
=
TextStruct
;
...
@@ -473,7 +486,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -473,7 +486,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
screen
->
EEDrawList
=
Phead
;
screen
->
EEDrawList
=
Phead
;
#if 0 && defined(DEBUG)
#if 0 && defined
(DEBUG)
screen->Show( 0, std::cout );
screen->Show( 0, std::cout );
#endif
#endif
...
@@ -497,15 +510,16 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
...
@@ -497,15 +510,16 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
* Lit les lignes relatives a la description d'un composant en schema
* Lit les lignes relatives a la description d'un composant en schema
*/
*/
{
{
int
ii
,
fieldref
;
int
ii
;
char
Name1
[
256
],
Name2
[
256
],
char
Name1
[
256
],
Name2
[
256
],
Char1
[
256
],
Char2
[
256
],
Char3
[
256
];
Char1
[
256
],
Char2
[
256
],
Char3
[
256
];
SCH_COMPONENT
*
LibItemStruc
t
;
SCH_COMPONENT
*
componen
t
;
int
Failed
=
0
,
newfmt
=
0
;
int
Failed
=
0
,
newfmt
=
0
;
char
*
ptcar
;
char
*
ptcar
;
LibItemStruct
=
new
SCH_COMPONENT
();
component
=
new
SCH_COMPONENT
();
LibItemStruct
->
m_Convert
=
1
;
component
->
m_Convert
=
1
;
if
(
Line
[
0
]
==
'$'
)
if
(
Line
[
0
]
==
'$'
)
{
{
...
@@ -531,49 +545,60 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
...
@@ -531,49 +545,60 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
if
(
Name1
[
ii
]
==
'~'
)
if
(
Name1
[
ii
]
==
'~'
)
Name1
[
ii
]
=
' '
;
Name1
[
ii
]
=
' '
;
LibItemStruc
t
->
m_ChipName
=
CONV_FROM_UTF8
(
Name1
);
componen
t
->
m_ChipName
=
CONV_FROM_UTF8
(
Name1
);
if
(
!
newfmt
)
if
(
!
newfmt
)
LibItemStruct
->
m_Field
[
VALUE
].
m_Text
=
CONV_FROM_UTF8
(
Name1
);
component
->
GetField
(
VALUE
)
->
m_Text
=
CONV_FROM_UTF8
(
Name1
);
}
}
else
else
{
{
LibItemStruc
t
->
m_ChipName
.
Empty
();
componen
t
->
m_ChipName
.
Empty
();
LibItemStruct
->
m_Field
[
VALUE
].
m_Text
.
Empty
();
component
->
GetField
(
VALUE
)
->
m_Text
.
Empty
();
LibItemStruct
->
m_Field
[
VALUE
].
m_Orient
=
TEXT_ORIENT_HORIZ
;
component
->
GetField
(
VALUE
)
->
m_Orient
=
TEXT_ORIENT_HORIZ
;
LibItemStruct
->
m_Field
[
VALUE
].
m_Attributs
=
TEXT_NO_VISIBLE
;
component
->
GetField
(
VALUE
)
->
m_Attributs
=
TEXT_NO_VISIBLE
;
}
}
if
(
strcmp
(
Name2
,
NULL_STRING
)
!=
0
)
if
(
strcmp
(
Name2
,
NULL_STRING
)
!=
0
)
{
{
bool
isDigit
=
false
;
bool
isDigit
=
false
;
for
(
ii
=
0
;
ii
<
(
int
)
strlen
(
Name2
);
ii
++
){
for
(
ii
=
0
;
ii
<
(
int
)
strlen
(
Name2
);
ii
++
)
{
if
(
Name2
[
ii
]
==
'~'
)
if
(
Name2
[
ii
]
==
'~'
)
Name2
[
ii
]
=
' '
;
Name2
[
ii
]
=
' '
;
//get RefBase from this, too. store in Name1.
if
(
Name2
[
ii
]
>=
'0'
&&
Name2
[
ii
]
<=
'9'
){
// get RefBase from this, too. store in Name1.
if
(
Name2
[
ii
]
>=
'0'
&&
Name2
[
ii
]
<=
'9'
)
{
isDigit
=
true
;
isDigit
=
true
;
Name1
[
ii
]
=
0
;
//null-terminate.
Name1
[
ii
]
=
0
;
//null-terminate.
}
}
if
(
!
isDigit
){
if
(
!
isDigit
)
{
Name1
[
ii
]
=
Name2
[
ii
];
Name1
[
ii
]
=
Name2
[
ii
];
}
}
}
}
Name1
[
ii
]
=
0
;
//just in case
Name1
[
ii
]
=
0
;
//just in case
int
jj
;
int
jj
;
for
(
jj
=
0
;
jj
<
ii
&&
Name1
[
jj
]
==
' '
;
jj
++
);
for
(
jj
=
0
;
jj
<
ii
&&
Name1
[
jj
]
==
' '
;
jj
++
)
if
(
jj
==
ii
){
;
//blank string.
LibItemStruct
->
m_PrefixString
=
wxT
(
"U"
);
if
(
jj
==
ii
)
}
else
{
{
LibItemStruct
->
m_PrefixString
=
CONV_FROM_UTF8
(
&
Name1
[
jj
]);
// blank string.
//printf("prefix: %s\n", CONV_TO_UTF8(LibItemStruct->m_PrefixString));
component
->
m_PrefixString
=
wxT
(
"U"
);
}
else
{
component
->
m_PrefixString
=
CONV_FROM_UTF8
(
&
Name1
[
jj
]
);
//printf("prefix: %s\n", CONV_TO_UTF8(component->m_PrefixString));
}
}
if
(
!
newfmt
)
if
(
!
newfmt
)
LibItemStruct
->
m_Field
[
REFERENCE
].
m_Text
=
CONV_FROM_UTF8
(
Name2
);
component
->
GetField
(
REFERENCE
)
->
m_Text
=
CONV_FROM_UTF8
(
Name2
);
}
}
else
else
{
{
LibItemStruct
->
m_Field
[
REFERENCE
].
m_Attributs
=
TEXT_NO_VISIBLE
;
component
->
GetField
(
REFERENCE
)
->
m_Attributs
=
TEXT_NO_VISIBLE
;
}
}
/* Traitement des autres lignes de description */
/* Traitement des autres lignes de description */
...
@@ -592,70 +617,68 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
...
@@ -592,70 +617,68 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
LineCount
++
;
LineCount
++
;
if
(
fgets
(
Line
,
256
-
1
,
f
)
==
NULL
)
if
(
fgets
(
Line
,
256
-
1
,
f
)
==
NULL
)
return
TRUE
;
return
TRUE
;
if
(
(
Line
[
0
]
!=
'F'
)
&&
(
Line
[
0
]
!=
'P'
)
&&
(
Line
[
0
]
!=
'A'
)
&&
(
Line
[
0
]
!=
'U'
)
)
break
;
if
(
Line
[
0
]
==
'U'
)
/* Lecture num multi, conversion et time stamp */
if
(
Line
[
0
]
==
'U'
)
/* Lecture num multi, conversion et time stamp */
{
{
sscanf
(
Line
+
1
,
"%d %d %lX"
,
sscanf
(
Line
+
1
,
"%d %d %lX"
,
&
LibItemStruct
->
m_Multi
,
&
LibItemStruc
t
->
m_Convert
,
&
component
->
m_Multi
,
&
componen
t
->
m_Convert
,
&
LibItemStruc
t
->
m_TimeStamp
);
&
componen
t
->
m_TimeStamp
);
}
}
if
(
Line
[
0
]
==
'P'
)
else
if
(
Line
[
0
]
==
'P'
)
{
{
sscanf
(
Line
+
1
,
"%d %d"
,
sscanf
(
Line
+
1
,
"%d %d"
,
&
LibItemStruct
->
m_Pos
.
x
,
&
LibItemStruc
t
->
m_Pos
.
y
);
&
component
->
m_Pos
.
x
,
&
componen
t
->
m_Pos
.
y
);
}
}
if
(
Line
[
0
]
==
'A'
&&
Line
[
1
]
==
'R'
)
else
if
(
Line
[
0
]
==
'A'
&&
Line
[
1
]
==
'R'
)
{
{
/*format:
/*
format:
AR Path="/9086AF6E/67452AA0" Ref="C99" Part="1"
*
AR Path="/9086AF6E/67452AA0" Ref="C99" Part="1"
where 9086AF6E is the unique timestamp of the containing sheet
*
where 9086AF6E is the unique timestamp of the containing sheet
and 67452AA0 is the timestamp of this component.
*
and 67452AA0 is the timestamp of this component.
C99 is the reference given this path.
*
C99 is the reference given this path.
*/
*/
int
ii
;
int
ii
;
ptcar
=
Line
+
2
;
ptcar
=
Line
+
2
;
//copy the path.
//copy the path.
ii
=
ReadDelimitedText
(
Name1
,
ptcar
,
255
);
ii
=
ReadDelimitedText
(
Name1
,
ptcar
,
255
);
ptcar
+=
ii
+
1
;
ptcar
+=
ii
+
1
;
wxString
path
=
CONV_FROM_UTF8
(
Name1
);
wxString
path
=
CONV_FROM_UTF8
(
Name1
);
// copy the reference
// copy the reference
ii
=
ReadDelimitedText
(
Name1
,
ptcar
,
255
);
ii
=
ReadDelimitedText
(
Name1
,
ptcar
,
255
);
ptcar
+=
ii
+
1
;
ptcar
+=
ii
+
1
;
wxString
ref
=
CONV_FROM_UTF8
(
Name1
);
wxString
ref
=
CONV_FROM_UTF8
(
Name1
);
// copy the multi, if exists
// copy the multi, if exists
ii
=
ReadDelimitedText
(
Name1
,
ptcar
,
255
);
ii
=
ReadDelimitedText
(
Name1
,
ptcar
,
255
);
if
(
Name1
[
0
]
==
0
)
// Nothing read, put a default value
if
(
Name1
[
0
]
==
0
)
// Nothing read, put a default value
sprintf
(
Name1
,
"%d"
,
LibItemStruct
->
m_Multi
);
sprintf
(
Name1
,
"%d"
,
component
->
m_Multi
);
int
multi
=
atoi
(
Name1
);
int
multi
=
atoi
(
Name1
);
if
(
multi
<
0
||
multi
>
25
)
multi
=
1
;
if
(
multi
<
0
||
multi
>
25
)
LibItemStruct
->
AddHierarchicalReference
(
path
,
ref
,
multi
);
multi
=
1
;
LibItemStruct
->
m_Field
[
REFERENCE
].
m_Text
=
ref
;
component
->
AddHierarchicalReference
(
path
,
ref
,
multi
);
component
->
GetField
(
REFERENCE
)
->
m_Text
=
ref
;
}
}
if
(
Line
[
0
]
==
'F'
)
else
if
(
Line
[
0
]
==
'F'
)
{
{
int
fieldNdx
;
char
FieldUserName
[
1024
];
char
FieldUserName
[
1024
];
int
hjustify
=
GR_TEXT_HJUSTIFY_CENTER
;
int
hjustify
=
GR_TEXT_HJUSTIFY_CENTER
;
int
vjustify
=
GR_TEXT_VJUSTIFY_CENTER
;
int
vjustify
=
GR_TEXT_VJUSTIFY_CENTER
;
wxString
fieldName
;
FieldUserName
[
0
]
=
0
;
FieldUserName
[
0
]
=
0
;
sscanf
(
Line
+
1
,
"%d"
,
&
fieldref
);
if
(
fieldref
>=
NUMBER_OF_FIELDS
)
{
MsgDiag
.
Printf
(
wxT
(
"Component Field number error at line %d, aborted"
),
LineCount
);
return
TRUE
;
}
/* Lecture du champ */
/* Lecture du champ */
ptcar
=
Line
;
while
(
*
ptcar
&&
(
*
ptcar
!=
'"'
)
)
ptcar
=
Line
;
while
(
*
ptcar
&&
(
*
ptcar
!=
'"'
)
)
ptcar
++
;
ptcar
++
;
if
(
*
ptcar
!=
'"'
)
if
(
*
ptcar
!=
'"'
)
...
@@ -676,22 +699,49 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
...
@@ -676,22 +699,49 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
LineCount
);
LineCount
);
return
TRUE
;
return
TRUE
;
}
}
if
(
*
ptcar
==
'"'
)
if
(
*
ptcar
==
'"'
)
{
{
Name1
[
ii
]
=
0
;
ptcar
++
;
Name1
[
ii
]
=
0
;
ptcar
++
;
break
;
break
;
}
}
}
}
if
(
LibItemStruct
->
m_Field
[
fieldref
].
m_Text
.
IsEmpty
()
)
fieldNdx
=
atoi
(
Line
+
2
);
LibItemStruct
->
m_Field
[
fieldref
].
m_Text
=
CONV_FROM_UTF8
(
Name1
);
ReadDelimitedText
(
FieldUserName
,
ptcar
,
sizeof
(
FieldUserName
)
);
if
(
0
==
strlen
(
FieldUserName
)
)
fieldName
=
ReturnDefaultFieldName
(
fieldNdx
);
else
fieldName
=
CONV_FROM_UTF8
(
FieldUserName
);
D
(
printf
(
"FiledUserName=
\"
%s
\"\n
"
,
FieldUserName
);)
if
(
fieldNdx
>=
component
->
GetFieldCount
()
)
{
// add as many fields as needed so the m_FieldId's are contiguous, no gaps.
while
(
fieldNdx
>=
component
->
GetFieldCount
()
)
{
int
newNdx
=
component
->
GetFieldCount
();
SCH_CMP_FIELD
f
(
wxPoint
(
0
,
0
),
newNdx
,
component
,
fieldName
);
component
->
AddField
(
f
);
}
}
else
{
component
->
GetField
(
fieldNdx
)
->
m_Name
=
fieldName
;
}
component
->
GetField
(
fieldNdx
)
->
m_Text
=
CONV_FROM_UTF8
(
Name1
);
/* Lecture des coordonnees */
if
(
(
ii
=
sscanf
(
ptcar
,
"%s %d %d %d %X %s %s"
,
Char1
,
if
(
(
ii
=
sscanf
(
ptcar
,
"%s %d %d %d %X %s %s"
,
Char1
,
&
LibItemStruct
->
m_Field
[
fieldref
].
m_Pos
.
x
,
&
component
->
GetField
(
fieldNdx
)
->
m_Pos
.
x
,
&
LibItemStruct
->
m_Field
[
fieldref
].
m_Pos
.
y
,
&
component
->
GetField
(
fieldNdx
)
->
m_Pos
.
y
,
&
LibItemStruct
->
m_Field
[
fieldref
].
m_Size
.
x
,
&
component
->
GetField
(
fieldNdx
)
->
m_Size
.
x
,
&
LibItemStruct
->
m_Field
[
fieldref
].
m_Attributs
,
&
component
->
GetField
(
fieldNdx
)
->
m_Attributs
,
Char2
,
Char3
)
)
<
4
)
Char2
,
Char3
)
)
<
4
)
{
{
MsgDiag
.
Printf
(
MsgDiag
.
Printf
(
...
@@ -701,13 +751,15 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
...
@@ -701,13 +751,15 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
continue
;
continue
;
}
}
ReadDelimitedText
(
FieldUserName
,
ptcar
,
sizeof
(
FieldUserName
)
);
if
(
(
component
->
GetField
(
fieldNdx
)
->
m_Size
.
x
==
0
)
||
(
ii
==
4
)
)
if
(
(
LibItemStruct
->
m_Field
[
fieldref
].
m_Size
.
x
==
0
)
||
(
ii
==
4
)
)
component
->
GetField
(
fieldNdx
)
->
m_Size
.
x
=
DEFAULT_SIZE_TEXT
;
LibItemStruct
->
m_Field
[
fieldref
].
m_Size
.
x
=
DEFAULT_SIZE_TEXT
;
LibItemStruct
->
m_Field
[
fieldref
].
m_Orient
=
TEXT_ORIENT_HORIZ
;
component
->
GetField
(
fieldNdx
)
->
m_Orient
=
TEXT_ORIENT_HORIZ
;
LibItemStruct
->
m_Field
[
fieldref
].
m_Size
.
y
=
LibItemStruct
->
m_Field
[
fieldref
].
m_Size
.
x
;
component
->
GetField
(
fieldNdx
)
->
m_Size
.
y
=
component
->
GetField
(
fieldNdx
)
->
m_Size
.
x
;
if
(
Char1
[
0
]
==
'V'
)
if
(
Char1
[
0
]
==
'V'
)
LibItemStruct
->
m_Field
[
fieldref
].
m_Orient
=
TEXT_ORIENT_VERT
;
component
->
GetField
(
fieldNdx
)
->
m_Orient
=
TEXT_ORIENT_VERT
;
if
(
ii
>=
7
)
if
(
ii
>=
7
)
{
{
if
(
*
Char2
==
'L'
)
if
(
*
Char2
==
'L'
)
...
@@ -718,25 +770,23 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
...
@@ -718,25 +770,23 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
vjustify
=
GR_TEXT_VJUSTIFY_BOTTOM
;
vjustify
=
GR_TEXT_VJUSTIFY_BOTTOM
;
else
if
(
*
Char3
==
'T'
)
else
if
(
*
Char3
==
'T'
)
vjustify
=
GR_TEXT_VJUSTIFY_TOP
;
vjustify
=
GR_TEXT_VJUSTIFY_TOP
;
LibItemStruct
->
m_Field
[
fieldref
].
m_HJustify
=
hjustify
;
LibItemStruct
->
m_Field
[
fieldref
].
m_VJustify
=
vjustify
;
}
if
(
fieldref
>=
FIELD1
)
component
->
GetField
(
fieldNdx
)
->
m_HJustify
=
hjustify
;
{
component
->
GetField
(
fieldNdx
)
->
m_VJustify
=
vjustify
;
LibItemStruct
->
m_Field
[
fieldref
].
m_Name
=
CONV_FROM_UTF8
(
FieldUserName
);
}
}
if
(
field
ref
==
REFERENCE
)
if
(
field
Ndx
==
REFERENCE
)
if
(
LibItemStruct
->
m_Field
[
fieldref
].
m_Text
[
0
]
==
'#'
)
if
(
component
->
GetField
(
fieldNdx
)
->
m_Text
[
0
]
==
'#'
)
LibItemStruct
->
m_Field
[
fieldref
].
m_Attributs
|=
TEXT_NO_VISIBLE
;
component
->
GetField
(
fieldNdx
)
->
m_Attributs
|=
TEXT_NO_VISIBLE
;
}
}
else
break
;
}
}
/* Lecture multi et position du composant */
/* Lecture multi et position du composant */
if
(
sscanf
(
Line
,
"%d %d %d"
,
if
(
sscanf
(
Line
,
"%d %d %d"
,
&
LibItemStruc
t
->
m_Multi
,
&
componen
t
->
m_Multi
,
&
LibItemStruct
->
m_Pos
.
x
,
&
LibItemStruc
t
->
m_Pos
.
y
)
!=
3
)
&
component
->
m_Pos
.
x
,
&
componen
t
->
m_Pos
.
y
)
!=
3
)
{
{
MsgDiag
.
Printf
(
MsgDiag
.
Printf
(
wxT
(
"Component unit & pos error at line %d, aborted"
),
wxT
(
"Component unit & pos error at line %d, aborted"
),
...
@@ -749,10 +799,10 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
...
@@ -749,10 +799,10 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
LineCount
++
;
LineCount
++
;
if
(
(
fgets
(
Line
,
256
-
1
,
f
)
==
NULL
)
if
(
(
fgets
(
Line
,
256
-
1
,
f
)
==
NULL
)
||
(
sscanf
(
Line
,
"%d %d %d %d"
,
||
(
sscanf
(
Line
,
"%d %d %d %d"
,
&
LibItemStruc
t
->
m_Transform
[
0
][
0
],
&
componen
t
->
m_Transform
[
0
][
0
],
&
LibItemStruc
t
->
m_Transform
[
0
][
1
],
&
componen
t
->
m_Transform
[
0
][
1
],
&
LibItemStruc
t
->
m_Transform
[
1
][
0
],
&
componen
t
->
m_Transform
[
1
][
0
],
&
LibItemStruc
t
->
m_Transform
[
1
][
1
]
)
!=
4
)
)
&
componen
t
->
m_Transform
[
1
][
1
]
)
!=
4
)
)
{
{
MsgDiag
.
Printf
(
MsgDiag
.
Printf
(
wxT
(
"Component orient error at line %d, aborted"
),
wxT
(
"Component orient error at line %d, aborted"
),
...
@@ -777,9 +827,9 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
...
@@ -777,9 +827,9 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
if
(
!
Failed
)
if
(
!
Failed
)
{
{
LibItemStruct
->
Pnext
=
Window
->
EEDrawList
;
component
->
Pnext
=
Window
->
EEDrawList
;
Window
->
EEDrawList
=
LibItemStruc
t
;
Window
->
EEDrawList
=
componen
t
;
LibItemStruc
t
->
m_Parent
=
Window
;
componen
t
->
m_Parent
=
Window
;
}
}
return
Failed
;
/* Fin lecture 1 composant */
return
Failed
;
/* Fin lecture 1 composant */
...
@@ -794,7 +844,7 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
...
@@ -794,7 +844,7 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
* Lit les lignes relatives a la description d'une feuille de hierarchie
* Lit les lignes relatives a la description d'une feuille de hierarchie
*/
*/
{
{
int
ii
,
fieldref
,
size
;
int
ii
,
fieldNdx
,
size
;
char
Name1
[
256
],
Char1
[
256
],
Char2
[
256
];
char
Name1
[
256
],
Char1
[
256
],
Char2
[
256
];
DrawSheetStruct
*
SheetStruct
;
DrawSheetStruct
*
SheetStruct
;
Hierarchical_PIN_Sheet_Struct
*
SheetLabelStruct
,
*
OldSheetLabel
=
NULL
;
Hierarchical_PIN_Sheet_Struct
*
SheetLabelStruct
,
*
OldSheetLabel
=
NULL
;
...
@@ -802,7 +852,9 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
...
@@ -802,7 +852,9 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
char
*
ptcar
;
char
*
ptcar
;
SheetStruct
=
new
DrawSheetStruct
();
SheetStruct
=
new
DrawSheetStruct
();
SheetStruct
->
m_TimeStamp
=
GetTimeStamp
();
SheetStruct
->
m_TimeStamp
=
GetTimeStamp
();
//sheets are added to the EEDrawList like other schematic components.
//sheets are added to the EEDrawList like other schematic components.
//however, in order to preserve the heirarchy (through m_Parent pointers),
//however, in order to preserve the heirarchy (through m_Parent pointers),
//a duplicate of the sheet is added to m_SubSheet array.
//a duplicate of the sheet is added to m_SubSheet array.
...
@@ -838,18 +890,19 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
...
@@ -838,18 +890,19 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
LineCount
++
;
LineCount
++
;
if
(
fgets
(
Line
,
256
-
1
,
f
)
==
NULL
)
if
(
fgets
(
Line
,
256
-
1
,
f
)
==
NULL
)
return
TRUE
;
return
TRUE
;
if
(
Line
[
0
]
==
'U'
){
if
(
Line
[
0
]
==
'U'
)
{
sscanf
(
Line
+
1
,
"%lX"
,
&
(
SheetStruct
->
m_TimeStamp
)
);
sscanf
(
Line
+
1
,
"%lX"
,
&
(
SheetStruct
->
m_TimeStamp
)
);
if
(
SheetStruct
->
m_TimeStamp
==
0
)
//zero is not unique!
if
(
SheetStruct
->
m_TimeStamp
==
0
)
//zero is not unique!
SheetStruct
->
m_TimeStamp
=
GetTimeStamp
();
SheetStruct
->
m_TimeStamp
=
GetTimeStamp
();
continue
;
continue
;
}
}
if
(
Line
[
0
]
!=
'F'
)
if
(
Line
[
0
]
!=
'F'
)
break
;
break
;
sscanf
(
Line
+
1
,
"%d"
,
&
field
ref
);
sscanf
(
Line
+
1
,
"%d"
,
&
field
Ndx
);
/* Lecture du champ :
/* Lecture du champ :
* si field
ref
>= 2 : Fn "texte" t s posx posy
* si field
Ndx
>= 2 : Fn "texte" t s posx posy
* sinon F0 "texte" pour sheetname
* sinon F0 "texte" pour sheetname
* et F1 "texte" pour filename */
* et F1 "texte" pour filename */
...
@@ -860,7 +913,7 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
...
@@ -860,7 +913,7 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
{
{
MsgDiag
.
Printf
(
MsgDiag
.
Printf
(
wxT
(
" ** EESchema file sheet label F%d at line %d, aborted"
),
wxT
(
" ** EESchema file sheet label F%d at line %d, aborted"
),
field
ref
,
LineCount
);
field
Ndx
,
LineCount
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -880,7 +933,7 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
...
@@ -880,7 +933,7 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
}
}
}
}
if
(
(
field
ref
==
0
)
||
(
fieldref
==
1
)
)
if
(
(
field
Ndx
==
0
)
||
(
fieldNdx
==
1
)
)
{
{
if
(
sscanf
(
ptcar
,
"%d"
,
&
size
)
!=
1
)
if
(
sscanf
(
ptcar
,
"%d"
,
&
size
)
!=
1
)
{
{
...
@@ -891,23 +944,26 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
...
@@ -891,23 +944,26 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
}
}
if
(
size
==
0
)
if
(
size
==
0
)
size
=
DEFAULT_SIZE_TEXT
;
size
=
DEFAULT_SIZE_TEXT
;
if
(
field
ref
==
0
)
if
(
field
Ndx
==
0
)
{
{
SheetStruct
->
m_SheetName
=
CONV_FROM_UTF8
(
Name1
);
SheetStruct
->
m_SheetName
=
CONV_FROM_UTF8
(
Name1
);
SheetStruct
->
m_SheetNameSize
=
size
;
SheetStruct
->
m_SheetNameSize
=
size
;
}
}
else
else
{
{
SheetStruct
->
SetFileName
(
CONV_FROM_UTF8
(
Name1
));
SheetStruct
->
SetFileName
(
CONV_FROM_UTF8
(
Name1
)
);
//printf("in ReadSheetDescr : SheetStruct->m_FileName = %s \n", Name1);
//printf("in ReadSheetDescr : SheetStruct->m_FileName = %s \n", Name1);
SheetStruct
->
m_FileNameSize
=
size
;
SheetStruct
->
m_FileNameSize
=
size
;
}
}
}
}
if
(
field
ref
>
1
)
if
(
field
Ndx
>
1
)
{
{
SheetLabelStruct
=
new
Hierarchical_PIN_Sheet_Struct
(
SheetStruct
,
SheetLabelStruct
=
new
Hierarchical_PIN_Sheet_Struct
(
SheetStruct
,
wxPoint
(
0
,
0
),
CONV_FROM_UTF8
(
Name1
)
);
wxPoint
(
0
,
0
),
CONV_FROM_UTF8
(
Name1
)
);
if
(
SheetStruct
->
m_Label
==
NULL
)
if
(
SheetStruct
->
m_Label
==
NULL
)
OldSheetLabel
=
SheetStruct
->
m_Label
=
SheetLabelStruct
;
OldSheetLabel
=
SheetStruct
->
m_Label
=
SheetLabelStruct
;
else
else
...
...
eeschema/locate.cpp
View file @
ff193f18
...
@@ -422,19 +422,21 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
...
@@ -422,19 +422,21 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
if
(
SearchMask
&
FIELDCMPITEM
)
if
(
SearchMask
&
FIELDCMPITEM
)
{
{
SCH_CMP_FIELD
*
Field
;
SCH_COMPONENT
*
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
SCH_COMPONENT
*
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
for
(
i
=
REFERENCE
;
i
<
NUMBER_OF_FIELDS
;
i
++
)
for
(
i
=
REFERENCE
;
i
<
DrawLibItem
->
GetFieldCount
()
;
i
++
)
{
{
Field
=
&
DrawLibItem
->
m_Field
[
i
];
SCH_CMP_FIELD
*
field
=
DrawLibItem
->
GetField
(
i
);
if
(
(
Field
->
m_Attributs
&
TEXT_NO_VISIBLE
)
)
if
(
field
->
m_Attributs
&
TEXT_NO_VISIBLE
)
continue
;
continue
;
if
(
Field
->
IsVoid
()
)
if
(
field
->
IsVoid
()
)
continue
;
continue
;
EDA_Rect
BoundaryBox
=
Field
->
GetBoundaryBox
();
EDA_Rect
BoundaryBox
=
field
->
GetBoundaryBox
();
if
(
BoundaryBox
.
Inside
(
x
,
y
)
)
if
(
BoundaryBox
.
Inside
(
x
,
y
)
)
{
{
LastSnappedStruct
=
F
ield
;
LastSnappedStruct
=
f
ield
;
return
TRUE
;
return
TRUE
;
}
}
}
}
...
...
eeschema/netform.cpp
View file @
ff193f18
...
@@ -297,9 +297,9 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
...
@@ -297,9 +297,9 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
break
;
// No component left
break
;
// No component left
FootprintName
.
Empty
();
FootprintName
.
Empty
();
if
(
!
Component
->
m_Field
[
FOOTPRINT
].
IsVoid
()
)
if
(
!
Component
->
GetField
(
FOOTPRINT
)
->
IsVoid
()
)
{
{
FootprintName
=
Component
->
m_Field
[
FOOTPRINT
].
m_Text
;
FootprintName
=
Component
->
GetField
(
FOOTPRINT
)
->
m_Text
;
FootprintName
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
FootprintName
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
}
}
...
@@ -310,7 +310,7 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
...
@@ -310,7 +310,7 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
Line
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
Line
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
fprintf
(
tmpfile
,
CONV_TO_UTF8
(
Line
)
);
fprintf
(
tmpfile
,
CONV_TO_UTF8
(
Line
)
);
Line
=
Component
->
m_Field
[
VALUE
].
m_Text
;
Line
=
Component
->
GetField
(
VALUE
)
->
m_Text
;
Line
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
Line
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
fprintf
(
tmpfile
,
"Value=%s
\n
"
,
CONV_TO_UTF8
(
Line
)
);
fprintf
(
tmpfile
,
"Value=%s
\n
"
,
CONV_TO_UTF8
(
Line
)
);
...
@@ -496,7 +496,7 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
...
@@ -496,7 +496,7 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
}
}
}
}
fprintf
(
f
,
" %s
\n
"
,
CONV_TO_UTF8
(
Component
->
m_Field
[
VALUE
].
m_Text
)
);
fprintf
(
f
,
" %s
\n
"
,
CONV_TO_UTF8
(
Component
->
GetField
(
VALUE
)
->
m_Text
)
);
}
}
}
}
...
@@ -587,9 +587,9 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
...
@@ -587,9 +587,9 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
}
}
}
}
if
(
!
Component
->
m_Field
[
FOOTPRINT
].
IsVoid
()
)
if
(
!
Component
->
GetField
(
FOOTPRINT
)
->
IsVoid
()
)
{
{
FootprintName
=
Component
->
m_Field
[
FOOTPRINT
].
m_Text
;
FootprintName
=
Component
->
GetField
(
FOOTPRINT
)
->
m_Text
;
FootprintName
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
FootprintName
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
}
}
else
else
...
@@ -601,7 +601,7 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
...
@@ -601,7 +601,7 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
CONV_TO_UTF8
(
FootprintName
)
);
CONV_TO_UTF8
(
FootprintName
)
);
fprintf
(
f
,
" %s"
,
CONV_TO_UTF8
(
Line
)
);
fprintf
(
f
,
" %s"
,
CONV_TO_UTF8
(
Line
)
);
Line
=
Component
->
m_Field
[
VALUE
].
m_Text
;
Line
=
Component
->
GetField
(
VALUE
)
->
m_Text
;
Line
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
Line
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
fprintf
(
f
,
" %s"
,
CONV_TO_UTF8
(
Line
)
);
fprintf
(
f
,
" %s"
,
CONV_TO_UTF8
(
Line
)
);
...
@@ -968,9 +968,9 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
...
@@ -968,9 +968,9 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
if
(
Component
==
NULL
)
if
(
Component
==
NULL
)
break
;
break
;
if
(
!
Component
->
m_Field
[
FOOTPRINT
].
IsVoid
()
)
if
(
!
Component
->
GetField
(
FOOTPRINT
)
->
IsVoid
()
)
{
{
FootprintName
=
Component
->
m_Field
[
FOOTPRINT
].
m_Text
;
FootprintName
=
Component
->
GetField
(
FOOTPRINT
)
->
m_Text
;
FootprintName
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
FootprintName
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
}
}
else
else
...
@@ -980,7 +980,7 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
...
@@ -980,7 +980,7 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
fprintf
(
f
,
"%s "
,
CONV_TO_UTF8
(
StartCmpDesc
)
);
fprintf
(
f
,
"%s "
,
CONV_TO_UTF8
(
StartCmpDesc
)
);
fprintf
(
f
,
"%s"
,
CONV_TO_UTF8
(
msg
)
);
fprintf
(
f
,
"%s"
,
CONV_TO_UTF8
(
msg
)
);
msg
=
Component
->
m_Field
[
VALUE
].
m_Text
;
msg
=
Component
->
GetField
(
VALUE
)
->
m_Text
;
msg
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
msg
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
fprintf
(
f
,
"
\"
%s
\"
"
,
CONV_TO_UTF8
(
msg
)
);
fprintf
(
f
,
"
\"
%s
\"
"
,
CONV_TO_UTF8
(
msg
)
);
fprintf
(
f
,
"
\n
"
);
fprintf
(
f
,
"
\n
"
);
...
...
eeschema/onrightclick.cpp
View file @
ff193f18
...
@@ -271,7 +271,7 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
...
@@ -271,7 +271,7 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
if
(
!
Component
->
m_Flags
)
if
(
!
Component
->
m_Flags
)
{
{
msg
=
_
(
"Move Component"
);
msg
=
_
(
"Move Component"
);
msg
<<
wxT
(
" "
)
<<
Component
->
GetField
Value
(
REFERENCE
)
;
msg
<<
wxT
(
" "
)
<<
Component
->
GetField
(
REFERENCE
)
->
m_Text
;
msg
=
AddHotkeyName
(
msg
,
s_Schematic_Hokeys_Descr
,
HK_MOVE_COMPONENT
);
msg
=
AddHotkeyName
(
msg
,
s_Schematic_Hokeys_Descr
,
HK_MOVE_COMPONENT
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_SCH_MOVE_CMP_REQUEST
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_SCH_MOVE_CMP_REQUEST
,
msg
,
move_xpm
);
msg
,
move_xpm
);
...
...
eeschema/plot.cpp
View file @
ff193f18
...
@@ -375,23 +375,23 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
...
@@ -375,23 +375,23 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
{
{
wxPoint
textpos
;
/* Position des textes */
wxPoint
textpos
;
/* Position des textes */
SCH_CMP_FIELD
*
Field
=
&
DrawLibItem
->
m_Field
[
FieldNumber
]
;
SCH_CMP_FIELD
*
field
=
DrawLibItem
->
GetField
(
FieldNumber
)
;
int
hjustify
,
vjustify
;
int
hjustify
,
vjustify
;
int
orient
,
color
=
-
1
;
int
orient
,
color
=
-
1
;
if
(
(
g_PlotFormat
==
PLOT_FORMAT_POST
)
&&
g_PlotPSColorOpt
)
if
(
(
g_PlotFormat
==
PLOT_FORMAT_POST
)
&&
g_PlotPSColorOpt
)
color
=
ReturnLayerColor
(
F
ield
->
GetLayer
()
);
color
=
ReturnLayerColor
(
f
ield
->
GetLayer
()
);
DrawMode
=
0
;
/* Unused */
DrawMode
=
0
;
/* Unused */
if
(
F
ield
->
m_Attributs
&
TEXT_NO_VISIBLE
)
if
(
f
ield
->
m_Attributs
&
TEXT_NO_VISIBLE
)
return
;
return
;
if
(
F
ield
->
IsVoid
()
)
if
(
f
ield
->
IsVoid
()
)
return
;
return
;
/* Calcul de la position des textes, selon orientation du composant */
/* Calcul de la position des textes, selon orientation du composant */
orient
=
F
ield
->
m_Orient
;
orient
=
f
ield
->
m_Orient
;
hjustify
=
Field
->
m_HJustify
;
vjustify
=
F
ield
->
m_VJustify
;
hjustify
=
field
->
m_HJustify
;
vjustify
=
f
ield
->
m_VJustify
;
textpos
=
F
ield
->
m_Pos
-
DrawLibItem
->
m_Pos
;
// textpos is the text position relative to the component anchor
textpos
=
f
ield
->
m_Pos
-
DrawLibItem
->
m_Pos
;
// textpos is the text position relative to the component anchor
textpos
=
TransformCoordinate
(
DrawLibItem
->
m_Transform
,
textpos
)
+
DrawLibItem
->
m_Pos
;
textpos
=
TransformCoordinate
(
DrawLibItem
->
m_Transform
,
textpos
)
+
DrawLibItem
->
m_Pos
;
...
@@ -423,20 +423,20 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
...
@@ -423,20 +423,20 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
//not sure what to do here in terms of plotting components that may have multiple REFERENCE entries.
//not sure what to do here in terms of plotting components that may have multiple REFERENCE entries.
if
(
!
IsMulti
||
(
FieldNumber
!=
REFERENCE
)
)
if
(
!
IsMulti
||
(
FieldNumber
!=
REFERENCE
)
)
{
{
PlotGraphicText
(
g_PlotFormat
,
textpos
,
color
,
F
ield
->
m_Text
,
PlotGraphicText
(
g_PlotFormat
,
textpos
,
color
,
f
ield
->
m_Text
,
orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
F
ield
->
m_Size
,
f
ield
->
m_Size
,
hjustify
,
vjustify
);
hjustify
,
vjustify
);
}
}
else
/* We plt the reference, for a multiple parts per package */
else
/* We plt the reference, for a multiple parts per package */
{
{
/* Adding A, B ... to the reference */
/* Adding A, B ... to the reference */
wxString
Text
;
wxString
Text
;
Text
=
F
ield
->
m_Text
;
Text
=
f
ield
->
m_Text
;
Text
.
Append
(
'A'
-
1
+
DrawLibItem
->
m_Multi
);
Text
.
Append
(
'A'
-
1
+
DrawLibItem
->
m_Multi
);
PlotGraphicText
(
g_PlotFormat
,
textpos
,
color
,
Text
,
PlotGraphicText
(
g_PlotFormat
,
textpos
,
color
,
Text
,
orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
F
ield
->
m_Size
,
hjustify
,
vjustify
);
f
ield
->
m_Size
,
hjustify
,
vjustify
);
}
}
}
}
...
...
eeschema/protos.h
View file @
ff193f18
...
@@ -8,7 +8,7 @@ LibEDA_BaseStruct * LocatePin(const wxPoint & RefPos,
...
@@ -8,7 +8,7 @@ LibEDA_BaseStruct * LocatePin(const wxPoint & RefPos,
int
Unit
,
int
Convert
,
SCH_COMPONENT
*
DrawItem
=
NULL
);
int
Unit
,
int
Convert
,
SCH_COMPONENT
*
DrawItem
=
NULL
);
/* Routine de localisation d'une PIN de la PartLib pointee par Entry */
/* Routine de localisation d'une PIN de la PartLib pointee par Entry */
const
wxString
&
ReturnDefaultFieldName
(
int
aFieldNdx
);
wxString
ReturnDefaultFieldName
(
int
aFieldNdx
);
/****************/
/****************/
...
...
include/base_struct.h
View file @
ff193f18
...
@@ -474,10 +474,11 @@ typedef enum {
...
@@ -474,10 +474,11 @@ typedef enum {
#define DEFAULT_SIZE_TEXT 60
/* default text height (in mils or 1/1000") */
#define DEFAULT_SIZE_TEXT 60
/* default text height (in mils or 1/1000") */
/** class EDA_TextStruct
/**
* basic class to handle texts (labels, texts on components or footprints ..)
* Class EDA_TextStruct
* is a basic class to handle texts (labels, texts on components or footprints ..)
* not used directly.
* not used directly.
*
t
he text classes are derived from EDA_BaseStruct and EDA_TextStruct
*
T
he text classes are derived from EDA_BaseStruct and EDA_TextStruct
*/
*/
class
EDA_TextStruct
class
EDA_TextStruct
{
{
...
@@ -492,7 +493,8 @@ public:
...
@@ -492,7 +493,8 @@ public:
int
m_CharType
;
/* normal, bold, italic ... */
int
m_CharType
;
/* normal, bold, italic ... */
int
m_HJustify
,
m_VJustify
;
/* Horiz and Vert Justifications */
int
m_HJustify
,
m_VJustify
;
/* Horiz and Vert Justifications */
int
m_ZoomLevelDrawable
;
/* zoom level to draw text.
int
m_ZoomLevelDrawable
;
/* zoom level to draw text.
* if zoom < m_ZoomLevelDrawable: the text is drawn as a single line */
* if zoom < m_ZoomLevelDrawable: the text is drawn as a single line
*/
int
*
m_TextDrawings
;
/* list of segments to draw, for the Draw function */
int
*
m_TextDrawings
;
/* list of segments to draw, for the Draw function */
int
m_TextDrawingsSize
;
/* segment count */
int
m_TextDrawingsSize
;
/* segment count */
...
@@ -503,10 +505,12 @@ public:
...
@@ -503,10 +505,12 @@ public:
int
GetLength
()
const
{
return
m_Text
.
Length
();
};
int
GetLength
()
const
{
return
m_Text
.
Length
();
};
/** Function Pitch()
/**
* @return distance between 2 caracteres
* Function Pitch
* @return distance between 2 characters
*/
*/
int
Pitch
();
int
Pitch
();
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
color
,
const
wxPoint
&
offset
,
int
color
,
int
draw_mode
,
int
display_mode
=
FILAIRE
,
int
anchor_color
=
-
1
);
int
draw_mode
,
int
display_mode
=
FILAIRE
,
int
anchor_color
=
-
1
);
...
...
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