More encapsulation improvements.

* EDA_DRAW_FRAME completely encapsulated.
* Encapsulate the the low hanging fruit in EDA_DRAW_PANEL.
This commit is contained in:
Wayne Stambaugh
2011-12-22 08:28:11 -05:00
parent 2df818b844
commit c2e5fcaec8
148 changed files with 1528 additions and 1438 deletions
+44 -44
View File
@@ -1028,7 +1028,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
if( !screen->m_IsPrinting & g_ShowPageLimits )
{
GRSetDrawMode( DC, GR_COPY );
GRRect( &DrawPanel->m_ClipBox, DC, 0, 0,
GRRect( &m_canvas->m_ClipBox, DC, 0, 0,
Sheet->m_Size.x * scale, Sheet->m_Size.y * scale, width,
g_DrawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY );
}
@@ -1041,13 +1041,13 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
yg = Sheet->m_Size.y - Sheet->m_BottomMargin; /* lower right corner */
#if defined(KICAD_GOST)
GRRect( &DrawPanel->m_ClipBox, DC, refx * scale, refy * scale,
GRRect( &m_canvas->m_ClipBox, DC, refx * scale, refy * scale,
xg * scale, yg * scale, width, Color );
#else
for( ii = 0; ii < 2; ii++ )
{
GRRect( &DrawPanel->m_ClipBox, DC, refx * scale, refy * scale,
GRRect( &m_canvas->m_ClipBox, DC, refx * scale, refy * scale,
xg * scale, yg * scale, width, Color );
refx += GRID_REF_W; refy += GRID_REF_W;
@@ -1073,7 +1073,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_PODPIS_LU:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_VERT, size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
width, false, false );
@@ -1082,7 +1082,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_SEGMENT_LU:
xg = Sheet->m_LeftMargin - WsItem->m_Endx;
yg = Sheet->m_Size.y - Sheet->m_BottomMargin - WsItem->m_Endy;
GRLine( &DrawPanel->m_ClipBox, DC, pos.x, pos.y,
GRLine( &m_canvas->m_ClipBox, DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
break;
}
@@ -1099,7 +1099,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_SEGMENT_LT:
xg = Sheet->m_LeftMargin + WsItem->m_Endx;
yg = Sheet->m_BottomMargin + WsItem->m_Endy;
GRLine( &DrawPanel->m_ClipBox, DC, pos.x, pos.y,
GRLine( &m_canvas->m_ClipBox, DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
break;
}
@@ -1117,10 +1117,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
Line.Printf( wxT( "%d" ), jj );
if( ii < xg - PAS_REF / 2 )
{
GRLine( &DrawPanel->m_ClipBox, DC, ii * scale, refy * scale,
GRLine( &m_canvas->m_ClipBox, DC, ii * scale, refy * scale,
ii * scale, ( refy + GRID_REF_W ) * scale, width, Color );
}
DrawGraphicText( DrawPanel, DC,
DrawGraphicText( m_canvas, DC,
wxPoint( ( ii - gxpas / 2 ) * scale,
( refy + GRID_REF_W / 2 ) * scale ),
Color, Line, TEXT_ORIENT_HORIZ, size_ref,
@@ -1128,10 +1128,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
width, false, false );
if( ii < xg - PAS_REF / 2 )
{
GRLine( &DrawPanel->m_ClipBox, DC, ii * scale, yg * scale,
GRLine( &m_canvas->m_ClipBox, DC, ii * scale, yg * scale,
ii * scale, ( yg - GRID_REF_W ) * scale, width, Color );
}
DrawGraphicText( DrawPanel, DC,
DrawGraphicText( m_canvas, DC,
wxPoint( ( ii - gxpas / 2 ) * scale,
( yg - GRID_REF_W / 2) * scale ),
Color, Line, TEXT_ORIENT_HORIZ, size_ref,
@@ -1149,10 +1149,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
Line.Printf( wxT( "%c" ), 'a' + jj - 26 );
if( ii < yg - PAS_REF / 2 )
{
GRLine( &DrawPanel->m_ClipBox, DC, refx * scale, ii * scale,
GRLine( &m_canvas->m_ClipBox, DC, refx * scale, ii * scale,
( refx + GRID_REF_W ) * scale, ii * scale, width, Color );
}
DrawGraphicText( DrawPanel, DC,
DrawGraphicText( m_canvas, DC,
wxPoint( ( refx + GRID_REF_W / 2 ) * scale,
( ii - gypas / 2 ) * scale ),
Color, Line, TEXT_ORIENT_HORIZ, size_ref,
@@ -1160,10 +1160,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
width, false, false );
if( ii < yg - PAS_REF / 2 )
{
GRLine( &DrawPanel->m_ClipBox, DC, xg * scale, ii * scale,
GRLine( &m_canvas->m_ClipBox, DC, xg * scale, ii * scale,
( xg - GRID_REF_W ) * scale, ii * scale, width, Color );
}
DrawGraphicText( DrawPanel, DC,
DrawGraphicText( m_canvas, DC,
wxPoint( ( xg - GRID_REF_W / 2 ) * scale,
( ii - gxpas / 2 ) * scale ),
Color, Line, TEXT_ORIENT_HORIZ, size_ref,
@@ -1197,7 +1197,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_PODPIS:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
@@ -1211,7 +1211,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
msg = WsItem->m_Legende;
if( screen->m_NumberOfScreen > 1 )
msg << screen->m_ScreenNumber;
DrawGraphicText( DrawPanel, DC, pos, Color, msg,
DrawGraphicText( m_canvas, DC, pos, Color, msg,
TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER, width, false, false );
break;
@@ -1220,7 +1220,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << screen->m_NumberOfScreen;
DrawGraphicText( DrawPanel, DC, pos, Color, msg,
DrawGraphicText( m_canvas, DC, pos, Color, msg,
TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER, width, false, false );
break;
@@ -1229,7 +1229,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
msg = screen->m_Company;
if( !msg.IsEmpty() )
{
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size1_5,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width,
@@ -1241,7 +1241,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
msg = screen->m_Title;
if( !msg.IsEmpty() )
{
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size1_5,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width,
@@ -1253,14 +1253,14 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
msg = screen->m_Commentaire1;
if( !msg.IsEmpty() )
{
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width,
false, false );
pos.x = (Sheet->m_LeftMargin + 1260) * scale;
pos.y = (Sheet->m_TopMargin + 270) * scale;
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, 1800, size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width,
@@ -1272,7 +1272,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
msg = screen->m_Commentaire2;
if( !msg.IsEmpty() )
{
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
@@ -1283,7 +1283,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
msg = screen->m_Commentaire3;
if( !msg.IsEmpty() )
{
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
@@ -1294,7 +1294,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
msg = screen->m_Commentaire4;
if( !msg.IsEmpty() )
{
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
@@ -1312,7 +1312,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
Sheet->m_RightMargin - WsItem->m_Endx;
yg = Sheet->m_Size.y -
Sheet->m_BottomMargin - WsItem->m_Endy;
GRLine( &DrawPanel->m_ClipBox, DC, pos.x, pos.y,
GRLine( &m_canvas->m_ClipBox, DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
break;
}
@@ -1332,14 +1332,14 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
msg = screen->m_Commentaire1;
if( !msg.IsEmpty() )
{
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width,
false, false );
pos.x = (Sheet->m_LeftMargin + 1260) * scale;
pos.y = (Sheet->m_TopMargin + 270) * scale;
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, 1800, size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width,
@@ -1350,7 +1350,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_PODPIS_D:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width,
@@ -1361,7 +1361,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << screen->m_ScreenNumber;
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
@@ -1375,7 +1375,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
Sheet->m_RightMargin - WsItem->m_Endx;
yg = Sheet->m_Size.y -
Sheet->m_BottomMargin - WsItem->m_Endy;
GRLine( &DrawPanel->m_ClipBox, DC, pos.x, pos.y,
GRLine( &m_canvas->m_ClipBox, DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
break;
}
@@ -1397,7 +1397,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += screen->m_Date;
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, true );
@@ -1407,7 +1407,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += screen->m_Revision;
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
GetPenSizeForBold( MIN( size.x, size.y ) ),
@@ -1419,7 +1419,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
msg = WsItem->m_Legende;
msg += g_ProductName + wxGetApp().GetAppName();
msg += wxT( " " ) + GetBuildVersion();
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
@@ -1429,7 +1429,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += Sheet->m_Name;
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
@@ -1440,7 +1440,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << screen->m_ScreenNumber << wxT( "/" ) << screen->m_NumberOfScreen;
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
@@ -1455,7 +1455,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
msg = WsItem->m_Legende;
msg << fname << wxT( "." ) << fext;
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
@@ -1466,7 +1466,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += GetScreenDesc();
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
@@ -1479,7 +1479,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
msg += screen->m_Company;
if( !msg.IsEmpty() )
{
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
GetPenSizeForBold( MIN( size.x, size.y ) ),
@@ -1492,7 +1492,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += screen->m_Title;
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
GetPenSizeForBold( MIN( size.x, size.y ) ),
@@ -1505,7 +1505,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
msg += screen->m_Commentaire1;
if( !msg.IsEmpty() )
{
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
@@ -1519,7 +1519,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
msg += screen->m_Commentaire2;
if( !msg.IsEmpty() )
{
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
@@ -1533,7 +1533,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
msg += screen->m_Commentaire3;
if( !msg.IsEmpty() )
{
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
@@ -1547,7 +1547,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
msg += screen->m_Commentaire4;
if( !msg.IsEmpty() )
{
DrawGraphicText( DrawPanel, DC, pos, Color,
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
@@ -1570,7 +1570,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
GRID_REF_W - Sheet->m_RightMargin - WsItem->m_Endx;
yg = Sheet->m_Size.y -
GRID_REF_W - Sheet->m_BottomMargin - WsItem->m_Endy;
GRLine( &DrawPanel->m_ClipBox, DC, pos.x, pos.y,
GRLine( &m_canvas->m_ClipBox, DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
break;
}