|
|
|
@ -102,7 +102,8 @@ static bool * s_AddFieldList[] = { |
|
|
|
#define OPTION_BOM_ADD_FIELD wxT("BomAddField")
|
|
|
|
|
|
|
|
/* 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_ExportSeparatorSymbol; |
|
|
|
/*!
|
|
|
|
@ -118,13 +119,15 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_Build_BOM_Frame, wxDialog ) |
|
|
|
BEGIN_EVENT_TABLE( WinEDA_Build_BOM_Frame, wxDialog ) |
|
|
|
|
|
|
|
////@begin WinEDA_Build_BOM_Frame event table entries
|
|
|
|
EVT_CLOSE( WinEDA_Build_BOM_Frame::OnCloseWindow ) |
|
|
|
|
|
|
|
EVT_RADIOBOX( ID_RADIOBOX_SELECT_FORMAT, WinEDA_Build_BOM_Frame::OnRadioboxSelectFormatSelected ) |
|
|
|
|
|
|
|
EVT_BUTTON( ID_CREATE_LIST, WinEDA_Build_BOM_Frame::OnCreateListClick ) |
|
|
|
|
|
|
|
EVT_BUTTON( wxID_OK, WinEDA_Build_BOM_Frame::OnOkClick ) |
|
|
|
|
|
|
|
EVT_BUTTON( wxID_EXIT, WinEDA_Build_BOM_Frame::OnExitClick ) |
|
|
|
EVT_BUTTON( wxID_CANCEL, WinEDA_Build_BOM_Frame::OnCancelClick ) |
|
|
|
|
|
|
|
EVT_BUTTON( wxID_APPLY, WinEDA_Build_BOM_Frame::OnApplyClick ) |
|
|
|
|
|
|
|
////@end WinEDA_Build_BOM_Frame event table entries
|
|
|
|
|
|
|
|
@ -135,16 +138,15 @@ void InstallToolsFrame(WinEDA_DrawFrame *parent, wxPoint & pos) |
|
|
|
/***************************************************************/ |
|
|
|
{ |
|
|
|
WinEDA_Build_BOM_Frame * frame = new WinEDA_Build_BOM_Frame(parent); |
|
|
|
frame->ShowModal(); frame->Destroy(); |
|
|
|
frame->ShowModal(); |
|
|
|
frame->Destroy(); |
|
|
|
} |
|
|
|
|
|
|
|
/*!
|
|
|
|
* 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, |
|
|
|
wxWindowID id, const wxString& caption, const wxPoint& pos, |
|
|
|
@ -158,8 +160,10 @@ WinEDA_Build_BOM_Frame::WinEDA_Build_BOM_Frame( WinEDA_DrawFrame* parent, |
|
|
|
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++ ) |
|
|
|
{ |
|
|
|
if ( (addfields & bitmask) ) * s_AddFieldList[ii] = true; |
|
|
|
else * s_AddFieldList[ii] = false; |
|
|
|
if( (addfields & bitmask) ) |
|
|
|
* s_AddFieldList[ii] = true; |
|
|
|
else |
|
|
|
* s_AddFieldList[ii] = false; |
|
|
|
|
|
|
|
bitmask <<= 1; |
|
|
|
} |
|
|
|
@ -172,7 +176,6 @@ WinEDA_Build_BOM_Frame::WinEDA_Build_BOM_Frame( WinEDA_DrawFrame* parent, |
|
|
|
m_OutputSeparatorCtrl->Enable(true); |
|
|
|
else |
|
|
|
m_OutputSeparatorCtrl->Enable(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/*!
|
|
|
|
@ -224,7 +227,7 @@ void WinEDA_Build_BOM_Frame::CreateControls() |
|
|
|
SetFont(*g_DialogFont); |
|
|
|
|
|
|
|
////@begin WinEDA_Build_BOM_Frame content construction
|
|
|
|
// Generated by DialogBlocks, 01/07/2007 21:25:39 (unregistered)
|
|
|
|
// Generated by DialogBlocks, 13/10/2007 00:04:07 (unregistered)
|
|
|
|
|
|
|
|
WinEDA_Build_BOM_Frame* itemDialog1 = this; |
|
|
|
|
|
|
|
@ -232,32 +235,32 @@ void WinEDA_Build_BOM_Frame::CreateControls() |
|
|
|
itemDialog1->SetSizer(itemBoxSizer2); |
|
|
|
|
|
|
|
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); |
|
|
|
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); |
|
|
|
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT, 5); |
|
|
|
|
|
|
|
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL); |
|
|
|
itemBoxSizer3->Add(itemBoxSizer4, 0, wxGROW|wxRIGHT|wxTOP|wxBOTTOM, 5); |
|
|
|
itemBoxSizer3->Add(itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); |
|
|
|
|
|
|
|
wxStaticBox* itemStaticBoxSizer5Static = new wxStaticBox(itemDialog1, wxID_ANY, _("List items:")); |
|
|
|
wxStaticBoxSizer* itemStaticBoxSizer5 = new wxStaticBoxSizer(itemStaticBoxSizer5Static, wxVERTICAL); |
|
|
|
itemBoxSizer4->Add(itemStaticBoxSizer5, 0, wxGROW|wxALL, 5); |
|
|
|
|
|
|
|
m_ListCmpbyRefItems = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Components by Reference"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); |
|
|
|
m_ListCmpbyRefItems = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Components by Reference"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); |
|
|
|
m_ListCmpbyRefItems->SetValue(true); |
|
|
|
itemStaticBoxSizer5->Add(m_ListCmpbyRefItems, 0, wxALIGN_LEFT|wxALL, 5); |
|
|
|
|
|
|
|
m_ListSubCmpItems = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _("Sub Components (i.e U2A, U2B..)"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); |
|
|
|
m_ListSubCmpItems = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _("Sub Components (i.e. U2A, U2B ...)"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); |
|
|
|
m_ListSubCmpItems->SetValue(false); |
|
|
|
itemStaticBoxSizer5->Add(m_ListSubCmpItems, 0, wxALIGN_LEFT|wxALL, 5); |
|
|
|
|
|
|
|
m_ListCmpbyValItems = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Components by Value"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); |
|
|
|
m_ListCmpbyValItems = new wxCheckBox( itemDialog1, ID_CHECKBOX3, _("Components by Value"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); |
|
|
|
m_ListCmpbyValItems->SetValue(true); |
|
|
|
itemStaticBoxSizer5->Add(m_ListCmpbyValItems, 0, wxALIGN_LEFT|wxALL, 5); |
|
|
|
|
|
|
|
m_GenListLabelsbyVal = new wxCheckBox( itemDialog1, ID_CHECKBOX3, _("Hierachy Pins by name"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); |
|
|
|
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_CHECKBOX4, _("Hierachy Pins by Sheets"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); |
|
|
|
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); |
|
|
|
|
|
|
|
@ -276,66 +279,73 @@ void WinEDA_Build_BOM_Frame::CreateControls() |
|
|
|
m_OutputSeparatorCtrl->SetSelection(0); |
|
|
|
itemBoxSizer4->Add(m_OutputSeparatorCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); |
|
|
|
|
|
|
|
wxStaticBox* itemStaticBoxSizer13Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options")); |
|
|
|
wxStaticBox* itemStaticBoxSizer13Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options:")); |
|
|
|
wxStaticBoxSizer* itemStaticBoxSizer13 = new wxStaticBoxSizer(itemStaticBoxSizer13Static, wxHORIZONTAL); |
|
|
|
itemBoxSizer4->Add(itemStaticBoxSizer13, 0, wxGROW|wxALL, 5); |
|
|
|
|
|
|
|
m_GetListBrowser = new wxCheckBox( itemDialog1, ID_CHECKBOX6, _("Launch list browser"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); |
|
|
|
m_GetListBrowser->SetValue(false); |
|
|
|
itemStaticBoxSizer13->Add(m_GetListBrowser, 0, wxGROW|wxALL, 5); |
|
|
|
itemStaticBoxSizer13->Add(m_GetListBrowser, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); |
|
|
|
|
|
|
|
wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxVERTICAL); |
|
|
|
itemBoxSizer3->Add(itemBoxSizer15, 0, 0, 0); |
|
|
|
itemBoxSizer3->Add(itemBoxSizer15, 0, wxALIGN_TOP|wxLEFT|wxTOP|wxBOTTOM, 5); |
|
|
|
|
|
|
|
wxStaticBox* itemStaticBoxSizer16Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Fields to Add")); |
|
|
|
wxStaticBox* itemStaticBoxSizer16Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Fields to add:")); |
|
|
|
m_FieldsToAppendListSizer = new wxStaticBoxSizer(itemStaticBoxSizer16Static, wxVERTICAL); |
|
|
|
itemBoxSizer15->Add(m_FieldsToAppendListSizer, 0, wxGROW|wxALL, 5); |
|
|
|
itemBoxSizer15->Add(m_FieldsToAppendListSizer, 0, wxALIGN_LEFT|wxALL, 5); |
|
|
|
|
|
|
|
m_AddField1 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD1, _("Add Field 1"), wxDefaultPosition, wxDefaultSize, 0 ); |
|
|
|
m_AddField1 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD1, _("Add Field 1"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); |
|
|
|
m_AddField1->SetValue(false); |
|
|
|
m_FieldsToAppendListSizer->Add(m_AddField1, 0, wxGROW|wxALL, 5); |
|
|
|
m_FieldsToAppendListSizer->Add(m_AddField1, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); |
|
|
|
|
|
|
|
m_AddField2 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD2, _("Add Field 2"), wxDefaultPosition, wxDefaultSize, 0 ); |
|
|
|
m_AddField2 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD2, _("Add Field 2"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); |
|
|
|
m_AddField2->SetValue(false); |
|
|
|
m_FieldsToAppendListSizer->Add(m_AddField2, 0, wxGROW|wxALL, 5); |
|
|
|
m_FieldsToAppendListSizer->Add(m_AddField2, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); |
|
|
|
|
|
|
|
m_AddField3 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD1, _("Add Field 3"), wxDefaultPosition, wxDefaultSize, 0 ); |
|
|
|
m_AddField3 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD3, _("Add Field 3"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); |
|
|
|
m_AddField3->SetValue(false); |
|
|
|
m_FieldsToAppendListSizer->Add(m_AddField3, 0, wxGROW|wxALL, 5); |
|
|
|
m_FieldsToAppendListSizer->Add(m_AddField3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); |
|
|
|
|
|
|
|
m_AddField4 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD4, _("Add Field 4"), wxDefaultPosition, wxDefaultSize, 0 ); |
|
|
|
m_AddField4 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD4, _("Add Field 4"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); |
|
|
|
m_AddField4->SetValue(false); |
|
|
|
m_FieldsToAppendListSizer->Add(m_AddField4, 0, wxGROW|wxALL, 5); |
|
|
|
m_FieldsToAppendListSizer->Add(m_AddField4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); |
|
|
|
|
|
|
|
m_AddField5 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD5, _("Add Field 5"), wxDefaultPosition, wxDefaultSize, 0 ); |
|
|
|
m_AddField5 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD5, _("Add Field 5"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); |
|
|
|
m_AddField5->SetValue(false); |
|
|
|
m_FieldsToAppendListSizer->Add(m_AddField5, 0, wxGROW|wxALL, 5); |
|
|
|
m_FieldsToAppendListSizer->Add(m_AddField5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); |
|
|
|
|
|
|
|
m_AddField6 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD6, _("Add Field 6"), wxDefaultPosition, wxDefaultSize, 0 ); |
|
|
|
m_AddField6 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD6, _("Add Field 6"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); |
|
|
|
m_AddField6->SetValue(false); |
|
|
|
m_FieldsToAppendListSizer->Add(m_AddField6, 0, wxGROW|wxALL, 5); |
|
|
|
m_FieldsToAppendListSizer->Add(m_AddField6, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); |
|
|
|
|
|
|
|
m_AddField7 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD7, _("Add Field 7"), wxDefaultPosition, wxDefaultSize, 0 ); |
|
|
|
m_AddField7 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD7, _("Add Field 7"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); |
|
|
|
m_AddField7->SetValue(false); |
|
|
|
m_FieldsToAppendListSizer->Add(m_AddField7, 0, wxGROW|wxALL, 5); |
|
|
|
m_FieldsToAppendListSizer->Add(m_AddField7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); |
|
|
|
|
|
|
|
m_AddField8 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD8, _("Add Field 8"), wxDefaultPosition, wxDefaultSize, 0 ); |
|
|
|
m_AddField8 = new wxCheckBox( itemDialog1, ID_CHECKBOX_FIELD8, _("Add Field 8"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); |
|
|
|
m_AddField8->SetValue(false); |
|
|
|
m_FieldsToAppendListSizer->Add(m_AddField8, 0, wxGROW|wxALL, 5); |
|
|
|
m_FieldsToAppendListSizer->Add(m_AddField8, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); |
|
|
|
|
|
|
|
itemBoxSizer15->Add(5, 5, 0, wxGROW|wxALL, 10); |
|
|
|
|
|
|
|
itemBoxSizer15->Add(5, 5, 0, wxGROW|wxALL, 15); |
|
|
|
wxButton* itemButton26 = new wxButton( itemDialog1, ID_CREATE_LIST, _("Create &List"), wxDefaultPosition, wxDefaultSize, 0 ); |
|
|
|
itemButton26->SetDefault(); |
|
|
|
itemButton26->SetForegroundColour(wxColour(166, 0, 0)); |
|
|
|
itemBoxSizer15->Add(itemButton26, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); |
|
|
|
|
|
|
|
wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxVERTICAL); |
|
|
|
itemBoxSizer15->Add(itemBoxSizer26, 0, wxGROW|wxALL, 5); |
|
|
|
wxBoxSizer* itemBoxSizer27 = new wxBoxSizer(wxHORIZONTAL); |
|
|
|
itemBoxSizer2->Add(itemBoxSizer27, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5); |
|
|
|
|
|
|
|
wxButton* itemButton27 = new wxButton( itemDialog1, wxID_OK, _("&Create List"), wxDefaultPosition, wxDefaultSize, 0 ); |
|
|
|
itemButton27->SetDefault(); |
|
|
|
itemButton27->SetForegroundColour(wxColour(166, 0, 0)); |
|
|
|
itemBoxSizer26->Add(itemButton27, 0, wxGROW|wxALL, 5); |
|
|
|
wxButton* itemButton28 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); |
|
|
|
itemButton28->SetForegroundColour(wxColour(255, 0, 0)); |
|
|
|
itemBoxSizer27->Add(itemButton28, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); |
|
|
|
|
|
|
|
wxButton* itemButton28 = new wxButton( itemDialog1, wxID_EXIT, _("&Quit"), wxDefaultPosition, wxDefaultSize, 0 ); |
|
|
|
itemButton28->SetForegroundColour(wxColour(0, 0, 210)); |
|
|
|
itemBoxSizer26->Add(itemButton28, 0, wxGROW|wxALL, 5); |
|
|
|
wxButton* itemButton29 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); |
|
|
|
itemButton29->SetForegroundColour(wxColour(0, 0, 255)); |
|
|
|
itemBoxSizer27->Add(itemButton29, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); |
|
|
|
|
|
|
|
wxButton* itemButton30 = new wxButton( itemDialog1, wxID_APPLY, _("&Apply"), wxDefaultPosition, wxDefaultSize, 0 ); |
|
|
|
itemBoxSizer27->Add(itemButton30, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); |
|
|
|
|
|
|
|
// Set validators
|
|
|
|
m_ListCmpbyRefItems->SetValidator( wxGenericValidator(& s_ListByRef) ); |
|
|
|
@ -391,48 +401,153 @@ wxIcon WinEDA_Build_BOM_Frame::GetIconResource( const wxString& name ) |
|
|
|
return wxNullIcon; |
|
|
|
////@end WinEDA_Build_BOM_Frame icon retrieval
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK |
|
|
|
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX_SELECT_FORMAT |
|
|
|
*/ |
|
|
|
|
|
|
|
void WinEDA_Build_BOM_Frame::OnOkClick( wxCommandEvent& event ) |
|
|
|
void WinEDA_Build_BOM_Frame::OnRadioboxSelectFormatSelected( wxCommandEvent& event ) |
|
|
|
{ |
|
|
|
if( m_OutputFormCtrl->GetSelection() == 1 ) |
|
|
|
m_OutputSeparatorCtrl->Enable(true); |
|
|
|
else |
|
|
|
m_OutputSeparatorCtrl->Enable(false); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CREATE_LIST |
|
|
|
*/ |
|
|
|
|
|
|
|
void WinEDA_Build_BOM_Frame::OnCreateListClick( wxCommandEvent& event ) |
|
|
|
{ |
|
|
|
GenList(); |
|
|
|
event.Skip(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_EXIT |
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK |
|
|
|
*/ |
|
|
|
|
|
|
|
void WinEDA_Build_BOM_Frame::OnExitClick( wxCommandEvent& event ) |
|
|
|
void WinEDA_Build_BOM_Frame::OnOkClick( wxCommandEvent& event ) |
|
|
|
{ |
|
|
|
SavePreferences(); |
|
|
|
EndModal( 0 ); |
|
|
|
} |
|
|
|
|
|
|
|
/**********************************************************/ |
|
|
|
void WinEDA_Build_BOM_Frame::GenList() |
|
|
|
/**********************************************************/ |
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL |
|
|
|
*/ |
|
|
|
|
|
|
|
void WinEDA_Build_BOM_Frame::OnCancelClick( wxCommandEvent& event ) |
|
|
|
{ |
|
|
|
#define EXT_LIST wxT(".lst")
|
|
|
|
wxString mask, filename; |
|
|
|
EndModal( -1 ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_APPLY |
|
|
|
*/ |
|
|
|
|
|
|
|
void WinEDA_Build_BOM_Frame::OnApplyClick( wxCommandEvent& event ) |
|
|
|
{ |
|
|
|
SavePreferences(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**************************************************/ |
|
|
|
void WinEDA_Build_BOM_Frame::SavePreferences() |
|
|
|
/**************************************************/ |
|
|
|
{ |
|
|
|
// Determine current settings of "List items" and "Options" checkboxes
|
|
|
|
// (NOTE: These 6 settings are restored when the dialog box is next
|
|
|
|
// invoked, but are *not* still saved after EESchema is next shut down.)
|
|
|
|
s_ListByRef = m_ListCmpbyRefItems->GetValue(); |
|
|
|
s_ListByValue = m_ListCmpbyValItems->GetValue(); |
|
|
|
s_ListWithSubCmponents = m_ListSubCmpItems->GetValue(); |
|
|
|
s_ListByValue = m_ListCmpbyValItems->GetValue(); |
|
|
|
s_ListHierarchicalPinByName = m_GenListLabelsbyVal->GetValue(); |
|
|
|
s_ListBySheet = m_GenListLabelsbySheet->GetValue(); |
|
|
|
s_BrowsList = m_GetListBrowser->GetValue(); |
|
|
|
|
|
|
|
// Determine current settings of both radiobutton groups
|
|
|
|
s_OutputFormOpt = m_OutputFormCtrl->GetSelection(); |
|
|
|
s_OutputSeparatorOpt = m_OutputSeparatorCtrl->GetSelection(); |
|
|
|
if ( s_OutputSeparatorOpt < 0 ) s_OutputSeparatorOpt = 0; |
|
|
|
s_ExportSeparatorSymbol = s_ExportSeparator[s_OutputSeparatorOpt]; |
|
|
|
if( s_OutputSeparatorOpt < 0 ) |
|
|
|
s_OutputSeparatorOpt = 0; |
|
|
|
|
|
|
|
// Determine current settings of all 8 "Fields to add" checkboxes
|
|
|
|
s_Add_F1_state = m_AddField1->GetValue(); |
|
|
|
s_Add_F2_state = m_AddField2->GetValue(); |
|
|
|
s_Add_F3_state = m_AddField3->GetValue(); |
|
|
|
s_Add_F4_state = m_AddField4->GetValue(); |
|
|
|
s_Add_F5_state = m_AddField5->GetValue(); |
|
|
|
s_Add_F6_state = m_AddField6->GetValue(); |
|
|
|
s_Add_F7_state = m_AddField7->GetValue(); |
|
|
|
s_Add_F8_state = m_AddField8->GetValue(); |
|
|
|
|
|
|
|
// 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_SEPARATOR, (long) s_OutputSeparatorOpt); |
|
|
|
|
|
|
|
// Now save current settings of all 8 "Fields to add" checkboxes
|
|
|
|
long addfields = 0; |
|
|
|
for( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ ) |
|
|
|
{ |
|
|
|
if( * s_AddFieldList[ii] ) |
|
|
|
addfields |= bitmask; |
|
|
|
bitmask <<= 1; |
|
|
|
} |
|
|
|
m_Parent->m_Parent->m_EDA_Config->Write(OPTION_BOM_ADD_FIELD, addfields); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************/ |
|
|
|
void WinEDA_Build_BOM_Frame::GenList() |
|
|
|
/**********************************************************/ |
|
|
|
{ |
|
|
|
#define EXT_LIST wxT(".lst")
|
|
|
|
wxString mask, filename; |
|
|
|
|
|
|
|
// Although the currently selected options determine the contents
|
|
|
|
// and format of the subsequently generated file, they are still
|
|
|
|
// *not* "restored" if the dialog box is ever subsequently invoked
|
|
|
|
// again (unless those options had been specifically "saved" before
|
|
|
|
// now (by clicking on either of the "OK" or "Apply" buttons)).
|
|
|
|
//
|
|
|
|
// Hence the following previously provided commands are now
|
|
|
|
// commented out, and the currently selected options are now
|
|
|
|
// read "directly" by the relevant functions instead. (The previous
|
|
|
|
// behavior of the dialog box in this regard had been inconsistent,
|
|
|
|
// in that the settings of the "Fields to add" checkboxes were *not*
|
|
|
|
// "restored", whereas all of the other settings *were* "restored";
|
|
|
|
// now, *none* of those settings are subsequently "restored".)
|
|
|
|
|
|
|
|
// s_ListByRef = m_ListCmpbyRefItems->GetValue();
|
|
|
|
// s_ListWithSubCmponents = m_ListSubCmpItems->GetValue();
|
|
|
|
// s_ListByValue = m_ListCmpbyValItems->GetValue();
|
|
|
|
// s_ListHierarchicalPinByName = m_GenListLabelsbyVal->GetValue();
|
|
|
|
// s_ListBySheet = m_GenListLabelsbySheet->GetValue();
|
|
|
|
// s_BrowsList = m_GetListBrowser->GetValue();
|
|
|
|
// s_OutputFormOpt = m_OutputFormCtrl->GetSelection();
|
|
|
|
|
|
|
|
// s_OutputSeparatorOpt = m_OutputSeparatorCtrl->GetSelection();
|
|
|
|
// if( s_OutputSeparatorOpt < 0 )
|
|
|
|
// s_OutputSeparatorOpt = 0;
|
|
|
|
// s_ExportSeparatorSymbol = s_ExportSeparator[s_OutputSeparatorOpt];
|
|
|
|
|
|
|
|
// Updated code for determining the value of s_ExportSeparatorSymbol
|
|
|
|
if( m_OutputSeparatorCtrl->GetSelection() > 0 ) |
|
|
|
s_ExportSeparatorSymbol |
|
|
|
= s_ExportSeparator[m_OutputSeparatorCtrl->GetSelection()]; |
|
|
|
else |
|
|
|
s_ExportSeparatorSymbol = s_ExportSeparator[0]; |
|
|
|
|
|
|
|
m_ListFileName = ScreenSch->m_FileName; |
|
|
|
ChangeFileNameExt(m_ListFileName, EXT_LIST); |
|
|
|
mask = wxT("*"); mask += EXT_LIST; |
|
|
|
mask = wxT("*"); |
|
|
|
mask += EXT_LIST; |
|
|
|
|
|
|
|
filename = EDA_FileSelector(_("Bill of material:"), |
|
|
|
wxEmptyString, /* Chemin par defaut (ici dir courante) */ |
|
|
|
@ -443,16 +558,22 @@ wxString mask, filename; |
|
|
|
wxFD_SAVE, |
|
|
|
TRUE |
|
|
|
); |
|
|
|
if ( filename.IsEmpty() ) return; |
|
|
|
else m_ListFileName = filename; |
|
|
|
if( filename.IsEmpty() ) |
|
|
|
return; |
|
|
|
else |
|
|
|
m_ListFileName = filename; |
|
|
|
|
|
|
|
/* Close dialog and show the list, if wanted */ |
|
|
|
if ( s_OutputFormOpt == 0) GenereListeOfItems(m_ListFileName); |
|
|
|
else CreateExportList(m_ListFileName); |
|
|
|
/* Close dialog, then show the list (if so requested) */ |
|
|
|
// if( s_OutputFormOpt == 0 )
|
|
|
|
if( m_OutputFormCtrl->GetSelection() == 0 ) |
|
|
|
GenereListeOfItems(m_ListFileName); |
|
|
|
else |
|
|
|
CreateExportList(m_ListFileName); |
|
|
|
|
|
|
|
Close(); |
|
|
|
EndModal( 1 ); |
|
|
|
|
|
|
|
if ( s_BrowsList ) |
|
|
|
// if( s_BrowsList )
|
|
|
|
if( m_GetListBrowser->GetValue() ) |
|
|
|
{ |
|
|
|
wxString editorname = GetEditorName(); |
|
|
|
AddDelimiterString(filename); |
|
|
|
@ -465,9 +586,9 @@ wxString mask, filename; |
|
|
|
void WinEDA_Build_BOM_Frame::CreateExportList(const wxString & FullFileName) |
|
|
|
/****************************************************************************/ |
|
|
|
/*
|
|
|
|
Print a list of components, in a form which can be imported by a spreadsheet |
|
|
|
form is; |
|
|
|
cmp name;cmp val; fields; |
|
|
|
* Print a list of components, in a form which can be imported by a spreadsheet |
|
|
|
* form is: |
|
|
|
* cmp name; cmp val; fields; |
|
|
|
*/ |
|
|
|
{ |
|
|
|
FILE *f; |
|
|
|
@ -478,7 +599,8 @@ wxString msg; |
|
|
|
/* Creation de la liste des elements */ |
|
|
|
if( ( f = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL ) |
|
|
|
{ |
|
|
|
msg = _("Failed to open file "); msg << FullFileName; |
|
|
|
msg = _("Failed to open file "); |
|
|
|
msg << FullFileName; |
|
|
|
DisplayError(this, msg); |
|
|
|
return; |
|
|
|
} |
|
|
|
@ -490,7 +612,8 @@ wxString msg; |
|
|
|
MyZMalloc( NbItems * sizeof(EDA_BaseStruct **) ); |
|
|
|
if( List == NULL ) |
|
|
|
{ |
|
|
|
fclose(f); return; |
|
|
|
fclose( f ); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
GenListeCmp( List ); |
|
|
|
@ -499,7 +622,9 @@ wxString msg; |
|
|
|
qsort( List, NbItems, sizeof( EDA_BaseStruct * ), |
|
|
|
(int(*)(const void*, const void*))ListTriComposantByRef ); |
|
|
|
|
|
|
|
if( ! s_ListWithSubCmponents ) DeleteSubCmp(List, NbItems); |
|
|
|
// if( ! s_ListWithSubCmponents )
|
|
|
|
if( ! m_ListSubCmpItems->GetValue() ) |
|
|
|
DeleteSubCmp(List, NbItems); |
|
|
|
|
|
|
|
/* create the file */ |
|
|
|
PrintListeCmpByRef(f, List, NbItems, TRUE); |
|
|
|
@ -516,8 +641,8 @@ wxString msg; |
|
|
|
void WinEDA_Build_BOM_Frame::GenereListeOfItems(const wxString & FullFileName) |
|
|
|
/****************************************************************************/ |
|
|
|
/*
|
|
|
|
Routine principale pour la creation des listings ( composants et/ou labels |
|
|
|
globaux et "sheet labels" ) |
|
|
|
* Routine principale pour la creation des listings ( composants et/ou labels |
|
|
|
* globaux et "sheet labels" ) |
|
|
|
*/ |
|
|
|
{ |
|
|
|
FILE *f; |
|
|
|
@ -530,7 +655,8 @@ wxString msg; |
|
|
|
/* Creation de la liste des elements */ |
|
|
|
if( ( f = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL ) |
|
|
|
{ |
|
|
|
msg = _("Failed to open file "); msg << FullFileName; |
|
|
|
msg = _("Failed to open file "); |
|
|
|
msg << FullFileName; |
|
|
|
DisplayError(this, msg); |
|
|
|
return; |
|
|
|
} |
|
|
|
@ -542,7 +668,8 @@ wxString msg; |
|
|
|
MyZMalloc( NbItems * sizeof(EDA_BaseStruct **) ); |
|
|
|
if( List == NULL ) |
|
|
|
{ |
|
|
|
fclose(f); return; |
|
|
|
fclose( f ); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
GenListeCmp( List ); |
|
|
|
@ -557,14 +684,18 @@ wxString msg; |
|
|
|
qsort( List, NbItems, sizeof( EDA_BaseStruct * ), |
|
|
|
(int(*)(const void*, const void*))ListTriComposantByRef ); |
|
|
|
|
|
|
|
if( ! s_ListWithSubCmponents ) DeleteSubCmp(List, NbItems); |
|
|
|
// if( ! s_ListWithSubCmponents )
|
|
|
|
if( ! m_ListSubCmpItems->GetValue() ) |
|
|
|
DeleteSubCmp(List, NbItems); |
|
|
|
|
|
|
|
if( s_ListByRef ) |
|
|
|
// if( s_ListByRef )
|
|
|
|
if( m_ListCmpbyRefItems->GetValue() ) |
|
|
|
{ |
|
|
|
PrintListeCmpByRef(f, List, NbItems); |
|
|
|
} |
|
|
|
|
|
|
|
if( s_ListByValue ) |
|
|
|
// if( s_ListByValue )
|
|
|
|
if( m_ListCmpbyValItems->GetValue() ) |
|
|
|
{ |
|
|
|
qsort( List, NbItems, sizeof( EDA_BaseStruct * ), |
|
|
|
(int(*)(const void*, const void*))ListTriComposantByVal ); |
|
|
|
@ -583,13 +714,15 @@ wxString msg; |
|
|
|
ListOfLabels = (ListLabel *) MyZMalloc( NbItems * sizeof(ListLabel) ); |
|
|
|
if( ListOfLabels == NULL ) |
|
|
|
{ |
|
|
|
fclose(f); return; |
|
|
|
fclose( f ); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
GenListeGLabels(ListOfLabels); |
|
|
|
|
|
|
|
/* Tri de la liste */ |
|
|
|
if( s_ListBySheet ) |
|
|
|
// if( s_ListBySheet )
|
|
|
|
if( m_GenListLabelsbySheet->GetValue() ) |
|
|
|
{ |
|
|
|
qsort( ListOfLabels, NbItems, sizeof( ListLabel ), |
|
|
|
(int(*)(const void*, const void*))ListTriGLabelBySheet ); |
|
|
|
@ -599,7 +732,8 @@ wxString msg; |
|
|
|
PrintListeGLabel(f, ListOfLabels, NbItems); |
|
|
|
} |
|
|
|
|
|
|
|
if( s_ListHierarchicalPinByName ) |
|
|
|
// if( s_ListHierarchicalPinByName )
|
|
|
|
if( m_GenListLabelsbyVal->GetValue() ) |
|
|
|
{ |
|
|
|
qsort( ListOfLabels, NbItems, sizeof( ListLabel ), |
|
|
|
(int(*)(const void*, const void*))ListTriGLabelByVal ); |
|
|
|
@ -622,10 +756,10 @@ wxString msg; |
|
|
|
int GenListeCmp( EDA_BaseStruct ** List ) |
|
|
|
/****************************************/ |
|
|
|
/* Routine de generation de la liste des elements utiles du dessin
|
|
|
|
Si List == NULL: comptage des elements |
|
|
|
Sinon remplissage de la liste |
|
|
|
Initialise "FlagControlMulti" a SheetNumber pour la sortie des listes |
|
|
|
et m_Father comme pointeur sur la sheet d'appartenance |
|
|
|
* Si List == NULL: comptage des elements |
|
|
|
* Sinon remplissage de la liste |
|
|
|
* Initialise "FlagControlMulti" a SheetNumber pour la sortie des listes |
|
|
|
* et m_Father comme pointeur sur la sheet d'appartenance |
|
|
|
*/ |
|
|
|
{ |
|
|
|
int ItemCount = 0; |
|
|
|
@ -643,7 +777,6 @@ BASE_SCREEN * screen; |
|
|
|
{ |
|
|
|
switch( DrawList->Type() ) |
|
|
|
{ |
|
|
|
|
|
|
|
case DRAW_LIB_ITEM_STRUCT_TYPE : |
|
|
|
ItemCount++; |
|
|
|
DrawLibItem = (EDA_SchComponentStruct *) DrawList; |
|
|
|
@ -651,12 +784,13 @@ BASE_SCREEN * screen; |
|
|
|
DrawLibItem->m_Parent = screen; |
|
|
|
if( List ) |
|
|
|
{ |
|
|
|
*List = DrawList; List++; |
|
|
|
*List = DrawList; |
|
|
|
List++; |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
default: break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
DrawList = DrawList->Pnext; |
|
|
|
} |
|
|
|
@ -664,12 +798,13 @@ BASE_SCREEN * screen; |
|
|
|
return( ItemCount ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*********************************************/ |
|
|
|
static int GenListeGLabels( ListLabel * List ) |
|
|
|
/*********************************************/ |
|
|
|
/* Count the Glabels, or fill the list Listwith Glabel pointers
|
|
|
|
If List == NULL: Item count only |
|
|
|
Else fill list of Glabels |
|
|
|
* If List == NULL: Item count only |
|
|
|
* Else fill list of Glabels |
|
|
|
*/ |
|
|
|
{ |
|
|
|
int ItemCount = 0; |
|
|
|
@ -714,10 +849,11 @@ BASE_SCREEN * screen; |
|
|
|
ItemCount++; |
|
|
|
SheetLabel = (DrawSheetLabelStruct*)(SheetLabel->Pnext); |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
default: break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
DrawList = DrawList->Pnext; |
|
|
|
} |
|
|
|
@ -725,24 +861,27 @@ BASE_SCREEN * screen; |
|
|
|
return( ItemCount ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************/ |
|
|
|
static int ListTriComposantByVal(EDA_SchComponentStruct **Objet1, |
|
|
|
EDA_SchComponentStruct **Objet2) |
|
|
|
/**********************************************************/ |
|
|
|
/* Routine de comparaison pour le tri du Tableau par qsort()
|
|
|
|
Les composants sont tries |
|
|
|
par valeur |
|
|
|
si meme valeur: par reference |
|
|
|
si meme valeur: par numero d'unite |
|
|
|
|
|
|
|
* Les composants sont tries |
|
|
|
* par valeur |
|
|
|
* si meme valeur: par reference |
|
|
|
* si meme valeur: par numero d'unite |
|
|
|
*/ |
|
|
|
{ |
|
|
|
int ii; |
|
|
|
const wxString * Text1, *Text2; |
|
|
|
|
|
|
|
if( (*Objet1 == NULL) && (*Objet2 == NULL ) ) return(0); |
|
|
|
if( *Objet1 == NULL) return(-1); |
|
|
|
if( *Objet2 == NULL) return(1); |
|
|
|
if( ( *Objet1 == NULL ) && ( *Objet2 == NULL ) ) |
|
|
|
return( 0 ); |
|
|
|
if( *Objet1 == NULL ) |
|
|
|
return( -1 ); |
|
|
|
if( *Objet2 == NULL ) |
|
|
|
return( 1 ); |
|
|
|
|
|
|
|
Text1 = &(*Objet1)->m_Field[VALUE].m_Text; |
|
|
|
Text2 = &(*Objet2)->m_Field[VALUE].m_Text; |
|
|
|
@ -763,24 +902,27 @@ const wxString * Text1, *Text2; |
|
|
|
return( ii ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************/ |
|
|
|
static int ListTriComposantByRef(EDA_SchComponentStruct **Objet1, |
|
|
|
EDA_SchComponentStruct **Objet2) |
|
|
|
/**********************************************************/ |
|
|
|
/* Routine de comparaison pour le tri du Tableau par qsort()
|
|
|
|
Les composants sont tries |
|
|
|
par reference |
|
|
|
si meme referenece: par valeur |
|
|
|
si meme valeur: par numero d'unite |
|
|
|
|
|
|
|
* Les composants sont tries |
|
|
|
* par reference |
|
|
|
* si meme referenece: par valeur |
|
|
|
* si meme valeur: par numero d'unite |
|
|
|
*/ |
|
|
|
{ |
|
|
|
int ii; |
|
|
|
const wxString * Text1, *Text2; |
|
|
|
|
|
|
|
if( (*Objet1 == NULL) && (*Objet2 == NULL ) ) return(0); |
|
|
|
if( *Objet1 == NULL) return(-1); |
|
|
|
if( *Objet2 == NULL) return(1); |
|
|
|
if( ( *Objet1 == NULL ) && ( *Objet2 == NULL ) ) |
|
|
|
return( 0 ); |
|
|
|
if( *Objet1 == NULL ) |
|
|
|
return( -1 ); |
|
|
|
if( *Objet2 == NULL ) |
|
|
|
return( 1 ); |
|
|
|
|
|
|
|
Text1 = &(*Objet1)->m_Field[REFERENCE].m_Text; |
|
|
|
Text2 = &(*Objet2)->m_Field[REFERENCE].m_Text; |
|
|
|
@ -801,14 +943,14 @@ const wxString * Text1, *Text2; |
|
|
|
return( ii ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************/ |
|
|
|
static int ListTriGLabelByVal(ListLabel *Objet1, ListLabel *Objet2) |
|
|
|
/*******************************************************************/ |
|
|
|
/* Routine de comparaison pour le tri du Tableau par qsort()
|
|
|
|
Les labels sont tries |
|
|
|
par comparaison ascii |
|
|
|
si meme valeur: par numero de sheet |
|
|
|
|
|
|
|
* Les labels sont tries |
|
|
|
* par comparaison ascii |
|
|
|
* si meme valeur: par numero de sheet |
|
|
|
*/ |
|
|
|
{ |
|
|
|
int ii; |
|
|
|
@ -823,6 +965,7 @@ const wxString * Text1, *Text2; |
|
|
|
Text2 = &((DrawSheetLabelStruct *)Objet2->m_Label)->m_Text; |
|
|
|
else |
|
|
|
Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text; |
|
|
|
|
|
|
|
ii = Text1->CmpNoCase(*Text2); |
|
|
|
|
|
|
|
if( ii == 0 ) |
|
|
|
@ -833,14 +976,14 @@ const wxString * Text1, *Text2; |
|
|
|
return( ii ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************/ |
|
|
|
static int ListTriGLabelBySheet(ListLabel *Objet1, ListLabel *Objet2) |
|
|
|
/*******************************************************************/ |
|
|
|
/* Routine de comparaison pour le tri du Tableau par qsort()
|
|
|
|
Les labels sont tries |
|
|
|
par sheet number |
|
|
|
si meme valeur, par ordre alphabetique |
|
|
|
|
|
|
|
* Les labels sont tries |
|
|
|
* par sheet number |
|
|
|
* si meme valeur, par ordre alphabetique |
|
|
|
*/ |
|
|
|
{ |
|
|
|
int ii; |
|
|
|
@ -859,6 +1002,7 @@ const wxString * Text1, *Text2; |
|
|
|
Text2 = &((DrawSheetLabelStruct *)Objet2->m_Label)->m_Text; |
|
|
|
else |
|
|
|
Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text; |
|
|
|
|
|
|
|
ii = Text1->CmpNoCase(*Text2); |
|
|
|
} |
|
|
|
|
|
|
|
@ -866,13 +1010,12 @@ const wxString * Text1, *Text2; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************/ |
|
|
|
static void DeleteSubCmp( EDA_BaseStruct ** List, int NbItems ) |
|
|
|
/**************************************************************/ |
|
|
|
/* Supprime les sous-composants, c'est a dire les descriptions redonnantes des
|
|
|
|
boitiers multiples |
|
|
|
La liste des composant doit etre triee par reference et par num d'unite |
|
|
|
* boitiers multiples |
|
|
|
* La liste des composant doit etre triee par reference et par num d'unite |
|
|
|
*/ |
|
|
|
{ |
|
|
|
int ii; |
|
|
|
@ -882,7 +1025,8 @@ const wxString * OldName = NULL; |
|
|
|
for( ii = 0; ii < NbItems; ii++ ) |
|
|
|
{ |
|
|
|
LibItem = (EDA_SchComponentStruct *) List[ii]; |
|
|
|
if ( LibItem == NULL ) continue; |
|
|
|
if( LibItem == NULL ) |
|
|
|
continue; |
|
|
|
if( OldName ) |
|
|
|
{ |
|
|
|
if( OldName->CmpNoCase( LibItem->m_Field[REFERENCE].m_Text ) == 0 ) |
|
|
|
@ -922,14 +1066,19 @@ wxCheckBox * FieldCtrl = FieldListCtrl[0]; |
|
|
|
for( ii = FIELD1; ii <= FIELD8; ii ++ ) |
|
|
|
{ |
|
|
|
FieldCtrl = FieldListCtrl[ii - FIELD1]; |
|
|
|
if ( FieldCtrl == NULL ) continue; |
|
|
|
if ( ! FieldCtrl->IsChecked() ) continue; |
|
|
|
if ( CompactForm ) fprintf(f, "%c%s", s_ExportSeparatorSymbol, |
|
|
|
if( FieldCtrl == NULL ) |
|
|
|
continue; |
|
|
|
if( ! FieldCtrl->IsChecked() ) |
|
|
|
continue; |
|
|
|
if( CompactForm ) |
|
|
|
fprintf(f, "%c%s", s_ExportSeparatorSymbol, |
|
|
|
CONV_TO_UTF8(DrawLibItem->m_Field[ii].m_Text)); |
|
|
|
else fprintf(f, "; %-12s", CONV_TO_UTF8(DrawLibItem->m_Field[ii].m_Text)); |
|
|
|
else |
|
|
|
fprintf(f, "; %-12s", CONV_TO_UTF8(DrawLibItem->m_Field[ii].m_Text)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************************************/ |
|
|
|
int WinEDA_Build_BOM_Frame::PrintListeCmpByRef( FILE * f, EDA_BaseStruct ** List, int NbItems, |
|
|
|
bool CompactForm ) |
|
|
|
@ -962,17 +1111,22 @@ wxString msg; |
|
|
|
for( ii = FIELD1; ii <= FIELD8; ii ++ ) |
|
|
|
{ |
|
|
|
wxCheckBox * FieldCtrl = FieldListCtrl[ii - FIELD1]; |
|
|
|
if ( FieldCtrl == NULL ) continue; |
|
|
|
if ( ! FieldCtrl->IsChecked() ) continue; |
|
|
|
if( FieldCtrl == NULL ) |
|
|
|
continue; |
|
|
|
if( ! FieldCtrl->IsChecked() ) |
|
|
|
continue; |
|
|
|
msg = _("Field"); |
|
|
|
fprintf(f, "%c%s%d", s_ExportSeparatorSymbol, CONV_TO_UTF8(msg), ii - FIELD1 + 1); |
|
|
|
} |
|
|
|
fprintf( f, "\n" ); |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
else |
|
|
|
{ |
|
|
|
msg = _("\n#Cmp ( order = Reference )"); |
|
|
|
if ( s_ListWithSubCmponents ) msg << _(" (with SubCmp)"); |
|
|
|
// if( s_ListWithSubCmponents )
|
|
|
|
if( m_ListSubCmpItems->GetValue() ) |
|
|
|
msg << _(" (with SubCmp)"); |
|
|
|
fprintf( f, "%s\n", CONV_TO_UTF8(msg) ); |
|
|
|
} |
|
|
|
|
|
|
|
@ -980,37 +1134,49 @@ wxString msg; |
|
|
|
{ |
|
|
|
DrawList = List[ii]; |
|
|
|
|
|
|
|
if( DrawList == NULL ) continue; |
|
|
|
if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; |
|
|
|
if( DrawList == NULL ) |
|
|
|
continue; |
|
|
|
if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) |
|
|
|
continue; |
|
|
|
|
|
|
|
DrawLibItem = (EDA_SchComponentStruct *) DrawList; |
|
|
|
if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) continue; |
|
|
|
if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) |
|
|
|
continue; |
|
|
|
|
|
|
|
Multi = 0; Unit = ' '; |
|
|
|
Multi = 0; |
|
|
|
Unit = ' '; |
|
|
|
Entry = FindLibPart(DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT); |
|
|
|
if( Entry ) Multi = Entry->m_UnitCount; |
|
|
|
if( (Multi > 1 ) && s_ListWithSubCmponents ) |
|
|
|
if( Entry ) |
|
|
|
Multi = Entry->m_UnitCount; |
|
|
|
// if( ( Multi > 1 ) && s_ListWithSubCmponents )
|
|
|
|
if( ( Multi > 1 ) && m_ListSubCmpItems->GetValue() ) |
|
|
|
Unit = DrawLibItem->m_Multi + 'A' - 1; |
|
|
|
|
|
|
|
sprintf( NameCmp,"%s", CONV_TO_UTF8(DrawLibItem->m_Field[REFERENCE].m_Text) ); |
|
|
|
if ( ! CompactForm || Unit != ' ' ) sprintf( NameCmp+strlen(NameCmp),"%c", Unit); |
|
|
|
if( ! CompactForm || Unit != ' ' ) |
|
|
|
sprintf( NameCmp + strlen(NameCmp), "%c", Unit ); |
|
|
|
|
|
|
|
if ( CompactForm ) fprintf(f, "%s%c%s", NameCmp, s_ExportSeparatorSymbol, |
|
|
|
if( CompactForm ) |
|
|
|
fprintf(f, "%s%c%s", NameCmp, s_ExportSeparatorSymbol, |
|
|
|
CONV_TO_UTF8(DrawLibItem->m_Field[VALUE].m_Text)); |
|
|
|
else fprintf(f, "| %-10s %-12s", NameCmp, |
|
|
|
else |
|
|
|
fprintf(f, "| %-10s %-12s", NameCmp, |
|
|
|
CONV_TO_UTF8(DrawLibItem->m_Field[VALUE].m_Text)); |
|
|
|
|
|
|
|
if ( s_ListWithSubCmponents ) |
|
|
|
// if( s_ListWithSubCmponents )
|
|
|
|
if( m_ListSubCmpItems->GetValue() ) |
|
|
|
{ |
|
|
|
DrawSheetStruct * sheet = (DrawSheetStruct *)(DrawLibItem->m_Parent); |
|
|
|
wxString sheetname; |
|
|
|
if( sheet && sheet->Type() == DRAW_SHEET_STRUCT_TYPE ) |
|
|
|
sheetname = sheet->m_SheetName; |
|
|
|
else sheetname = _("Root"); |
|
|
|
else |
|
|
|
sheetname = _("Root"); |
|
|
|
if( CompactForm ) |
|
|
|
fprintf(f, "%c%d;%s", s_ExportSeparatorSymbol, DrawLibItem->m_FlagControlMulti, |
|
|
|
CONV_TO_UTF8(sheetname)); |
|
|
|
else fprintf(f, " (Sheet %.2d: \"%s\")", DrawLibItem->m_FlagControlMulti, |
|
|
|
else |
|
|
|
fprintf(f, " (Sheet %.2d: \"%s\")", DrawLibItem->m_FlagControlMulti, |
|
|
|
CONV_TO_UTF8(sheetname)); |
|
|
|
} |
|
|
|
|
|
|
|
@ -1038,7 +1204,9 @@ EDA_LibComponentStruct *Entry; |
|
|
|
wxString msg; |
|
|
|
|
|
|
|
msg = _("\n#Cmp ( order = Value )"); |
|
|
|
if ( s_ListWithSubCmponents ) msg << _(" (with SubCmp)"); |
|
|
|
// if( s_ListWithSubCmponents )
|
|
|
|
if( m_ListSubCmpItems->GetValue() ) |
|
|
|
msg << _(" (with SubCmp)"); |
|
|
|
msg << wxT("\n"); |
|
|
|
fprintf(f, CONV_TO_UTF8(msg)); |
|
|
|
|
|
|
|
@ -1046,16 +1214,22 @@ wxString msg; |
|
|
|
{ |
|
|
|
DrawList = List[ii]; |
|
|
|
|
|
|
|
if( DrawList == NULL ) continue; |
|
|
|
if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; |
|
|
|
if( DrawList == NULL ) |
|
|
|
continue; |
|
|
|
if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) |
|
|
|
continue; |
|
|
|
|
|
|
|
DrawLibItem = (EDA_SchComponentStruct *) DrawList; |
|
|
|
if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) continue; |
|
|
|
if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) |
|
|
|
continue; |
|
|
|
|
|
|
|
Multi = 0; Unit = ' '; |
|
|
|
Multi = 0; |
|
|
|
Unit = ' '; |
|
|
|
Entry = FindLibPart(DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT); |
|
|
|
if( Entry ) Multi = Entry->m_UnitCount; |
|
|
|
if( (Multi > 1 ) && s_ListWithSubCmponents ) |
|
|
|
if( Entry ) |
|
|
|
Multi = Entry->m_UnitCount; |
|
|
|
// if( ( Multi > 1 ) && s_ListWithSubCmponents )
|
|
|
|
if( ( Multi > 1 ) && m_ListSubCmpItems->GetValue() ) |
|
|
|
Unit = DrawLibItem->m_Multi + 'A' - 1; |
|
|
|
msg = DrawLibItem->m_Field[REFERENCE].m_Text; |
|
|
|
msg.Append(Unit); |
|
|
|
@ -1063,7 +1237,8 @@ wxString msg; |
|
|
|
fprintf( f, "| %-12s %-10s", |
|
|
|
CONV_TO_UTF8(DrawLibItem->m_Field[VALUE].m_Text), |
|
|
|
CONV_TO_UTF8(msg) ); |
|
|
|
if ( s_ListWithSubCmponents ) |
|
|
|
// if( s_ListWithSubCmponents )
|
|
|
|
if( m_ListSubCmpItems->GetValue() ) |
|
|
|
{ |
|
|
|
fprintf(f, " (Sheet %.2d)", DrawLibItem->m_FlagControlMulti); |
|
|
|
} |
|
|
|
@ -1110,7 +1285,10 @@ wxString msg; |
|
|
|
{ |
|
|
|
DrawSheetLabel = (DrawSheetLabelStruct *) LabelItem->m_Label; |
|
|
|
jj = DrawSheetLabel->m_Shape; |
|
|
|
if ( jj < 0 ) jj = NET_TMAX; if ( jj > NET_TMAX ) jj = 4; |
|
|
|
if( jj < 0 ) |
|
|
|
jj = NET_TMAX; |
|
|
|
if( jj > NET_TMAX ) |
|
|
|
jj = 4; |
|
|
|
wxString labtype = CONV_FROM_UTF8(SheetLabelType[jj]); |
|
|
|
msg.Printf( |
|
|
|
_("> %-28.28s Sheet %-7.7s (Sheet %.2d) pos: %3.3f, %3.3f\n"), |
|
|
|
@ -1123,62 +1301,11 @@ wxString msg; |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
default: break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
msg = _("#End labels\n"); |
|
|
|
fprintf(f, CONV_TO_UTF8(msg)); |
|
|
|
return( 0 ); |
|
|
|
} |
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_CLOSE_WINDOW event handler for ID_DIALOG |
|
|
|
*/ |
|
|
|
|
|
|
|
void WinEDA_Build_BOM_Frame::OnCloseWindow( wxCloseEvent& event ) |
|
|
|
{ |
|
|
|
SavePreferences(); |
|
|
|
EndModal(0); |
|
|
|
} |
|
|
|
|
|
|
|
/**************************************************/ |
|
|
|
void WinEDA_Build_BOM_Frame::SavePreferences() |
|
|
|
/**************************************************/ |
|
|
|
{ |
|
|
|
s_Add_F1_state = m_AddField1->GetValue(); |
|
|
|
s_Add_F2_state = m_AddField2->GetValue(); |
|
|
|
s_Add_F3_state = m_AddField3->GetValue(); |
|
|
|
s_Add_F4_state = m_AddField4->GetValue(); |
|
|
|
s_Add_F5_state = m_AddField5->GetValue(); |
|
|
|
s_Add_F6_state = m_AddField6->GetValue(); |
|
|
|
s_Add_F7_state = m_AddField7->GetValue(); |
|
|
|
s_Add_F8_state = m_AddField8->GetValue(); |
|
|
|
s_OutputFormOpt = m_OutputFormCtrl->GetSelection(); |
|
|
|
s_OutputSeparatorOpt = m_OutputSeparatorCtrl->GetSelection(); |
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
long addfields = 0; |
|
|
|
for ( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ ) |
|
|
|
{ |
|
|
|
if ( * s_AddFieldList[ii] ) addfields |= bitmask; |
|
|
|
bitmask <<= 1; |
|
|
|
} |
|
|
|
m_Parent->m_Parent->m_EDA_Config->Write(OPTION_BOM_ADD_FIELD, addfields); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX1 |
|
|
|
*/ |
|
|
|
|
|
|
|
void WinEDA_Build_BOM_Frame::OnRadioboxSelectFormatSelected( wxCommandEvent& event ) |
|
|
|
{ |
|
|
|
if ( m_OutputFormCtrl->GetSelection() == 1 ) |
|
|
|
m_OutputSeparatorCtrl->Enable(true); |
|
|
|
else |
|
|
|
m_OutputSeparatorCtrl->Enable(false); |
|
|
|
} |
|
|
|
|