29 #include <nlohmann/json.hpp> 30 #include <wx/filename.h> 44 #include <wx/filedlg.h> 109 FILE* jobFile = wxFopen(
m_filename.GetFullPath(), wxT(
"rt" ) );
111 if( jobFile ==
nullptr )
122 bool json_format =
false;
124 char* line = jobfileReader.
ReadLine();
131 if( data.Contains( wxT(
"{" ) ) )
136 while( ( line = jobfileReader.ReadLine() ) )
137 data <<
'\n' << line;
143 for(
json& entry : js[
"FilesAttributes"] )
145 std::string
name = entry[
"Path"].get<std::string>();
181 wxFileName filename = aFullFileName;
182 wxString currentPath;
185 if( !filename.IsOk() )
188 if( filename.DirExists() )
189 currentPath = filename.GetPath();
193 wxFileDialog dlg(
this,
_(
"Open Gerber Job File" ),
195 filename.GetFullName(),
197 wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
199 if( dlg.ShowModal() == wxID_CANCEL )
202 filename = dlg.GetPath();
203 currentPath = filename.GetPath();
208 currentPath = filename.GetPath();
215 if( filename.IsOk() )
219 if( gbjReader.ReadGerberJobFile() )
227 wxArrayString& gbrfiles = gbjReader.GetGerberFiles();
char * ReadLine() override
Read a line of text into the buffer and increments the line number counter.
void SortLayersByX2Attributes()
bool Clear_DrawLayers(bool query)
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
FILE_HISTORY m_jobFileHistory
this class read and parse a Gerber job file to extract useful info for GerbView
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Places the report at the end of the list, for objects that support report ordering.
A pure virtual class used to derive REPORTER objects from.
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=nullptr)
Update the list of recently opened files.
This file contains miscellaneous commonly used macros and functions.
bool LoadGerberJobFile(const wxString &aFileName)
Load a Gerber job file, and load gerber files found in job files.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
virtual void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board.
A LINE_READER that reads from an open file.
GERBER_JOBFILE_READER(const wxString &aFileName, REPORTER *aReporter)
bool LoadListOfGerberAndDrillFiles(const wxString &aPath, const wxArrayString &aFilenameList, const std::vector< int > *aFileType=nullptr)
Load a list of Gerber and NC drill files and updates the view based on them.
void ListSet(const wxString &aList)
Add a list of items.
Definition of file extensions used in Kicad.
wxArrayString & GetGerberFiles()
read a .gbrjob file
virtual void ClearMsgPanel()
Clear all messages from the message panel.
A wrapper for reporting to a wxString object.
wxString GerberJobFileWildcard()
wxArrayString m_GerberFiles
wxString formatStringFromJSON(const std::string &name)