From 95089623a4e8d237bcae068ce9f3789ea4e504f6 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Sun, 5 Apr 2020 18:51:37 -0400 Subject: [PATCH] Eeschema: fix s-expression build errors due to global variable changes. --- eeschema/general.h | 3 +++ eeschema/sch_sexpr_parser.cpp | 2 +- eeschema/sch_sexpr_parser.h | 2 +- eeschema/sch_sexpr_plugin.cpp | 22 +++++++++++++--------- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/eeschema/general.h b/eeschema/general.h index a2eb181fe6..cfcfebaf90 100644 --- a/eeschema/general.h +++ b/eeschema/general.h @@ -57,6 +57,9 @@ class ERC_SETTINGS; ///< The default selection highlight thickness #define DEFAULTSELECTIONTHICKNESS 3 +///< The default line width in mils. +#define DEFAULT_LINE_WIDTH 6 + /* Rotation, mirror of graphic items in components bodies are handled by a * transform matrix. The default matrix is useful to draw lib entries with * using this default matrix ( no rotation, no mirror but Y axis is bottom to top, and diff --git a/eeschema/sch_sexpr_parser.cpp b/eeschema/sch_sexpr_parser.cpp index 911d74da96..29c1dd7898 100644 --- a/eeschema/sch_sexpr_parser.cpp +++ b/eeschema/sch_sexpr_parser.cpp @@ -393,7 +393,7 @@ void SCH_SEXPR_PARSER::parseStroke( STROKE_PARAMS& aStroke ) wxCHECK_RET( CurTok() == T_stroke, wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a stroke." ) ); - aStroke.m_Width = GetDefaultLineThickness(); + aStroke.m_Width = Mils2iu( DEFAULT_LINE_WIDTH ); aStroke.m_Type = PLOT_DASH_TYPE::DEFAULT; aStroke.m_Color = COLOR4D::UNSPECIFIED; diff --git a/eeschema/sch_sexpr_parser.h b/eeschema/sch_sexpr_parser.h index f5bbb5bd13..420f86492f 100644 --- a/eeschema/sch_sexpr_parser.h +++ b/eeschema/sch_sexpr_parser.h @@ -71,7 +71,7 @@ public: PLOT_DASH_TYPE m_Type; COLOR4D m_Color; - STROKE_PARAMS( int aWidth = GetDefaultLineThickness(), + STROKE_PARAMS( int aWidth = Mils2iu( DEFAULT_LINE_WIDTH ), PLOT_DASH_TYPE aType = PLOT_DASH_TYPE::DEFAULT, const COLOR4D& aColor = COLOR4D::UNSPECIFIED ) : m_Width( aWidth ), diff --git a/eeschema/sch_sexpr_plugin.cpp b/eeschema/sch_sexpr_plugin.cpp index b0f39833a7..4551bf250b 100644 --- a/eeschema/sch_sexpr_plugin.cpp +++ b/eeschema/sch_sexpr_plugin.cpp @@ -885,7 +885,8 @@ void SCH_SEXPR_PLUGIN::saveField( SCH_FIELD* aField, int aNestLevel ) FormatInternalUnits( aField->GetPosition().y ).c_str(), FormatAngle( aField->GetTextAngleDegrees() * 10.0 ).c_str() ); - if( !aField->IsDefaultFormatting() || ( aField->GetTextHeight() != GetDefaultTextSize() ) ) + if( !aField->IsDefaultFormatting() + || ( aField->GetTextHeight() != Mils2iu( DEFAULT_SIZE_TEXT ) ) ) { m_out->Print( 0, "\n" ); aField->Format( m_out, aNestLevel, 0 ); @@ -985,7 +986,8 @@ void SCH_SEXPR_PLUGIN::saveSheet( SCH_SHEET* aSheet, int aNestLevel ) FormatInternalUnits( pin->GetPosition().y ).c_str(), FormatAngle( getSheetPinAngle( pin->GetEdge() ) * 10.0 ).c_str() ); - if( !pin->IsDefaultFormatting() || ( pin->GetTextHeight() != GetDefaultTextSize() ) ) + if( !pin->IsDefaultFormatting() + || ( pin->GetTextHeight() != Mils2iu( DEFAULT_SIZE_TEXT ) ) ) { m_out->Print( 0, "\n" ); pin->Format( m_out, aNestLevel + 1, 0 ); @@ -1114,7 +1116,8 @@ void SCH_SEXPR_PLUGIN::saveText( SCH_TEXT* aText, int aNestLevel ) FormatAngle( aText->GetTextAngle() ).c_str() ); } - if( !aText->IsDefaultFormatting() || ( aText->GetTextHeight() != GetDefaultTextSize() ) ) + if( !aText->IsDefaultFormatting() + || ( aText->GetTextHeight() != Mils2iu( DEFAULT_SIZE_TEXT ) ) ) { m_out->Print( 0, "\n" ); aText->Format( m_out, aNestLevel + 1, 0 ); @@ -1606,7 +1609,7 @@ void SCH_SEXPR_PLUGIN_CACHE::saveArc( LIB_ARC* aArc, bool needsSpace = false; bool onNewLine = false; - if( aArc->GetWidth() != 0 ) + if( aArc->GetWidth() != 0 && aArc->GetWidth() != Mils2iu( DEFAULT_LINE_WIDTH ) ) { aFormatter.Print( 0, "\n" ); aFormatter.Print( aNestLevel + 1, "(stroke (width %s))", @@ -1679,7 +1682,7 @@ void SCH_SEXPR_PLUGIN_CACHE::saveBezier( LIB_BEZIER* aBezier, bool needsSpace = false; - if( aBezier->GetWidth() != 0 ) + if( aBezier->GetWidth() != 0 && aBezier->GetWidth() != Mils2iu( DEFAULT_LINE_WIDTH ) ) { aFormatter.Print( aNestLevel + 1, "(stroke (width %s))", FormatInternalUnits( aBezier->GetWidth() ).c_str() ); @@ -1719,7 +1722,7 @@ void SCH_SEXPR_PLUGIN_CACHE::saveCircle( LIB_CIRCLE* aCircle, FormatInternalUnits( aCircle->GetPosition().y ).c_str(), FormatInternalUnits( aCircle->GetRadius() ).c_str() ); - if( aCircle->GetWidth() != 0 ) + if( aCircle->GetWidth() != 0 && aCircle->GetWidth() != Mils2iu( DEFAULT_LINE_WIDTH ) ) { aFormatter.Print( 0, " (stroke (width %s))", FormatInternalUnits( aCircle->GetWidth() ).c_str() ); @@ -1749,7 +1752,8 @@ void SCH_SEXPR_PLUGIN_CACHE::saveField( LIB_FIELD* aField, FormatInternalUnits( aField->GetPosition().y ).c_str(), static_cast( aField->GetTextAngle() ) / 10.0 ); - if( aField->IsDefaultFormatting() && ( aField->GetTextHeight() == GetDefaultTextSize() ) ) + if( aField->IsDefaultFormatting() + && ( aField->GetTextHeight() == Mils2iu( DEFAULT_SIZE_TEXT ) ) ) { aFormatter.Print( 0, ")\n" ); // Close property token if no font effects. } @@ -1866,7 +1870,7 @@ void SCH_SEXPR_PLUGIN_CACHE::savePolyLine( LIB_POLYLINE* aPolyLine, bool needsSpace = false; - if( aPolyLine->GetWidth() != 0 ) + if( aPolyLine->GetWidth() != 0 && aPolyLine->GetWidth() != Mils2iu( DEFAULT_LINE_WIDTH ) ) { aFormatter.Print( aNestLevel + 1, "(stroke (width %s))", FormatInternalUnits( aPolyLine->GetWidth() ).c_str() ); @@ -1910,7 +1914,7 @@ void SCH_SEXPR_PLUGIN_CACHE::saveRectangle( LIB_RECTANGLE* aRectangle, bool needsSpace = false; - if( aRectangle->GetWidth() != 0 ) + if( aRectangle->GetWidth() != 0 && aRectangle->GetWidth() != Mils2iu( DEFAULT_LINE_WIDTH ) ) { aFormatter.Print( 0, " (stroke (width %s))", FormatInternalUnits( aRectangle->GetWidth() ).c_str() );