diff --git a/common/drawtxt.cpp b/common/drawtxt.cpp index b7da2dc15f..5fe1d5f768 100644 --- a/common/drawtxt.cpp +++ b/common/drawtxt.cpp @@ -242,7 +242,7 @@ static void DrawGraphicTextPline( EDA_RECT* aClipBox, /** * Function DrawGraphicText * 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 aPos = text position (according to h_justify, v_justify) * @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 * the text. NULL to draw this text. */ -void DrawGraphicText( EDA_DRAW_PANEL* aPanel, +void DrawGraphicText( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aPos, 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 overbar_pos; // Start point for the current 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 wxPoint coord[BUF_SIZE + 1]; // Buffer coordinate used to draw polylines (one char shape) bool sketch_mode = false; @@ -322,7 +319,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, dy = size_v; /* Do not draw the text if out of draw area! */ - if( aPanel ) + if( aClipBox ) { int xm, ym, ll, xc, yc; ll = std::abs( dx ); @@ -330,10 +327,10 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, xc = current_char_pos.x; yc = current_char_pos.y; - x0 = aPanel->GetClipBox()->GetX() - ll; - y0 = aPanel->GetClipBox()->GetY() - ll; - xm = aPanel->GetClipBox()->GetRight() + ll; - ym = aPanel->GetClipBox()->GetBottom() + ll; + x0 = aClipBox->GetX() - ll; + y0 = aClipBox->GetY() - ll; + xm = aClipBox->GetRight() + ll; + ym = aClipBox->GetBottom() + ll; if( xc < x0 ) return; @@ -407,7 +404,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, aCallback( current_char_pos.x, current_char_pos.y, end.x, end.y ); } else - GRLine( clipBox, aDC, + GRLine( aClipBox, aDC, current_char_pos.x, current_char_pos.y, end.x, end.y, aWidth, aColor ); return; @@ -461,7 +458,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, RotatePoint( &overbar_pos, aPos, aOrient ); coord[1] = overbar_pos; // Plot the overbar segment - DrawGraphicTextPline( clipBox, aDC, aColor, aWidth, + DrawGraphicTextPline( aClipBox, aDC, aColor, aWidth, sketch_mode, 2, coord, aCallback, aPlotter ); } @@ -508,7 +505,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, if( aWidth <= 1 ) aWidth = 0; - DrawGraphicTextPline( clipBox, aDC, aColor, aWidth, + DrawGraphicTextPline( aClipBox, aDC, aColor, aWidth, sketch_mode, point_count, coord, aCallback, aPlotter ); } @@ -554,13 +551,12 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, coord[1] = overbar_pos; // Plot the overbar segment - DrawGraphicTextPline( clipBox, aDC, aColor, aWidth, + DrawGraphicTextPline( aClipBox, aDC, aColor, aWidth, sketch_mode, 2, coord, aCallback, aPlotter ); } } -void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel, - wxDC * aDC, +void DrawGraphicHaloText( EDA_RECT* aClipBox, wxDC * aDC, const wxPoint &aPos, enum EDA_COLOR_T aBgColor, enum EDA_COLOR_T aColor1, @@ -570,24 +566,23 @@ void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, - int aWidth, - bool aItalic, - bool aBold, + int aWidth, bool aItalic, bool aBold, void (*aCallback)( int x0, int y0, int xf, int yf ), PLOTTER * aPlotter ) { // Swap color if contrast would be better - if( ColorIsLight( aBgColor ) ) { + if( ColorIsLight( aBgColor ) ) + { EDA_COLOR_T c = aColor1; aColor1 = aColor2; 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, 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, aCallback, aPlotter ); } diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 59383b2dcb..2c90aa4891 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -35,10 +35,13 @@ // Conversion to application internal units defined at build time. #if defined( PCBNEW ) -#include + #include #elif defined( EESCHEMA ) -#include + #include #elif defined( GERBVIEW ) +#elif defined( PL_EDITOR ) + #include + #define FMT_IU Double2Str #else #error "Cannot resolve units formatting due to no definition of EESCHEMA or PCBNEW." #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_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; iCount(); i++ ) { wxString txt = list->Item( i ); - DrawOneLineOfText( aPanel, - aDC, - aOffset, - aColor, - aDrawMode, - aFillMode, + drawOneLineOfText( aClipBox, aDC, aOffset, aColor, + aDrawMode, aFillMode, i ? UNSPECIFIED_COLOR : aAnchor_color, - txt, - pos ); + txt, pos ); pos += offset; } delete (list); } else - DrawOneLineOfText( aPanel, - aDC, - aOffset, - aColor, - aDrawMode, - aFillMode, - aAnchor_color, - m_Text, - m_Pos ); + drawOneLineOfText( aClipBox, aDC, aOffset, 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, GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode, EDA_COLOR_T aAnchor_color, @@ -273,7 +265,7 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, // Draw text anchor, if requested if( aAnchor_color != UNSPECIFIED_COLOR ) { - GRDrawAnchor( aPanel->GetClipBox(), aDC, + GRDrawAnchor( aClipBox, aDC, aPos.x + aOffset.x, aPos.y + aOffset.y, DIM_ANCRE_TEXTE, aAnchor_color ); } @@ -286,7 +278,7 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, if( m_Mirror ) 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 ); } diff --git a/common/worksheet.cpp b/common/worksheet.cpp index f3fc9b5463..d3c242f1be 100644 --- a/common/worksheet.cpp +++ b/common/worksheet.cpp @@ -46,15 +46,68 @@ static const wxString productName = wxT( "KiCad E.D.A. " ); +/* Draws the item list crated by BuildWorkSheetGraphicList + * aClipBox = the clipping rect, or NULL if no clipping + * aDC = the current Device Context + */ +void WS_DRAW_ITEM_LIST::Draw( EDA_RECT* aClipBox, wxDC* aDC ) +{ + for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() ) + { + switch( item->GetType() ) + { + case WS_DRAW_ITEM_BASE::wsg_line: + { + WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item; + GRLine( aClipBox, aDC, + line->GetStart(), line->GetEnd(), + line->GetPenWidth(), line->GetColor() ); + } + break; -void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas, + case WS_DRAW_ITEM_BASE::wsg_rect: + { + WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item; + GRRect( aClipBox, aDC, + rect->GetStart().x, rect->GetStart().y, + rect->GetEnd().x, rect->GetEnd().y, + rect->GetPenWidth(), rect->GetColor() ); + } + break; + + case WS_DRAW_ITEM_BASE::wsg_text: + { + WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item; + DrawGraphicText( aClipBox, aDC, text->GetTextPosition(), + text->GetColor(), text->GetText(), + text->GetOrientation(), text->GetSize(), + text->GetHorizJustify(), text->GetVertJustify(), + text->GetPenWidth(), text->IsItalic(), text->IsBold() ); + } + break; + + case WS_DRAW_ITEM_BASE::wsg_poly: + { + WS_DRAW_ITEM_POLYGON* poly = (WS_DRAW_ITEM_POLYGON*) item; + GRPoly( aClipBox, aDC, + poly->m_Corners.size(), &poly->m_Corners[0], + poly->IsFilled() ? FILLED_SHAPE : NO_FILL, + poly->GetPenWidth(), + poly->GetColor(), poly->GetColor() ); + } + break; + } + } +} + +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 aLineColor, EDA_COLOR_T aTextColor ) + EDA_COLOR_T aColor, EDA_COLOR_T aAltColor ) { GRSetDrawMode( aDC, GR_COPY ); WS_DRAW_ITEM_LIST drawList; @@ -72,56 +125,10 @@ void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas, drawList.BuildWorkSheetGraphicList( aPageInfo.GetType(), aFullSheetName, aFileName, - aTitleBlock, aLineColor, aTextColor ); + aTitleBlock, aColor, aAltColor ); // Draw item list - for( WS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item; - item = drawList.GetNext() ) - { - switch( item->GetType() ) - { - case WS_DRAW_ITEM_BASE::wsg_line: - { - WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item; - GRLine( aCanvas ? aCanvas->GetClipBox() : NULL, aDC, - line->GetStart(), line->GetEnd(), - line->GetPenWidth(), line->GetColor() ); - } - break; - - case WS_DRAW_ITEM_BASE::wsg_rect: - { - WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item; - GRRect( aCanvas ? aCanvas->GetClipBox() : NULL, aDC, - rect->GetStart().x, rect->GetStart().y, - rect->GetEnd().x, rect->GetEnd().y, - rect->GetPenWidth(), rect->GetColor() ); - } - break; - - case WS_DRAW_ITEM_BASE::wsg_text: - { - WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item; - DrawGraphicText( aCanvas, aDC, text->GetTextPosition(), - text->GetColor(), text->GetText(), - text->GetOrientation(), text->GetSize(), - text->GetHorizJustify(), text->GetVertJustify(), - text->GetPenWidth(), text->IsItalic(), text->IsBold() ); - } - break; - - case WS_DRAW_ITEM_BASE::wsg_poly: - { - WS_DRAW_ITEM_POLYGON* poly = (WS_DRAW_ITEM_POLYGON*) item; - GRPoly( aCanvas ? aCanvas->GetClipBox() : NULL, aDC, - poly->m_Corners.size(), &poly->m_Corners[0], - poly->IsFilled() ? FILLED_SHAPE : NO_FILL, - poly->GetPenWidth(), - poly->GetColor(), poly->GetColor() ); - } - break; - } - } + drawList.Draw( aClipBox, aDC ); } @@ -146,59 +153,13 @@ void EDA_DRAW_FRAME::DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWi TITLE_BLOCK t_block = GetTitleBlock(); EDA_COLOR_T color = RED; - DrawPageLayout( aDC, m_canvas, pageInfo, + DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo, aFilename, GetScreenDesc(), t_block, aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber, 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() { // Virtual function, in basic function, returns diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index 60a32cf419..2a3fbdb245 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -304,7 +304,8 @@ void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a text = m_Text; 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 ); /* 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.SetEnd( aTransform.TransformCoordinate( bBox.GetEnd() ) ); grBox.Move( aOffset ); - GRRect( aPanel->GetClipBox(), aDC, grBox, 0, LIGHTMAGENTA ); + GRRect( clipbox, aDC, grBox, 0, LIGHTMAGENTA ); #endif } diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 36122e433f..4494a3068a 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -1091,6 +1091,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false ); GRSetDrawMode( DC, DrawMode ); + EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL; /* Get the num and name colors */ if( (Color < 0) && IsSelected() ) @@ -1139,7 +1140,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, if( orient == PIN_RIGHT ) { x = x1 + TextInside; - DrawGraphicText( panel, DC, wxPoint( x, y1 ), NameColor, + DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor, m_name, TEXT_ORIENT_HORIZ, PinNameSize, @@ -1150,7 +1151,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, else // Orient == PIN_LEFT { x = x1 - TextInside; - DrawGraphicText( panel, DC, wxPoint( x, y1 ), NameColor, + DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor, m_name, TEXT_ORIENT_HORIZ, PinNameSize, @@ -1162,7 +1163,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, if( DrawPinNum ) { - DrawGraphicText( panel, DC, + DrawGraphicText( clipbox, DC, wxPoint( (x1 + pin_pos.x) / 2, y1 - TXTMARGE ), NumColor, StringPinNum, @@ -1180,7 +1181,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, y = y1 + TextInside; if( DrawPinName ) - DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor, + DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor, m_name, TEXT_ORIENT_VERT, PinNameSize, GR_TEXT_HJUSTIFY_RIGHT, @@ -1188,7 +1189,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, false, false ); if( DrawPinNum ) - DrawGraphicText( panel, DC, + DrawGraphicText( clipbox, DC, wxPoint( x1 - TXTMARGE, (y1 + pin_pos.y) / 2 ), NumColor, StringPinNum, @@ -1202,7 +1203,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, y = y1 - TextInside; if( DrawPinName ) - DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor, + DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor, m_name, TEXT_ORIENT_VERT, PinNameSize, GR_TEXT_HJUSTIFY_LEFT, @@ -1210,7 +1211,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, false, false ); if( DrawPinNum ) - DrawGraphicText( panel, DC, + DrawGraphicText( clipbox, DC, wxPoint( x1 - TXTMARGE, (y1 + pin_pos.y) / 2 ), NumColor, StringPinNum, @@ -1229,7 +1230,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, if( DrawPinName ) { x = (x1 + pin_pos.x) / 2; - DrawGraphicText( panel, DC, wxPoint( x, y1 - TXTMARGE ), + DrawGraphicText( clipbox, DC, wxPoint( x, y1 - TXTMARGE ), NameColor, m_name, TEXT_ORIENT_HORIZ, PinNameSize, GR_TEXT_HJUSTIFY_CENTER, @@ -1239,7 +1240,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, if( DrawPinNum ) { x = (x1 + pin_pos.x) / 2; - DrawGraphicText( panel, DC, wxPoint( x, y1 + TXTMARGE ), + DrawGraphicText( clipbox, DC, wxPoint( x, y1 + TXTMARGE ), NumColor, StringPinNum, TEXT_ORIENT_HORIZ, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, @@ -1252,7 +1253,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, if( DrawPinName ) { y = (y1 + pin_pos.y) / 2; - DrawGraphicText( panel, DC, wxPoint( x1 - TXTMARGE, y ), + DrawGraphicText( clipbox, DC, wxPoint( x1 - TXTMARGE, y ), NameColor, m_name, TEXT_ORIENT_VERT, PinNameSize, GR_TEXT_HJUSTIFY_CENTER, @@ -1262,7 +1263,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, if( DrawPinNum ) { - DrawGraphicText( panel, DC, + DrawGraphicText( clipbox, DC, wxPoint( x1 + TXTMARGE, (y1 + pin_pos.y) / 2 ), NumColor, StringPinNum, TEXT_ORIENT_VERT, PinNumSize, diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index 7964844b47..cdfd1eb644 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -399,7 +399,8 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO // Calculate pos accordint to mirror/rotation. txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset; - DrawGraphicText( aPanel, aDC, txtpos, (EDA_COLOR_T) color, m_Text, orient, m_Size, + EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL; + DrawGraphicText( clipbox, aDC, txtpos, (EDA_COLOR_T) color, m_Text, orient, m_Size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GetPenSize(), m_Italic, m_Bold ); @@ -412,7 +413,7 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO grBox.SetOrigin( aTransform.TransformCoordinate( bBox.GetOrigin() ) ); grBox.SetEnd( aTransform.TransformCoordinate( bBox.GetEnd() ) ); grBox.Move( aOffset ); - GRRect( aPanel->GetClipBox(), aDC, grBox, 0, LIGHTMAGENTA ); + GRRect( clipbox, aDC, grBox, 0, LIGHTMAGENTA ); #endif } diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index c2691c0780..e09712994e 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -194,7 +194,8 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, color = GetLayerColor( LAYER_FIELDS ); } - DrawGraphicText( panel, DC, textpos, color, GetFullyQualifiedText(), orient, m_Size, + EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL; + DrawGraphicText( clipbox, DC, textpos, color, GetFullyQualifiedText(), orient, m_Size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, LineWidth, m_Italic, m_Bold ); @@ -214,9 +215,9 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, textpos = parentComponent->GetScreenCoord( textpos ); textpos += parentComponent->GetPosition(); const int len = 10; - GRLine( panel->GetClipBox(), DC, + GRLine( clipbox, DC, textpos.x - len, textpos.y, textpos.x + len, textpos.y, 0, BLUE ); - GRLine( panel->GetClipBox(), DC, + GRLine( clipbox, DC, textpos.x, textpos.y - len, textpos.x, textpos.y + len, 0, BLUE ); #endif } diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index a94e7150b2..d655bf9fb7 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -573,6 +573,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint pos_sheetname,pos_filename; wxPoint pos = m_pos + aOffset; int lineWidth = GetPenSize(); + EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL; if( aColor >= 0 ) color = aColor; @@ -581,7 +582,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GRSetDrawMode( aDC, aDrawMode ); - GRRect( aPanel->GetClipBox(), aDC, pos.x, pos.y, + GRRect( clipbox, aDC, pos.x, pos.y, pos.x + m_size.x, pos.y + m_size.y, lineWidth, color ); pos_sheetname = GetSheetNamePosition() + aOffset; @@ -599,7 +600,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, txtcolor = GetLayerColor( LAYER_SHEETNAME ); Text = wxT( "Sheet: " ) + m_name; - DrawGraphicText( aPanel, aDC, pos_sheetname, + DrawGraphicText( clipbox, aDC, pos_sheetname, (EDA_COLOR_T) txtcolor, Text, name_orientation, wxSize( m_sheetNameSize, m_sheetNameSize ), GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, lineWidth, @@ -612,7 +613,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, txtcolor = GetLayerColor( LAYER_SHEETFILENAME ); Text = wxT( "File: " ) + m_fileName; - DrawGraphicText( aPanel, aDC, pos_filename, + DrawGraphicText( clipbox, aDC, pos_filename, (EDA_COLOR_T) txtcolor, Text, name_orientation, wxSize( m_fileNameSize, m_fileNameSize ), GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, lineWidth, diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 3e0f1baa7e..77acb3d096 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -343,6 +343,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset, { EDA_COLOR_T color; int linewidth = ( m_Thickness == 0 ) ? GetDefaultLineThickness() : m_Thickness; + EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL; linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold ); @@ -355,7 +356,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset, wxPoint text_offset = aOffset + GetSchematicTextOffset(); EXCHG( linewidth, m_Thickness ); // Set the minimum width - EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR ); + EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR ); EXCHG( linewidth, m_Thickness ); // set initial value if( m_isDangling ) @@ -365,7 +366,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset, #if 0 { EDA_RECT BoundaryBox = GetBoundingBox(); - GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN ); + GRRect( clipbox, DC, BoundaryBox, 0, BROWN ); } #endif } @@ -1285,11 +1286,12 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel, int linewidth = (m_Thickness == 0) ? GetDefaultLineThickness() : m_Thickness; linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold ); EXCHG( linewidth, m_Thickness ); // Set the minimum width - EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR ); + EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL; + EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR ); EXCHG( linewidth, m_Thickness ); // set initial value CreateGraphicShape( Poly, m_Pos + aOffset ); - GRPoly( panel->GetClipBox(), DC, Poly.size(), &Poly[0], 0, linewidth, color, color ); + GRPoly( clipbox, DC, Poly.size(), &Poly[0], 0, linewidth, color, color ); if( m_isDangling ) DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color ); @@ -1298,7 +1300,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel, #if 0 { EDA_RECT BoundaryBox = GetBoundingBox(); - GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN ); + GRRect( clipbox, DC, BoundaryBox, 0, BROWN ); } #endif } @@ -1604,7 +1606,9 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel, { static std::vector Poly; EDA_COLOR_T color; - int linewidth = ( m_Thickness == 0 ) ? GetDefaultLineThickness() : m_Thickness; + int linewidth = m_Thickness == 0 ? + GetDefaultLineThickness() : m_Thickness; + EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL; linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold ); @@ -1617,11 +1621,11 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel, EXCHG( linewidth, m_Thickness ); // Set the minimum width wxPoint text_offset = offset + GetSchematicTextOffset(); - EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR ); + EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR ); EXCHG( linewidth, m_Thickness ); // set initial value CreateGraphicShape( Poly, m_Pos + offset ); - GRPoly( panel->GetClipBox(), DC, Poly.size(), &Poly[0], 0, linewidth, color, color ); + GRPoly( clipbox, DC, Poly.size(), &Poly[0], 0, linewidth, color, color ); if( m_isDangling ) DrawDanglingSymbol( panel, DC, m_Pos + offset, color ); @@ -1630,7 +1634,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel, #if 0 { EDA_RECT BoundaryBox = GetBoundingBox(); - GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN ); + GRRect( clipbox, DC, BoundaryBox, 0, BROWN ); } #endif } diff --git a/gerbview/draw_gerber_screen.cpp b/gerbview/draw_gerber_screen.cpp index 24b03fbd83..b680f86902 100644 --- a/gerbview/draw_gerber_screen.cpp +++ b/gerbview/draw_gerber_screen.cpp @@ -407,7 +407,7 @@ void GERBVIEW_FRAME::DrawItemsDCodeID( wxDC* aDC, GR_DRAWMODE aDrawMode ) int color = GetVisibleElementColor( DCODES_VISIBLE ); - DrawGraphicText( m_canvas, aDC, pos, (EDA_COLOR_T) color, Line, + DrawGraphicText( m_canvas->GetClipBox(), aDC, pos, (EDA_COLOR_T) color, Line, orient, wxSize( width, width ), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, 0, false, false ); diff --git a/include/drawtxt.h b/include/drawtxt.h index 7df51db52b..b2d898e99a 100644 --- a/include/drawtxt.h +++ b/include/drawtxt.h @@ -70,7 +70,7 @@ int OverbarPositionY( int size_v ); /** * Function DrawGraphicText * Draw a graphic text (like module texts) - * @param aPanel = the current DrawPanel. 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 aPos = text position (according to h_justify, v_justify) * @param aColor (enum EDA_COLOR_T) = text color @@ -89,7 +89,7 @@ int OverbarPositionY( int size_v ); * @param aPlotter = a pointer to a PLOTTER instance, when this function is used to plot * the text. NULL to draw this text. */ -void DrawGraphicText( EDA_DRAW_PANEL * aPanel, +void DrawGraphicText( EDA_RECT* aClipBox, wxDC * aDC, const wxPoint &aPos, enum EDA_COLOR_T aColor, @@ -111,7 +111,7 @@ void DrawGraphicText( EDA_DRAW_PANEL * aPanel, * If aBgColor is a dark color text is drawn in aColor2 with aColor1 * border; otherwise colors are swapped. */ -void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel, +void DrawGraphicHaloText( EDA_RECT* aClipBox, wxDC * aDC, const wxPoint &aPos, enum EDA_COLOR_T aBgColor, diff --git a/include/eda_text.h b/include/eda_text.h index 6558db3a6c..301dda0637 100644 --- a/include/eda_text.h +++ b/include/eda_text.h @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2013 Jean-Pierre Charras, jpe.charras at wanadoo.fr + * Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -183,7 +183,7 @@ public: /** * Function Draw - * @param aPanel = the current DrawPanel + * @param aClipBox = the clipping rect, or NULL if no clipping * @param aDC = the current Device Context * @param aOffset = draw offset (usually (0,0)) * @param aColor = text color @@ -191,7 +191,7 @@ public: * @param aDisplay_mode = LINE, FILLED or SKETCH * @param aAnchor_color = anchor color ( UNSPECIFIED = do not draw anchor ). */ - void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, + void Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aDisplay_mode = LINE, EDA_COLOR_T aAnchor_color = UNSPECIFIED_COLOR ); @@ -277,10 +277,10 @@ public: private: /** - * Function DrawOneLineOfText + * Function drawOneLineOfText * Draw a single text line. * Used to draw each line of this EDA_TEXT, that can be multiline - * @param aPanel = the current DrawPanel + * @param aClipBox = the clipping rect, or NULL if no clipping * @param aDC = the current Device Context * @param aOffset = draw offset (usually (0,0)) * @param aColor = text color @@ -290,7 +290,7 @@ private: * @param aText = the single line of text to draw. * @param aPos = the position of this line ). */ - void DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, + void drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode, EDA_COLOR_T aAnchor_color, wxString& aText, diff --git a/include/worksheet.h b/include/worksheet.h index 7757d9282d..4b16095c77 100644 --- a/include/worksheet.h +++ b/include/worksheet.h @@ -11,17 +11,15 @@ // Forward declarations: class EDA_DRAW_PANEL; +class EDA_RECT; class TITLE_BLOCK; class PAGE_INFO; -#define PAS_REF 2000 // Pitch (in mils) of reference locations in worksheet - /** * Function DrawPageLayout is a core function to draw the page layout with * the frame and the basic inscriptions. * @param aDC The device context. - * @param aCanvas The EDA_DRAW_PANEL to draw into, or NULL if the page - * layout is not drawn into the main panel. + * @param aClipBox = the clipping rect, or NULL if no clipping. * @param aPageInfo for margins and page size (in mils). * @param aFullSheetName The sheetpath (full sheet name), for basic inscriptions. * @param aFileName The file name, for basic inscriptions. @@ -30,22 +28,22 @@ class PAGE_INFO; * @param aSheetNumber The sheet number (for basic inscriptions). * @param aPenWidth the pen size The line width for drawing. * @param aScalar the scale factor to convert from mils to internal units. - * @param aLineColor The color for drawing. - * @param aTextColor The color for inscriptions. + * @param aColor The color for drawing. + * @param aAltColor The color for items which need to be "hightlighted". * * Parameters used in aPageInfo * - the size of the page layout. * - the LTmargin The left top margin of the page layout. * - the RBmargin The right bottom margin of the page layout. */ -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 aLineColor, EDA_COLOR_T aTextColor ); + EDA_COLOR_T aColor, EDA_COLOR_T aAltColor ); #endif // WORKSHEET_H_ diff --git a/include/worksheet_shape_builder.h b/include/worksheet_shape_builder.h index 09219c1b2a..8b9c8ea3f0 100644 --- a/include/worksheet_shape_builder.h +++ b/include/worksheet_shape_builder.h @@ -504,6 +504,13 @@ public: return NULL; } + /** + * Draws the item list crated by BuildWorkSheetGraphicList + * @param aClipBox = the clipping rect, or NULL if no clipping + * @param aDC = the current Device Context + */ + void Draw( EDA_RECT* aClipBox, wxDC* aDC ); + /** * Function BuildWorkSheetGraphicList is a core function for * drawing or plotting the page layout with @@ -515,14 +522,14 @@ public: * @param aFileName The file name, for basic inscriptions. * @param aSheetPathHumanReadable The human readable sheet path. * @param aTitleBlock The sheet title block, for basic inscriptions. - * @param aLineColor The color for drawing and fixed text. - * @param aTextColor The color for user inscriptions. + * @param aColor The color for drawing. + * @param aAltColor The color for items which need to be "hightlighted". */ void BuildWorkSheetGraphicList( const wxString& aPaperFormat, const wxString& aFileName, const wxString& aSheetPathHumanReadable, const TITLE_BLOCK& aTitleBlock, - EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor ); + EDA_COLOR_T aColor, EDA_COLOR_T aAltColor ); /** * Function BuildFullText * returns the full text corresponding to the aTextbase, diff --git a/include/wxstruct.h b/include/wxstruct.h index 5d4c3a82d7..83c0e9c492 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -708,15 +708,6 @@ public: void DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth, double aScale, const wxString &aFilename ); - /** - * Function GetXYSheetReferences - * returns the X,Y sheet references where the point position is located - * @param aPosition = position to identify by YX ref - * @return a wxString containing the message locator like A3 or B6 - * (or ?? if out of page limits) - */ - const wxString GetXYSheetReferences( const wxPoint& aPosition ) const; - void DisplayToolMsg( const wxString& msg ); virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0; virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0; diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index 7d95403c03..fca76caa09 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -539,6 +539,8 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) wxString buffer; int tsize; + EDA_RECT* clipBox = aDrawInfo.m_DrawPanel? + aDrawInfo.m_DrawPanel->GetClipBox() : NULL; if( aDrawInfo.m_Display_padnum ) { @@ -552,7 +554,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) { // tsize reserve room for marges and segments thickness tsize = ( tsize * 7 ) / 10; - DrawGraphicHaloText( aDrawInfo.m_DrawPanel, aDC, tpos, + DrawGraphicHaloText( clipBox, aDC, tpos, aDrawInfo.m_Color, BLACK, WHITE, buffer, t_angle, wxSize( tsize , tsize ), GR_TEXT_HJUSTIFY_CENTER, @@ -579,7 +581,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) // tsize reserve room for marges and segments thickness tsize = ( tsize * 7 ) / 10; - DrawGraphicHaloText( aDrawInfo.m_DrawPanel, aDC, tpos, + DrawGraphicHaloText( clipBox, aDC, tpos, aDrawInfo.m_Color, BLACK, WHITE, m_ShortNetname, t_angle, wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER, diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index fd20cf981e..344f776537 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -103,7 +103,8 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, if( brd->IsElementVisible( ANCHOR_VISIBLE ) ) anchor_color = brd->GetVisibleElementColor( ANCHOR_VISIBLE ); - EDA_TEXT::Draw( panel, DC, offset, color, + EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL; + EDA_TEXT::Draw( clipbox, DC, offset, color, DrawMode, fillmode, anchor_color ); } diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index f75bb735ea..9e1d7050cf 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -233,7 +233,7 @@ EDA_RECT TEXTE_MODULE::GetBoundingBox() const void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, const wxPoint& offset ) { - MODULE* module = (MODULE*) m_Parent; + MODULE* module = (MODULE*) m_Parent; /* parent must *not* be NULL (a module text without a footprint parent has no sense) */ @@ -281,14 +281,14 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, width = -width; GRSetDrawMode( DC, draw_mode ); - wxPoint pos( m_Pos.x - offset.x, + wxPoint pos( m_Pos.x - offset.x, m_Pos.y - offset.y); // Draw the text anchor point if( brd->IsElementVisible( ANCHOR_VISIBLE ) ) { EDA_COLOR_T anchor_color = brd->GetVisibleElementColor(ANCHOR_VISIBLE); - GRDrawAnchor( panel->GetClipBox(), DC, pos.x, pos.y, + GRDrawAnchor( panel->GetClipBox(), DC, pos.x, pos.y, DIM_ANCRE_TEXTE, anchor_color ); } @@ -300,7 +300,8 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, if( m_Mirror ) size.x = -size.x; - DrawGraphicText( panel, DC, pos, color, m_Text, orient, + EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL; + DrawGraphicText( clipbox, DC, pos, color, m_Text, orient, size, m_HJustify, m_VJustify, width, m_Italic, m_Bold ); } diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index ee37bb6d73..da404bda20 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -176,7 +176,7 @@ wxString SEGZONE::GetSelectMenuText() const nettxt = wxT( "???" ); } - text.Printf( _( "Zone (%08lX) [%s] on %s" ), + text.Printf( _( "Zone (%08lX) [%s] on %s" ), m_TimeStamp, GetChars( nettxt ), GetChars( GetLayerName() ) ); return text; @@ -738,10 +738,11 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, GRSetDrawMode( aDC, GR_COPY ); tsize = (tsize * 7) / 10; // small reduction to give a better look - DrawGraphicHaloText( panel, aDC, tpos, - color, BLACK, WHITE, net->GetShortNetname(), angle, + EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL; + DrawGraphicHaloText( clipbox, aDC, tpos, + color, BLACK, WHITE, net->GetShortNetname(), angle, wxSize( tsize, tsize ), - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 7, false, false ); } @@ -917,7 +918,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, m_Start.x + aOffset.x - bx, m_Start.y + aOffset.y - by, 0, color ); - // lines for the bottom layer + // lines for the bottom layer ax = 0; ay = radius; bx = 0; by = drill_radius; RotatePoint( &ax, &ay, layer_bottom * 3600.0 / brd->GetCopperLayerCount( ) ); RotatePoint( &bx, &by, layer_bottom * 3600.0 / brd->GetCopperLayerCount( ) ); @@ -952,10 +953,11 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, if( (aDrawMode & GR_XOR) == 0 ) GRSetDrawMode( aDC, GR_COPY ); - DrawGraphicHaloText( panel, aDC, m_Start, - color, WHITE, BLACK, net->GetShortNetname(), 0, + EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL; + DrawGraphicHaloText( clipbox, aDC, m_Start, + color, WHITE, BLACK, net->GetShortNetname(), 0, wxSize( tsize, tsize ), - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 7, false, false ); } }