From 86a710e175cc4bf8618f1f8618524df87c095394 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 6 Aug 2020 14:58:16 +0200 Subject: [PATCH] Gerbview: show a message instead of an error when trying to open a job file as plot file. From master branch, commit ef0ae8 --- gerbview/files.cpp | 24 +++++++++++++++++++++++- gerbview/menubar.cpp | 11 +++++++---- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/gerbview/files.cpp b/gerbview/files.cpp index 7d185ab408..c6b555f36a 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -322,7 +322,17 @@ bool GERBVIEW_FRAME::loadListOfGerberAndDrillFiles( const wxString& aPath, } 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( + _( "A gerber job file cannot be loaded as a plot file %s" ), + filename.GetFullName() ); + success = false; + reporter.Report( txt, REPORTER::RPT_WARNING ); + } + else if( Read_GERBER_File( filename.GetFullPath() ) ) { UpdateFileHistory( m_lastFileName ); @@ -552,6 +562,18 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR 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(); if( layer == NO_AVAILABLE_LAYERS ) diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp index d289d2646a..7c4ade9a8a 100644 --- a/gerbview/menubar.cpp +++ b/gerbview/menubar.cpp @@ -54,20 +54,23 @@ void GERBVIEW_FRAME::ReCreateMenuBar() // Open Gerber file(s) AddMenuItem( fileMenu, wxID_FILE, - _( "Open &Gerber File(s)..." ), - _( "Open Gerber file(s) on the current layer. Previous data will be deleted" ), + _( "Open &Gerber Plot File(s)..." ), + _( "Open Gerber plot file(s) on the current layer." + " Previous data will be deleted" ), KiBitmap( load_gerber_xpm ) ); // Open Excellon drill file(s) AddMenuItem( fileMenu, ID_GERBVIEW_LOAD_DRILL_FILE, _( "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 ) ); // Open Gerber job files AddMenuItem( fileMenu, ID_GERBVIEW_LOAD_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 ) ); // Open Zip archive files