Pcbnew nanometer internal unit fixes.

* Scale page reference border and title block, grid sizes, and zoom factors
  correctly for nanometers.
This commit is contained in:
Wayne Stambaugh 2012-04-15 21:25:26 -04:00
parent add5321328
commit 8c0dc01fdd
12 changed files with 151 additions and 106 deletions

View File

@ -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 )
return;
@ -1012,41 +1013,39 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
wxSize pageSize = pageInfo.GetSizeMils();
// 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( DC, GR_COPY );
GRRect( m_canvas->GetClipBox(), DC, 0, 0,
pageSize.x * scale, pageSize.y * scale, line_width,
GRSetDrawMode( aDC, GR_COPY );
GRRect( m_canvas->GetClipBox(), aDC, 0, 0,
pageSize.x * aScalar, pageSize.y * aScalar, aLineWidth,
g_DrawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY );
}
wxPoint margin_left_top( pageInfo.GetLeftMarginMils(), pageInfo.GetTopMarginMils() );
wxPoint margin_right_bottom( pageInfo.GetRightMarginMils(), pageInfo.GetBottomMarginMils() );
wxString paper = pageInfo.GetType();
wxString file = screen->GetFileName();
wxString file = aScreen->GetFileName();
TITLE_BLOCK t_block = GetTitleBlock();
int number_of_screens = screen->m_NumberOfScreen;
int screen_to_draw = screen->m_ScreenNumber;
int number_of_screens = aScreen->m_NumberOfScreen;
int screen_to_draw = aScreen->m_ScreenNumber;
TraceWorkSheet( ( wxDC* )DC, pageSize, margin_left_top, margin_right_bottom,
paper, file, t_block, number_of_screens, screen_to_draw,
( int )line_width );
TraceWorkSheet( aDC, pageSize, margin_left_top, margin_right_bottom,
paper, file, t_block, number_of_screens, screen_to_draw,
aLineWidth, aScalar );
}
void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoint& aRB,
wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb,
int aNScr, int aScr, int aLnW, EDA_COLOR_T aClr1,
EDA_COLOR_T aClr2 )
wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb,
int aNScr, int aScr, int aLnW, double aScalar,
EDA_COLOR_T aClr1, EDA_COLOR_T aClr2 )
{
wxPoint pos;
int refx, refy;
wxString Line;
Ki_WorkSheetData* WsItem;
int scale = m_internalUnits / 1000;
wxSize size( SIZETEXT * scale, SIZETEXT * scale );
wxSize size_ref( SIZETEXT_REF * scale, SIZETEXT_REF * scale );
wxSize size( SIZETEXT * aScalar, SIZETEXT * aScalar );
wxSize size_ref( SIZETEXT_REF * aScalar, SIZETEXT_REF * aScalar );
wxString msg;
GRSetDrawMode( aDC, GR_COPY );
@ -1062,15 +1061,15 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
#if defined(KICAD_GOST)
// Draw the border.
GRRect( m_canvas->GetClipBox(), aDC, refx * scale, refy * scale,
xg * scale, yg * scale, aLnW, aClr1 );
GRRect( m_canvas->GetClipBox(), aDC, refx * aScalar, refy * aScalar,
xg * aScalar, yg * aScalar, aLnW, aClr1 );
refx = aLT.x;
refy = aSz.y - aRB.y; // Lower left corner
for( WsItem = &WS_Segm1_LU; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = ( refx - WsItem->m_Posx ) * scale;
pos.y = ( refy - WsItem->m_Posy ) * scale;
pos.x = ( refx - WsItem->m_Posx ) * aScalar;
pos.y = ( refy - WsItem->m_Posy ) * aScalar;
msg.Empty();
switch( WsItem->m_Type )
{
@ -1090,7 +1089,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
xg = aLT.x - WsItem->m_Endx;
yg = aSz.y - aRB.y - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 );
xg * aScalar, yg * aScalar, aLnW, aClr1 );
break;
}
}
@ -1098,8 +1097,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
refy = aRB.y; // Left Top corner
for( WsItem = &WS_Segm1_LT; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = ( refx + WsItem->m_Posx ) * scale;
pos.y = ( refy + WsItem->m_Posy ) * scale;
pos.x = ( refx + WsItem->m_Posx ) * aScalar;
pos.y = ( refy + WsItem->m_Posy ) * aScalar;
msg.Empty();
switch( WsItem->m_Type )
{
@ -1107,14 +1106,14 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
xg = aLT.x + WsItem->m_Endx;
yg = aRB.y + WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 );
xg * aScalar, yg * aScalar, aLnW, aClr1 );
break;
}
}
wxSize size2( SIZETEXT * scale * 2, SIZETEXT * scale * 2);
wxSize size3( SIZETEXT * scale * 3, SIZETEXT * scale * 3);
wxSize size1_5( SIZETEXT * scale * 1.5, SIZETEXT * scale * 1.5);
wxSize size2( SIZETEXT * aScalar * 2, SIZETEXT * aScalar * 2);
wxSize size3( SIZETEXT * aScalar * 3, SIZETEXT * aScalar * 3);
wxSize size1_5( SIZETEXT * aScalar * 1.5, SIZETEXT * aScalar * 1.5);
// lower right corner
refx = aSz.x - aRB.x;
refy = aSz.y - aRB.y;
@ -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 )
{
pos.x = (refx - WsItem->m_Posx) * scale;
pos.y = (refy - WsItem->m_Posy) * scale;
pos.x = (refx - WsItem->m_Posx) * aScalar;
pos.y = (refy - WsItem->m_Posy) * aScalar;
msg.Empty();
switch( WsItem->m_Type )
{
@ -1198,8 +1197,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
msg, TEXT_ORIENT_HORIZ, size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
pos.x = (aLT.x + 1260) * scale;
pos.y = (aLT.y + 270) * scale;
pos.x = (aLT.x + 1260) * aScalar;
pos.y = (aLT.y + 270) * aScalar;
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, 1800, size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
@ -1244,13 +1243,13 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
case WS_LEFT_SEGMENT:
WS_MostUpperLine.m_Posy = WS_MostUpperLine.m_Endy =
WS_MostLeftLine.m_Posy = STAMP_OY;
pos.y = ( refy - WsItem->m_Posy ) * scale;
pos.y = ( refy - WsItem->m_Posy ) * aScalar;
case WS_SEGMENT:
xg = aSz.x - aRB.x - WsItem->m_Endx;
yg = aSz.y - aRB.y - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 );
xg * aScalar, yg * aScalar, aLnW, aClr1 );
break;
}
}
@ -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 )
{
pos.x = ( refx - WsItem->m_Posx ) * scale;
pos.y = ( refy - WsItem->m_Posy ) * scale;
pos.x = ( refx - WsItem->m_Posx ) * aScalar;
pos.y = ( refy - WsItem->m_Posy ) * aScalar;
msg.Empty();
switch( WsItem->m_Type )
@ -1274,8 +1273,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
msg, TEXT_ORIENT_HORIZ, size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
pos.x = (aLT.x + 1260) * scale;
pos.y = (aLT.y + 270) * scale;
pos.x = (aLT.x + 1260) * aScalar;
pos.y = (aLT.y + 270) * aScalar;
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, 1800, size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
@ -1303,13 +1302,13 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
break;
case WS_LEFT_SEGMENT_D:
pos.y = ( refy - WsItem->m_Posy ) * scale;
pos.y = ( refy - WsItem->m_Posy ) * aScalar;
case WS_SEGMENT_D:
xg = aSz.x - aRB.x - WsItem->m_Endx;
yg = aSz.y - aRB.y - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 );
xg * aScalar, yg * aScalar, aLnW, aClr1 );
break;
}
}
@ -1320,8 +1319,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
int ii, jj, ipas, gxpas, gypas;
for( ii = 0; ii < 2; ii++ )
{
GRRect( m_canvas->GetClipBox(), aDC, refx * scale, refy * scale,
xg * scale, yg * scale, aLnW, aClr1 );
GRRect( m_canvas->GetClipBox(), aDC, refx * aScalar, refy * aScalar,
xg * aScalar, yg * aScalar, aLnW, aClr1 );
refx += GRID_REF_W; refy += 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
if( ii < xg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), aDC, ii * scale, refy * scale,
ii * scale, ( refy + GRID_REF_W ) * scale, aLnW, aClr1 );
GRLine( m_canvas->GetClipBox(), aDC, ii * aScalar, refy * aScalar,
ii * aScalar, ( refy + GRID_REF_W ) * aScalar, aLnW, aClr1 );
}
DrawGraphicText( m_canvas, aDC,
wxPoint( ( ii - gxpas / 2 ) * scale,
( refy + GRID_REF_W / 2 ) * scale ),
wxPoint( ( ii - gxpas / 2 ) * aScalar,
( refy + GRID_REF_W / 2 ) * aScalar ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
if( ii < xg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), aDC, ii * scale, yg * scale,
ii * scale, ( yg - GRID_REF_W ) * scale, aLnW, aClr1 );
GRLine( m_canvas->GetClipBox(), aDC, ii * aScalar, yg * aScalar,
ii * aScalar, ( yg - GRID_REF_W ) * aScalar, aLnW, aClr1 );
}
DrawGraphicText( m_canvas, aDC,
wxPoint( ( ii - gxpas / 2 ) * scale,
( yg - GRID_REF_W / 2) * scale ),
wxPoint( ( ii - gxpas / 2 ) * aScalar,
( yg - GRID_REF_W / 2) * aScalar ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
@ -1378,25 +1377,25 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
if( ii < yg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), aDC, refx * scale, ii * scale,
( refx + GRID_REF_W ) * scale, ii * scale, aLnW, aClr1 );
GRLine( m_canvas->GetClipBox(), aDC, refx * aScalar, ii * aScalar,
( refx + GRID_REF_W ) * aScalar, ii * aScalar, aLnW, aClr1 );
}
DrawGraphicText( m_canvas, aDC,
wxPoint( ( refx + GRID_REF_W / 2 ) * scale,
( ii - gypas / 2 ) * scale ),
wxPoint( ( refx + GRID_REF_W / 2 ) * aScalar,
( ii - gypas / 2 ) * aScalar ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
if( ii < yg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), aDC, xg * scale, ii * scale,
( xg - GRID_REF_W ) * scale, ii * scale, aLnW, aClr1 );
GRLine( m_canvas->GetClipBox(), aDC, xg * aScalar, ii * aScalar,
( xg - GRID_REF_W ) * aScalar, ii * aScalar, aLnW, aClr1 );
}
DrawGraphicText( m_canvas, aDC,
wxPoint( ( xg - GRID_REF_W / 2 ) * scale,
( ii - gxpas / 2 ) * scale ),
wxPoint( ( xg - GRID_REF_W / 2 ) * aScalar,
( ii - gxpas / 2 ) * aScalar ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
@ -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 )
{
pos.x = (refx - WsItem->m_Posx) * scale;
pos.y = (refy - WsItem->m_Posy) * scale;
pos.x = (refx - WsItem->m_Posx) * aScalar;
pos.y = (refy - WsItem->m_Posy) * aScalar;
msg.Empty();
switch( WsItem->m_Type )
@ -1592,13 +1591,13 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
WS_MostUpperLine.m_Posy =
WS_MostUpperLine.m_Endy =
WS_MostLeftLine.m_Posy = UpperLimit;
pos.y = (refy - WsItem->m_Posy) * scale;
pos.y = (refy - WsItem->m_Posy) * aScalar;
case WS_SEGMENT:
xg = aSz.x - GRID_REF_W - aRB.x - WsItem->m_Endx;
yg = aSz.y - GRID_REF_W - aRB.y - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 );
xg * aScalar, yg * aScalar, aLnW, aClr1 );
break;
}
}

View File

@ -237,7 +237,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
sheetSize.y/2) );
if( aPrint_Sheet_Ref )
frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness );
frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness, MILS_TO_IU_SCALAR );
screen->m_IsPrinting = false;
panel->SetClipBox( tmp );

View File

@ -378,7 +378,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
aScreen->Draw( panel, dc, GR_DEFAULT_DRAWMODE );
if( printReference )
parent->TraceWorkSheet( dc, aScreen, g_DrawDefaultLineThickness );
parent->TraceWorkSheet( dc, aScreen, g_DrawDefaultLineThickness, MILS_TO_IU_SCALAR );
g_DrawBgColor = bg_color;
aScreen->m_IsPrinting = false;

View File

@ -31,6 +31,7 @@
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <wxEeschemaStruct.h>
#include <base_units.h>
#include <general.h>
#include <class_library.h>
@ -70,7 +71,7 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
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
if( IsShown() )

View File

@ -32,6 +32,7 @@
#include <class_drawpanel.h>
#include <gestfich.h>
#include <confirm.h>
#include <base_units.h>
#include <general.h>
#include <protos.h>
@ -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 )
{
GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE );
TraceWorkSheet( aDC, GetScreen(), g_DrawDefaultLineThickness );
TraceWorkSheet( aDC, GetScreen(), g_DrawDefaultLineThickness, MILS_TO_IU_SCALAR );
}

View File

@ -33,6 +33,7 @@
#include <common.h>
#include <class_drawpanel.h>
#include <drawtxt.h>
#include <base_units.h>
#include <gerbview.h>
#include <class_board_design_settings.h>
@ -106,7 +107,7 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if( IsElementVisible( DCODES_VISIBLE ) )
DrawItemsDCodeID( DC, GR_COPY );
TraceWorkSheet( DC, screen, 0 );
TraceWorkSheet( DC, screen, 0, MILS_TO_IU_SCALAR );
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );

View File

@ -37,6 +37,19 @@
#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
* convert \a aValue in internal units to the appropriate user units defined by \a aUnit.

View File

@ -667,7 +667,7 @@ public:
*/
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
@ -682,13 +682,14 @@ public:
* @param aNScr The number of screens (for basic inscriptions).
* @param aScr The screen number (for basic inscriptions).
* @param aLnW The line width for drawing.
* @param aScalar Scalar to convert from mils to internal units.
* @param aClr1 The color for drawing.
* @param aClr2 The colr for inscriptions.
*/
void TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoint& aRB,
wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb,
int aNScr, int aScr, int aLnW, EDA_COLOR_T aClr1 = RED,
EDA_COLOR_T aClr2 = RED );
wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb,
int aNScr, int aScr, int aLnW, double aScalar,
EDA_COLOR_T aClr1 = RED, EDA_COLOR_T aClr2 = RED );
void PlotWorkSheet( PLOTTER* aPlotter, BASE_SCREEN* aScreen );

View File

@ -10,6 +10,7 @@
#include <trigo.h>
#include <class_pcb_screen.h>
#include <eda_text.h> // FILLED
#include <base_units.h>
#include <pcbnew.h>
#include <class_board_design_settings.h>
@ -18,6 +19,19 @@
#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.
* Limited to 19 values to keep a decent size to menus
* 15 it better but does not allow a sufficient number of values
@ -30,42 +44,56 @@
*/
static const double pcbZoomList[] =
{
0.5, 1.0, 1.5, 2.0, 3.0, 4.5, 7.0,
10.0, 15.0, 22.0, 35.0, 50.0, 80.0, 120.0,
200.0, 350.0, 500.0, 1000.0, 2000.0
ZOOM_FACTOR( 0.5 ),
ZOOM_FACTOR( 1.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.
static GRID_TYPE pcbGridList[] =
{
// predefined grid list in 0.0001 inches
{ ID_POPUP_GRID_LEVEL_1000, wxRealPoint( 1000, 1000 ) },
{ ID_POPUP_GRID_LEVEL_500, wxRealPoint( 500, 500 ) },
{ ID_POPUP_GRID_LEVEL_250, wxRealPoint( 250, 250 ) },
{ ID_POPUP_GRID_LEVEL_200, wxRealPoint( 200, 200 ) },
{ ID_POPUP_GRID_LEVEL_100, wxRealPoint( 100, 100 ) },
{ ID_POPUP_GRID_LEVEL_50, wxRealPoint( 50, 50 ) },
{ ID_POPUP_GRID_LEVEL_25, wxRealPoint( 25, 25 ) },
{ ID_POPUP_GRID_LEVEL_20, wxRealPoint( 20, 20 ) },
{ ID_POPUP_GRID_LEVEL_10, wxRealPoint( 10, 10 ) },
{ ID_POPUP_GRID_LEVEL_5, wxRealPoint( 5, 5 ) },
{ ID_POPUP_GRID_LEVEL_2, wxRealPoint( 2, 2 ) },
{ ID_POPUP_GRID_LEVEL_1, wxRealPoint( 1, 1 ) },
{ ID_POPUP_GRID_LEVEL_1000, DMIL_GRID( 1000 ) },
{ ID_POPUP_GRID_LEVEL_500, DMIL_GRID( 500 ) },
{ ID_POPUP_GRID_LEVEL_250, DMIL_GRID( 250 ) },
{ ID_POPUP_GRID_LEVEL_200, DMIL_GRID( 200 ) },
{ ID_POPUP_GRID_LEVEL_100, DMIL_GRID( 100 ) },
{ ID_POPUP_GRID_LEVEL_50, DMIL_GRID( 50 ) },
{ ID_POPUP_GRID_LEVEL_25, DMIL_GRID( 25 ) },
{ ID_POPUP_GRID_LEVEL_20, DMIL_GRID( 20 ) },
{ ID_POPUP_GRID_LEVEL_10, DMIL_GRID( 10 ) },
{ ID_POPUP_GRID_LEVEL_5, DMIL_GRID( 5 ) },
{ ID_POPUP_GRID_LEVEL_2, DMIL_GRID( 2 ) },
{ ID_POPUP_GRID_LEVEL_1, DMIL_GRID( 1 ) },
// 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_2_5MM, wxRealPoint( MM_TO_PCB_UNITS * 2.5, MM_TO_PCB_UNITS * 2.5 ) },
{ ID_POPUP_GRID_LEVEL_1MM, wxRealPoint( MM_TO_PCB_UNITS, MM_TO_PCB_UNITS ) },
{ ID_POPUP_GRID_LEVEL_0_5MM, wxRealPoint( MM_TO_PCB_UNITS * 0.5, MM_TO_PCB_UNITS * 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_2MM, wxRealPoint( MM_TO_PCB_UNITS * 0.2, MM_TO_PCB_UNITS * 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_0_5MM, wxRealPoint( MM_TO_PCB_UNITS * 0.05, MM_TO_PCB_UNITS * 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_1MM, wxRealPoint( MM_TO_PCB_UNITS * 0.01, MM_TO_PCB_UNITS * 0.01 ) }
{ ID_POPUP_GRID_LEVEL_5MM, MM_GRID( 5.0 ) },
{ ID_POPUP_GRID_LEVEL_2_5MM, MM_GRID( 2.5 ) },
{ ID_POPUP_GRID_LEVEL_1MM, MM_GRID( 1.0 ) },
{ ID_POPUP_GRID_LEVEL_0_5MM, MM_GRID( 0.5 ) },
{ ID_POPUP_GRID_LEVEL_0_25MM, MM_GRID( 0.25 ) },
{ ID_POPUP_GRID_LEVEL_0_2MM, MM_GRID( 0.2 ) },
{ ID_POPUP_GRID_LEVEL_0_1MM, MM_GRID( 0.1 ) },
{ ID_POPUP_GRID_LEVEL_0_0_5MM, MM_GRID( 0.05 ) },
{ ID_POPUP_GRID_LEVEL_0_0_25MM, MM_GRID( 0.025 ) },
{ ID_POPUP_GRID_LEVEL_0_0_1MM, MM_GRID( 0.01 ) }
};
@ -79,13 +107,13 @@ PCB_SCREEN::PCB_SCREEN( const wxSize& aPageSizeIU ) :
AddGrid( pcbGridList[i] );
// 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_Route_Layer_TOP = LAYER_N_FRONT; // default layers pair for vias (bottom to top)
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 );
}

View File

@ -265,7 +265,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
g_DrawBgColor = WHITE;
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);
g_DrawBgColor = bg_color;

View File

@ -35,9 +35,9 @@
#include <wxBasePcbFrame.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <base_units.h>
#include <class_board.h>
#include <pcbnew.h>
#include <protos.h>
@ -278,7 +278,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
int bg_color = g_DrawBgColor;
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 )
{

View File

@ -31,6 +31,7 @@
#include <fctsys.h>
#include <class_drawpanel.h>
#include <wxPcbStruct.h>
#include <base_units.h>
#include <class_board.h>
#include <class_module.h>
@ -66,7 +67,7 @@ void FOOTPRINT_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
GRSetDrawMode( DC, GR_COPY );
m_canvas->DrawBackGround( DC );
TraceWorkSheet( DC, screen, 0 );
TraceWorkSheet( DC, screen, 0, MILS_TO_IU_SCALAR );
// Redraw the footprints
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
@ -104,7 +105,7 @@ void PCB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
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);