Commit 5c247857 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Replace in EDA_TEXT::Draw the parameter EDA_DRAW_PANEL* aPanel by EDA_RECT*...

Replace in EDA_TEXT::Draw the parameter EDA_DRAW_PANEL* aPanel  by EDA_RECT* aClipBox, which is the actual parameter used by Draw.
This change make more easy to  use this function when a EDA_DRAW_PANEL canvas is not used to draw texts.
Remove dead code in worksheet.cpp.
parent a56d3235
Loading
Loading
Loading
Loading
+17 −22
Original line number Original line Diff line number Diff line
@@ -242,7 +242,7 @@ static void DrawGraphicTextPline( EDA_RECT* aClipBox,
/**
/**
 * Function DrawGraphicText
 * Function DrawGraphicText
 * Draw a graphic text (like module texts)
 * Draw a graphic text (like module texts)
 *  @param aPanel = the current m_canvas. NULL if draw within a 3D GL Canvas
 *  @param aClipBox = the clipping rect, or NULL if no clipping
 *  @param aDC = the current Device Context. 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_COLOR_T) = text color
 *  @param aColor (enum EDA_COLOR_T) = text color
@@ -261,7 +261,7 @@ static void DrawGraphicTextPline( EDA_RECT* aClipBox,
 *  @param aPlotter = a pointer to a PLOTTER instance, when this function is used to plot
 *  @param aPlotter = a pointer to a PLOTTER instance, when this function is used to plot
 *                  the text. NULL to draw this text.
 *                  the text. NULL to draw this text.
 */
 */
void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
void DrawGraphicText( EDA_RECT* aClipBox,
                      wxDC* aDC,
                      wxDC* aDC,
                      const wxPoint& aPos,
                      const wxPoint& aPos,
                      EDA_COLOR_T aColor,
                      EDA_COLOR_T aColor,
@@ -284,9 +284,6 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
    wxPoint     current_char_pos;           // Draw coordinates for the current char
    wxPoint     current_char_pos;           // Draw coordinates for the current char
    wxPoint     overbar_pos;                // Start point for the current overbar
    wxPoint     overbar_pos;                // Start point for the current overbar
    int         overbar_italic_comp;        // Italic compensation for overbar
    int         overbar_italic_comp;        // Italic compensation for overbar
    EDA_RECT*   clipBox;                    // Clip box used in basic draw functions

    clipBox = aPanel ? aPanel->GetClipBox() : NULL;
    #define        BUF_SIZE 100
    #define        BUF_SIZE 100
    wxPoint coord[BUF_SIZE + 1];                // Buffer coordinate used to draw polylines (one char shape)
    wxPoint coord[BUF_SIZE + 1];                // Buffer coordinate used to draw polylines (one char shape)
    bool    sketch_mode     = false;
    bool    sketch_mode     = false;
@@ -322,7 +319,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
    dy  = size_v;
    dy  = size_v;


    /* Do not draw the text if out of draw area! */
    /* Do not draw the text if out of draw area! */
    if( aPanel )
    if( aClipBox )
    {
    {
        int xm, ym, ll, xc, yc;
        int xm, ym, ll, xc, yc;
        ll = std::abs( dx );
        ll = std::abs( dx );
@@ -330,10 +327,10 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
        xc  = current_char_pos.x;
        xc  = current_char_pos.x;
        yc  = current_char_pos.y;
        yc  = current_char_pos.y;


        x0  = aPanel->GetClipBox()->GetX() - ll;
        x0  = aClipBox->GetX() - ll;
        y0  = aPanel->GetClipBox()->GetY() - ll;
        y0  = aClipBox->GetY() - ll;
        xm  = aPanel->GetClipBox()->GetRight() + ll;
        xm  = aClipBox->GetRight() + ll;
        ym  = aPanel->GetClipBox()->GetBottom() + ll;
        ym  = aClipBox->GetBottom() + ll;


        if( xc < x0 )
        if( xc < x0 )
            return;
            return;
@@ -407,7 +404,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
            aCallback( current_char_pos.x, current_char_pos.y, end.x, end.y );
            aCallback( current_char_pos.x, current_char_pos.y, end.x, end.y );
        }
        }
        else
        else
            GRLine( clipBox, aDC,
            GRLine( aClipBox, aDC,
                    current_char_pos.x, current_char_pos.y, end.x, end.y, aWidth, aColor );
                    current_char_pos.x, current_char_pos.y, end.x, end.y, aWidth, aColor );


        return;
        return;
@@ -461,7 +458,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
                    RotatePoint( &overbar_pos, aPos, aOrient );
                    RotatePoint( &overbar_pos, aPos, aOrient );
                    coord[1] = overbar_pos;
                    coord[1] = overbar_pos;
                    // Plot the overbar segment
                    // Plot the overbar segment
                    DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
                    DrawGraphicTextPline( aClipBox, aDC, aColor, aWidth,
                                          sketch_mode, 2, coord, aCallback, aPlotter );
                                          sketch_mode, 2, coord, aCallback, aPlotter );
                }
                }


@@ -508,7 +505,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
                    if( aWidth <= 1 )
                    if( aWidth <= 1 )
                        aWidth = 0;
                        aWidth = 0;


                    DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
                    DrawGraphicTextPline( aClipBox, aDC, aColor, aWidth,
                                          sketch_mode, point_count, coord,
                                          sketch_mode, point_count, coord,
                                          aCallback, aPlotter );
                                          aCallback, aPlotter );
                }
                }
@@ -554,13 +551,12 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
        coord[1] = overbar_pos;
        coord[1] = overbar_pos;


        // Plot the overbar segment
        // Plot the overbar segment
        DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
        DrawGraphicTextPline( aClipBox, aDC, aColor, aWidth,
                              sketch_mode, 2, coord, aCallback, aPlotter );
                              sketch_mode, 2, coord, aCallback, aPlotter );
    }
    }
}
}


void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel,
void DrawGraphicHaloText( EDA_RECT* aClipBox, wxDC * aDC,
                          wxDC * aDC,
                          const wxPoint &aPos,
                          const wxPoint &aPos,
                          enum EDA_COLOR_T aBgColor,
                          enum EDA_COLOR_T aBgColor,
                          enum EDA_COLOR_T aColor1,
                          enum EDA_COLOR_T aColor1,
@@ -570,24 +566,23 @@ void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel,
                          const wxSize &aSize,
                          const wxSize &aSize,
                          enum EDA_TEXT_HJUSTIFY_T aH_justify,
                          enum EDA_TEXT_HJUSTIFY_T aH_justify,
                          enum EDA_TEXT_VJUSTIFY_T aV_justify,
                          enum EDA_TEXT_VJUSTIFY_T aV_justify,
                          int aWidth,
                          int aWidth, bool aItalic, bool aBold,
                          bool aItalic,
                          bool aBold,
                          void (*aCallback)( int x0, int y0, int xf, int yf ),
                          void (*aCallback)( int x0, int y0, int xf, int yf ),
                          PLOTTER * aPlotter )
                          PLOTTER * aPlotter )
{
{
    // Swap color if contrast would be better
    // Swap color if contrast would be better
    if( ColorIsLight( aBgColor ) ) {
    if( ColorIsLight( aBgColor ) )
    {
        EDA_COLOR_T c = aColor1;
        EDA_COLOR_T c = aColor1;
        aColor1 = aColor2;
        aColor1 = aColor2;
        aColor2 = c;
        aColor2 = c;
    }
    }


    DrawGraphicText( aPanel, aDC, aPos, aColor1, aText, aOrient, aSize,
    DrawGraphicText( aClipBox, aDC, aPos, aColor1, aText, aOrient, aSize,
                     aH_justify, aV_justify, aWidth, aItalic, aBold,
                     aH_justify, aV_justify, aWidth, aItalic, aBold,
                     aCallback, aPlotter );
                     aCallback, aPlotter );


    DrawGraphicText( aPanel, aDC, aPos, aColor2, aText, aOrient, aSize,
    DrawGraphicText( aClipBox, aDC, aPos, aColor2, aText, aOrient, aSize,
                     aH_justify, aV_justify, aWidth / 4, aItalic, aBold,
                     aH_justify, aV_justify, aWidth / 4, aItalic, aBold,
                     aCallback, aPlotter );
                     aCallback, aPlotter );
}
}
+15 −23
Original line number Original line Diff line number Diff line
@@ -39,6 +39,9 @@
#elif defined( EESCHEMA )
#elif defined( EESCHEMA )
    #include <sch_item_struct.h>
    #include <sch_item_struct.h>
#elif defined( GERBVIEW )
#elif defined( GERBVIEW )
#elif defined( PL_EDITOR )
    #include <base_units.h>
    #define FMT_IU Double2Str
#else
#else
#error "Cannot resolve units formatting due to no definition of EESCHEMA or PCBNEW."
#error "Cannot resolve units formatting due to no definition of EESCHEMA or PCBNEW."
#endif
#endif
@@ -212,7 +215,7 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
}
}




void EDA_TEXT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
                     EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode,
                     EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode,
                     EDA_DRAW_MODE_T aFillMode, EDA_COLOR_T aAnchor_color )
                     EDA_DRAW_MODE_T aFillMode, EDA_COLOR_T aAnchor_color )
{
{
@@ -229,34 +232,23 @@ void EDA_TEXT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
        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 );
            DrawOneLineOfText( aPanel,
            drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
                               aDC,
                               aDrawMode, aFillMode,
                               aOffset,
                               aColor,
                               aDrawMode,
                               aFillMode,
                               i ?  UNSPECIFIED_COLOR : aAnchor_color,
                               i ?  UNSPECIFIED_COLOR : aAnchor_color,
                               txt,
                               txt, pos );
                               pos );
            pos += offset;
            pos += offset;
        }
        }


        delete (list);
        delete (list);
    }
    }
    else
    else
        DrawOneLineOfText( aPanel,
        drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
                           aDC,
                           aDrawMode, aFillMode,
                           aOffset,
                           aAnchor_color, m_Text, m_Pos );
                           aColor,
                           aDrawMode,
                           aFillMode,
                           aAnchor_color,
                           m_Text,
                           m_Pos );
}
}




void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
void EDA_TEXT::drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC,
                                  const wxPoint& aOffset, EDA_COLOR_T aColor,
                                  const wxPoint& aOffset, EDA_COLOR_T aColor,
                                  GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode,
                                  GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode,
                                  EDA_COLOR_T aAnchor_color,
                                  EDA_COLOR_T aAnchor_color,
@@ -273,7 +265,7 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
    // Draw text anchor, if requested
    // Draw text anchor, if requested
    if( aAnchor_color != UNSPECIFIED_COLOR )
    if( aAnchor_color != UNSPECIFIED_COLOR )
    {
    {
        GRDrawAnchor( aPanel->GetClipBox(), aDC,
        GRDrawAnchor( aClipBox, aDC,
                      aPos.x + aOffset.x, aPos.y + aOffset.y,
                      aPos.x + aOffset.x, aPos.y + aOffset.y,
                      DIM_ANCRE_TEXTE, aAnchor_color );
                      DIM_ANCRE_TEXTE, aAnchor_color );
    }
    }
@@ -286,7 +278,7 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
    if( m_Mirror )
    if( m_Mirror )
        size.x = -size.x;
        size.x = -size.x;


    DrawGraphicText( aPanel, aDC, aOffset + aPos, aColor, aText, m_Orient, size,
    DrawGraphicText( aClipBox, aDC, aOffset + aPos, aColor, aText, m_Orient, size,
                     m_HJustify, m_VJustify, width, m_Italic, m_Bold );
                     m_HJustify, m_VJustify, width, m_Italic, m_Bold );
}
}


+42 −81
Original line number Original line Diff line number Diff line
@@ -46,44 +46,20 @@


static const wxString productName = wxT( "KiCad E.D.A.  " );
static const wxString productName = wxT( "KiCad E.D.A.  " );



/* Draws the item list crated by BuildWorkSheetGraphicList
void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas,
 * aClipBox = the clipping rect, or NULL if no clipping
                     const PAGE_INFO& aPageInfo,
 * aDC = the current Device Context
                     const wxString &aFullSheetName,
 */
                     const wxString& aFileName,
void WS_DRAW_ITEM_LIST::Draw( EDA_RECT* aClipBox, wxDC* aDC )
                     TITLE_BLOCK& aTitleBlock,
                     int aSheetCount, int aSheetNumber,
                     int aPenWidth, double aScalar,
                     EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor )
{
{
    GRSetDrawMode( aDC, GR_COPY );
    for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
    WS_DRAW_ITEM_LIST drawList;

    wxPoint LTmargin( aPageInfo.GetLeftMarginMils(), aPageInfo.GetTopMarginMils() );
    wxPoint RBmargin( aPageInfo.GetRightMarginMils(), aPageInfo.GetBottomMarginMils() );
    wxSize pagesize = aPageInfo.GetSizeMils();

    drawList.SetMargins( LTmargin, RBmargin );
    drawList.SetPenSize( aPenWidth );
    drawList.SetMilsToIUfactor( aScalar );
    drawList.SetPageSize( pagesize );
    drawList.SetSheetNumber( aSheetNumber );
    drawList.SetSheetCount( aSheetCount );

    drawList.BuildWorkSheetGraphicList(
                               aPageInfo.GetType(), aFullSheetName, aFileName,
                               aTitleBlock, aLineColor, aTextColor );

    // Draw item list
    for( WS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item;
         item = drawList.GetNext() )
    {
    {
        switch( item->GetType() )
        switch( item->GetType() )
        {
        {
        case WS_DRAW_ITEM_BASE::wsg_line:
        case WS_DRAW_ITEM_BASE::wsg_line:
            {
            {
                WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item;
                WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item;
                GRLine( aCanvas ? aCanvas->GetClipBox() : NULL, aDC,
                GRLine( aClipBox, aDC,
                        line->GetStart(), line->GetEnd(),
                        line->GetStart(), line->GetEnd(),
                        line->GetPenWidth(), line->GetColor() );
                        line->GetPenWidth(), line->GetColor() );
            }
            }
@@ -92,7 +68,7 @@ void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas,
        case WS_DRAW_ITEM_BASE::wsg_rect:
        case WS_DRAW_ITEM_BASE::wsg_rect:
            {
            {
                WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
                WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
                GRRect( aCanvas ? aCanvas->GetClipBox() : NULL, aDC,
                GRRect( aClipBox, aDC,
                        rect->GetStart().x, rect->GetStart().y,
                        rect->GetStart().x, rect->GetStart().y,
                        rect->GetEnd().x, rect->GetEnd().y,
                        rect->GetEnd().x, rect->GetEnd().y,
                        rect->GetPenWidth(), rect->GetColor() );
                        rect->GetPenWidth(), rect->GetColor() );
@@ -102,7 +78,7 @@ void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas,
        case WS_DRAW_ITEM_BASE::wsg_text:
        case WS_DRAW_ITEM_BASE::wsg_text:
            {
            {
                WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item;
                WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item;
                DrawGraphicText( aCanvas, aDC, text->GetTextPosition(),
                DrawGraphicText( aClipBox, aDC, text->GetTextPosition(),
                                 text->GetColor(), text->GetText(),
                                 text->GetColor(), text->GetText(),
                                 text->GetOrientation(), text->GetSize(),
                                 text->GetOrientation(), text->GetSize(),
                                 text->GetHorizJustify(), text->GetVertJustify(),
                                 text->GetHorizJustify(), text->GetVertJustify(),
@@ -113,7 +89,7 @@ void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas,
        case WS_DRAW_ITEM_BASE::wsg_poly:
        case WS_DRAW_ITEM_BASE::wsg_poly:
            {
            {
                WS_DRAW_ITEM_POLYGON* poly = (WS_DRAW_ITEM_POLYGON*) item;
                WS_DRAW_ITEM_POLYGON* poly = (WS_DRAW_ITEM_POLYGON*) item;
                GRPoly( aCanvas ? aCanvas->GetClipBox() : NULL, aDC,
                GRPoly( aClipBox, aDC,
                        poly->m_Corners.size(), &poly->m_Corners[0],
                        poly->m_Corners.size(), &poly->m_Corners[0],
                        poly->IsFilled() ? FILLED_SHAPE : NO_FILL,
                        poly->IsFilled() ? FILLED_SHAPE : NO_FILL,
                        poly->GetPenWidth(),
                        poly->GetPenWidth(),
@@ -124,6 +100,37 @@ void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas,
    }
    }
}
}


void DrawPageLayout( wxDC* aDC, EDA_RECT* aClipBox,
                     const PAGE_INFO& aPageInfo,
                     const wxString &aFullSheetName,
                     const wxString& aFileName,
                     TITLE_BLOCK& aTitleBlock,
                     int aSheetCount, int aSheetNumber,
                     int aPenWidth, double aScalar,
                     EDA_COLOR_T aColor, EDA_COLOR_T aAltColor )
{
    GRSetDrawMode( aDC, GR_COPY );
    WS_DRAW_ITEM_LIST drawList;

    wxPoint LTmargin( aPageInfo.GetLeftMarginMils(), aPageInfo.GetTopMarginMils() );
    wxPoint RBmargin( aPageInfo.GetRightMarginMils(), aPageInfo.GetBottomMarginMils() );
    wxSize pagesize = aPageInfo.GetSizeMils();

    drawList.SetMargins( LTmargin, RBmargin );
    drawList.SetPenSize( aPenWidth );
    drawList.SetMilsToIUfactor( aScalar );
    drawList.SetPageSize( pagesize );
    drawList.SetSheetNumber( aSheetNumber );
    drawList.SetSheetCount( aSheetCount );

    drawList.BuildWorkSheetGraphicList(
                               aPageInfo.GetType(), aFullSheetName, aFileName,
                               aTitleBlock, aColor, aAltColor );

    // Draw item list
    drawList.Draw( aClipBox, aDC );
}



void EDA_DRAW_FRAME::DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
void EDA_DRAW_FRAME::DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
                                     double aScalar, const wxString &aFilename )
                                     double aScalar, const wxString &aFilename )
@@ -146,59 +153,13 @@ void EDA_DRAW_FRAME::DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWi
    TITLE_BLOCK t_block = GetTitleBlock();
    TITLE_BLOCK t_block = GetTitleBlock();
    EDA_COLOR_T color = RED;
    EDA_COLOR_T color = RED;


    DrawPageLayout( aDC, m_canvas, pageInfo,
    DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo,
                    aFilename, GetScreenDesc(), t_block,
                    aFilename, GetScreenDesc(), t_block,
                    aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
                    aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
                    aLineWidth, aScalar, color, color );
                    aLineWidth, aScalar, color, color );
}
}




const wxString EDA_DRAW_FRAME::GetXYSheetReferences( const wxPoint& aPosition ) const
{
    const PAGE_INFO& pageInfo = GetPageSettings();

    int         ii;
    int         xg, yg;
    int         ipas;
    int         gxpas, gypas;
    int         refx, refy;
    wxString    msg;

    // Upper left corner
    refx = pageInfo.GetLeftMarginMils();
    refy = pageInfo.GetTopMarginMils();

    // lower right corner
    xg   = pageInfo.GetSizeMils().x - pageInfo.GetRightMarginMils();
    yg   = pageInfo.GetSizeMils().y - pageInfo.GetBottomMarginMils();

    // Get the Y axis identifier (A symbol A ... Z)
    if( aPosition.y < refy || aPosition.y > yg )  // Outside of Y limits
        msg << wxT( "?" );
    else
    {
        ipas  = ( yg - refy ) / PAS_REF;        // ipas = Y count sections
        gypas = ( yg - refy ) / ipas;           // gypas = Y section size
        ii    = ( aPosition.y - refy ) / gypas;
        msg.Printf( wxT( "%c" ), 'A' + ii );
    }

    // Get the X axis identifier (A number 1 ... n)
    if( aPosition.x < refx || aPosition.x > xg )  // Outside of X limits
        msg << wxT( "?" );
    else
    {
        ipas  = ( xg - refx ) / PAS_REF;        // ipas = X count sections
        gxpas = ( xg - refx ) / ipas;           // gxpas = X section size

        ii = ( aPosition.x - refx ) / gxpas;
        msg << ii + 1;
    }

    return msg;
}


wxString EDA_DRAW_FRAME::GetScreenDesc()
wxString EDA_DRAW_FRAME::GetScreenDesc()
{
{
    // Virtual function, in basic function, returns
    // Virtual function, in basic function, returns
+3 −2
Original line number Original line Diff line number Diff line
@@ -304,7 +304,8 @@ void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
        text = m_Text;
        text = m_Text;


    GRSetDrawMode( aDC, aDrawMode );
    GRSetDrawMode( aDC, aDrawMode );
    DrawGraphicText( aPanel, aDC, text_pos, (EDA_COLOR_T) color, text, m_Orient, m_Size,
    EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
    DrawGraphicText( clipbox, aDC, text_pos, (EDA_COLOR_T) color, text, m_Orient, m_Size,
                     m_HJustify, m_VJustify, linewidth, m_Italic, m_Bold );
                     m_HJustify, m_VJustify, linewidth, m_Italic, m_Bold );


    /* Set to one (1) to draw bounding box around field text to validate
    /* Set to one (1) to draw bounding box around field text to validate
@@ -315,7 +316,7 @@ void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
    grBox.SetOrigin( aTransform.TransformCoordinate( bBox.GetOrigin() ) );
    grBox.SetOrigin( aTransform.TransformCoordinate( bBox.GetOrigin() ) );
    grBox.SetEnd( aTransform.TransformCoordinate( bBox.GetEnd() ) );
    grBox.SetEnd( aTransform.TransformCoordinate( bBox.GetEnd() ) );
    grBox.Move( aOffset );
    grBox.Move( aOffset );
    GRRect( aPanel->GetClipBox(), aDC, grBox, 0, LIGHTMAGENTA );
    GRRect( clipbox, aDC, grBox, 0, LIGHTMAGENTA );
#endif
#endif
}
}


+12 −11
Original line number Original line Diff line number Diff line
@@ -1091,6 +1091,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
    numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
    numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );


    GRSetDrawMode( DC, DrawMode );
    GRSetDrawMode( DC, DrawMode );
    EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;


    /* Get the num and name colors */
    /* Get the num and name colors */
    if( (Color < 0) && IsSelected() )
    if( (Color < 0) && IsSelected() )
@@ -1139,7 +1140,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
                if( orient == PIN_RIGHT )
                if( orient == PIN_RIGHT )
                {
                {
                    x = x1 + TextInside;
                    x = x1 + TextInside;
                    DrawGraphicText( panel, DC, wxPoint( x, y1 ), NameColor,
                    DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor,
                                     m_name,
                                     m_name,
                                     TEXT_ORIENT_HORIZ,
                                     TEXT_ORIENT_HORIZ,
                                     PinNameSize,
                                     PinNameSize,
@@ -1150,7 +1151,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
                else    // Orient == PIN_LEFT
                else    // Orient == PIN_LEFT
                {
                {
                    x = x1 - TextInside;
                    x = x1 - TextInside;
                    DrawGraphicText( panel, DC, wxPoint( x, y1 ), NameColor,
                    DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor,
                                     m_name,
                                     m_name,
                                     TEXT_ORIENT_HORIZ,
                                     TEXT_ORIENT_HORIZ,
                                     PinNameSize,
                                     PinNameSize,
@@ -1162,7 +1163,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,


            if( DrawPinNum )
            if( DrawPinNum )
            {
            {
                DrawGraphicText( panel, DC,
                DrawGraphicText( clipbox, DC,
                                 wxPoint( (x1 + pin_pos.x) / 2,
                                 wxPoint( (x1 + pin_pos.x) / 2,
                                         y1 - TXTMARGE ), NumColor,
                                         y1 - TXTMARGE ), NumColor,
                                 StringPinNum,
                                 StringPinNum,
@@ -1180,7 +1181,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
                y = y1 + TextInside;
                y = y1 + TextInside;


                if( DrawPinName )
                if( DrawPinName )
                    DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor,
                    DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor,
                                     m_name,
                                     m_name,
                                     TEXT_ORIENT_VERT, PinNameSize,
                                     TEXT_ORIENT_VERT, PinNameSize,
                                     GR_TEXT_HJUSTIFY_RIGHT,
                                     GR_TEXT_HJUSTIFY_RIGHT,
@@ -1188,7 +1189,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
                                     false, false );
                                     false, false );


                if( DrawPinNum )
                if( DrawPinNum )
                    DrawGraphicText( panel, DC,
                    DrawGraphicText( clipbox, DC,
                                     wxPoint( x1 - TXTMARGE,
                                     wxPoint( x1 - TXTMARGE,
                                              (y1 + pin_pos.y) / 2 ), NumColor,
                                              (y1 + pin_pos.y) / 2 ), NumColor,
                                     StringPinNum,
                                     StringPinNum,
@@ -1202,7 +1203,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
                y = y1 - TextInside;
                y = y1 - TextInside;


                if( DrawPinName )
                if( DrawPinName )
                    DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor,
                    DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor,
                                     m_name,
                                     m_name,
                                     TEXT_ORIENT_VERT, PinNameSize,
                                     TEXT_ORIENT_VERT, PinNameSize,
                                     GR_TEXT_HJUSTIFY_LEFT,
                                     GR_TEXT_HJUSTIFY_LEFT,
@@ -1210,7 +1211,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
                                     false, false );
                                     false, false );


                if( DrawPinNum )
                if( DrawPinNum )
                    DrawGraphicText( panel, DC,
                    DrawGraphicText( clipbox, DC,
                                     wxPoint( x1 - TXTMARGE,
                                     wxPoint( x1 - TXTMARGE,
                                              (y1 + pin_pos.y) / 2 ), NumColor,
                                              (y1 + pin_pos.y) / 2 ), NumColor,
                                     StringPinNum,
                                     StringPinNum,
@@ -1229,7 +1230,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
            if( DrawPinName )
            if( DrawPinName )
            {
            {
                x = (x1 + pin_pos.x) / 2;
                x = (x1 + pin_pos.x) / 2;
                DrawGraphicText( panel, DC, wxPoint( x, y1 - TXTMARGE ),
                DrawGraphicText( clipbox, DC, wxPoint( x, y1 - TXTMARGE ),
                                 NameColor, m_name,
                                 NameColor, m_name,
                                 TEXT_ORIENT_HORIZ, PinNameSize,
                                 TEXT_ORIENT_HORIZ, PinNameSize,
                                 GR_TEXT_HJUSTIFY_CENTER,
                                 GR_TEXT_HJUSTIFY_CENTER,
@@ -1239,7 +1240,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
            if( DrawPinNum )
            if( DrawPinNum )
            {
            {
                x = (x1 + pin_pos.x) / 2;
                x = (x1 + pin_pos.x) / 2;
                DrawGraphicText( panel, DC, wxPoint( x, y1 + TXTMARGE ),
                DrawGraphicText( clipbox, DC, wxPoint( x, y1 + TXTMARGE ),
                                 NumColor, StringPinNum,
                                 NumColor, StringPinNum,
                                 TEXT_ORIENT_HORIZ, PinNumSize,
                                 TEXT_ORIENT_HORIZ, PinNumSize,
                                 GR_TEXT_HJUSTIFY_CENTER,
                                 GR_TEXT_HJUSTIFY_CENTER,
@@ -1252,7 +1253,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
            if( DrawPinName )
            if( DrawPinName )
            {
            {
                y = (y1 + pin_pos.y) / 2;
                y = (y1 + pin_pos.y) / 2;
                DrawGraphicText( panel, DC, wxPoint( x1 - TXTMARGE, y ),
                DrawGraphicText( clipbox, DC, wxPoint( x1 - TXTMARGE, y ),
                                 NameColor, m_name,
                                 NameColor, m_name,
                                 TEXT_ORIENT_VERT, PinNameSize,
                                 TEXT_ORIENT_VERT, PinNameSize,
                                 GR_TEXT_HJUSTIFY_CENTER,
                                 GR_TEXT_HJUSTIFY_CENTER,
@@ -1262,7 +1263,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,


            if( DrawPinNum )
            if( DrawPinNum )
            {
            {
                DrawGraphicText( panel, DC,
                DrawGraphicText( clipbox, DC,
                                 wxPoint( x1 + TXTMARGE, (y1 + pin_pos.y) / 2 ),
                                 wxPoint( x1 + TXTMARGE, (y1 + pin_pos.y) / 2 ),
                                 NumColor, StringPinNum,
                                 NumColor, StringPinNum,
                                 TEXT_ORIENT_VERT, PinNumSize,
                                 TEXT_ORIENT_VERT, PinNumSize,
Loading