From d06d35a74da31a24b9f7017b21ecdcc0b3bd4d09 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 2 Dec 2020 18:42:37 +0000 Subject: [PATCH] Formatting. --- pcbnew/router/pns_item.h | 3 ++- pcbnew/router/pns_kicad_iface.cpp | 18 +++++++++++------- pcbnew/router/pns_line_placer.cpp | 10 +++++----- pcbnew/router/pns_router.cpp | 10 +++------- pcbnew/router/pns_shove.cpp | 20 +++++++++++--------- pcbnew/router/pns_tool_base.cpp | 7 ++++--- pcbnew/router/pns_topology.cpp | 3 ++- 7 files changed, 38 insertions(+), 33 deletions(-) diff --git a/pcbnew/router/pns_item.h b/pcbnew/router/pns_item.h index d8b01d228b..f7c9a37026 100644 --- a/pcbnew/router/pns_item.h +++ b/pcbnew/router/pns_item.h @@ -41,7 +41,8 @@ enum LineMarker { MK_VIOLATION = ( 1 << 3 ), MK_LOCKED = ( 1 << 4 ), MK_DP_COUPLED = ( 1 << 5 ), - MK_ALT_SHAPE = ( 1 << 6 ) + MK_ALT_SHAPE = ( 1 << 6 ) // For instance, a simple annular ring when the pad has + // been dropped from a layer. }; diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index eb3bf04d10..953c7b39d5 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -609,8 +609,10 @@ bool PNS_PCBNEW_RULE_RESOLVER::DpNetPair( const PNS::ITEM* aItem, int& aNetP, in class PNS_PCBNEW_DEBUG_DECORATOR: public PNS::DEBUG_DECORATOR { public: - PNS_PCBNEW_DEBUG_DECORATOR( KIGFX::VIEW* aView = NULL ): PNS::DEBUG_DECORATOR(), - m_view( NULL ), m_items( NULL ) + PNS_PCBNEW_DEBUG_DECORATOR( KIGFX::VIEW* aView = NULL ) : + PNS::DEBUG_DECORATOR(), + m_view( NULL ), + m_items( NULL ) { SetView( aView ); } @@ -636,7 +638,7 @@ public: m_view->Add( m_items ); } - void AddPoint( VECTOR2I aP, int aColor, const std::string aName = "") override + void AddPoint( VECTOR2I aP, int aColor, const std::string aName = "" ) override { SHAPE_LINE_CHAIN l; @@ -652,7 +654,7 @@ public: AddLine( l, aColor, 10000 ); } - void AddBox( BOX2I aB, int aColor, const std::string aName = "" ) override + void AddBox( BOX2I aB, int aColor, const std::string aName = "" ) override { SHAPE_LINE_CHAIN l; @@ -668,7 +670,7 @@ public: AddLine( l, aColor, 10000 ); } - void AddSegment( SEG aS, int aColor, const std::string aName = "") override + void AddSegment( SEG aS, int aColor, const std::string aName = "" ) override { SHAPE_LINE_CHAIN l; @@ -678,7 +680,8 @@ public: AddLine( l, aColor, 10000 ); } - void AddDirections( VECTOR2D aP, int aMask, int aColor, const std::string aName = "") override + void AddDirections( VECTOR2D aP, int aMask, int aColor, + const std::string aName = "" ) override { BOX2I b( aP - VECTOR2I( 10000, 10000 ), VECTOR2I( 20000, 20000 ) ); @@ -693,7 +696,8 @@ public: } } - void AddLine( const SHAPE_LINE_CHAIN& aLine, int aType, int aWidth, const std::string aName = "" ) override + void AddLine( const SHAPE_LINE_CHAIN& aLine, int aType, int aWidth, + const std::string aName = "" ) override { if( !m_view ) return; diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index 9ab22f25a5..8775ec15c0 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -1091,8 +1091,8 @@ bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinis if( aEndItem ) { - // The user has indicated a connection should be made. If either the - // trace or endItem is netless, then allow the connection by adopting the net of the other. + // The user has indicated a connection should be made. If either the trace or + // endItem is net-less, then allow the connection by adopting the net of the other. if( m_currentNet <= 0 ) { m_currentNet = aEndItem->Net(); @@ -1238,8 +1238,8 @@ bool LINE_PLACER::UnfixRoute() m_currentLayer = st.pts[0].layer; m_head.SetLayer( m_currentLayer ); m_tail.SetLayer( m_currentLayer ); - m_head.RemoveVia( ); - m_tail.RemoveVia( ); + m_head.RemoveVia(); + m_tail.RemoveVia(); if (m_shove) { @@ -1306,7 +1306,7 @@ void LINE_PLACER::removeLoops( NODE* aNode, LINE& aLatest ) if( !( line.ContainsLink( seg ) ) && line.SegmentCount() ) { - for( auto ss : line.Links() ) + for( LINKED_ITEM* ss : line.Links() ) toErase.insert( ss ); removedCount++; diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index 15a625593e..c0195c5800 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -337,7 +337,7 @@ void ROUTER::updateView( NODE* aNode, ITEM_SET& aCurrent, bool aDragging ) m_iface->DisplayItem( item, -1, clearance, aDragging ); } - for( auto item : removed ) + for( ITEM* item : removed ) m_iface->HideItem( item ); } @@ -348,9 +348,7 @@ void ROUTER::UpdateSizes( const SIZES_SETTINGS& aSizes ) // Change track/via size settings if( m_state == ROUTE_TRACK) - { m_placer->UpdateSizes( m_sizes ); - } } @@ -390,10 +388,10 @@ void ROUTER::CommitRouting( NODE* aNode ) aNode->GetUpdatedItems( removed, added ); - for( auto item : removed ) + for( ITEM* item : removed ) m_iface->RemoveItem( item ); - for( auto item : added ) + for( ITEM* item : added ) m_iface->AddItem( item ); m_iface->Commit(); @@ -406,9 +404,7 @@ bool ROUTER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinish ) bool rv = false; if( m_logger ) - { m_logger->Log( LOGGER::EVT_FIX, aP, aEndItem ); - } switch( m_state ) { diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp index a10cc5ff33..7274449fea 100644 --- a/pcbnew/router/pns_shove.cpp +++ b/pcbnew/router/pns_shove.cpp @@ -277,7 +277,7 @@ SHOVE::SHOVE_STATUS SHOVE::ProcessSingleLine( LINE& aCurrent, LINE& aObstacle, L bool obstacleIsHead = false; - for( auto s : aObstacle.Links() ) + for( LINKED_ITEM* s : aObstacle.Links() ) { if( s->Marker() & MK_HEAD ) { @@ -302,7 +302,10 @@ SHOVE::SHOVE_STATUS SHOVE::ProcessSingleLine( LINE& aCurrent, LINE& aObstacle, L int clearance = getClearance( &aCurrent, &aObstacle ) + 1; #ifdef DEBUG - Dbg()->Message( wxString::Format( "shove process-single: cur net %d obs %d cl %d", aCurrent.Net(), aObstacle.Net(), clearance ) ); + Dbg()->Message( wxString::Format( "shove process-single: cur net %d obs %d cl %d", + aCurrent.Net(), + aObstacle.Net(), + clearance ) ); #endif HULL_SET hulls; @@ -643,7 +646,7 @@ NODE* SHOVE::reduceSpringback( const ITEM_SET& aHeadSet, VIA_HANDLE& aDraggedVia { SPRINGBACK_TAG& spTag = m_nodeStack.back(); - auto obs = spTag.m_node->CheckColliding( aHeadSet ); + OPT obs = spTag.m_node->CheckColliding( aHeadSet ); if( !obs && !spTag.m_locked ) { @@ -870,7 +873,8 @@ SHOVE::SHOVE_STATUS SHOVE::onCollidingVia( ITEM* aCurrent, VIA* aObstacleVia ) // hole-to-hole is a mechanical constraint (broken drill bits), not an electrical // one, so it has to be checked irrespective of matching nets. - // temporarily removed hole-to-hole collision check due to conflicts with the springback algorithm... + // temporarily removed hole-to-hole collision check due to conflicts with the + // springback algorithm... // we need to figure out a better solution here - TW holeCollision = false; //rr->CollideHoles( ¤tLine->Via(), aObstacleVia, true, &mtvHoles ); } @@ -1015,7 +1019,7 @@ void SHOVE::unwindLineStack( ITEM* aItem ) { LINE* l = static_cast( aItem ); - for( auto seg : l->Links() ) + for( LINKED_ITEM* seg : l->Links() ) unwindLineStack( seg ); } } @@ -1048,7 +1052,7 @@ void SHOVE::popLineStack( ) { bool found = false; - for( auto s : l.Links() ) + for( LINKED_ITEM* s : l.Links() ) { if( i->ContainsLink( s ) ) { @@ -1479,12 +1483,10 @@ SHOVE::SHOVE_STATUS SHOVE::ShoveDraggingVia( const VIA_HANDLE aOldVia, const VEC m_newHead = OPT_LINE(); m_draggedVia = NULL; - auto viaToDrag = findViaByHandle( m_currentNode, aOldVia ); + VIA* viaToDrag = findViaByHandle( m_currentNode, aOldVia ); if( !viaToDrag ) - { return SH_INCOMPLETE; - } // Pop NODEs containing previous shoves which are no longer necessary ITEM_SET headSet; diff --git a/pcbnew/router/pns_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp index 4edf12036b..8567f6ca24 100644 --- a/pcbnew/router/pns_tool_base.cpp +++ b/pcbnew/router/pns_tool_base.cpp @@ -406,12 +406,13 @@ const VECTOR2I TOOL_BASE::snapToItem( bool aEnabled, ITEM* aItem, VECTOR2I aP) { if( aItem->Kind() == ITEM::SEGMENT_T ) { - anchor = m_gridHelper->AlignToSegment( aP, static_cast( li )->Seg() ); + SEGMENT* seg = static_cast( li ); + anchor = m_gridHelper->AlignToSegment( aP, seg->Seg() ); } else if( aItem->Kind() == ITEM::ARC_T ) { - anchor = m_gridHelper->AlignToArc( aP, - *static_cast( static_cast( li )->Shape() ) ); + ARC* arc = static_cast( li ); + anchor = m_gridHelper->AlignToArc( aP, *static_cast( arc->Shape() ) ); } } diff --git a/pcbnew/router/pns_topology.cpp b/pcbnew/router/pns_topology.cpp index ea680f1317..c54d48c153 100644 --- a/pcbnew/router/pns_topology.cpp +++ b/pcbnew/router/pns_topology.cpp @@ -109,7 +109,8 @@ bool TOPOLOGY::LeadingRatLine( const LINE* aTrack, SHAPE_LINE_CHAIN& aRatLine ) if( !jt ) return false; - if( ( !track.EndsWithVia() && jt->LinkCount() >= 2 ) || ( track.EndsWithVia() && jt->LinkCount() >= 3 ) ) // we got something connected + if( ( !track.EndsWithVia() && jt->LinkCount() >= 2 ) + || ( track.EndsWithVia() && jt->LinkCount() >= 3 ) ) // we got something connected { end = jt->Pos(); }