29#include <nlohmann/json.hpp>
30#include <wx/filename.h>
44#include <wx/filedlg.h>
47using json = nlohmann::json;
109 FILE* jobFile = wxFopen(
m_filename.GetFullPath(), wxT(
"rt" ) );
111 if( jobFile ==
nullptr )
121 bool json_format =
false;
123 char* line = jobfileReader.
ReadLine();
130 if( data.Contains( wxT(
"{" ) ) )
135 while( ( line = jobfileReader.
ReadLine() ) !=
nullptr )
136 data <<
'\n' << line;
142 for(
json& entry : js[
"FilesAttributes"] )
144 std::string
name = entry[
"Path"].get<std::string>();
180 wxFileName filename = aFullFileName;
181 wxString currentPath;
184 if( !filename.IsOk() )
187 if( filename.DirExists() )
188 currentPath = filename.GetPath();
192 wxFileDialog dlg(
this,
_(
"Open Gerber Job File" ),
194 filename.GetFullName(),
196 wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
198 if( dlg.ShowModal() == wxID_CANCEL )
201 filename = dlg.GetPath();
202 currentPath = filename.GetPath();
207 currentPath = filename.GetPath();
213 if( filename.IsOk() )
228 std::vector<int> fileTypesVec( gbrfiles.Count(), 0 );
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=nullptr)
Update the list of recently opened files.
virtual void ClearMsgPanel()
Clear all messages from the message panel.
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.
char * ReadLine() override
Read a line of text into the buffer and increments the line number counter.
this class read and parse a Gerber job file to extract useful info for GerbView
GERBER_JOBFILE_READER(const wxString &aFileName, REPORTER *aReporter)
wxArrayString m_GerberFiles
wxArrayString & GetGerberFiles()
read a .gbrjob file
wxString formatStringFromJSON(const std::string &name)
void SortLayersByX2Attributes()
bool LoadGerberJobFile(const wxString &aFileName)
Load a Gerber job file, and load gerber files found in job files.
FILE_HISTORY m_jobFileHistory
bool Clear_DrawLayers(bool query)
bool LoadListOfGerberAndDrillFiles(const wxString &aPath, const wxArrayString &aFilenameList, std::vector< int > *aFileType)
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.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
A pure virtual class used to derive REPORTER objects from.
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 wrapper for reporting to a wxString object.
bool HasMessage() const override
Returns true if the reporter client is non-empty.
const wxString & GetMessages() const
static wxString GerberJobFileWildcard()
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.