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
f21e24f2
Commit
f21e24f2
authored
Dec 10, 2008
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code cleanup, better comments and comments translation
parent
6c01c554
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
123 additions
and
187 deletions
+123
-187
build_BOM.cpp
eeschema/build_BOM.cpp
+118
-184
dialog_build_BOM.h
eeschema/dialog_build_BOM.h
+2
-2
libarch.cpp
eeschema/libarch.cpp
+3
-1
No files found.
eeschema/build_BOM.cpp
View file @
f21e24f2
...
@@ -32,6 +32,7 @@ class LABEL_OBJECT
...
@@ -32,6 +32,7 @@ class LABEL_OBJECT
public
:
public
:
int
m_LabelType
;
int
m_LabelType
;
SCH_ITEM
*
m_Label
;
SCH_ITEM
*
m_Label
;
//have to store it here since the object references will be duplicated.
//have to store it here since the object references will be duplicated.
DrawSheetPath
m_SheetPath
;
//composed of UIDs
DrawSheetPath
m_SheetPath
;
//composed of UIDs
...
@@ -47,20 +48,19 @@ public:
...
@@ -47,20 +48,19 @@ public:
// Filename extension for BOM list
// Filename extension for BOM list
#define EXT_LIST wxT( ".lst" )
#define EXT_LIST wxT( ".lst" )
// Exported functions
int
BuildComponentsListFromSchematic
(
OBJ_CMP_TO_LIST
*
aList
);
/* fonctions locales */
/* Local functions */
static
int
GenListeGLabels
(
std
::
vector
<
LABEL_OBJECT
>&
aList
);
static
void
BuildComponentsListFromSchematic
(
std
::
vector
<
OBJ_CMP_TO_LIST
>&
aList
);
static
int
ListTriComposantByRef
(
OBJ_CMP_TO_LIST
*
obj1
,
OBJ_CMP_TO_LIST
*
obj2
);
static
void
GenListeGLabels
(
std
::
vector
<
LABEL_OBJECT
>&
aList
);
static
int
ListTriComposantByVal
(
OBJ_CMP_TO_LIST
*
obj1
,
OBJ_CMP_TO_LIST
*
obj2
);
static
bool
SortComponentsByReference
(
const
OBJ_CMP_TO_LIST
&
obj1
,
const
OBJ_CMP_TO_LIST
&
obj2
);
static
bool
SortComponentsByValue
(
const
OBJ_CMP_TO_LIST
&
obj1
,
const
OBJ_CMP_TO_LIST
&
obj2
);
static
bool
SortLabelsByValue
(
const
LABEL_OBJECT
&
obj1
,
const
LABEL_OBJECT
&
obj2
);
static
bool
SortLabelsByValue
(
const
LABEL_OBJECT
&
obj1
,
const
LABEL_OBJECT
&
obj2
);
static
bool
SortLabelsBySheet
(
const
LABEL_OBJECT
&
obj1
,
const
LABEL_OBJECT
&
obj2
);
static
bool
SortLabelsBySheet
(
const
LABEL_OBJECT
&
obj1
,
const
LABEL_OBJECT
&
obj2
);
static
void
DeleteSubCmp
(
OBJ_CMP_TO_LIST
*
aList
,
int
aItemCoun
t
);
static
void
DeleteSubCmp
(
std
::
vector
<
OBJ_CMP_TO_LIST
>&
aLis
t
);
static
int
PrintListeGLabel
(
FILE
*
f
,
std
::
vector
<
LABEL_OBJECT
>&
aList
);
static
int
PrintListeGLabel
(
FILE
*
f
,
std
::
vector
<
LABEL_OBJECT
>&
aList
);
int
RefDesStringCompare
(
c
har
*
obj1
,
char
*
obj2
);
int
RefDesStringCompare
(
c
onst
char
*
obj1
,
const
char
*
obj2
);
int
SplitString
(
wxString
strToSplit
,
int
SplitString
(
wxString
strToSplit
,
wxString
*
strBeginning
,
wxString
*
strBeginning
,
wxString
*
strDigits
,
wxString
*
strDigits
,
...
@@ -135,8 +135,6 @@ void WinEDA_Build_BOM_Frame::CreateExportList( const wxString& aFullFileName,
...
@@ -135,8 +135,6 @@ void WinEDA_Build_BOM_Frame::CreateExportList( const wxString& aFullFileName,
*/
*/
{
{
FILE
*
f
;
FILE
*
f
;
OBJ_CMP_TO_LIST
*
aList
;
int
itemCount
;
wxString
msg
;
wxString
msg
;
/* Creation de la liste des elements */
/* Creation de la liste des elements */
...
@@ -148,30 +146,17 @@ void WinEDA_Build_BOM_Frame::CreateExportList( const wxString& aFullFileName,
...
@@ -148,30 +146,17 @@ void WinEDA_Build_BOM_Frame::CreateExportList( const wxString& aFullFileName,
return
;
return
;
}
}
itemCount
=
BuildComponentsListFromSchematic
(
NULL
);
std
::
vector
<
OBJ_CMP_TO_LIST
>
cmplist
;
if
(
itemCount
)
BuildComponentsListFromSchematic
(
cmplist
);
{
aList
=
(
OBJ_CMP_TO_LIST
*
)
MyZMalloc
(
itemCount
*
sizeof
(
OBJ_CMP_TO_LIST
)
);
if
(
aList
==
NULL
)
{
fclose
(
f
);
return
;
}
BuildComponentsListFromSchematic
(
aList
);
/* sort component list */
/* sort component list */
qsort
(
aList
,
itemCount
,
sizeof
(
OBJ_CMP_TO_LIST
),
sort
(
cmplist
.
begin
(),
cmplist
.
end
(),
SortComponentsByReference
);
(
int
(
*
)
(
const
void
*
,
const
void
*
)
)
ListTriComposantByRef
);
if
(
!
aIncludeSubComponents
)
if
(
!
aIncludeSubComponents
)
DeleteSubCmp
(
aList
,
itemCoun
t
);
DeleteSubCmp
(
cmplis
t
);
/* create the file */
/* create the file */
PrintComponentsListByRef
(
f
,
aList
,
itemCount
,
TRUE
,
aIncludeSubComponents
);
PrintComponentsListByRef
(
f
,
cmplist
,
TRUE
,
aIncludeSubComponents
);
MyFree
(
aList
);
}
fclose
(
f
);
fclose
(
f
);
}
}
...
@@ -188,7 +173,6 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& aFullFileName,
...
@@ -188,7 +173,6 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& aFullFileName,
*/
*/
{
{
FILE
*
f
;
FILE
*
f
;
OBJ_CMP_TO_LIST
*
list
;
int
itemCount
;
int
itemCount
;
char
Line
[
1024
];
char
Line
[
1024
];
wxString
msg
;
wxString
msg
;
...
@@ -201,43 +185,31 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& aFullFileName,
...
@@ -201,43 +185,31 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& aFullFileName,
return
;
return
;
}
}
itemCount
=
BuildComponentsListFromSchematic
(
NULL
);
std
::
vector
<
OBJ_CMP_TO_LIST
>
cmplist
;
BuildComponentsListFromSchematic
(
cmplist
);
itemCount
=
cmplist
.
size
();
if
(
itemCount
)
if
(
itemCount
)
{
{
list
=
(
OBJ_CMP_TO_LIST
*
)
MyZMalloc
(
itemCount
*
sizeof
(
OBJ_CMP_TO_LIST
)
);
/* creates the list file */
if
(
list
==
NULL
)
// Error memory alloc
{
fclose
(
f
);
return
;
}
BuildComponentsListFromSchematic
(
list
);
/* generation du fichier listing */
DateAndTime
(
Line
);
DateAndTime
(
Line
);
wxString
Title
=
g_Main_Title
+
wxT
(
" "
)
+
GetBuildVersion
();
wxString
Title
=
g_Main_Title
+
wxT
(
" "
)
+
GetBuildVersion
();
fprintf
(
f
,
"%s >> Creation date: %s
\n
"
,
CONV_TO_UTF8
(
Title
),
Line
);
fprintf
(
f
,
"%s >> Creation date: %s
\n
"
,
CONV_TO_UTF8
(
Title
),
Line
);
/* Tri et impression de la liste des composants */
/* sort component list */
sort
(
cmplist
.
begin
(),
cmplist
.
end
(),
SortComponentsByReference
);
qsort
(
list
,
itemCount
,
sizeof
(
OBJ_CMP_TO_LIST
),
(
int
(
*
)
(
const
void
*
,
const
void
*
)
)
ListTriComposantByRef
);
if
(
!
aIncludeSubComponents
)
if
(
!
aIncludeSubComponents
)
DeleteSubCmp
(
list
,
itemCoun
t
);
DeleteSubCmp
(
cmplis
t
);
if
(
m_ListCmpbyRefItems
->
GetValue
()
)
if
(
m_ListCmpbyRefItems
->
GetValue
()
)
{
PrintComponentsListByRef
(
f
,
cmplist
,
false
,
aIncludeSubComponents
);
PrintComponentsListByRef
(
f
,
list
,
itemCount
,
false
,
aIncludeSubComponents
);
}
if
(
m_ListCmpbyValItems
->
GetValue
()
)
if
(
m_ListCmpbyValItems
->
GetValue
()
)
{
{
qsort
(
list
,
itemCount
,
sizeof
(
OBJ_CMP_TO_LIST
),
sort
(
cmplist
.
begin
(),
cmplist
.
end
(),
SortComponentsByValue
);
(
int
(
*
)
(
const
void
*
,
const
void
*
)
)
ListTriComposantByVal
);
PrintComponentsListByVal
(
f
,
cmplist
,
aIncludeSubComponents
);
PrintComponentsListByVal
(
f
,
list
,
itemCount
,
aIncludeSubComponents
);
}
}
MyFree
(
list
);
}
}
/*************************************************/
/*************************************************/
...
@@ -275,9 +247,9 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& aFullFileName,
...
@@ -275,9 +247,9 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& aFullFileName,
}
}
/*********************************************************/
/*********************************************************
******************
/
int
BuildComponentsListFromSchematic
(
OBJ_CMP_TO_LIST
*
aList
)
void
BuildComponentsListFromSchematic
(
std
::
vector
<
OBJ_CMP_TO_LIST
>&
aList
)
/*********************************************************/
/*********************************************************
******************
/
/* Creates the list of components found in the whole schematic
/* Creates the list of components found in the whole schematic
*
*
...
@@ -287,7 +259,6 @@ int BuildComponentsListFromSchematic( OBJ_CMP_TO_LIST* aList )
...
@@ -287,7 +259,6 @@ int BuildComponentsListFromSchematic( OBJ_CMP_TO_LIST* aList )
* Also Initialise m_Father as pointerof the SCH_SCREN parent
* Also Initialise m_Father as pointerof the SCH_SCREN parent
*/
*/
{
{
int
itemCount
=
0
;
EDA_BaseStruct
*
SchItem
;
EDA_BaseStruct
*
SchItem
;
SCH_COMPONENT
*
DrawLibItem
;
SCH_COMPONENT
*
DrawLibItem
;
DrawSheetPath
*
sheet
;
DrawSheetPath
*
sheet
;
...
@@ -302,38 +273,32 @@ int BuildComponentsListFromSchematic( OBJ_CMP_TO_LIST* aList )
...
@@ -302,38 +273,32 @@ int BuildComponentsListFromSchematic( OBJ_CMP_TO_LIST* aList )
if
(
SchItem
->
Type
()
!=
TYPE_SCH_COMPONENT
)
if
(
SchItem
->
Type
()
!=
TYPE_SCH_COMPONENT
)
continue
;
continue
;
itemCount
++
;
DrawLibItem
=
(
SCH_COMPONENT
*
)
SchItem
;
DrawLibItem
=
(
SCH_COMPONENT
*
)
SchItem
;
DrawLibItem
->
SetParent
(
sheet
->
LastScreen
()
);
DrawLibItem
->
SetParent
(
sheet
->
LastScreen
()
);
if
(
aList
)
OBJ_CMP_TO_LIST
item
;
{
item
.
m_RootCmp
=
DrawLibItem
;
aList
->
m_RootCmp
=
DrawLibItem
;
item
.
m_SheetPath
=
*
sheet
;
aList
->
m_SheetPath
=
*
sheet
;
item
.
m_Unit
=
DrawLibItem
->
GetUnitSelection
(
sheet
);
aList
->
m_Unit
=
DrawLibItem
->
GetUnitSelection
(
sheet
);
strncpy
(
aList
->
m_Reference
,
strncpy
(
item
.
m_Reference
,
CONV_TO_UTF8
(
DrawLibItem
->
GetRef
(
sheet
)
),
CONV_TO_UTF8
(
DrawLibItem
->
GetRef
(
sheet
)
),
sizeof
(
aList
->
m_Reference
)
);
sizeof
(
item
.
m_Reference
)
);
// Ensure always nul terminate m_Ref.
// Ensure always nul terminate m_Ref.
aList
->
m_Reference
[
sizeof
(
aList
->
m_Reference
)
-
1
]
=
0
;
item
.
m_Reference
[
sizeof
(
item
.
m_Reference
)
-
1
]
=
0
;
aList
++
;
aList
.
push_back
(
item
)
;
}
}
}
}
}
return
itemCount
;
}
}
/****************************************************************/
/****************************************************************/
static
int
GenListeGLabels
(
std
::
vector
<
LABEL_OBJECT
>&
aList
)
static
void
GenListeGLabels
(
std
::
vector
<
LABEL_OBJECT
>&
aList
)
/****************************************************************/
/****************************************************************/
/* Fill aList with Glabel info
/* Fill aList with Glabel info
*/
*/
{
{
int
itemCount
=
0
;
SCH_ITEM
*
DrawList
;
SCH_ITEM
*
DrawList
;
Hierarchical_PIN_Sheet_Struct
*
PinLabel
;
Hierarchical_PIN_Sheet_Struct
*
PinLabel
;
DrawSheetPath
*
sheet
;
DrawSheetPath
*
sheet
;
...
@@ -352,7 +317,6 @@ static int GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
...
@@ -352,7 +317,6 @@ static int GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
{
{
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_GLOBALLABEL
:
itemCount
++
;
labet_object
.
m_LabelType
=
DrawList
->
Type
();
labet_object
.
m_LabelType
=
DrawList
->
Type
();
labet_object
.
m_SheetPath
=
*
sheet
;
labet_object
.
m_SheetPath
=
*
sheet
;
labet_object
.
m_Label
=
DrawList
;
labet_object
.
m_Label
=
DrawList
;
...
@@ -364,7 +328,6 @@ static int GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
...
@@ -364,7 +328,6 @@ static int GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
PinLabel
=
(
(
DrawSheetStruct
*
)
DrawList
)
->
m_Label
;
PinLabel
=
(
(
DrawSheetStruct
*
)
DrawList
)
->
m_Label
;
while
(
PinLabel
!=
NULL
)
while
(
PinLabel
!=
NULL
)
{
{
itemCount
++
;
labet_object
.
m_LabelType
=
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
;
labet_object
.
m_LabelType
=
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
;
labet_object
.
m_SheetPath
=
*
sheet
;
labet_object
.
m_SheetPath
=
*
sheet
;
labet_object
.
m_Label
=
PinLabel
;
labet_object
.
m_Label
=
PinLabel
;
...
@@ -377,102 +340,74 @@ static int GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
...
@@ -377,102 +340,74 @@ static int GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
default
:
default
:
break
;
break
;
}
}
DrawList
=
DrawList
->
Next
();
DrawList
=
DrawList
->
Next
();
}
}
}
}
return
itemCount
;
}
}
/**********************************************************/
/**********************************************************
**************************
/
static
int
ListTriComposantByVal
(
OBJ_CMP_TO_LIST
*
obj1
,
OBJ_CMP_TO_LIST
*
obj2
)
bool
SortComponentsByValue
(
const
OBJ_CMP_TO_LIST
&
obj1
,
const
OBJ_CMP_TO_LIST
&
obj2
)
/**********************************************************/
/**********************************************************
**************************
/
/*
Routine de comparaison pour le tri du Tableau par q
sort()
/*
Compare fuinction for
sort()
*
Les composants sont tries
*
components are sorted
*
par valeur
*
by value
*
si meme valeur: par
reference
*
if same value: by
reference
*
si meme valeur: par numero d'unite
*
if same reference: by unit number
*/
*/
{
{
int
ii
;
int
ii
;
const
wxString
*
Text1
,
*
Text2
;
const
wxString
*
Text1
,
*
Text2
;
if
(
(
obj1
==
NULL
)
&&
(
obj2
==
NULL
)
)
Text1
=
&
(
obj1
.
m_RootCmp
->
GetField
(
VALUE
)
->
m_Text
);
return
0
;
Text2
=
&
(
obj2
.
m_RootCmp
->
GetField
(
VALUE
)
->
m_Text
);
if
(
obj1
==
NULL
)
return
-
1
;
if
(
obj2
==
NULL
)
return
1
;
if
(
(
obj1
->
m_RootCmp
==
NULL
)
&&
(
obj2
->
m_RootCmp
==
NULL
)
)
return
0
;
if
(
obj1
->
m_RootCmp
==
NULL
)
return
-
1
;
if
(
obj2
->
m_RootCmp
==
NULL
)
return
1
;
Text1
=
&
(
obj1
->
m_RootCmp
->
GetField
(
VALUE
)
->
m_Text
);
Text2
=
&
(
obj2
->
m_RootCmp
->
GetField
(
VALUE
)
->
m_Text
);
ii
=
Text1
->
CmpNoCase
(
*
Text2
);
ii
=
Text1
->
CmpNoCase
(
*
Text2
);
if
(
ii
==
0
)
if
(
ii
==
0
)
{
{
ii
=
RefDesStringCompare
(
obj1
->
m_Reference
,
obj2
->
m_Reference
);
ii
=
RefDesStringCompare
(
obj1
.
m_Reference
,
obj2
.
m_Reference
);
}
}
if
(
ii
==
0
)
if
(
ii
==
0
)
{
{
ii
=
obj1
->
m_Unit
-
obj2
->
m_Unit
;
ii
=
obj1
.
m_Unit
-
obj2
.
m_Unit
;
}
}
return
ii
;
return
ii
<
0
;
}
}
/*******************************************************************/
/*******************************************************************
********************
/
int
ListTriComposantByRef
(
OBJ_CMP_TO_LIST
*
obj1
,
OBJ_CMP_TO_LIST
*
obj2
)
bool
SortComponentsByReference
(
const
OBJ_CMP_TO_LIST
&
obj1
,
const
OBJ_CMP_TO_LIST
&
obj2
)
/*******************************************************************/
/*******************************************************************
********************
/
/* compare function for sorting
/* compare function for sorting
*
Les composants sont tries
*
components are sorted
*
par
reference
*
by
reference
*
si meme referenece: par valeur
*
if same reference: by value
*
si meme valeur: par numero d'unite
*
if same value: by unit number
*/
*/
{
{
int
ii
;
int
ii
;
const
wxString
*
Text1
,
*
Text2
;
const
wxString
*
Text1
,
*
Text2
;
if
(
(
obj1
==
NULL
)
&&
(
obj2
==
NULL
)
)
ii
=
RefDesStringCompare
(
obj1
.
m_Reference
,
obj2
.
m_Reference
);
return
0
;
if
(
obj1
==
NULL
)
return
-
1
;
if
(
obj2
==
NULL
)
return
1
;
if
(
(
obj1
->
m_RootCmp
==
NULL
)
&&
(
obj2
->
m_RootCmp
==
NULL
)
)
return
0
;
if
(
obj1
->
m_RootCmp
==
NULL
)
return
-
1
;
if
(
obj2
->
m_RootCmp
==
NULL
)
return
1
;
ii
=
RefDesStringCompare
(
obj1
->
m_Reference
,
obj2
->
m_Reference
);
if
(
ii
==
0
)
if
(
ii
==
0
)
{
{
Text1
=
&
(
obj1
->
m_RootCmp
->
GetField
(
VALUE
)
->
m_Text
);
Text1
=
&
(
obj1
.
m_RootCmp
->
GetField
(
VALUE
)
->
m_Text
);
Text2
=
&
(
obj2
->
m_RootCmp
->
GetField
(
VALUE
)
->
m_Text
);
Text2
=
&
(
obj2
.
m_RootCmp
->
GetField
(
VALUE
)
->
m_Text
);
ii
=
Text1
->
CmpNoCase
(
*
Text2
);
ii
=
Text1
->
CmpNoCase
(
*
Text2
);
}
}
if
(
ii
==
0
)
if
(
ii
==
0
)
{
{
ii
=
obj1
->
m_Unit
-
obj2
->
m_Unit
;
ii
=
obj1
.
m_Unit
-
obj2
.
m_Unit
;
}
}
return
ii
;
return
ii
<
0
;
}
}
...
@@ -487,17 +422,17 @@ bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
...
@@ -487,17 +422,17 @@ bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
*/
*/
{
{
int
ii
;
int
ii
;
wxString
*
Text1
,
*
Text2
;
wxString
*
Text1
,
*
Text2
;
if
(
obj1
.
m_LabelType
==
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
)
if
(
obj1
.
m_LabelType
==
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
)
Text1
=
&
(
(
Hierarchical_PIN_Sheet_Struct
*
)
(
obj1
.
m_Label
)
)
->
m_Text
;
Text1
=
&
(
(
Hierarchical_PIN_Sheet_Struct
*
)(
obj1
.
m_Label
)
)
->
m_Text
;
else
else
Text1
=
&
(
(
SCH_TEXT
*
)
(
obj1
.
m_Label
)
)
->
m_Text
;
Text1
=
&
(
(
SCH_TEXT
*
)(
obj1
.
m_Label
)
)
->
m_Text
;
if
(
obj2
.
m_LabelType
==
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
)
if
(
obj2
.
m_LabelType
==
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
)
Text2
=
&
(
(
Hierarchical_PIN_Sheet_Struct
*
)
(
obj2
.
m_Label
)
)
->
m_Text
;
Text2
=
&
(
(
Hierarchical_PIN_Sheet_Struct
*
)(
obj2
.
m_Label
)
)
->
m_Text
;
else
else
Text2
=
&
(
(
SCH_TEXT
*
)
(
obj2
.
m_Label
)
)
->
m_Text
;
Text2
=
&
(
(
SCH_TEXT
*
)(
obj2
.
m_Label
)
)
->
m_Text
;
ii
=
Text1
->
CmpNoCase
(
*
Text2
);
ii
=
Text1
->
CmpNoCase
(
*
Text2
);
...
@@ -545,7 +480,7 @@ bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
...
@@ -545,7 +480,7 @@ bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
/**************************************************************/
/**************************************************************/
static
void
DeleteSubCmp
(
OBJ_CMP_TO_LIST
*
aList
,
int
aItemCoun
t
)
static
void
DeleteSubCmp
(
std
::
vector
<
OBJ_CMP_TO_LIST
>&
aLis
t
)
/**************************************************************/
/**************************************************************/
/* Remove sub components from the list, when multiples parts per package are found in this list
/* Remove sub components from the list, when multiples parts per package are found in this list
...
@@ -557,7 +492,7 @@ static void DeleteSubCmp( OBJ_CMP_TO_LIST* aList, int aItemCount )
...
@@ -557,7 +492,7 @@ static void DeleteSubCmp( OBJ_CMP_TO_LIST* aList, int aItemCount )
wxString
currName
;
wxString
currName
;
for
(
int
ii
=
0
;
ii
<
aItemCount
;
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
aList
.
size
()
;
ii
++
)
{
{
libItem
=
aList
[
ii
].
m_RootCmp
;
libItem
=
aList
[
ii
].
m_RootCmp
;
if
(
libItem
==
NULL
)
if
(
libItem
==
NULL
)
...
@@ -569,9 +504,8 @@ static void DeleteSubCmp( OBJ_CMP_TO_LIST* aList, int aItemCount )
...
@@ -569,9 +504,8 @@ static void DeleteSubCmp( OBJ_CMP_TO_LIST* aList, int aItemCount )
{
{
if
(
oldName
==
currName
)
// currName is a subpart of oldName: remove it
if
(
oldName
==
currName
)
// currName is a subpart of oldName: remove it
{
{
aList
[
ii
].
m_RootCmp
=
NULL
;
aList
.
erase
(
aList
.
begin
()
+
ii
);
aList
[
ii
].
m_SheetPath
.
Clear
();
ii
--
;
aList
[
ii
].
m_Reference
[
0
]
=
0
;
}
}
}
}
oldName
=
currName
;
oldName
=
currName
;
...
@@ -629,17 +563,18 @@ void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem
...
@@ -629,17 +563,18 @@ void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem
/*********************************************************************************************/
/*********************************************************************************************/
int
WinEDA_Build_BOM_Frame
::
PrintComponentsListByRef
(
FILE
*
f
,
int
WinEDA_Build_BOM_Frame
::
PrintComponentsListByRef
(
OBJ_CMP_TO_LIST
*
aList
,
FILE
*
f
,
int
aItemCoun
t
,
std
::
vector
<
OBJ_CMP_TO_LIST
>&
aLis
t
,
bool
CompactForm
,
bool
CompactForm
,
bool
aIncludeSubComponents
)
bool
aIncludeSubComponents
)
/*********************************************************************************************/
/*********************************************************************************************/
/* Print the B.O.M sorted by reference
/* Print the B.O.M sorted by reference
*/
*/
{
{
int
ii
,
Multi
,
Unit
;
int
Multi
,
Unit
;
EDA_BaseStruct
*
DrawList
;
EDA_BaseStruct
*
DrawList
;
SCH_COMPONENT
*
DrawLibItem
;
SCH_COMPONENT
*
DrawLibItem
;
EDA_LibComponentStruct
*
Entry
;
EDA_LibComponentStruct
*
Entry
;
...
@@ -672,7 +607,7 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f,
...
@@ -672,7 +607,7 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f,
if
(
m_AddFootprintField
->
IsChecked
()
)
if
(
m_AddFootprintField
->
IsChecked
()
)
fprintf
(
f
,
"%cfootprint"
,
s_ExportSeparatorSymbol
);
fprintf
(
f
,
"%cfootprint"
,
s_ExportSeparatorSymbol
);
for
(
ii
=
FIELD1
;
ii
<=
FIELD8
;
ii
++
)
for
(
i
nt
i
i
=
FIELD1
;
ii
<=
FIELD8
;
ii
++
)
{
{
const
wxCheckBox
*
FieldCtrl
=
FieldListCtrl
[
ii
-
FIELD1
];
const
wxCheckBox
*
FieldCtrl
=
FieldListCtrl
[
ii
-
FIELD1
];
if
(
FieldCtrl
==
NULL
)
if
(
FieldCtrl
==
NULL
)
...
@@ -697,7 +632,7 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f,
...
@@ -697,7 +632,7 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f,
}
}
// Print list of items
// Print list of items
for
(
ii
=
0
;
ii
<
aItemCount
;
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
aList
.
size
()
;
ii
++
)
{
{
DrawList
=
aList
[
ii
].
m_RootCmp
;
DrawList
=
aList
[
ii
].
m_RootCmp
;
...
@@ -717,13 +652,11 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f,
...
@@ -717,13 +652,11 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f,
Multi
=
Entry
->
m_UnitCount
;
Multi
=
Entry
->
m_UnitCount
;
if
(
(
Multi
>
1
)
&&
aIncludeSubComponents
)
if
(
(
Multi
>
1
)
&&
aIncludeSubComponents
)
#if defined(KICAD_GOST)
#if defined (KICAD_GOST)
Unit
=
aList
[
ii
].
m_Unit
+
'1'
-
1
;
Unit
=
aList
[
ii
].
m_Unit
+
'1'
-
1
;
#else
#else
Unit
=
aList
[
ii
].
m_Unit
+
'A'
-
1
;
Unit
=
aList
[
ii
].
m_Unit
+
'A'
-
1
;
#endif
#endif
...
@@ -772,10 +705,11 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f,
...
@@ -772,10 +705,11 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f,
/*********************************************************************************************/
/*********************************************************************************************/
int
WinEDA_Build_BOM_Frame
::
PrintComponentsListByVal
(
FILE
*
f
,
int
WinEDA_Build_BOM_Frame
::
PrintComponentsListByVal
(
OBJ_CMP_TO_LIST
*
aList
,
FILE
*
f
,
int
aItemCount
,
std
::
vector
<
OBJ_CMP_TO_LIST
>&
aList
,
bool
aIncludeSubComponents
)
bool
aIncludeSubComponents
)
/**********************************************************************************************/
/**********************************************************************************************/
{
{
int
Multi
;
int
Multi
;
...
@@ -793,7 +727,7 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByVal( FILE* f,
...
@@ -793,7 +727,7 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByVal( FILE* f,
msg
<<
wxT
(
"
\n
"
);
msg
<<
wxT
(
"
\n
"
);
fprintf
(
f
,
CONV_TO_UTF8
(
msg
)
);
fprintf
(
f
,
CONV_TO_UTF8
(
msg
)
);
for
(
int
ii
=
0
;
ii
<
aItemCount
;
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
aList
.
size
()
;
ii
++
)
{
{
DrawList
=
aList
[
ii
].
m_RootCmp
;
DrawList
=
aList
[
ii
].
m_RootCmp
;
...
@@ -916,7 +850,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
...
@@ -916,7 +850,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
/********************************************/
/********************************************/
int
RefDesStringCompare
(
c
har
*
obj1
,
char
*
obj2
)
int
RefDesStringCompare
(
c
onst
char
*
obj1
,
const
char
*
obj2
)
/********************************************/
/********************************************/
/* This function will act just like the strcmp function but correctly sort
/* This function will act just like the strcmp function but correctly sort
...
...
eeschema/dialog_build_BOM.h
View file @
f21e24f2
...
@@ -134,9 +134,9 @@ public:
...
@@ -134,9 +134,9 @@ public:
bool
aRunBrowser
);
bool
aRunBrowser
);
void
GenereListeOfItems
(
const
wxString
&
FullFileName
,
bool
aIncludeSubComponents
);
void
GenereListeOfItems
(
const
wxString
&
FullFileName
,
bool
aIncludeSubComponents
);
void
CreateExportList
(
const
wxString
&
FullFileName
,
bool
aIncludeSubComponents
);
void
CreateExportList
(
const
wxString
&
FullFileName
,
bool
aIncludeSubComponents
);
int
PrintComponentsListByRef
(
FILE
*
f
,
OBJ_CMP_TO_LIST
*
List
,
int
NbItems
,
int
PrintComponentsListByRef
(
FILE
*
f
,
std
::
vector
<
OBJ_CMP_TO_LIST
>&
aList
,
bool
CompactForm
,
bool
aIncludeSubComponents
);
bool
CompactForm
,
bool
aIncludeSubComponents
);
int
PrintComponentsListByVal
(
FILE
*
f
,
OBJ_CMP_TO_LIST
*
List
,
int
NbItems
,
int
PrintComponentsListByVal
(
FILE
*
f
,
std
::
vector
<
OBJ_CMP_TO_LIST
>&
aList
,
bool
aIncludeSubComponents
);
bool
aIncludeSubComponents
);
void
PrintFieldData
(
FILE
*
f
,
SCH_COMPONENT
*
DrawLibItem
,
bool
CompactForm
=
FALSE
);
void
PrintFieldData
(
FILE
*
f
,
SCH_COMPONENT
*
DrawLibItem
,
bool
CompactForm
=
FALSE
);
void
SavePreferences
();
void
SavePreferences
();
...
...
eeschema/libarch.cpp
View file @
f21e24f2
...
@@ -38,7 +38,9 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
...
@@ -38,7 +38,9 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
EDA_ScreenList
s_list
;
EDA_ScreenList
s_list
;
// examine all screens used and build the list of components found in lib
/* examine all screens (not scheets) used and build the list of components found in lib
* complex hierarchies are not a problem because we just want to know used components in librarires
*/
for
(
SCH_SCREEN
*
screen
=
s_list
.
GetFirst
();
screen
!=
NULL
;
screen
=
s_list
.
GetNext
()
)
for
(
SCH_SCREEN
*
screen
=
s_list
.
GetFirst
();
screen
!=
NULL
;
screen
=
s_list
.
GetNext
()
)
{
{
for
(
SCH_ITEM
*
SchItem
=
screen
->
EEDrawList
;
SchItem
;
SchItem
=
SchItem
->
Next
()
)
for
(
SCH_ITEM
*
SchItem
=
screen
->
EEDrawList
;
SchItem
;
SchItem
=
SchItem
->
Next
()
)
...
...
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