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

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
...@@ -242,7 +242,7 @@ static void DrawGraphicTextPline( EDA_RECT* aClipBox, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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 );
} }
......
...@@ -35,10 +35,13 @@ ...@@ -35,10 +35,13 @@
// Conversion to application internal units defined at build time. // Conversion to application internal units defined at build time.
#if defined( PCBNEW ) #if defined( PCBNEW )
#include <class_board_item.h> #include <class_board_item.h>
#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 ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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 );
} }
......
...@@ -46,44 +46,20 @@ ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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 ...@@ -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
......
...@@ -304,7 +304,8 @@ void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a ...@@ -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 ...@@ -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
} }
......
...@@ -1091,6 +1091,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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,
......
...@@ -399,7 +399,8 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO ...@@ -399,7 +399,8 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO
// Calculate pos accordint to mirror/rotation. // Calculate pos accordint to mirror/rotation.
txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset; 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(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GetPenSize(),
m_Italic, m_Bold ); m_Italic, m_Bold );
...@@ -412,7 +413,7 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO ...@@ -412,7 +413,7 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO
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
} }
......
...@@ -194,7 +194,8 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, ...@@ -194,7 +194,8 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
color = GetLayerColor( LAYER_FIELDS ); 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, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
LineWidth, m_Italic, m_Bold ); LineWidth, m_Italic, m_Bold );
...@@ -214,9 +215,9 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, ...@@ -214,9 +215,9 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
textpos = parentComponent->GetScreenCoord( textpos ); textpos = parentComponent->GetScreenCoord( textpos );
textpos += parentComponent->GetPosition(); textpos += parentComponent->GetPosition();
const int len = 10; const int len = 10;
GRLine( panel->GetClipBox(), DC, GRLine( clipbox, DC,
textpos.x - len, textpos.y, textpos.x + len, textpos.y, 0, BLUE ); 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 ); textpos.x, textpos.y - len, textpos.x, textpos.y + len, 0, BLUE );
#endif #endif
} }
......
...@@ -573,6 +573,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -573,6 +573,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
wxPoint pos_sheetname,pos_filename; wxPoint pos_sheetname,pos_filename;
wxPoint pos = m_pos + aOffset; wxPoint pos = m_pos + aOffset;
int lineWidth = GetPenSize(); int lineWidth = GetPenSize();
EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
if( aColor >= 0 ) if( aColor >= 0 )
color = aColor; color = aColor;
...@@ -581,7 +582,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -581,7 +582,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GRSetDrawMode( aDC, aDrawMode ); 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.x + m_size.x, pos.y + m_size.y, lineWidth, color );
pos_sheetname = GetSheetNamePosition() + aOffset; pos_sheetname = GetSheetNamePosition() + aOffset;
...@@ -599,7 +600,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -599,7 +600,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
txtcolor = GetLayerColor( LAYER_SHEETNAME ); txtcolor = GetLayerColor( LAYER_SHEETNAME );
Text = wxT( "Sheet: " ) + m_name; Text = wxT( "Sheet: " ) + m_name;
DrawGraphicText( aPanel, aDC, pos_sheetname, DrawGraphicText( clipbox, aDC, pos_sheetname,
(EDA_COLOR_T) txtcolor, Text, name_orientation, (EDA_COLOR_T) txtcolor, Text, name_orientation,
wxSize( m_sheetNameSize, m_sheetNameSize ), wxSize( m_sheetNameSize, m_sheetNameSize ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, lineWidth, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, lineWidth,
...@@ -612,7 +613,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -612,7 +613,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
txtcolor = GetLayerColor( LAYER_SHEETFILENAME ); txtcolor = GetLayerColor( LAYER_SHEETFILENAME );
Text = wxT( "File: " ) + m_fileName; Text = wxT( "File: " ) + m_fileName;
DrawGraphicText( aPanel, aDC, pos_filename, DrawGraphicText( clipbox, aDC, pos_filename,
(EDA_COLOR_T) txtcolor, Text, name_orientation, (EDA_COLOR_T) txtcolor, Text, name_orientation,
wxSize( m_fileNameSize, m_fileNameSize ), wxSize( m_fileNameSize, m_fileNameSize ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, lineWidth, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, lineWidth,
......
...@@ -343,6 +343,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset, ...@@ -343,6 +343,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
{ {
EDA_COLOR_T color; 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 ); 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, ...@@ -355,7 +356,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
wxPoint text_offset = aOffset + GetSchematicTextOffset(); wxPoint text_offset = aOffset + GetSchematicTextOffset();
EXCHG( linewidth, m_Thickness ); // Set the minimum width 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 EXCHG( linewidth, m_Thickness ); // set initial value
if( m_isDangling ) if( m_isDangling )
...@@ -365,7 +366,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset, ...@@ -365,7 +366,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
#if 0 #if 0
{ {
EDA_RECT BoundaryBox = GetBoundingBox(); EDA_RECT BoundaryBox = GetBoundingBox();
GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN ); GRRect( clipbox, DC, BoundaryBox, 0, BROWN );
} }
#endif #endif
} }
...@@ -1285,11 +1286,12 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel, ...@@ -1285,11 +1286,12 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
int linewidth = (m_Thickness == 0) ? GetDefaultLineThickness() : m_Thickness; int linewidth = (m_Thickness == 0) ? GetDefaultLineThickness() : m_Thickness;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold ); linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
EXCHG( linewidth, m_Thickness ); // Set the minimum width 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 EXCHG( linewidth, m_Thickness ); // set initial value
CreateGraphicShape( Poly, m_Pos + aOffset ); 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 ) if( m_isDangling )
DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color ); DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color );
...@@ -1298,7 +1300,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel, ...@@ -1298,7 +1300,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
#if 0 #if 0
{ {
EDA_RECT BoundaryBox = GetBoundingBox(); EDA_RECT BoundaryBox = GetBoundingBox();
GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN ); GRRect( clipbox, DC, BoundaryBox, 0, BROWN );
} }
#endif #endif
} }
...@@ -1604,7 +1606,9 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel, ...@@ -1604,7 +1606,9 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
{ {
static std::vector <wxPoint> Poly; static std::vector <wxPoint> Poly;
EDA_COLOR_T color; 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 ); linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
...@@ -1617,11 +1621,11 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel, ...@@ -1617,11 +1621,11 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
EXCHG( linewidth, m_Thickness ); // Set the minimum width EXCHG( linewidth, m_Thickness ); // Set the minimum width
wxPoint text_offset = offset + GetSchematicTextOffset(); 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 EXCHG( linewidth, m_Thickness ); // set initial value
CreateGraphicShape( Poly, m_Pos + offset ); 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 ) if( m_isDangling )
DrawDanglingSymbol( panel, DC, m_Pos + offset, color ); DrawDanglingSymbol( panel, DC, m_Pos + offset, color );
...@@ -1630,7 +1634,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel, ...@@ -1630,7 +1634,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
#if 0 #if 0
{ {
EDA_RECT BoundaryBox = GetBoundingBox(); EDA_RECT BoundaryBox = GetBoundingBox();
GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN ); GRRect( clipbox, DC, BoundaryBox, 0, BROWN );
} }
#endif #endif
} }
......
...@@ -407,7 +407,7 @@ void GERBVIEW_FRAME::DrawItemsDCodeID( wxDC* aDC, GR_DRAWMODE aDrawMode ) ...@@ -407,7 +407,7 @@ void GERBVIEW_FRAME::DrawItemsDCodeID( wxDC* aDC, GR_DRAWMODE aDrawMode )
int color = GetVisibleElementColor( DCODES_VISIBLE ); 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 ), orient, wxSize( width, width ),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
0, false, false ); 0, false, false );
......
...@@ -70,7 +70,7 @@ int OverbarPositionY( int size_v ); ...@@ -70,7 +70,7 @@ int OverbarPositionY( int size_v );
/** /**
* Function DrawGraphicText * Function DrawGraphicText
* Draw a graphic text (like module texts) * 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 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
...@@ -89,7 +89,7 @@ int OverbarPositionY( int size_v ); ...@@ -89,7 +89,7 @@ int OverbarPositionY( int size_v );
* @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,
enum EDA_COLOR_T aColor, enum EDA_COLOR_T aColor,
...@@ -111,7 +111,7 @@ void DrawGraphicText( EDA_DRAW_PANEL * aPanel, ...@@ -111,7 +111,7 @@ void DrawGraphicText( EDA_DRAW_PANEL * aPanel,
* If aBgColor is a dark color text is drawn in aColor2 with aColor1 * If aBgColor is a dark color text is drawn in aColor2 with aColor1
* border; otherwise colors are swapped. * border; otherwise colors are swapped.
*/ */
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,
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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) 2013 Jean-Pierre Charras, jpe.charras at wanadoo.fr
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -183,7 +183,7 @@ public: ...@@ -183,7 +183,7 @@ public:
/** /**
* Function Draw * Function Draw
* @param aPanel = the current DrawPanel * @param aClipBox = the clipping rect, or NULL if no clipping
* @param aDC = the current Device Context * @param aDC = the current Device Context
* @param aOffset = draw offset (usually (0,0)) * @param aOffset = draw offset (usually (0,0))
* @param aColor = text color * @param aColor = text color
...@@ -191,7 +191,7 @@ public: ...@@ -191,7 +191,7 @@ public:
* @param aDisplay_mode = LINE, FILLED or SKETCH * @param aDisplay_mode = LINE, FILLED or SKETCH
* @param aAnchor_color = anchor color ( UNSPECIFIED = do not draw anchor ). * @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, const wxPoint& aOffset, EDA_COLOR_T aColor,
GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aDisplay_mode = LINE, GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aDisplay_mode = LINE,
EDA_COLOR_T aAnchor_color = UNSPECIFIED_COLOR ); EDA_COLOR_T aAnchor_color = UNSPECIFIED_COLOR );
...@@ -277,10 +277,10 @@ public: ...@@ -277,10 +277,10 @@ public:
private: private:
/** /**
* Function DrawOneLineOfText * Function drawOneLineOfText
* Draw a single text line. * Draw a single text line.
* Used to draw each line of this EDA_TEXT, that can be multiline * 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 aDC = the current Device Context
* @param aOffset = draw offset (usually (0,0)) * @param aOffset = draw offset (usually (0,0))
* @param aColor = text color * @param aColor = text color
...@@ -290,7 +290,7 @@ private: ...@@ -290,7 +290,7 @@ private:
* @param aText = the single line of text to draw. * @param aText = the single line of text to draw.
* @param aPos = the position of this line ). * @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, 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, wxString& aText, EDA_COLOR_T aAnchor_color, wxString& aText,
......
...@@ -11,17 +11,15 @@ ...@@ -11,17 +11,15 @@
// Forward declarations: // Forward declarations:
class EDA_DRAW_PANEL; class EDA_DRAW_PANEL;
class EDA_RECT;
class TITLE_BLOCK; class TITLE_BLOCK;
class PAGE_INFO; 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 * Function DrawPageLayout is a core function to draw the page layout with
* the frame and the basic inscriptions. * the frame and the basic inscriptions.
* @param aDC The device context. * @param aDC The device context.
* @param aCanvas The EDA_DRAW_PANEL to draw into, or NULL if the page * @param aClipBox = the clipping rect, or NULL if no clipping.
* layout is not drawn into the main panel.
* @param aPageInfo for margins and page size (in mils). * @param aPageInfo for margins and page size (in mils).
* @param aFullSheetName The sheetpath (full sheet name), for basic inscriptions. * @param aFullSheetName The sheetpath (full sheet name), for basic inscriptions.
* @param aFileName The file name, for basic inscriptions. * @param aFileName The file name, for basic inscriptions.
...@@ -30,22 +28,22 @@ class PAGE_INFO; ...@@ -30,22 +28,22 @@ class PAGE_INFO;
* @param aSheetNumber The sheet number (for basic inscriptions). * @param aSheetNumber The sheet number (for basic inscriptions).
* @param aPenWidth the pen size The line width for drawing. * @param aPenWidth the pen size The line width for drawing.
* @param aScalar the scale factor to convert from mils to internal units. * @param aScalar the scale factor to convert from mils to internal units.
* @param aLineColor The color for drawing. * @param aColor The color for drawing.
* @param aTextColor The color for inscriptions. * @param aAltColor The color for items which need to be "hightlighted".
* *
* Parameters used in aPageInfo * Parameters used in aPageInfo
* - the size of the page layout. * - the size of the page layout.
* - the LTmargin The left top margin of the page layout. * - the LTmargin The left top margin of the page layout.
* - the RBmargin The right bottom 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 PAGE_INFO& aPageInfo,
const wxString &aFullSheetName, const wxString &aFullSheetName,
const wxString& aFileName, const wxString& aFileName,
TITLE_BLOCK& aTitleBlock, TITLE_BLOCK& aTitleBlock,
int aSheetCount, int aSheetNumber, int aSheetCount, int aSheetNumber,
int aPenWidth, double aScalar, int aPenWidth, double aScalar,
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor ); EDA_COLOR_T aColor, EDA_COLOR_T aAltColor );
#endif // WORKSHEET_H_ #endif // WORKSHEET_H_
...@@ -504,6 +504,13 @@ public: ...@@ -504,6 +504,13 @@ public:
return NULL; 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 * Function BuildWorkSheetGraphicList is a core function for
* drawing or plotting the page layout with * drawing or plotting the page layout with
...@@ -515,14 +522,14 @@ public: ...@@ -515,14 +522,14 @@ public:
* @param aFileName The file name, for basic inscriptions. * @param aFileName The file name, for basic inscriptions.
* @param aSheetPathHumanReadable The human readable sheet path. * @param aSheetPathHumanReadable The human readable sheet path.
* @param aTitleBlock The sheet title block, for basic inscriptions. * @param aTitleBlock The sheet title block, for basic inscriptions.
* @param aLineColor The color for drawing and fixed text. * @param aColor The color for drawing.
* @param aTextColor The color for user inscriptions. * @param aAltColor The color for items which need to be "hightlighted".
*/ */
void BuildWorkSheetGraphicList( const wxString& aPaperFormat, void BuildWorkSheetGraphicList( const wxString& aPaperFormat,
const wxString& aFileName, const wxString& aFileName,
const wxString& aSheetPathHumanReadable, const wxString& aSheetPathHumanReadable,
const TITLE_BLOCK& aTitleBlock, const TITLE_BLOCK& aTitleBlock,
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor ); EDA_COLOR_T aColor, EDA_COLOR_T aAltColor );
/** /**
* Function BuildFullText * Function BuildFullText
* returns the full text corresponding to the aTextbase, * returns the full text corresponding to the aTextbase,
......
...@@ -708,15 +708,6 @@ public: ...@@ -708,15 +708,6 @@ public:
void DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth, void DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
double aScale, const wxString &aFilename ); 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 ); void DisplayToolMsg( const wxString& msg );
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0; virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0; virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
......
...@@ -539,6 +539,8 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) ...@@ -539,6 +539,8 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
wxString buffer; wxString buffer;
int tsize; int tsize;
EDA_RECT* clipBox = aDrawInfo.m_DrawPanel?
aDrawInfo.m_DrawPanel->GetClipBox() : NULL;
if( aDrawInfo.m_Display_padnum ) if( aDrawInfo.m_Display_padnum )
{ {
...@@ -552,7 +554,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) ...@@ -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 reserve room for marges and segments thickness
tsize = ( tsize * 7 ) / 10; tsize = ( tsize * 7 ) / 10;
DrawGraphicHaloText( aDrawInfo.m_DrawPanel, aDC, tpos, DrawGraphicHaloText( clipBox, aDC, tpos,
aDrawInfo.m_Color, BLACK, WHITE, aDrawInfo.m_Color, BLACK, WHITE,
buffer, t_angle, buffer, t_angle,
wxSize( tsize , tsize ), GR_TEXT_HJUSTIFY_CENTER, wxSize( tsize , tsize ), GR_TEXT_HJUSTIFY_CENTER,
...@@ -579,7 +581,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) ...@@ -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 reserve room for marges and segments thickness
tsize = ( tsize * 7 ) / 10; tsize = ( tsize * 7 ) / 10;
DrawGraphicHaloText( aDrawInfo.m_DrawPanel, aDC, tpos, DrawGraphicHaloText( clipBox, aDC, tpos,
aDrawInfo.m_Color, BLACK, WHITE, aDrawInfo.m_Color, BLACK, WHITE,
m_ShortNetname, t_angle, m_ShortNetname, t_angle,
wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER, wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER,
......
...@@ -103,7 +103,8 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, ...@@ -103,7 +103,8 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
if( brd->IsElementVisible( ANCHOR_VISIBLE ) ) if( brd->IsElementVisible( ANCHOR_VISIBLE ) )
anchor_color = brd->GetVisibleElementColor( 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 ); DrawMode, fillmode, anchor_color );
} }
......
...@@ -300,7 +300,8 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ...@@ -300,7 +300,8 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
if( m_Mirror ) if( m_Mirror )
size.x = -size.x; 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 ); size, m_HJustify, m_VJustify, width, m_Italic, m_Bold );
} }
......
...@@ -738,7 +738,8 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, ...@@ -738,7 +738,8 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
GRSetDrawMode( aDC, GR_COPY ); GRSetDrawMode( aDC, GR_COPY );
tsize = (tsize * 7) / 10; // small reduction to give a better look tsize = (tsize * 7) / 10; // small reduction to give a better look
DrawGraphicHaloText( panel, aDC, tpos, EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
DrawGraphicHaloText( clipbox, aDC, tpos,
color, BLACK, WHITE, net->GetShortNetname(), angle, color, BLACK, WHITE, net->GetShortNetname(), angle,
wxSize( tsize, tsize ), wxSize( tsize, tsize ),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
...@@ -952,7 +953,8 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, ...@@ -952,7 +953,8 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
if( (aDrawMode & GR_XOR) == 0 ) if( (aDrawMode & GR_XOR) == 0 )
GRSetDrawMode( aDC, GR_COPY ); GRSetDrawMode( aDC, GR_COPY );
DrawGraphicHaloText( panel, aDC, m_Start, EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
DrawGraphicHaloText( clipbox, aDC, m_Start,
color, WHITE, BLACK, net->GetShortNetname(), 0, color, WHITE, BLACK, net->GetShortNetname(), 0,
wxSize( tsize, tsize ), wxSize( tsize, tsize ),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
......
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