Commit a9c1c49b authored by jean-pierre charras's avatar jean-pierre charras

Fixed minor issues in Gerbview

parent f0364c9d
...@@ -606,6 +606,7 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( GERBER_DRAW_ITEM* aParent, ...@@ -606,6 +606,7 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( GERBER_DRAW_ITEM* aParent,
} }
break; break;
case AMP_COMMENT:
case AMP_UNKNOWN: case AMP_UNKNOWN:
case AMP_EOF: case AMP_EOF:
break; break;
...@@ -707,6 +708,7 @@ int AM_PRIMITIVE::GetShapeDim( GERBER_DRAW_ITEM* aParent ) ...@@ -707,6 +708,7 @@ int AM_PRIMITIVE::GetShapeDim( GERBER_DRAW_ITEM* aParent )
dim = scale( params[4].GetValue( tool ), m_GerbMetric ) / 2; // Radius dim = scale( params[4].GetValue( tool ), m_GerbMetric ) / 2; // Radius
break; break;
case AMP_COMMENT:
case AMP_UNKNOWN: case AMP_UNKNOWN:
case AMP_EOF: case AMP_EOF:
break; break;
......
...@@ -44,7 +44,8 @@ ...@@ -44,7 +44,8 @@
* This complex shape is flashed. * This complex shape is flashed.
*/ */
enum AM_PRIMITIVE_ID { enum AM_PRIMITIVE_ID {
AMP_UNKNOWN = 0, // A value for uninitialized AM_PRIMITIVE. AMP_UNKNOWN = -1, // A value for uninitialized AM_PRIMITIVE.
AMP_COMMENT = 0, // A primitive description is not really a primitive, this is a comment
AMP_CIRCLE = 1, // Circle. (diameter and position) AMP_CIRCLE = 1, // Circle. (diameter and position)
AMP_LINE2 = 2, // Line with rectangle ends. (Width, start and end pos + rotation) AMP_LINE2 = 2, // Line with rectangle ends. (Width, start and end pos + rotation)
AMP_LINE20 = 20, // Same as AMP_LINE2 AMP_LINE20 = 20, // Same as AMP_LINE2
......
...@@ -76,9 +76,6 @@ const wxChar* D_CODE::ShowApertureType( APERTURE_T aType ) ...@@ -76,9 +76,6 @@ const wxChar* D_CODE::ShowApertureType( APERTURE_T aType )
case APT_CIRCLE: case APT_CIRCLE:
ret = wxT( "Round" ); break; ret = wxT( "Round" ); break;
case APT_LINE:
ret = wxT( "Line" ); break;
case APT_RECT: case APT_RECT:
ret = wxT( "Rect" ); break; ret = wxT( "Rect" ); break;
...@@ -114,7 +111,6 @@ int D_CODE::GetShapeDim( GERBER_DRAW_ITEM* aParent ) ...@@ -114,7 +111,6 @@ int D_CODE::GetShapeDim( GERBER_DRAW_ITEM* aParent )
switch( m_Shape ) switch( m_Shape )
{ {
case APT_CIRCLE: case APT_CIRCLE:
case APT_LINE:
dim = m_Size.x; dim = m_Size.x;
break; break;
...@@ -300,8 +296,6 @@ void WinEDA_GerberFrame::CopyDCodesSizeToItems() ...@@ -300,8 +296,6 @@ void WinEDA_GerberFrame::CopyDCodesSizeToItems()
{ {
switch( dcode->m_Shape ) switch( dcode->m_Shape )
{ {
case APT_LINE: // might not appears here, but some broken
// gerber files use it
case APT_CIRCLE: /* spot round */ case APT_CIRCLE: /* spot round */
gerb_item->m_Shape = GBR_SPOT_CIRCLE; gerb_item->m_Shape = GBR_SPOT_CIRCLE;
break; break;
...@@ -371,11 +365,6 @@ void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent, ...@@ -371,11 +365,6 @@ void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent,
} }
break; break;
case APT_LINE:
// not used for flashed items
break;
case APT_RECT: case APT_RECT:
{ {
wxPoint start; wxPoint start;
...@@ -514,11 +503,6 @@ void D_CODE::ConvertShapeToPolygon() ...@@ -514,11 +503,6 @@ void D_CODE::ConvertShapeToPolygon()
addHoleToPolygon( m_PolyCorners, m_DrillShape, m_Drill, initialpos ); addHoleToPolygon( m_PolyCorners, m_DrillShape, m_Drill, initialpos );
break; break;
case APT_LINE:
// Not used for flashed shapes
break;
case APT_RECT: case APT_RECT:
currpos.x = m_Size.x / 2; currpos.x = m_Size.x / 2;
currpos.y = m_Size.y / 2; currpos.y = m_Size.y / 2;
......
...@@ -43,7 +43,6 @@ class GERBER_DRAW_ITEM; ...@@ -43,7 +43,6 @@ class GERBER_DRAW_ITEM;
*/ */
enum APERTURE_T { enum APERTURE_T {
APT_CIRCLE = 'C', // Flashed shape: Circle with or without hole APT_CIRCLE = 'C', // Flashed shape: Circle with or without hole
APT_LINE = 'L', // tool to draw line. Not used to flash items
APT_RECT = 'R', // Flashed shape: Rectangle with or without hole APT_RECT = 'R', // Flashed shape: Rectangle with or without hole
APT_OVAL = '0', // Flashed shape: Oval with or without hole APT_OVAL = '0', // Flashed shape: Oval with or without hole
APT_POLYGON = 'P', // Flashed shape: Regular polygon (3 to 12 edges) APT_POLYGON = 'P', // Flashed shape: Regular polygon (3 to 12 edges)
......
...@@ -109,7 +109,6 @@ static void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem, ...@@ -109,7 +109,6 @@ static void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
aGbrItem->m_Shape = GBR_SPOT_POLY; aGbrItem->m_Shape = GBR_SPOT_POLY;
break; break;
case APT_LINE: // Should not be used.
case APT_CIRCLE: case APT_CIRCLE:
aGbrItem->m_Shape = GBR_SPOT_CIRCLE; aGbrItem->m_Shape = GBR_SPOT_CIRCLE;
aGbrItem->m_Size.y = aGbrItem->m_Size.x; aGbrItem->m_Size.y = aGbrItem->m_Size.x;
......
...@@ -873,9 +873,37 @@ bool GERBER_IMAGE::ReadApertureMacro( char buff[GERBER_BUFZ], ...@@ -873,9 +873,37 @@ bool GERBER_IMAGE::ReadApertureMacro( char buff[GERBER_BUFZ],
break; // exit with text still pointing at % break; // exit with text still pointing at %
int paramCount = 0; int paramCount = 0;
int primitive_type = ReadInt( text ); int primitive_type = AMP_UNKNOWN;
// Test for a valid symbol at the beginning of a description:
// it can be: a parameter declaration like $1=$2/4
// or a digit (macro primitive selection)
// all other symbols are illegal.
if( *text == '$' ) // parameter declaration, not yet supported
{
msg.Printf( wxT( "RS274X: Aperture Macro \"%s\": Operator $ not yet supported here, line: \"%s\"" ),
GetChars( am.name ), GetChars( CONV_FROM_UTF8( buff ) ) );
ReportMessage( msg );
primitive_type = AMP_COMMENT;
}
else if( !isdigit(*text) ) // Ill. symbol
{
msg.Printf( wxT( "RS274X: Aperture Macro \"%s\": ill. symbol, line: \"%s\"" ),
GetChars( am.name ), GetChars( CONV_FROM_UTF8( buff ) ) );
ReportMessage( msg );
primitive_type = AMP_COMMENT;
}
else
primitive_type = ReadInt( text );
switch( primitive_type ) switch( primitive_type )
{ {
case 0: // lines starting by 0 are a comment
paramCount = AMP_COMMENT;
// Skip comment
while( *text && (*text != '*') )
text++;
break;
case AMP_CIRCLE: case AMP_CIRCLE:
paramCount = 4; paramCount = 4;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment