26#include <wx/filename.h>
39#include <wx/filedlg.h>
43using json = nlohmann::json;
105 FILE* jobFile = wxFopen(
m_filename.GetFullPath(), wxT(
"rt" ) );
107 if( jobFile ==
nullptr )
115 bool json_format =
false;
117 char* line = jobfileReader.
ReadLine();
124 if( data.Contains( wxT(
"{" ) ) )
129 while( ( line = jobfileReader.
ReadLine() ) !=
nullptr )
130 data <<
'\n' << line;
136 for(
json& entry : js[
"FilesAttributes"] )
138 std::string
name = entry[
"Path"].get<std::string>();
150 m_reporter->ReportTail(
_(
"This job file uses an outdated format. Please recreate it." ),
174 wxFileName filename = aFullFileName;
175 wxString currentPath;
178 if( !filename.IsOk() )
181 if( filename.DirExists() )
182 currentPath = filename.GetPath();
186 wxFileDialog dlg(
this,
_(
"Open Gerber Job File" ),
188 filename.GetFullName(),
190 wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
194 if( dlg.ShowModal() == wxID_CANCEL )
197 filename = dlg.GetPath();
198 currentPath = filename.GetPath();
203 currentPath = filename.GetPath();
209 if( filename.IsOk() )
224 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.
A pure virtual class used to derive REPORTER objects from.
A wrapper for reporting to a wxString object.
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.
IbisParser parser & reporter
Definition of file extensions used in Kicad.