Gerbview: Gerber attributes display: fix incorrect attributes deletion.

The Gerber attribute deletion command (%TD,xxx) always cleared all attributes,
instead of clearing xxx attribute.
Therefore some attributes were not always displayed.
This commit is contained in:
jean-pierre charras 2020-02-23 09:41:37 +01:00
parent 41f59ab873
commit 7206b567ac
2 changed files with 7 additions and 4 deletions

View File

@ -379,9 +379,10 @@ void GERBER_FILE_IMAGE::RemoveAttribute( X2_ATTRIBUTE& aAttribute )
* if a attribute name is specified (for instance %TD.CN*%) is specified, * if a attribute name is specified (for instance %TD.CN*%) is specified,
* only this attribute is cleared * only this attribute is cleared
*/ */
m_NetAttributeDict.ClearAttribute( &aAttribute.GetPrm( 1 ) ); wxString cmd = aAttribute.GetPrm( 0 );
m_NetAttributeDict.ClearAttribute( &cmd );
if( aAttribute.GetPrm( 1 ).IsEmpty() || aAttribute.GetPrm( 1 ) == ".AperFunction" ) if( cmd.IsEmpty() || cmd == ".AperFunction" )
m_AperFunction.Clear(); m_AperFunction.Clear();
} }

View File

@ -172,8 +172,10 @@ bool GERBER_FILE_IMAGE::ReadRS274XCommand( char *aBuff, unsigned int aBuffSize,
default: default:
code_command = ReadXCommandID( aText ); code_command = ReadXCommandID( aText );
ok = ExecuteRS274XCommand( code_command, aBuff, aBuffSize, aText ); ok = ExecuteRS274XCommand( code_command, aBuff, aBuffSize, aText );
if( !ok ) if( !ok )
goto exit; goto exit;
break; break;
} }
} }
@ -364,7 +366,7 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff,
case FILE_ATTRIBUTE: // Command %TF ... case FILE_ATTRIBUTE: // Command %TF ...
m_IsX2_file = true; m_IsX2_file = true;
{ {
X2_ATTRIBUTE dummy; X2_ATTRIBUTE dummy;
dummy.ParseAttribCmd( m_Current_File, aBuff, aBuffSize, aText, m_LineNum ); dummy.ParseAttribCmd( m_Current_File, aBuff, aBuffSize, aText, m_LineNum );
@ -381,7 +383,7 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff,
{ {
m_PartString = dummy.GetPrm( 1 ); m_PartString = dummy.GetPrm( 1 );
} }
} }
break; break;
case APERTURE_ATTRIBUTE: // Command %TA case APERTURE_ATTRIBUTE: // Command %TA