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
cd3b3b33
Commit
cd3b3b33
authored
Mar 11, 2011
by
Andrey Fedorushkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eeschema: add russian GOST compact form BOM output
parent
018292a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
108 additions
and
7 deletions
+108
-7
dialog_build_BOM.cpp
eeschema/dialogs/dialog_build_BOM.cpp
+104
-7
dialog_build_BOM.h
eeschema/dialogs/dialog_build_BOM.h
+4
-0
No files found.
eeschema/dialogs/dialog_build_BOM.cpp
View file @
cd3b3b33
...
...
@@ -542,38 +542,68 @@ order = Alphab. ) count = %d\n\n" ),
fclose
(
f
);
}
#if defined(KICAD_GOST)
wxString
DIALOG_BUILD_BOM
::
PrintFieldData
(
SCH_COMPONENT
*
DrawLibItem
,
#else
void
DIALOG_BUILD_BOM
::
PrintFieldData
(
FILE
*
f
,
SCH_COMPONENT
*
DrawLibItem
,
#endif
bool
CompactForm
)
{
int
ii
;
#if defined(KICAD_GOST)
wxString
outStr
;
wxString
tmpStr
;
#endif
if
(
IsFieldChecked
(
FOOTPRINT
)
)
{
if
(
CompactForm
)
{
#if defined(KICAD_GOST)
outStr
.
Printf
(
wxT
(
"%c%s"
),
s_ExportSeparatorSymbol
,
GetChars
(
DrawLibItem
->
GetField
(
FOOTPRINT
)
->
m_Text
)
);
#else
fprintf
(
f
,
"%c%s"
,
s_ExportSeparatorSymbol
,
TO_UTF8
(
DrawLibItem
->
GetField
(
FOOTPRINT
)
->
m_Text
)
);
#endif
}
else
{
#if defined(KICAD_GOST)
outStr
.
Printf
(
wxT
(
"; %-12s"
),
GetChars
(
DrawLibItem
->
GetField
(
FOOTPRINT
)
->
m_Text
)
);
#else
fprintf
(
f
,
"; %-12s"
,
TO_UTF8
(
DrawLibItem
->
GetField
(
FOOTPRINT
)
->
m_Text
)
);
#endif
}
}
for
(
ii
=
FIELD1
;
ii
<
DrawLibItem
->
GetFieldCount
();
ii
++
)
for
(
int
ii
=
FIELD1
;
ii
<
DrawLibItem
->
GetFieldCount
();
ii
++
)
{
if
(
!
IsFieldChecked
(
ii
)
)
continue
;
if
(
CompactForm
)
#if defined(KICAD_GOST)
tmpStr
.
Printf
(
wxT
(
"%c%s"
),
s_ExportSeparatorSymbol
,
GetChars
(
DrawLibItem
->
GetField
(
ii
)
->
m_Text
)
);
#else
fprintf
(
f
,
"%c%s"
,
s_ExportSeparatorSymbol
,
TO_UTF8
(
DrawLibItem
->
GetField
(
ii
)
->
m_Text
)
);
#endif
else
#if defined(KICAD_GOST)
tmpStr
.
Printf
(
wxT
(
"; %-12s"
),
GetChars
(
DrawLibItem
->
GetField
(
ii
)
->
m_Text
)
);
outStr
+=
tmpStr
;
#else
fprintf
(
f
,
"; %-12s"
,
TO_UTF8
(
DrawLibItem
->
GetField
(
ii
)
->
m_Text
)
);
#endif
}
#if defined(KICAD_GOST)
return
outStr
;
#endif
}
...
...
@@ -628,6 +658,13 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
std
::
string
CmpName
;
wxString
subRef
;
#if defined(KICAD_GOST)
wxString
strCur
;
wxString
strPred
;
int
amount
=
0
;
std
::
string
CmpNameFirst
;
std
::
string
CmpNameLast
;
#endif
// Print list of items
for
(
unsigned
ii
=
0
;
ii
<
aList
.
GetCount
();
ii
++
)
...
...
@@ -660,9 +697,9 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
if
(
CompactForm
)
#if defined(KICAD_GOST)
fprintf
(
f
,
"%s%c%s%c%s"
,
CmpName
.
c_str
(
),
s_ExportSeparatorSymbol
,
TO_UTF8
(
comp
->
GetField
(
VALUE
)
->
m_Text
),
s_ExportSeparatorSymbol
,
TO_UTF8
(
comp
->
GetField
(
DATASHEET
)
->
m_Text
)
);
strCur
.
Printf
(
wxT
(
"%c%s%c%s"
),
s_ExportSeparatorSymbol
,
GetChars
(
comp
->
GetField
(
VALUE
)
->
m_Text
),
s_ExportSeparatorSymbol
,
GetChars
(
comp
->
GetField
(
DATASHEET
)
->
m_Text
)
);
#else
fprintf
(
f
,
"%s%c%s"
,
CmpName
.
c_str
(),
s_ExportSeparatorSymbol
,
TO_UTF8
(
comp
->
GetField
(
VALUE
)
->
m_Text
)
);
...
...
@@ -687,10 +724,16 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
{
if
(
CompactForm
)
{
#if defined(KICAD_GOST)
strCur
.
Printf
(
wxT
(
"%c%s"
),
s_ExportSeparatorSymbol
,
GetChars
(
msg
)
);
msg
=
m_Parent
->
GetXYSheetReferences
(
screen
,
comp
->
m_Pos
);
strCur
.
Printf
(
wxT
(
"%c%s)"
),
s_ExportSeparatorSymbol
,
GetChars
(
msg
)
);
#else
fprintf
(
f
,
"%c%s"
,
s_ExportSeparatorSymbol
,
TO_UTF8
(
msg
)
);
msg
=
m_Parent
->
GetXYSheetReferences
(
screen
,
comp
->
m_Pos
);
fprintf
(
f
,
"%c%s)"
,
s_ExportSeparatorSymbol
,
TO_UTF8
(
msg
)
);
#endif
}
else
{
...
...
@@ -701,9 +744,44 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
}
}
#if defined(KICAD_GOST)
wxString
tmpStr
=
PrintFieldData
(
comp
,
CompactForm
);
strCur
+=
tmpStr
;
if
(
CompactForm
)
{
if
(
strPred
.
Len
()
==
0
)
CmpNameFirst
=
CmpName
;
else
{
if
(
!
strCur
.
IsSameAs
(
strPred
)
)
{
switch
(
amount
)
{
case
1
:
fprintf
(
f
,
"%s%s%c%d
\n
"
,
CmpNameFirst
.
c_str
(),
TO_UTF8
(
strPred
),
s_ExportSeparatorSymbol
,
amount
);
break
;
case
2
:
fprintf
(
f
,
"%s,%s%s%c%d
\n
"
,
CmpNameFirst
.
c_str
(),
CmpNameLast
.
c_str
(),
TO_UTF8
(
strPred
),
s_ExportSeparatorSymbol
,
amount
);
break
;
default
:
fprintf
(
f
,
"%s..%s%s%c%d
\n
"
,
CmpNameFirst
.
c_str
(),
CmpNameLast
.
c_str
(),
TO_UTF8
(
strPred
),
s_ExportSeparatorSymbol
,
amount
);
break
;
}
CmpNameFirst
=
CmpName
;
amount
=
0
;
}
}
strPred
=
strCur
;
CmpNameLast
=
CmpName
;
amount
++
;
}
else
{
fprintf
(
f
,
"%s"
,
TO_UTF8
(
tmpStr
)
);
fprintf
(
f
,
"
\n
"
);
}
#else
PrintFieldData
(
f
,
comp
,
CompactForm
);
fprintf
(
f
,
"
\n
"
);
#endif
}
if
(
!
CompactForm
)
...
...
@@ -712,6 +790,21 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
fputs
(
TO_UTF8
(
msg
),
f
);
}
#if defined(KICAD_GOST)
else
{
switch
(
amount
)
{
case
1
:
fprintf
(
f
,
"%s%s%c%d
\n
"
,
CmpNameFirst
.
c_str
(),
TO_UTF8
(
strPred
),
s_ExportSeparatorSymbol
,
amount
);
break
;
case
2
:
fprintf
(
f
,
"%s,%s%s%c%d
\n
"
,
CmpNameFirst
.
c_str
(),
CmpNameLast
.
c_str
(),
TO_UTF8
(
strPred
),
s_ExportSeparatorSymbol
,
amount
);
break
;
default
:
fprintf
(
f
,
"%s..%s%s%c%d
\n
"
,
CmpNameFirst
.
c_str
(),
CmpNameLast
.
c_str
(),
TO_UTF8
(
strPred
),
s_ExportSeparatorSymbol
,
amount
);
break
;
}
}
#endif
return
0
;
}
...
...
@@ -925,7 +1018,11 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
}
}
#if defined(KICAD_GOST)
fprintf
(
f
,
"%s"
,
TO_UTF8
(
PrintFieldData
(
DrawLibItem
)
)
);
#else
PrintFieldData
(
f
,
DrawLibItem
);
#endif
fputs
(
"
\n
"
,
f
);
}
...
...
eeschema/dialogs/dialog_build_BOM.h
View file @
cd3b3b33
...
...
@@ -55,7 +55,11 @@ private:
int
PrintComponentsListByPart
(
FILE
*
f
,
SCH_REFERENCE_LIST
&
aList
,
bool
aIncludeSubComponents
);
#if defined(KICAD_GOST)
wxString
PrintFieldData
(
SCH_COMPONENT
*
DrawLibItem
,
bool
CompactForm
=
FALSE
);
#else
void
PrintFieldData
(
FILE
*
f
,
SCH_COMPONENT
*
DrawLibItem
,
bool
CompactForm
=
FALSE
);
#endif
bool
IsFieldChecked
(
int
aFieldId
);
...
...
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