30#include <wx/filename.h>
43#include <wx/filedlg.h>
47using json = nlohmann::json;
109 FILE* jobFile = wxFopen(
m_filename.GetFullPath(), wxT(
"rt" ) );
111 if( jobFile ==
nullptr )
119 bool json_format =
false;
121 char* line = jobfileReader.
ReadLine();
128 if( data.Contains( wxT(
"{" ) ) )
133 while( ( line = jobfileReader.
ReadLine() ) !=
nullptr )
134 data <<
'\n' << line;
140 for(
json& entry : js[
"FilesAttributes"] )
142 std::string
name = entry[
"Path"].get<std::string>();
154 m_reporter->ReportTail(
_(
"This job file uses an outdated format. Please recreate it." ),
178 wxFileName filename = aFullFileName;
179 wxString currentPath;
182 if( !filename.IsOk() )
185 if( filename.DirExists() )
186 currentPath = filename.GetPath();
190 wxFileDialog dlg(
this,
_(
"Open Gerber Job File" ),
192 filename.GetFullName(),
194 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.
A pure virtual class used to derive REPORTER objects from.
virtual bool HasMessage() const
Returns true if any messages were reported.
A wrapper for reporting to a wxString object.
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.