Cleanup formatting.
This commit is contained in:
parent
0ebea4be53
commit
17c9f7c61f
|
@ -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<wxString> 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 );
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -22,9 +22,7 @@
|
|||
*/
|
||||
|
||||
#include <preview_items/centreline_rect_item.h>
|
||||
|
||||
#include <preview_items/two_point_geom_manager.h>
|
||||
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <view/view.h>
|
||||
|
||||
|
@ -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() );
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
*/
|
||||
|
||||
#include <preview_items/ruler_item.h>
|
||||
|
||||
#include <preview_items/preview_utils.h>
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
|
@ -30,8 +29,6 @@
|
|||
#include <view/view.h>
|
||||
#include <trigo.h>
|
||||
|
||||
#include <common.h>
|
||||
|
||||
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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue