From 53f69ece79befe66d872e92398ab2d31d4155dba Mon Sep 17 00:00:00 2001 From: charras Date: Wed, 17 Dec 2008 14:51:39 +0000 Subject: [PATCH] gerbview: add french translation, G55 command (a do nothing command) and solved a bug that can crashes gerbview with files without any DCODE tools info. --- gerbview/dcode.cpp | 6 +++++- gerbview/gerbview.h | 3 ++- gerbview/rs274d.cpp | 28 ++++++++++++++++++---------- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/gerbview/dcode.cpp b/gerbview/dcode.cpp index 60db9d39f6..d4a5f0ef99 100644 --- a/gerbview/dcode.cpp +++ b/gerbview/dcode.cpp @@ -379,6 +379,8 @@ void WinEDA_GerberFrame::CopyDCodesSizeToItems() /* Set Size Items (Lines, Flashes) from DCodes List */ { + static D_CODE dummy(999); //Used if D_CODE not found in list + for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() ) { GERBER* gerber = g_GERBER_List[track->GetLayer()]; @@ -386,6 +388,8 @@ void WinEDA_GerberFrame::CopyDCodesSizeToItems() D_CODE* dcode = gerber->GetDCODE( track->GetNet(), false ); wxASSERT( dcode ); + if ( dcode == NULL ) + dcode = &dummy; dcode->m_InUse = TRUE; @@ -415,7 +419,7 @@ void WinEDA_GerberFrame::CopyDCodesSizeToItems() switch( dcode->m_Shape ) { - case APT_LINE: // ne devrait pas etre utilis� ici + case APT_LINE: // might not appears here, but some broken gerber files use it case APT_CIRCLE: /* spot round (for GERBER)*/ track->m_Shape = S_SPOT_CIRCLE; break; diff --git a/gerbview/gerbview.h b/gerbview/gerbview.h index f620354fd4..73c26873a7 100644 --- a/gerbview/gerbview.h +++ b/gerbview/gerbview.h @@ -83,6 +83,7 @@ enum Gerb_GCommand { GC_TURN_ON_POLY_FILL = 36, GC_TURN_OFF_POLY_FILL = 37, GC_SELECT_TOOL = 54, + GC_PHOTO_MODE = 55, // can starts a D03 flash command: redundant with D03 GC_SPECIFY_INCHES = 70, GC_SPECIFY_MILLIMETERS = 71, GC_TURN_OFF_360_INTERPOL = 74, @@ -292,7 +293,7 @@ inline double DCODE_PARAM::GetValue( const D_CODE* aDcode ) const { // the first one was numbered 1, not zero, as in $1, see page 19 of spec. unsigned ndx = GetIndex() - 1; - + wxASSERT(aDcode); // get the parameter from the aDcode if( ndx < aDcode->m_am_params.size() ) return aDcode->m_am_params[ndx].GetValue( NULL ); diff --git a/gerbview/rs274d.cpp b/gerbview/rs274d.cpp index fb6120450d..5ba1755463 100644 --- a/gerbview/rs274d.cpp +++ b/gerbview/rs274d.cpp @@ -198,7 +198,7 @@ static void fillLineTRACK( TRACK* aTrack, int Dcode_index, int aLayer, } -#if 0 // @todo finish translating comment and get it into the doxygen function comment for fillArcTRACK below +#if 0 // @todo get it into the doxygen function comment for fillArcTRACK below /*****************************************************************/ static void Append_1_SEG_ARC_GERBER( int Dcode_index, WinEDA_GerberFrame* frame, wxDC* DC, @@ -208,15 +208,20 @@ static void Append_1_SEG_ARC_GERBER( int Dcode_index, /*****************************************************************/ /* - creation d'un arc: - si multiquadrant == true arc de 0 a 360 degres - et rel_center est la coordonn�e du centre relativement au startpoint - - si multiquadrant == false arc de 0 � 90 entierement contenu dans le meme quadrant - et rel_center est la coordonn�e du centre relativement au startpoint, - mais en VALEUR ABSOLUE et le signe des valeurs x et y de rel_center doit - etre deduit de cette limite de 90 degres -*/ + * Creates an arc: + * if multiquadrant == true : arc can be 0 to 360 degres + * and rel_center is the center coordiante relative to startpoint. + * + * if multiquadrant == false arc can be only 0 to 90 deg, + * and only in the same quadrant : + * absolute angle 0 to 90 (quadrant 1) or + * absolute angle 90 to 180 (quadrant 2) or + * absolute angle 180 to 270 (quadrant 3) or + * absolute angle 270 to 0 (quadrant 4) + * rel_center is the center coordiante relative to startpoint, + * given in ABSOLUE VALUE and the signe of values x et y de rel_center + * must be calculated from the previously given constraint: arc only in the same quadrant + */ #endif @@ -641,6 +646,9 @@ bool GERBER::Execute_G_Command( char*& text, int G_commande ) { switch( G_commande ) { + case GC_PHOTO_MODE: // can starts a D03 flash command: redundant, can be safely ignored + break; + case GC_LINEAR_INTERPOL_1X: m_Iterpolation = GERB_INTERPOL_LINEAR_1X; break;