Solved: B.O.M. generation minor problem or multiple parts per package components in complex hierarchies.
This commit is contained in:
parent
b8ea76fe63
commit
4999a844c0
|
@ -10,7 +10,6 @@ email address.
|
|||
+eeschema:
|
||||
Solved netlist problems for multiple parts per package components
|
||||
in complex hierarchies.
|
||||
B.O.M. generation still have a minor problem wih this.
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ set(EESCHEMA_SRCS
|
|||
backanno.cpp
|
||||
block.cpp
|
||||
block_libedit.cpp
|
||||
build_BOM.cpp
|
||||
busentry.cpp
|
||||
bus-wire-junction.cpp
|
||||
class_drawsheet.cpp
|
||||
|
|
|
@ -0,0 +1,863 @@
|
|||
// Name: build_BOM.cpp
|
||||
|
||||
// Purpose:
|
||||
// Author: jean-pierre Charras
|
||||
// Licence: GPL license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "fctsys.h"
|
||||
|
||||
|
||||
#include "common.h"
|
||||
#include "program.h"
|
||||
#include "libcmp.h"
|
||||
#include "general.h"
|
||||
#include "netlist.h"
|
||||
|
||||
#include "dialog_build_BOM.h"
|
||||
|
||||
|
||||
#include "protos.h"
|
||||
|
||||
// Filename extension for BOM list
|
||||
#define EXT_LIST wxT( ".lst" )
|
||||
|
||||
/* fonctions locales */
|
||||
static int GenListeGLabels( ListLabel* List );
|
||||
int GenListeCmp( ListComponent* List );
|
||||
static int ListTriComposantByRef( ListComponent* Objet1,
|
||||
ListComponent* Objet2 );
|
||||
static int ListTriComposantByVal( ListComponent* Objet1,
|
||||
ListComponent* Objet2 );
|
||||
static int ListTriGLabelBySheet( ListLabel* Objet1, ListLabel* Objet2 );
|
||||
static int ListTriGLabelByVal( ListLabel* Objet1, ListLabel* Objet2 );
|
||||
static void DeleteSubCmp( ListComponent* List, int NbItems );
|
||||
|
||||
static int PrintListeGLabel( FILE* f, ListLabel* List, int NbItems );
|
||||
|
||||
/* Local variables */
|
||||
|
||||
/* separator used in bom export to spreadsheet */
|
||||
static char s_ExportSeparatorSymbol;
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
void WinEDA_Build_BOM_Frame::Create_BOM_Lists( bool aTypeFileIsExport,
|
||||
bool aIncludeSubComponents,
|
||||
char aExportSeparatorSymbol,
|
||||
bool aRunBrowser )
|
||||
/**************************************************************************/
|
||||
{
|
||||
wxString mask, filename;
|
||||
|
||||
s_ExportSeparatorSymbol = aExportSeparatorSymbol;
|
||||
|
||||
m_ListFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||
ChangeFileNameExt( m_ListFileName, EXT_LIST );
|
||||
|
||||
//need to get rid of the path.
|
||||
m_ListFileName = m_ListFileName.AfterLast( '/' );
|
||||
mask = wxT( "*" );
|
||||
mask += EXT_LIST;
|
||||
|
||||
filename = EDA_FileSelector( _( "Bill of materials:" ),
|
||||
wxEmptyString, /* Chemin par defaut (ici dir courante) */
|
||||
m_ListFileName, /* nom fichier par defaut, et resultat */
|
||||
EXT_LIST, /* extension par defaut */
|
||||
mask, /* Masque d'affichage */
|
||||
this,
|
||||
wxFD_SAVE,
|
||||
TRUE
|
||||
);
|
||||
if( filename.IsEmpty() )
|
||||
return;
|
||||
else
|
||||
m_ListFileName = filename;
|
||||
|
||||
/* Close dialog, then show the list (if so requested) */
|
||||
|
||||
if( aTypeFileIsExport )
|
||||
CreateExportList( m_ListFileName, aIncludeSubComponents );
|
||||
else
|
||||
GenereListeOfItems( m_ListFileName, aIncludeSubComponents );
|
||||
|
||||
EndModal( 1 );
|
||||
|
||||
if( aRunBrowser )
|
||||
{
|
||||
wxString editorname = GetEditorName();
|
||||
AddDelimiterString( filename );
|
||||
ExecuteFile( this, editorname, filename );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
void WinEDA_Build_BOM_Frame::CreateExportList( const wxString& FullFileName,
|
||||
bool aIncludeSubComponents )
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
* Print a list of components, in a form which can be imported by a spreadsheet
|
||||
* form is:
|
||||
* cmp name; cmp val; fields;
|
||||
*/
|
||||
{
|
||||
FILE* f;
|
||||
ListComponent* List;
|
||||
int NbItems;
|
||||
wxString msg;
|
||||
|
||||
/* Creation de la liste des elements */
|
||||
if( ( f = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL )
|
||||
{
|
||||
msg = _( "Failed to open file " );
|
||||
msg << FullFileName;
|
||||
DisplayError( this, msg );
|
||||
return;
|
||||
}
|
||||
|
||||
NbItems = GenListeCmp( NULL );
|
||||
if( NbItems )
|
||||
{
|
||||
List = (ListComponent*) MyZMalloc( NbItems * sizeof(ListComponent) );
|
||||
if( List == NULL )
|
||||
{
|
||||
fclose( f );
|
||||
return;
|
||||
}
|
||||
|
||||
GenListeCmp( List );
|
||||
|
||||
/* sort component list */
|
||||
qsort( List, NbItems, sizeof( ListComponent ),
|
||||
( int( * ) ( const void*, const void* ) )ListTriComposantByRef );
|
||||
|
||||
// if( ! s_ListWithSubCmponents )
|
||||
if( !aIncludeSubComponents )
|
||||
DeleteSubCmp( List, NbItems );
|
||||
|
||||
/* create the file */
|
||||
PrintListeCmpByRef( f, List, NbItems, TRUE, aIncludeSubComponents );
|
||||
|
||||
MyFree( List );
|
||||
}
|
||||
|
||||
fclose( f );
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName,
|
||||
bool aIncludeSubComponents )
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
* Routine principale pour la creation des listings ( composants et/ou labels
|
||||
* globaux et "sheet labels" )
|
||||
*/
|
||||
{
|
||||
FILE* f;
|
||||
ListComponent* List;
|
||||
ListLabel* ListOfLabels;
|
||||
int NbItems;
|
||||
char Line[1024];
|
||||
wxString msg;
|
||||
|
||||
/* Creation de la liste des elements */
|
||||
if( ( f = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL )
|
||||
{
|
||||
msg = _( "Failed to open file " );
|
||||
msg << FullFileName;
|
||||
DisplayError( this, msg );
|
||||
return;
|
||||
}
|
||||
|
||||
NbItems = GenListeCmp( NULL );
|
||||
if( NbItems )
|
||||
{
|
||||
List = (ListComponent*) MyZMalloc( NbItems * sizeof(ListComponent) );
|
||||
if( List == NULL ) // Error memory alloc
|
||||
{
|
||||
fclose( f );
|
||||
return;
|
||||
}
|
||||
|
||||
GenListeCmp( List );
|
||||
|
||||
/* generation du fichier listing */
|
||||
DateAndTime( Line );
|
||||
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
||||
fprintf( f, "%s >> Creation date: %s\n", CONV_TO_UTF8( Title ), Line );
|
||||
|
||||
/* Tri et impression de la liste des composants */
|
||||
|
||||
qsort( List, NbItems, sizeof( ListComponent ),
|
||||
( int( * ) ( const void*, const void* ) )ListTriComposantByRef );
|
||||
|
||||
if( !aIncludeSubComponents )
|
||||
DeleteSubCmp( List, NbItems );
|
||||
|
||||
// if( s_ListByRef )
|
||||
if( m_ListCmpbyRefItems->GetValue() )
|
||||
{
|
||||
PrintListeCmpByRef( f, List, NbItems, false, aIncludeSubComponents );
|
||||
}
|
||||
|
||||
// if( s_ListByValue )
|
||||
if( m_ListCmpbyValItems->GetValue() )
|
||||
{
|
||||
qsort( List, NbItems, sizeof( ListComponent ),
|
||||
( int( * ) ( const void*, const void* ) )ListTriComposantByVal );
|
||||
PrintListeCmpByVal( f, List, NbItems, aIncludeSubComponents );
|
||||
}
|
||||
MyFree( List );
|
||||
}
|
||||
|
||||
/***************************************/
|
||||
/* Generation liste des Labels globaux */
|
||||
/***************************************/
|
||||
NbItems = GenListeGLabels( NULL );
|
||||
if( NbItems )
|
||||
{
|
||||
ListOfLabels = (ListLabel*) MyZMalloc( NbItems * sizeof(ListLabel) );
|
||||
if( ListOfLabels == NULL )
|
||||
{
|
||||
fclose( f );
|
||||
return;
|
||||
}
|
||||
|
||||
GenListeGLabels( ListOfLabels );
|
||||
|
||||
/* Tri de la liste */
|
||||
|
||||
// if( s_ListBySheet )
|
||||
if( m_GenListLabelsbySheet->GetValue() )
|
||||
{
|
||||
qsort( ListOfLabels, NbItems, sizeof( ListLabel ),
|
||||
( int( * ) ( const void*, const void* ) )ListTriGLabelBySheet );
|
||||
|
||||
msg.Printf( _(
|
||||
"\n#Global, Hierarchical Labels and PinSheets ( order = Sheet Number ) count = %d\n" ),
|
||||
NbItems );
|
||||
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
|
||||
PrintListeGLabel( f, ListOfLabels, NbItems );
|
||||
}
|
||||
|
||||
// if( s_ListHierarchicalPinByName )
|
||||
if( m_GenListLabelsbyVal->GetValue() )
|
||||
{
|
||||
qsort( ListOfLabels, NbItems, sizeof( ListLabel ),
|
||||
( int( * ) ( const void*, const void* ) )ListTriGLabelByVal );
|
||||
|
||||
msg.Printf( _(
|
||||
"\n#Global, Hierarchical Labels and PinSheets ( order = Alphab. ) count = %d\n\n" ),
|
||||
NbItems );
|
||||
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
|
||||
PrintListeGLabel( f, ListOfLabels, NbItems );
|
||||
}
|
||||
MyFree( ListOfLabels );
|
||||
}
|
||||
|
||||
msg = _( "\n#End List\n" );
|
||||
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
|
||||
fclose( f );
|
||||
}
|
||||
|
||||
|
||||
/****************************************/
|
||||
int GenListeCmp( ListComponent* List )
|
||||
/****************************************/
|
||||
|
||||
/* Creates the list of components in the schematic
|
||||
*
|
||||
* routine for generating a list of the used components.
|
||||
* if List == null, just returns the count. if not, fills the list.
|
||||
* goes through the sheets, not the screens, so that we account for
|
||||
* multiple instances of a given screen.
|
||||
* Also Initialise m_Father as pointer pointeur of the SCH_SCREN parent
|
||||
*/
|
||||
{
|
||||
int ItemCount = 0;
|
||||
EDA_BaseStruct* SchItem;
|
||||
SCH_COMPONENT* DrawLibItem;
|
||||
DrawSheetPath* sheet;
|
||||
|
||||
/* Build the sheet (not screen) list */
|
||||
EDA_SheetList SheetList( NULL );
|
||||
|
||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||
{
|
||||
for( SchItem = sheet->LastDrawList(); SchItem; SchItem = SchItem->Next() )
|
||||
{
|
||||
if( SchItem->Type() != TYPE_SCH_COMPONENT )
|
||||
continue;
|
||||
|
||||
ItemCount++;
|
||||
DrawLibItem = (SCH_COMPONENT*) SchItem;
|
||||
DrawLibItem->m_Parent = sheet->LastScreen();
|
||||
if( List )
|
||||
{
|
||||
List->m_Comp = DrawLibItem;
|
||||
List->m_SheetList = *sheet;
|
||||
List->m_Unit = DrawLibItem->GetUnitSelection( sheet );
|
||||
strncpy( List->m_Ref,
|
||||
CONV_TO_UTF8( DrawLibItem->GetRef( sheet ) ),
|
||||
sizeof( List->m_Ref ) );
|
||||
List++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ItemCount;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************/
|
||||
static int GenListeGLabels( ListLabel* List )
|
||||
/*********************************************/
|
||||
|
||||
/* Count the Glabels, or fill the list Listwith Glabel pointers
|
||||
* If List == NULL: Item count only
|
||||
* Else fill list of Glabels
|
||||
*/
|
||||
{
|
||||
int ItemCount = 0;
|
||||
EDA_BaseStruct* DrawList;
|
||||
Hierarchical_PIN_Sheet_Struct* SheetLabel;
|
||||
DrawSheetPath* sheet;
|
||||
|
||||
/* Build the screen list */
|
||||
EDA_SheetList SheetList( NULL );
|
||||
|
||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||
{
|
||||
DrawList = sheet->LastDrawList();
|
||||
wxString path = sheet->PathHumanReadable();
|
||||
while( DrawList )
|
||||
{
|
||||
switch( DrawList->Type() )
|
||||
{
|
||||
case TYPE_SCH_HIERLABEL:
|
||||
case TYPE_SCH_GLOBALLABEL:
|
||||
ItemCount++;
|
||||
if( List )
|
||||
{
|
||||
List->m_LabelType = DrawList->Type();
|
||||
snprintf( List->m_SheetPath, sizeof(List->m_SheetPath),
|
||||
"%s", CONV_TO_UTF8( path ) );
|
||||
List->m_Label = DrawList;
|
||||
List++;
|
||||
}
|
||||
break;
|
||||
|
||||
case DRAW_SHEET_STRUCT_TYPE:
|
||||
{
|
||||
#define Sheet ( (DrawSheetStruct*) DrawList )
|
||||
SheetLabel = Sheet->m_Label;
|
||||
while( SheetLabel != NULL )
|
||||
{
|
||||
if( List )
|
||||
{
|
||||
List->m_LabelType = DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE;
|
||||
snprintf( List->m_SheetPath, sizeof(List->m_SheetPath),
|
||||
"%s", CONV_TO_UTF8( path ) );
|
||||
List->m_Label = SheetLabel;
|
||||
List++;
|
||||
}
|
||||
ItemCount++;
|
||||
SheetLabel = (Hierarchical_PIN_Sheet_Struct*) (SheetLabel->Pnext);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
DrawList = DrawList->Pnext;
|
||||
}
|
||||
}
|
||||
|
||||
return ItemCount;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
static int ListTriComposantByVal( ListComponent* Objet1,
|
||||
ListComponent* Objet2 )
|
||||
/**********************************************************/
|
||||
|
||||
/* Routine de comparaison pour le tri du Tableau par qsort()
|
||||
* Les composants sont tries
|
||||
* par valeur
|
||||
* si meme valeur: par reference
|
||||
* si meme valeur: par numero d'unite
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
const wxString* Text1, * Text2;
|
||||
|
||||
if( ( Objet1 == NULL ) && ( Objet2 == NULL ) )
|
||||
return 0;
|
||||
if( Objet1 == NULL )
|
||||
return -1;
|
||||
if( Objet2 == NULL )
|
||||
return 1;
|
||||
if( ( Objet1->m_Comp == NULL ) && ( Objet2->m_Comp == NULL ) )
|
||||
return 0;
|
||||
if( Objet1->m_Comp == NULL )
|
||||
return -1;
|
||||
if( Objet2->m_Comp == NULL )
|
||||
return 1;
|
||||
|
||||
Text1 = &(Objet1->m_Comp->m_Field[VALUE].m_Text);
|
||||
Text2 = &(Objet2->m_Comp->m_Field[VALUE].m_Text);
|
||||
ii = Text1->CmpNoCase( *Text2 );
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
ii = strcmp( Objet1->m_Ref, Objet2->m_Ref );
|
||||
}
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
ii = Objet1->m_Unit - Objet2->m_Unit;
|
||||
}
|
||||
|
||||
return ii;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
static int ListTriComposantByRef( ListComponent* Objet1,
|
||||
ListComponent* Objet2 )
|
||||
/**********************************************************/
|
||||
|
||||
/* Routine de comparaison pour le tri du Tableau par qsort()
|
||||
* Les composants sont tries
|
||||
* par reference
|
||||
* si meme referenece: par valeur
|
||||
* si meme valeur: par numero d'unite
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
const wxString* Text1, * Text2;
|
||||
|
||||
if( ( Objet1 == NULL ) && ( Objet2 == NULL ) )
|
||||
return 0;
|
||||
if( Objet1 == NULL )
|
||||
return -1;
|
||||
if( Objet2 == NULL )
|
||||
return 1;
|
||||
|
||||
if( ( Objet1->m_Comp == NULL ) && ( Objet2->m_Comp == NULL ) )
|
||||
return 0;
|
||||
if( Objet1->m_Comp == NULL )
|
||||
return -1;
|
||||
if( Objet2->m_Comp == NULL )
|
||||
return 1;
|
||||
|
||||
ii = strcmp( Objet1->m_Ref, Objet2->m_Ref );
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
Text1 = &( Objet1->m_Comp->m_Field[VALUE].m_Text );
|
||||
Text2 = &( Objet2->m_Comp->m_Field[VALUE].m_Text );
|
||||
ii = Text1->CmpNoCase( *Text2 );
|
||||
}
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
ii = Objet1->m_Unit - Objet2->m_Unit;
|
||||
}
|
||||
|
||||
return ii;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
static int ListTriGLabelByVal( ListLabel* Objet1, ListLabel* Objet2 )
|
||||
/*******************************************************************/
|
||||
|
||||
/* Routine de comparaison pour le tri du Tableau par qsort()
|
||||
* Les labels sont tries
|
||||
* par comparaison ascii
|
||||
* si meme valeur: par numero de sheet
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
const wxString* Text1, * Text2;
|
||||
|
||||
if( Objet1->m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
||||
Text1 = &( (Hierarchical_PIN_Sheet_Struct*) Objet1->m_Label )->m_Text;
|
||||
else
|
||||
Text1 = &( (SCH_TEXT*) Objet1->m_Label )->m_Text;
|
||||
|
||||
if( Objet2->m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
||||
Text2 = &( (Hierarchical_PIN_Sheet_Struct*) Objet2->m_Label )->m_Text;
|
||||
else
|
||||
Text2 = &( (SCH_TEXT*) Objet2->m_Label )->m_Text;
|
||||
|
||||
ii = Text1->CmpNoCase( *Text2 );
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
ii = strcmp( Objet1->m_SheetPath, Objet2->m_SheetPath );
|
||||
}
|
||||
|
||||
return ii;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************/
|
||||
static int ListTriGLabelBySheet( ListLabel* Objet1, ListLabel* Objet2 )
|
||||
/*******************************************************************/
|
||||
|
||||
/* Routine de comparaison pour le tri du Tableau par qsort()
|
||||
* Les labels sont tries
|
||||
* par sheet number
|
||||
* si meme valeur, par ordre alphabetique
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
const wxString* Text1, * Text2;
|
||||
|
||||
|
||||
ii = strcmp( Objet1->m_SheetPath, Objet2->m_SheetPath );
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
if( Objet1->m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
||||
Text1 = &( (Hierarchical_PIN_Sheet_Struct*) Objet1->m_Label )->m_Text;
|
||||
else
|
||||
Text1 = &( (SCH_TEXT*) Objet1->m_Label )->m_Text;
|
||||
|
||||
if( Objet2->m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
||||
Text2 = &( (Hierarchical_PIN_Sheet_Struct*) Objet2->m_Label )->m_Text;
|
||||
else
|
||||
Text2 = &( (SCH_TEXT*) Objet2->m_Label )->m_Text;
|
||||
|
||||
ii = Text1->CmpNoCase( *Text2 );
|
||||
}
|
||||
|
||||
return ii;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
static void DeleteSubCmp( ListComponent* List, int NbItems )
|
||||
/**************************************************************/
|
||||
|
||||
/* Remove sub components from the list, when multiples parts per package are found in this list
|
||||
* The component list **MUST** be sorted by reference and by unit number
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
SCH_COMPONENT* LibItem;
|
||||
wxString OldName, CurrName;
|
||||
|
||||
for( ii = 0; ii < NbItems; ii++ )
|
||||
{
|
||||
LibItem = List[ii].m_Comp;
|
||||
if( LibItem == NULL )
|
||||
continue;
|
||||
CurrName = CONV_FROM_UTF8( List[ii].m_Ref );
|
||||
if( !OldName.IsEmpty() )
|
||||
{
|
||||
if( OldName == CurrName ) // CurrName is a subpart of OldName: remove it
|
||||
{
|
||||
List[ii].m_Comp = NULL;
|
||||
List[ii].m_SheetList.Clear();
|
||||
List[ii].m_Ref[0] = 0;
|
||||
}
|
||||
}
|
||||
OldName = CurrName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************************/
|
||||
void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
|
||||
bool CompactForm )
|
||||
/*******************************************************************************************/
|
||||
{
|
||||
wxCheckBox* FieldListCtrl[FIELD8 - FIELD1 + 1] = {
|
||||
m_AddField1,
|
||||
m_AddField2,
|
||||
m_AddField3,
|
||||
m_AddField4,
|
||||
m_AddField5,
|
||||
m_AddField6,
|
||||
m_AddField7,
|
||||
m_AddField8
|
||||
};
|
||||
int ii;
|
||||
wxCheckBox* FieldCtrl = FieldListCtrl[0];
|
||||
|
||||
if( CompactForm )
|
||||
{
|
||||
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
|
||||
CONV_TO_UTF8( DrawLibItem->m_Field[FOOTPRINT].m_Text ) );
|
||||
}
|
||||
|
||||
for( ii = FIELD1; ii <= FIELD8; ii++ )
|
||||
{
|
||||
FieldCtrl = FieldListCtrl[ii - FIELD1];
|
||||
if( FieldCtrl == NULL )
|
||||
continue;
|
||||
if( !FieldCtrl->IsChecked() )
|
||||
continue;
|
||||
if( CompactForm )
|
||||
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
|
||||
CONV_TO_UTF8( DrawLibItem->m_Field[ii].m_Text ) );
|
||||
else
|
||||
fprintf( f, "; %-12s", CONV_TO_UTF8( DrawLibItem->m_Field[ii].m_Text ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************/
|
||||
int WinEDA_Build_BOM_Frame::PrintListeCmpByRef( FILE* f, ListComponent* List, int NbItems,
|
||||
bool CompactForm, bool aIncludeSubComponents )
|
||||
/*********************************************************************************************/
|
||||
|
||||
/* Print the B.O.M sorted by reference
|
||||
*/
|
||||
{
|
||||
int ii, Multi, Unit;
|
||||
EDA_BaseStruct* DrawList;
|
||||
SCH_COMPONENT* DrawLibItem;
|
||||
EDA_LibComponentStruct* Entry;
|
||||
char CmpName[80];
|
||||
wxString msg;
|
||||
|
||||
if( CompactForm )
|
||||
{
|
||||
wxCheckBox* FieldListCtrl[FIELD8 - FIELD1 + 1] = {
|
||||
m_AddField1,
|
||||
m_AddField2,
|
||||
m_AddField3,
|
||||
m_AddField4,
|
||||
m_AddField5,
|
||||
m_AddField6,
|
||||
m_AddField7,
|
||||
m_AddField8
|
||||
};
|
||||
|
||||
// Print comment line:
|
||||
fprintf( f, "ref%cvalue", s_ExportSeparatorSymbol );
|
||||
|
||||
if( aIncludeSubComponents )
|
||||
fprintf( f, "%csheet path", s_ExportSeparatorSymbol );
|
||||
|
||||
fprintf( f, "%cfootprint", s_ExportSeparatorSymbol );
|
||||
|
||||
for( ii = FIELD1; ii <= FIELD8; ii++ )
|
||||
{
|
||||
wxCheckBox* FieldCtrl = FieldListCtrl[ii - FIELD1];
|
||||
if( FieldCtrl == NULL )
|
||||
continue;
|
||||
if( !FieldCtrl->IsChecked() )
|
||||
continue;
|
||||
msg = _( "Field" );
|
||||
fprintf( f, "%c%s%d", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ), ii - FIELD1 + 1 );
|
||||
}
|
||||
|
||||
fprintf( f, "\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = _( "\n#Cmp ( order = Reference )" );
|
||||
|
||||
if( aIncludeSubComponents )
|
||||
msg << _( " (with SubCmp)" );
|
||||
fprintf( f, "%s\n", CONV_TO_UTF8( msg ) );
|
||||
}
|
||||
|
||||
// Print list of items
|
||||
for( ii = 0; ii < NbItems; ii++ )
|
||||
{
|
||||
DrawList = List[ii].m_Comp;
|
||||
|
||||
if( DrawList == NULL )
|
||||
continue;
|
||||
if( DrawList->Type() != TYPE_SCH_COMPONENT )
|
||||
continue;
|
||||
|
||||
DrawLibItem = (SCH_COMPONENT*) DrawList;
|
||||
if( List[ii].m_Ref[0] == '#' )
|
||||
continue;
|
||||
|
||||
Multi = 0;
|
||||
Unit = ' ';
|
||||
Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
||||
if( Entry )
|
||||
Multi = Entry->m_UnitCount;
|
||||
|
||||
if( ( Multi > 1 ) && aIncludeSubComponents )
|
||||
Unit = List[ii].m_Unit + 'A' - 1;
|
||||
|
||||
sprintf( CmpName, "%s", List[ii].m_Ref );
|
||||
if( !CompactForm || Unit != ' ' )
|
||||
sprintf( CmpName + strlen( CmpName ), "%c", Unit );
|
||||
|
||||
if( CompactForm )
|
||||
fprintf( f, "%s%c%s", CmpName, s_ExportSeparatorSymbol,
|
||||
CONV_TO_UTF8( DrawLibItem->m_Field[VALUE].m_Text ) );
|
||||
else
|
||||
fprintf( f, "| %-10s %-12s", CmpName,
|
||||
CONV_TO_UTF8( DrawLibItem->m_Field[VALUE].m_Text ) );
|
||||
|
||||
if( aIncludeSubComponents )
|
||||
{
|
||||
msg = List[ii].m_SheetList.PathHumanReadable();
|
||||
if( CompactForm )
|
||||
fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) );
|
||||
else
|
||||
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
|
||||
}
|
||||
|
||||
PrintFieldData( f, DrawLibItem, CompactForm );
|
||||
|
||||
fprintf( f, "\n" );
|
||||
}
|
||||
|
||||
if( !CompactForm )
|
||||
{
|
||||
msg = _( "#End Cmp\n" );
|
||||
fprintf( f, CONV_TO_UTF8( msg ) );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************/
|
||||
int WinEDA_Build_BOM_Frame::PrintListeCmpByVal( FILE* f, ListComponent* List, int NbItems,
|
||||
bool aIncludeSubComponents )
|
||||
/**********************************************************************************************/
|
||||
{
|
||||
int ii, Multi;
|
||||
wxChar Unit;
|
||||
EDA_BaseStruct* DrawList;
|
||||
SCH_COMPONENT* DrawLibItem;
|
||||
EDA_LibComponentStruct* Entry;
|
||||
char CmpName[80];
|
||||
wxString msg;
|
||||
|
||||
msg = _( "\n#Cmp ( order = Value )" );
|
||||
|
||||
if( aIncludeSubComponents )
|
||||
msg << _( " (with SubCmp)" );
|
||||
msg << wxT( "\n" );
|
||||
fprintf( f, CONV_TO_UTF8( msg ) );
|
||||
|
||||
for( ii = 0; ii < NbItems; ii++ )
|
||||
{
|
||||
DrawList = List[ii].m_Comp;
|
||||
|
||||
if( DrawList == NULL )
|
||||
continue;
|
||||
if( DrawList->Type() != TYPE_SCH_COMPONENT )
|
||||
continue;
|
||||
|
||||
DrawLibItem = (SCH_COMPONENT*) DrawList;
|
||||
if( List[ii].m_Ref[0] == '#' )
|
||||
continue;
|
||||
|
||||
Multi = 0;
|
||||
Unit = ' ';
|
||||
Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
||||
if( Entry )
|
||||
Multi = Entry->m_UnitCount;
|
||||
|
||||
if( ( Multi > 1 ) && aIncludeSubComponents )
|
||||
{
|
||||
Unit = List[ii].m_Unit + 'A' - 1;
|
||||
}
|
||||
|
||||
sprintf( CmpName, "%s%c", List[ii].m_Ref, Unit );
|
||||
fprintf( f, "| %-12s %-10s",CONV_TO_UTF8( DrawLibItem->m_Field[VALUE].m_Text ), CmpName );
|
||||
|
||||
// print the sheet path
|
||||
if( aIncludeSubComponents )
|
||||
{
|
||||
msg = List[ii].m_SheetList.PathHumanReadable();
|
||||
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
|
||||
}
|
||||
|
||||
PrintFieldData( f, DrawLibItem );
|
||||
|
||||
fprintf( f, "\n" );
|
||||
}
|
||||
|
||||
msg = _( "#End Cmp\n" );
|
||||
fprintf( f, CONV_TO_UTF8( msg ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
static int PrintListeGLabel( FILE* f, ListLabel* List, int NbItems )
|
||||
/******************************************************************/
|
||||
{
|
||||
int ii, jj;
|
||||
SCH_LABEL* DrawTextItem;
|
||||
Hierarchical_PIN_Sheet_Struct* DrawSheetLabel;
|
||||
ListLabel* LabelItem;
|
||||
wxString msg, sheetpath;
|
||||
wxString labeltype;
|
||||
|
||||
for( ii = 0; ii < NbItems; ii++ )
|
||||
{
|
||||
LabelItem = &List[ii];
|
||||
|
||||
switch( LabelItem->m_LabelType )
|
||||
{
|
||||
case TYPE_SCH_HIERLABEL:
|
||||
case TYPE_SCH_GLOBALLABEL:
|
||||
DrawTextItem = (SCH_LABEL*) (LabelItem->m_Label);
|
||||
if( LabelItem->m_LabelType == TYPE_SCH_HIERLABEL )
|
||||
labeltype = wxT( "Hierarchical" );
|
||||
else
|
||||
labeltype = wxT( "Global " );
|
||||
sheetpath = CONV_FROM_UTF8( LabelItem->m_SheetPath );
|
||||
msg.Printf(
|
||||
_( "> %-28.28s %s (Sheet %s) pos: %3.3f, %3.3f\n" ),
|
||||
DrawTextItem->m_Text.GetData(),
|
||||
labeltype.GetData(),
|
||||
sheetpath.GetData(),
|
||||
(float) DrawTextItem->m_Pos.x / 1000,
|
||||
(float) DrawTextItem->m_Pos.y / 1000 );
|
||||
|
||||
fprintf( f, CONV_TO_UTF8( msg ) );
|
||||
break;
|
||||
|
||||
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
||||
{
|
||||
DrawSheetLabel = (Hierarchical_PIN_Sheet_Struct*) LabelItem->m_Label;
|
||||
jj = DrawSheetLabel->m_Shape;
|
||||
if( jj < 0 )
|
||||
jj = NET_TMAX;
|
||||
if( jj > NET_TMAX )
|
||||
jj = 4;
|
||||
wxString labtype = CONV_FROM_UTF8( SheetLabelType[jj] );
|
||||
msg.Printf(
|
||||
_( "> %-28.28s PinSheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n" ),
|
||||
DrawSheetLabel->m_Text.GetData(),
|
||||
labtype.GetData(),
|
||||
LabelItem->m_SheetPath,
|
||||
(float) DrawSheetLabel->m_Pos.x / 1000,
|
||||
(float) DrawSheetLabel->m_Pos.y / 1000 );
|
||||
fprintf( f, CONV_TO_UTF8( msg ) );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
msg = _( "#End labels\n" );
|
||||
fprintf( f, CONV_TO_UTF8( msg ) );
|
||||
return 0;
|
||||
}
|
|
@ -47,19 +47,6 @@
|
|||
////@end XPM images
|
||||
|
||||
|
||||
/* fonctions locales */
|
||||
static int GenListeGLabels( ListLabel* List );
|
||||
int GenListeCmp( ListComponent* List );
|
||||
static int ListTriComposantByRef( ListComponent* Objet1,
|
||||
ListComponent* Objet2 );
|
||||
static int ListTriComposantByVal( ListComponent* Objet1,
|
||||
ListComponent* Objet2 );
|
||||
static int ListTriGLabelBySheet( ListLabel* Objet1, ListLabel* Objet2 );
|
||||
static int ListTriGLabelByVal( ListLabel* Objet1, ListLabel* Objet2 );
|
||||
static void DeleteSubCmp( ListComponent* List, int NbItems );
|
||||
|
||||
static int PrintListeGLabel( FILE* f, ListLabel* List, int NbItems );
|
||||
|
||||
/* Local variables */
|
||||
static bool s_ListByRef = TRUE;
|
||||
static bool s_ListByValue = TRUE;
|
||||
|
@ -100,7 +87,6 @@ static bool* s_AddFieldList[] = {
|
|||
* (selected by s_OutputSeparatorOpt, and s_OutputSeparatorOpt radiobox)
|
||||
*/
|
||||
static char s_ExportSeparator[] = ("\t;,.");
|
||||
static char s_ExportSeparatorSymbol;
|
||||
|
||||
/*!
|
||||
* WinEDA_Build_BOM_Frame type definition
|
||||
|
@ -166,10 +152,22 @@ WinEDA_Build_BOM_Frame::WinEDA_Build_BOM_Frame( WinEDA_DrawFrame* parent,
|
|||
|
||||
m_OutputFormCtrl->SetSelection( s_OutputFormOpt );
|
||||
m_OutputSeparatorCtrl->SetSelection( s_OutputSeparatorOpt );
|
||||
|
||||
// Enable/disable options:
|
||||
if( s_OutputFormOpt == 1 )
|
||||
{
|
||||
m_OutputSeparatorCtrl->Enable( true );
|
||||
m_ListCmpbyValItems->Enable( false );
|
||||
m_GenListLabelsbyVal->Enable( false );
|
||||
m_GenListLabelsbySheet->Enable( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_OutputSeparatorCtrl->Enable( false );
|
||||
m_ListCmpbyValItems->Enable( true );
|
||||
m_GenListLabelsbyVal->Enable( true );
|
||||
m_GenListLabelsbySheet->Enable( true );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -423,9 +421,19 @@ wxIcon WinEDA_Build_BOM_Frame::GetIconResource( const wxString& name )
|
|||
void WinEDA_Build_BOM_Frame::OnRadioboxSelectFormatSelected( wxCommandEvent& event )
|
||||
{
|
||||
if( m_OutputFormCtrl->GetSelection() == 1 )
|
||||
{
|
||||
m_OutputSeparatorCtrl->Enable( true );
|
||||
m_ListCmpbyValItems->Enable( false );
|
||||
m_GenListLabelsbyVal->Enable( false );
|
||||
m_GenListLabelsbySheet->Enable( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_OutputSeparatorCtrl->Enable( false );
|
||||
m_ListCmpbyValItems->Enable( true );
|
||||
m_GenListLabelsbyVal->Enable( true );
|
||||
m_GenListLabelsbySheet->Enable( true );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -435,7 +443,16 @@ void WinEDA_Build_BOM_Frame::OnRadioboxSelectFormatSelected( wxCommandEvent& eve
|
|||
|
||||
void WinEDA_Build_BOM_Frame::OnCreateListClick( wxCommandEvent& event )
|
||||
{
|
||||
GenList();
|
||||
char ExportSeparatorSymbol = s_ExportSeparator[0];
|
||||
if( m_OutputSeparatorCtrl->GetSelection() > 0 )
|
||||
ExportSeparatorSymbol = s_ExportSeparator[m_OutputSeparatorCtrl->GetSelection()];
|
||||
|
||||
bool ExportFileType = m_OutputFormCtrl->GetSelection() == 0 ? false : true;
|
||||
|
||||
SavePreferences();
|
||||
|
||||
Create_BOM_Lists( ExportFileType, m_ListSubCmpItems->GetValue(),
|
||||
ExportSeparatorSymbol, m_GetListBrowser->GetValue());
|
||||
}
|
||||
|
||||
|
||||
|
@ -515,855 +532,3 @@ void WinEDA_Build_BOM_Frame::SavePreferences()
|
|||
|
||||
m_Parent->m_Parent->m_EDA_Config->Write( OPTION_BOM_ADD_FIELD, addfields );
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
void WinEDA_Build_BOM_Frame::GenList()
|
||||
/**********************************************************/
|
||||
{
|
||||
#define EXT_LIST wxT( ".lst" )
|
||||
wxString mask, filename;
|
||||
|
||||
// Although the currently selected options determine the contents
|
||||
// and format of the subsequently generated file, they are still
|
||||
// *not* "restored" if the dialog box is ever subsequently invoked
|
||||
// again (unless those options had been specifically "saved" before
|
||||
// now (by clicking on either of the "OK" or "Apply" buttons)).
|
||||
//
|
||||
// Hence the following previously provided commands are now
|
||||
// commented out, and the currently selected options are now
|
||||
// read "directly" by the relevant functions instead. (The previous
|
||||
// behavior of the dialog box in this regard had been inconsistent,
|
||||
// in that the settings of the "Fields to add" checkboxes were *not*
|
||||
// "restored", whereas all of the other settings *were* "restored";
|
||||
// now, *none* of those settings are subsequently "restored".)
|
||||
|
||||
// s_ListByRef = m_ListCmpbyRefItems->GetValue();
|
||||
// s_ListWithSubCmponents = m_ListSubCmpItems->GetValue();
|
||||
// s_ListByValue = m_ListCmpbyValItems->GetValue();
|
||||
// s_ListHierarchicalPinByName = m_GenListLabelsbyVal->GetValue();
|
||||
// s_ListBySheet = m_GenListLabelsbySheet->GetValue();
|
||||
// s_BrowsList = m_GetListBrowser->GetValue();
|
||||
// s_OutputFormOpt = m_OutputFormCtrl->GetSelection();
|
||||
|
||||
// s_OutputSeparatorOpt = m_OutputSeparatorCtrl->GetSelection();
|
||||
// if( s_OutputSeparatorOpt < 0 )
|
||||
// s_OutputSeparatorOpt = 0;
|
||||
// s_ExportSeparatorSymbol = s_ExportSeparator[s_OutputSeparatorOpt];
|
||||
|
||||
// Updated code for determining the value of s_ExportSeparatorSymbol
|
||||
if( m_OutputSeparatorCtrl->GetSelection() > 0 )
|
||||
s_ExportSeparatorSymbol
|
||||
= s_ExportSeparator[m_OutputSeparatorCtrl->GetSelection()];
|
||||
else
|
||||
s_ExportSeparatorSymbol = s_ExportSeparator[0];
|
||||
|
||||
m_ListFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||
ChangeFileNameExt( m_ListFileName, EXT_LIST );
|
||||
|
||||
//need to get rid of the path.
|
||||
m_ListFileName = m_ListFileName.AfterLast( '/' );
|
||||
mask = wxT( "*" );
|
||||
mask += EXT_LIST;
|
||||
|
||||
filename = EDA_FileSelector( _( "Bill of materials:" ),
|
||||
wxEmptyString, /* Chemin par defaut (ici dir courante) */
|
||||
m_ListFileName, /* nom fichier par defaut, et resultat */
|
||||
EXT_LIST, /* extension par defaut */
|
||||
mask, /* Masque d'affichage */
|
||||
this,
|
||||
wxFD_SAVE,
|
||||
TRUE
|
||||
);
|
||||
if( filename.IsEmpty() )
|
||||
return;
|
||||
else
|
||||
m_ListFileName = filename;
|
||||
|
||||
/* Close dialog, then show the list (if so requested) */
|
||||
|
||||
// if( s_OutputFormOpt == 0 )
|
||||
if( m_OutputFormCtrl->GetSelection() == 0 )
|
||||
GenereListeOfItems( m_ListFileName );
|
||||
else
|
||||
CreateExportList( m_ListFileName );
|
||||
|
||||
EndModal( 1 );
|
||||
|
||||
// if( s_BrowsList )
|
||||
if( m_GetListBrowser->GetValue() )
|
||||
{
|
||||
wxString editorname = GetEditorName();
|
||||
AddDelimiterString( filename );
|
||||
ExecuteFile( this, editorname, filename );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
void WinEDA_Build_BOM_Frame::CreateExportList( const wxString& FullFileName )
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
* Print a list of components, in a form which can be imported by a spreadsheet
|
||||
* form is:
|
||||
* cmp name; cmp val; fields;
|
||||
*/
|
||||
{
|
||||
FILE* f;
|
||||
ListComponent* List;
|
||||
int NbItems;
|
||||
wxString msg;
|
||||
|
||||
/* Creation de la liste des elements */
|
||||
if( ( f = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL )
|
||||
{
|
||||
msg = _( "Failed to open file " );
|
||||
msg << FullFileName;
|
||||
DisplayError( this, msg );
|
||||
return;
|
||||
}
|
||||
|
||||
NbItems = GenListeCmp( NULL );
|
||||
if( NbItems )
|
||||
{
|
||||
List = (ListComponent*) MyZMalloc( NbItems * sizeof(ListComponent) );
|
||||
if( List == NULL )
|
||||
{
|
||||
fclose( f );
|
||||
return;
|
||||
}
|
||||
|
||||
GenListeCmp( List );
|
||||
|
||||
/* sort component list */
|
||||
qsort( List, NbItems, sizeof( ListComponent ),
|
||||
( int( * ) ( const void*, const void* ) )ListTriComposantByRef );
|
||||
|
||||
// if( ! s_ListWithSubCmponents )
|
||||
if( !m_ListSubCmpItems->GetValue() )
|
||||
DeleteSubCmp( List, NbItems );
|
||||
|
||||
/* create the file */
|
||||
PrintListeCmpByRef( f, List, NbItems, TRUE );
|
||||
|
||||
MyFree( List );
|
||||
}
|
||||
|
||||
fclose( f );
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName )
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
* Routine principale pour la creation des listings ( composants et/ou labels
|
||||
* globaux et "sheet labels" )
|
||||
*/
|
||||
{
|
||||
FILE* f;
|
||||
ListComponent* List;
|
||||
ListLabel* ListOfLabels;
|
||||
int NbItems;
|
||||
char Line[1024];
|
||||
wxString msg;
|
||||
|
||||
/* Creation de la liste des elements */
|
||||
if( ( f = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL )
|
||||
{
|
||||
msg = _( "Failed to open file " );
|
||||
msg << FullFileName;
|
||||
DisplayError( this, msg );
|
||||
return;
|
||||
}
|
||||
|
||||
NbItems = GenListeCmp( NULL );
|
||||
if( NbItems )
|
||||
{
|
||||
List = (ListComponent*) MyZMalloc( NbItems * sizeof(ListComponent) );
|
||||
if( List == NULL ) // Error memory alloc
|
||||
{
|
||||
fclose( f );
|
||||
return;
|
||||
}
|
||||
|
||||
GenListeCmp( List );
|
||||
|
||||
/* generation du fichier listing */
|
||||
DateAndTime( Line );
|
||||
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
||||
fprintf( f, "%s >> Creation date: %s\n", CONV_TO_UTF8( Title ), Line );
|
||||
|
||||
/* Tri et impression de la liste des composants */
|
||||
|
||||
qsort( List, NbItems, sizeof( ListComponent ),
|
||||
( int( * ) ( const void*, const void* ) )ListTriComposantByRef );
|
||||
|
||||
// if( ! s_ListWithSubCmponents )
|
||||
if( !m_ListSubCmpItems->GetValue() )
|
||||
DeleteSubCmp( List, NbItems );
|
||||
|
||||
// if( s_ListByRef )
|
||||
if( m_ListCmpbyRefItems->GetValue() )
|
||||
{
|
||||
PrintListeCmpByRef( f, List, NbItems );
|
||||
}
|
||||
|
||||
// if( s_ListByValue )
|
||||
if( m_ListCmpbyValItems->GetValue() )
|
||||
{
|
||||
qsort( List, NbItems, sizeof( ListComponent ),
|
||||
( int( * ) ( const void*, const void* ) )ListTriComposantByVal );
|
||||
PrintListeCmpByVal( f, List, NbItems );
|
||||
}
|
||||
MyFree( List );
|
||||
}
|
||||
|
||||
/***************************************/
|
||||
/* Generation liste des Labels globaux */
|
||||
/***************************************/
|
||||
NbItems = GenListeGLabels( NULL );
|
||||
if( NbItems )
|
||||
{
|
||||
ListOfLabels = (ListLabel*) MyZMalloc( NbItems * sizeof(ListLabel) );
|
||||
if( ListOfLabels == NULL )
|
||||
{
|
||||
fclose( f );
|
||||
return;
|
||||
}
|
||||
|
||||
GenListeGLabels( ListOfLabels );
|
||||
|
||||
/* Tri de la liste */
|
||||
|
||||
// if( s_ListBySheet )
|
||||
if( m_GenListLabelsbySheet->GetValue() )
|
||||
{
|
||||
qsort( ListOfLabels, NbItems, sizeof( ListLabel ),
|
||||
( int( * ) ( const void*, const void* ) )ListTriGLabelBySheet );
|
||||
|
||||
msg.Printf( _( "\n#Global, Hierarchical Labels and PinSheets ( order = Sheet Number ) count = %d\n" ), NbItems );
|
||||
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
|
||||
PrintListeGLabel( f, ListOfLabels, NbItems );
|
||||
}
|
||||
|
||||
// if( s_ListHierarchicalPinByName )
|
||||
if( m_GenListLabelsbyVal->GetValue() )
|
||||
{
|
||||
qsort( ListOfLabels, NbItems, sizeof( ListLabel ),
|
||||
( int( * ) ( const void*, const void* ) )ListTriGLabelByVal );
|
||||
|
||||
msg.Printf( _( "\n#Global, Hierarchical Labels and PinSheets ( order = Alphab. ) count = %d\n\n" ), NbItems );
|
||||
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
|
||||
PrintListeGLabel( f, ListOfLabels, NbItems );
|
||||
}
|
||||
MyFree( ListOfLabels );
|
||||
}
|
||||
|
||||
msg = _( "\n#End List\n" );
|
||||
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
|
||||
fclose( f );
|
||||
}
|
||||
|
||||
|
||||
/****************************************/
|
||||
int GenListeCmp( ListComponent* List )
|
||||
/****************************************/
|
||||
|
||||
/* Creates the list of components in the schematic
|
||||
*
|
||||
* routine for generating a list of the used components.
|
||||
* if List == null, just returns the count. if not, fills the list.
|
||||
* goes through the sheets, not the screens, so that we account for
|
||||
* multiple instances of a given screen.
|
||||
* Also Initialise m_Father as pointer pointeur of the SCH_SCREN parent
|
||||
*/
|
||||
{
|
||||
int ItemCount = 0;
|
||||
EDA_BaseStruct* SchItem;
|
||||
SCH_COMPONENT* DrawLibItem;
|
||||
DrawSheetPath* sheet;
|
||||
|
||||
/* Build the sheet (not screen) list */
|
||||
EDA_SheetList SheetList( NULL );
|
||||
|
||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||
{
|
||||
for ( SchItem = sheet->LastDrawList(); SchItem;SchItem = SchItem->Next() )
|
||||
{
|
||||
if( SchItem->Type() != TYPE_SCH_COMPONENT )
|
||||
continue;
|
||||
|
||||
ItemCount++;
|
||||
DrawLibItem = (SCH_COMPONENT*) SchItem;
|
||||
DrawLibItem->m_Parent = sheet->LastScreen();
|
||||
if( List )
|
||||
{
|
||||
List->m_Comp = DrawLibItem;
|
||||
List->m_SheetList = *sheet;
|
||||
strncpy( List->m_Ref,
|
||||
CONV_TO_UTF8( DrawLibItem->GetRef( sheet ) ),
|
||||
sizeof( List->m_Ref ) );
|
||||
List++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ItemCount;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************/
|
||||
static int GenListeGLabels( ListLabel* List )
|
||||
/*********************************************/
|
||||
|
||||
/* Count the Glabels, or fill the list Listwith Glabel pointers
|
||||
* If List == NULL: Item count only
|
||||
* Else fill list of Glabels
|
||||
*/
|
||||
{
|
||||
int ItemCount = 0;
|
||||
EDA_BaseStruct* DrawList;
|
||||
Hierarchical_PIN_Sheet_Struct* SheetLabel;
|
||||
DrawSheetPath* sheet;
|
||||
|
||||
/* Build the screen list */
|
||||
EDA_SheetList SheetList( NULL );
|
||||
|
||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||
{
|
||||
DrawList = sheet->LastDrawList();
|
||||
wxString path = sheet->PathHumanReadable();
|
||||
while( DrawList )
|
||||
{
|
||||
switch( DrawList->Type() )
|
||||
{
|
||||
case TYPE_SCH_HIERLABEL:
|
||||
case TYPE_SCH_GLOBALLABEL:
|
||||
ItemCount++;
|
||||
if( List )
|
||||
{
|
||||
List->m_LabelType = DrawList->Type();
|
||||
snprintf( List->m_SheetPath, sizeof(List->m_SheetPath),
|
||||
"%s", CONV_TO_UTF8( path ) );
|
||||
List->m_Label = DrawList;
|
||||
List++;
|
||||
}
|
||||
break;
|
||||
|
||||
case DRAW_SHEET_STRUCT_TYPE:
|
||||
{
|
||||
#define Sheet ( (DrawSheetStruct*) DrawList )
|
||||
SheetLabel = Sheet->m_Label;
|
||||
while( SheetLabel != NULL )
|
||||
{
|
||||
if( List )
|
||||
{
|
||||
List->m_LabelType = DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE;
|
||||
snprintf( List->m_SheetPath, sizeof(List->m_SheetPath),
|
||||
"%s", CONV_TO_UTF8( path ) );
|
||||
List->m_Label = SheetLabel;
|
||||
List++;
|
||||
}
|
||||
ItemCount++;
|
||||
SheetLabel = (Hierarchical_PIN_Sheet_Struct*) (SheetLabel->Pnext);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
DrawList = DrawList->Pnext;
|
||||
}
|
||||
}
|
||||
|
||||
return ItemCount;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
static int ListTriComposantByVal( ListComponent* Objet1,
|
||||
ListComponent* Objet2 )
|
||||
/**********************************************************/
|
||||
|
||||
/* Routine de comparaison pour le tri du Tableau par qsort()
|
||||
* Les composants sont tries
|
||||
* par valeur
|
||||
* si meme valeur: par reference
|
||||
* si meme valeur: par numero d'unite
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
const wxString* Text1, * Text2;
|
||||
|
||||
if( ( Objet1 == NULL ) && ( Objet2 == NULL ) )
|
||||
return 0;
|
||||
if( Objet1 == NULL )
|
||||
return -1;
|
||||
if( Objet2 == NULL )
|
||||
return 1;
|
||||
if( ( Objet1->m_Comp == NULL ) && ( Objet2->m_Comp == NULL ) )
|
||||
return 0;
|
||||
if( Objet1->m_Comp == NULL )
|
||||
return -1;
|
||||
if( Objet2->m_Comp == NULL )
|
||||
return 1;
|
||||
|
||||
Text1 = &(Objet1->m_Comp->m_Field[VALUE].m_Text);
|
||||
Text2 = &(Objet2->m_Comp->m_Field[VALUE].m_Text);
|
||||
ii = Text1->CmpNoCase( *Text2 );
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
ii = strcmp( Objet1->m_Ref, Objet2->m_Ref );
|
||||
}
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
ii = Objet1->m_Comp->m_Multi - Objet2->m_Comp->m_Multi;
|
||||
}
|
||||
|
||||
return ii;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
static int ListTriComposantByRef( ListComponent* Objet1,
|
||||
ListComponent* Objet2 )
|
||||
/**********************************************************/
|
||||
|
||||
/* Routine de comparaison pour le tri du Tableau par qsort()
|
||||
* Les composants sont tries
|
||||
* par reference
|
||||
* si meme referenece: par valeur
|
||||
* si meme valeur: par numero d'unite
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
const wxString* Text1, * Text2;
|
||||
|
||||
if( ( Objet1 == NULL ) && ( Objet2 == NULL ) )
|
||||
return 0;
|
||||
if( Objet1 == NULL )
|
||||
return -1;
|
||||
if( Objet2 == NULL )
|
||||
return 1;
|
||||
|
||||
if( ( Objet1->m_Comp == NULL ) && ( Objet2->m_Comp == NULL ) )
|
||||
return 0;
|
||||
if( Objet1->m_Comp == NULL )
|
||||
return -1;
|
||||
if( Objet2->m_Comp == NULL )
|
||||
return 1;
|
||||
|
||||
ii = strcmp( Objet1->m_Ref, Objet2->m_Ref );
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
Text1 = &( Objet1->m_Comp->m_Field[VALUE].m_Text );
|
||||
Text2 = &( Objet2->m_Comp->m_Field[VALUE].m_Text );
|
||||
ii = Text1->CmpNoCase( *Text2 );
|
||||
}
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
ii = Objet1->m_Comp->m_Multi - Objet2->m_Comp->m_Multi;
|
||||
}
|
||||
|
||||
return ii;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
static int ListTriGLabelByVal( ListLabel* Objet1, ListLabel* Objet2 )
|
||||
/*******************************************************************/
|
||||
|
||||
/* Routine de comparaison pour le tri du Tableau par qsort()
|
||||
* Les labels sont tries
|
||||
* par comparaison ascii
|
||||
* si meme valeur: par numero de sheet
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
const wxString* Text1, * Text2;
|
||||
|
||||
if( Objet1->m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
||||
Text1 = &( (Hierarchical_PIN_Sheet_Struct*) Objet1->m_Label )->m_Text;
|
||||
else
|
||||
Text1 = &( (SCH_TEXT*) Objet1->m_Label )->m_Text;
|
||||
|
||||
if( Objet2->m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
||||
Text2 = &( (Hierarchical_PIN_Sheet_Struct*) Objet2->m_Label )->m_Text;
|
||||
else
|
||||
Text2 = &( (SCH_TEXT*) Objet2->m_Label )->m_Text;
|
||||
|
||||
ii = Text1->CmpNoCase( *Text2 );
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
ii = strcmp( Objet1->m_SheetPath, Objet2->m_SheetPath );
|
||||
}
|
||||
|
||||
return ii;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************/
|
||||
static int ListTriGLabelBySheet( ListLabel* Objet1, ListLabel* Objet2 )
|
||||
/*******************************************************************/
|
||||
|
||||
/* Routine de comparaison pour le tri du Tableau par qsort()
|
||||
* Les labels sont tries
|
||||
* par sheet number
|
||||
* si meme valeur, par ordre alphabetique
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
const wxString* Text1, * Text2;
|
||||
|
||||
|
||||
ii = strcmp( Objet1->m_SheetPath, Objet2->m_SheetPath );
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
if( Objet1->m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
||||
Text1 = &( (Hierarchical_PIN_Sheet_Struct*) Objet1->m_Label )->m_Text;
|
||||
else
|
||||
Text1 = &( (SCH_TEXT*) Objet1->m_Label )->m_Text;
|
||||
|
||||
if( Objet2->m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
||||
Text2 = &( (Hierarchical_PIN_Sheet_Struct*) Objet2->m_Label )->m_Text;
|
||||
else
|
||||
Text2 = &( (SCH_TEXT*) Objet2->m_Label )->m_Text;
|
||||
|
||||
ii = Text1->CmpNoCase( *Text2 );
|
||||
}
|
||||
|
||||
return ii;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
static void DeleteSubCmp( ListComponent* List, int NbItems )
|
||||
/**************************************************************/
|
||||
|
||||
/* Remove sub components from the list, when multiples parts per package are found in this list
|
||||
* The component list **MUST** be sorted by reference and by unit number
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
SCH_COMPONENT* LibItem;
|
||||
wxString OldName, CurrName;
|
||||
|
||||
for( ii = 0; ii < NbItems; ii++ )
|
||||
{
|
||||
LibItem = List[ii].m_Comp;
|
||||
if( LibItem == NULL )
|
||||
continue;
|
||||
CurrName = CONV_FROM_UTF8( List[ii].m_Ref );
|
||||
if( !OldName.IsEmpty() )
|
||||
{
|
||||
if( OldName == CurrName ) // CurrName is a subpart of OldName: remove it
|
||||
{
|
||||
List[ii].m_Comp = NULL;
|
||||
List[ii].m_SheetList.Clear();
|
||||
List[ii].m_Ref[0] = 0;
|
||||
}
|
||||
}
|
||||
OldName = CurrName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************************/
|
||||
void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
|
||||
bool CompactForm )
|
||||
/*******************************************************************************************/
|
||||
{
|
||||
wxCheckBox* FieldListCtrl[FIELD8 - FIELD1 + 1] = {
|
||||
m_AddField1,
|
||||
m_AddField2,
|
||||
m_AddField3,
|
||||
m_AddField4,
|
||||
m_AddField5,
|
||||
m_AddField6,
|
||||
m_AddField7,
|
||||
m_AddField8
|
||||
};
|
||||
int ii;
|
||||
wxCheckBox* FieldCtrl = FieldListCtrl[0];
|
||||
|
||||
if( CompactForm )
|
||||
{
|
||||
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
|
||||
CONV_TO_UTF8( DrawLibItem->m_Field[FOOTPRINT].m_Text ) );
|
||||
}
|
||||
|
||||
for( ii = FIELD1; ii <= FIELD8; ii++ )
|
||||
{
|
||||
FieldCtrl = FieldListCtrl[ii - FIELD1];
|
||||
if( FieldCtrl == NULL )
|
||||
continue;
|
||||
if( !FieldCtrl->IsChecked() )
|
||||
continue;
|
||||
if( CompactForm )
|
||||
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
|
||||
CONV_TO_UTF8( DrawLibItem->m_Field[ii].m_Text ) );
|
||||
else
|
||||
fprintf( f, "; %-12s", CONV_TO_UTF8( DrawLibItem->m_Field[ii].m_Text ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************/
|
||||
int WinEDA_Build_BOM_Frame::PrintListeCmpByRef( FILE* f, ListComponent* List, int NbItems,
|
||||
bool CompactForm )
|
||||
/*********************************************************************************************/
|
||||
|
||||
/* Print the B.O.M sorted by reference
|
||||
*/
|
||||
{
|
||||
int ii, Multi, Unit;
|
||||
EDA_BaseStruct* DrawList;
|
||||
SCH_COMPONENT* DrawLibItem;
|
||||
EDA_LibComponentStruct* Entry;
|
||||
char NameCmp[80];
|
||||
wxString msg;
|
||||
|
||||
if( CompactForm )
|
||||
{
|
||||
wxCheckBox* FieldListCtrl[FIELD8 - FIELD1 + 1] = {
|
||||
m_AddField1,
|
||||
m_AddField2,
|
||||
m_AddField3,
|
||||
m_AddField4,
|
||||
m_AddField5,
|
||||
m_AddField6,
|
||||
m_AddField7,
|
||||
m_AddField8
|
||||
};
|
||||
|
||||
// Print comment line:
|
||||
fprintf( f, "ref%cvalue", s_ExportSeparatorSymbol );
|
||||
|
||||
if( m_ListSubCmpItems->GetValue() )
|
||||
fprintf( f, "%csheet path", s_ExportSeparatorSymbol );
|
||||
|
||||
fprintf( f, "%cfootprint", s_ExportSeparatorSymbol );
|
||||
|
||||
for( ii = FIELD1; ii <= FIELD8; ii++ )
|
||||
{
|
||||
wxCheckBox* FieldCtrl = FieldListCtrl[ii - FIELD1];
|
||||
if( FieldCtrl == NULL )
|
||||
continue;
|
||||
if( !FieldCtrl->IsChecked() )
|
||||
continue;
|
||||
msg = _( "Field" );
|
||||
fprintf( f, "%c%s%d", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ), ii - FIELD1 + 1 );
|
||||
}
|
||||
|
||||
fprintf( f, "\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = _( "\n#Cmp ( order = Reference )" );
|
||||
|
||||
// if( s_ListWithSubCmponents )
|
||||
if( m_ListSubCmpItems->GetValue() )
|
||||
msg << _( " (with SubCmp)" );
|
||||
fprintf( f, "%s\n", CONV_TO_UTF8( msg ) );
|
||||
}
|
||||
|
||||
// Print list of items
|
||||
for( ii = 0; ii < NbItems; ii++ )
|
||||
{
|
||||
DrawList = List[ii].m_Comp;
|
||||
|
||||
if( DrawList == NULL )
|
||||
continue;
|
||||
if( DrawList->Type() != TYPE_SCH_COMPONENT )
|
||||
continue;
|
||||
|
||||
DrawLibItem = (SCH_COMPONENT*) DrawList;
|
||||
if( List[ii].m_Ref[0] == '#' )
|
||||
continue;
|
||||
|
||||
Multi = 0;
|
||||
Unit = ' ';
|
||||
Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
||||
if( Entry )
|
||||
Multi = Entry->m_UnitCount;
|
||||
|
||||
// if( ( Multi > 1 ) && s_ListWithSubCmponents )
|
||||
if( ( Multi > 1 ) && m_ListSubCmpItems->GetValue() )
|
||||
Unit = DrawLibItem->m_Multi + 'A' - 1;
|
||||
|
||||
sprintf( NameCmp, "%s", List[ii].m_Ref );
|
||||
if( !CompactForm || Unit != ' ' )
|
||||
sprintf( NameCmp + strlen( NameCmp ), "%c", Unit );
|
||||
|
||||
if( CompactForm )
|
||||
fprintf( f, "%s%c%s", NameCmp, s_ExportSeparatorSymbol,
|
||||
CONV_TO_UTF8( DrawLibItem->m_Field[VALUE].m_Text ) );
|
||||
else
|
||||
fprintf( f, "| %-10s %-12s", NameCmp,
|
||||
CONV_TO_UTF8( DrawLibItem->m_Field[VALUE].m_Text ) );
|
||||
|
||||
// if( s_ListWithSubCmponents )
|
||||
if( m_ListSubCmpItems->GetValue() )
|
||||
{
|
||||
msg = List[ii].m_SheetList.PathHumanReadable();
|
||||
if( CompactForm )
|
||||
fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) );
|
||||
else
|
||||
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
|
||||
}
|
||||
|
||||
PrintFieldData( f, DrawLibItem, CompactForm );
|
||||
|
||||
fprintf( f, "\n" );
|
||||
}
|
||||
|
||||
if( !CompactForm )
|
||||
{
|
||||
msg = _( "#End Cmp\n" );
|
||||
fprintf( f, CONV_TO_UTF8( msg ) );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************/
|
||||
int WinEDA_Build_BOM_Frame::PrintListeCmpByVal( FILE* f, ListComponent* List, int NbItems )
|
||||
/**********************************************************************************************/
|
||||
{
|
||||
int ii, Multi;
|
||||
wxChar Unit;
|
||||
EDA_BaseStruct* DrawList;
|
||||
SCH_COMPONENT* DrawLibItem;
|
||||
EDA_LibComponentStruct* Entry;
|
||||
wxString msg;
|
||||
|
||||
msg = _( "\n#Cmp ( order = Value )" );
|
||||
|
||||
// if( s_ListWithSubCmponents )
|
||||
if( m_ListSubCmpItems->GetValue() )
|
||||
msg << _( " (with SubCmp)" );
|
||||
msg << wxT( "\n" );
|
||||
fprintf( f, CONV_TO_UTF8( msg ) );
|
||||
|
||||
for( ii = 0; ii < NbItems; ii++ )
|
||||
{
|
||||
DrawList = List[ii].m_Comp;
|
||||
|
||||
if( DrawList == NULL )
|
||||
continue;
|
||||
if( DrawList->Type() != TYPE_SCH_COMPONENT )
|
||||
continue;
|
||||
|
||||
DrawLibItem = (SCH_COMPONENT*) DrawList;
|
||||
if( List[ii].m_Ref[0] == '#' )
|
||||
continue;
|
||||
|
||||
Multi = 0;
|
||||
Unit = ' ';
|
||||
Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
||||
if( Entry )
|
||||
Multi = Entry->m_UnitCount;
|
||||
|
||||
// if( ( Multi > 1 ) && s_ListWithSubCmponents )
|
||||
if( ( Multi > 1 ) && m_ListSubCmpItems->GetValue() )
|
||||
{
|
||||
Unit = DrawLibItem->m_Multi + 'A' - 1;
|
||||
}
|
||||
fprintf( f, "| %-12s %-10s%c",
|
||||
CONV_TO_UTF8( DrawLibItem->m_Field[VALUE].m_Text ),
|
||||
List[ii].m_Ref, Unit );
|
||||
|
||||
// if( s_ListWithSubCmponents )
|
||||
// print the sheet path
|
||||
if( m_ListSubCmpItems->GetValue() )
|
||||
{
|
||||
msg = List[ii].m_SheetList.PathHumanReadable();
|
||||
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
|
||||
}
|
||||
|
||||
PrintFieldData( f, DrawLibItem );
|
||||
|
||||
fprintf( f, "\n" );
|
||||
}
|
||||
|
||||
msg = _( "#End Cmp\n" );
|
||||
fprintf( f, CONV_TO_UTF8( msg ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
static int PrintListeGLabel( FILE* f, ListLabel* List, int NbItems )
|
||||
/******************************************************************/
|
||||
{
|
||||
int ii, jj;
|
||||
SCH_LABEL* DrawTextItem;
|
||||
Hierarchical_PIN_Sheet_Struct* DrawSheetLabel;
|
||||
ListLabel* LabelItem;
|
||||
wxString msg, sheetpath;
|
||||
wxString labeltype;
|
||||
|
||||
for( ii = 0; ii < NbItems; ii++ )
|
||||
{
|
||||
LabelItem = &List[ii];
|
||||
|
||||
switch( LabelItem->m_LabelType )
|
||||
{
|
||||
case TYPE_SCH_HIERLABEL:
|
||||
case TYPE_SCH_GLOBALLABEL:
|
||||
DrawTextItem = (SCH_LABEL*) (LabelItem->m_Label);
|
||||
if( LabelItem->m_LabelType == TYPE_SCH_HIERLABEL )
|
||||
labeltype = wxT("Hierarchical");
|
||||
else
|
||||
labeltype = wxT("Global ");
|
||||
sheetpath = CONV_FROM_UTF8(LabelItem->m_SheetPath);
|
||||
msg.Printf(
|
||||
_( "> %-28.28s %s (Sheet %s) pos: %3.3f, %3.3f\n" ),
|
||||
DrawTextItem->m_Text.GetData(),
|
||||
labeltype.GetData(),
|
||||
sheetpath.GetData(),
|
||||
(float) DrawTextItem->m_Pos.x / 1000,
|
||||
(float) DrawTextItem->m_Pos.y / 1000 );
|
||||
|
||||
fprintf( f, CONV_TO_UTF8( msg ) );
|
||||
break;
|
||||
|
||||
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
||||
{
|
||||
DrawSheetLabel = (Hierarchical_PIN_Sheet_Struct*) LabelItem->m_Label;
|
||||
jj = DrawSheetLabel->m_Shape;
|
||||
if( jj < 0 )
|
||||
jj = NET_TMAX;
|
||||
if( jj > NET_TMAX )
|
||||
jj = 4;
|
||||
wxString labtype = CONV_FROM_UTF8( SheetLabelType[jj] );
|
||||
msg.Printf(
|
||||
_( "> %-28.28s PinSheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n" ),
|
||||
DrawSheetLabel->m_Text.GetData(),
|
||||
labtype.GetData(),
|
||||
LabelItem->m_SheetPath,
|
||||
(float) DrawSheetLabel->m_Pos.x / 1000,
|
||||
(float) DrawSheetLabel->m_Pos.y / 1000 );
|
||||
fprintf( f, CONV_TO_UTF8( msg ) );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
msg = _( "#End labels\n" );
|
||||
fprintf( f, CONV_TO_UTF8( msg ) );
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -119,8 +119,6 @@ public:
|
|||
|
||||
////@end WinEDA_Build_BOM_Frame event handler declarations
|
||||
|
||||
void GenList();
|
||||
|
||||
////@begin WinEDA_Build_BOM_Frame member function declarations
|
||||
|
||||
/// Retrieves bitmap resources
|
||||
|
@ -129,10 +127,17 @@ public:
|
|||
/// Retrieves icon resources
|
||||
wxIcon GetIconResource( const wxString& name );
|
||||
////@end WinEDA_Build_BOM_Frame member function declarations
|
||||
void GenereListeOfItems(const wxString & FullFileName);
|
||||
void CreateExportList(const wxString & FullFileName);
|
||||
int PrintListeCmpByRef( FILE * f, ListComponent * List, int NbItems, bool CompactForm = FALSE );
|
||||
int PrintListeCmpByVal( FILE *f, ListComponent * List, int NbItems);
|
||||
|
||||
void Create_BOM_Lists(bool aTypeFileIsExport,
|
||||
bool aIncludeSubComponents,
|
||||
char aExportSeparatorSymbol,
|
||||
bool aRunBrowser);
|
||||
void GenereListeOfItems(const wxString & FullFileName, bool aIncludeSubComponents );
|
||||
void CreateExportList(const wxString & FullFileName, bool aIncludeSubComponents);
|
||||
int PrintListeCmpByRef( FILE * f, ListComponent * List, int NbItems,
|
||||
bool CompactForm, bool aIncludeSubComponents );
|
||||
int PrintListeCmpByVal( FILE *f, ListComponent * List, int NbItems,
|
||||
bool aIncludeSubComponents);
|
||||
void PrintFieldData(FILE * f, SCH_COMPONENT * DrawLibItem, bool CompactForm = FALSE);
|
||||
void SavePreferences();
|
||||
|
||||
|
|
|
@ -71,7 +71,9 @@ OBJECTS = eeschema.o\
|
|||
plot.o libalias.o \
|
||||
plotps.o netform.o \
|
||||
delsheet.o \
|
||||
delete.o dialog_build_BOM.o \
|
||||
delete.o\
|
||||
build_BOM.o \
|
||||
dialog_build_BOM.o \
|
||||
erc.o\
|
||||
dialog_erc.o\
|
||||
selpart.o \
|
||||
|
|
|
@ -95,19 +95,20 @@ typedef struct ListLabel
|
|||
{
|
||||
int m_LabelType;
|
||||
void* m_Label;
|
||||
char m_SheetPath[64];
|
||||
char m_SheetPath[256];
|
||||
} ListLabel;
|
||||
|
||||
// Used to create lists of components BOM, netlist generation)
|
||||
typedef struct ListComponent
|
||||
{
|
||||
SCH_COMPONENT* m_Comp;
|
||||
char m_Ref[32];
|
||||
|
||||
SCH_COMPONENT* m_Comp; // pointer on the component in schematic
|
||||
char m_Ref[32]; // component reference
|
||||
int m_Unit; // Unit value, for multiple parts per package
|
||||
//have to store it here since the object references will be duplicated.
|
||||
DrawSheetPath m_SheetList; //composed of UIDs
|
||||
} ListComponent;
|
||||
|
||||
/* Structure decrivant 1 composant de la schematique (pour *annotation* ) */
|
||||
/* Structure decrivant 1 composant de la schematique (for annotation ) */
|
||||
struct CmpListStruct
|
||||
{
|
||||
public:
|
||||
|
@ -123,7 +124,7 @@ public:
|
|||
int m_NumRef; /* Numero de reference */
|
||||
int m_Flag; /* flag pour calculs internes */
|
||||
wxPoint m_Pos; /* position components */
|
||||
char m_Path[128]; // the 'path' of the object in the sheet hierarchy.
|
||||
char m_Path[256]; // the 'path' of the object in the sheet hierarchy.
|
||||
};
|
||||
|
||||
|
||||
|
|
Binary file not shown.
4422
internat/fr/kicad.po
4422
internat/fr/kicad.po
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue