From 17c9f7c61fe1b890b0db31a8aeff8791438fb7fa Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 7 Nov 2020 21:21:56 +0000 Subject: [PATCH] Cleanup formatting. --- common/preview_items/arc_assistant.cpp | 18 ++++++++++-------- common/preview_items/arc_geom_manager.cpp | 16 ++++++---------- common/preview_items/bright_box.cpp | 2 +- common/preview_items/centreline_rect_item.cpp | 17 ++++++----------- common/preview_items/polygon_geom_manager.cpp | 6 ++---- common/preview_items/polygon_item.cpp | 8 ++++---- common/preview_items/ruler_item.cpp | 5 +---- common/preview_items/selection_area.cpp | 7 ++++--- common/preview_items/simple_overlay_item.cpp | 2 +- common/preview_items/two_point_assistant.cpp | 8 ++++---- 10 files changed, 39 insertions(+), 50 deletions(-) diff --git a/common/preview_items/arc_assistant.cpp b/common/preview_items/arc_assistant.cpp index be3d77916c..e0493bc94f 100644 --- a/common/preview_items/arc_assistant.cpp +++ b/common/preview_items/arc_assistant.cpp @@ -35,8 +35,10 @@ using namespace KIGFX::PREVIEW; -ARC_ASSISTANT::ARC_ASSISTANT( const ARC_GEOM_MANAGER& aManager, EDA_UNITS aUnits ) - : EDA_ITEM( NOT_USED ), m_constructMan( aManager ), m_units( aUnits ) +ARC_ASSISTANT::ARC_ASSISTANT( const ARC_GEOM_MANAGER& aManager, EDA_UNITS aUnits ) : + EDA_ITEM( NOT_USED ), + m_constructMan( aManager ), + m_units( aUnits ) { } @@ -79,7 +81,7 @@ double getNormDeciDegFromRad( double aRadians ) void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const { - auto& gal = *aView->GetGAL(); + KIGFX::GAL& gal = *aView->GetGAL(); // not in a position to draw anything if( m_constructMan.IsReset() ) @@ -87,15 +89,15 @@ void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const gal.ResetTextAttributes(); - const auto origin = m_constructMan.GetOrigin(); + const VECTOR2I origin = m_constructMan.GetOrigin(); KIGFX::PREVIEW::DRAW_CONTEXT preview_ctx( *aView ); // draw first radius line bool dimFirstLine = m_constructMan.GetStep() > ARC_GEOM_MANAGER::SET_START; - preview_ctx.DrawLineWithAngleHighlight( - origin, m_constructMan.GetStartRadiusEnd(), dimFirstLine ); + preview_ctx.DrawLineWithAngleHighlight( origin, m_constructMan.GetStartRadiusEnd(), + dimFirstLine ); std::vector cursorStrings; @@ -134,6 +136,6 @@ void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const // place the text next to cursor, on opposite side from radius DrawTextNextToCursor( aView, m_constructMan.GetLastPoint(), - origin - m_constructMan.GetLastPoint(), - cursorStrings, aLayer == LAYER_SELECT_OVERLAY ); + origin - m_constructMan.GetLastPoint(), cursorStrings, + aLayer == LAYER_SELECT_OVERLAY ); } diff --git a/common/preview_items/arc_geom_manager.cpp b/common/preview_items/arc_geom_manager.cpp index 8e330e3418..eabf4e5c39 100644 --- a/common/preview_items/arc_geom_manager.cpp +++ b/common/preview_items/arc_geom_manager.cpp @@ -39,14 +39,10 @@ bool ARC_GEOM_MANAGER::acceptPoint( const VECTOR2I& aPt ) { switch( getStep() ) { - case SET_ORIGIN: - return setOrigin( aPt ); - case SET_START: - return setStart( aPt ); - case SET_ANGLE: - return setEnd( aPt ); - case COMPLETE: - break; + case SET_ORIGIN: return setOrigin( aPt ); + case SET_START: return setStart( aPt ); + case SET_ANGLE: return setEnd( aPt ); + case COMPLETE: return false; } return false; @@ -130,7 +126,7 @@ bool ARC_GEOM_MANAGER::setOrigin( const VECTOR2I& aOrigin ) bool ARC_GEOM_MANAGER::setStart( const VECTOR2I& aEnd ) { - const auto radVec = aEnd - m_origin; + const VECTOR2I radVec = aEnd - m_origin; m_radius = radVec.EuclideanNorm(); m_startAngle = radVec.Angle(); @@ -150,7 +146,7 @@ bool ARC_GEOM_MANAGER::setStart( const VECTOR2I& aEnd ) bool ARC_GEOM_MANAGER::setEnd( const VECTOR2I& aCursor ) { - const auto radVec = aCursor - m_origin; + const VECTOR2I radVec = aCursor - m_origin; m_endAngle = radVec.Angle(); diff --git a/common/preview_items/bright_box.cpp b/common/preview_items/bright_box.cpp index 099fd03b4f..45359cb438 100644 --- a/common/preview_items/bright_box.cpp +++ b/common/preview_items/bright_box.cpp @@ -44,7 +44,7 @@ void BRIGHT_BOX::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const if( !m_item ) return; - auto gal = aView->GetGAL(); + KIGFX::GAL* gal = aView->GetGAL(); gal->SetIsStroke( true ); gal->SetIsFill( false ); diff --git a/common/preview_items/centreline_rect_item.cpp b/common/preview_items/centreline_rect_item.cpp index dbe85a1357..8a56aea391 100644 --- a/common/preview_items/centreline_rect_item.cpp +++ b/common/preview_items/centreline_rect_item.cpp @@ -22,9 +22,7 @@ */ #include - #include - #include #include @@ -74,20 +72,17 @@ static SHAPE_POLY_SET getRectangleAlongCentreLine( const VECTOR2D& aClStart, } -CENTRELINE_RECT_ITEM::CENTRELINE_RECT_ITEM( - const TWO_POINT_GEOMETRY_MANAGER& aGeomMgr, - double aAspect ): - m_geomMgr( aGeomMgr ), - m_aspect( aAspect ) +CENTRELINE_RECT_ITEM::CENTRELINE_RECT_ITEM( const TWO_POINT_GEOMETRY_MANAGER& aGeomMgr, + double aAspect ) : + m_geomMgr( aGeomMgr ), + m_aspect( aAspect ) { } SHAPE_POLY_SET CENTRELINE_RECT_ITEM::getOutline() const { - return getRectangleAlongCentreLine( m_geomMgr.GetOrigin(), - m_geomMgr.GetEnd(), - m_aspect ); + return getRectangleAlongCentreLine( m_geomMgr.GetOrigin(), m_geomMgr.GetEnd(), m_aspect ); } @@ -99,7 +94,7 @@ const BOX2I CENTRELINE_RECT_ITEM::ViewBBox() const void CENTRELINE_RECT_ITEM::drawPreviewShape( KIGFX::VIEW* aView ) const { - auto& gal = *aView->GetGAL(); + KIGFX::GAL& gal = *aView->GetGAL(); gal.DrawLine( m_geomMgr.GetOrigin(), m_geomMgr.GetEnd() ); gal.DrawPolygon( getOutline() ); diff --git a/common/preview_items/polygon_geom_manager.cpp b/common/preview_items/polygon_geom_manager.cpp index 174cd40192..aaeffa0e37 100644 --- a/common/preview_items/polygon_geom_manager.cpp +++ b/common/preview_items/polygon_geom_manager.cpp @@ -88,8 +88,10 @@ bool POLYGON_GEOM_MANAGER::IsSelfIntersecting( bool aIncludeLeaderPts ) const if( aIncludeLeaderPts ) { for( int i = 0; i < m_leaderPts.PointCount(); ++i ) + { if( m_leaderPts.CPoint( i ) != pts.CPoint( 0 ) ) pts.Append( m_leaderPts.CPoint( i ) ); + } } // line chain needs to be set as closed for proper checks @@ -120,16 +122,12 @@ bool POLYGON_GEOM_MANAGER::NewPointClosesOutline( const VECTOR2I& aPt ) const void POLYGON_GEOM_MANAGER::DeleteLastCorner() { if( m_lockedPoints.PointCount() > 0 ) - { m_lockedPoints.Remove( m_lockedPoints.PointCount() - 1 ); - } // update the new last segment (was previously // locked in), reusing last constraints if( m_lockedPoints.PointCount() > 0 ) - { updateLeaderPoints( m_leaderPts.CLastPoint() ); - } m_client.OnGeometryChange( *this ); } diff --git a/common/preview_items/polygon_item.cpp b/common/preview_items/polygon_item.cpp index 6f0f57bd9f..6f751f4d3f 100644 --- a/common/preview_items/polygon_item.cpp +++ b/common/preview_items/polygon_item.cpp @@ -29,7 +29,7 @@ using namespace KIGFX::PREVIEW; const double POLYGON_ITEM::POLY_LINE_WIDTH = 1; -POLYGON_ITEM::POLYGON_ITEM(): +POLYGON_ITEM::POLYGON_ITEM() : SIMPLE_OVERLAY_ITEM() { } @@ -54,8 +54,8 @@ void POLYGON_ITEM::SetPoints( const SHAPE_LINE_CHAIN& aLockedInPts, void POLYGON_ITEM::drawPreviewShape( KIGFX::VIEW* aView ) const { - auto& gal = *aView->GetGAL(); - auto rs = aView->GetPainter()->GetSettings(); + KIGFX::GAL& gal = *aView->GetGAL(); + RENDER_SETTINGS* renderSettings = aView->GetPainter()->GetSettings(); if( m_lockedChain.PointCount() >= 2 ) { @@ -66,7 +66,7 @@ void POLYGON_ITEM::drawPreviewShape( KIGFX::VIEW* aView ) const // draw the leader line in a different color if( m_leaderChain.PointCount() >= 2 ) { - gal.SetStrokeColor( rs->GetLayerColor( LAYER_AUX_ITEMS ) ); + gal.SetStrokeColor( renderSettings->GetLayerColor( LAYER_AUX_ITEMS ) ); gal.DrawPolyline( m_leaderChain ); } diff --git a/common/preview_items/ruler_item.cpp b/common/preview_items/ruler_item.cpp index 0302ecc030..ddcbdc918d 100644 --- a/common/preview_items/ruler_item.cpp +++ b/common/preview_items/ruler_item.cpp @@ -22,7 +22,6 @@ */ #include - #include #include #include @@ -30,8 +29,6 @@ #include #include -#include - using namespace KIGFX::PREVIEW; static const double maxTickDensity = 10.0; // min pixels between tick marks @@ -181,7 +178,7 @@ void drawTicksAlongLine( KIGFX::GAL* aGal, const VECTOR2D& aOrigin, const VECTOR for( int i = 0; i < numTicks; ++i ) { - const auto tickPos = aOrigin + aLine.Resize( tickSpace * i ); + const VECTOR2D tickPos = aOrigin + aLine.Resize( tickSpace * i ); double length = aMinorTickLen; bool drawLabel = false; diff --git a/common/preview_items/selection_area.cpp b/common/preview_items/selection_area.cpp index 511a7b68dd..ccfb27ef85 100644 --- a/common/preview_items/selection_area.cpp +++ b/common/preview_items/selection_area.cpp @@ -84,10 +84,11 @@ const BOX2I SELECTION_AREA::ViewBBox() const void SELECTION_AREA::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const { - auto& gal = *aView->GetGAL(); - auto rs = aView->GetPainter()->GetSettings(); + KIGFX::GAL& gal = *aView->GetGAL(); + RENDER_SETTINGS* settings = aView->GetPainter()->GetSettings(); - const auto& scheme = rs->IsBackgroundDark() ? selectionColorScheme[0] : selectionColorScheme[1]; + const SELECTION_COLORS& scheme = settings->IsBackgroundDark() ? selectionColorScheme[0] + : selectionColorScheme[1]; // Set the fill of the selection rectangle // based on the selection mode diff --git a/common/preview_items/simple_overlay_item.cpp b/common/preview_items/simple_overlay_item.cpp index e1b5f0c26a..2707546b5d 100644 --- a/common/preview_items/simple_overlay_item.cpp +++ b/common/preview_items/simple_overlay_item.cpp @@ -41,7 +41,7 @@ SIMPLE_OVERLAY_ITEM::SIMPLE_OVERLAY_ITEM(): void SIMPLE_OVERLAY_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const { - auto& gal = *aView->GetGAL(); + KIGFX::GAL& gal = *aView->GetGAL(); setupGal( gal ); drawPreviewShape( aView ); diff --git a/common/preview_items/two_point_assistant.cpp b/common/preview_items/two_point_assistant.cpp index 58abcde5f3..29191c5a14 100644 --- a/common/preview_items/two_point_assistant.cpp +++ b/common/preview_items/two_point_assistant.cpp @@ -56,15 +56,15 @@ const BOX2I TWO_POINT_ASSISTANT::ViewBBox() const void TWO_POINT_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const { - auto& gal = *aView->GetGAL(); + KIGFX::GAL& gal = *aView->GetGAL(); // not in a position to draw anything if( m_constructMan.IsReset() ) return; - const auto origin = m_constructMan.GetOrigin(); - const auto end = m_constructMan.GetEnd(); - const auto radVec = end - origin; + const VECTOR2I origin = m_constructMan.GetOrigin(); + const VECTOR2I end = m_constructMan.GetEnd(); + const VECTOR2I radVec = end - origin; if( radVec.x == 0 && radVec.y == 0 ) {