2009-11-03 13:26:31 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2010-02-26 08:36:58 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
// Name: build_BOM.cpp
|
2008-05-15 19:14:17 +00:00
|
|
|
// Purpose:
|
2009-11-03 13:26:31 +00:00
|
|
|
// Author: jean-pierre Charras
|
2009-12-02 21:44:03 +00:00
|
|
|
// License: GPL license
|
2008-05-15 19:14:17 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
#include <algorithm> // to use sort vector
|
|
|
|
#include <vector>
|
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "confirm.h"
|
|
|
|
#include "kicad_string.h"
|
|
|
|
#include "gestfich.h"
|
2009-04-05 20:49:15 +00:00
|
|
|
#include "appl_wxstruct.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
#include "program.h"
|
|
|
|
#include "general.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
#include "class_library.h"
|
2008-05-15 19:14:17 +00:00
|
|
|
#include "netlist.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
#include "protos.h"
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2010-01-05 08:48:49 +00:00
|
|
|
#include "build_version.h"
|
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
#include "dialog_build_BOM.h"
|
|
|
|
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
/**
|
|
|
|
* @bug - Every instance of fprintf() and fputs() in this file fails to check
|
|
|
|
* the return value for an error.
|
|
|
|
*/
|
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class LABEL_OBJECT
|
|
|
|
* is used in build BOM to handle the list of labels in schematic
|
2008-12-10 16:49:53 +00:00
|
|
|
* because in a complex hierarchy, a label is used more than once,
|
|
|
|
* and had more than one sheet path, so we must create a flat list of labels
|
|
|
|
*/
|
|
|
|
class LABEL_OBJECT
|
|
|
|
{
|
|
|
|
public:
|
2009-12-02 21:44:03 +00:00
|
|
|
int m_LabelType;
|
|
|
|
SCH_ITEM* m_Label;
|
2008-12-10 18:00:15 +00:00
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
//have to store it here since the object references will be duplicated.
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_PATH m_SheetPath; //composed of UIDs
|
2008-12-10 16:49:53 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
public: LABEL_OBJECT()
|
2008-12-10 16:49:53 +00:00
|
|
|
{
|
|
|
|
m_Label = NULL;
|
|
|
|
m_LabelType = 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
static void BuildComponentsListFromSchematic(
|
|
|
|
std::vector <OBJ_CMP_TO_LIST>& aList );
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2008-12-10 18:00:15 +00:00
|
|
|
static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList );
|
2009-11-03 13:26:31 +00:00
|
|
|
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 SortLabelsBySheet( const LABEL_OBJECT& obj1,
|
|
|
|
const LABEL_OBJECT& obj2 );
|
2008-12-10 18:00:15 +00:00
|
|
|
static void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList );
|
2008-12-10 16:49:53 +00:00
|
|
|
static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList );
|
2008-05-28 12:28:47 +00:00
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
// separator used in bom export to spreadsheet
|
2008-05-15 19:14:17 +00:00
|
|
|
static char s_ExportSeparatorSymbol;
|
|
|
|
|
|
|
|
|
2010-02-26 06:06:03 +00:00
|
|
|
void DIALOG_BUILD_BOM::Create_BOM_Lists( int aTypeFile,
|
2009-04-25 10:12:30 +00:00
|
|
|
bool aIncludeSubComponents,
|
|
|
|
char aExportSeparatorSymbol,
|
|
|
|
bool aRunBrowser )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
wxString wildcard;
|
|
|
|
|
|
|
|
static wxFileName fn;
|
|
|
|
|
|
|
|
wxFileName current = g_RootSheet->m_AssociatedScreen->m_FileName;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
|
|
|
s_ExportSeparatorSymbol = aExportSeparatorSymbol;
|
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
if( !fn.HasName() || fn.GetName()==NAMELESS_PROJECT )
|
|
|
|
{
|
|
|
|
fn.SetName( current.GetName() );
|
|
|
|
}
|
|
|
|
// else use a previous run's name, because fn was set before and user
|
|
|
|
// is probably just iteratively refining the BOM.
|
|
|
|
|
|
|
|
if( fn.GetPath().IsEmpty() )
|
|
|
|
{
|
|
|
|
fn.SetPath( current.GetPath() );
|
|
|
|
}
|
|
|
|
// else use a previous run's path, because fn was set before and user
|
|
|
|
// is probably just iteratively refining the BOM.
|
|
|
|
|
|
|
|
wxString bomDesc = _( "Bill of Materials" ); // translate once, use twice.
|
|
|
|
|
|
|
|
if( aTypeFile == 0 )
|
|
|
|
{
|
|
|
|
fn.SetExt( wxT( "lst" ) );
|
|
|
|
wildcard = bomDesc + wxT( " (*.lst)|*.lst" );
|
|
|
|
}
|
2010-02-26 08:36:58 +00:00
|
|
|
else
|
2010-07-30 21:41:55 +00:00
|
|
|
{
|
|
|
|
fn.SetExt( wxT( "csv" ) );
|
|
|
|
wildcard = bomDesc + wxT( " (*.csv)|*.csv" );
|
|
|
|
}
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
wxFileDialog dlg( this, bomDesc, fn.GetPath(),
|
|
|
|
fn.GetFullName(), wildcard,
|
2009-04-05 20:49:15 +00:00
|
|
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
2008-05-15 19:14:17 +00:00
|
|
|
return;
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
fn = dlg.GetPath(); // remember path+filename+ext for subsequent runs.
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
m_ListFileName = dlg.GetPath();
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
// Close dialog, then show the list (if so requested)
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2010-02-26 08:36:58 +00:00
|
|
|
switch( aTypeFile )
|
|
|
|
{
|
|
|
|
case 0: // list
|
2008-05-15 19:14:17 +00:00
|
|
|
GenereListeOfItems( m_ListFileName, aIncludeSubComponents );
|
2010-02-26 08:36:58 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: // speadsheet
|
2010-02-26 06:06:03 +00:00
|
|
|
CreateExportList( m_ListFileName, aIncludeSubComponents );
|
2010-02-26 08:36:58 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: // Single Part per line
|
2010-02-26 11:18:08 +00:00
|
|
|
CreatePartsList( m_ListFileName, aIncludeSubComponents );
|
2010-02-26 08:36:58 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-05-15 19:14:17 +00:00
|
|
|
|
|
|
|
EndModal( 1 );
|
|
|
|
|
|
|
|
if( aRunBrowser )
|
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
wxString editorname = wxGetApp().GetEditorName();
|
2009-04-25 10:12:30 +00:00
|
|
|
wxString filename = m_ListFileName;
|
2008-05-15 19:14:17 +00:00
|
|
|
AddDelimiterString( filename );
|
|
|
|
ExecuteFile( this, editorname, filename );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-19 20:15:30 +00:00
|
|
|
/** Helper function IsFieldChecked
|
|
|
|
* return the state of the wxCheckbox corresponding to the
|
|
|
|
* field aFieldId (FOOTPRINT and FIELD1 to FIELD8
|
|
|
|
* if the option "All user fields" is checked, return always true
|
|
|
|
* for fileds ids >= FIELD1
|
|
|
|
* @param aFieldId = the field id : FOOTPRINT to FIELD8
|
|
|
|
*/
|
|
|
|
bool DIALOG_BUILD_BOM::IsFieldChecked(int aFieldId)
|
|
|
|
{
|
|
|
|
if( m_AddAllFields->IsChecked() && (aFieldId>= FIELD1) )
|
|
|
|
return true;
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2010-03-19 20:15:30 +00:00
|
|
|
switch ( aFieldId )
|
|
|
|
{
|
|
|
|
case FIELD1:
|
|
|
|
return m_AddField1->IsChecked();
|
|
|
|
case FIELD2:
|
|
|
|
return m_AddField2->IsChecked();
|
|
|
|
case FIELD3:
|
|
|
|
return m_AddField3->IsChecked();
|
|
|
|
case FIELD4:
|
|
|
|
return m_AddField4->IsChecked();
|
|
|
|
case FIELD5:
|
|
|
|
return m_AddField5->IsChecked();
|
|
|
|
case FIELD6:
|
|
|
|
return m_AddField6->IsChecked();
|
|
|
|
case FIELD7:
|
|
|
|
return m_AddField7->IsChecked();
|
|
|
|
case FIELD8:
|
|
|
|
return m_AddField8->IsChecked();
|
|
|
|
case FOOTPRINT:
|
|
|
|
return m_AddFootprintField->IsChecked();
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2010-02-26 08:36:58 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2010-02-26 11:18:08 +00:00
|
|
|
void DIALOG_BUILD_BOM::CreatePartsList( const wxString& aFullFileName, bool aIncludeSubComponents )
|
2010-02-26 06:06:03 +00:00
|
|
|
{
|
|
|
|
FILE* f;
|
|
|
|
wxString msg;
|
|
|
|
|
|
|
|
if( ( f = wxFopen( aFullFileName, wxT( "wt" ) ) ) == NULL )
|
|
|
|
{
|
|
|
|
msg = _( "Failed to open file " );
|
|
|
|
msg << aFullFileName;
|
|
|
|
DisplayError( this, msg );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector <OBJ_CMP_TO_LIST> cmplist;
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2010-02-26 06:06:03 +00:00
|
|
|
BuildComponentsListFromSchematic( cmplist );
|
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
// sort component list by ref and remove sub components
|
2010-02-26 11:18:08 +00:00
|
|
|
if( !aIncludeSubComponents )
|
|
|
|
{
|
|
|
|
sort( cmplist.begin(), cmplist.end(), SortComponentsByReference );
|
|
|
|
DeleteSubCmp( cmplist );
|
|
|
|
}
|
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
// sort component list by value
|
2010-02-26 06:06:03 +00:00
|
|
|
sort( cmplist.begin(), cmplist.end(), SortComponentsByValue );
|
2010-04-24 09:03:35 +00:00
|
|
|
PrintComponentsListByPart( f, cmplist,aIncludeSubComponents );
|
2010-02-26 06:06:03 +00:00
|
|
|
|
|
|
|
fclose( f );
|
|
|
|
}
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2010-02-26 08:36:58 +00:00
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
/*
|
|
|
|
* Print a list of components, in a form which can be imported by a spreadsheet
|
|
|
|
* form is:
|
|
|
|
* cmp name; cmp val; fields;
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
void DIALOG_BUILD_BOM::CreateExportList( const wxString& aFullFileName,
|
|
|
|
bool aIncludeSubComponents )
|
|
|
|
{
|
2008-12-10 18:00:15 +00:00
|
|
|
FILE* f;
|
|
|
|
wxString msg;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2008-05-28 12:28:47 +00:00
|
|
|
if( ( f = wxFopen( aFullFileName, wxT( "wt" ) ) ) == NULL )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
|
|
|
msg = _( "Failed to open file " );
|
2008-05-28 12:28:47 +00:00
|
|
|
msg << aFullFileName;
|
2008-05-15 19:14:17 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-12-10 18:00:15 +00:00
|
|
|
std::vector <OBJ_CMP_TO_LIST> cmplist;
|
|
|
|
BuildComponentsListFromSchematic( cmplist );
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
// sort component list
|
2008-12-10 18:00:15 +00:00
|
|
|
sort( cmplist.begin(), cmplist.end(), SortComponentsByReference );
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2008-12-10 18:00:15 +00:00
|
|
|
if( !aIncludeSubComponents )
|
|
|
|
DeleteSubCmp( cmplist );
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
// create the file
|
2008-12-10 18:00:15 +00:00
|
|
|
PrintComponentsListByRef( f, cmplist, TRUE, aIncludeSubComponents );
|
2008-05-15 19:14:17 +00:00
|
|
|
|
|
|
|
fclose( f );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
/** GenereListeOfItems()
|
|
|
|
* Main function to create the list of components and/or labels
|
|
|
|
* (global labels and pin sheets" )
|
2008-05-15 19:14:17 +00:00
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
|
|
|
|
bool aIncludeSubComponents )
|
|
|
|
{
|
2008-12-10 18:00:15 +00:00
|
|
|
FILE* f;
|
|
|
|
int itemCount;
|
|
|
|
char Line[1024];
|
|
|
|
wxString msg;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2008-05-28 12:28:47 +00:00
|
|
|
if( ( f = wxFopen( aFullFileName, wxT( "wt" ) ) ) == NULL )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
|
|
|
msg = _( "Failed to open file " );
|
2008-05-28 12:28:47 +00:00
|
|
|
msg << aFullFileName;
|
2008-05-15 19:14:17 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-12-10 18:00:15 +00:00
|
|
|
std::vector <OBJ_CMP_TO_LIST> cmplist;
|
|
|
|
BuildComponentsListFromSchematic( cmplist );
|
|
|
|
|
|
|
|
itemCount = cmplist.size();
|
2008-05-28 12:28:47 +00:00
|
|
|
if( itemCount )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
// creates the list file
|
2008-05-15 19:14:17 +00:00
|
|
|
DateAndTime( Line );
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
wxString Title = wxGetApp().GetAppName() + wxT( " " ) +
|
2009-04-25 10:12:30 +00:00
|
|
|
GetBuildVersion();
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
fprintf( f, "%s >> Creation date: %s\n", CONV_TO_UTF8( Title ), Line );
|
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
// sort component list
|
2008-12-10 18:00:15 +00:00
|
|
|
sort( cmplist.begin(), cmplist.end(), SortComponentsByReference );
|
2008-05-15 19:14:17 +00:00
|
|
|
|
|
|
|
if( !aIncludeSubComponents )
|
2008-12-10 18:00:15 +00:00
|
|
|
DeleteSubCmp( cmplist );
|
2008-05-15 19:14:17 +00:00
|
|
|
|
|
|
|
if( m_ListCmpbyRefItems->GetValue() )
|
2008-12-10 18:00:15 +00:00
|
|
|
PrintComponentsListByRef( f, cmplist, false, aIncludeSubComponents );
|
2008-05-15 19:14:17 +00:00
|
|
|
|
|
|
|
if( m_ListCmpbyValItems->GetValue() )
|
|
|
|
{
|
2008-12-10 18:00:15 +00:00
|
|
|
sort( cmplist.begin(), cmplist.end(), SortComponentsByValue );
|
|
|
|
PrintComponentsListByVal( f, cmplist, aIncludeSubComponents );
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
/*************************************************/
|
2009-12-02 21:44:03 +00:00
|
|
|
/* Create list of global labels and pins sheets */
|
2008-12-10 16:49:53 +00:00
|
|
|
/*************************************************/
|
|
|
|
std::vector <LABEL_OBJECT> listOfLabels;
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
GenListeGLabels( listOfLabels );
|
|
|
|
if( ( itemCount = listOfLabels.size() ) > 0 )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
|
|
|
if( m_GenListLabelsbySheet->GetValue() )
|
|
|
|
{
|
2008-12-10 16:49:53 +00:00
|
|
|
sort( listOfLabels.begin(), listOfLabels.end(), SortLabelsBySheet );
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2010-08-10 15:42:26 +00:00
|
|
|
msg.Printf( _( "\n#Global, Hierarchical Labels and PinSheets \
|
|
|
|
( order = Sheet Number ) count = %d\n" ),
|
2009-04-25 10:12:30 +00:00
|
|
|
itemCount );
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
|
2008-12-10 16:49:53 +00:00
|
|
|
PrintListeGLabel( f, listOfLabels );
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( m_GenListLabelsbyVal->GetValue() )
|
|
|
|
{
|
2008-12-10 16:49:53 +00:00
|
|
|
sort( listOfLabels.begin(), listOfLabels.end(), SortLabelsByValue );
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2010-08-10 15:42:26 +00:00
|
|
|
msg.Printf( _( "\n#Global, Hierarchical Labels and PinSheets ( \
|
|
|
|
order = Alphab. ) count = %d\n\n" ),
|
2009-04-25 10:12:30 +00:00
|
|
|
itemCount );
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
|
2008-12-10 16:49:53 +00:00
|
|
|
PrintListeGLabel( f, listOfLabels );
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
msg = _( "\n#End List\n" );
|
|
|
|
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
|
|
|
|
fclose( f );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
/**
|
|
|
|
* Function BuildComponentsListFromSchematic
|
|
|
|
* creates the list of components found in the whole schematic.
|
2008-05-15 19:14:17 +00:00
|
|
|
*
|
2010-07-30 21:41:55 +00:00
|
|
|
* Goes through the 'sheets', not the screens, so that we account for
|
2008-05-15 19:14:17 +00:00
|
|
|
* multiple instances of a given screen.
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
|
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
// Build the sheet list (which is not screen a screen list)
|
|
|
|
SCH_SHEET_LIST sheetList; // uses a global
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext() )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
for( EDA_BaseStruct* schItem = path->LastDrawList(); schItem; schItem = schItem->Next() )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
if( schItem->Type() != TYPE_SCH_COMPONENT )
|
2008-05-15 19:14:17 +00:00
|
|
|
continue;
|
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
SCH_COMPONENT* comp = (SCH_COMPONENT*) schItem;
|
|
|
|
|
|
|
|
comp->SetParent( path->LastScreen() );
|
|
|
|
|
2008-12-10 18:00:15 +00:00
|
|
|
OBJ_CMP_TO_LIST item;
|
2010-07-30 21:41:55 +00:00
|
|
|
|
|
|
|
item.m_RootCmp = comp;
|
|
|
|
item.m_SheetPath = *path;
|
|
|
|
item.m_Unit = comp->GetUnitSelection( path );
|
|
|
|
|
|
|
|
item.SetRef( comp->GetRef( path ) );
|
|
|
|
|
|
|
|
// skip pseudo components, which have a reference starting
|
|
|
|
// with #, mainly power symbols
|
|
|
|
if( item.GetRefStr()[0] == '#' )
|
2010-04-24 09:03:35 +00:00
|
|
|
continue;
|
2010-07-30 21:41:55 +00:00
|
|
|
|
|
|
|
// Real component found, keep it
|
2008-12-10 18:00:15 +00:00
|
|
|
aList.push_back( item );
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
/* Fill aList with Glabel info
|
2008-05-15 19:14:17 +00:00
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
|
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
// Build the sheet list
|
|
|
|
SCH_SHEET_LIST sheetList;
|
2008-12-10 16:49:53 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
LABEL_OBJECT lable;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext() )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
SCH_ITEM* schItem = (SCH_ITEM*) path->LastDrawList();
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
while( schItem )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
switch( schItem->Type() )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
|
|
|
case TYPE_SCH_HIERLABEL:
|
|
|
|
case TYPE_SCH_GLOBALLABEL:
|
2010-07-30 21:41:55 +00:00
|
|
|
lable.m_LabelType = schItem->Type();
|
|
|
|
lable.m_SheetPath = *path;
|
|
|
|
lable.m_Label = schItem;
|
|
|
|
aList.push_back( lable );
|
2008-05-15 19:14:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_SHEET_STRUCT_TYPE:
|
2008-12-10 16:49:53 +00:00
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
SCH_SHEET* sheet = (SCH_SHEET*) schItem;
|
2010-06-24 18:31:43 +00:00
|
|
|
|
|
|
|
BOOST_FOREACH( SCH_SHEET_PIN sheetLabel, sheet->GetSheetPins() )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
lable.m_LabelType = DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE;
|
|
|
|
lable.m_SheetPath = *path;
|
|
|
|
lable.m_Label = &sheetLabel;
|
|
|
|
aList.push_back( lable );
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
2008-12-10 16:49:53 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2008-12-10 18:00:15 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
schItem = schItem->Next();
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
/* Compare function for sort()
|
2008-12-10 18:00:15 +00:00
|
|
|
* components are sorted
|
|
|
|
* by value
|
|
|
|
* if same value: by reference
|
|
|
|
* if same reference: by unit number
|
2008-05-15 19:14:17 +00:00
|
|
|
*/
|
2010-08-10 15:42:26 +00:00
|
|
|
bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1, const OBJ_CMP_TO_LIST& obj2 )
|
2009-12-02 21:44:03 +00:00
|
|
|
{
|
2008-12-10 18:00:15 +00:00
|
|
|
int ii;
|
2008-05-15 19:14:17 +00:00
|
|
|
const wxString* Text1, * Text2;
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
Text1 = &( obj1.m_RootCmp->GetField( VALUE )->m_Text );
|
|
|
|
Text2 = &( obj2.m_RootCmp->GetField( VALUE )->m_Text );
|
2008-05-15 19:14:17 +00:00
|
|
|
ii = Text1->CmpNoCase( *Text2 );
|
|
|
|
|
|
|
|
if( ii == 0 )
|
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
ii = RefDesStringCompare( obj1.GetRef(), obj2.GetRef() );
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( ii == 0 )
|
|
|
|
{
|
2008-12-10 18:00:15 +00:00
|
|
|
ii = obj1.m_Unit - obj2.m_Unit;
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
2008-12-10 18:00:15 +00:00
|
|
|
return ii < 0;
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
/* compare function for sorting
|
2008-12-10 18:00:15 +00:00
|
|
|
* components are sorted
|
|
|
|
* by reference
|
|
|
|
* if same reference: by value
|
|
|
|
* if same value: by unit number
|
2008-05-15 19:14:17 +00:00
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
bool SortComponentsByReference( const OBJ_CMP_TO_LIST& obj1,
|
|
|
|
const OBJ_CMP_TO_LIST& obj2 )
|
|
|
|
{
|
2008-12-10 18:00:15 +00:00
|
|
|
int ii;
|
2008-05-15 19:14:17 +00:00
|
|
|
const wxString* Text1, * Text2;
|
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
ii = RefDesStringCompare( obj1.GetRef(), obj2.GetRef() );
|
2008-05-15 19:14:17 +00:00
|
|
|
|
|
|
|
if( ii == 0 )
|
|
|
|
{
|
2008-12-10 18:00:15 +00:00
|
|
|
Text1 = &( obj1.m_RootCmp->GetField( VALUE )->m_Text );
|
|
|
|
Text2 = &( obj2.m_RootCmp->GetField( VALUE )->m_Text );
|
2008-05-15 19:14:17 +00:00
|
|
|
ii = Text1->CmpNoCase( *Text2 );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( ii == 0 )
|
|
|
|
{
|
2008-12-10 18:00:15 +00:00
|
|
|
ii = obj1.m_Unit - obj2.m_Unit;
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
2008-12-10 18:00:15 +00:00
|
|
|
return ii < 0;
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
/* compare function for sorting labels
|
|
|
|
* sort by
|
|
|
|
* value
|
|
|
|
* if same value: by sheet
|
2008-05-15 19:14:17 +00:00
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
|
|
|
|
{
|
2008-12-10 18:00:15 +00:00
|
|
|
int ii;
|
|
|
|
wxString* Text1, * Text2;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
if( obj1.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
2010-02-26 08:36:58 +00:00
|
|
|
Text1 = &( (SCH_SHEET_PIN*)(obj1.m_Label) )->m_Text;
|
2008-05-15 19:14:17 +00:00
|
|
|
else
|
2010-02-26 08:36:58 +00:00
|
|
|
Text1 = &( (SCH_TEXT*)(obj1.m_Label) )->m_Text;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
if( obj2.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
2010-02-26 08:36:58 +00:00
|
|
|
Text2 = &( (SCH_SHEET_PIN*)(obj2.m_Label) )->m_Text;
|
2008-05-15 19:14:17 +00:00
|
|
|
else
|
2010-02-26 08:36:58 +00:00
|
|
|
Text2 = &( (SCH_TEXT*)(obj2.m_Label) )->m_Text;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
|
|
|
ii = Text1->CmpNoCase( *Text2 );
|
|
|
|
|
|
|
|
if( ii == 0 )
|
|
|
|
{
|
2008-12-10 16:49:53 +00:00
|
|
|
ii = obj1.m_SheetPath.Cmp( obj2.m_SheetPath );
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
return ii < 0;
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
/* compare function for sorting labels
|
|
|
|
* by sheet
|
|
|
|
* in a sheet, by alphabetic order
|
2008-05-15 19:14:17 +00:00
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
|
|
|
|
{
|
2008-12-10 18:00:15 +00:00
|
|
|
int ii;
|
2008-12-10 16:49:53 +00:00
|
|
|
wxString Text1, Text2;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
ii = obj1.m_SheetPath.Cmp( obj2.m_SheetPath );
|
2008-05-15 19:14:17 +00:00
|
|
|
|
|
|
|
if( ii == 0 )
|
|
|
|
{
|
2008-12-10 16:49:53 +00:00
|
|
|
if( obj1.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
2009-11-04 20:46:53 +00:00
|
|
|
Text1 = ( (SCH_SHEET_PIN*) obj1.m_Label )->m_Text;
|
2008-05-15 19:14:17 +00:00
|
|
|
else
|
2008-12-10 16:49:53 +00:00
|
|
|
Text1 = ( (SCH_TEXT*) obj1.m_Label )->m_Text;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
if( obj2.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
2009-11-04 20:46:53 +00:00
|
|
|
Text2 = ( (SCH_SHEET_PIN*) obj2.m_Label )->m_Text;
|
2008-05-15 19:14:17 +00:00
|
|
|
else
|
2008-12-10 16:49:53 +00:00
|
|
|
Text2 = ( (SCH_TEXT*) obj2.m_Label )->m_Text;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
ii = Text1.CmpNoCase( Text2 );
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
return ii < 0;
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
/* Remove sub components from the list, when multiples parts per package are
|
|
|
|
* found in this list
|
2008-05-15 19:14:17 +00:00
|
|
|
* The component list **MUST** be sorted by reference and by unit number
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
static void DeleteSubCmp( std::vector <OBJ_CMP_TO_LIST>& aList )
|
|
|
|
{
|
2008-06-04 13:17:33 +00:00
|
|
|
SCH_COMPONENT* libItem;
|
2008-12-10 18:00:15 +00:00
|
|
|
wxString oldName;
|
|
|
|
wxString currName;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2008-05-28 12:28:47 +00:00
|
|
|
|
2008-12-10 18:00:15 +00:00
|
|
|
for( unsigned ii = 0; ii < aList.size(); ii++ )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
2008-12-10 16:49:53 +00:00
|
|
|
libItem = aList[ii].m_RootCmp;
|
2008-05-28 12:28:47 +00:00
|
|
|
if( libItem == NULL )
|
2008-05-15 19:14:17 +00:00
|
|
|
continue;
|
2008-05-28 12:28:47 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
currName = aList[ii].GetRef();
|
2008-05-28 12:28:47 +00:00
|
|
|
|
|
|
|
if( !oldName.IsEmpty() )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
2009-11-03 13:26:31 +00:00
|
|
|
if( oldName == currName ) // currName is a subpart of oldName:
|
|
|
|
// remove it
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
2008-12-10 18:00:15 +00:00
|
|
|
aList.erase( aList.begin() + ii );
|
|
|
|
ii--;
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-28 12:28:47 +00:00
|
|
|
oldName = currName;
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-12 15:24:52 +00:00
|
|
|
void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
|
2009-04-25 10:12:30 +00:00
|
|
|
bool CompactForm )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
|
|
|
int ii;
|
|
|
|
|
2010-03-19 20:15:30 +00:00
|
|
|
if( IsFieldChecked( FOOTPRINT ) )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
2008-06-04 13:17:33 +00:00
|
|
|
if( CompactForm )
|
|
|
|
{
|
|
|
|
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
|
2010-08-10 15:42:26 +00:00
|
|
|
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
|
2008-06-04 13:17:33 +00:00
|
|
|
}
|
|
|
|
else
|
2009-12-02 21:44:03 +00:00
|
|
|
{
|
2009-11-03 13:26:31 +00:00
|
|
|
fprintf( f, "; %-12s",
|
2010-08-10 15:42:26 +00:00
|
|
|
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
|
2009-12-02 21:44:03 +00:00
|
|
|
}
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
2008-10-06 05:44:29 +00:00
|
|
|
for( ii = FIELD1; ii < DrawLibItem->GetFieldCount(); ii++ )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
2010-03-19 20:15:30 +00:00
|
|
|
if( ! IsFieldChecked( ii ) )
|
|
|
|
continue;
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
if( CompactForm )
|
|
|
|
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
|
2010-08-10 15:42:26 +00:00
|
|
|
CONV_TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) );
|
2008-05-15 19:14:17 +00:00
|
|
|
else
|
2009-11-03 13:26:31 +00:00
|
|
|
fprintf( f, "; %-12s",
|
2010-08-10 15:42:26 +00:00
|
|
|
CONV_TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) );
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-26 08:36:58 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
/* Print the B.O.M sorted by reference
|
|
|
|
*/
|
2009-03-12 15:24:52 +00:00
|
|
|
int DIALOG_BUILD_BOM::PrintComponentsListByRef(
|
2008-12-10 18:00:15 +00:00
|
|
|
FILE* f,
|
|
|
|
std::vector <OBJ_CMP_TO_LIST>& aList,
|
|
|
|
bool CompactForm,
|
2009-04-25 10:12:30 +00:00
|
|
|
bool aIncludeSubComponents )
|
2009-11-03 13:26:31 +00:00
|
|
|
{
|
2009-09-18 14:56:05 +00:00
|
|
|
wxString msg;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
|
|
|
if( CompactForm )
|
|
|
|
{
|
|
|
|
// Print comment line:
|
2010-02-09 19:13:21 +00:00
|
|
|
#if defined(KICAD_GOST)
|
2010-02-26 08:36:58 +00:00
|
|
|
fprintf( f, "ref%cvalue%cdatasheet", s_ExportSeparatorSymbol, s_ExportSeparatorSymbol );
|
2010-02-09 19:13:21 +00:00
|
|
|
#else
|
2008-05-15 19:14:17 +00:00
|
|
|
fprintf( f, "ref%cvalue", s_ExportSeparatorSymbol );
|
2010-02-09 19:13:21 +00:00
|
|
|
#endif
|
2008-05-15 19:14:17 +00:00
|
|
|
|
|
|
|
if( aIncludeSubComponents )
|
2008-07-31 15:30:57 +00:00
|
|
|
{
|
2008-05-15 19:14:17 +00:00
|
|
|
fprintf( f, "%csheet path", s_ExportSeparatorSymbol );
|
2008-07-31 15:30:57 +00:00
|
|
|
fprintf( f, "%clocation", s_ExportSeparatorSymbol );
|
|
|
|
}
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2010-03-19 20:15:30 +00:00
|
|
|
if( IsFieldChecked( FOOTPRINT ) )
|
2008-06-04 13:17:33 +00:00
|
|
|
fprintf( f, "%cfootprint", s_ExportSeparatorSymbol );
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2008-12-10 18:00:15 +00:00
|
|
|
for( int ii = FIELD1; ii <= FIELD8; ii++ )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
2010-03-19 20:15:30 +00:00
|
|
|
if( !IsFieldChecked( ii ) )
|
2008-05-15 19:14:17 +00:00
|
|
|
continue;
|
2008-05-28 12:28:47 +00:00
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
msg = _( "Field" );
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2010-08-10 15:42:26 +00:00
|
|
|
fprintf( f, "%c%s%d", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ), ii - FIELD1 + 1 );
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fprintf( f, "\n" );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
msg = _( "\n#Cmp ( order = Reference )" );
|
|
|
|
|
|
|
|
if( aIncludeSubComponents )
|
|
|
|
msg << _( " (with SubCmp)" );
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
fprintf( f, "%s\n", CONV_TO_UTF8( msg ) );
|
|
|
|
}
|
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
std::string CmpName;
|
|
|
|
wxString subRef;
|
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
// Print list of items
|
2008-12-10 18:00:15 +00:00
|
|
|
for( unsigned ii = 0; ii < aList.size(); ii++ )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
EDA_BaseStruct* item = aList[ii].m_RootCmp;
|
|
|
|
if( item == NULL )
|
2008-05-15 19:14:17 +00:00
|
|
|
continue;
|
2010-07-30 21:41:55 +00:00
|
|
|
|
|
|
|
if( item->Type() != TYPE_SCH_COMPONENT )
|
2008-05-15 19:14:17 +00:00
|
|
|
continue;
|
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
SCH_COMPONENT* comp = (SCH_COMPONENT*) item;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2010-04-24 11:27:38 +00:00
|
|
|
bool isMulti = false;
|
2010-07-30 21:41:55 +00:00
|
|
|
|
|
|
|
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( comp->m_ChipName );
|
|
|
|
if( entry )
|
|
|
|
isMulti = entry->IsMulti();
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2010-04-24 11:27:38 +00:00
|
|
|
if( isMulti && aIncludeSubComponents )
|
|
|
|
subRef = LIB_COMPONENT::ReturnSubReference( aList[ii].m_Unit );
|
|
|
|
else
|
|
|
|
subRef.Empty();
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
CmpName = aList[ii].GetRefStr();
|
|
|
|
|
2010-04-24 11:27:38 +00:00
|
|
|
if( !CompactForm )
|
2010-07-30 21:41:55 +00:00
|
|
|
CmpName += CONV_TO_UTF8(subRef);
|
2008-05-15 19:14:17 +00:00
|
|
|
|
|
|
|
if( CompactForm )
|
2010-02-09 19:13:21 +00:00
|
|
|
#if defined(KICAD_GOST)
|
2010-07-30 21:41:55 +00:00
|
|
|
fprintf( f, "%s%c%s%c%s", CmpName.c_str(), s_ExportSeparatorSymbol,
|
2010-08-10 15:42:26 +00:00
|
|
|
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ), s_ExportSeparatorSymbol,
|
|
|
|
CONV_TO_UTF8( comp->GetField( DATASHEET )->m_Text ) );
|
2010-02-09 19:13:21 +00:00
|
|
|
#else
|
2010-07-30 21:41:55 +00:00
|
|
|
fprintf( f, "%s%c%s", CmpName.c_str(), s_ExportSeparatorSymbol,
|
2010-08-10 15:42:26 +00:00
|
|
|
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ) );
|
2010-02-09 19:13:21 +00:00
|
|
|
#endif
|
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
else
|
2010-02-09 19:13:21 +00:00
|
|
|
#if defined(KICAD_GOST)
|
2010-07-30 21:41:55 +00:00
|
|
|
fprintf( f, "| %-10s %-12s %-20s", CmpName.c_str(),
|
2010-08-10 15:42:26 +00:00
|
|
|
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ),
|
|
|
|
CONV_TO_UTF8( comp->GetField( DATASHEET )->m_Text ) );
|
2010-02-09 19:13:21 +00:00
|
|
|
#else
|
2010-07-30 21:41:55 +00:00
|
|
|
fprintf( f, "| %-10s %-12s", CmpName.c_str(),
|
2010-08-10 15:42:26 +00:00
|
|
|
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ) );
|
2010-02-09 19:13:21 +00:00
|
|
|
#endif
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
if( aIncludeSubComponents )
|
|
|
|
{
|
2008-12-10 16:49:53 +00:00
|
|
|
msg = aList[ii].m_SheetPath.PathHumanReadable();
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
if( CompactForm )
|
2008-07-31 15:30:57 +00:00
|
|
|
{
|
2010-08-10 15:42:26 +00:00
|
|
|
fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) );
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2010-08-10 15:42:26 +00:00
|
|
|
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) comp->GetParent(),
|
|
|
|
comp->m_Pos );
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
fprintf( f, "%c%s)", s_ExportSeparatorSymbol,
|
2010-08-10 15:42:26 +00:00
|
|
|
CONV_TO_UTF8( msg ) );
|
2008-07-31 15:30:57 +00:00
|
|
|
}
|
2008-05-15 19:14:17 +00:00
|
|
|
else
|
2008-07-31 15:30:57 +00:00
|
|
|
{
|
2008-05-15 19:14:17 +00:00
|
|
|
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2010-08-10 15:42:26 +00:00
|
|
|
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) comp->GetParent(),
|
|
|
|
comp->m_Pos );
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2008-07-31 15:30:57 +00:00
|
|
|
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) );
|
|
|
|
}
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
PrintFieldData( f, comp, CompactForm );
|
2008-05-15 19:14:17 +00:00
|
|
|
|
|
|
|
fprintf( f, "\n" );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !CompactForm )
|
|
|
|
{
|
|
|
|
msg = _( "#End Cmp\n" );
|
2009-05-05 17:32:07 +00:00
|
|
|
fputs( CONV_TO_UTF8( msg ), f );
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
2009-12-02 21:44:03 +00:00
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-26 08:36:58 +00:00
|
|
|
/* Bom Output format option - single part per line
|
|
|
|
* a common part being defined as have a common value.
|
|
|
|
* This is true for most designs but will produce an
|
|
|
|
* incorrect output if two or more parts with the same
|
|
|
|
* value have different footprints, tolerances, voltage
|
|
|
|
* rating, etc. Also usefull if the following fields
|
|
|
|
* are edited:
|
|
|
|
* FIELD1 - manufacture
|
|
|
|
* FIELD2 - manufacture part number
|
|
|
|
* FIELD3 - distributor part number
|
|
|
|
*/
|
2010-02-26 06:06:03 +00:00
|
|
|
int DIALOG_BUILD_BOM::PrintComponentsListByPart(
|
|
|
|
FILE* f,
|
2010-04-24 09:03:35 +00:00
|
|
|
std::vector <OBJ_CMP_TO_LIST>& aList,
|
|
|
|
bool aIncludeSubComponents)
|
2010-02-26 06:06:03 +00:00
|
|
|
{
|
2010-04-24 09:03:35 +00:00
|
|
|
int qty = 0;
|
2010-07-30 21:41:55 +00:00
|
|
|
wxString refName;
|
2010-04-24 09:03:35 +00:00
|
|
|
wxString fullRefName; // reference + part Id (for multiple parts per package
|
2010-07-30 21:41:55 +00:00
|
|
|
wxString valName;
|
|
|
|
wxString refNames;
|
2010-04-24 09:03:35 +00:00
|
|
|
wxString lastRef;
|
|
|
|
wxString unitId;
|
2010-07-30 21:41:55 +00:00
|
|
|
SCH_COMPONENT* currCmp;
|
|
|
|
SCH_COMPONENT* nextCmp;
|
|
|
|
SCH_COMPONENT dummyCmp; // A dummy component, to store fields
|
2010-02-26 06:06:03 +00:00
|
|
|
|
|
|
|
for( unsigned ii = 0; ii < aList.size(); ii++ )
|
|
|
|
{
|
2010-04-24 09:03:35 +00:00
|
|
|
currCmp = (SCH_COMPONENT*) aList[ii].m_RootCmp;
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2010-04-24 09:03:35 +00:00
|
|
|
if( ii < aList.size() -1 )
|
|
|
|
nextCmp = aList[ii+1].m_RootCmp;
|
|
|
|
else
|
|
|
|
nextCmp = NULL;
|
2010-03-01 19:26:24 +00:00
|
|
|
|
2010-03-02 09:23:17 +00:00
|
|
|
// Store fields. Store non empty fields only.
|
2010-04-24 09:03:35 +00:00
|
|
|
for( int jj = FOOTPRINT; jj < currCmp->GetFieldCount(); jj++ )
|
2010-03-01 19:26:24 +00:00
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
// Ensure fields exists in dummy component
|
2010-06-20 14:47:30 +00:00
|
|
|
if( dummyCmp.GetFieldCount() <= jj )
|
2010-06-19 10:58:50 +00:00
|
|
|
dummyCmp.AddField( *currCmp->GetField( jj ) );
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2010-06-19 10:58:50 +00:00
|
|
|
// store useful data
|
2010-04-24 09:03:35 +00:00
|
|
|
if( !currCmp->GetField( jj )->m_Text.IsEmpty() )
|
|
|
|
dummyCmp.GetField( jj )->m_Text = currCmp->GetField( jj )->m_Text;
|
2010-03-01 19:26:24 +00:00
|
|
|
}
|
2010-02-26 06:06:03 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
refName = aList[ii].GetRef();
|
|
|
|
valName = currCmp->GetField( VALUE )->m_Text;
|
2010-04-24 09:03:35 +00:00
|
|
|
|
|
|
|
int multi = 0;
|
|
|
|
if( aIncludeSubComponents )
|
2010-02-26 08:36:58 +00:00
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( currCmp->m_ChipName );
|
|
|
|
if( entry )
|
|
|
|
multi = entry->GetPartCount();
|
2010-04-24 09:03:35 +00:00
|
|
|
if ( multi <= 1 )
|
|
|
|
multi = 0;
|
2010-02-26 08:36:58 +00:00
|
|
|
}
|
2010-02-26 06:06:03 +00:00
|
|
|
|
2010-04-24 09:03:35 +00:00
|
|
|
if ( multi && aList[ii].m_Unit > 0 )
|
2010-07-30 21:41:55 +00:00
|
|
|
unitId.Printf( wxT("%c"), 'A' -1 + aList[ii].m_Unit );
|
|
|
|
else
|
|
|
|
unitId.Empty();
|
2010-02-26 08:36:58 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
fullRefName = refName + unitId;
|
|
|
|
|
|
|
|
if( refNames.IsEmpty() )
|
|
|
|
refNames = fullRefName;
|
2010-04-24 09:03:35 +00:00
|
|
|
else
|
2010-07-30 21:41:55 +00:00
|
|
|
refNames << wxT( ", " ) << fullRefName;
|
|
|
|
|
2010-04-24 09:03:35 +00:00
|
|
|
// In multi parts per package, we have the reference more than once
|
|
|
|
// but we must count only one package
|
2010-07-30 21:41:55 +00:00
|
|
|
if( lastRef != refName )
|
2010-02-26 08:36:58 +00:00
|
|
|
qty++;
|
2010-07-30 21:41:55 +00:00
|
|
|
|
|
|
|
lastRef = refName;
|
2010-04-24 09:03:35 +00:00
|
|
|
|
|
|
|
// if the next cmoponent has same value the line will be printed after.
|
2010-07-30 21:41:55 +00:00
|
|
|
if( nextCmp && nextCmp->GetField( VALUE )->m_Text.CmpNoCase( valName ) == 0 )
|
2010-03-02 09:23:17 +00:00
|
|
|
continue;
|
2010-02-26 06:06:03 +00:00
|
|
|
|
2010-04-24 09:03:35 +00:00
|
|
|
// Print line for the current component value:
|
2010-07-30 21:41:55 +00:00
|
|
|
fprintf( f, "%15s%c%3d", CONV_TO_UTF8( valName ), s_ExportSeparatorSymbol, qty );
|
2010-02-26 06:06:03 +00:00
|
|
|
|
2010-03-19 20:15:30 +00:00
|
|
|
if( IsFieldChecked(FOOTPRINT ) )
|
2010-03-01 19:26:24 +00:00
|
|
|
fprintf( f, "%c%15s", s_ExportSeparatorSymbol,
|
2010-08-10 15:42:26 +00:00
|
|
|
CONV_TO_UTF8( currCmp->GetField( FOOTPRINT )->m_Text ) );
|
2010-02-26 08:36:58 +00:00
|
|
|
|
2010-03-03 19:43:14 +00:00
|
|
|
#if defined(KICAD_GOST)
|
|
|
|
fprintf( f, "%c%20s", s_ExportSeparatorSymbol,
|
2010-08-10 15:42:26 +00:00
|
|
|
CONV_TO_UTF8( currCmp->GetField( DATASHEET )->m_Text ) );
|
2010-03-03 19:43:14 +00:00
|
|
|
#endif
|
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
// wrap the field in quotes, since it has commas in it.
|
|
|
|
fprintf( f, "%c\"%s\"", s_ExportSeparatorSymbol,
|
2010-08-10 15:42:26 +00:00
|
|
|
CONV_TO_UTF8( refNames ) );
|
2010-06-20 14:47:30 +00:00
|
|
|
|
2010-03-19 20:15:30 +00:00
|
|
|
// print fields, on demand
|
2010-06-20 14:47:30 +00:00
|
|
|
int last_nonempty_field_idx = 0;
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2010-06-20 14:47:30 +00:00
|
|
|
for( int jj = FOOTPRINT; jj < dummyCmp.GetFieldCount(); jj++ )
|
|
|
|
if ( !dummyCmp.GetField( jj )->m_Text.IsEmpty() )
|
|
|
|
last_nonempty_field_idx = jj;
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2010-06-20 14:47:30 +00:00
|
|
|
for( int jj = FIELD1; jj <= last_nonempty_field_idx ; jj++ )
|
2010-03-19 20:15:30 +00:00
|
|
|
{
|
|
|
|
if ( IsFieldChecked( jj ) )
|
|
|
|
fprintf( f, "%c%4s", s_ExportSeparatorSymbol,
|
2010-08-10 15:42:26 +00:00
|
|
|
CONV_TO_UTF8( dummyCmp.GetField( jj )->m_Text ) );
|
2010-03-19 20:15:30 +00:00
|
|
|
}
|
2010-02-26 06:06:03 +00:00
|
|
|
|
2010-06-20 14:47:30 +00:00
|
|
|
fprintf( f, "\n" );
|
2010-03-01 19:26:24 +00:00
|
|
|
|
2010-04-24 09:03:35 +00:00
|
|
|
// Clear strings and values, to prepare next component
|
|
|
|
qty = 0;
|
2010-07-30 21:41:55 +00:00
|
|
|
refNames.Empty();
|
|
|
|
|
2010-06-20 14:47:30 +00:00
|
|
|
for( int jj = FOOTPRINT; jj < dummyCmp.GetFieldCount(); jj++ )
|
2010-03-02 09:23:17 +00:00
|
|
|
dummyCmp.GetField( jj )->m_Text.Empty();
|
2010-02-26 08:36:58 +00:00
|
|
|
}
|
|
|
|
|
2010-02-26 06:06:03 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-02-26 08:36:58 +00:00
|
|
|
|
2009-03-12 15:24:52 +00:00
|
|
|
int DIALOG_BUILD_BOM::PrintComponentsListByVal(
|
2008-12-10 18:00:15 +00:00
|
|
|
FILE* f,
|
|
|
|
std::vector <OBJ_CMP_TO_LIST>& aList,
|
2009-09-18 14:56:05 +00:00
|
|
|
bool aIncludeSubComponents )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
EDA_BaseStruct* schItem;
|
2009-09-18 14:56:05 +00:00
|
|
|
SCH_COMPONENT* DrawLibItem;
|
2010-07-30 21:41:55 +00:00
|
|
|
LIB_COMPONENT* entry;
|
|
|
|
std::string CmpName;
|
2009-09-18 14:56:05 +00:00
|
|
|
wxString msg;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
|
|
|
msg = _( "\n#Cmp ( order = Value )" );
|
|
|
|
|
|
|
|
if( aIncludeSubComponents )
|
|
|
|
msg << _( " (with SubCmp)" );
|
|
|
|
msg << wxT( "\n" );
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2009-05-05 17:32:07 +00:00
|
|
|
fputs( CONV_TO_UTF8( msg ), f );
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2008-12-10 18:00:15 +00:00
|
|
|
for( unsigned ii = 0; ii < aList.size(); ii++ )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
schItem = aList[ii].m_RootCmp;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
if( schItem == NULL )
|
2008-05-15 19:14:17 +00:00
|
|
|
continue;
|
2008-05-28 12:28:47 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
if( schItem->Type() != TYPE_SCH_COMPONENT )
|
2008-05-15 19:14:17 +00:00
|
|
|
continue;
|
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
DrawLibItem = (SCH_COMPONENT*) schItem;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2010-04-24 11:27:38 +00:00
|
|
|
bool isMulti = false;
|
2010-07-30 21:41:55 +00:00
|
|
|
entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
|
|
|
|
if( entry )
|
|
|
|
isMulti = entry->IsMulti();
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2010-04-24 11:27:38 +00:00
|
|
|
wxString subRef;
|
|
|
|
if( isMulti && aIncludeSubComponents )
|
|
|
|
subRef = LIB_COMPONENT::ReturnSubReference( aList[ii].m_Unit );
|
|
|
|
else
|
|
|
|
subRef.Empty();
|
2008-11-05 11:41:15 +00:00
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
CmpName = aList[ii].GetRefStr();
|
|
|
|
CmpName += CONV_TO_UTF8(subRef);
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
fprintf( f, "| %-12s %-10s",
|
|
|
|
CONV_TO_UTF8( DrawLibItem->GetField( VALUE )->m_Text ),
|
2010-07-30 21:41:55 +00:00
|
|
|
CmpName.c_str() );
|
2008-05-15 19:14:17 +00:00
|
|
|
|
|
|
|
// print the sheet path
|
|
|
|
if( aIncludeSubComponents )
|
|
|
|
{
|
2008-12-10 16:49:53 +00:00
|
|
|
msg = aList[ii].m_SheetPath.PathHumanReadable();
|
2008-05-15 19:14:17 +00:00
|
|
|
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
|
2010-08-10 15:42:26 +00:00
|
|
|
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) DrawLibItem->GetParent(),
|
|
|
|
DrawLibItem->m_Pos );
|
2008-07-31 15:30:57 +00:00
|
|
|
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) );
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PrintFieldData( f, DrawLibItem );
|
|
|
|
|
2009-05-05 17:32:07 +00:00
|
|
|
fputs( "\n", f );
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
msg = _( "#End Cmp\n" );
|
2009-05-05 17:32:07 +00:00
|
|
|
fputs( CONV_TO_UTF8( msg ), f );
|
2008-05-15 19:14:17 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
|
|
|
SCH_LABEL* DrawTextItem;
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET_PIN* DrawSheetLabel;
|
2008-05-15 19:14:17 +00:00
|
|
|
wxString msg, sheetpath;
|
|
|
|
wxString labeltype;
|
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
for( unsigned ii = 0; ii < aList.size(); ii++ )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
2008-12-10 16:49:53 +00:00
|
|
|
switch( aList[ii].m_LabelType )
|
2008-05-15 19:14:17 +00:00
|
|
|
{
|
|
|
|
case TYPE_SCH_HIERLABEL:
|
|
|
|
case TYPE_SCH_GLOBALLABEL:
|
2010-02-26 08:36:58 +00:00
|
|
|
DrawTextItem = (SCH_LABEL*)(aList[ii].m_Label);
|
2008-05-28 12:28:47 +00:00
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
if( aList[ii].m_LabelType == TYPE_SCH_HIERLABEL )
|
2008-05-15 19:14:17 +00:00
|
|
|
labeltype = wxT( "Hierarchical" );
|
|
|
|
else
|
|
|
|
labeltype = wxT( "Global " );
|
2008-05-28 12:28:47 +00:00
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
sheetpath = aList[ii].m_SheetPath.PathHumanReadable();
|
2010-08-10 15:42:26 +00:00
|
|
|
msg.Printf( _( "> %-28.28s %s (Sheet %s) pos: %3.3f, %3.3f\n" ),
|
|
|
|
GetChars( DrawTextItem->m_Text ),
|
|
|
|
GetChars( labeltype ),
|
|
|
|
GetChars( sheetpath ),
|
|
|
|
(float) DrawTextItem->m_Pos.x / 1000,
|
|
|
|
(float) DrawTextItem->m_Pos.y / 1000 );
|
2008-05-15 19:14:17 +00:00
|
|
|
|
2009-05-05 17:32:07 +00:00
|
|
|
fputs( CONV_TO_UTF8( msg ), f );
|
2008-05-15 19:14:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
DrawSheetLabel = (SCH_SHEET_PIN*) aList[ii].m_Label;
|
2008-12-10 16:49:53 +00:00
|
|
|
int jj = DrawSheetLabel->m_Shape;
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
if( jj < 0 )
|
|
|
|
jj = NET_TMAX;
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
if( jj > NET_TMAX )
|
|
|
|
jj = 4;
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2008-05-15 19:14:17 +00:00
|
|
|
wxString labtype = CONV_FROM_UTF8( SheetLabelType[jj] );
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2010-08-10 15:42:26 +00:00
|
|
|
msg.Printf( _( "> %-28.28s PinSheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n" ),
|
|
|
|
GetChars( DrawSheetLabel->m_Text ),
|
|
|
|
GetChars( labtype ),
|
|
|
|
GetChars( aList[ii].m_SheetPath.PathHumanReadable() ),
|
|
|
|
(float) DrawSheetLabel->m_Pos.x / 1000,
|
|
|
|
(float) DrawSheetLabel->m_Pos.y / 1000 );
|
2010-07-30 21:41:55 +00:00
|
|
|
|
2009-05-05 17:32:07 +00:00
|
|
|
fputs( CONV_TO_UTF8( msg ), f );
|
2008-05-15 19:14:17 +00:00
|
|
|
}
|
2008-12-10 16:49:53 +00:00
|
|
|
break;
|
2008-05-15 19:14:17 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
msg = _( "#End labels\n" );
|
2009-05-05 17:32:07 +00:00
|
|
|
fputs( CONV_TO_UTF8( msg ), f );
|
2008-05-15 19:14:17 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2008-05-28 12:28:47 +00:00
|
|
|
|
|
|
|
|