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()
}
void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] )
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int LibDrawText::GetPenSize( )
{
wxPoint pos1, pos2;
int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = m_Width;
int pensize = m_Width;
if( linewidth == 0 ) // Use default values for pen size
if( pensize == 0 ) // Use default values for pen size
{
if( m_Bold )
linewidth = GetPenSizeForBold( m_Size.x );
pensize = GetPenSizeForBold( m_Size.x );
else
linewidth = g_DrawDefaultLineThickness;
pensize = g_DrawDefaultLineThickness;
}
// 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( ( m_Selected & IS_SELECTED ) )
......@@ -226,7 +232,7 @@ void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
DrawGraphicText( aPanel, aDC, pos1, (EDA_Colors) color, m_Text,
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
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 )
}
/** 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
* the m_Text
......@@ -213,7 +224,7 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint text_pos;
int color = aColor;
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
int linewidth = GetPenSize( );
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
......
......@@ -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
* writes the data structures for this object out to a FILE in "*.brd"
......
......@@ -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,
wxDC* aDC,
......@@ -334,7 +344,7 @@ void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
{
int MapX1, MapY1, x1, y1;
int color;
int width = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
int width = GetPenSize( );
int posX = aPinPos.x, posY = aPinPos.y, len = m_PinLen;
BASE_SCREEN* screen = aPanel->GetScreen();
......@@ -510,10 +520,10 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
wxSize PinNameSize( m_PinNameSize, m_PinNameSize );
wxSize PinNumSize( m_PinNumSize, m_PinNumSize );
int nameLineWidth = g_DrawDefaultLineThickness;
int nameLineWidth = GetPenSize( );
nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_PinNameSize, false );
int numLineWidth = g_DrawDefaultLineThickness;
int numLineWidth = GetPenSize( );
numLineWidth = Clamp_Text_PenSize( numLineWidth, m_PinNumSize, false );
GRSetDrawMode( DC, DrawMode );
......
......@@ -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.
* entree:
......
......@@ -57,6 +57,11 @@ public:
*/
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
*/
......
......@@ -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,
int DrawMode, int Color )
......
......@@ -97,6 +97,12 @@ public:
*/
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)
void Show( int nestLevel, std::ostream& os );
......
......@@ -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,
const wxPoint& aOffset, int aColor,
int aDrawMode, void* aData,
......@@ -245,7 +255,6 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint pos1, pos2, posc;
int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
if( aColor < 0 ) // Used normal color or selected color
{
......@@ -275,7 +284,7 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( fill == FILLED_WITH_BG_BODYCOLOR )
GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
m_Rayon, linewidth, color,
m_Rayon, GetPenSize( ), color,
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( fill == FILLED_SHAPE && !aData )
GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
......@@ -285,12 +294,12 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
#ifdef DRAW_ARC_WITH_ANGLE
GRArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
m_Rayon, linewidth, color );
m_Rayon, GetPenSize( ), color );
#else
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
}
......@@ -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,
const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] )
......@@ -490,7 +509,6 @@ void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint pos1;
int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
if( aColor < 0 ) // Used normal color or selected color
{
......@@ -509,14 +527,14 @@ void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( fill == FILLED_WITH_BG_BODYCOLOR )
GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y,
m_Rayon, linewidth, color,
m_Rayon, GetPenSize( ), color,
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( fill == FILLED_SHAPE )
GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y,
m_Rayon, 0, color, color );
else
GRCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y,
m_Rayon, linewidth, color );
m_Rayon, GetPenSize( ), color );
}
......@@ -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,
const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] )
......@@ -623,7 +650,6 @@ void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint pos1, pos2;
int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
if( aColor < 0 ) // Used normal color or selected color
{
......@@ -642,14 +668,14 @@ void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( fill == FILLED_WITH_BG_BODYCOLOR && !aData )
GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
linewidth, color,
GetPenSize( ), color,
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( m_Fill == FILLED_SHAPE && !aData )
GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
linewidth, color, color );
GetPenSize( ), color, color );
else
GRRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
linewidth, color );
GetPenSize( ), color );
}
......@@ -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,
const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] )
......@@ -783,7 +818,6 @@ void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint pos1, pos2;
int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
if( aColor < 0 ) // Used normal color or selected color
{
......@@ -797,7 +831,7 @@ void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
pos2 = TransformCoordinate( aTransformMatrix, m_End ) + aOffset;
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 )
}
/** 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,
const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] )
......@@ -969,7 +1012,6 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
wxPoint pos1;
int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
// Buffer used to store current corners coordinates for drawings
static wxPoint* Buf_Poly_Drawings = NULL;
......@@ -1010,14 +1052,14 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( fill == FILLED_WITH_BG_BODYCOLOR )
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
Buf_Poly_Drawings, 1, linewidth, color,
Buf_Poly_Drawings, 1, GetPenSize( ), color,
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( fill == FILLED_SHAPE )
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
Buf_Poly_Drawings, 1, linewidth, color, color );
Buf_Poly_Drawings, 1, GetPenSize( ), color, color );
else
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()
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,
const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] )
......@@ -1217,7 +1268,6 @@ void LibDrawBezier::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
std::vector<wxPoint> PolyPointsTraslated;
int color = ReturnLayerColor( LAYER_DEVICE );
int linewidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
m_PolyPoints = Bezier2Poly( m_BezierPoints[0] ,
m_BezierPoints[1] ,
......@@ -1242,14 +1292,14 @@ void LibDrawBezier::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( fill == FILLED_WITH_BG_BODYCOLOR )
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
&PolyPointsTraslated[0], 1, linewidth, color,
&PolyPointsTraslated[0], 1, GetPenSize( ), color,
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( fill == FILLED_SHAPE )
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
&PolyPointsTraslated[0], 1, linewidth, color, color );
&PolyPointsTraslated[0], 1, GetPenSize( ), color, color );
else
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:
const wxPoint &aOffset, int aColor, int aDrawMode,
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
* writes the data structures for this object out to a FILE in "*.brd"
......@@ -210,7 +215,7 @@ public:
// (Currently Unused) Pin num and Pin name text opt position, 0 = default:
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) */
int m_Width; /* Line width */
......@@ -263,6 +268,11 @@ public:
void ReturnPinStringNum( wxString& buffer ) const;
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,
int aColor, int aDrawMode, void* aData,
const int aTransformMatrix[2][2] );
......@@ -343,6 +353,11 @@ public:
virtual EDA_Rect GetBoundingBox();
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:
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,
int aColor, int aDrawMode, void* aData,
const int aTransformMatrix[2][2] );
......@@ -460,6 +480,11 @@ public:
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,
int aColor, int aDrawMode, void* aData,
const int aTransformMatrix[2][2] );
......@@ -515,6 +540,11 @@ public:
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,
int aColor, int aDrawMode, void* aData,
const int aTransformMatrix[2][2] );
......@@ -571,6 +601,11 @@ public:
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,
int aColor, int aDrawMode, void* aData,
const int aTransformMatrix[2][2] );
......@@ -637,6 +672,11 @@ public:
*/
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,
int aColor, int aDrawMode, void* aData,
const int aTransformMatrix[2][2] );
......@@ -648,13 +688,13 @@ public:
/* Graphic Body Item: Bezier Curve (set of lines) */
/**********************************************************/
class LibDrawBezier : public LibEDA_BaseStruct
{
public:
{
public:
int m_Width; /* Line width */
std::vector<wxPoint> m_BezierPoints; // list of parameter (3|4)
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
public:
public:
LibDrawBezier(EDA_LibComponentStruct * aParent);
~LibDrawBezier() { }
......@@ -703,11 +743,16 @@ class LibDrawBezier : public LibEDA_BaseStruct
*/
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,
int aColor, int aDrawMode, void* aData,
const int aTransformMatrix[2][2] );
virtual void DisplayInfo( WinEDA_DrawFrame* frame );
};
};
#endif // CLASSES_BODY_ITEMS_H
......@@ -65,7 +65,6 @@ static void PlotLibPart( Plotter* plotter, SCH_COMPONENT* DrawLibItem )
Multi = DrawLibItem->m_Multi;
convert = DrawLibItem->m_Convert;
plotter->set_current_line_width( g_DrawDefaultLineThickness );
for( LibEDA_BaseStruct* DEntry = Entry->m_Drawings;
DEntry != NULL; DEntry = DEntry->Next() )
{
......@@ -75,6 +74,7 @@ static void PlotLibPart( Plotter* plotter, SCH_COMPONENT* DrawLibItem )
if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) )
continue;
plotter->set_current_line_width( DEntry->GetPenSize( ) );
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
draw_bgfill = plotter->get_color_mode();
......@@ -89,12 +89,12 @@ static void PlotLibPart( Plotter* plotter, SCH_COMPONENT* DrawLibItem )
if( draw_bgfill && Arc->m_Fill == FILLED_WITH_BG_BODYCOLOR )
{
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->arc( pos,
-t1,
-t2,
-t1,
Arc->m_Rayon,
Arc->m_Fill,
Arc->m_Width );
......@@ -126,7 +126,6 @@ static void PlotLibPart( Plotter* plotter, SCH_COMPONENT* DrawLibItem )
* transformation matrix causes xy axes to be flipped. */
t1 = (TransMat[0][0] != 0) ^ (Text->m_Orient != 0);
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;
thickness = Clamp_Text_PenSize( thickness, Text->m_Size, Text->m_Bold );
......@@ -369,9 +368,7 @@ static void PlotTextField( Plotter* plotter, SCH_COMPONENT* DrawLibItem,
}
int thickness = (field->m_Width == 0) ? g_DrawDefaultLineThickness : field->m_Width;
thickness = Clamp_Text_PenSize( thickness, field->m_Size, field->m_Bold );
plotter->set_current_line_width( thickness );
int thickness = field->GetPenSize( );
if( !IsMulti || (FieldNumber != REFERENCE) )
{
......@@ -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.
......@@ -520,7 +517,7 @@ static void PlotTextStruct( Plotter* plotter, EDA_BaseStruct* Struct )
{
static std::vector <wxPoint> Poly;
switch( Struct->Type() )
switch( aSchText->Type() )
{
case TYPE_SCH_GLOBALLABEL:
case TYPE_SCH_HIERLABEL:
......@@ -532,31 +529,29 @@ static void PlotTextStruct( Plotter* plotter, EDA_BaseStruct* Struct )
return;
}
SCH_TEXT* schText = (SCH_TEXT*) Struct;
EDA_Colors color = UNSPECIFIED_COLOR;
color = ReturnLayerColor( schText->m_Layer );
wxPoint textpos = schText->m_Pos + schText->GetSchematicTextOffset();
int thickness = (schText->m_Width == 0) ? g_DrawDefaultLineThickness : schText->m_Width;
thickness = Clamp_Text_PenSize( thickness, schText->m_Size, schText->m_Bold );
color = ReturnLayerColor( aSchText->m_Layer );
wxPoint textpos = aSchText->m_Pos + aSchText->GetSchematicTextOffset();
int thickness = aSchText->GetPenSize( );
plotter->set_current_line_width( thickness );
if( schText->m_MultilineAllowed )
if( aSchText->m_MultilineAllowed )
{
wxPoint pos = textpos;
wxArrayString* list = wxStringSplit( schText->m_Text, '\n' );
wxArrayString* list = wxStringSplit( aSchText->m_Text, '\n' );
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++ )
{
wxString txt = list->Item( i );
plotter->text( pos,
color, txt, schText->m_Orient, schText->m_Size,
schText->m_HJustify, schText->m_VJustify,
thickness, schText->m_Italic, schText->m_Bold );
color, txt, aSchText->m_Orient, aSchText->m_Size,
aSchText->m_HJustify, aSchText->m_VJustify,
thickness, aSchText->m_Italic, aSchText->m_Bold );
pos += offset;
}
......@@ -564,19 +559,19 @@ static void PlotTextStruct( Plotter* plotter, EDA_BaseStruct* Struct )
}
else
plotter->text( textpos,
color, schText->m_Text, schText->m_Orient, schText->m_Size,
schText->m_HJustify, schText->m_VJustify,
thickness, schText->m_Italic, schText->m_Bold );
color, aSchText->m_Text, aSchText->m_Orient, aSchText->m_Size,
aSchText->m_HJustify, aSchText->m_VJustify,
thickness, aSchText->m_Italic, aSchText->m_Bold );
/* 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 );
}
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 );
}
}
......@@ -775,7 +770,7 @@ void PlotDrawlist( Plotter* plotter, SCH_ITEM* drawlist )
case TYPE_SCH_LABEL:
case TYPE_SCH_GLOBALLABEL:
case TYPE_SCH_HIERLABEL:
PlotTextStruct( plotter, drawlist );
PlotTextStruct( plotter, (SCH_TEXT*) drawlist );
break;
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