diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 1c364eff20..df83ecb477 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -344,12 +344,12 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl { 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 || m_Italic ) { - aFormatter->Print( aNestLevel+2, "(font" ); + aFormatter->Print( 0, " (font" ); // Add font support here at some point in the future. @@ -366,13 +366,13 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl if( IsItalic() ) aFormatter->Print( 0, " italic" ); - aFormatter->Print( 0, ")\n"); + aFormatter->Print( 0, ")"); } if( m_Mirror || ( m_HJustify != GR_TEXT_HJUSTIFY_CENTER ) || ( m_VJustify != GR_TEXT_VJUSTIFY_CENTER ) ) { - aFormatter->Print( aNestLevel+2, "(justify"); + aFormatter->Print( 0, " (justify"); if( m_HJustify != GR_TEXT_HJUSTIFY_CENTER ) 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 if( m_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. if( m_Attributs ) - aFormatter->Print( aNestLevel+2, "hide\n" ); + aFormatter->Print( 0, " hide" ); - aFormatter->Print( aNestLevel+1, ")\n" ); + aFormatter->Print( 0, ")\n" ); } } diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 48f17ed166..5ff61d02da 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -770,8 +770,11 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const if( aPad->GetDrillShape() == PAD_OVAL ) m_out->Print( 0, " oval" ); - m_out->Print( 0, " (size %s)", (sz.GetHeight() != sz.GetWidth()) ? FMT_IU( sz ).c_str() : - FMT_IU( sz.GetWidth() ).c_str() ); + if( sz.GetWidth() > 0 ) + 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) ) 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 m_out->Print( 0, ")\n" ); - m_out->Print( aNestLevel+1, "(net %d %s)\n", - aPad->GetNet(), m_out->Quotew( aPad->GetNetname() ).c_str() ); + // Unconnected pad is default net so don't save it. + 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 ) m_out->Print( aNestLevel+1, "(die_length %s)\n", diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 16492fd168..4652ad45d3 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -2022,6 +2022,9 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR ) case T_drill: { + bool haveWidth = false; + wxSize drillSize = pad->GetDrillSize(); + for( token = NextTok(); token != T_RIGHT; token = NextTok() ) { if( token == T_LEFT ) @@ -2033,23 +2036,21 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR ) pad->SetDrillShape( PAD_OVAL ); break; - case T_size: + case T_NUMBER: { - int width = parseBoardUnits( "drill width" ); - int height = width; - token = NextTok(); + if( !haveWidth ) + { + drillSize.SetWidth( parseBoardUnits() ); - if( token == T_NUMBER ) - { - height = 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; } @@ -2064,6 +2065,7 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR ) } } + pad->SetDrillSize( drillSize ); break; }