Gerbview: Fix a minor but annoying issue in gerbview config: colors setup is broken when running a testing version after an old gerbview version (due to a bug of this old version which breaks the color config)

This commit is contained in:
jean-pierre charras 2013-01-21 21:02:07 +01:00
parent 2f3c5e7a1e
commit 9ededca9d7
3 changed files with 20 additions and 12 deletions

View File

@ -122,15 +122,15 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings()
// because the parameter list that use these keywords does not store them, // because the parameter list that use these keywords does not store them,
// just points to them. // just points to them.
static const wxChar* keys[] = { static const wxChar* keys[] = {
wxT("ColorLayer0"), wxT("ColorLayer1"), wxT("ColorLayer2"), wxT("ColorLayer3"), wxT("ColorLayer_0"), wxT("ColorLayer_1"), wxT("ColorLayer_2"), wxT("ColorLayer_3"),
wxT("ColorLayer4"), wxT("ColorLayer5"), wxT("ColorLayer6"), wxT("ColorLayer7"), wxT("ColorLayer_4"), wxT("ColorLayer_5"), wxT("ColorLayer_6"), wxT("ColorLayer_7"),
wxT("ColorLayer8"), wxT("ColorLayer9"), wxT("ColorLayer10"), wxT("ColorLayer11"), wxT("ColorLayer_8"), wxT("ColorLayer_9"), wxT("ColorLayer_10"), wxT("ColorLayer_11"),
wxT("ColorLayer12"), wxT("ColorLayer13"), wxT("ColorLayer14"), wxT("ColorLayer15"), wxT("ColorLayer_12"), wxT("ColorLayer_13"), wxT("ColorLayer_14"), wxT("ColorLayer_15"),
wxT("ColorLayer16"), wxT("ColorLayer17"), wxT("ColorLayer18"), wxT("ColorLayer19"), wxT("ColorLayer_16"), wxT("ColorLayer_17"), wxT("ColorLayer_18"), wxT("ColorLayer_19"),
wxT("ColorLayer20"), wxT("ColorLayer21"), wxT("ColorLayer22"), wxT("ColorLayer23"), wxT("ColorLayer_20"), wxT("ColorLayer_21"), wxT("ColorLayer_22"), wxT("ColorLayer_23"),
wxT("ColorLayer24"), wxT("ColorLayer25"), wxT("ColorLayer26"), wxT("ColorLayer27"), wxT("ColorLayer_24"), wxT("ColorLayer_25"), wxT("ColorLayer_26"), wxT("ColorLayer_27"),
wxT("ColorLayer28"), wxT("ColorLayer29"), wxT("ColorLayer30"), wxT("ColorLayer31"), wxT("ColorLayer_28"), wxT("ColorLayer_29"), wxT("ColorLayer_30"), wxT("ColorLayer_31"),
}; };
wxASSERT( DIM(keys) == DIM(color_default) ); wxASSERT( DIM(keys) == DIM(color_default) );

View File

@ -50,7 +50,7 @@
// Config keywords // Config keywords
static const wxString cfgShowPageSizeOption( wxT( "ShowPageSizeOpt" ) ); static const wxString cfgShowPageSizeOption( wxT( "PageSizeOpt" ) );
static const wxString cfgShowDCodes( wxT( "ShowDCodesOpt" ) ); static const wxString cfgShowDCodes( wxT( "ShowDCodesOpt" ) );
static const wxString cfgShowNegativeObjects( wxT( "ShowNegativeObjectsOpt" ) ); static const wxString cfgShowNegativeObjects( wxT( "ShowNegativeObjectsOpt" ) );
static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) ); static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) );

View File

@ -153,7 +153,8 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
char*& text ) char*& text )
{ {
int code; int code;
int xy_seq_len, xy_seq_char; int xy_seq_len; // not used, provided but not yet in use
int xy_seq_char;
bool ok = true; bool ok = true;
char line[GERBER_BUFZ]; char line[GERBER_BUFZ];
wxString msg; wxString msg;
@ -215,13 +216,14 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
break; break;
case 'X': case 'X':
case 'Y': // Values transmitted :2 (really xy_seq_len : FIX case 'Y': // Values transmitted :2 (really xy_seq_len :
// ME) digits // digits
{ {
code = *(text++); code = *(text++);
char ctmp = *(text++) - '0'; char ctmp = *(text++) - '0';
if( code == 'X' ) if( code == 'X' )
{ {
xy_seq_len--;
// number of digits after the decimal point (0 to 6 allowed) // number of digits after the decimal point (0 to 6 allowed)
m_FmtScale.x = *text - '0'; m_FmtScale.x = *text - '0';
m_FmtLen.x = ctmp + m_FmtScale.x; m_FmtLen.x = ctmp + m_FmtScale.x;
@ -234,6 +236,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
} }
else else
{ {
xy_seq_len--;
m_FmtScale.y = *text - '0'; m_FmtScale.y = *text - '0';
m_FmtLen.y = ctmp + m_FmtScale.y; m_FmtLen.y = ctmp + m_FmtScale.y;
if( m_FmtScale.y < 0 ) if( m_FmtScale.y < 0 )
@ -255,6 +258,11 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
} }
} }
if( xy_seq_len != 0 )
{
ReportMessage( wxT( "RS274X: suspicious Format Statement (FS) command" ) );
}
break; break;
case AXIS_SELECT: // command ASAXBY*% or %ASAYBX*% case AXIS_SELECT: // command ASAXBY*% or %ASAYBX*%