Commit 4019284e authored by Wayne Stambaugh's avatar Wayne Stambaugh

Minor Pcbnew s-expression improvements.

* Put text effects on a single line.
* Remove size token when defining drill sizes.
* Don't save net in pad definition when pad has no connection.
parent e06ce757
...@@ -344,12 +344,12 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl ...@@ -344,12 +344,12 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
{ {
if( !IsDefaultFormatting() ) if( !IsDefaultFormatting() )
{ {
aFormatter->Print( aNestLevel+1, "(effects\n" ); aFormatter->Print( aNestLevel+1, "(effects" );
if( ( m_Size.x != DEFAULT_SIZE_TEXT ) || ( m_Size.y != DEFAULT_SIZE_TEXT ) || m_Bold if( ( m_Size.x != DEFAULT_SIZE_TEXT ) || ( m_Size.y != DEFAULT_SIZE_TEXT ) || m_Bold
|| m_Italic ) || m_Italic )
{ {
aFormatter->Print( aNestLevel+2, "(font" ); aFormatter->Print( 0, " (font" );
// Add font support here at some point in the future. // Add font support here at some point in the future.
...@@ -366,13 +366,13 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl ...@@ -366,13 +366,13 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
if( IsItalic() ) if( IsItalic() )
aFormatter->Print( 0, " italic" ); aFormatter->Print( 0, " italic" );
aFormatter->Print( 0, ")\n"); aFormatter->Print( 0, ")");
} }
if( m_Mirror || ( m_HJustify != GR_TEXT_HJUSTIFY_CENTER ) if( m_Mirror || ( m_HJustify != GR_TEXT_HJUSTIFY_CENTER )
|| ( m_VJustify != GR_TEXT_VJUSTIFY_CENTER ) ) || ( m_VJustify != GR_TEXT_VJUSTIFY_CENTER ) )
{ {
aFormatter->Print( aNestLevel+2, "(justify"); aFormatter->Print( 0, " (justify");
if( m_HJustify != GR_TEXT_HJUSTIFY_CENTER ) if( m_HJustify != GR_TEXT_HJUSTIFY_CENTER )
aFormatter->Print( 0, (m_HJustify == GR_TEXT_HJUSTIFY_LEFT) ? " left" : " right" ); aFormatter->Print( 0, (m_HJustify == GR_TEXT_HJUSTIFY_LEFT) ? " left" : " right" );
...@@ -383,13 +383,13 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl ...@@ -383,13 +383,13 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
if( m_Mirror ) if( m_Mirror )
aFormatter->Print( 0, " mirror" ); aFormatter->Print( 0, " mirror" );
aFormatter->Print( 0, ")\n" ); aFormatter->Print( 0, ")" );
} }
// As of now the only place this is used is in Eeschema to hide or show the text. // As of now the only place this is used is in Eeschema to hide or show the text.
if( m_Attributs ) if( m_Attributs )
aFormatter->Print( aNestLevel+2, "hide\n" ); aFormatter->Print( 0, " hide" );
aFormatter->Print( aNestLevel+1, ")\n" ); aFormatter->Print( 0, ")\n" );
} }
} }
...@@ -770,8 +770,11 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const ...@@ -770,8 +770,11 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
if( aPad->GetDrillShape() == PAD_OVAL ) if( aPad->GetDrillShape() == PAD_OVAL )
m_out->Print( 0, " oval" ); m_out->Print( 0, " oval" );
m_out->Print( 0, " (size %s)", (sz.GetHeight() != sz.GetWidth()) ? FMT_IU( sz ).c_str() : if( sz.GetWidth() > 0 )
FMT_IU( sz.GetWidth() ).c_str() ); m_out->Print( 0, " %s", FMT_IU( sz.GetWidth() ).c_str() );
if( sz.GetHeight() > 0 && sz.GetWidth() != sz.GetHeight() )
m_out->Print( 0, " %s", FMT_IU( sz.GetHeight() ).c_str() );
if( (aPad->GetOffset().x != 0) || (aPad->GetOffset().y != 0) ) if( (aPad->GetOffset().x != 0) || (aPad->GetOffset().y != 0) )
m_out->Print( 0, " (offset %s)", FMT_IU( aPad->GetOffset() ).c_str() ); m_out->Print( 0, " (offset %s)", FMT_IU( aPad->GetOffset() ).c_str() );
...@@ -799,8 +802,12 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const ...@@ -799,8 +802,12 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
m_out->Print( 0, ")\n" ); m_out->Print( 0, ")\n" );
m_out->Print( aNestLevel+1, "(net %d %s)\n", // Unconnected pad is default net so don't save it.
aPad->GetNet(), m_out->Quotew( aPad->GetNetname() ).c_str() ); if( aPad->GetNet() != 0 )
{
m_out->Print( aNestLevel+1, "(net %d %s)\n",
aPad->GetNet(), m_out->Quotew( aPad->GetNetname() ).c_str() );
}
if( aPad->GetDieLength() != 0 ) if( aPad->GetDieLength() != 0 )
m_out->Print( aNestLevel+1, "(die_length %s)\n", m_out->Print( aNestLevel+1, "(die_length %s)\n",
......
...@@ -2022,6 +2022,9 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR ) ...@@ -2022,6 +2022,9 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR )
case T_drill: case T_drill:
{ {
bool haveWidth = false;
wxSize drillSize = pad->GetDrillSize();
for( token = NextTok(); token != T_RIGHT; token = NextTok() ) for( token = NextTok(); token != T_RIGHT; token = NextTok() )
{ {
if( token == T_LEFT ) if( token == T_LEFT )
...@@ -2033,23 +2036,21 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR ) ...@@ -2033,23 +2036,21 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR )
pad->SetDrillShape( PAD_OVAL ); pad->SetDrillShape( PAD_OVAL );
break; break;
case T_size: case T_NUMBER:
{ {
int width = parseBoardUnits( "drill width" ); if( !haveWidth )
int height = width;
token = NextTok();
if( token == T_NUMBER )
{ {
height = parseBoardUnits(); drillSize.SetWidth( parseBoardUnits() );
NeedRIGHT();
// If height is not defined the width and height are the same.
drillSize.SetHeight( drillSize.GetWidth() );
haveWidth = true;
} }
else if( token != T_RIGHT ) else
{ {
Expecting( ") or number" ); drillSize.SetHeight( parseBoardUnits() );
} }
pad->SetDrillSize( wxSize( width, height ) );
break; break;
} }
...@@ -2064,6 +2065,7 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR ) ...@@ -2064,6 +2065,7 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR )
} }
} }
pad->SetDrillSize( drillSize );
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