More detailed error messages when loading Gerber or drill files and if no room to load some files.
This commit is contained in:
parent
361c0c2e21
commit
aac13e7ae1
|
@ -34,6 +34,7 @@
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
#include <reporter.h>
|
#include <reporter.h>
|
||||||
|
#include <html_messagebox.h>
|
||||||
|
|
||||||
#include <gerbview_frame.h>
|
#include <gerbview_frame.h>
|
||||||
#include <gerbview_id.h>
|
#include <gerbview_id.h>
|
||||||
|
@ -197,8 +198,13 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read gerber files: each file is loaded on a new GerbView layer
|
// Read gerber files: each file is loaded on a new GerbView layer
|
||||||
|
bool success = true;
|
||||||
int layer = getActiveLayer();
|
int layer = getActiveLayer();
|
||||||
|
|
||||||
|
// Manage errors when loading files
|
||||||
|
wxString msg;
|
||||||
|
WX_STRING_REPORTER reporter( &msg );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
filename = filenamesList[ii];
|
filename = filenamesList[ii];
|
||||||
|
@ -216,11 +222,23 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
|
||||||
|
|
||||||
layer = getNextAvailableLayer( layer );
|
layer = getNextAvailableLayer( layer );
|
||||||
|
|
||||||
if( layer == NO_AVAILABLE_LAYERS )
|
if( layer == NO_AVAILABLE_LAYERS && ii < filenamesList.GetCount()-1 )
|
||||||
{
|
{
|
||||||
wxString msg = wxT( "No more empty available layers.\n"
|
success = false;
|
||||||
"The remaining gerber files will not be loaded." );
|
|
||||||
wxMessageBox( msg );
|
reporter.Report( _( "No available graphic layer in Gerbview to load files" ),
|
||||||
|
REPORTER::RPT_ERROR );
|
||||||
|
|
||||||
|
// Report the name of not loaded files:
|
||||||
|
ii += 1;
|
||||||
|
while( ii < filenamesList.GetCount() )
|
||||||
|
{
|
||||||
|
filename = filenamesList[ii++];
|
||||||
|
wxString txt;
|
||||||
|
txt.Printf( _( "\nNot loaded: '%s'" ),
|
||||||
|
GetChars( filename.GetFullName() ) );
|
||||||
|
reporter.Report( txt, REPORTER::RPT_ERROR );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,6 +246,13 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !success )
|
||||||
|
{
|
||||||
|
HTML_MESSAGE_BOX mbox( this, _( "Errors" ) );
|
||||||
|
mbox.ListSet( msg );
|
||||||
|
mbox.ShowModal();
|
||||||
|
}
|
||||||
|
|
||||||
Zoom_Automatique( false );
|
Zoom_Automatique( false );
|
||||||
|
|
||||||
// Synchronize layers tools with actual active layer:
|
// Synchronize layers tools with actual active layer:
|
||||||
|
@ -235,7 +260,7 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
|
||||||
setActiveLayer( getActiveLayer() );
|
setActiveLayer( getActiveLayer() );
|
||||||
m_LayersManager->UpdateLayerIcons();
|
m_LayersManager->UpdateLayerIcons();
|
||||||
syncLayerBox();
|
syncLayerBox();
|
||||||
return true;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -280,9 +305,14 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
|
||||||
m_mruPath = currentPath;
|
m_mruPath = currentPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read gerber files: each file is loaded on a new GerbView layer
|
// Read Excellon drill files: each file is loaded on a new GerbView layer
|
||||||
|
bool success = true;
|
||||||
int layer = getActiveLayer();
|
int layer = getActiveLayer();
|
||||||
|
|
||||||
|
// Manage errors when loading files
|
||||||
|
wxString msg;
|
||||||
|
WX_STRING_REPORTER reporter( &msg );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
filename = filenamesList[ii];
|
filename = filenamesList[ii];
|
||||||
|
@ -301,11 +331,23 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
|
||||||
|
|
||||||
layer = getNextAvailableLayer( layer );
|
layer = getNextAvailableLayer( layer );
|
||||||
|
|
||||||
if( layer == NO_AVAILABLE_LAYERS )
|
if( layer == NO_AVAILABLE_LAYERS && ii < filenamesList.GetCount()-1 )
|
||||||
{
|
{
|
||||||
wxString msg = wxT( "No more empty available layers.\n"
|
success = false;
|
||||||
"The remaining gerber files will not be loaded." );
|
|
||||||
wxMessageBox( msg );
|
reporter.Report( _( "No available graphic layer in Gerbview to load files" ),
|
||||||
|
REPORTER::RPT_ERROR );
|
||||||
|
|
||||||
|
// Report the name of not loaded files:
|
||||||
|
ii += 1;
|
||||||
|
while( ii < filenamesList.GetCount() )
|
||||||
|
{
|
||||||
|
filename = filenamesList[ii++];
|
||||||
|
wxString txt;
|
||||||
|
txt.Printf( _( "\nNot loaded: '%s'" ),
|
||||||
|
GetChars( filename.GetFullName() ) );
|
||||||
|
reporter.Report( txt, REPORTER::RPT_ERROR );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,6 +355,13 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !success )
|
||||||
|
{
|
||||||
|
HTML_MESSAGE_BOX mbox( this, _( "Errors" ) );
|
||||||
|
mbox.ListSet( msg );
|
||||||
|
mbox.ShowModal();
|
||||||
|
}
|
||||||
|
|
||||||
Zoom_Automatique( false );
|
Zoom_Automatique( false );
|
||||||
|
|
||||||
// Synchronize layers tools with actual active layer:
|
// Synchronize layers tools with actual active layer:
|
||||||
|
@ -321,7 +370,7 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
|
||||||
m_LayersManager->UpdateLayerIcons();
|
m_LayersManager->UpdateLayerIcons();
|
||||||
syncLayerBox();
|
syncLayerBox();
|
||||||
|
|
||||||
return true;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -430,9 +479,17 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR
|
||||||
|
|
||||||
if( aReporter )
|
if( aReporter )
|
||||||
{
|
{
|
||||||
msg = _( "No available graphic layer in Gerbview.\n"
|
msg = _( "No available graphic layer in Gerbview to load files" );
|
||||||
"The remaining files will not be loaded." );
|
|
||||||
aReporter->Report( msg, REPORTER::RPT_ERROR );
|
aReporter->Report( msg, REPORTER::RPT_ERROR );
|
||||||
|
|
||||||
|
// Report the name of not loaded files:
|
||||||
|
while( !localfilename.IsEmpty() )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "\nNot loaded: '%s'" ),
|
||||||
|
GetChars( localfilename.AfterLast( ':' ) ) );
|
||||||
|
aReporter->Report( msg, REPORTER::RPT_ERROR );
|
||||||
|
localfilename = zipfilesys.FindNext();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -487,7 +544,11 @@ bool GERBVIEW_FRAME::LoadZipArchiveFile( const wxString& aFullFileName )
|
||||||
bool success = unarchiveFiles( filename.GetFullPath(), &reporter );
|
bool success = unarchiveFiles( filename.GetFullPath(), &reporter );
|
||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
wxMessageBox( msg );
|
{
|
||||||
|
HTML_MESSAGE_BOX mbox( this, _( "Errors" ) );
|
||||||
|
mbox.ListSet( msg );
|
||||||
|
mbox.ShowModal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Zoom_Automatique( false );
|
Zoom_Automatique( false );
|
||||||
|
|
Loading…
Reference in New Issue