37#include <wx/filedlg.h>
89 wxFileDialog dlg(
m_frame,
_(
"Save Bill of Materials" ), pro_dir, fn.GetFullName(),
92 if( dlg.ShowModal() == wxID_CANCEL )
97 fp_bom = wxFopen( fn.GetFullPath(), wxT(
"wt" ) );
99 if( fp_bom ==
nullptr )
101 DisplayError(
m_frame, wxString::Format(
_(
"Failed to create file '%s'." ), fn.GetFullPath() ) );
106 wxString msg = wxT(
"\"" );
107 msg <<
_(
"Id" ) << wxT(
"\";\"" );
108 msg <<
_(
"Designator" ) << wxT(
"\";\"" );
109 msg <<
_(
"Footprint" ) << wxT(
"\";\"" );
110 msg <<
_(
"Quantity" ) << wxT(
"\";\"" );
111 msg <<
_(
"Designation" ) << wxT(
"\";\"" );
112 msg <<
_(
"Supplier and ref" ) << wxT(
"\";\n" );
113 fprintf( fp_bom,
"%s",
TO_UTF8( msg ) );
124 bool valExist =
false;
131 curEntry.m_Ref.Append( wxT(
", " ), 1 );
158 msg << curEntry.m_Id << wxT(
";\"" );
159 msg << curEntry.m_Ref << wxT(
"\";\"" );
160 msg <<
From_UTF8( curEntry.m_FPID.GetLibItemName().c_str() ) << wxT(
"\";" );
161 msg << curEntry.m_Count << wxT(
";\"" );
162 msg << curEntry.m_Val << wxT(
"\";;;\n" );
163 fprintf( fp_bom,
"%s",
TO_UTF8( msg ) );
std::vector< BOM_ENTRY > BOM_ENTRY_LIST
int GenBOMFileFromBoard(const TOOL_EVENT &aEvent)
Information pertinent to a Pcbnew printed circuit board.
const FOOTPRINTS & Footprints() const
const wxString & GetFileName() const
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
A logical library item identifier and consists of various portions much like a URI.
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
static const std::string CsvFileExtension
static wxString CsvFileWildcard()
This file contains miscellaneous commonly used macros and functions.
wxString From_UTF8(const char *cstring)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition of file extensions used in Kicad.