Gerbview: show a message instead of an error when trying to open a job file as plot file.

From master branch, commit ef0ae8
This commit is contained in:
jean-pierre charras 2020-08-06 14:58:16 +02:00
parent 1797a9c61a
commit 86a710e175
2 changed files with 30 additions and 5 deletions

View File

@ -322,7 +322,17 @@ bool GERBVIEW_FRAME::loadListOfGerberAndDrillFiles( const wxString& aPath,
} }
else else
{ {
if( Read_GERBER_File( filename.GetFullPath() ) ) if( filename.GetExt() == GerberJobFileExtension.c_str() )
{
//We cannot read a gerber job file as a gerber plot file: skip it
wxString txt;
txt.Printf(
_( "<b>A gerber job file cannot be loaded as a plot file</b> <i>%s</i>" ),
filename.GetFullName() );
success = false;
reporter.Report( txt, REPORTER::RPT_WARNING );
}
else if( Read_GERBER_File( filename.GetFullPath() ) )
{ {
UpdateFileHistory( m_lastFileName ); UpdateFileHistory( m_lastFileName );
@ -552,6 +562,18 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR
continue; continue;
} }
if( curr_ext == GerberJobFileExtension.c_str() )
{
//We cannot read a gerber job file as a gerber plot file: skip it
if( aReporter )
{
msg.Printf( _( "Info: skip file \"%s\" (gerber job file)\n" ), entry->GetName() );
aReporter->Report( msg, REPORTER::RPT_WARNING );
}
continue;
}
int layer = GetActiveLayer(); int layer = GetActiveLayer();
if( layer == NO_AVAILABLE_LAYERS ) if( layer == NO_AVAILABLE_LAYERS )

View File

@ -54,20 +54,23 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
// Open Gerber file(s) // Open Gerber file(s)
AddMenuItem( fileMenu, wxID_FILE, AddMenuItem( fileMenu, wxID_FILE,
_( "Open &Gerber File(s)..." ), _( "Open &Gerber Plot File(s)..." ),
_( "Open Gerber file(s) on the current layer. Previous data will be deleted" ), _( "Open Gerber plot file(s) on the current layer."
" Previous data will be deleted" ),
KiBitmap( load_gerber_xpm ) ); KiBitmap( load_gerber_xpm ) );
// Open Excellon drill file(s) // Open Excellon drill file(s)
AddMenuItem( fileMenu, ID_GERBVIEW_LOAD_DRILL_FILE, AddMenuItem( fileMenu, ID_GERBVIEW_LOAD_DRILL_FILE,
_( "Open &Excellon Drill File(s)..." ), _( "Open &Excellon Drill File(s)..." ),
_( "Open Excellon drill file(s) on the current layer. Previous data will be deleted" ), _( "Open Excellon drill file(s) on the current layer."
" Previous data will be deleted" ),
KiBitmap( gerbview_drill_file_xpm ) ); KiBitmap( gerbview_drill_file_xpm ) );
// Open Gerber job files // Open Gerber job files
AddMenuItem( fileMenu, ID_GERBVIEW_LOAD_JOB_FILE, AddMenuItem( fileMenu, ID_GERBVIEW_LOAD_JOB_FILE,
_( "Open Gerber &Job File..." ), _( "Open Gerber &Job File..." ),
_( "Open a Gerber job file, and it's associated gerber files depending on the job" ), _( "Open a Gerber job file, and it's associated gerber plot"
" files depending on the job" ),
KiBitmap( gerber_job_file_xpm ) ); KiBitmap( gerber_job_file_xpm ) );
// Open Zip archive files // Open Zip archive files