From 86e73c1bae1d2ec88a28d9b49afc73134b9e642f Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 21 Jan 2013 21:02:07 +0100 Subject: [PATCH] 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) --- gerbview/gerbview_config.cpp | 16 ++++++++-------- gerbview/gerbview_frame.cpp | 2 +- gerbview/rs274x.cpp | 14 +++++++++++--- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/gerbview/gerbview_config.cpp b/gerbview/gerbview_config.cpp index 4c258eea3d..6db6f420dd 100644 --- a/gerbview/gerbview_config.cpp +++ b/gerbview/gerbview_config.cpp @@ -122,15 +122,15 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings() // because the parameter list that use these keywords does not store them, // just points to them. static const wxChar* keys[] = { - wxT("ColorLayer0"), wxT("ColorLayer1"), wxT("ColorLayer2"), wxT("ColorLayer3"), - wxT("ColorLayer4"), wxT("ColorLayer5"), wxT("ColorLayer6"), wxT("ColorLayer7"), - wxT("ColorLayer8"), wxT("ColorLayer9"), wxT("ColorLayer10"), wxT("ColorLayer11"), - wxT("ColorLayer12"), wxT("ColorLayer13"), wxT("ColorLayer14"), wxT("ColorLayer15"), + wxT("ColorLayer_0"), wxT("ColorLayer_1"), wxT("ColorLayer_2"), wxT("ColorLayer_3"), + wxT("ColorLayer_4"), wxT("ColorLayer_5"), wxT("ColorLayer_6"), wxT("ColorLayer_7"), + wxT("ColorLayer_8"), wxT("ColorLayer_9"), wxT("ColorLayer_10"), wxT("ColorLayer_11"), + wxT("ColorLayer_12"), wxT("ColorLayer_13"), wxT("ColorLayer_14"), wxT("ColorLayer_15"), - wxT("ColorLayer16"), wxT("ColorLayer17"), wxT("ColorLayer18"), wxT("ColorLayer19"), - wxT("ColorLayer20"), wxT("ColorLayer21"), wxT("ColorLayer22"), wxT("ColorLayer23"), - wxT("ColorLayer24"), wxT("ColorLayer25"), wxT("ColorLayer26"), wxT("ColorLayer27"), - wxT("ColorLayer28"), wxT("ColorLayer29"), wxT("ColorLayer30"), wxT("ColorLayer31"), + wxT("ColorLayer_16"), wxT("ColorLayer_17"), wxT("ColorLayer_18"), wxT("ColorLayer_19"), + wxT("ColorLayer_20"), wxT("ColorLayer_21"), wxT("ColorLayer_22"), wxT("ColorLayer_23"), + wxT("ColorLayer_24"), wxT("ColorLayer_25"), wxT("ColorLayer_26"), wxT("ColorLayer_27"), + wxT("ColorLayer_28"), wxT("ColorLayer_29"), wxT("ColorLayer_30"), wxT("ColorLayer_31"), }; wxASSERT( DIM(keys) == DIM(color_default) ); diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 63da5c600d..b8117ede59 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -50,7 +50,7 @@ // Config keywords -static const wxString cfgShowPageSizeOption( wxT( "ShowPageSizeOpt" ) ); +static const wxString cfgShowPageSizeOption( wxT( "PageSizeOpt" ) ); static const wxString cfgShowDCodes( wxT( "ShowDCodesOpt" ) ); static const wxString cfgShowNegativeObjects( wxT( "ShowNegativeObjectsOpt" ) ); static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) ); diff --git a/gerbview/rs274x.cpp b/gerbview/rs274x.cpp index 8af947aed7..902394cd03 100644 --- a/gerbview/rs274x.cpp +++ b/gerbview/rs274x.cpp @@ -153,7 +153,8 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command, char*& text ) { 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; char line[GERBER_BUFZ]; wxString msg; @@ -215,13 +216,14 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command, break; case 'X': - case 'Y': // Values transmitted :2 (really xy_seq_len : FIX - // ME) digits + case 'Y': // Values transmitted :2 (really xy_seq_len : + // digits { code = *(text++); char ctmp = *(text++) - '0'; if( code == 'X' ) { + xy_seq_len--; // number of digits after the decimal point (0 to 6 allowed) m_FmtScale.x = *text - '0'; m_FmtLen.x = ctmp + m_FmtScale.x; @@ -234,6 +236,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command, } else { + xy_seq_len--; m_FmtScale.y = *text - '0'; m_FmtLen.y = ctmp + m_FmtScale.y; 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; case AXIS_SELECT: // command ASAXBY*% or %ASAYBX*%