32#include <wx/filedlg.h>
38 FILE* cmpFile = wxFopen( aFullCmpFileName, wxT(
"wt" ) );
40 if( cmpFile ==
nullptr )
47 fprintf( cmpFile,
"\nBeginCmp\n" );
48 fprintf( cmpFile,
"TimeStamp = %s\n",
TO_UTF8( fp->m_Uuid.AsString() ) );
49 fprintf( cmpFile,
"Path = %s\n",
TO_UTF8( fp->GetPath().AsString() ) );
50 fprintf( cmpFile,
"Reference = %s;\n",
51 !fp->GetReference().IsEmpty() ?
TO_UTF8( fp->GetReference() ) :
"[NoRef]" );
52 fprintf( cmpFile,
"ValeurCmp = %s;\n",
53 !fp->GetValue().IsEmpty() ?
TO_UTF8( fp->GetValue() ) :
"[NoVal]" );
54 fprintf( cmpFile,
"IdModule = %s;\n", fp->GetFPID().Format().c_str() );
55 fprintf( cmpFile,
"EndCmp\n" );
58 fprintf( cmpFile,
"\nEndListe\n" );
68 wxString projectDir = wxPathOnly(
Prj().GetProjectFullName() );
73 wxFileDialog dlg(
this,
_(
"Save Footprint Association File" ), projectDir, fn.GetFullName(),
75 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
77 if( dlg.ShowModal() == wxID_CANCEL )
80 wxString
path = dlg.GetPath();
83 DisplayError(
this, wxString::Format(
_(
"Failed to create file '%s'." ),
path ) );
Information pertinent to a Pcbnew printed circuit board.
const FOOTPRINTS & Footprints() const
const wxString & GetFileName() const
void RecreateCmpFileFromBoard(wxCommandEvent &aEvent)
Recreates a .cmp file from the current loaded board.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
This file is part of the common library.
static const std::string FootprintAssignmentFileExtension
static wxString FootprintAssignmentFileWildcard()
This file contains miscellaneous commonly used macros and functions.
wxString GetISO8601CurrentDateTime()
#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.