Commit 7f9e9144 authored by charras's avatar charras

Eeschema: added GetPenSize() used in Draw and Plot functions to get the...

Eeschema: added GetPenSize() used in Draw and Plot functions to get the thickness of lines. Work in progress
parent e4b83b40
...@@ -189,26 +189,32 @@ LibDrawText* LibDrawText::GenCopy() ...@@ -189,26 +189,32 @@ LibDrawText* LibDrawText::GenCopy()
} }
void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, /** Function GetPenSize
const wxPoint& aOffset, int aColor, int aDrawMode, * @return the size of the "pen" that be used to draw or plot this item
void* aData, const int aTransformMatrix[2][2] ) */
int LibDrawText::GetPenSize( )
{ {
wxPoint pos1, pos2; int pensize = m_Width;
int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = m_Width;
if( linewidth == 0 ) // Use default values for pen size if( pensize == 0 ) // Use default values for pen size
{ {
if( m_Bold ) if( m_Bold )
linewidth = GetPenSizeForBold( m_Size.x ); pensize = GetPenSizeForBold( m_Size.x );
else else
linewidth = g_DrawDefaultLineThickness; pensize = g_DrawDefaultLineThickness;
} }
// Clip pen size for small texts: // Clip pen size for small texts:
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold ); pensize = Clamp_Text_PenSize( pensize, m_Size, m_Bold );
return pensize;
}
void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] )
{
wxPoint pos1, pos2;
int color = ReturnLayerColor( LAYER_DEVICE );
if( aColor < 0 ) // Used normal color or selected color if( aColor < 0 ) // Used normal color or selected color
{ {
if( ( m_Selected & IS_SELECTED ) ) if( ( m_Selected & IS_SELECTED ) )
...@@ -226,7 +232,7 @@ void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -226,7 +232,7 @@ void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
DrawGraphicText( aPanel, aDC, pos1, (EDA_Colors) color, m_Text, DrawGraphicText( aPanel, aDC, pos1, (EDA_Colors) color, m_Text,
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT, t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
m_Size, m_HJustify, m_VJustify, m_Size, m_HJustify, m_VJustify,
linewidth, m_Italic, m_Bold ); GetPenSize( ), m_Italic, m_Bold );
} }
......
...@@ -202,6 +202,17 @@ bool LibDrawField::Load( char* line, wxString& errorMsg ) ...@@ -202,6 +202,17 @@ bool LibDrawField::Load( char* line, wxString& errorMsg )
} }
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int LibDrawField::GetPenSize( )
{
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
return pensize;
}
/* /*
* if aData not NULL, aData must point a wxString which is used instead of * if aData not NULL, aData must point a wxString which is used instead of
* the m_Text * the m_Text
...@@ -213,7 +224,7 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -213,7 +224,7 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint text_pos; wxPoint text_pos;
int color = aColor; int color = aColor;
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width; int linewidth = GetPenSize( );
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold ); linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
......
...@@ -43,6 +43,11 @@ public: ...@@ -43,6 +43,11 @@ public:
} }
/** Function GetPenSize virtual pure
* @return the size of the "pen" that be used to draw or plot this item
*/
int GetPenSize( );
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.brd" * writes the data structures for this object out to a FILE in "*.brd"
......
...@@ -276,6 +276,16 @@ bool LibDrawPin::Load( char* line, wxString& errorMsg ) ...@@ -276,6 +276,16 @@ bool LibDrawPin::Load( char* line, wxString& errorMsg )
} }
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int LibDrawPin::GetPenSize( )
{
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
return pensize;
}
/**********************************************************************************************/ /**********************************************************************************************/
void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel, void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel,
wxDC* aDC, wxDC* aDC,
...@@ -334,7 +344,7 @@ void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel, ...@@ -334,7 +344,7 @@ void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
{ {
int MapX1, MapY1, x1, y1; int MapX1, MapY1, x1, y1;
int color; int color;
int width = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width; int width = GetPenSize( );
int posX = aPinPos.x, posY = aPinPos.y, len = m_PinLen; int posX = aPinPos.x, posY = aPinPos.y, len = m_PinLen;
BASE_SCREEN* screen = aPanel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
...@@ -510,10 +520,10 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, ...@@ -510,10 +520,10 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
wxSize PinNameSize( m_PinNameSize, m_PinNameSize ); wxSize PinNameSize( m_PinNameSize, m_PinNameSize );
wxSize PinNumSize( m_PinNumSize, m_PinNumSize ); wxSize PinNumSize( m_PinNumSize, m_PinNumSize );
int nameLineWidth = g_DrawDefaultLineThickness; int nameLineWidth = GetPenSize( );
nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_PinNameSize, false ); nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_PinNameSize, false );
int numLineWidth = g_DrawDefaultLineThickness; int numLineWidth = GetPenSize( );
numLineWidth = Clamp_Text_PenSize( numLineWidth, m_PinNumSize, false ); numLineWidth = Clamp_Text_PenSize( numLineWidth, m_PinNumSize, false );
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
......
...@@ -45,6 +45,25 @@ SCH_CMP_FIELD::~SCH_CMP_FIELD() ...@@ -45,6 +45,25 @@ SCH_CMP_FIELD::~SCH_CMP_FIELD()
} }
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int SCH_CMP_FIELD::GetPenSize( )
{
int pensize = m_Width;
if( pensize == 0 ) // Use default values for pen size
{
if( m_Bold )
pensize = GetPenSizeForBold( m_Size.x );
else
pensize = g_DrawDefaultLineThickness;
}
// Clip pen size for small texts:
pensize = Clamp_Text_PenSize( pensize, m_Size, m_Bold );
return pensize;
}
/** /**
* Routine de trace des textes type Field du composant. * Routine de trace des textes type Field du composant.
* entree: * entree:
......
...@@ -57,6 +57,11 @@ public: ...@@ -57,6 +57,11 @@ public:
*/ */
void ImportValues( const LibDrawField& aSource ); void ImportValues( const LibDrawField& aSource );
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int GetPenSize( );
/** /**
* Function Draw * Function Draw
*/ */
......
...@@ -466,6 +466,26 @@ void SCH_TEXT::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) ...@@ -466,6 +466,26 @@ void SCH_TEXT::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
} }
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int SCH_TEXT::GetPenSize( )
{
int pensize = m_Width;
if( pensize == 0 ) // Use default values for pen size
{
if( m_Bold )
pensize = GetPenSizeForBold( m_Size.x );
else
pensize = g_DrawDefaultLineThickness;
}
// Clip pen size for small texts:
pensize = Clamp_Text_PenSize( pensize, m_Size, m_Bold );
return pensize;
}
/*******************************************************************************************/ /*******************************************************************************************/
void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aOffset, void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aOffset,
int DrawMode, int Color ) int DrawMode, int Color )
......
...@@ -97,6 +97,12 @@ public: ...@@ -97,6 +97,12 @@ public:
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int GetPenSize( );
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ); void Show( int nestLevel, std::ostream& os );
......
...@@ -237,6 +237,16 @@ LibDrawArc* LibDrawArc::GenCopy() ...@@ -237,6 +237,16 @@ LibDrawArc* LibDrawArc::GenCopy()
} }
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int LibDrawArc::GetPenSize( )
{
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
return pensize;
}
void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, const wxPoint& aOffset, int aColor,
int aDrawMode, void* aData, int aDrawMode, void* aData,
...@@ -245,7 +255,6 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -245,7 +255,6 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint pos1, pos2, posc; wxPoint pos1, pos2, posc;
int color = ReturnLayerColor( LAYER_DEVICE ); int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
if( aColor < 0 ) // Used normal color or selected color if( aColor < 0 ) // Used normal color or selected color
{ {
...@@ -275,7 +284,7 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -275,7 +284,7 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( fill == FILLED_WITH_BG_BODYCOLOR ) if( fill == FILLED_WITH_BG_BODYCOLOR )
GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2, GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
m_Rayon, linewidth, color, m_Rayon, GetPenSize( ), color,
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( fill == FILLED_SHAPE && !aData ) else if( fill == FILLED_SHAPE && !aData )
GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2, GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
...@@ -285,12 +294,12 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -285,12 +294,12 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
#ifdef DRAW_ARC_WITH_ANGLE #ifdef DRAW_ARC_WITH_ANGLE
GRArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2, GRArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
m_Rayon, linewidth, color ); m_Rayon, GetPenSize( ), color );
#else #else
GRArc1( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, GRArc1( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
posc.x, posc.y, linewidth, color ); posc.x, posc.y, GetPenSize( ), color );
#endif #endif
} }
...@@ -483,6 +492,16 @@ LibDrawCircle* LibDrawCircle::GenCopy() ...@@ -483,6 +492,16 @@ LibDrawCircle* LibDrawCircle::GenCopy()
} }
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int LibDrawCircle::GetPenSize( )
{
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
return pensize;
}
void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode, const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] ) void* aData, const int aTransformMatrix[2][2] )
...@@ -490,7 +509,6 @@ void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -490,7 +509,6 @@ void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint pos1; wxPoint pos1;
int color = ReturnLayerColor( LAYER_DEVICE ); int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
if( aColor < 0 ) // Used normal color or selected color if( aColor < 0 ) // Used normal color or selected color
{ {
...@@ -509,14 +527,14 @@ void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -509,14 +527,14 @@ void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( fill == FILLED_WITH_BG_BODYCOLOR ) if( fill == FILLED_WITH_BG_BODYCOLOR )
GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y,
m_Rayon, linewidth, color, m_Rayon, GetPenSize( ), color,
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( fill == FILLED_SHAPE ) else if( fill == FILLED_SHAPE )
GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y,
m_Rayon, 0, color, color ); m_Rayon, 0, color, color );
else else
GRCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, GRCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y,
m_Rayon, linewidth, color ); m_Rayon, GetPenSize( ), color );
} }
...@@ -616,6 +634,15 @@ LibDrawSquare* LibDrawSquare::GenCopy() ...@@ -616,6 +634,15 @@ LibDrawSquare* LibDrawSquare::GenCopy()
} }
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int LibDrawSquare::GetPenSize( )
{
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
return pensize;
}
void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode, const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] ) void* aData, const int aTransformMatrix[2][2] )
...@@ -623,7 +650,6 @@ void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -623,7 +650,6 @@ void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint pos1, pos2; wxPoint pos1, pos2;
int color = ReturnLayerColor( LAYER_DEVICE ); int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
if( aColor < 0 ) // Used normal color or selected color if( aColor < 0 ) // Used normal color or selected color
{ {
...@@ -642,14 +668,14 @@ void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -642,14 +668,14 @@ void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( fill == FILLED_WITH_BG_BODYCOLOR && !aData ) if( fill == FILLED_WITH_BG_BODYCOLOR && !aData )
GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
linewidth, color, GetPenSize( ), color,
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( m_Fill == FILLED_SHAPE && !aData ) else if( m_Fill == FILLED_SHAPE && !aData )
GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
linewidth, color, color ); GetPenSize( ), color, color );
else else
GRRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, GRRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
linewidth, color ); GetPenSize( ), color );
} }
...@@ -776,6 +802,15 @@ LibDrawSegment* LibDrawSegment::GenCopy() ...@@ -776,6 +802,15 @@ LibDrawSegment* LibDrawSegment::GenCopy()
} }
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int LibDrawSegment::GetPenSize( )
{
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
return pensize;
}
void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode, const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] ) void* aData, const int aTransformMatrix[2][2] )
...@@ -783,7 +818,6 @@ void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -783,7 +818,6 @@ void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint pos1, pos2; wxPoint pos1, pos2;
int color = ReturnLayerColor( LAYER_DEVICE ); int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
if( aColor < 0 ) // Used normal color or selected color if( aColor < 0 ) // Used normal color or selected color
{ {
...@@ -797,7 +831,7 @@ void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -797,7 +831,7 @@ void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
pos2 = TransformCoordinate( aTransformMatrix, m_End ) + aOffset; pos2 = TransformCoordinate( aTransformMatrix, m_End ) + aOffset;
GRLine( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, GRLine( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
linewidth, color ); GetPenSize( ), color );
} }
...@@ -962,6 +996,15 @@ void LibDrawPolyline::AddPoint( const wxPoint& point ) ...@@ -962,6 +996,15 @@ void LibDrawPolyline::AddPoint( const wxPoint& point )
} }
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int LibDrawPolyline::GetPenSize( )
{
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
return pensize;
}
void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode, const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] ) void* aData, const int aTransformMatrix[2][2] )
...@@ -969,7 +1012,6 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -969,7 +1012,6 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint pos1; wxPoint pos1;
int color = ReturnLayerColor( LAYER_DEVICE ); int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
// Buffer used to store current corners coordinates for drawings // Buffer used to store current corners coordinates for drawings
static wxPoint* Buf_Poly_Drawings = NULL; static wxPoint* Buf_Poly_Drawings = NULL;
...@@ -1010,14 +1052,14 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -1010,14 +1052,14 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( fill == FILLED_WITH_BG_BODYCOLOR ) if( fill == FILLED_WITH_BG_BODYCOLOR )
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(), GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
Buf_Poly_Drawings, 1, linewidth, color, Buf_Poly_Drawings, 1, GetPenSize( ), color,
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( fill == FILLED_SHAPE ) else if( fill == FILLED_SHAPE )
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(), GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
Buf_Poly_Drawings, 1, linewidth, color, color ); Buf_Poly_Drawings, 1, GetPenSize( ), color, color );
else else
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(), GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
Buf_Poly_Drawings, 0, linewidth, color, color ); Buf_Poly_Drawings, 0, GetPenSize( ), color, color );
} }
...@@ -1209,6 +1251,15 @@ LibDrawBezier* LibDrawBezier::GenCopy() ...@@ -1209,6 +1251,15 @@ LibDrawBezier* LibDrawBezier::GenCopy()
return newitem; return newitem;
} }
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int LibDrawBezier::GetPenSize( )
{
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
return pensize;
}
void LibDrawBezier::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void LibDrawBezier::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode, const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] ) void* aData, const int aTransformMatrix[2][2] )
...@@ -1217,7 +1268,6 @@ void LibDrawBezier::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -1217,7 +1268,6 @@ void LibDrawBezier::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
std::vector<wxPoint> PolyPointsTraslated; std::vector<wxPoint> PolyPointsTraslated;
int color = ReturnLayerColor( LAYER_DEVICE ); int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
m_PolyPoints = Bezier2Poly( m_BezierPoints[0] , m_PolyPoints = Bezier2Poly( m_BezierPoints[0] ,
m_BezierPoints[1] , m_BezierPoints[1] ,
...@@ -1242,14 +1292,14 @@ void LibDrawBezier::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -1242,14 +1292,14 @@ void LibDrawBezier::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( fill == FILLED_WITH_BG_BODYCOLOR ) if( fill == FILLED_WITH_BG_BODYCOLOR )
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(), GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
&PolyPointsTraslated[0], 1, linewidth, color, &PolyPointsTraslated[0], 1, GetPenSize( ), color,
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( fill == FILLED_SHAPE ) else if( fill == FILLED_SHAPE )
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(), GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
&PolyPointsTraslated[0], 1, linewidth, color, color ); &PolyPointsTraslated[0], 1, GetPenSize( ), color, color );
else else
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(), GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
&PolyPointsTraslated[0], 0, linewidth, color, color ); &PolyPointsTraslated[0], 0, GetPenSize( ), color, color );
} }
......
...@@ -141,6 +141,11 @@ public: ...@@ -141,6 +141,11 @@ public:
const wxPoint &aOffset, int aColor, int aDrawMode, const wxPoint &aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] ) = 0; void* aData, const int aTransformMatrix[2][2] ) = 0;
/** Function GetPenSize virtual pure
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize( ) = 0;
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.brd" * writes the data structures for this object out to a FILE in "*.brd"
...@@ -210,7 +215,7 @@ public: ...@@ -210,7 +215,7 @@ public:
// (Currently Unused) Pin num and Pin name text opt position, 0 = default: // (Currently Unused) Pin num and Pin name text opt position, 0 = default:
char m_PinNumPositionOpt, m_PinNamePositionOpt; char m_PinNumPositionOpt, m_PinNamePositionOpt;
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start wxPoint m_Pos; /* Position or centre (Arc and Circle) or start
* point (segments) */ * point (segments) */
int m_Width; /* Line width */ int m_Width; /* Line width */
...@@ -263,6 +268,11 @@ public: ...@@ -263,6 +268,11 @@ public:
void ReturnPinStringNum( wxString& buffer ) const; void ReturnPinStringNum( wxString& buffer ) const;
void SetPinNumFromString( wxString& buffer ); void SetPinNumFromString( wxString& buffer );
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize( );
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
int aColor, int aDrawMode, void* aData, int aColor, int aDrawMode, void* aData,
const int aTransformMatrix[2][2] ); const int aTransformMatrix[2][2] );
...@@ -343,6 +353,11 @@ public: ...@@ -343,6 +353,11 @@ public:
virtual EDA_Rect GetBoundingBox(); virtual EDA_Rect GetBoundingBox();
virtual void DisplayInfo( WinEDA_DrawFrame* frame ); virtual void DisplayInfo( WinEDA_DrawFrame* frame );
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize( );
}; };
...@@ -394,6 +409,11 @@ public: ...@@ -394,6 +409,11 @@ public:
LibDrawCircle* GenCopy(); LibDrawCircle* GenCopy();
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize( );
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
int aColor, int aDrawMode, void* aData, int aColor, int aDrawMode, void* aData,
const int aTransformMatrix[2][2] ); const int aTransformMatrix[2][2] );
...@@ -460,6 +480,11 @@ public: ...@@ -460,6 +480,11 @@ public:
LibDrawText* GenCopy(); LibDrawText* GenCopy();
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize( );
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
int aColor, int aDrawMode, void* aData, int aColor, int aDrawMode, void* aData,
const int aTransformMatrix[2][2] ); const int aTransformMatrix[2][2] );
...@@ -515,6 +540,11 @@ public: ...@@ -515,6 +540,11 @@ public:
LibDrawSquare* GenCopy(); LibDrawSquare* GenCopy();
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize( );
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
int aColor, int aDrawMode, void* aData, int aColor, int aDrawMode, void* aData,
const int aTransformMatrix[2][2] ); const int aTransformMatrix[2][2] );
...@@ -571,6 +601,11 @@ public: ...@@ -571,6 +601,11 @@ public:
LibDrawSegment* GenCopy(); LibDrawSegment* GenCopy();
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize( );
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
int aColor, int aDrawMode, void* aData, int aColor, int aDrawMode, void* aData,
const int aTransformMatrix[2][2] ); const int aTransformMatrix[2][2] );
...@@ -637,6 +672,11 @@ public: ...@@ -637,6 +672,11 @@ public:
*/ */
virtual EDA_Rect GetBoundingBox(); virtual EDA_Rect GetBoundingBox();
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize( );
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
int aColor, int aDrawMode, void* aData, int aColor, int aDrawMode, void* aData,
const int aTransformMatrix[2][2] ); const int aTransformMatrix[2][2] );
...@@ -648,13 +688,13 @@ public: ...@@ -648,13 +688,13 @@ public:
/* Graphic Body Item: Bezier Curve (set of lines) */ /* Graphic Body Item: Bezier Curve (set of lines) */
/**********************************************************/ /**********************************************************/
class LibDrawBezier : public LibEDA_BaseStruct class LibDrawBezier : public LibEDA_BaseStruct
{ {
public: public:
int m_Width; /* Line width */ int m_Width; /* Line width */
std::vector<wxPoint> m_BezierPoints; // list of parameter (3|4) std::vector<wxPoint> m_BezierPoints; // list of parameter (3|4)
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2) std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
public: public:
LibDrawBezier(EDA_LibComponentStruct * aParent); LibDrawBezier(EDA_LibComponentStruct * aParent);
~LibDrawBezier() { } ~LibDrawBezier() { }
...@@ -703,11 +743,16 @@ class LibDrawBezier : public LibEDA_BaseStruct ...@@ -703,11 +743,16 @@ class LibDrawBezier : public LibEDA_BaseStruct
*/ */
virtual EDA_Rect GetBoundingBox(); virtual EDA_Rect GetBoundingBox();
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize( );
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
int aColor, int aDrawMode, void* aData, int aColor, int aDrawMode, void* aData,
const int aTransformMatrix[2][2] ); const int aTransformMatrix[2][2] );
virtual void DisplayInfo( WinEDA_DrawFrame* frame ); virtual void DisplayInfo( WinEDA_DrawFrame* frame );
}; };
#endif // CLASSES_BODY_ITEMS_H #endif // CLASSES_BODY_ITEMS_H
...@@ -65,7 +65,6 @@ static void PlotLibPart( Plotter* plotter, SCH_COMPONENT* DrawLibItem ) ...@@ -65,7 +65,6 @@ static void PlotLibPart( Plotter* plotter, SCH_COMPONENT* DrawLibItem )
Multi = DrawLibItem->m_Multi; Multi = DrawLibItem->m_Multi;
convert = DrawLibItem->m_Convert; convert = DrawLibItem->m_Convert;
plotter->set_current_line_width( g_DrawDefaultLineThickness );
for( LibEDA_BaseStruct* DEntry = Entry->m_Drawings; for( LibEDA_BaseStruct* DEntry = Entry->m_Drawings;
DEntry != NULL; DEntry = DEntry->Next() ) DEntry != NULL; DEntry = DEntry->Next() )
{ {
...@@ -75,6 +74,7 @@ static void PlotLibPart( Plotter* plotter, SCH_COMPONENT* DrawLibItem ) ...@@ -75,6 +74,7 @@ static void PlotLibPart( Plotter* plotter, SCH_COMPONENT* DrawLibItem )
if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) ) if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) )
continue; continue;
plotter->set_current_line_width( DEntry->GetPenSize( ) );
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) ); plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
draw_bgfill = plotter->get_color_mode(); draw_bgfill = plotter->get_color_mode();
...@@ -89,12 +89,12 @@ static void PlotLibPart( Plotter* plotter, SCH_COMPONENT* DrawLibItem ) ...@@ -89,12 +89,12 @@ static void PlotLibPart( Plotter* plotter, SCH_COMPONENT* DrawLibItem )
if( draw_bgfill && Arc->m_Fill == FILLED_WITH_BG_BODYCOLOR ) if( draw_bgfill && Arc->m_Fill == FILLED_WITH_BG_BODYCOLOR )
{ {
plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
plotter->arc( pos, -t1, -t2, Arc->m_Rayon, FILLED_SHAPE, 0 ); plotter->arc( pos, -t2, -t1, Arc->m_Rayon, FILLED_SHAPE, 0 );
} }
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) ); plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
plotter->arc( pos, plotter->arc( pos,
-t1,
-t2, -t2,
-t1,
Arc->m_Rayon, Arc->m_Rayon,
Arc->m_Fill, Arc->m_Fill,
Arc->m_Width ); Arc->m_Width );
...@@ -126,7 +126,6 @@ static void PlotLibPart( Plotter* plotter, SCH_COMPONENT* DrawLibItem ) ...@@ -126,7 +126,6 @@ static void PlotLibPart( Plotter* plotter, SCH_COMPONENT* DrawLibItem )
* transformation matrix causes xy axes to be flipped. */ * transformation matrix causes xy axes to be flipped. */
t1 = (TransMat[0][0] != 0) ^ (Text->m_Orient != 0); t1 = (TransMat[0][0] != 0) ^ (Text->m_Orient != 0);
pos = TransformCoordinate( TransMat, Text->m_Pos ) + DrawLibItem->m_Pos; pos = TransformCoordinate( TransMat, Text->m_Pos ) + DrawLibItem->m_Pos;
plotter->set_current_line_width( -1 );
int thickness = (Text->m_Width == 0) ? g_DrawDefaultLineThickness : Text->m_Width; int thickness = (Text->m_Width == 0) ? g_DrawDefaultLineThickness : Text->m_Width;
thickness = Clamp_Text_PenSize( thickness, Text->m_Size, Text->m_Bold ); thickness = Clamp_Text_PenSize( thickness, Text->m_Size, Text->m_Bold );
...@@ -369,9 +368,7 @@ static void PlotTextField( Plotter* plotter, SCH_COMPONENT* DrawLibItem, ...@@ -369,9 +368,7 @@ static void PlotTextField( Plotter* plotter, SCH_COMPONENT* DrawLibItem,
} }
int thickness = (field->m_Width == 0) ? g_DrawDefaultLineThickness : field->m_Width; int thickness = field->GetPenSize( );
thickness = Clamp_Text_PenSize( thickness, field->m_Size, field->m_Bold );
plotter->set_current_line_width( thickness );
if( !IsMulti || (FieldNumber != REFERENCE) ) if( !IsMulti || (FieldNumber != REFERENCE) )
{ {
...@@ -509,9 +506,9 @@ static void PlotPinSymbol( Plotter* plotter, const wxPoint& pos, ...@@ -509,9 +506,9 @@ static void PlotPinSymbol( Plotter* plotter, const wxPoint& pos,
} }
/*******************************************/ /********************************************************************/
static void PlotTextStruct( Plotter* plotter, EDA_BaseStruct* Struct ) static void PlotTextStruct( Plotter* plotter, SCH_TEXT* aSchText )
/*******************************************/ /********************************************************************/
/* /*
* Routine de trace des Textes, Labels et Global-Labels. * Routine de trace des Textes, Labels et Global-Labels.
...@@ -520,7 +517,7 @@ static void PlotTextStruct( Plotter* plotter, EDA_BaseStruct* Struct ) ...@@ -520,7 +517,7 @@ static void PlotTextStruct( Plotter* plotter, EDA_BaseStruct* Struct )
{ {
static std::vector <wxPoint> Poly; static std::vector <wxPoint> Poly;
switch( Struct->Type() ) switch( aSchText->Type() )
{ {
case TYPE_SCH_GLOBALLABEL: case TYPE_SCH_GLOBALLABEL:
case TYPE_SCH_HIERLABEL: case TYPE_SCH_HIERLABEL:
...@@ -532,31 +529,29 @@ static void PlotTextStruct( Plotter* plotter, EDA_BaseStruct* Struct ) ...@@ -532,31 +529,29 @@ static void PlotTextStruct( Plotter* plotter, EDA_BaseStruct* Struct )
return; return;
} }
SCH_TEXT* schText = (SCH_TEXT*) Struct;
EDA_Colors color = UNSPECIFIED_COLOR; EDA_Colors color = UNSPECIFIED_COLOR;
color = ReturnLayerColor( schText->m_Layer ); color = ReturnLayerColor( aSchText->m_Layer );
wxPoint textpos = schText->m_Pos + schText->GetSchematicTextOffset(); wxPoint textpos = aSchText->m_Pos + aSchText->GetSchematicTextOffset();
int thickness = (schText->m_Width == 0) ? g_DrawDefaultLineThickness : schText->m_Width; int thickness = aSchText->GetPenSize( );
thickness = Clamp_Text_PenSize( thickness, schText->m_Size, schText->m_Bold );
plotter->set_current_line_width( thickness ); plotter->set_current_line_width( thickness );
if( schText->m_MultilineAllowed ) if( aSchText->m_MultilineAllowed )
{ {
wxPoint pos = textpos; wxPoint pos = textpos;
wxArrayString* list = wxStringSplit( schText->m_Text, '\n' ); wxArrayString* list = wxStringSplit( aSchText->m_Text, '\n' );
wxPoint offset; wxPoint offset;
offset.y = schText->GetInterline(); offset.y = aSchText->GetInterline();
RotatePoint( &offset, schText->m_Orient ); RotatePoint( &offset, aSchText->m_Orient );
for( unsigned i = 0; i<list->Count(); i++ ) for( unsigned i = 0; i<list->Count(); i++ )
{ {
wxString txt = list->Item( i ); wxString txt = list->Item( i );
plotter->text( pos, plotter->text( pos,
color, txt, schText->m_Orient, schText->m_Size, color, txt, aSchText->m_Orient, aSchText->m_Size,
schText->m_HJustify, schText->m_VJustify, aSchText->m_HJustify, aSchText->m_VJustify,
thickness, schText->m_Italic, schText->m_Bold ); thickness, aSchText->m_Italic, aSchText->m_Bold );
pos += offset; pos += offset;
} }
...@@ -564,19 +559,19 @@ static void PlotTextStruct( Plotter* plotter, EDA_BaseStruct* Struct ) ...@@ -564,19 +559,19 @@ static void PlotTextStruct( Plotter* plotter, EDA_BaseStruct* Struct )
} }
else else
plotter->text( textpos, plotter->text( textpos,
color, schText->m_Text, schText->m_Orient, schText->m_Size, color, aSchText->m_Text, aSchText->m_Orient, aSchText->m_Size,
schText->m_HJustify, schText->m_VJustify, aSchText->m_HJustify, aSchText->m_VJustify,
thickness, schText->m_Italic, schText->m_Bold ); thickness, aSchText->m_Italic, aSchText->m_Bold );
/* Draw graphic symbol for global or hierachical labels */ /* Draw graphic symbol for global or hierachical labels */
if( Struct->Type() == TYPE_SCH_GLOBALLABEL ) if( aSchText->Type() == TYPE_SCH_GLOBALLABEL )
{ {
( (SCH_GLOBALLABEL*) Struct )->CreateGraphicShape( Poly, schText->m_Pos ); ( (SCH_GLOBALLABEL*) aSchText )->CreateGraphicShape( Poly, aSchText->m_Pos );
plotter->poly( Poly.size(), &Poly[0].x, NO_FILL ); plotter->poly( Poly.size(), &Poly[0].x, NO_FILL );
} }
if( Struct->Type() == TYPE_SCH_HIERLABEL ) if( aSchText->Type() == TYPE_SCH_HIERLABEL )
{ {
( (SCH_HIERLABEL*) Struct )->CreateGraphicShape( Poly, schText->m_Pos ); ( (SCH_HIERLABEL*) aSchText )->CreateGraphicShape( Poly, aSchText->m_Pos );
plotter->poly( Poly.size(), &Poly[0].x, NO_FILL ); plotter->poly( Poly.size(), &Poly[0].x, NO_FILL );
} }
} }
...@@ -775,7 +770,7 @@ void PlotDrawlist( Plotter* plotter, SCH_ITEM* drawlist ) ...@@ -775,7 +770,7 @@ void PlotDrawlist( Plotter* plotter, SCH_ITEM* drawlist )
case TYPE_SCH_LABEL: case TYPE_SCH_LABEL:
case TYPE_SCH_GLOBALLABEL: case TYPE_SCH_GLOBALLABEL:
case TYPE_SCH_HIERLABEL: case TYPE_SCH_HIERLABEL:
PlotTextStruct( plotter, drawlist ); PlotTextStruct( plotter, (SCH_TEXT*) drawlist );
break; break;
case TYPE_SCH_COMPONENT: case TYPE_SCH_COMPONENT:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment