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
5bccc872
Commit
5bccc872
authored
Mar 01, 2010
by
bennett78
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes Bugs item #2960683
better use of wxString
parent
ea4f81a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
31 deletions
+35
-31
build_BOM.cpp
eeschema/build_BOM.cpp
+35
-31
No files found.
eeschema/build_BOM.cpp
View file @
5bccc872
...
...
@@ -800,17 +800,18 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart(
{
int
qty
=
1
;
char
RefName
[
256
];
char
ValName
[
256
];
char
NxtName
[
256
];
wxString
ValName
,
NxtName
;
char
RNames
[
2000
];
wxArrayString
cmpFields
;
EDA_BaseStruct
*
DrawList
;
EDA_BaseStruct
*
NxtList
;
SCH_COMPONENT
*
DrawLibItem
;
SCH_COMPONENT
*
NxtLibItem
;
SCH_COMPONENT
*
m_Cmp
;
SCH_COMPONENT
Cmp
;
strcpy
(
NxtName
,
""
);
NxtName
=
wxT
(
""
);
strcpy
(
RNames
,
""
);
m_Cmp
=
&
Cmp
;
for
(
unsigned
ii
=
0
;
ii
<
aList
.
size
();
ii
++
)
{
...
...
@@ -822,6 +823,16 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart(
if
(
aList
[
ii
].
m_Reference
[
0
]
==
'#'
)
continue
;
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
if
(
(
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
.
IsEmpty
())
)
continue
;
// m_Cmp = DrawLibItem->GenCopy();
// Store fields. try to store non empty fields.
for
(
int
jj
=
FOOTPRINT
;
jj
<
DrawLibItem
->
GetFieldCount
();
jj
++
)
{
if
(
!
DrawLibItem
->
GetField
(
jj
)
->
m_Text
.
IsEmpty
()
)
m_Cmp
->
GetField
(
jj
)
->
m_Text
=
DrawLibItem
->
GetField
(
jj
)
->
m_Text
;
}
NxtLibItem
=
NULL
;
for
(
unsigned
ij
=
ii
+
1
;
ij
<
aList
.
size
();
ij
++
)
...
...
@@ -834,52 +845,45 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart(
if
(
aList
[
ij
].
m_Reference
[
0
]
==
'#'
)
continue
;
NxtLibItem
=
(
SCH_COMPONENT
*
)
NxtList
;
if
(
(
NxtLibItem
->
GetField
(
VALUE
)
->
m_Text
.
IsEmpty
())
)
{
continue
;
}
break
;
}
sprintf
(
RefName
,
"%s"
,
aList
[
ii
].
m_Reference
);
sprintf
(
ValName
,
"%s"
,
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
)
);
if
(
NxtLibItem
)
sprintf
(
NxtName
,
"%s"
,
CONV_TO_UTF8
(
NxtLibItem
->
GetField
(
VALUE
)
->
m_Text
)
);
if
(
NxtLibItem
!=
NULL
)
NxtName
=
NxtLibItem
->
GetField
(
VALUE
)
->
m_Text
;
else
NxtName
[
0
]
=
0
;
NxtName
=
wxT
(
""
)
;
sprintf
(
RefName
,
"%s"
,
aList
[
ii
].
m_Reference
);
ValName
=
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
;
// Store fields. try to find and store non empty fields.
int
needed_size
=
DrawLibItem
->
GetFieldCount
()
-
cmpFields
.
GetCount
();
if
(
needed_size
>
0
)
cmpFields
.
Add
(
wxEmptyString
,
needed_size
);
for
(
int
jj
=
FIELD1
;
jj
<
DrawLibItem
->
GetFieldCount
();
jj
++
)
{
if
(
cmpFields
[
jj
].
IsEmpty
()
)
cmpFields
[
jj
]
=
DrawLibItem
->
GetField
(
jj
)
->
m_Text
;
}
if
(
!
strcmp
(
NxtName
,
ValName
)
)
{
if
(
!
NxtName
.
CmpNoCase
(
ValName
))
{
qty
++
;
strcat
(
RNames
,
", "
);
strcat
(
RNames
,
RefName
);
continue
;
continue
;
}
fprintf
(
f
,
"%
-15s%c%-3d"
,
ValName
,
s_ExportSeparatorSymbol
,
qty
);
fprintf
(
f
,
"%
15s%c%3d"
,
CONV_TO_UTF8
(
ValName
)
,
s_ExportSeparatorSymbol
,
qty
);
qty
=
1
;
if
(
m_AddFootprintField
->
IsChecked
()
)
fprintf
(
f
,
"%c%
-16
s"
,
s_ExportSeparatorSymbol
,
fprintf
(
f
,
"%c%
15
s"
,
s_ExportSeparatorSymbol
,
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
FOOTPRINT
)
->
m_Text
)
);
fprintf
(
f
,
"%c%-20s"
,
s_ExportSeparatorSymbol
,
CONV_TO_UTF8
(
cmpFields
[
FIELD1
])
);
fprintf
(
f
,
"%c%-20s"
,
s_ExportSeparatorSymbol
,
CONV_TO_UTF8
(
cmpFields
[
FIELD2
])
);
fprintf
(
f
,
"%c%-20s"
,
s_ExportSeparatorSymbol
,
CONV_TO_UTF8
(
cmpFields
[
FIELD3
])
);
cmpFields
.
Clear
();
// for( int jj = FIELD1; jj < DrawLibItem->GetFieldCount(); jj++ )
for
(
int
jj
=
FIELD1
;
jj
<
FIELD5
;
jj
++
)
fprintf
(
f
,
"%c%12s"
,
s_ExportSeparatorSymbol
,
CONV_TO_UTF8
(
m_Cmp
->
GetField
(
jj
)
->
m_Text
)
);
fprintf
(
f
,
"%c%s%s"
,
s_ExportSeparatorSymbol
,
RefName
,
RNames
);
strcpy
(
RNames
,
""
);
fputs
(
"
\n
"
,
f
);
strcpy
(
RNames
,
""
);
for
(
int
jj
=
FOOTPRINT
;
jj
<
DrawLibItem
->
GetFieldCount
();
jj
++
)
m_Cmp
->
GetField
(
jj
)
->
m_Text
=
wxT
(
""
);
}
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment