Commit ee3b9500 authored by charras's avatar charras
Browse files

Added: comments in Drawtxt.cpp. By the way, solved: bug when drawing a 3D board with pcb texts.

parent 37c6e40d
Loading
Loading
Loading
Loading
+10 −8
Original line number Original line Diff line number Diff line
@@ -22,7 +22,7 @@




/****************************************************************************************************/
/****************************************************************************************************/
void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
                      const wxPoint& aPos, EDA_Colors aColor, const wxString& aText,
                      const wxPoint& aPos, EDA_Colors aColor, const wxString& aText,
                      int aOrient, const wxSize& aSize,
                      int aOrient, const wxSize& aSize,
                      enum GRTextHorizJustifyType aH_justify,
                      enum GRTextHorizJustifyType aH_justify,
@@ -34,7 +34,8 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
/** Function DrawGraphicText
/** Function DrawGraphicText
 * Draw a graphic text (like module texts)
 * Draw a graphic text (like module texts)
 * Draw a graphic text (like module texts)
 * Draw a graphic text (like module texts)
 *  @param aPanel = the current DrawPanel
 *  @param aPanel = the current DrawPanel. NULL if draw within a 3D GL Canvas
 *  @param aDC = the current Device Context. NULL if draw within a 3D GL Canvas
 *  @param aPos = text position (according to h_justify, v_justify)
 *  @param aPos = text position (according to h_justify, v_justify)
 *  @param aColor (enum EDA_Colors) = text color
 *  @param aColor (enum EDA_Colors) = text color
 *  @param aText = text to draw
 *  @param aText = text to draw
@@ -46,7 +47,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
 *      if width < 0 : draw segments in sketch mode, width = abs(width)
 *      if width < 0 : draw segments in sketch mode, width = abs(width)
 *  @param aItalic = true to simulate an italic font
 *  @param aItalic = true to simulate an italic font
 *  @param aCallback() = function called (if non null) to draw each segment.
 *  @param aCallback() = function called (if non null) to draw each segment.
 *                  used only to draw 3D texts
 *                  used to draw 3D texts or for plotting, NULL for normal drawings
 */
 */
{
{
    int            ii, kk, char_count, AsciiCode, endcar;
    int            ii, kk, char_count, AsciiCode, endcar;
@@ -189,10 +190,11 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
    ox = cX - dx;
    ox = cX - dx;
    oy = cY + dy;
    oy = cY + dy;


    if( aPanel->GetScreen()->Scale( aSize.x ) == 0 )
    // Note: if aPanel == NULL, we are using a GL Canvas that handle scaling
    if( aPanel && aPanel->GetScreen()->Scale( aSize.x ) == 0 )
        return;
        return;


    if( ABS( (aPanel->GetScreen()->Scale( aSize.x ) ) ) < 3 )    /* shapes are too small: connot be drawn */
    if( aPanel && ABS( (aPanel->GetScreen()->Scale( aSize.x ) ) ) < 3 )    /* shapes are too small: connot be drawn */
    {                                   /* insteed the text is drawn as a line */
    {                                   /* insteed the text is drawn as a line */
        dx = (pitch * char_count) / 2;
        dx = (pitch * char_count) / 2;
        dy = size_v / 2;                /* line is always centered */
        dy = size_v / 2;                /* line is always centered */
@@ -209,7 +211,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
        if ( aCallback )
        if ( aCallback )
            aCallback( ux0, uy0, dx, dy );
            aCallback( ux0, uy0, dx, dy );
        else
        else
            GRLine( &aPanel->m_ClipBox, DC, ux0, uy0, dx, dy, aWidth, aColor );
            GRLine( &aPanel->m_ClipBox, aDC, ux0, uy0, dx, dy, aWidth, aColor );


        return;
        return;
    }
    }
@@ -259,11 +261,11 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
                        int ik, * coordptr;
                        int ik, * coordptr;
                        coordptr = coord;
                        coordptr = coord;
                        for( ik = 0; ik < (ii - 2); ik += 2, coordptr += 2 )
                        for( ik = 0; ik < (ii - 2); ik += 2, coordptr += 2 )
                            GRCSegm( &aPanel->m_ClipBox, DC, *coordptr, *(coordptr + 1),
                            GRCSegm( &aPanel->m_ClipBox, aDC, *coordptr, *(coordptr + 1),
                                     *(coordptr + 2), *(coordptr + 3), aWidth, aColor );
                                     *(coordptr + 2), *(coordptr + 3), aWidth, aColor );
                    }
                    }
                    else
                    else
                        GRPoly( &aPanel->m_ClipBox, DC, ii / 2, (wxPoint*)coord, 0,
                        GRPoly( &aPanel->m_ClipBox, aDC, ii / 2, (wxPoint*)coord, 0,
                                aWidth, aColor, aColor );
                                aWidth, aColor, aColor );
                }
                }
                plume = f_cod; ii = 0;
                plume = f_cod; ii = 0;
+3 −2
Original line number Original line Diff line number Diff line
@@ -11,7 +11,8 @@


/** Function DrawGraphicText
/** Function DrawGraphicText
 * Draw a graphic text (like module texts)
 * Draw a graphic text (like module texts)
 *  @param aPanel = the current DrawPanel
 *  @param aPanel = the current DrawPanel. NULL if draw within a 3D GL Canvas
 *  @param aDC = the current Device Context. NULL if draw within a 3D GL Canvas
 *  @param aPos = text position (according to h_justify, v_justify)
 *  @param aPos = text position (according to h_justify, v_justify)
 *  @param aColor (enum EDA_Colors) = text color
 *  @param aColor (enum EDA_Colors) = text color
 *  @param aText = text to draw
 *  @param aText = text to draw
@@ -23,7 +24,7 @@
 *      if width < 0 : draw segments in sketch mode, width = abs(width)
 *      if width < 0 : draw segments in sketch mode, width = abs(width)
 *  @param aItalic = true to simulate an italic font
 *  @param aItalic = true to simulate an italic font
 *  @param aCallback() = function called (if non null) to draw each segment.
 *  @param aCallback() = function called (if non null) to draw each segment.
 *                  used only to draw 3D texts
 *                  used to draw 3D texts or for plotting, NULL for normal drawings
 */
 */
void DrawGraphicText( WinEDA_DrawPanel* aPanel,
void DrawGraphicText( WinEDA_DrawPanel* aPanel,
                                  wxDC* aDC,
                                  wxDC* aDC,