Commit e2abaa81 authored by CHARRAS's avatar CHARRAS

Display filename and full sheet name ("sheet path") in sheet references

parent 4d9ea908
...@@ -229,7 +229,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; ...@@ -229,7 +229,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION;
msg += screen->m_Revision; msg += screen->m_Revision;
break; break;
case WS_LICENCE: case WS_KICAD_VERSION:
msg += g_ProductName; msg += g_ProductName;
break; break;
...@@ -241,6 +241,18 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; ...@@ -241,6 +241,18 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION;
msg << screen->m_ScreenNumber << wxT("/") << screen->m_NumberOfScreen; msg << screen->m_ScreenNumber << wxT("/") << screen->m_NumberOfScreen;
break; break;
case WS_FILENAME:
{
wxString fname, fext;
wxFileName::SplitPath(screen->m_FileName, (wxString*)NULL, &fname, &fext);
msg << fname << wxT(".") << fext;
}
break;
case WS_FULLSHEETNAME:
// msg += GetScreenDesc();
break;
case WS_COMPANY_NAME: case WS_COMPANY_NAME:
msg += screen->m_Company; msg += screen->m_Company;
if ( ! msg.IsEmpty() ) if ( ! msg.IsEmpty() )
......
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: dialog_build_BOM.cpp // Name: dialog_build_BOM.cpp
// Purpose: // Purpose:
// Author: jean-pierre Charras // Author: jean-pierre Charras
...@@ -11,7 +12,7 @@ ...@@ -11,7 +12,7 @@
// Generated by DialogBlocks (unregistered), 01/15/06 18:18:44 // Generated by DialogBlocks (unregistered), 01/15/06 18:18:44
#if defined(__GNUG__) && !defined(__APPLE__) #if defined (__GNUG__) && !defined (__APPLE__)
#pragma implementation "dialog_build_BOM.h" #pragma implementation "dialog_build_BOM.h"
#endif #endif
...@@ -47,17 +48,17 @@ ...@@ -47,17 +48,17 @@
/* fonctions locales */ /* fonctions locales */
static int GenListeGLabels( ListLabel * List ); static int GenListeGLabels( ListLabel* List );
int GenListeCmp( ListComponent * List ); int GenListeCmp( ListComponent* List );
static int ListTriComposantByRef(ListComponent *Objet1, static int ListTriComposantByRef( ListComponent* Objet1,
ListComponent *Objet2); ListComponent* Objet2 );
static int ListTriComposantByVal(ListComponent *Objet1, static int ListTriComposantByVal( ListComponent* Objet1,
ListComponent *Objet2); ListComponent* Objet2 );
static int ListTriGLabelBySheet(ListLabel *Objet1, ListLabel *Objet2); static int ListTriGLabelBySheet( ListLabel* Objet1, ListLabel* Objet2 );
static int ListTriGLabelByVal(ListLabel *Objet1, ListLabel *Objet2); static int ListTriGLabelByVal( ListLabel* Objet1, ListLabel* Objet2 );
static void DeleteSubCmp( ListComponent * List , int NbItems); static void DeleteSubCmp( ListComponent* List, int NbItems );
static int PrintListeGLabel( FILE *f, ListLabel *List, int NbItems); static int PrintListeGLabel( FILE* f, ListLabel* List, int NbItems );
/* Local variables */ /* Local variables */
static bool s_ListByRef = TRUE; static bool s_ListByRef = TRUE;
...@@ -77,29 +78,30 @@ static bool s_Add_F5_state; ...@@ -77,29 +78,30 @@ static bool s_Add_F5_state;
static bool s_Add_F6_state; static bool s_Add_F6_state;
static bool s_Add_F7_state; static bool s_Add_F7_state;
static bool s_Add_F8_state; static bool s_Add_F8_state;
static bool * s_AddFieldList[] = { static bool* s_AddFieldList[] = {
& s_Add_FpField_state, &s_Add_FpField_state,
& s_Add_F1_state, &s_Add_F1_state,
& s_Add_F2_state, &s_Add_F2_state,
& s_Add_F3_state, &s_Add_F3_state,
& s_Add_F4_state, &s_Add_F4_state,
& s_Add_F5_state, &s_Add_F5_state,
& s_Add_F6_state, &s_Add_F6_state,
& s_Add_F7_state, &s_Add_F7_state,
& s_Add_F8_state, &s_Add_F8_state,
NULL NULL
}; };
#define OPTION_BOM_FORMAT wxT("BomFormat") #define OPTION_BOM_FORMAT wxT( "BomFormat" )
#define OPTION_BOM_SEPARATOR wxT("BomExportSeparator") #define OPTION_BOM_SEPARATOR wxT( "BomExportSeparator" )
#define OPTION_BOM_ADD_FIELD wxT("BomAddField") #define OPTION_BOM_ADD_FIELD wxT( "BomAddField" )
/* list of separators used in bom export to spreadsheet /* list of separators used in bom export to spreadsheet
* (selected by s_OutputSeparatorOpt, and s_OutputSeparatorOpt radiobox) * (selected by s_OutputSeparatorOpt, and s_OutputSeparatorOpt radiobox)
*/ */
static char s_ExportSeparator[] = ("\t;,."); static char s_ExportSeparator[] = ("\t;,.");
static char s_ExportSeparatorSymbol; static char s_ExportSeparatorSymbol;
/*! /*!
* WinEDA_Build_BOM_Frame type definition * WinEDA_Build_BOM_Frame type definition
*/ */
...@@ -113,15 +115,15 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_Build_BOM_Frame, wxDialog ) ...@@ -113,15 +115,15 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_Build_BOM_Frame, wxDialog )
BEGIN_EVENT_TABLE( WinEDA_Build_BOM_Frame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_Build_BOM_Frame, wxDialog )
////@begin WinEDA_Build_BOM_Frame event table entries ////@begin WinEDA_Build_BOM_Frame event table entries
EVT_RADIOBOX( ID_RADIOBOX_SELECT_FORMAT, WinEDA_Build_BOM_Frame::OnRadioboxSelectFormatSelected ) EVT_RADIOBOX( ID_RADIOBOX_SELECT_FORMAT, WinEDA_Build_BOM_Frame::OnRadioboxSelectFormatSelected )
EVT_BUTTON( ID_CREATE_LIST, WinEDA_Build_BOM_Frame::OnCreateListClick ) EVT_BUTTON( ID_CREATE_LIST, WinEDA_Build_BOM_Frame::OnCreateListClick )
EVT_BUTTON( wxID_OK, WinEDA_Build_BOM_Frame::OnOkClick ) EVT_BUTTON( wxID_OK, WinEDA_Build_BOM_Frame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_Build_BOM_Frame::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, WinEDA_Build_BOM_Frame::OnCancelClick )
EVT_BUTTON( wxID_APPLY, WinEDA_Build_BOM_Frame::OnApplyClick ) EVT_BUTTON( wxID_APPLY, WinEDA_Build_BOM_Frame::OnApplyClick )
////@end WinEDA_Build_BOM_Frame event table entries ////@end WinEDA_Build_BOM_Frame event table entries
...@@ -132,43 +134,55 @@ END_EVENT_TABLE() ...@@ -132,43 +134,55 @@ END_EVENT_TABLE()
* WinEDA_Build_BOM_Frame constructors * WinEDA_Build_BOM_Frame constructors
*/ */
WinEDA_Build_BOM_Frame::WinEDA_Build_BOM_Frame() { } WinEDA_Build_BOM_Frame::WinEDA_Build_BOM_Frame()
{
}
WinEDA_Build_BOM_Frame::WinEDA_Build_BOM_Frame( WinEDA_DrawFrame* parent, WinEDA_Build_BOM_Frame::WinEDA_Build_BOM_Frame( WinEDA_DrawFrame* parent,
wxWindowID id, const wxString& caption, const wxPoint& pos, wxWindowID id,
const wxSize& size, long style ) const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{ {
m_Parent = parent; m_Parent = parent;
/* Get options */ /* Get options */
s_OutputFormOpt = m_Parent->m_Parent->m_EDA_Config->Read(OPTION_BOM_FORMAT, (long) 0); s_OutputFormOpt = m_Parent->m_Parent->m_EDA_Config->Read( OPTION_BOM_FORMAT, (long) 0 );
s_OutputSeparatorOpt = m_Parent->m_Parent->m_EDA_Config->Read(OPTION_BOM_SEPARATOR, (long) 0); s_OutputSeparatorOpt = m_Parent->m_Parent->m_EDA_Config->Read( OPTION_BOM_SEPARATOR, (long) 0 );
long addfields = m_Parent->m_Parent->m_EDA_Config->Read(OPTION_BOM_ADD_FIELD, (long) 0); long addfields = m_Parent->m_Parent->m_EDA_Config->Read( OPTION_BOM_ADD_FIELD, (long) 0 );
for( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ ) for( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ )
{ {
if( (addfields & bitmask) ) if( (addfields & bitmask) )
* s_AddFieldList[ii] = true; *s_AddFieldList[ii] = true;
else else
* s_AddFieldList[ii] = false; *s_AddFieldList[ii] = false;
bitmask <<= 1; bitmask <<= 1;
} }
Create(parent, id, caption, pos, size, style); Create( parent, id, caption, pos, size, style );
m_OutputFormCtrl->SetSelection(s_OutputFormOpt); m_OutputFormCtrl->SetSelection( s_OutputFormOpt );
m_OutputSeparatorCtrl->SetSelection(s_OutputSeparatorOpt); m_OutputSeparatorCtrl->SetSelection( s_OutputSeparatorOpt );
if( s_OutputFormOpt == 1 ) if( s_OutputFormOpt == 1 )
m_OutputSeparatorCtrl->Enable(true); m_OutputSeparatorCtrl->Enable( true );
else else
m_OutputSeparatorCtrl->Enable(false); m_OutputSeparatorCtrl->Enable( false );
} }
/*! /*!
* WinEDA_Build_BOM_Frame creator * WinEDA_Build_BOM_Frame creator
*/ */
bool WinEDA_Build_BOM_Frame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) bool WinEDA_Build_BOM_Frame::Create( wxWindow* parent,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{ {
////@begin WinEDA_Build_BOM_Frame member initialisation ////@begin WinEDA_Build_BOM_Frame member initialisation
m_ListCmpbyRefItems = NULL; m_ListCmpbyRefItems = NULL;
...@@ -189,176 +203,225 @@ bool WinEDA_Build_BOM_Frame::Create( wxWindow* parent, wxWindowID id, const wxSt ...@@ -189,176 +203,225 @@ bool WinEDA_Build_BOM_Frame::Create( wxWindow* parent, wxWindowID id, const wxSt
m_AddField6 = NULL; m_AddField6 = NULL;
m_AddField7 = NULL; m_AddField7 = NULL;
m_AddField8 = NULL; m_AddField8 = NULL;
////@end WinEDA_Build_BOM_Frame member initialisation ////@end WinEDA_Build_BOM_Frame member initialisation
////@begin WinEDA_Build_BOM_Frame creation ////@begin WinEDA_Build_BOM_Frame creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS); SetExtraStyle( wxWS_EX_BLOCK_EVENTS );
wxDialog::Create( parent, id, caption, pos, size, style ); wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls(); CreateControls();
if (GetSizer()) if( GetSizer() )
{ {
GetSizer()->SetSizeHints(this); GetSizer()->SetSizeHints( this );
} }
Centre(); Centre();
////@end WinEDA_Build_BOM_Frame creation ////@end WinEDA_Build_BOM_Frame creation
return TRUE; return TRUE;
} }
/*! /*!
* Control creation for WinEDA_Build_BOM_Frame * Control creation for WinEDA_Build_BOM_Frame
*/ */
void WinEDA_Build_BOM_Frame::CreateControls() void WinEDA_Build_BOM_Frame::CreateControls()
{ {
SetFont(*g_DialogFont); SetFont( *g_DialogFont );
////@begin WinEDA_Build_BOM_Frame content construction ////@begin WinEDA_Build_BOM_Frame content construction
// Generated by DialogBlocks, Вск 04 Ноя 2007 18:43:07 (unregistered) // Generated by DialogBlocks, Вск 04 Ноя 2007 18:43:07 (unregistered)
WinEDA_Build_BOM_Frame* itemDialog1 = this; WinEDA_Build_BOM_Frame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
itemDialog1->SetSizer(itemBoxSizer2); itemDialog1->SetSizer( itemBoxSizer2 );
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxHORIZONTAL );
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT, 5); itemBoxSizer2->Add( itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, 5 );
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL); wxBoxSizer* itemBoxSizer4 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer3->Add(itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); itemBoxSizer3->Add( itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, 5 );
wxStaticBox* itemStaticBoxSizer5Static = new wxStaticBox(itemDialog1, wxID_ANY, _("List items:")); wxStaticBox* itemStaticBoxSizer5Static = new wxStaticBox( itemDialog1, wxID_ANY,
wxStaticBoxSizer* itemStaticBoxSizer5 = new wxStaticBoxSizer(itemStaticBoxSizer5Static, wxVERTICAL); _( "List items:" ) );
itemBoxSizer4->Add(itemStaticBoxSizer5, 0, wxGROW|wxALL, 5); wxStaticBoxSizer* itemStaticBoxSizer5 = new wxStaticBoxSizer( itemStaticBoxSizer5Static,
wxVERTICAL );
m_ListCmpbyRefItems = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Components by Reference"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); itemBoxSizer4->Add( itemStaticBoxSizer5, 0, wxGROW | wxALL, 5 );
m_ListCmpbyRefItems->SetValue(true);
itemStaticBoxSizer5->Add(m_ListCmpbyRefItems, 0, wxALIGN_LEFT|wxALL, 5); m_ListCmpbyRefItems = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _(
"Components by Reference" ), wxDefaultPosition,
m_ListSubCmpItems = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _("Sub Components (i.e. U2A, U2B ...)"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); wxDefaultSize, wxCHK_2STATE );
m_ListSubCmpItems->SetValue(false); m_ListCmpbyRefItems->SetValue( true );
itemStaticBoxSizer5->Add(m_ListSubCmpItems, 0, wxALIGN_LEFT|wxALL, 5); itemStaticBoxSizer5->Add( m_ListCmpbyRefItems, 0, wxALIGN_LEFT | wxALL, 5 );
m_ListCmpbyValItems = new wxCheckBox( itemDialog1, ID_CHECKBOX3, _("Components by Value"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ListSubCmpItems = new wxCheckBox( itemDialog1, ID_CHECKBOX2,
m_ListCmpbyValItems->SetValue(true); _(
itemStaticBoxSizer5->Add(m_ListCmpbyValItems, 0, wxALIGN_LEFT|wxALL, 5); "Sub Components (i.e. U2A, U2B ...)" ),
wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_GenListLabelsbyVal = new wxCheckBox( itemDialog1, ID_CHECKBOX4, _("Hierachy Pins by Name"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ListSubCmpItems->SetValue( false );
m_GenListLabelsbyVal->SetValue(false); itemStaticBoxSizer5->Add( m_ListSubCmpItems, 0, wxALIGN_LEFT | wxALL, 5 );
itemStaticBoxSizer5->Add(m_GenListLabelsbyVal, 0, wxALIGN_LEFT|wxALL, 5);
m_ListCmpbyValItems = new wxCheckBox( itemDialog1, ID_CHECKBOX3, _(
m_GenListLabelsbySheet = new wxCheckBox( itemDialog1, ID_CHECKBOX5, _("Hierachy Pins by Sheets"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); "Components by Value" ), wxDefaultPosition,
m_GenListLabelsbySheet->SetValue(false); wxDefaultSize, wxCHK_2STATE );
itemStaticBoxSizer5->Add(m_GenListLabelsbySheet, 0, wxALIGN_LEFT|wxALL, 5); m_ListCmpbyValItems->SetValue( true );
itemStaticBoxSizer5->Add( m_ListCmpbyValItems, 0, wxALIGN_LEFT | wxALL, 5 );
m_GenListLabelsbyVal = new wxCheckBox( itemDialog1, ID_CHECKBOX4, _(
"Hierachy Pins by Name" ), wxDefaultPosition,
wxDefaultSize, wxCHK_2STATE );
m_GenListLabelsbyVal->SetValue( false );
itemStaticBoxSizer5->Add( m_GenListLabelsbyVal, 0, wxALIGN_LEFT | wxALL, 5 );
m_GenListLabelsbySheet = new wxCheckBox( itemDialog1, ID_CHECKBOX5,
_(
"Hierachy Pins by Sheets" ), wxDefaultPosition,
wxDefaultSize, wxCHK_2STATE );
m_GenListLabelsbySheet->SetValue( false );
itemStaticBoxSizer5->Add( m_GenListLabelsbySheet, 0, wxALIGN_LEFT | wxALL, 5 );
wxArrayString m_OutputFormCtrlStrings; wxArrayString m_OutputFormCtrlStrings;
m_OutputFormCtrlStrings.Add(_("List")); m_OutputFormCtrlStrings.Add( _( "List" ) );
m_OutputFormCtrlStrings.Add(_("Text for spreadsheet import")); m_OutputFormCtrlStrings.Add( _( "Text for spreadsheet import" ) );
m_OutputFormCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX_SELECT_FORMAT, _("Output format:"), wxDefaultPosition, wxDefaultSize, m_OutputFormCtrlStrings, 1, wxRA_SPECIFY_COLS ); m_OutputFormCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX_SELECT_FORMAT, _(
m_OutputFormCtrl->SetSelection(0); "Output format:" ), wxDefaultPosition, wxDefaultSize,
itemBoxSizer4->Add(m_OutputFormCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5); m_OutputFormCtrlStrings, 1,
wxRA_SPECIFY_COLS );
m_OutputFormCtrl->SetSelection( 0 );
itemBoxSizer4->Add( m_OutputFormCtrl, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
wxArrayString m_OutputSeparatorCtrlStrings; wxArrayString m_OutputSeparatorCtrlStrings;
m_OutputSeparatorCtrlStrings.Add(_("Tab")); m_OutputSeparatorCtrlStrings.Add( _( "Tab" ) );
m_OutputSeparatorCtrlStrings.Add(_(";")); m_OutputSeparatorCtrlStrings.Add( _( ";" ) );
m_OutputSeparatorCtrlStrings.Add(_(",")); m_OutputSeparatorCtrlStrings.Add( _( "," ) );
m_OutputSeparatorCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX_SEPARATOR, _("Field separator for spreadsheet import:"), wxDefaultPosition, wxDefaultSize, m_OutputSeparatorCtrlStrings, 1, wxRA_SPECIFY_ROWS ); m_OutputSeparatorCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX_SEPARATOR,
m_OutputSeparatorCtrl->SetSelection(0); _(
itemBoxSizer4->Add(m_OutputSeparatorCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); "Field separator for spreadsheet import:" ),
wxDefaultPosition, wxDefaultSize,
wxStaticBox* itemStaticBoxSizer13Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options:")); m_OutputSeparatorCtrlStrings, 1, wxRA_SPECIFY_ROWS );
wxStaticBoxSizer* itemStaticBoxSizer13 = new wxStaticBoxSizer(itemStaticBoxSizer13Static, wxHORIZONTAL); m_OutputSeparatorCtrl->SetSelection( 0 );
itemBoxSizer4->Add(itemStaticBoxSizer13, 0, wxGROW|wxALL, 5); itemBoxSizer4->Add( m_OutputSeparatorCtrl, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
m_GetListBrowser = new wxCheckBox( itemDialog1, ID_CHECKBOX6, _("Launch list browser"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); wxStaticBox* itemStaticBoxSizer13Static = new wxStaticBox( itemDialog1, wxID_ANY,
m_GetListBrowser->SetValue(false); _( "Options:" ) );
itemStaticBoxSizer13->Add(m_GetListBrowser, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxStaticBoxSizer* itemStaticBoxSizer13 = new wxStaticBoxSizer( itemStaticBoxSizer13Static,
wxHORIZONTAL );
wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxVERTICAL); itemBoxSizer4->Add( itemStaticBoxSizer13, 0, wxGROW | wxALL, 5 );
itemBoxSizer3->Add(itemBoxSizer15, 0, wxALIGN_TOP|wxLEFT|wxTOP|wxBOTTOM, 5);
m_GetListBrowser = new wxCheckBox( itemDialog1, ID_CHECKBOX6, _(
wxStaticBox* itemStaticBoxSizer16Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Fields to add:")); "Launch list browser" ), wxDefaultPosition,
m_FieldsToAppendListSizer = new wxStaticBoxSizer(itemStaticBoxSizer16Static, wxVERTICAL); wxDefaultSize, wxCHK_2STATE );
itemBoxSizer15->Add(m_FieldsToAppendListSizer, 0, wxALIGN_LEFT|wxALL, 5); m_GetListBrowser->SetValue( false );
itemStaticBoxSizer13->Add( m_GetListBrowser, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
m_AddFootprintField = new wxCheckBox( itemDialog1, ID_CHECKBOX_FOOTPRINT_FIELD, _("Footprint"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddFootprintField->SetValue(false); wxBoxSizer* itemBoxSizer15 = new wxBoxSizer( wxVERTICAL );
m_FieldsToAppendListSizer->Add(m_AddFootprintField, 0, wxGROW|wxALL, 5); itemBoxSizer3->Add( itemBoxSizer15, 0, wxALIGN_TOP | wxLEFT | wxTOP | wxBOTTOM, 5 );
m_AddField1 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD1, _("Field 1"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); wxStaticBox* itemStaticBoxSizer16Static = new wxStaticBox( itemDialog1, wxID_ANY,
m_AddField1->SetValue(false); _( "Fields to add:" ) );
m_FieldsToAppendListSizer->Add(m_AddField1, 0, wxGROW|wxALL, 5); m_FieldsToAppendListSizer = new wxStaticBoxSizer( itemStaticBoxSizer16Static, wxVERTICAL );
itemBoxSizer15->Add( m_FieldsToAppendListSizer, 0, wxALIGN_LEFT | wxALL, 5 );
m_AddField2 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD2, _("Field 2"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddField2->SetValue(false); m_AddFootprintField = new wxCheckBox( itemDialog1, ID_CHECKBOX_FOOTPRINT_FIELD, _(
m_FieldsToAppendListSizer->Add(m_AddField2, 0, wxGROW|wxALL, 5); "Footprint" ), wxDefaultPosition, wxDefaultSize,
wxCHK_2STATE );
m_AddField3 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD3, _("Field 3"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_AddFootprintField->SetValue( false );
m_AddField3->SetValue(false); m_FieldsToAppendListSizer->Add( m_AddFootprintField, 0, wxGROW | wxALL, 5 );
m_FieldsToAppendListSizer->Add(m_AddField3, 0, wxGROW|wxALL, 5);
m_AddField1 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD1, _(
m_AddField4 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD4, _("Field 4"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); "Field 1" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddField4->SetValue(false); m_AddField1->SetValue( false );
m_FieldsToAppendListSizer->Add(m_AddField4, 0, wxGROW|wxALL, 5); m_FieldsToAppendListSizer->Add( m_AddField1, 0, wxGROW | wxALL, 5 );
m_AddField5 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD5, _("Field 5"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_AddField2 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD2, _(
m_AddField5->SetValue(false); "Field 2" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_FieldsToAppendListSizer->Add(m_AddField5, 0, wxGROW|wxALL, 5); m_AddField2->SetValue( false );
m_FieldsToAppendListSizer->Add( m_AddField2, 0, wxGROW | wxALL, 5 );
m_AddField6 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD6, _("Field 6"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddField6->SetValue(false); m_AddField3 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD3, _(
m_FieldsToAppendListSizer->Add(m_AddField6, 0, wxGROW|wxALL, 5); "Field 3" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddField3->SetValue( false );
m_AddField7 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD7, _("Field 7"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_FieldsToAppendListSizer->Add( m_AddField3, 0, wxGROW | wxALL, 5 );
m_AddField7->SetValue(false);
m_FieldsToAppendListSizer->Add(m_AddField7, 0, wxGROW|wxALL, 5); m_AddField4 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD4, _(
"Field 4" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddField8 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD8, _("Field 8"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_AddField4->SetValue( false );
m_AddField8->SetValue(false); m_FieldsToAppendListSizer->Add( m_AddField4, 0, wxGROW | wxALL, 5 );
m_FieldsToAppendListSizer->Add(m_AddField8, 0, wxGROW|wxALL, 5);
m_AddField5 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD5, _(
itemBoxSizer15->Add(5, 5, 0, wxGROW|wxALL, 10); "Field 5" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddField5->SetValue( false );
wxButton* itemButton27 = new wxButton( itemDialog1, ID_CREATE_LIST, _("Create &List"), wxDefaultPosition, wxDefaultSize, 0 ); m_FieldsToAppendListSizer->Add( m_AddField5, 0, wxGROW | wxALL, 5 );
m_AddField6 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD6, _(
"Field 6" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddField6->SetValue( false );
m_FieldsToAppendListSizer->Add( m_AddField6, 0, wxGROW | wxALL, 5 );
m_AddField7 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD7, _(
"Field 7" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddField7->SetValue( false );
m_FieldsToAppendListSizer->Add( m_AddField7, 0, wxGROW | wxALL, 5 );
m_AddField8 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD8, _(
"Field 8" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_AddField8->SetValue( false );
m_FieldsToAppendListSizer->Add( m_AddField8, 0, wxGROW | wxALL, 5 );
itemBoxSizer15->Add( 5, 5, 0, wxGROW | wxALL, 10 );
wxButton* itemButton27 = new wxButton( itemDialog1, ID_CREATE_LIST, _(
"Create &List" ), wxDefaultPosition, wxDefaultSize,
0 );
itemButton27->SetDefault(); itemButton27->SetDefault();
itemButton27->SetForegroundColour(wxColour(166, 0, 0)); itemButton27->SetForegroundColour( wxColour( 166, 0, 0 ) );
itemBoxSizer15->Add(itemButton27, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); itemBoxSizer15->Add( itemButton27, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
wxBoxSizer* itemBoxSizer28 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* itemBoxSizer28 = new wxBoxSizer( wxHORIZONTAL );
itemBoxSizer2->Add(itemBoxSizer28, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5); itemBoxSizer2->Add( itemBoxSizer28,
0,
wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
wxButton* itemButton29 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); wxButton* itemButton29 = new wxButton( itemDialog1, wxID_OK, _(
itemButton29->SetForegroundColour(wxColour(255, 0, 0)); "&OK" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer28->Add(itemButton29, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); itemButton29->SetForegroundColour( wxColour( 255, 0, 0 ) );
itemBoxSizer28->Add( itemButton29, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxButton* itemButton30 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); wxButton* itemButton30 = new wxButton( itemDialog1, wxID_CANCEL, _(
itemButton30->SetForegroundColour(wxColour(0, 0, 255)); "&Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer28->Add(itemButton30, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); itemButton30->SetForegroundColour( wxColour( 0, 0, 255 ) );
itemBoxSizer28->Add( itemButton30, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxButton* itemButton31 = new wxButton( itemDialog1, wxID_APPLY, _("&Apply"), wxDefaultPosition, wxDefaultSize, 0 ); wxButton* itemButton31 = new wxButton( itemDialog1, wxID_APPLY, _(
itemBoxSizer28->Add(itemButton31, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); "&Apply" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer28->Add( itemButton31, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
// Set validators // Set validators
m_ListCmpbyRefItems->SetValidator( wxGenericValidator(& s_ListByRef) ); m_ListCmpbyRefItems->SetValidator( wxGenericValidator( &s_ListByRef ) );
m_ListSubCmpItems->SetValidator( wxGenericValidator(& s_ListWithSubCmponents) ); m_ListSubCmpItems->SetValidator( wxGenericValidator( &s_ListWithSubCmponents ) );
m_ListCmpbyValItems->SetValidator( wxGenericValidator(& s_ListByValue) ); m_ListCmpbyValItems->SetValidator( wxGenericValidator( &s_ListByValue ) );
m_GenListLabelsbyVal->SetValidator( wxGenericValidator(& s_ListHierarchicalPinByName) ); m_GenListLabelsbyVal->SetValidator( wxGenericValidator( &s_ListHierarchicalPinByName ) );
m_GenListLabelsbySheet->SetValidator( wxGenericValidator(& s_ListBySheet) ); m_GenListLabelsbySheet->SetValidator( wxGenericValidator( &s_ListBySheet ) );
m_OutputFormCtrl->SetValidator( wxGenericValidator(& s_OutputFormOpt) ); m_OutputFormCtrl->SetValidator( wxGenericValidator( &s_OutputFormOpt ) );
m_OutputSeparatorCtrl->SetValidator( wxGenericValidator(& s_OutputSeparatorOpt) ); m_OutputSeparatorCtrl->SetValidator( wxGenericValidator( &s_OutputSeparatorOpt ) );
m_GetListBrowser->SetValidator( wxGenericValidator(& s_BrowsList) ); m_GetListBrowser->SetValidator( wxGenericValidator( &s_BrowsList ) );
m_AddFootprintField->SetValidator( wxGenericValidator(& s_Add_FpField_state) ); m_AddFootprintField->SetValidator( wxGenericValidator( &s_Add_FpField_state ) );
m_AddField1->SetValidator( wxGenericValidator(& s_Add_F1_state) ); m_AddField1->SetValidator( wxGenericValidator( &s_Add_F1_state ) );
m_AddField2->SetValidator( wxGenericValidator(& s_Add_F2_state) ); m_AddField2->SetValidator( wxGenericValidator( &s_Add_F2_state ) );
m_AddField3->SetValidator( wxGenericValidator(& s_Add_F3_state) ); m_AddField3->SetValidator( wxGenericValidator( &s_Add_F3_state ) );
m_AddField4->SetValidator( wxGenericValidator(& s_Add_F4_state) ); m_AddField4->SetValidator( wxGenericValidator( &s_Add_F4_state ) );
m_AddField5->SetValidator( wxGenericValidator(& s_Add_F5_state) ); m_AddField5->SetValidator( wxGenericValidator( &s_Add_F5_state ) );
m_AddField6->SetValidator( wxGenericValidator(& s_Add_F6_state) ); m_AddField6->SetValidator( wxGenericValidator( &s_Add_F6_state ) );
m_AddField7->SetValidator( wxGenericValidator(& s_Add_F7_state) ); m_AddField7->SetValidator( wxGenericValidator( &s_Add_F7_state ) );
m_AddField8->SetValidator( wxGenericValidator(& s_Add_F8_state) ); m_AddField8->SetValidator( wxGenericValidator( &s_Add_F8_state ) );
////@end WinEDA_Build_BOM_Frame content construction ////@end WinEDA_Build_BOM_Frame content construction
} }
/*! /*!
* Should we show tooltips? * Should we show tooltips?
*/ */
...@@ -368,6 +431,7 @@ bool WinEDA_Build_BOM_Frame::ShowToolTips() ...@@ -368,6 +431,7 @@ bool WinEDA_Build_BOM_Frame::ShowToolTips()
return TRUE; return TRUE;
} }
/*! /*!
* Get bitmap resources * Get bitmap resources
*/ */
...@@ -376,11 +440,13 @@ wxBitmap WinEDA_Build_BOM_Frame::GetBitmapResource( const wxString& name ) ...@@ -376,11 +440,13 @@ wxBitmap WinEDA_Build_BOM_Frame::GetBitmapResource( const wxString& name )
{ {
// Bitmap retrieval // Bitmap retrieval
////@begin WinEDA_Build_BOM_Frame bitmap retrieval ////@begin WinEDA_Build_BOM_Frame bitmap retrieval
wxUnusedVar(name); wxUnusedVar( name );
return wxNullBitmap; return wxNullBitmap;
////@end WinEDA_Build_BOM_Frame bitmap retrieval ////@end WinEDA_Build_BOM_Frame bitmap retrieval
} }
/*! /*!
* Get icon resources * Get icon resources
*/ */
...@@ -389,8 +455,9 @@ wxIcon WinEDA_Build_BOM_Frame::GetIconResource( const wxString& name ) ...@@ -389,8 +455,9 @@ wxIcon WinEDA_Build_BOM_Frame::GetIconResource( const wxString& name )
{ {
// Icon retrieval // Icon retrieval
////@begin WinEDA_Build_BOM_Frame icon retrieval ////@begin WinEDA_Build_BOM_Frame icon retrieval
wxUnusedVar(name); wxUnusedVar( name );
return wxNullIcon; return wxNullIcon;
////@end WinEDA_Build_BOM_Frame icon retrieval ////@end WinEDA_Build_BOM_Frame icon retrieval
} }
...@@ -402,9 +469,9 @@ wxIcon WinEDA_Build_BOM_Frame::GetIconResource( const wxString& name ) ...@@ -402,9 +469,9 @@ wxIcon WinEDA_Build_BOM_Frame::GetIconResource( const wxString& name )
void WinEDA_Build_BOM_Frame::OnRadioboxSelectFormatSelected( wxCommandEvent& event ) void WinEDA_Build_BOM_Frame::OnRadioboxSelectFormatSelected( wxCommandEvent& event )
{ {
if( m_OutputFormCtrl->GetSelection() == 1 ) if( m_OutputFormCtrl->GetSelection() == 1 )
m_OutputSeparatorCtrl->Enable(true); m_OutputSeparatorCtrl->Enable( true );
else else
m_OutputSeparatorCtrl->Enable(false); m_OutputSeparatorCtrl->Enable( false );
} }
...@@ -480,18 +547,19 @@ void WinEDA_Build_BOM_Frame::SavePreferences() ...@@ -480,18 +547,19 @@ void WinEDA_Build_BOM_Frame::SavePreferences()
s_Add_F8_state = m_AddField8->GetValue(); s_Add_F8_state = m_AddField8->GetValue();
// Now save current settings of both radiobutton groups // Now save current settings of both radiobutton groups
m_Parent->m_Parent->m_EDA_Config->Write(OPTION_BOM_FORMAT, (long)s_OutputFormOpt); m_Parent->m_Parent->m_EDA_Config->Write( OPTION_BOM_FORMAT, (long) s_OutputFormOpt );
m_Parent->m_Parent->m_EDA_Config->Write(OPTION_BOM_SEPARATOR, (long) s_OutputSeparatorOpt); m_Parent->m_Parent->m_EDA_Config->Write( OPTION_BOM_SEPARATOR, (long) s_OutputSeparatorOpt );
// Now save current settings of all 8 "Fields to add" checkboxes // Now save current settings of all 8 "Fields to add" checkboxes
long addfields = 0; long addfields = 0;
for( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ ) for( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ )
{ {
if( * s_AddFieldList[ii] ) if( *s_AddFieldList[ii] )
addfields |= bitmask; addfields |= bitmask;
bitmask <<= 1; bitmask <<= 1;
} }
m_Parent->m_Parent->m_EDA_Config->Write(OPTION_BOM_ADD_FIELD, addfields);
m_Parent->m_Parent->m_EDA_Config->Write( OPTION_BOM_ADD_FIELD, addfields );
} }
...@@ -499,8 +567,8 @@ void WinEDA_Build_BOM_Frame::SavePreferences() ...@@ -499,8 +567,8 @@ void WinEDA_Build_BOM_Frame::SavePreferences()
void WinEDA_Build_BOM_Frame::GenList() void WinEDA_Build_BOM_Frame::GenList()
/**********************************************************/ /**********************************************************/
{ {
#define EXT_LIST wxT(".lst") #define EXT_LIST wxT( ".lst" )
wxString mask, filename; wxString mask, filename;
// Although the currently selected options determine the contents // Although the currently selected options determine the contents
// and format of the subsequently generated file, they are still // and format of the subsequently generated file, they are still
...@@ -537,13 +605,14 @@ wxString mask, filename; ...@@ -537,13 +605,14 @@ wxString mask, filename;
s_ExportSeparatorSymbol = s_ExportSeparator[0]; s_ExportSeparatorSymbol = s_ExportSeparator[0];
m_ListFileName = g_RootSheet->m_AssociatedScreen->m_FileName; m_ListFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
ChangeFileNameExt(m_ListFileName, EXT_LIST); ChangeFileNameExt( m_ListFileName, EXT_LIST );
//need to get rid of the path. //need to get rid of the path.
m_ListFileName = m_ListFileName.AfterLast('/'); m_ListFileName = m_ListFileName.AfterLast( '/' );
mask = wxT("*"); mask = wxT( "*" );
mask += EXT_LIST; mask += EXT_LIST;
filename = EDA_FileSelector(_("Bill of materials:"), filename = EDA_FileSelector( _( "Bill of materials:" ),
wxEmptyString, /* Chemin par defaut (ici dir courante) */ wxEmptyString, /* Chemin par defaut (ici dir courante) */
m_ListFileName, /* nom fichier par defaut, et resultat */ m_ListFileName, /* nom fichier par defaut, et resultat */
EXT_LIST, /* extension par defaut */ EXT_LIST, /* extension par defaut */
...@@ -558,11 +627,12 @@ wxString mask, filename; ...@@ -558,11 +627,12 @@ wxString mask, filename;
m_ListFileName = filename; m_ListFileName = filename;
/* Close dialog, then show the list (if so requested) */ /* Close dialog, then show the list (if so requested) */
// if( s_OutputFormOpt == 0 ) // if( s_OutputFormOpt == 0 )
if( m_OutputFormCtrl->GetSelection() == 0 ) if( m_OutputFormCtrl->GetSelection() == 0 )
GenereListeOfItems(m_ListFileName); GenereListeOfItems( m_ListFileName );
else else
CreateExportList(m_ListFileName); CreateExportList( m_ListFileName );
EndModal( 1 ); EndModal( 1 );
...@@ -570,40 +640,40 @@ wxString mask, filename; ...@@ -570,40 +640,40 @@ wxString mask, filename;
if( m_GetListBrowser->GetValue() ) if( m_GetListBrowser->GetValue() )
{ {
wxString editorname = GetEditorName(); wxString editorname = GetEditorName();
AddDelimiterString(filename); AddDelimiterString( filename );
ExecuteFile(this, editorname, filename); ExecuteFile( this, editorname, filename );
} }
} }
/****************************************************************************/ /****************************************************************************/
void WinEDA_Build_BOM_Frame::CreateExportList(const wxString & FullFileName) void WinEDA_Build_BOM_Frame::CreateExportList( const wxString& FullFileName )
/****************************************************************************/ /****************************************************************************/
/* /*
* Print a list of components, in a form which can be imported by a spreadsheet * Print a list of components, in a form which can be imported by a spreadsheet
* form is: * form is:
* cmp name; cmp val; fields; * cmp name; cmp val; fields;
*/ */
{ {
FILE *f; FILE* f;
ListComponent * List; ListComponent* List;
int NbItems; int NbItems;
wxString msg; wxString msg;
/* Creation de la liste des elements */ /* Creation de la liste des elements */
if( ( f = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL ) if( ( f = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL )
{ {
msg = _("Failed to open file "); msg = _( "Failed to open file " );
msg << FullFileName; msg << FullFileName;
DisplayError(this, msg); DisplayError( this, msg );
return; return;
} }
NbItems = GenListeCmp( NULL ); NbItems = GenListeCmp( NULL );
if( NbItems ) if( NbItems )
{ {
List = (ListComponent*)MyZMalloc( NbItems * sizeof(ListComponent) ); List = (ListComponent*) MyZMalloc( NbItems * sizeof(ListComponent) );
if( List == NULL ) if( List == NULL )
{ {
fclose( f ); fclose( f );
...@@ -614,14 +684,14 @@ wxString msg; ...@@ -614,14 +684,14 @@ wxString msg;
/* sort component list */ /* sort component list */
qsort( List, NbItems, sizeof( ListComponent ), qsort( List, NbItems, sizeof( ListComponent ),
(int(*)(const void*, const void*))ListTriComposantByRef ); ( int( * ) ( const void*, const void* ) )ListTriComposantByRef );
// if( ! s_ListWithSubCmponents ) // if( ! s_ListWithSubCmponents )
if( ! m_ListSubCmpItems->GetValue() ) if( !m_ListSubCmpItems->GetValue() )
DeleteSubCmp(List, NbItems); DeleteSubCmp( List, NbItems );
/* create the file */ /* create the file */
PrintListeCmpByRef(f, List, NbItems, TRUE); PrintListeCmpByRef( f, List, NbItems, TRUE );
MyFree( List ); MyFree( List );
} }
...@@ -630,35 +700,35 @@ wxString msg; ...@@ -630,35 +700,35 @@ wxString msg;
} }
/****************************************************************************/ /****************************************************************************/
void WinEDA_Build_BOM_Frame::GenereListeOfItems(const wxString & FullFileName) void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName )
/****************************************************************************/ /****************************************************************************/
/* /*
* Routine principale pour la creation des listings ( composants et/ou labels * Routine principale pour la creation des listings ( composants et/ou labels
* globaux et "sheet labels" ) * globaux et "sheet labels" )
*/ */
{ {
FILE *f; FILE* f;
ListComponent * List; ListComponent* List;
ListLabel * ListOfLabels; ListLabel* ListOfLabels;
int NbItems; int NbItems;
char Line[1024]; char Line[1024];
wxString msg; wxString msg;
/* Creation de la liste des elements */ /* Creation de la liste des elements */
if( ( f = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL ) if( ( f = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL )
{ {
msg = _("Failed to open file "); msg = _( "Failed to open file " );
msg << FullFileName; msg << FullFileName;
DisplayError(this, msg); DisplayError( this, msg );
return; return;
} }
NbItems = GenListeCmp( NULL ); NbItems = GenListeCmp( NULL );
if( NbItems ) if( NbItems )
{ {
List = ( ListComponent *) List = (ListComponent*)
MyZMalloc( NbItems * sizeof(ListComponent) ); MyZMalloc( NbItems * sizeof(ListComponent) );
if( List == NULL ) if( List == NULL )
{ {
...@@ -668,39 +738,45 @@ wxString msg; ...@@ -668,39 +738,45 @@ wxString msg;
GenListeCmp( List ); GenListeCmp( List );
for(int i=0; i<NbItems; i++){ #if 0
printf("found component: %s\n", List[i].m_Ref); for( int i = 0; i<NbItems; i++ )
{
printf( "found component: %s\n", List[i].m_Ref );
} }
#endif
/* generation du fichier listing */ /* generation du fichier listing */
DateAndTime(Line); DateAndTime( Line );
wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion(); wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
fprintf( f, "%s >> Creation date: %s\n", CONV_TO_UTF8(Title), Line ); fprintf( f, "%s >> Creation date: %s\n", CONV_TO_UTF8( Title ), Line );
/* Tri et impression de la liste des composants */ /* Tri et impression de la liste des composants */
qsort( List, NbItems, sizeof( ListComponent ), qsort( List, NbItems, sizeof( ListComponent ),
(int(*)(const void*, const void*))ListTriComposantByRef ); ( int( * ) ( const void*, const void* ) )ListTriComposantByRef );
printf("sorted by reference:\n"); #if 0
for(int i=0; i<NbItems; i++){ printf( "sorted by reference:\n" );
printf("found component: %s\n", List[i].m_Ref); for( int i = 0; i<NbItems; i++ )
{
printf( "found component: %s\n", List[i].m_Ref );
} }
#endif
// if( ! s_ListWithSubCmponents ) // if( ! s_ListWithSubCmponents )
if( ! m_ListSubCmpItems->GetValue() ) if( !m_ListSubCmpItems->GetValue() )
DeleteSubCmp(List, NbItems); DeleteSubCmp( List, NbItems );
// if( s_ListByRef ) // if( s_ListByRef )
if( m_ListCmpbyRefItems->GetValue() ) if( m_ListCmpbyRefItems->GetValue() )
{ {
PrintListeCmpByRef(f, List, NbItems); PrintListeCmpByRef( f, List, NbItems );
} }
// if( s_ListByValue ) // if( s_ListByValue )
if( m_ListCmpbyValItems->GetValue() ) if( m_ListCmpbyValItems->GetValue() )
{ {
qsort( List, NbItems, sizeof( ListComponent ), qsort( List, NbItems, sizeof( ListComponent ),
(int(*)(const void*, const void*))ListTriComposantByVal ); ( int( * ) ( const void*, const void* ) )ListTriComposantByVal );
PrintListeCmpByVal(f, List, NbItems); PrintListeCmpByVal( f, List, NbItems );
} }
MyFree( List ); MyFree( List );
} }
...@@ -712,51 +788,52 @@ wxString msg; ...@@ -712,51 +788,52 @@ wxString msg;
NbItems = GenListeGLabels( NULL ); NbItems = GenListeGLabels( NULL );
if( NbItems ) if( NbItems )
{ {
ListOfLabels = (ListLabel *) MyZMalloc( NbItems * sizeof(ListLabel) ); ListOfLabels = (ListLabel*) MyZMalloc( NbItems * sizeof(ListLabel) );
memset((void*)ListOfLabels, 0, NbItems * sizeof(ListLabel)); memset( (void*) ListOfLabels, 0, NbItems * sizeof(ListLabel) );
if( ListOfLabels == NULL ) if( ListOfLabels == NULL )
{ {
fclose( f ); fclose( f );
return; return;
} }
GenListeGLabels(ListOfLabels); GenListeGLabels( ListOfLabels );
/* Tri de la liste */ /* Tri de la liste */
// if( s_ListBySheet ) // if( s_ListBySheet )
if( m_GenListLabelsbySheet->GetValue() ) if( m_GenListLabelsbySheet->GetValue() )
{ {
qsort( ListOfLabels, NbItems, sizeof( ListLabel ), qsort( ListOfLabels, NbItems, sizeof( ListLabel ),
(int(*)(const void*, const void*))ListTriGLabelBySheet ); ( int( * ) ( const void*, const void* ) )ListTriGLabelBySheet );
msg.Printf( _("\n#Glob labels ( order = Sheet Number ) count = %d\n"), NbItems ); msg.Printf( _( "\n#Glob labels ( order = Sheet Number ) count = %d\n" ), NbItems );
fprintf( f, "%s", CONV_TO_UTF8(msg) ); fprintf( f, "%s", CONV_TO_UTF8( msg ) );
PrintListeGLabel(f, ListOfLabels, NbItems); PrintListeGLabel( f, ListOfLabels, NbItems );
} }
// if( s_ListHierarchicalPinByName ) // if( s_ListHierarchicalPinByName )
if( m_GenListLabelsbyVal->GetValue() ) if( m_GenListLabelsbyVal->GetValue() )
{ {
qsort( ListOfLabels, NbItems, sizeof( ListLabel ), qsort( ListOfLabels, NbItems, sizeof( ListLabel ),
(int(*)(const void*, const void*))ListTriGLabelByVal ); ( int( * ) ( const void*, const void* ) )ListTriGLabelByVal );
msg.Printf(_("\n#Glob labels ( order = Alphab. ) count = %d\n\n"), NbItems ); msg.Printf( _( "\n#Glob labels ( order = Alphab. ) count = %d\n\n" ), NbItems );
fprintf( f, "%s", CONV_TO_UTF8(msg) ); fprintf( f, "%s", CONV_TO_UTF8( msg ) );
PrintListeGLabel(f, ListOfLabels, NbItems); PrintListeGLabel( f, ListOfLabels, NbItems );
} }
MyFree( ListOfLabels ); MyFree( ListOfLabels );
} }
msg = _("\n#End List\n"); msg = _( "\n#End List\n" );
fprintf( f, "%s", CONV_TO_UTF8(msg) ); fprintf( f, "%s", CONV_TO_UTF8( msg ) );
fclose( f ); fclose( f );
} }
/****************************************/ /****************************************/
int GenListeCmp( ListComponent * List ) int GenListeCmp( ListComponent* List )
/****************************************/ /****************************************/
/* Routine de generation de la liste des elements utiles du dessin /* Routine de generation de la liste des elements utiles du dessin
* Si List == NULL: comptage des elements * Si List == NULL: comptage des elements
* Sinon remplissage de la liste * Sinon remplissage de la liste
...@@ -769,13 +846,13 @@ int GenListeCmp( ListComponent * List ) ...@@ -769,13 +846,13 @@ int GenListeCmp( ListComponent * List )
* multiple instances of a given screen. * multiple instances of a given screen.
*/ */
{ {
int ItemCount = 0; int ItemCount = 0;
EDA_BaseStruct *DrawList; EDA_BaseStruct* DrawList;
EDA_SchComponentStruct *DrawLibItem; EDA_SchComponentStruct* DrawLibItem;
DrawSheetPath * sheet; DrawSheetPath* sheet;
/* Build the sheet (not screen) list */ /* Build the sheet (not screen) list */
EDA_SheetList SheetList(NULL); EDA_SheetList SheetList( NULL );
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
...@@ -784,17 +861,17 @@ DrawSheetPath * sheet; ...@@ -784,17 +861,17 @@ DrawSheetPath * sheet;
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
case DRAW_LIB_ITEM_STRUCT_TYPE : case DRAW_LIB_ITEM_STRUCT_TYPE:
ItemCount++; ItemCount++;
DrawLibItem = (EDA_SchComponentStruct *) DrawList; DrawLibItem = (EDA_SchComponentStruct*) DrawList;
DrawLibItem->m_Parent = sheet->LastScreen(); DrawLibItem->m_Parent = sheet->LastScreen();
if( List ) if( List )
{ {
(*List).m_Comp = DrawLibItem; List->m_Comp = DrawLibItem;
(*List).m_SheetList = *sheet; List->m_SheetList = *sheet;
strncpy(&((*List).m_Ref[0]), strncpy( List->m_Ref,
CONV_TO_UTF8(DrawLibItem->GetRef(sheet)), CONV_TO_UTF8( DrawLibItem->GetRef( sheet ) ),
sizeof((*List).m_Ref)); sizeof( List->m_Ref ) );
List++; List++;
} }
break; break;
...@@ -802,66 +879,69 @@ DrawSheetPath * sheet; ...@@ -802,66 +879,69 @@ DrawSheetPath * sheet;
default: default:
break; break;
} }
DrawList = DrawList->Pnext; DrawList = DrawList->Pnext;
} }
} }
return( ItemCount );
return ItemCount;
} }
/*********************************************/ /*********************************************/
static int GenListeGLabels( ListLabel * List ) static int GenListeGLabels( ListLabel* List )
/*********************************************/ /*********************************************/
/* Count the Glabels, or fill the list Listwith Glabel pointers /* Count the Glabels, or fill the list Listwith Glabel pointers
* If List == NULL: Item count only * If List == NULL: Item count only
* Else fill list of Glabels * Else fill list of Glabels
*/ */
{ {
int ItemCount = 0; int ItemCount = 0;
EDA_BaseStruct *DrawList; EDA_BaseStruct* DrawList;
DrawSheetLabelStruct *SheetLabel; DrawSheetLabelStruct* SheetLabel;
DrawSheetPath * sheet; DrawSheetPath* sheet;
/* Build the screen list */ /* Build the screen list */
EDA_SheetList SheetList(NULL); EDA_SheetList SheetList( NULL );
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
DrawList = sheet->LastDrawList(); DrawList = sheet->LastDrawList();
wxString path = sheet->Path(); wxString path = sheet->PathHumanReadable();
while(DrawList ) while( DrawList )
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
case DRAW_HIER_LABEL_STRUCT_TYPE: case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE : case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
ItemCount++; ItemCount++;
if( List ) if( List )
{ {
List->m_LabelType = DrawList->Type(); List->m_LabelType = DrawList->Type();
snprintf(List->m_SheetPath, sizeof(List->m_SheetPath), snprintf( List->m_SheetPath, sizeof(List->m_SheetPath),
"%s", CONV_TO_UTF8(path)); "%s", CONV_TO_UTF8( path ) );
List->m_Label = DrawList; List->m_Label = DrawList;
List++; List++;
} }
break; break;
case DRAW_SHEET_STRUCT_TYPE : case DRAW_SHEET_STRUCT_TYPE:
{ {
#define Sheet ((DrawSheetStruct * ) DrawList) #define Sheet ( (DrawSheetStruct*) DrawList )
SheetLabel= Sheet->m_Label; SheetLabel = Sheet->m_Label;
while( SheetLabel != NULL ) while( SheetLabel != NULL )
{ {
if( List ) if( List )
{ {
List->m_LabelType = DRAW_SHEETLABEL_STRUCT_TYPE; List->m_LabelType = DRAW_SHEETLABEL_STRUCT_TYPE;
snprintf(List->m_SheetPath, sizeof(List->m_SheetPath), snprintf( List->m_SheetPath, sizeof(List->m_SheetPath),
"%s", CONV_TO_UTF8(path)); "%s", CONV_TO_UTF8( path ) );
List->m_Label = SheetLabel; List->m_Label = SheetLabel;
List++; List++;
} }
ItemCount++; ItemCount++;
SheetLabel = (DrawSheetLabelStruct*)(SheetLabel->Pnext); SheetLabel = (DrawSheetLabelStruct*) (SheetLabel->Pnext);
} }
} }
break; break;
...@@ -872,14 +952,16 @@ DrawSheetPath * sheet; ...@@ -872,14 +952,16 @@ DrawSheetPath * sheet;
DrawList = DrawList->Pnext; DrawList = DrawList->Pnext;
} }
} }
return( ItemCount );
return ItemCount;
} }
/**********************************************************/ /**********************************************************/
static int ListTriComposantByVal(ListComponent *Objet1, static int ListTriComposantByVal( ListComponent* Objet1,
ListComponent *Objet2) ListComponent* Objet2 )
/**********************************************************/ /**********************************************************/
/* Routine de comparaison pour le tri du Tableau par qsort() /* Routine de comparaison pour le tri du Tableau par qsort()
* Les composants sont tries * Les composants sont tries
* par valeur * par valeur
...@@ -887,29 +969,29 @@ static int ListTriComposantByVal(ListComponent *Objet1, ...@@ -887,29 +969,29 @@ static int ListTriComposantByVal(ListComponent *Objet1,
* si meme valeur: par numero d'unite * si meme valeur: par numero d'unite
*/ */
{ {
int ii; int ii;
const wxString * Text1, *Text2; const wxString* Text1, * Text2;
if( ( Objet1 == NULL ) && ( Objet2 == NULL ) ) if( ( Objet1 == NULL ) && ( Objet2 == NULL ) )
return( 0 ); return 0;
if( Objet1 == NULL ) if( Objet1 == NULL )
return( -1 ); return -1;
if( Objet2 == NULL ) if( Objet2 == NULL )
return( 1 ); return 1;
if( ( Objet1->m_Comp == NULL ) && ( Objet2->m_Comp == NULL ) ) if( ( Objet1->m_Comp == NULL ) && ( Objet2->m_Comp == NULL ) )
return( 0 ); return 0;
if( Objet1->m_Comp == NULL ) if( Objet1->m_Comp == NULL )
return( -1 ); return -1;
if( Objet2->m_Comp == NULL ) if( Objet2->m_Comp == NULL )
return( 1 ); return 1;
Text1 = &(Objet1->m_Comp->m_Field[VALUE].m_Text); Text1 = &(Objet1->m_Comp->m_Field[VALUE].m_Text);
Text2 = &(Objet2->m_Comp->m_Field[VALUE].m_Text); Text2 = &(Objet2->m_Comp->m_Field[VALUE].m_Text);
ii = Text1->CmpNoCase(*Text2); ii = Text1->CmpNoCase( *Text2 );
if( ii == 0 ) if( ii == 0 )
{ {
ii = strcmp(Objet1->m_Ref, Objet2->m_Ref); ii = strcmp( Objet1->m_Ref, Objet2->m_Ref );
} }
if( ii == 0 ) if( ii == 0 )
...@@ -917,14 +999,15 @@ const wxString * Text1, *Text2; ...@@ -917,14 +999,15 @@ const wxString * Text1, *Text2;
ii = Objet1->m_Comp->m_Multi - Objet2->m_Comp->m_Multi; ii = Objet1->m_Comp->m_Multi - Objet2->m_Comp->m_Multi;
} }
return( ii ); return ii;
} }
/**********************************************************/ /**********************************************************/
static int ListTriComposantByRef(ListComponent *Objet1, static int ListTriComposantByRef( ListComponent* Objet1,
ListComponent *Objet2) ListComponent* Objet2 )
/**********************************************************/ /**********************************************************/
/* Routine de comparaison pour le tri du Tableau par qsort() /* Routine de comparaison pour le tri du Tableau par qsort()
* Les composants sont tries * Les composants sont tries
* par reference * par reference
...@@ -932,123 +1015,128 @@ static int ListTriComposantByRef(ListComponent *Objet1, ...@@ -932,123 +1015,128 @@ static int ListTriComposantByRef(ListComponent *Objet1,
* si meme valeur: par numero d'unite * si meme valeur: par numero d'unite
*/ */
{ {
int ii; int ii;
const wxString * Text1, *Text2; const wxString* Text1, * Text2;
if( ( Objet1 == NULL ) && ( Objet2 == NULL ) ) if( ( Objet1 == NULL ) && ( Objet2 == NULL ) )
return( 0 ); return 0;
if( Objet1 == NULL ) if( Objet1 == NULL )
return( -1 ); return -1;
if( Objet2 == NULL ) if( Objet2 == NULL )
return( 1 ); return 1;
if( ( Objet1->m_Comp == NULL ) && ( Objet2->m_Comp == NULL ) ) if( ( Objet1->m_Comp == NULL ) && ( Objet2->m_Comp == NULL ) )
return( 0 ); return 0;
if( Objet1->m_Comp == NULL ) if( Objet1->m_Comp == NULL )
return( -1 ); return -1;
if( Objet2->m_Comp == NULL ) if( Objet2->m_Comp == NULL )
return( 1 ); return 1;
ii = strcmp(Objet1->m_Ref, Objet2->m_Ref); ii = strcmp( Objet1->m_Ref, Objet2->m_Ref );
if( ii == 0 ){ if( ii == 0 )
{
Text1 = &( Objet1->m_Comp->m_Field[VALUE].m_Text ); Text1 = &( Objet1->m_Comp->m_Field[VALUE].m_Text );
Text2 = &( Objet2->m_Comp->m_Field[VALUE].m_Text ); Text2 = &( Objet2->m_Comp->m_Field[VALUE].m_Text );
ii = Text1->CmpNoCase(*Text2); ii = Text1->CmpNoCase( *Text2 );
} }
if( ii == 0 ){ if( ii == 0 )
{
ii = Objet1->m_Comp->m_Multi - Objet2->m_Comp->m_Multi; ii = Objet1->m_Comp->m_Multi - Objet2->m_Comp->m_Multi;
} }
return( ii ); return ii;
} }
/******************************************************************/ /******************************************************************/
static int ListTriGLabelByVal(ListLabel *Objet1, ListLabel *Objet2) static int ListTriGLabelByVal( ListLabel* Objet1, ListLabel* Objet2 )
/*******************************************************************/ /*******************************************************************/
/* Routine de comparaison pour le tri du Tableau par qsort() /* Routine de comparaison pour le tri du Tableau par qsort()
* Les labels sont tries * Les labels sont tries
* par comparaison ascii * par comparaison ascii
* si meme valeur: par numero de sheet * si meme valeur: par numero de sheet
*/ */
{ {
int ii; int ii;
const wxString * Text1, *Text2; const wxString* Text1, * Text2;
if( Objet1->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( Objet1->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE )
Text1 = &((DrawSheetLabelStruct *)Objet1->m_Label)->m_Text; Text1 = &( (DrawSheetLabelStruct*) Objet1->m_Label )->m_Text;
else else
Text1 = &((DrawTextStruct *)Objet1->m_Label)->m_Text; Text1 = &( (DrawTextStruct*) Objet1->m_Label )->m_Text;
if( Objet2->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( Objet2->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE )
Text2 = &((DrawSheetLabelStruct *)Objet2->m_Label)->m_Text; Text2 = &( (DrawSheetLabelStruct*) Objet2->m_Label )->m_Text;
else else
Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text; Text2 = &( (DrawTextStruct*) Objet2->m_Label )->m_Text;
ii = Text1->CmpNoCase(*Text2); ii = Text1->CmpNoCase( *Text2 );
if( ii == 0 ) if( ii == 0 )
{ {
ii = strcmp(Objet1->m_SheetPath, Objet2->m_SheetPath); ii = strcmp( Objet1->m_SheetPath, Objet2->m_SheetPath );
} }
return( ii ); return ii;
} }
/*******************************************************************/ /*******************************************************************/
static int ListTriGLabelBySheet(ListLabel *Objet1, ListLabel *Objet2) static int ListTriGLabelBySheet( ListLabel* Objet1, ListLabel* Objet2 )
/*******************************************************************/ /*******************************************************************/
/* Routine de comparaison pour le tri du Tableau par qsort() /* Routine de comparaison pour le tri du Tableau par qsort()
* Les labels sont tries * Les labels sont tries
* par sheet number * par sheet number
* si meme valeur, par ordre alphabetique * si meme valeur, par ordre alphabetique
*/ */
{ {
int ii; int ii;
const wxString * Text1, *Text2; const wxString* Text1, * Text2;
ii = strcmp(Objet1->m_SheetPath, Objet2->m_SheetPath); ii = strcmp( Objet1->m_SheetPath, Objet2->m_SheetPath );
if( ii == 0 ) if( ii == 0 )
{ {
if( Objet1->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( Objet1->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE )
Text1 = &((DrawSheetLabelStruct *)Objet1->m_Label)->m_Text; Text1 = &( (DrawSheetLabelStruct*) Objet1->m_Label )->m_Text;
else else
Text1 = &((DrawTextStruct *)Objet1->m_Label)->m_Text; Text1 = &( (DrawTextStruct*) Objet1->m_Label )->m_Text;
if( Objet2->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( Objet2->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE )
Text2 = &((DrawSheetLabelStruct *)Objet2->m_Label)->m_Text; Text2 = &( (DrawSheetLabelStruct*) Objet2->m_Label )->m_Text;
else else
Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text; Text2 = &( (DrawTextStruct*) Objet2->m_Label )->m_Text;
ii = Text1->CmpNoCase(*Text2); ii = Text1->CmpNoCase( *Text2 );
} }
return( ii ); return ii;
} }
/**************************************************************/ /**************************************************************/
static void DeleteSubCmp( ListComponent * List, int NbItems ) static void DeleteSubCmp( ListComponent* List, int NbItems )
/**************************************************************/ /**************************************************************/
/* Remove sub components from the list, when multiples parts per package are found in this list /* Remove sub components from the list, when multiples parts per package are found in this list
* The component list **MUST** be sorted by reference and by unit number * The component list **MUST** be sorted by reference and by unit number
*/ */
{ {
int ii; int ii;
EDA_SchComponentStruct * LibItem; EDA_SchComponentStruct* LibItem;
wxString OldName, CurrName; wxString OldName, CurrName;
for( ii = 0; ii < NbItems; ii++ ) for( ii = 0; ii < NbItems; ii++ )
{ {
LibItem = List[ii].m_Comp; LibItem = List[ii].m_Comp;
if( LibItem == NULL ) if( LibItem == NULL )
continue; continue;
CurrName = CONV_FROM_UTF8(List[ii].m_Ref); CurrName = CONV_FROM_UTF8( List[ii].m_Ref );
if( !OldName.IsEmpty() ) if( !OldName.IsEmpty() )
{ {
if( OldName == CurrName ) // CurrName is a subpart of OldName: remove it if( OldName == CurrName ) // CurrName is a subpart of OldName: remove it
...@@ -1056,7 +1144,6 @@ wxString OldName, CurrName; ...@@ -1056,7 +1144,6 @@ wxString OldName, CurrName;
List[ii].m_Comp = NULL; List[ii].m_Comp = NULL;
List[ii].m_SheetList.Clear(); List[ii].m_SheetList.Clear();
List[ii].m_Ref[0] = 0; List[ii].m_Ref[0] = 0;
} }
} }
OldName = CurrName; OldName = CurrName;
...@@ -1065,11 +1152,11 @@ wxString OldName, CurrName; ...@@ -1065,11 +1152,11 @@ wxString OldName, CurrName;
/*******************************************************************************************/ /*******************************************************************************************/
void WinEDA_Build_BOM_Frame::PrintFieldData(FILE * f, EDA_SchComponentStruct * DrawLibItem, void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, EDA_SchComponentStruct* DrawLibItem,
bool CompactForm) bool CompactForm )
/*******************************************************************************************/ /*******************************************************************************************/
{ {
wxCheckBox * FieldListCtrl[FIELD8 - FIELD1 + 1] = { wxCheckBox* FieldListCtrl[FIELD8 - FIELD1 + 1] = {
m_AddField1, m_AddField1,
m_AddField2, m_AddField2,
m_AddField3, m_AddField3,
...@@ -1079,51 +1166,49 @@ wxCheckBox * FieldListCtrl[FIELD8 - FIELD1 + 1] = { ...@@ -1079,51 +1166,49 @@ wxCheckBox * FieldListCtrl[FIELD8 - FIELD1 + 1] = {
m_AddField7, m_AddField7,
m_AddField8 m_AddField8
}; };
int ii; int ii;
wxCheckBox * FieldCtrl = FieldListCtrl[0]; wxCheckBox* FieldCtrl = FieldListCtrl[0];
if( CompactForm ) if( CompactForm )
{ {
fprintf(f, "%c%s", s_ExportSeparatorSymbol, fprintf( f, "%c%s", s_ExportSeparatorSymbol,
CONV_TO_UTF8(DrawLibItem->m_Field[FOOTPRINT].m_Text)); CONV_TO_UTF8( DrawLibItem->m_Field[FOOTPRINT].m_Text ) );
} }
for( ii = FIELD1; ii <= FIELD8; ii ++ ) for( ii = FIELD1; ii <= FIELD8; ii++ )
{ {
FieldCtrl = FieldListCtrl[ii - FIELD1]; FieldCtrl = FieldListCtrl[ii - FIELD1];
if( FieldCtrl == NULL ) if( FieldCtrl == NULL )
continue; continue;
if( ! FieldCtrl->IsChecked() ) if( !FieldCtrl->IsChecked() )
continue; continue;
if( CompactForm ) if( CompactForm )
fprintf(f, "%c%s", s_ExportSeparatorSymbol, fprintf( f, "%c%s", s_ExportSeparatorSymbol,
CONV_TO_UTF8(DrawLibItem->m_Field[ii].m_Text)); CONV_TO_UTF8( DrawLibItem->m_Field[ii].m_Text ) );
else else
fprintf(f, "; %-12s", CONV_TO_UTF8(DrawLibItem->m_Field[ii].m_Text)); fprintf( f, "; %-12s", CONV_TO_UTF8( DrawLibItem->m_Field[ii].m_Text ) );
} }
} }
/*********************************************************************************************/ /*********************************************************************************************/
int WinEDA_Build_BOM_Frame::PrintListeCmpByRef( FILE * f, ListComponent * List, int NbItems, int WinEDA_Build_BOM_Frame::PrintListeCmpByRef( FILE* f, ListComponent* List, int NbItems,
bool CompactForm ) bool CompactForm )
/*********************************************************************************************/ /*********************************************************************************************/
/* Print the B.O.M sorted by reference /* Print the B.O.M sorted by reference
*/ */
{ {
int ii, Multi, Unit; int ii, Multi, Unit;
EDA_BaseStruct *DrawList; EDA_BaseStruct* DrawList;
EDA_SchComponentStruct *DrawLibItem; EDA_SchComponentStruct* DrawLibItem;
EDA_LibComponentStruct *Entry; EDA_LibComponentStruct* Entry;
char NameCmp[80]; char NameCmp[80];
wxString msg; wxString msg;
if( CompactForm ) if( CompactForm )
{ {
fprintf( f, "ref%cvalue%csheet path%csheet name%cfootprint", wxCheckBox* FieldListCtrl[FIELD8 - FIELD1 + 1] = {
s_ExportSeparatorSymbol, s_ExportSeparatorSymbol,
s_ExportSeparatorSymbol, s_ExportSeparatorSymbol );
wxCheckBox * FieldListCtrl[FIELD8 - FIELD1 + 1] = {
m_AddField1, m_AddField1,
m_AddField2, m_AddField2,
m_AddField3, m_AddField3,
...@@ -1133,28 +1218,39 @@ wxString msg; ...@@ -1133,28 +1218,39 @@ wxString msg;
m_AddField7, m_AddField7,
m_AddField8 m_AddField8
}; };
for( ii = FIELD1; ii <= FIELD8; ii ++ )
// 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]; wxCheckBox* FieldCtrl = FieldListCtrl[ii - FIELD1];
if( FieldCtrl == NULL ) if( FieldCtrl == NULL )
continue; continue;
if( ! FieldCtrl->IsChecked() ) if( !FieldCtrl->IsChecked() )
continue; continue;
msg = _("Field"); msg = _( "Field" );
fprintf(f, "%c%s%d", s_ExportSeparatorSymbol, CONV_TO_UTF8(msg), ii - FIELD1 + 1); fprintf( f, "%c%s%d", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ), ii - FIELD1 + 1 );
} }
fprintf( f, "\n" ); fprintf( f, "\n" );
} }
else else
{ {
msg = _("\n#Cmp ( order = Reference )"); msg = _( "\n#Cmp ( order = Reference )" );
// if( s_ListWithSubCmponents ) // if( s_ListWithSubCmponents )
if( m_ListSubCmpItems->GetValue() ) if( m_ListSubCmpItems->GetValue() )
msg << _(" (with SubCmp)"); msg << _( " (with SubCmp)" );
fprintf( f, "%s\n", CONV_TO_UTF8(msg) ); fprintf( f, "%s\n", CONV_TO_UTF8( msg ) );
} }
// Print list of items
for( ii = 0; ii < NbItems; ii++ ) for( ii = 0; ii < NbItems; ii++ )
{ {
DrawList = List[ii].m_Comp; DrawList = List[ii].m_Comp;
...@@ -1164,78 +1260,73 @@ wxString msg; ...@@ -1164,78 +1260,73 @@ wxString msg;
if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
continue; continue;
DrawLibItem = (EDA_SchComponentStruct *) DrawList; DrawLibItem = (EDA_SchComponentStruct*) DrawList;
if( List[ii].m_Ref[0] == '#' ) if( List[ii].m_Ref[0] == '#' )
continue; continue;
Multi = 0; Multi = 0;
Unit = ' '; Unit = ' ';
Entry = FindLibPart(DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT); Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry ) if( Entry )
Multi = Entry->m_UnitCount; Multi = Entry->m_UnitCount;
// if( ( Multi > 1 ) && s_ListWithSubCmponents ) // if( ( Multi > 1 ) && s_ListWithSubCmponents )
if( ( Multi > 1 ) && m_ListSubCmpItems->GetValue() ) if( ( Multi > 1 ) && m_ListSubCmpItems->GetValue() )
Unit = DrawLibItem->m_Multi + 'A' - 1; Unit = DrawLibItem->m_Multi + 'A' - 1;
sprintf( NameCmp,"%s", List[ii].m_Ref ); sprintf( NameCmp, "%s", List[ii].m_Ref );
if( ! CompactForm || Unit != ' ' ) if( !CompactForm || Unit != ' ' )
sprintf( NameCmp + strlen(NameCmp), "%c", Unit ); sprintf( NameCmp + strlen( NameCmp ), "%c", Unit );
if( CompactForm ) if( CompactForm )
fprintf(f, "%s%c%s", NameCmp, s_ExportSeparatorSymbol, fprintf( f, "%s%c%s", NameCmp, s_ExportSeparatorSymbol,
CONV_TO_UTF8(DrawLibItem->m_Field[VALUE].m_Text)); CONV_TO_UTF8( DrawLibItem->m_Field[VALUE].m_Text ) );
else else
fprintf(f, "| %-10s %-12s", NameCmp, fprintf( f, "| %-10s %-12s", NameCmp,
CONV_TO_UTF8(DrawLibItem->m_Field[VALUE].m_Text)); CONV_TO_UTF8( DrawLibItem->m_Field[VALUE].m_Text ) );
// if( s_ListWithSubCmponents ) // if( s_ListWithSubCmponents )
if( m_ListSubCmpItems->GetValue() ) if( m_ListSubCmpItems->GetValue() )
{ {
SCH_SCREEN * screen = (SCH_SCREEN *)(DrawLibItem->m_Parent); msg = List[ii].m_SheetList.PathHumanReadable();
wxString sheetname;
if( screen && screen->Type() == SCREEN_STRUCT_TYPE )
sheetname = screen->m_FileName;
else
sheetname = _("?");
if( CompactForm ) if( CompactForm )
fprintf(f, "%c%s;%s", s_ExportSeparatorSymbol, fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) );
CONV_TO_UTF8(List[ii].m_SheetList.Path()),
CONV_TO_UTF8(sheetname));
else else
fprintf(f, " (Sheet %s: \"%s\")", fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
CONV_TO_UTF8(List[ii].m_SheetList.Path()),
CONV_TO_UTF8(sheetname));
} }
PrintFieldData(f, DrawLibItem, CompactForm); PrintFieldData( f, DrawLibItem, CompactForm );
fprintf(f, "\n"); fprintf( f, "\n" );
} }
if( ! CompactForm )
if( !CompactForm )
{ {
msg = _("#End Cmp\n"); msg = _( "#End Cmp\n" );
fprintf(f, CONV_TO_UTF8(msg)); fprintf( f, CONV_TO_UTF8( msg ) );
} }
return( 0 ); return 0;
} }
/*********************************************************************************************/ /*********************************************************************************************/
int WinEDA_Build_BOM_Frame::PrintListeCmpByVal( FILE * f, ListComponent * List, int NbItems ) int WinEDA_Build_BOM_Frame::PrintListeCmpByVal( FILE* f, ListComponent* List, int NbItems )
/**********************************************************************************************/ /**********************************************************************************************/
{ {
int ii, Multi; int ii, Multi;
wxChar Unit; wxChar Unit;
EDA_BaseStruct *DrawList; EDA_BaseStruct* DrawList;
EDA_SchComponentStruct *DrawLibItem; EDA_SchComponentStruct* DrawLibItem;
EDA_LibComponentStruct *Entry; EDA_LibComponentStruct* Entry;
wxString msg; wxString msg;
msg = _("\n#Cmp ( order = Value )"); msg = _( "\n#Cmp ( order = Value )" );
// if( s_ListWithSubCmponents ) // if( s_ListWithSubCmponents )
if( m_ListSubCmpItems->GetValue() ) if( m_ListSubCmpItems->GetValue() )
msg << _(" (with SubCmp)"); msg << _( " (with SubCmp)" );
msg << wxT("\n"); msg << wxT( "\n" );
fprintf(f, CONV_TO_UTF8(msg)); fprintf( f, CONV_TO_UTF8( msg ) );
for( ii = 0; ii < NbItems; ii++ ) for( ii = 0; ii < NbItems; ii++ )
{ {
...@@ -1246,91 +1337,96 @@ wxString msg; ...@@ -1246,91 +1337,96 @@ wxString msg;
if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
continue; continue;
DrawLibItem = (EDA_SchComponentStruct *) DrawList; DrawLibItem = (EDA_SchComponentStruct*) DrawList;
if( List[ii].m_Ref[0] == '#' ) if( List[ii].m_Ref[0] == '#' )
continue; continue;
Multi = 0; Multi = 0;
Unit = ' '; Unit = ' ';
Entry = FindLibPart(DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT); Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry ) if( Entry )
Multi = Entry->m_UnitCount; Multi = Entry->m_UnitCount;
// if( ( Multi > 1 ) && s_ListWithSubCmponents ) // if( ( Multi > 1 ) && s_ListWithSubCmponents )
if( ( Multi > 1 ) && m_ListSubCmpItems->GetValue() ){ if( ( Multi > 1 ) && m_ListSubCmpItems->GetValue() )
{
Unit = DrawLibItem->m_Multi + 'A' - 1; Unit = DrawLibItem->m_Multi + 'A' - 1;
} }
fprintf( f, "| %-12s %-10s%c", fprintf( f, "| %-12s %-10s%c",
CONV_TO_UTF8(DrawLibItem->m_Field[VALUE].m_Text), CONV_TO_UTF8( DrawLibItem->m_Field[VALUE].m_Text ),
List[ii].m_Ref, Unit); List[ii].m_Ref, Unit );
// if( s_ListWithSubCmponents ) // if( s_ListWithSubCmponents )
// print the sheet path
if( m_ListSubCmpItems->GetValue() ) if( m_ListSubCmpItems->GetValue() )
{ {
fprintf(f, " (Sheet %s)", CONV_TO_UTF8(List[ii].m_SheetList.Path()) ); msg = List[ii].m_SheetList.PathHumanReadable();
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
} }
PrintFieldData(f, DrawLibItem); PrintFieldData( f, DrawLibItem );
fprintf(f, "\n"); fprintf( f, "\n" );
} }
msg = _("#End Cmp\n");
fprintf(f, CONV_TO_UTF8(msg)); msg = _( "#End Cmp\n" );
return( 0 ); fprintf( f, CONV_TO_UTF8( msg ) );
return 0;
} }
/******************************************************************/ /******************************************************************/
static int PrintListeGLabel( FILE *f, ListLabel *List, int NbItems) static int PrintListeGLabel( FILE* f, ListLabel* List, int NbItems )
/******************************************************************/ /******************************************************************/
{ {
int ii, jj; int ii, jj;
DrawLabelStruct *DrawTextItem; DrawLabelStruct* DrawTextItem;
DrawSheetLabelStruct * DrawSheetLabel; DrawSheetLabelStruct* DrawSheetLabel;
ListLabel * LabelItem; ListLabel* LabelItem;
wxString msg; wxString msg;
char str[64]; char str[64];
for( ii = 0; ii < NbItems; ii++ ) for( ii = 0; ii < NbItems; ii++ )
{ {
LabelItem = & List[ii]; LabelItem = &List[ii];
switch( LabelItem->m_LabelType ) switch( LabelItem->m_LabelType )
{ {
case DRAW_HIER_LABEL_STRUCT_TYPE: case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
DrawTextItem = (DrawLabelStruct *)(LabelItem->m_Label); DrawTextItem = (DrawLabelStruct*) (LabelItem->m_Label);
if(LabelItem->m_LabelType == DRAW_HIER_LABEL_STRUCT_TYPE) if( LabelItem->m_LabelType == DRAW_HIER_LABEL_STRUCT_TYPE )
strncpy(str, "Hierarchal", sizeof(str)); strncpy( str, "Hierarchical", sizeof(str) );
else else
strncpy(str, "Global ", sizeof(str)); strncpy( str, "Global ", sizeof(str) );
msg.Printf( msg.Printf(
_("> %-28.28s %s (Sheet %s) pos: %3.3f, %3.3f\n"), _( "> %-28.28s %s (Sheet %s) pos: %3.3f, %3.3f\n" ),
DrawTextItem->m_Text.GetData(), DrawTextItem->m_Text.GetData(),
str, str,
LabelItem->m_SheetPath, LabelItem->m_SheetPath,
(float)DrawTextItem->m_Pos.x / 1000, (float) DrawTextItem->m_Pos.x / 1000,
(float)DrawTextItem->m_Pos.y / 1000); (float) DrawTextItem->m_Pos.y / 1000 );
fprintf(f, CONV_TO_UTF8(msg)); fprintf( f, CONV_TO_UTF8( msg ) );
break; break;
case DRAW_SHEETLABEL_STRUCT_TYPE : case DRAW_SHEETLABEL_STRUCT_TYPE:
{ {
DrawSheetLabel = (DrawSheetLabelStruct *) LabelItem->m_Label; DrawSheetLabel = (DrawSheetLabelStruct*) LabelItem->m_Label;
jj = DrawSheetLabel->m_Shape; jj = DrawSheetLabel->m_Shape;
if( jj < 0 ) if( jj < 0 )
jj = NET_TMAX; jj = NET_TMAX;
if( jj > NET_TMAX ) if( jj > NET_TMAX )
jj = 4; jj = 4;
wxString labtype = CONV_FROM_UTF8(SheetLabelType[jj]); wxString labtype = CONV_FROM_UTF8( SheetLabelType[jj] );
msg.Printf( msg.Printf(
_("> %-28.28s Sheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n"), _( "> %-28.28s Sheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n" ),
DrawSheetLabel->m_Text.GetData(), DrawSheetLabel->m_Text.GetData(),
labtype.GetData(), labtype.GetData(),
LabelItem->m_SheetPath, LabelItem->m_SheetPath,
(float)DrawSheetLabel->m_Pos.x / 1000, (float) DrawSheetLabel->m_Pos.x / 1000,
(float)DrawSheetLabel->m_Pos.y / 1000); (float) DrawSheetLabel->m_Pos.y / 1000 );
fprintf(f, CONV_TO_UTF8(msg)); fprintf( f, CONV_TO_UTF8( msg ) );
} }
break; break;
...@@ -1338,7 +1434,8 @@ static int PrintListeGLabel( FILE *f, ListLabel *List, int NbItems) ...@@ -1338,7 +1434,8 @@ static int PrintListeGLabel( FILE *f, ListLabel *List, int NbItems)
break; break;
} }
} }
msg = _("#End labels\n");
fprintf(f, CONV_TO_UTF8(msg)); msg = _( "#End labels\n" );
return( 0 ); fprintf( f, CONV_TO_UTF8( msg ) );
return 0;
} }
...@@ -95,7 +95,7 @@ typedef struct ListLabel ...@@ -95,7 +95,7 @@ typedef struct ListLabel
{ {
int m_LabelType; int m_LabelType;
void * m_Label; void * m_Label;
char m_SheetPath[32]; char m_SheetPath[64];
} ListLabel; } ListLabel;
typedef struct ListComponent typedef struct ListComponent
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment