Commit 8c0dc01f authored by Wayne Stambaugh's avatar Wayne Stambaugh

Pcbnew nanometer internal unit fixes.

* Scale page reference border and title block, grid sizes, and zoom factors
  correctly for nanometers.
parent add53213
...@@ -1003,7 +1003,8 @@ Ki_WorkSheetData WS_Segm5_LT = ...@@ -1003,7 +1003,8 @@ Ki_WorkSheetData WS_Segm5_LT =
}; };
void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width ) void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
double aScalar )
{ {
if( !m_showBorderAndTitleBlock ) if( !m_showBorderAndTitleBlock )
return; return;
...@@ -1012,41 +1013,39 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid ...@@ -1012,41 +1013,39 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
wxSize pageSize = pageInfo.GetSizeMils(); wxSize pageSize = pageInfo.GetSizeMils();
// if not printing, draw the page limits: // if not printing, draw the page limits:
if( !screen->m_IsPrinting && g_ShowPageLimits ) if( !aScreen->m_IsPrinting && g_ShowPageLimits )
{ {
int scale = m_internalUnits / 1000; GRSetDrawMode( aDC, GR_COPY );
GRSetDrawMode( DC, GR_COPY ); GRRect( m_canvas->GetClipBox(), aDC, 0, 0,
GRRect( m_canvas->GetClipBox(), DC, 0, 0, pageSize.x * aScalar, pageSize.y * aScalar, aLineWidth,
pageSize.x * scale, pageSize.y * scale, line_width,
g_DrawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY ); g_DrawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY );
} }
wxPoint margin_left_top( pageInfo.GetLeftMarginMils(), pageInfo.GetTopMarginMils() ); wxPoint margin_left_top( pageInfo.GetLeftMarginMils(), pageInfo.GetTopMarginMils() );
wxPoint margin_right_bottom( pageInfo.GetRightMarginMils(), pageInfo.GetBottomMarginMils() ); wxPoint margin_right_bottom( pageInfo.GetRightMarginMils(), pageInfo.GetBottomMarginMils() );
wxString paper = pageInfo.GetType(); wxString paper = pageInfo.GetType();
wxString file = screen->GetFileName(); wxString file = aScreen->GetFileName();
TITLE_BLOCK t_block = GetTitleBlock(); TITLE_BLOCK t_block = GetTitleBlock();
int number_of_screens = screen->m_NumberOfScreen; int number_of_screens = aScreen->m_NumberOfScreen;
int screen_to_draw = screen->m_ScreenNumber; int screen_to_draw = aScreen->m_ScreenNumber;
TraceWorkSheet( ( wxDC* )DC, pageSize, margin_left_top, margin_right_bottom, TraceWorkSheet( aDC, pageSize, margin_left_top, margin_right_bottom,
paper, file, t_block, number_of_screens, screen_to_draw, paper, file, t_block, number_of_screens, screen_to_draw,
( int )line_width ); aLineWidth, aScalar );
} }
void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoint& aRB, void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoint& aRB,
wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb, wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb,
int aNScr, int aScr, int aLnW, EDA_COLOR_T aClr1, int aNScr, int aScr, int aLnW, double aScalar,
EDA_COLOR_T aClr2 ) EDA_COLOR_T aClr1, EDA_COLOR_T aClr2 )
{ {
wxPoint pos; wxPoint pos;
int refx, refy; int refx, refy;
wxString Line; wxString Line;
Ki_WorkSheetData* WsItem; Ki_WorkSheetData* WsItem;
int scale = m_internalUnits / 1000; wxSize size( SIZETEXT * aScalar, SIZETEXT * aScalar );
wxSize size( SIZETEXT * scale, SIZETEXT * scale ); wxSize size_ref( SIZETEXT_REF * aScalar, SIZETEXT_REF * aScalar );
wxSize size_ref( SIZETEXT_REF * scale, SIZETEXT_REF * scale );
wxString msg; wxString msg;
GRSetDrawMode( aDC, GR_COPY ); GRSetDrawMode( aDC, GR_COPY );
...@@ -1062,15 +1061,15 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi ...@@ -1062,15 +1061,15 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
// Draw the border. // Draw the border.
GRRect( m_canvas->GetClipBox(), aDC, refx * scale, refy * scale, GRRect( m_canvas->GetClipBox(), aDC, refx * aScalar, refy * aScalar,
xg * scale, yg * scale, aLnW, aClr1 ); xg * aScalar, yg * aScalar, aLnW, aClr1 );
refx = aLT.x; refx = aLT.x;
refy = aSz.y - aRB.y; // Lower left corner refy = aSz.y - aRB.y; // Lower left corner
for( WsItem = &WS_Segm1_LU; WsItem != NULL; WsItem = WsItem->Pnext ) for( WsItem = &WS_Segm1_LU; WsItem != NULL; WsItem = WsItem->Pnext )
{ {
pos.x = ( refx - WsItem->m_Posx ) * scale; pos.x = ( refx - WsItem->m_Posx ) * aScalar;
pos.y = ( refy - WsItem->m_Posy ) * scale; pos.y = ( refy - WsItem->m_Posy ) * aScalar;
msg.Empty(); msg.Empty();
switch( WsItem->m_Type ) switch( WsItem->m_Type )
{ {
...@@ -1090,7 +1089,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi ...@@ -1090,7 +1089,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
xg = aLT.x - WsItem->m_Endx; xg = aLT.x - WsItem->m_Endx;
yg = aSz.y - aRB.y - WsItem->m_Endy; yg = aSz.y - aRB.y - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 ); xg * aScalar, yg * aScalar, aLnW, aClr1 );
break; break;
} }
} }
...@@ -1098,8 +1097,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi ...@@ -1098,8 +1097,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
refy = aRB.y; // Left Top corner refy = aRB.y; // Left Top corner
for( WsItem = &WS_Segm1_LT; WsItem != NULL; WsItem = WsItem->Pnext ) for( WsItem = &WS_Segm1_LT; WsItem != NULL; WsItem = WsItem->Pnext )
{ {
pos.x = ( refx + WsItem->m_Posx ) * scale; pos.x = ( refx + WsItem->m_Posx ) * aScalar;
pos.y = ( refy + WsItem->m_Posy ) * scale; pos.y = ( refy + WsItem->m_Posy ) * aScalar;
msg.Empty(); msg.Empty();
switch( WsItem->m_Type ) switch( WsItem->m_Type )
{ {
...@@ -1107,14 +1106,14 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi ...@@ -1107,14 +1106,14 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
xg = aLT.x + WsItem->m_Endx; xg = aLT.x + WsItem->m_Endx;
yg = aRB.y + WsItem->m_Endy; yg = aRB.y + WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 ); xg * aScalar, yg * aScalar, aLnW, aClr1 );
break; break;
} }
} }
wxSize size2( SIZETEXT * scale * 2, SIZETEXT * scale * 2); wxSize size2( SIZETEXT * aScalar * 2, SIZETEXT * aScalar * 2);
wxSize size3( SIZETEXT * scale * 3, SIZETEXT * scale * 3); wxSize size3( SIZETEXT * aScalar * 3, SIZETEXT * aScalar * 3);
wxSize size1_5( SIZETEXT * scale * 1.5, SIZETEXT * scale * 1.5); wxSize size1_5( SIZETEXT * aScalar * 1.5, SIZETEXT * aScalar * 1.5);
// lower right corner // lower right corner
refx = aSz.x - aRB.x; refx = aSz.x - aRB.x;
refy = aSz.y - aRB.y; refy = aSz.y - aRB.y;
...@@ -1123,8 +1122,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi ...@@ -1123,8 +1122,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
{ {
for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext ) for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext )
{ {
pos.x = (refx - WsItem->m_Posx) * scale; pos.x = (refx - WsItem->m_Posx) * aScalar;
pos.y = (refy - WsItem->m_Posy) * scale; pos.y = (refy - WsItem->m_Posy) * aScalar;
msg.Empty(); msg.Empty();
switch( WsItem->m_Type ) switch( WsItem->m_Type )
{ {
...@@ -1198,8 +1197,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi ...@@ -1198,8 +1197,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
msg, TEXT_ORIENT_HORIZ, size3, msg, TEXT_ORIENT_HORIZ, size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false ); aLnW, false, false );
pos.x = (aLT.x + 1260) * scale; pos.x = (aLT.x + 1260) * aScalar;
pos.y = (aLT.y + 270) * scale; pos.y = (aLT.y + 270) * aScalar;
DrawGraphicText( m_canvas, aDC, pos, aClr2, DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, 1800, size2, msg, 1800, size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
...@@ -1244,13 +1243,13 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi ...@@ -1244,13 +1243,13 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
case WS_LEFT_SEGMENT: case WS_LEFT_SEGMENT:
WS_MostUpperLine.m_Posy = WS_MostUpperLine.m_Endy = WS_MostUpperLine.m_Posy = WS_MostUpperLine.m_Endy =
WS_MostLeftLine.m_Posy = STAMP_OY; WS_MostLeftLine.m_Posy = STAMP_OY;
pos.y = ( refy - WsItem->m_Posy ) * scale; pos.y = ( refy - WsItem->m_Posy ) * aScalar;
case WS_SEGMENT: case WS_SEGMENT:
xg = aSz.x - aRB.x - WsItem->m_Endx; xg = aSz.x - aRB.x - WsItem->m_Endx;
yg = aSz.y - aRB.y - WsItem->m_Endy; yg = aSz.y - aRB.y - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 ); xg * aScalar, yg * aScalar, aLnW, aClr1 );
break; break;
} }
} }
...@@ -1259,8 +1258,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi ...@@ -1259,8 +1258,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
{ {
for( WsItem = &WS_CADRE_D; WsItem != NULL; WsItem = WsItem->Pnext ) for( WsItem = &WS_CADRE_D; WsItem != NULL; WsItem = WsItem->Pnext )
{ {
pos.x = ( refx - WsItem->m_Posx ) * scale; pos.x = ( refx - WsItem->m_Posx ) * aScalar;
pos.y = ( refy - WsItem->m_Posy ) * scale; pos.y = ( refy - WsItem->m_Posy ) * aScalar;
msg.Empty(); msg.Empty();
switch( WsItem->m_Type ) switch( WsItem->m_Type )
...@@ -1274,8 +1273,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi ...@@ -1274,8 +1273,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
msg, TEXT_ORIENT_HORIZ, size3, msg, TEXT_ORIENT_HORIZ, size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false ); aLnW, false, false );
pos.x = (aLT.x + 1260) * scale; pos.x = (aLT.x + 1260) * aScalar;
pos.y = (aLT.y + 270) * scale; pos.y = (aLT.y + 270) * aScalar;
DrawGraphicText( m_canvas, aDC, pos, aClr2, DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, 1800, size2, msg, 1800, size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
...@@ -1303,13 +1302,13 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi ...@@ -1303,13 +1302,13 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
break; break;
case WS_LEFT_SEGMENT_D: case WS_LEFT_SEGMENT_D:
pos.y = ( refy - WsItem->m_Posy ) * scale; pos.y = ( refy - WsItem->m_Posy ) * aScalar;
case WS_SEGMENT_D: case WS_SEGMENT_D:
xg = aSz.x - aRB.x - WsItem->m_Endx; xg = aSz.x - aRB.x - WsItem->m_Endx;
yg = aSz.y - aRB.y - WsItem->m_Endy; yg = aSz.y - aRB.y - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 ); xg * aScalar, yg * aScalar, aLnW, aClr1 );
break; break;
} }
} }
...@@ -1320,8 +1319,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi ...@@ -1320,8 +1319,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
int ii, jj, ipas, gxpas, gypas; int ii, jj, ipas, gxpas, gypas;
for( ii = 0; ii < 2; ii++ ) for( ii = 0; ii < 2; ii++ )
{ {
GRRect( m_canvas->GetClipBox(), aDC, refx * scale, refy * scale, GRRect( m_canvas->GetClipBox(), aDC, refx * aScalar, refy * aScalar,
xg * scale, yg * scale, aLnW, aClr1 ); xg * aScalar, yg * aScalar, aLnW, aClr1 );
refx += GRID_REF_W; refy += GRID_REF_W; refx += GRID_REF_W; refy += GRID_REF_W;
xg -= GRID_REF_W; yg -= GRID_REF_W; xg -= GRID_REF_W; yg -= GRID_REF_W;
...@@ -1343,24 +1342,24 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi ...@@ -1343,24 +1342,24 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
if( ii < xg - PAS_REF / 2 ) if( ii < xg - PAS_REF / 2 )
{ {
GRLine( m_canvas->GetClipBox(), aDC, ii * scale, refy * scale, GRLine( m_canvas->GetClipBox(), aDC, ii * aScalar, refy * aScalar,
ii * scale, ( refy + GRID_REF_W ) * scale, aLnW, aClr1 ); ii * aScalar, ( refy + GRID_REF_W ) * aScalar, aLnW, aClr1 );
} }
DrawGraphicText( m_canvas, aDC, DrawGraphicText( m_canvas, aDC,
wxPoint( ( ii - gxpas / 2 ) * scale, wxPoint( ( ii - gxpas / 2 ) * aScalar,
( refy + GRID_REF_W / 2 ) * scale ), ( refy + GRID_REF_W / 2 ) * aScalar ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref, aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false ); aLnW, false, false );
if( ii < xg - PAS_REF / 2 ) if( ii < xg - PAS_REF / 2 )
{ {
GRLine( m_canvas->GetClipBox(), aDC, ii * scale, yg * scale, GRLine( m_canvas->GetClipBox(), aDC, ii * aScalar, yg * aScalar,
ii * scale, ( yg - GRID_REF_W ) * scale, aLnW, aClr1 ); ii * aScalar, ( yg - GRID_REF_W ) * aScalar, aLnW, aClr1 );
} }
DrawGraphicText( m_canvas, aDC, DrawGraphicText( m_canvas, aDC,
wxPoint( ( ii - gxpas / 2 ) * scale, wxPoint( ( ii - gxpas / 2 ) * aScalar,
( yg - GRID_REF_W / 2) * scale ), ( yg - GRID_REF_W / 2) * aScalar ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref, aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false ); aLnW, false, false );
...@@ -1378,25 +1377,25 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi ...@@ -1378,25 +1377,25 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
if( ii < yg - PAS_REF / 2 ) if( ii < yg - PAS_REF / 2 )
{ {
GRLine( m_canvas->GetClipBox(), aDC, refx * scale, ii * scale, GRLine( m_canvas->GetClipBox(), aDC, refx * aScalar, ii * aScalar,
( refx + GRID_REF_W ) * scale, ii * scale, aLnW, aClr1 ); ( refx + GRID_REF_W ) * aScalar, ii * aScalar, aLnW, aClr1 );
} }
DrawGraphicText( m_canvas, aDC, DrawGraphicText( m_canvas, aDC,
wxPoint( ( refx + GRID_REF_W / 2 ) * scale, wxPoint( ( refx + GRID_REF_W / 2 ) * aScalar,
( ii - gypas / 2 ) * scale ), ( ii - gypas / 2 ) * aScalar ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref, aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false ); aLnW, false, false );
if( ii < yg - PAS_REF / 2 ) if( ii < yg - PAS_REF / 2 )
{ {
GRLine( m_canvas->GetClipBox(), aDC, xg * scale, ii * scale, GRLine( m_canvas->GetClipBox(), aDC, xg * aScalar, ii * aScalar,
( xg - GRID_REF_W ) * scale, ii * scale, aLnW, aClr1 ); ( xg - GRID_REF_W ) * aScalar, ii * aScalar, aLnW, aClr1 );
} }
DrawGraphicText( m_canvas, aDC, DrawGraphicText( m_canvas, aDC,
wxPoint( ( xg - GRID_REF_W / 2 ) * scale, wxPoint( ( xg - GRID_REF_W / 2 ) * aScalar,
( ii - gxpas / 2 ) * scale ), ( ii - gxpas / 2 ) * aScalar ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref, aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false ); aLnW, false, false );
...@@ -1408,8 +1407,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi ...@@ -1408,8 +1407,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext ) for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext )
{ {
pos.x = (refx - WsItem->m_Posx) * scale; pos.x = (refx - WsItem->m_Posx) * aScalar;
pos.y = (refy - WsItem->m_Posy) * scale; pos.y = (refy - WsItem->m_Posy) * aScalar;
msg.Empty(); msg.Empty();
switch( WsItem->m_Type ) switch( WsItem->m_Type )
...@@ -1592,13 +1591,13 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi ...@@ -1592,13 +1591,13 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
WS_MostUpperLine.m_Posy = WS_MostUpperLine.m_Posy =
WS_MostUpperLine.m_Endy = WS_MostUpperLine.m_Endy =
WS_MostLeftLine.m_Posy = UpperLimit; WS_MostLeftLine.m_Posy = UpperLimit;
pos.y = (refy - WsItem->m_Posy) * scale; pos.y = (refy - WsItem->m_Posy) * aScalar;
case WS_SEGMENT: case WS_SEGMENT:
xg = aSz.x - GRID_REF_W - aRB.x - WsItem->m_Endx; xg = aSz.x - GRID_REF_W - aRB.x - WsItem->m_Endx;
yg = aSz.y - GRID_REF_W - aRB.y - WsItem->m_Endy; yg = aSz.y - GRID_REF_W - aRB.y - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 ); xg * aScalar, yg * aScalar, aLnW, aClr1 );
break; break;
} }
} }
......
...@@ -237,7 +237,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame, ...@@ -237,7 +237,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
sheetSize.y/2) ); sheetSize.y/2) );
if( aPrint_Sheet_Ref ) if( aPrint_Sheet_Ref )
frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness ); frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness, MILS_TO_IU_SCALAR );
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
panel->SetClipBox( tmp ); panel->SetClipBox( tmp );
......
...@@ -378,7 +378,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen ) ...@@ -378,7 +378,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
aScreen->Draw( panel, dc, GR_DEFAULT_DRAWMODE ); aScreen->Draw( panel, dc, GR_DEFAULT_DRAWMODE );
if( printReference ) if( printReference )
parent->TraceWorkSheet( dc, aScreen, g_DrawDefaultLineThickness ); parent->TraceWorkSheet( dc, aScreen, g_DrawDefaultLineThickness, MILS_TO_IU_SCALAR );
g_DrawBgColor = bg_color; g_DrawBgColor = bg_color;
aScreen->m_IsPrinting = false; aScreen->m_IsPrinting = false;
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <gr_basic.h> #include <gr_basic.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <wxEeschemaStruct.h> #include <wxEeschemaStruct.h>
#include <base_units.h>
#include <general.h> #include <general.h>
#include <class_library.h> #include <class_library.h>
...@@ -70,7 +71,7 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -70,7 +71,7 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
GetScreen()->Draw( m_canvas, DC, GR_DEFAULT_DRAWMODE ); GetScreen()->Draw( m_canvas, DC, GR_DEFAULT_DRAWMODE );
TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness ); TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness, MILS_TO_IU_SCALAR );
#ifdef USE_WX_OVERLAY #ifdef USE_WX_OVERLAY
if( IsShown() ) if( IsShown() )
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <gestfich.h> #include <gestfich.h>
#include <confirm.h> #include <confirm.h>
#include <base_units.h>
#include <general.h> #include <general.h>
#include <protos.h> #include <protos.h>
...@@ -862,7 +863,7 @@ void SCH_EDIT_FRAME::SVG_Print( wxCommandEvent& event ) ...@@ -862,7 +863,7 @@ void SCH_EDIT_FRAME::SVG_Print( wxCommandEvent& event )
void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData ) void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData )
{ {
GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE ); GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE );
TraceWorkSheet( aDC, GetScreen(), g_DrawDefaultLineThickness ); TraceWorkSheet( aDC, GetScreen(), g_DrawDefaultLineThickness, MILS_TO_IU_SCALAR );
} }
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <common.h> #include <common.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <drawtxt.h> #include <drawtxt.h>
#include <base_units.h>
#include <gerbview.h> #include <gerbview.h>
#include <class_board_design_settings.h> #include <class_board_design_settings.h>
...@@ -106,7 +107,7 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -106,7 +107,7 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if( IsElementVisible( DCODES_VISIBLE ) ) if( IsElementVisible( DCODES_VISIBLE ) )
DrawItemsDCodeID( DC, GR_COPY ); DrawItemsDCodeID( DC, GR_COPY );
TraceWorkSheet( DC, screen, 0 ); TraceWorkSheet( DC, screen, 0, MILS_TO_IU_SCALAR );
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
......
...@@ -37,6 +37,19 @@ ...@@ -37,6 +37,19 @@
#include <common.h> #include <common.h>
/// Scalar to convert mils to internal units.
#if defined( PCBNEW )
#if defined( USE_PCBNEW_NANOMETRES )
#define MILS_TO_IU_SCALAR 25.4e3 // Pcbnew in nanometers.
#else
#define MILS_TO_IU_SCALAR 10.0 // Pcbnew in deci-mils.
#endif
#else
#define MILS_TO_IU_SCALAR 1.0 // Eeschema and anything else.
#endif
/** /**
* Function To_User_Unit * Function To_User_Unit
* convert \a aValue in internal units to the appropriate user units defined by \a aUnit. * convert \a aValue in internal units to the appropriate user units defined by \a aUnit.
......
...@@ -667,7 +667,7 @@ public: ...@@ -667,7 +667,7 @@ public:
*/ */
double GetZoom(); double GetZoom();
void TraceWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth ); void TraceWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth, double aScalar );
/** /**
* Function TraceWorkSheet is a core function for drawing of the page layout with * Function TraceWorkSheet is a core function for drawing of the page layout with
...@@ -682,13 +682,14 @@ public: ...@@ -682,13 +682,14 @@ public:
* @param aNScr The number of screens (for basic inscriptions). * @param aNScr The number of screens (for basic inscriptions).
* @param aScr The screen number (for basic inscriptions). * @param aScr The screen number (for basic inscriptions).
* @param aLnW The line width for drawing. * @param aLnW The line width for drawing.
* @param aScalar Scalar to convert from mils to internal units.
* @param aClr1 The color for drawing. * @param aClr1 The color for drawing.
* @param aClr2 The colr for inscriptions. * @param aClr2 The colr for inscriptions.
*/ */
void TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoint& aRB, void TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoint& aRB,
wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb, wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb,
int aNScr, int aScr, int aLnW, EDA_COLOR_T aClr1 = RED, int aNScr, int aScr, int aLnW, double aScalar,
EDA_COLOR_T aClr2 = RED ); EDA_COLOR_T aClr1 = RED, EDA_COLOR_T aClr2 = RED );
void PlotWorkSheet( PLOTTER* aPlotter, BASE_SCREEN* aScreen ); void PlotWorkSheet( PLOTTER* aPlotter, BASE_SCREEN* aScreen );
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <trigo.h> #include <trigo.h>
#include <class_pcb_screen.h> #include <class_pcb_screen.h>
#include <eda_text.h> // FILLED #include <eda_text.h> // FILLED
#include <base_units.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <class_board_design_settings.h> #include <class_board_design_settings.h>
...@@ -18,6 +19,19 @@ ...@@ -18,6 +19,19 @@
#include <pcbnew_id.h> #include <pcbnew_id.h>
#if defined( USE_PCBNEW_NANOMETRES )
#define ZOOM_FACTOR( x ) ( x * 25.4e2 )
#define DMIL_GRID( x ) wxRealPoint( x * 25.4e2, x * 25.4e2 )
#define MM_GRID( x ) wxRealPoint( x * 1e6, x * 1e6 )
#else
#define ZOOM_FACTOR( x ) x
#define DMIL_GRID( x ) wxRealPoint( x , x )
#define MM_GRID( x ) wxRealPoint( x * 1e4 / 25.4, x * 1e4 / 25.4 )
#endif
/* Default Pcbnew zoom values. /* Default Pcbnew zoom values.
* Limited to 19 values to keep a decent size to menus * Limited to 19 values to keep a decent size to menus
* 15 it better but does not allow a sufficient number of values * 15 it better but does not allow a sufficient number of values
...@@ -30,42 +44,56 @@ ...@@ -30,42 +44,56 @@
*/ */
static const double pcbZoomList[] = static const double pcbZoomList[] =
{ {
0.5, 1.0, 1.5, 2.0, 3.0, 4.5, 7.0, ZOOM_FACTOR( 0.5 ),
10.0, 15.0, 22.0, 35.0, 50.0, 80.0, 120.0, ZOOM_FACTOR( 1.0 ),
200.0, 350.0, 500.0, 1000.0, 2000.0 ZOOM_FACTOR( 1.5 ),
ZOOM_FACTOR( 2.0 ),
ZOOM_FACTOR( 3.0 ),
ZOOM_FACTOR( 4.5 ),
ZOOM_FACTOR( 7.0 ),
ZOOM_FACTOR( 10.0 ),
ZOOM_FACTOR( 15.0 ),
ZOOM_FACTOR( 22.0 ),
ZOOM_FACTOR( 35.0 ),
ZOOM_FACTOR( 50.0 ),
ZOOM_FACTOR( 80.0 ),
ZOOM_FACTOR( 120.0 ),
ZOOM_FACTOR( 200.0 ),
ZOOM_FACTOR( 350.0 ),
ZOOM_FACTOR( 500.0 ),
ZOOM_FACTOR( 1000.0 ),
ZOOM_FACTOR( 2000.0 )
}; };
#define MM_TO_PCB_UNITS (10000.0 / 25.4)
// Default grid sizes for PCB editor screens. // Default grid sizes for PCB editor screens.
static GRID_TYPE pcbGridList[] = static GRID_TYPE pcbGridList[] =
{ {
// predefined grid list in 0.0001 inches // predefined grid list in 0.0001 inches
{ ID_POPUP_GRID_LEVEL_1000, wxRealPoint( 1000, 1000 ) }, { ID_POPUP_GRID_LEVEL_1000, DMIL_GRID( 1000 ) },
{ ID_POPUP_GRID_LEVEL_500, wxRealPoint( 500, 500 ) }, { ID_POPUP_GRID_LEVEL_500, DMIL_GRID( 500 ) },
{ ID_POPUP_GRID_LEVEL_250, wxRealPoint( 250, 250 ) }, { ID_POPUP_GRID_LEVEL_250, DMIL_GRID( 250 ) },
{ ID_POPUP_GRID_LEVEL_200, wxRealPoint( 200, 200 ) }, { ID_POPUP_GRID_LEVEL_200, DMIL_GRID( 200 ) },
{ ID_POPUP_GRID_LEVEL_100, wxRealPoint( 100, 100 ) }, { ID_POPUP_GRID_LEVEL_100, DMIL_GRID( 100 ) },
{ ID_POPUP_GRID_LEVEL_50, wxRealPoint( 50, 50 ) }, { ID_POPUP_GRID_LEVEL_50, DMIL_GRID( 50 ) },
{ ID_POPUP_GRID_LEVEL_25, wxRealPoint( 25, 25 ) }, { ID_POPUP_GRID_LEVEL_25, DMIL_GRID( 25 ) },
{ ID_POPUP_GRID_LEVEL_20, wxRealPoint( 20, 20 ) }, { ID_POPUP_GRID_LEVEL_20, DMIL_GRID( 20 ) },
{ ID_POPUP_GRID_LEVEL_10, wxRealPoint( 10, 10 ) }, { ID_POPUP_GRID_LEVEL_10, DMIL_GRID( 10 ) },
{ ID_POPUP_GRID_LEVEL_5, wxRealPoint( 5, 5 ) }, { ID_POPUP_GRID_LEVEL_5, DMIL_GRID( 5 ) },
{ ID_POPUP_GRID_LEVEL_2, wxRealPoint( 2, 2 ) }, { ID_POPUP_GRID_LEVEL_2, DMIL_GRID( 2 ) },
{ ID_POPUP_GRID_LEVEL_1, wxRealPoint( 1, 1 ) }, { ID_POPUP_GRID_LEVEL_1, DMIL_GRID( 1 ) },
// predefined grid list in mm // predefined grid list in mm
{ ID_POPUP_GRID_LEVEL_5MM, wxRealPoint( MM_TO_PCB_UNITS * 5.0, MM_TO_PCB_UNITS * 5.0 ) }, { ID_POPUP_GRID_LEVEL_5MM, MM_GRID( 5.0 ) },
{ ID_POPUP_GRID_LEVEL_2_5MM, wxRealPoint( MM_TO_PCB_UNITS * 2.5, MM_TO_PCB_UNITS * 2.5 ) }, { ID_POPUP_GRID_LEVEL_2_5MM, MM_GRID( 2.5 ) },
{ ID_POPUP_GRID_LEVEL_1MM, wxRealPoint( MM_TO_PCB_UNITS, MM_TO_PCB_UNITS ) }, { ID_POPUP_GRID_LEVEL_1MM, MM_GRID( 1.0 ) },
{ ID_POPUP_GRID_LEVEL_0_5MM, wxRealPoint( MM_TO_PCB_UNITS * 0.5, MM_TO_PCB_UNITS * 0.5 ) }, { ID_POPUP_GRID_LEVEL_0_5MM, MM_GRID( 0.5 ) },
{ ID_POPUP_GRID_LEVEL_0_25MM, wxRealPoint( MM_TO_PCB_UNITS * 0.25, MM_TO_PCB_UNITS * 0.25 ) }, { ID_POPUP_GRID_LEVEL_0_25MM, MM_GRID( 0.25 ) },
{ ID_POPUP_GRID_LEVEL_0_2MM, wxRealPoint( MM_TO_PCB_UNITS * 0.2, MM_TO_PCB_UNITS * 0.2 ) }, { ID_POPUP_GRID_LEVEL_0_2MM, MM_GRID( 0.2 ) },
{ ID_POPUP_GRID_LEVEL_0_1MM, wxRealPoint( MM_TO_PCB_UNITS * 0.1, MM_TO_PCB_UNITS * 0.1 ) }, { ID_POPUP_GRID_LEVEL_0_1MM, MM_GRID( 0.1 ) },
{ ID_POPUP_GRID_LEVEL_0_0_5MM, wxRealPoint( MM_TO_PCB_UNITS * 0.05, MM_TO_PCB_UNITS * 0.05 ) }, { ID_POPUP_GRID_LEVEL_0_0_5MM, MM_GRID( 0.05 ) },
{ ID_POPUP_GRID_LEVEL_0_0_25MM, wxRealPoint( MM_TO_PCB_UNITS * 0.025, MM_TO_PCB_UNITS * 0.025 ) }, { ID_POPUP_GRID_LEVEL_0_0_25MM, MM_GRID( 0.025 ) },
{ ID_POPUP_GRID_LEVEL_0_0_1MM, wxRealPoint( MM_TO_PCB_UNITS * 0.01, MM_TO_PCB_UNITS * 0.01 ) } { ID_POPUP_GRID_LEVEL_0_0_1MM, MM_GRID( 0.01 ) }
}; };
...@@ -79,13 +107,13 @@ PCB_SCREEN::PCB_SCREEN( const wxSize& aPageSizeIU ) : ...@@ -79,13 +107,13 @@ PCB_SCREEN::PCB_SCREEN( const wxSize& aPageSizeIU ) :
AddGrid( pcbGridList[i] ); AddGrid( pcbGridList[i] );
// Set the working grid size to a reasonnable value (in 1/10000 inch) // Set the working grid size to a reasonnable value (in 1/10000 inch)
SetGrid( wxRealPoint( 500, 500 ) ); SetGrid( DMIL_GRID( 500 ) );
m_Active_Layer = LAYER_N_BACK; // default active layer = bottom layer m_Active_Layer = LAYER_N_BACK; // default active layer = bottom layer
m_Route_Layer_TOP = LAYER_N_FRONT; // default layers pair for vias (bottom to top) m_Route_Layer_TOP = LAYER_N_FRONT; // default layers pair for vias (bottom to top)
m_Route_Layer_BOTTOM = LAYER_N_BACK; m_Route_Layer_BOTTOM = LAYER_N_BACK;
SetZoom( 150 ); // a default value for zoom SetZoom( ZOOM_FACTOR( 150 ) ); // a default value for zoom
InitDataPoints( aPageSizeIU ); InitDataPoints( aPageSizeIU );
} }
......
...@@ -265,7 +265,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, ...@@ -265,7 +265,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
g_DrawBgColor = WHITE; g_DrawBgColor = WHITE;
if( aPrint_Frame_Ref ) if( aPrint_Frame_Ref )
m_Parent->TraceWorkSheet( &dc, screen, s_Parameters.m_PenDefaultSize ); m_Parent->TraceWorkSheet( &dc, screen, s_Parameters.m_PenDefaultSize, MILS_TO_IU_SCALAR );
m_Parent->PrintPage( &dc, m_PrintMaskLayer, false, &s_Parameters); m_Parent->PrintPage( &dc, m_PrintMaskLayer, false, &s_Parameters);
g_DrawBgColor = bg_color; g_DrawBgColor = bg_color;
......
...@@ -35,9 +35,9 @@ ...@@ -35,9 +35,9 @@
#include <wxBasePcbFrame.h> #include <wxBasePcbFrame.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <confirm.h> #include <confirm.h>
#include <base_units.h>
#include <class_board.h> #include <class_board.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <protos.h> #include <protos.h>
...@@ -278,7 +278,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() ...@@ -278,7 +278,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
int bg_color = g_DrawBgColor; int bg_color = g_DrawBgColor;
if( m_PrintParams.m_Print_Sheet_Ref ) if( m_PrintParams.m_Print_Sheet_Ref )
m_Parent->TraceWorkSheet( dc, screen, m_PrintParams.m_PenDefaultSize ); m_Parent->TraceWorkSheet( dc, screen, m_PrintParams.m_PenDefaultSize, MILS_TO_IU_SCALAR );
if( printMirror ) if( printMirror )
{ {
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <fctsys.h> #include <fctsys.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <base_units.h>
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
...@@ -66,7 +67,7 @@ void FOOTPRINT_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -66,7 +67,7 @@ void FOOTPRINT_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
GRSetDrawMode( DC, GR_COPY ); GRSetDrawMode( DC, GR_COPY );
m_canvas->DrawBackGround( DC ); m_canvas->DrawBackGround( DC );
TraceWorkSheet( DC, screen, 0 ); TraceWorkSheet( DC, screen, 0, MILS_TO_IU_SCALAR );
// Redraw the footprints // Redraw the footprints
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() ) for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
...@@ -104,7 +105,7 @@ void PCB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -104,7 +105,7 @@ void PCB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
m_canvas->DrawBackGround( DC ); m_canvas->DrawBackGround( DC );
TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness ); TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness, MILS_TO_IU_SCALAR );
GetBoard()->Draw( m_canvas, DC, GR_OR | GR_ALLOW_HIGHCONTRAST); GetBoard()->Draw( m_canvas, DC, GR_OR | GR_ALLOW_HIGHCONTRAST);
......
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