Commit 7f9e9144 authored by charras's avatar charras
Browse files

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
Loading
Loading
Loading
Loading
+19 −13
Original line number Diff line number Diff line
@@ -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 );
}


+12 −1
Original line number Diff line number Diff line
@@ -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 );


+5 −0
Original line number Diff line number Diff line
@@ -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"
+13 −3
Original line number Diff line number Diff line
@@ -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 );
+20 −1
Original line number Diff line number Diff line
@@ -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:
Loading