From a5f5a20722bbe42ceb8259ad49baf198c6d4de04 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 4 Aug 2020 15:57:57 +0100 Subject: [PATCH] Repair formatting. --- pcbnew/eagle_plugin.cpp | 56 +++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 6351ecd20d..4ccaeb3203 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -119,11 +119,15 @@ static wxString interpret_text( const wxString& aText ) { wxString text; bool sectionOpen = false; - for ( wxString::size_type i = 0; i < aText.size(); i++ ) { + + for ( wxString::size_type i = 0; i < aText.size(); i++ ) + { // Interpret escaped characters - if ( aText[ i ] == '\\' ) { + if ( aText[ i ] == '\\' ) + { if ( i + 1 != aText.size() ) text.Append( aText[ i + 1 ] ); + i++; continue; } @@ -136,8 +140,10 @@ static wxString interpret_text( const wxString& aText ) continue; } - if ( aText[ i ] == '!' ) { - if ( sectionOpen ) { + if ( aText[ i ] == '!' ) + { + if ( sectionOpen ) + { text.Append( '~' ); sectionOpen = false; continue; @@ -165,6 +171,7 @@ static wxString interpret_text( const wxString& aText ) text.Append( aText[ i ] ); } + return text; } @@ -948,9 +955,7 @@ void EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLib, const wxString* aLibName ) // add the templating MODULE to the MODULE template factory "m_templates" std::pair r = m_templates.insert( {key, m} ); - if( !r.second - // && !( m_props && m_props->Value( "ignore_duplicates" ) ) - ) + if( !r.second /* && !( m_props && m_props->Value( "ignore_duplicates" ) ) */ ) { wxString lib = aLibName ? *aLibName : m_lib_path; const wxString& pkg = pack_ref; @@ -1242,8 +1247,9 @@ ZONE_CONTAINER* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode ) EPOLYGON p( aPolyNode ); PCB_LAYER_ID layer = kicad_layer( p.layer ); ZONE_CONTAINER* zone = nullptr; - bool keepout = ( p.layer == EAGLE_LAYER::TRESTRICT || p.layer == EAGLE_LAYER::BRESTRICT - || p.layer == EAGLE_LAYER::VRESTRICT ); + bool keepout = ( p.layer == EAGLE_LAYER::TRESTRICT + || p.layer == EAGLE_LAYER::BRESTRICT + || p.layer == EAGLE_LAYER::VRESTRICT ); if( !IsCopperLayer( layer ) && !keepout ) return nullptr; @@ -1971,15 +1977,15 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const for( double a = end_angle + angle; fabs( a - end_angle ) > fabs( delta ); a -= delta ) { - pts.push_back( - wxPoint( KiROUND( radius * cos( a ) ), - KiROUND( radius * sin( a ) ) ) + center ); + pts.push_back( wxPoint( KiROUND( radius * cos( a ) ), + KiROUND( radius * sin( a ) ) ) + center ); } } } - if( p.layer == EAGLE_LAYER::TRESTRICT || p.layer == EAGLE_LAYER::BRESTRICT - || p.layer == EAGLE_LAYER::VRESTRICT ) + if( p.layer == EAGLE_LAYER::TRESTRICT + || p.layer == EAGLE_LAYER::BRESTRICT + || p.layer == EAGLE_LAYER::VRESTRICT ) { MODULE_ZONE_CONTAINER* zone = new MODULE_ZONE_CONTAINER( aModule ); aModule->Add( zone, ADD_MODE::APPEND ); @@ -1990,8 +1996,8 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const outline.SetClosed( true ); zone->Outline()->AddOutline( outline ); - zone->SetHatch( - ZONE_HATCH_STYLE::DIAGONAL_EDGE, ZONE_CONTAINER::GetDefaultHatchPitch(), true ); + zone->SetHatch( ZONE_HATCH_STYLE::DIAGONAL_EDGE, ZONE_CONTAINER::GetDefaultHatchPitch(), + true ); } else { @@ -2007,20 +2013,21 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const dwg->SetStart0( *pts.begin() ); dwg->SetEnd0( pts.back() ); dwg->SetDrawCoord(); - dwg->GetPolyShape().Inflate( - p.width.ToPcbUnits() / 2, 32, SHAPE_POLY_SET::ALLOW_ACUTE_CORNERS ); + dwg->GetPolyShape().Inflate( p.width.ToPcbUnits() / 2, 32, + SHAPE_POLY_SET::ALLOW_ACUTE_CORNERS ); } } void EAGLE_PLUGIN::packageCircle( MODULE* aModule, wxXmlNode* aTree ) const { - ECIRCLE e( aTree ); + ECIRCLE e( aTree ); int width = e.width.ToPcbUnits(); int radius = e.radius.ToPcbUnits(); - if( e.layer == EAGLE_LAYER::TRESTRICT || e.layer == EAGLE_LAYER::BRESTRICT - || e.layer == EAGLE_LAYER::VRESTRICT ) + if( e.layer == EAGLE_LAYER::TRESTRICT + || e.layer == EAGLE_LAYER::BRESTRICT + || e.layer == EAGLE_LAYER::VRESTRICT ) { MODULE_ZONE_CONTAINER* zone = new MODULE_ZONE_CONTAINER( aModule ); aModule->Add( zone, ADD_MODE::APPEND ); @@ -2049,8 +2056,8 @@ void EAGLE_PLUGIN::packageCircle( MODULE* aModule, wxXmlNode* aTree ) const } } - zone->SetHatch( - ZONE_HATCH_STYLE::DIAGONAL_EDGE, ZONE_CONTAINER::GetDefaultHatchPitch(), true ); + zone->SetHatch( ZONE_HATCH_STYLE::DIAGONAL_EDGE, ZONE_CONTAINER::GetDefaultHatchPitch(), + true ); } else { @@ -2299,7 +2306,8 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals ) // If we are curving, we need at least 2 segments otherwise // delta_angle == angle int segments = std::max( 2, GetArcToSegmentCount( KiROUND( radius ), - ARC_HIGH_DEF, *w.curve ) - 1 ); + ARC_HIGH_DEF, + *w.curve ) - 1 ); delta_angle = angle / segments; }