Eeschema: make draw functions working with "old" libraries using a useless large negative line width (like -1000 or -2000 mils).

They are now clamped to -1.

This is only a workaround to avoid ugly artifacts
This commit is contained in:
jean-pierre charras 2018-10-20 13:08:33 +02:00
parent 1116acd74b
commit 576a0af293
6 changed files with 43 additions and 7 deletions

View File

@ -309,7 +309,13 @@ void LIB_ARC::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
int LIB_ARC::GetPenSize() const
{
return ( m_Width == 0 ) ? GetDefaultLineThickness() : m_Width;
if( m_Width > 0 )
return m_Width;
if( m_Width == 0 )
return GetDefaultLineThickness();
return -1; // a value to use a minimal pen size
}

View File

@ -200,7 +200,13 @@ void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
int LIB_BEZIER::GetPenSize() const
{
return ( m_Width == 0 ) ? GetDefaultLineThickness() : m_Width;
if( m_Width > 0 )
return m_Width;
if( m_Width == 0 )
return GetDefaultLineThickness();
return -1; // a value to use a minimal pen size
}

View File

@ -164,7 +164,13 @@ void LIB_CIRCLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
int LIB_CIRCLE::GetPenSize() const
{
return ( m_Width == 0 ) ? GetDefaultLineThickness() : m_Width;
if( m_Width > 0 )
return m_Width;
if( m_Width == 0 )
return GetDefaultLineThickness();
return -1; // a value to use a minimal pen size
}

View File

@ -563,7 +563,13 @@ bool LIB_PIN::HitTest( const wxPoint &aPosition, int aThreshold, const TRANSFORM
int LIB_PIN::GetPenSize() const
{
return ( m_width == 0 ) ? GetDefaultLineThickness() : m_width;
if( m_width > 0 )
return m_width;
if( m_width == 0 )
return GetDefaultLineThickness();
return 0;
}

View File

@ -176,7 +176,13 @@ void LIB_POLYLINE::AddPoint( const wxPoint& point )
int LIB_POLYLINE::GetPenSize() const
{
return ( m_Width == 0 ) ? GetDefaultLineThickness() : m_Width;
if( m_Width > 0 )
return m_Width;
if( m_Width == 0 )
return GetDefaultLineThickness();
return -1; // the minimal pen value
}

View File

@ -154,7 +154,13 @@ void LIB_RECTANGLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
int LIB_RECTANGLE::GetPenSize() const
{
return ( m_Width == 0 ) ? GetDefaultLineThickness() : m_Width;
if( m_Width > 0 )
return m_Width;
if( m_Width == 0 )
return GetDefaultLineThickness();
return -1; // a value to use a minimal pen size
}
@ -381,7 +387,7 @@ void LIB_RECTANGLE::CalcEdit( const wxPoint& aPosition )
else if( m_isWidthLocked )
{
if( m_isStartPointSelected )
m_Pos.y = aPosition.y;
m_Pos.y = aPosition.y;
else
m_End.y = aPosition.y;
}