Coding style and lint fixes.

This commit is contained in:
Jeff Young 2018-09-19 21:52:13 +01:00
parent 06e63c3073
commit 6e2b7521d0
1 changed files with 43 additions and 40 deletions

View File

@ -173,8 +173,7 @@ bool SCH_PAINTER::Draw( const VIEW_ITEM *aItem, int aLayer )
HANDLE_ITEM(SCH_BITMAP_T, SCH_BITMAP);
HANDLE_ITEM(SCH_MARKER_T, SCH_MARKER);
default:
return false;
default: return false;
}
return false;
@ -339,6 +338,7 @@ void SCH_PAINTER::draw( LIB_CIRCLE *aCircle, int aLayer )
m_gal->DrawCircle( mapCoords( aCircle->GetPosition() ), aCircle->GetRadius() );
}
void SCH_PAINTER::draw( LIB_ARC *aArc, int aLayer )
{
if( !isUnitAndConversionShown( aArc ) )
@ -545,8 +545,6 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer, bool isDangling, bool isMovin
break;
}
//printf("pin %p p0 %d %d pos %d %d len %d\n", aPin, p0.x, p0.y, pos.x, pos.y, len);
VECTOR2D pc;
m_gal->SetIsStroke( true );
@ -735,14 +733,14 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer, bool isDangling, bool isMovin
SET_DC( ABOVE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( -len / 2, -aboveOffset ), 0 );
m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( -len / 2.0, -aboveOffset ), 0 );
}
if( size[BELOW] )
{
SET_DC( BELOW );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
m_gal->StrokeText( text[BELOW], pos + VECTOR2D( -len / 2, belowOffset ), 0 );
m_gal->StrokeText( text[BELOW], pos + VECTOR2D( -len / 2.0, belowOffset ), 0 );
}
break;
@ -767,14 +765,14 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer, bool isDangling, bool isMovin
SET_DC( ABOVE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( len / 2, -aboveOffset ), 0 );
m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( len / 2.0, -aboveOffset ), 0 );
}
if( size[BELOW] )
{
SET_DC( BELOW );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
m_gal->StrokeText( text[BELOW], pos + VECTOR2D( len / 2, belowOffset ), 0 );
m_gal->StrokeText( text[BELOW], pos + VECTOR2D( len / 2.0, belowOffset ), 0 );
}
break;
@ -798,14 +796,14 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer, bool isDangling, bool isMovin
SET_DC( ABOVE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, len / 2 ), M_PI / 2 );
m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, len / 2.0 ), M_PI / 2 );
}
if( size[BELOW] )
{
SET_DC( BELOW );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
m_gal->StrokeText( text[BELOW], pos + VECTOR2D( belowOffset, len / 2 ), M_PI / 2 );
m_gal->StrokeText( text[BELOW], pos + VECTOR2D( belowOffset, len / 2.0 ), M_PI / 2 );
}
break;
@ -829,16 +827,19 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer, bool isDangling, bool isMovin
SET_DC( ABOVE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, -len / 2 ), M_PI / 2 );
m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, -len / 2.0 ), M_PI / 2 );
}
if( size[BELOW] )
{
SET_DC( BELOW );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
m_gal->StrokeText( text[BELOW], pos + VECTOR2D( belowOffset, -len / 2 ), M_PI / 2 );
m_gal->StrokeText( text[BELOW], pos + VECTOR2D( belowOffset, -len / 2.0 ), M_PI / 2 );
}
break;
default:
wxFAIL_MSG( "Unknown pin orientation" );
}
}
@ -868,7 +869,7 @@ void SCH_PAINTER::draw( SCH_JUNCTION *aJct, int aLayer )
m_gal->SetIsFill(true);
m_gal->SetStrokeColor( color );
m_gal->SetFillColor( color );
m_gal->DrawCircle( aJct->GetPosition(), aJct->GetEffectiveSymbolSize() / 2 );
m_gal->DrawCircle( aJct->GetPosition(), SCH_JUNCTION::GetEffectiveSymbolSize() / 2.0 );
}
@ -904,6 +905,7 @@ void SCH_PAINTER::draw( SCH_LINE *aLine, int aLayer )
switch( aLine->GetLineStyle() )
{
default:
case PLOTDASHTYPE_DASH:
strokes[0] = strokes[2] = DASH_MARK_LEN( width );
break;
@ -1045,14 +1047,14 @@ void SCH_PAINTER::draw( SCH_COMPONENT *aComp, int aLayer )
// Use dummy part if the actual couldn't be found (or couldn't be locked).
// In either case copy it so we can re-orient and translate it.
std::unique_ptr<LIB_PART> ptrans( new LIB_PART( part ? *part.get() : *dummy() ) );
std::unique_ptr<LIB_PART> temp( new LIB_PART( part ? *part.get() : *dummy() ) );
if( aComp->IsMoving() )
ptrans->SetFlags( IS_MOVED );
temp->SetFlags( IS_MOVED );
orientComponent( ptrans.get(), aComp->GetOrientation() );
orientComponent( temp.get(), aComp->GetOrientation() );
for( auto& item : ptrans->GetDrawItems() )
for( auto& item : temp->GetDrawItems() )
{
if( aComp->IsMoving() )
item.SetFlags( IS_MOVED );
@ -1062,7 +1064,7 @@ void SCH_PAINTER::draw( SCH_COMPONENT *aComp, int aLayer )
item.Move( wxPoint( rp.x + ip.x, ip.y - rp.y ) );
}
draw( ptrans.get(), aLayer, false,
draw( temp.get(), aLayer, false,
aComp->GetUnit(), aComp->GetConvert(), aComp->GetDanglingPinFlags() );
// The fields are SCH_COMPONENT-specific and so don't need to be copied/
@ -1114,7 +1116,7 @@ void SCH_PAINTER::draw( SCH_FIELD *aField, int aLayer )
lineWidth = Clamp_Text_PenSize( lineWidth, aField->GetTextSize(), aField->IsBold() );
// Calculate the text orientation according to the component orientation.
orient = aField->GetTextAngle();
orient = (int) aField->GetTextAngle();
if( parentComponent->GetTransform().y1 ) // Rotate component 90 degrees.
{
@ -1166,7 +1168,7 @@ void SCH_PAINTER::draw( SCH_GLOBALLABEL *aLabel, int aLayer )
aLabel->CreateGraphicShape( pts, aLabel->GetTextPos() );
for( auto p : pts )
pts2.push_back( VECTOR2D( p.x, p.y ) );
pts2.emplace_back( VECTOR2D( p.x, p.y ) );
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
@ -1192,7 +1194,7 @@ void SCH_PAINTER::draw( SCH_HIERLABEL *aLabel, int aLayer )
aLabel->CreateGraphicShape( pts, aLabel->GetTextPos() );
for( auto p : pts )
pts2.push_back( VECTOR2D( p.x, p.y ) );
pts2.emplace_back( VECTOR2D( p.x, p.y ) );
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
@ -1328,7 +1330,8 @@ void SCH_PAINTER::draw( SCH_MARKER *aMarker, int aLayer )
const int scale = aMarker->m_ScalingFactor;
// If you are changing this, update the bounding box as well
const VECTOR2D arrow[] = {
const VECTOR2D arrow[] =
{
VECTOR2D( 0 * scale, 0 * scale ),
VECTOR2D( 8 * scale, 1 * scale ),
VECTOR2D( 4 * scale, 3 * scale ),