Repoint IU_PER_MILS

This commit is contained in:
Marek Roszko 2022-09-16 19:25:07 -04:00
parent ee48c8d232
commit e6ed275c25
56 changed files with 122 additions and 122 deletions

View File

@ -28,7 +28,7 @@
DIALOG_EESCHEMA_PAGE_SETTINGS::DIALOG_EESCHEMA_PAGE_SETTINGS( EDA_DRAW_FRAME* aParent,
wxSize aMaxUserSizeMils ) :
DIALOG_PAGES_SETTINGS( aParent, IU_PER_MILS, aMaxUserSizeMils )
DIALOG_PAGES_SETTINGS( aParent, schIUScale.IU_PER_MILS, aMaxUserSizeMils )
{
}

View File

@ -557,7 +557,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetDXF( const wxString& aFileName,
plotter->SetColorMode( getModeColor() );
// Currently, plot units are in decimil
plotter->SetViewport( aPlotOffset, IU_PER_MILS/10, aScale, false );
plotter->SetViewport( aPlotOffset, schIUScale.IU_PER_MILS/10, aScale, false );
// Init :
plotter->SetCreator( wxT( "Eeschema-DXF" ) );
@ -662,8 +662,8 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFiles( bool aPlotAll, bool aPlotFrameRef,
if( getPlotOriginAndUnits() == HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER )
{
plotOffset.x = plotPage.GetWidthIU( IU_PER_MILS ) / 2;
plotOffset.y = -plotPage.GetHeightIU( IU_PER_MILS ) / 2;
plotOffset.x = plotPage.GetWidthIU( schIUScale.IU_PER_MILS ) / 2;
plotOffset.y = -plotPage.GetHeightIU( schIUScale.IU_PER_MILS ) / 2;
}
try
@ -725,7 +725,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetHpgl( const wxString& aFileName,
plotter->SetRenderSettings( aRenderSettings );
plotter->RenderSettings()->LoadColors( getColorSettings() );
plotter->SetColorMode( getModeColor() );
plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );
plotter->SetViewport( aPlot0ffset, schIUScale.IU_PER_MILS/10, aScale, false );
// TODO this could be configurable
plotter->SetTargetChordLength( schIUScale.mmToIU( 0.6 ) );
@ -907,8 +907,8 @@ void DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScr
if( m_plotBackgroundColor->GetValue() && aPlotter->GetColorMode() )
{
aPlotter->SetColor( aPlotter->RenderSettings()->GetBackgroundColor() );
wxPoint end( aPlotter->PageSettings().GetWidthIU( IU_PER_MILS ),
aPlotter->PageSettings().GetHeightIU( IU_PER_MILS ) );
wxPoint end( aPlotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ),
aPlotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) );
aPlotter->Rect( wxPoint( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 );
}
@ -963,7 +963,7 @@ void DIALOG_PLOT_SCHEMATIC::setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aSc
aPlotter->SetPageSettings( plotPage );
// Currently, plot units are in decimil
aPlotter->SetViewport( wxPoint( 0, 0 ), IU_PER_MILS/10, scale, false );
aPlotter->SetViewport( wxPoint( 0, 0 ), schIUScale.IU_PER_MILS/10, scale, false );
}
@ -1083,7 +1083,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
plotter->SetColorMode( getModeColor() );
// Currently, plot units are in decimil
plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );
plotter->SetViewport( aPlot0ffset, schIUScale.IU_PER_MILS/10, aScale, false );
// Init :
plotter->SetCreator( wxT( "Eeschema-PS" ) );
@ -1101,8 +1101,8 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
if( m_plotBackgroundColor->GetValue() && plotter->GetColorMode() )
{
plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
wxPoint end( plotter->PageSettings().GetWidthIU( IU_PER_MILS ),
plotter->PageSettings().GetHeightIU( IU_PER_MILS ) );
wxPoint end( plotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ),
plotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) );
plotter->Rect( wxPoint( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 );
}
@ -1216,7 +1216,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( const wxString& aFileName,
double scale = 1.0;
// Currently, plot units are in decimil
plotter->SetViewport( plot_offset, IU_PER_MILS/10, scale, false );
plotter->SetViewport( plot_offset, schIUScale.IU_PER_MILS/10, scale, false );
// Init :
plotter->SetCreator( wxT( "Eeschema-SVG" ) );
@ -1234,8 +1234,8 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( const wxString& aFileName,
if( m_plotBackgroundColor->GetValue() && plotter->GetColorMode() )
{
plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
wxPoint end( plotter->PageSettings().GetWidthIU( IU_PER_MILS ),
plotter->PageSettings().GetHeightIU( IU_PER_MILS ) );
wxPoint end( plotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ),
plotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) );
plotter->Rect( wxPoint( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 );
}

View File

@ -425,7 +425,7 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
// Change scale factor and offset to print the whole page.
bool printReference = cfg->m_Printing.title_block;
pageSizeIU = aScreen->GetPageSettings().GetSizeIU( IU_PER_MILS );
pageSizeIU = aScreen->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS );
FitThisSizeToPaper( pageSizeIU );
fitRect = GetLogicalPaperRect();
@ -501,7 +501,7 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
if( printReference )
{
m_parent->PrintDrawingSheet( &renderSettings, aScreen, IU_PER_MILS, aScreen->GetFileName(),
m_parent->PrintDrawingSheet( &renderSettings, aScreen, schIUScale.IU_PER_MILS, aScreen->GetFileName(),
wxEmptyString );
}

View File

@ -250,7 +250,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
m_page->SetHeightMils( 5000 );
m_page->SetWidthMils( 6000 );
m_drawingSheet = new DS_PROXY_VIEW_ITEM( (int) IU_PER_MILS, m_page, nullptr, m_titleBlock );
m_drawingSheet = new DS_PROXY_VIEW_ITEM( (int) schIUScale.IU_PER_MILS, m_page, nullptr, m_titleBlock );
m_drawingSheet->SetColorLayer( LAYER_SCHEMATIC_DRAWINGSHEET );
m_drawingSheet->SetPageBorderColorLayer( LAYER_SCHEMATIC_PAGE_LIMITS );
view->Add( m_drawingSheet );
@ -501,7 +501,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::zoomFitPreview()
view->SetScale( 1.0 );
VECTOR2D screenSize = view->ToWorld( m_preview->GetClientSize(), false );
VECTOR2I psize( m_page->GetWidthIU( IU_PER_MILS ), m_page->GetHeightIU( IU_PER_MILS ) );
VECTOR2I psize( m_page->GetWidthIU( schIUScale.IU_PER_MILS ), m_page->GetHeightIU( schIUScale.IU_PER_MILS ) );
double scale = view->GetScale() / std::max( fabs( psize.x / screenSize.x ),
fabs( psize.y / screenSize.y ) );

View File

@ -176,7 +176,7 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
if( aDrawingSheet )
{
wsItems.SetMilsToIUfactor( IU_PER_MILS );
wsItems.SetMilsToIUfactor( schIUScale.IU_PER_MILS );
wsItems.SetPageNumber( "1" );
wsItems.SetSheetCount( 1 );
wsItems.SetFileName( "dummyFilename" );

View File

@ -151,7 +151,7 @@ const PAGE_INFO& SCH_BASE_FRAME::GetPageSettings () const
const wxSize SCH_BASE_FRAME::GetPageSizeIU() const
{
// GetSizeIU is compile time dependent:
return GetScreen()->GetPageSettings().GetSizeIU( IU_PER_MILS );
return GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS );
}

View File

@ -1276,7 +1276,7 @@ void SCH_EDIT_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
aSettings->GetPrintDC()->SetLogicalFunction( wxCOPY );
GetScreen()->Print( aSettings );
PrintDrawingSheet( aSettings, GetScreen(), IU_PER_MILS, fileName );
PrintDrawingSheet( aSettings, GetScreen(), schIUScale.IU_PER_MILS, fileName );
}
@ -1695,8 +1695,8 @@ const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
if( aIncludeAllVisible )
{
// Get the whole page size and return that
int sizeX = GetScreen()->GetPageSettings().GetWidthIU( IU_PER_MILS );
int sizeY = GetScreen()->GetPageSettings().GetHeightIU( IU_PER_MILS );
int sizeX = GetScreen()->GetPageSettings().GetWidthIU( schIUScale.IU_PER_MILS );
int sizeY = GetScreen()->GetPageSettings().GetHeightIU( schIUScale.IU_PER_MILS );
bBoxDoc = BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( sizeX, sizeY ) );
}
else

View File

@ -101,9 +101,9 @@ SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS() :
m_OverrideItemColors( false ),
m_LabelSizeRatio( DEFAULT_LABEL_SIZE_RATIO ),
m_TextOffsetRatio( DEFAULT_TEXT_OFFSET_RATIO ),
m_PinSymbolSize( DEFAULT_TEXT_SIZE * IU_PER_MILS / 2 )
m_PinSymbolSize( DEFAULT_TEXT_SIZE * schIUScale.IU_PER_MILS / 2 )
{
SetDefaultPenWidth( DEFAULT_LINE_WIDTH_MILS * IU_PER_MILS );
SetDefaultPenWidth( DEFAULT_LINE_WIDTH_MILS * schIUScale.IU_PER_MILS );
SetDashLengthRatio( 12 ); // From ISO 128-2
SetGapLengthRatio( 3 ); // From ISO 128-2

View File

@ -2499,7 +2499,7 @@ void SCH_ALTIUM_PLUGIN::ParseSheet( const std::map<wxString, wxString>& aPropert
m_currentSheet->GetScreen()->SetPageSettings( pageInfo );
m_sheetOffset = { 0, pageInfo.GetHeightIU( IU_PER_MILS ) };
m_sheetOffset = { 0, pageInfo.GetHeightIU( schIUScale.IU_PER_MILS ) };
}

View File

@ -232,7 +232,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
// Set the new sheet size.
sheet->GetScreen()->SetPageSettings( pageInfo );
wxSize pageSizeIU = sheet->GetScreen()->GetPageSettings().GetSizeIU( IU_PER_MILS );
wxSize pageSizeIU = sheet->GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS );
VECTOR2I sheetcentre( pageSizeIU.x / 2, pageSizeIU.y / 2 );
VECTOR2I itemsCentre = sheetBoundingBox.Centre();

View File

@ -755,7 +755,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
// Calculate the already placed items bounding box and the page size to determine
// placement for the new symbols
wxSize pageSizeIU = m_rootSheet->GetScreen()->GetPageSettings().GetSizeIU( IU_PER_MILS );
wxSize pageSizeIU = m_rootSheet->GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS );
BOX2I sheetBbox = getSheetBbox( m_rootSheet );
VECTOR2I newCmpPosition( sheetBbox.GetLeft(), sheetBbox.GetBottom() );
int maxY = sheetBbox.GetY();
@ -940,7 +940,7 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
targetSheetSize += VECTOR2I( Mils2iu( 1500 ), Mils2iu( 1500 ) );
// Get current Eeschema sheet size.
wxSize pageSizeIU = m_currentSheet->GetScreen()->GetPageSettings().GetSizeIU( IU_PER_MILS );
wxSize pageSizeIU = m_currentSheet->GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS );
PAGE_INFO pageInfo = m_currentSheet->GetScreen()->GetPageSettings();
// Increase if necessary
@ -953,7 +953,7 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
// Set the new sheet size.
m_currentSheet->GetScreen()->SetPageSettings( pageInfo );
pageSizeIU = m_currentSheet->GetScreen()->GetPageSettings().GetSizeIU( IU_PER_MILS );
pageSizeIU = m_currentSheet->GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS );
VECTOR2I sheetcentre( pageSizeIU.x / 2, pageSizeIU.y / 2 );
VECTOR2I itemsCentre = sheetBoundingBox.Centre();

View File

@ -72,7 +72,7 @@ SCH_SCREEN::SCH_SCREEN( EDA_ITEM* aParent ) :
// Suitable for schematic only. For symbol_editor and viewlib, must be set to true
m_Center = false;
InitDataPoints( m_paper.GetSizeIU( IU_PER_MILS ) );
InitDataPoints( m_paper.GetSizeIU( schIUScale.IU_PER_MILS ) );
}

View File

@ -82,8 +82,8 @@ void SCH_VIEW::SetScale( double aScale, VECTOR2D aAnchor )
void SCH_VIEW::ResizeSheetWorkingArea( const SCH_SCREEN* aScreen )
{
const PAGE_INFO& page_info = aScreen->GetPageSettings();
double max_size_x = page_info.GetWidthIU( IU_PER_MILS ) * 3.0;
double max_size_y = page_info.GetHeightIU( IU_PER_MILS ) * 3.0;
double max_size_x = page_info.GetWidthIU( schIUScale.IU_PER_MILS ) * 3.0;
double max_size_y = page_info.GetHeightIU( schIUScale.IU_PER_MILS ) * 3.0;
m_boundary.SetOrigin( -max_size_x / 4, -max_size_y / 4 );
m_boundary.SetSize( max_size_x, max_size_y );
}
@ -94,7 +94,7 @@ void SCH_VIEW::DisplaySheet( const SCH_SCREEN *aScreen )
for( SCH_ITEM* item : aScreen->Items() )
Add( item );
m_drawingSheet.reset( new DS_PROXY_VIEW_ITEM( static_cast<int>( IU_PER_MILS ),
m_drawingSheet.reset( new DS_PROXY_VIEW_ITEM( static_cast<int>( schIUScale.IU_PER_MILS ),
&aScreen->GetPageSettings(),
&aScreen->Schematic()->Prj(),
&aScreen->GetTitleBlock() ) );

View File

@ -37,13 +37,13 @@ const int schSettingsSchemaVersion = 1;
SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
NESTED_SETTINGS( "schematic", schSettingsSchemaVersion, aParent, aPath ),
m_DefaultLineWidth( DEFAULT_LINE_WIDTH_MILS * IU_PER_MILS ),
m_DefaultTextSize( DEFAULT_TEXT_SIZE * IU_PER_MILS ),
m_DefaultLineWidth( DEFAULT_LINE_WIDTH_MILS * schIUScale.IU_PER_MILS ),
m_DefaultTextSize( DEFAULT_TEXT_SIZE * schIUScale.IU_PER_MILS ),
m_LabelSizeRatio( DEFAULT_LABEL_SIZE_RATIO ),
m_TextOffsetRatio( DEFAULT_TEXT_OFFSET_RATIO ),
m_PinSymbolSize( DEFAULT_TEXT_SIZE * IU_PER_MILS / 2 ),
m_PinSymbolSize( DEFAULT_TEXT_SIZE * schIUScale.IU_PER_MILS / 2 ),
m_JunctionSizeChoice( 3 ),
m_JunctionSize( DEFAULT_JUNCTION_DIAM * IU_PER_MILS ),
m_JunctionSize( DEFAULT_JUNCTION_DIAM * schIUScale.IU_PER_MILS ),
m_AnnotateStartNum( 0 ),
m_IntersheetRefsShow( false ),
m_IntersheetRefsListOwnPage( true ),
@ -103,11 +103,11 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
m_params.emplace_back( new PARAM_SCALED<int>( "drawing.default_line_thickness",
&m_DefaultLineWidth, Mils2iu( defaultLineThickness ), Mils2iu( 5 ), Mils2iu( 1000 ),
1 / IU_PER_MILS ) );
1 / schIUScale.IU_PER_MILS ) );
m_params.emplace_back( new PARAM_SCALED<int>( "drawing.default_text_size",
&m_DefaultTextSize, Mils2iu( defaultTextSize ), Mils2iu( 5 ), Mils2iu( 1000 ),
1 / IU_PER_MILS ) );
1 / schIUScale.IU_PER_MILS ) );
m_params.emplace_back( new PARAM<double>( "drawing.text_offset_ratio",
&m_TextOffsetRatio, DEFAULT_TEXT_OFFSET_RATIO, 0.0, 2.0 ) );
@ -117,7 +117,7 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
m_params.emplace_back( new PARAM_SCALED<int>( "drawing.pin_symbol_size",
&m_PinSymbolSize, Mils2iu( defaultPinSymbolSize ), Mils2iu( 0 ), Mils2iu( 1000 ),
1 / IU_PER_MILS ) );
1 / schIUScale.IU_PER_MILS ) );
// m_JunctionSize is only a run-time cache of the calculated size. Do not save it.

View File

@ -485,7 +485,7 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard()
// the drawings into the dc size
// scale is the ratio resolution (in PPI) / internal units
double ppi = 300; // Use 300 pixels per inch to create bitmap images on start
double inch2Iu = 1000.0 * IU_PER_MILS;
double inch2Iu = 1000.0 * schIUScale.IU_PER_MILS;
double scale = ppi / inch2Iu;
wxSize dcsize = DrawArea.GetSize();

View File

@ -44,7 +44,7 @@ void SYMBOL_EDIT_FRAME::SVGPlotSymbol( const wxString& aFullFileName )
const double scale = 1.0;
// Currently, plot units are in decimil
plotter->SetViewport( plot_offset, IU_PER_MILS/10, scale, false );
plotter->SetViewport( plot_offset, schIUScale.IU_PER_MILS/10, scale, false );
// Init :
plotter->SetCreator( wxT( "Eeschema-SVG" ) );
@ -65,8 +65,8 @@ void SYMBOL_EDIT_FRAME::SVGPlotSymbol( const wxString& aFullFileName )
TRANSFORM temp; // Uses default transform
wxPoint plotPos;
plotPos.x = pageInfo.GetWidthIU( IU_PER_MILS ) / 2;
plotPos.y = pageInfo.GetHeightIU( IU_PER_MILS ) / 2;
plotPos.x = pageInfo.GetWidthIU( schIUScale.IU_PER_MILS ) / 2;
plotPos.y = pageInfo.GetHeightIU( schIUScale.IU_PER_MILS ) / 2;
m_symbol->Plot( plotter, GetUnit(), GetConvert(), background, plotPos, temp, false );
@ -89,7 +89,7 @@ void SYMBOL_EDIT_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
if( !m_symbol )
return;
wxSize pagesize = GetScreen()->GetPageSettings().GetSizeIU( IU_PER_MILS );
wxSize pagesize = GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS );
/* Plot item centered to the page
* In symbol_editor, the symbol is centered at 0,0 coordinates.

View File

@ -146,7 +146,7 @@ SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAM
GetRenderSettings()->LoadColors( GetColorSettings() );
GetCanvas()->GetGAL()->SetAxesColor( m_colorSettings->GetColor( LAYER_SCHEMATIC_GRID_AXES ) );
GetRenderSettings()->SetDefaultPenWidth( DEFAULT_LINE_WIDTH_MILS * IU_PER_MILS );
GetRenderSettings()->SetDefaultPenWidth( DEFAULT_LINE_WIDTH_MILS * schIUScale.IU_PER_MILS );
setupTools();
setupUIConditions();

View File

@ -124,7 +124,7 @@ VECTOR2I EE_GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, int aLayer, SC
VECTOR2I EE_GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, int aLayer,
const EE_SELECTION& aSkip )
{
constexpr int snapRange = SNAP_RANGE * IU_PER_MILS;
constexpr int snapRange = SNAP_RANGE * schIUScale.IU_PER_MILS;
VECTOR2I pt = aOrigin;
VECTOR2I snapDist( snapRange, snapRange );

View File

@ -793,7 +793,7 @@ bool EXCELLON_IMAGE::readToolInformation( char*& aText )
return false;
// conv_scale = scaling factor from inch to Internal Unit
double conv_scale = IU_PER_MILS * 1000;
double conv_scale = gerbIUScale.IU_PER_MILS * 1000;
if( m_GerbMetric )
conv_scale /= 25.4;

View File

@ -122,7 +122,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent )
SetVisibleLayers( LSET::AllLayersMask() ); // All draw layers visible.
SetScreen( new BASE_SCREEN( GetPageSettings().GetSizeIU( IU_PER_MILS ) ) );
SetScreen( new BASE_SCREEN( GetPageSettings().GetSizeIU( gerbIUScale.IU_PER_MILS ) ) );
// Create the PCB_LAYER_WIDGET *after* SetLayout():
m_LayersManager = new GERBER_LAYER_WIDGET( this, GetCanvas() );
@ -829,12 +829,12 @@ void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
m_paper = aPageSettings;
if( GetScreen() )
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU( IU_PER_MILS ) );
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU( gerbIUScale.IU_PER_MILS ) );
GERBVIEW_DRAW_PANEL_GAL* drawPanel = static_cast<GERBVIEW_DRAW_PANEL_GAL*>( GetCanvas() );
// Prepare drawing-sheet template
DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( IU_PER_MILS, &GetPageSettings(),
DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( gerbIUScale.IU_PER_MILS, &GetPageSettings(),
&Prj(), &GetTitleBlock() );
if( GetScreen() )
@ -862,7 +862,7 @@ const wxSize GERBVIEW_FRAME::GetPageSizeIU() const
// this function is only needed because EDA_DRAW_FRAME is not compiled
// with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
// into an application specific source file.
return GetPageSettings().GetSizeIU( IU_PER_MILS );
return GetPageSettings().GetSizeIU( gerbIUScale.IU_PER_MILS );
}

View File

@ -75,7 +75,7 @@ bool GERBVIEW_PRINTOUT::OnPrintPage( int aPage )
int GERBVIEW_PRINTOUT::milsToIU( double aMils ) const
{
return KiROUND( IU_PER_MILS * aMils );
return KiROUND( gerbIUScale.IU_PER_MILS * aMils );
}

View File

@ -208,7 +208,7 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff,
bool y_fmt_known = false;
// conv_scale = scaling factor from inch to Internal Unit
double conv_scale = IU_PER_MILS * 1000;
double conv_scale = gerbIUScale.IU_PER_MILS * 1000;
if( m_GerbMetric )
conv_scale /= 25.4;
@ -380,7 +380,7 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff,
else if( code == MILLIMETER )
m_GerbMetric = true;
conv_scale = m_GerbMetric ? IU_PER_MILS / 25.4 : IU_PER_MILS;
conv_scale = m_GerbMetric ? gerbIUScale.IU_PER_MILS / 25.4 : gerbIUScale.IU_PER_MILS;
break;
case FILE_ATTRIBUTE: // Command %TF ...

View File

@ -323,12 +323,12 @@ void GERBVIEW_FRAME::updateDCodeSelectBox()
break;
case EDA_UNITS::INCHES:
scale = IU_PER_MILS * 1000;
scale = gerbIUScale.IU_PER_MILS * 1000;
units = wxT( "in" );
break;
case EDA_UNITS::MILS:
scale = IU_PER_MILS;
scale = gerbIUScale.IU_PER_MILS;
units = wxT( "mil" );
break;

View File

@ -84,12 +84,12 @@ int GERBVIEW_INSPECTION_TOOL::ShowDCodes( const TOOL_EVENT& aEvent )
break;
case EDA_UNITS::INCHES:
scale = IU_PER_MILS * 1000;
scale = gerbIUScale.IU_PER_MILS * 1000;
units = wxT( "in" );
break;
case EDA_UNITS::MILS:
scale = IU_PER_MILS;
scale = gerbIUScale.IU_PER_MILS;
units = wxT( "mil" );
break;

View File

@ -169,7 +169,7 @@ void PLEDITOR_PRINTOUT::PrintPage( int aPageNum )
// Change scale factor and offset to print the whole page.
pageSizeIU = m_parent->GetPageSettings().GetSizeIU( IU_PER_MILS );
pageSizeIU = m_parent->GetPageSettings().GetSizeIU( drawSheetIUScale.IU_PER_MILS );
FitThisSizeToPaper( pageSizeIU );
fitRect = GetLogicalPaperRect();
@ -199,11 +199,11 @@ void PLEDITOR_PRINTOUT::PrintPage( int aPageNum )
if( dataItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
{
BITMAP_BASE* bitmap = static_cast<DS_DATA_ITEM_BITMAP*>( dataItem )->m_ImageBitmap;
bitmap->SetPixelSizeIu( IU_PER_MILS * 1000 / bitmap->GetPPI() );
bitmap->SetPixelSizeIu( drawSheetIUScale.IU_PER_MILS * 1000 / bitmap->GetPPI() );
}
}
m_parent->PrintDrawingSheet( &renderSettings, screen, IU_PER_MILS, wxEmptyString );
m_parent->PrintDrawingSheet( &renderSettings, screen, drawSheetIUScale.IU_PER_MILS, wxEmptyString );
m_parent->SetDrawBgColor( bg_color );

View File

@ -93,7 +93,7 @@ void PL_DRAW_PANEL_GAL::DisplayDrawingSheet()
m_pageDrawItem.reset();
model.SetupDrawEnvironment( m_edaFrame->GetPageSettings(), IU_PER_MILS );
model.SetupDrawEnvironment( m_edaFrame->GetPageSettings(), drawSheetIUScale.IU_PER_MILS );
// To show the formatted texts instead of raw texts in drawing sheet editor, we need
// a dummy DS_DRAW_ITEM_LIST.
@ -101,7 +101,7 @@ void PL_DRAW_PANEL_GAL::DisplayDrawingSheet()
dummy.SetPaperFormat( &m_edaFrame->GetPageSettings().GetType() );
dummy.SetTitleBlock( &m_edaFrame->GetTitleBlock() );
dummy.SetProject( &m_edaFrame->Prj() );
dummy.SetMilsToIUfactor( IU_PER_MILS );
dummy.SetMilsToIUfactor( drawSheetIUScale.IU_PER_MILS );
for( DS_DATA_ITEM* dataItem : model.GetItems() )
dataItem->SyncDrawItems( &dummy, m_view );

View File

@ -121,7 +121,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_acceptedExts.emplace( DrawingSheetFileExtension, nullptr );
DragAcceptFiles( true );
wxSize pageSizeIU = GetPageLayout().GetPageSettings().GetSizeIU( IU_PER_MILS );
wxSize pageSizeIU = GetPageLayout().GetPageSettings().GetSizeIU( drawSheetIUScale.IU_PER_MILS );
SetScreen( new BASE_SCREEN( pageSizeIU ) );
setupTools();
@ -474,7 +474,7 @@ void PL_EDITOR_FRAME::ToPrinter( bool doPreview )
const BOX2I PL_EDITOR_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
{
BOX2I rv( VECTOR2I( 0, 0 ), GetPageLayout().GetPageSettings().GetSizeIU( IU_PER_MILS ) );
BOX2I rv( VECTOR2I( 0, 0 ), GetPageLayout().GetPageSettings().GetSizeIU( drawSheetIUScale.IU_PER_MILS ) );
return rv;
}
@ -570,7 +570,7 @@ void PL_EDITOR_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
m_pageLayout.SetPageSettings( aPageSettings );
if( GetScreen() )
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU( IU_PER_MILS ) );
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU( drawSheetIUScale.IU_PER_MILS ) );
}
@ -585,7 +585,7 @@ const wxSize PL_EDITOR_FRAME::GetPageSizeIU() const
// this function is only needed because EDA_DRAW_FRAME is not compiled
// with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
// into an application specific source file.
return m_pageLayout.GetPageSettings().GetSizeIU( IU_PER_MILS );
return m_pageLayout.GetPageSettings().GetSizeIU( drawSheetIUScale.IU_PER_MILS );
}
@ -773,11 +773,11 @@ void PL_EDITOR_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
if( dataItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
{
BITMAP_BASE* bitmap = static_cast<DS_DATA_ITEM_BITMAP*>( dataItem )->m_ImageBitmap;
bitmap->SetPixelSizeIu( IU_PER_MILS * 1000 / bitmap->GetPPI() );
bitmap->SetPixelSizeIu( drawSheetIUScale.IU_PER_MILS * 1000 / bitmap->GetPPI() );
}
}
PrintDrawingSheet( aSettings, GetScreen(), IU_PER_MILS, wxEmptyString );
PrintDrawingSheet( aSettings, GetScreen(), drawSheetIUScale.IU_PER_MILS, wxEmptyString );
GetCanvas()->DisplayDrawingSheet();
GetCanvas()->Refresh();
@ -864,7 +864,7 @@ DS_DATA_ITEM* PL_EDITOR_FRAME::AddDrawingSheetItem( int aType )
}
// Set the scale factor for pl_editor (it is set for Eeschema by default)
image->SetPixelSizeIu( IU_PER_MILS * 1000.0 / image->GetPPI() );
image->SetPixelSizeIu( drawSheetIUScale.IU_PER_MILS * 1000.0 / image->GetPPI() );
item = new DS_DATA_ITEM_BITMAP( image );
}
break;
@ -938,7 +938,7 @@ bool PL_EDITOR_FRAME::GetPageNumberOption() const
#if 1
void PL_EDITOR_FRAME::UpdateMsgPanelInfo()
{
VECTOR2D size = GetPageSettings().GetSizeIU( IU_PER_MILS );
VECTOR2D size = GetPageSettings().GetSizeIU( drawSheetIUScale.IU_PER_MILS );
std::vector<MSG_PANEL_ITEM> msgItems;
msgItems.emplace_back( _( "Page Width" ), EDA_UNIT_UTILS::UI::MessageTextFromValue(

View File

@ -89,7 +89,7 @@ int PL_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent )
{
m_frame->SaveCopyInUndoList();
DIALOG_PAGES_SETTINGS dlg( m_frame, IU_PER_MILS,
DIALOG_PAGES_SETTINGS dlg( m_frame, drawSheetIUScale.IU_PER_MILS,
wxSize( MAX_PAGE_SIZE_EESCHEMA_MILS,
MAX_PAGE_SIZE_EESCHEMA_MILS ) );
dlg.SetWksFileName( m_frame->GetCurrentFileName() );

View File

@ -340,8 +340,8 @@ bool DIALOG_EXPORT_SVG::CreateSVGFile( const wxString& aFullFileName )
BOX2I bbox = m_board->ComputeBoundingBox();
PAGE_INFO currpageInfo = m_board->GetPageSettings();
currpageInfo.SetWidthMils( bbox.GetWidth() / IU_PER_MILS );
currpageInfo.SetHeightMils( bbox.GetHeight() / IU_PER_MILS );
currpageInfo.SetWidthMils( bbox.GetWidth() / pcbIUScale.IU_PER_MILS );
currpageInfo.SetHeightMils( bbox.GetHeight() / pcbIUScale.IU_PER_MILS );
m_board->SetPageSettings( currpageInfo );
plot_opts.SetUseAuxOrigin( true );
VECTOR2I origin = bbox.GetOrigin();

View File

@ -74,7 +74,7 @@ int InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSetting
return dlg.ShowQuasiModal();
}
#define MIN_THICKNESS 10*IU_PER_MILS
#define MIN_THICKNESS 10*pcbIUScale.IU_PER_MILS
DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent,
ZONE_SETTINGS* aSettings,

View File

@ -228,7 +228,7 @@ void DIALOG_PLOT::init_Dialog()
}
// Set units and value for HPGL pen size (this param is in mils).
m_defaultPenSize.SetValue( m_plotOpts.GetHPGLPenDiameter() * IU_PER_MILS );
m_defaultPenSize.SetValue( m_plotOpts.GetHPGLPenDiameter() * pcbIUScale.IU_PER_MILS );
// Test for a reasonable scale value. Set to 1 if problem
if( m_XScaleAdjust < PLOT_MIN_SCALE || m_YScaleAdjust < PLOT_MIN_SCALE
@ -784,9 +784,9 @@ void DIALOG_PLOT::applyPlotSettings()
// is in use
if( getPlotFormat() == PLOT_FORMAT::HPGL )
{
if( !tempOptions.SetHPGLPenDiameter( m_defaultPenSize.GetValue() / IU_PER_MILS ) )
if( !tempOptions.SetHPGLPenDiameter( m_defaultPenSize.GetValue() / pcbIUScale.IU_PER_MILS ) )
{
m_defaultPenSize.SetValue( tempOptions.GetHPGLPenDiameter() * IU_PER_MILS );
m_defaultPenSize.SetValue( tempOptions.GetHPGLPenDiameter() * pcbIUScale.IU_PER_MILS );
msg.Printf( _( "HPGL pen size constrained." ) );
reporter.Report( msg, RPT_SEVERITY_INFO );
}

View File

@ -502,7 +502,7 @@ void PANEL_PCBNEW_COLOR_SETTINGS::createPreviewItems()
m_preview->UpdateColors();
m_preview->DisplayBoard( m_preview->GetBoard() );
DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( (int) IU_PER_MILS, m_page, nullptr,
DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( (int) pcbIUScale.IU_PER_MILS, m_page, nullptr,
m_titleBlock );
drawingSheet->SetIsFirstPage( true );
drawingSheet->SetColorLayer( LAYER_DRAWINGSHEET );

View File

@ -302,7 +302,7 @@ void DRC_TEST_PROVIDER_MISC::testTextVars()
if( !drawingSheet || m_drcEngine->IsErrorLimitExceeded( DRCE_UNRESOLVED_VARIABLE ) )
return;
drawItems.SetMilsToIUfactor( IU_PER_MILS );
drawItems.SetMilsToIUfactor( pcbIUScale.IU_PER_MILS );
drawItems.SetPageNumber( wxT( "1" ) );
drawItems.SetSheetCount( 1 );
drawItems.SetFileName( wxT( "dummyFilename" ) );

View File

@ -86,7 +86,7 @@ static int compute_pad_access_code( BOARD *aPcb, LSET aLayerMask )
/* Convert and clamp a size from IU to decimils */
static int iu_to_d356(int iu, int clamp)
{
int val = KiROUND( iu / ( IU_PER_MILS / 10 ) );
int val = KiROUND( iu / ( pcbIUScale.IU_PER_MILS / 10 ) );
if( val > clamp ) return clamp;
if( val < -clamp ) return -clamp;
return val;

View File

@ -47,7 +47,7 @@ public:
// Defined values to write coordinates using inches or mm:
static const double conv_unit_inch = 0.001 / IU_PER_MILS ; // units = INCHES
static const double conv_unit_inch = 0.001 / pcbIUScale.IU_PER_MILS ; // units = INCHES
static const char unit_text_inch[] = "## Unit = inches, Angle = deg.\n";
static const double conv_unit_mm = 1.0 / IU_PER_MM; // units = mm

View File

@ -212,7 +212,7 @@ static const wxString getShapeName( FOOTPRINT* aFootprint )
// GerbTool chokes on units different than INCH so this is the conversion factor
const static double SCALE_FACTOR = 1000.0 * IU_PER_MILS;
const static double SCALE_FACTOR = 1000.0 * pcbIUScale.IU_PER_MILS;
/* Two helper functions to calculate coordinates of footprints in gencad values

View File

@ -1052,7 +1052,7 @@ void EXPORTER_PCB_VRML::ExportVrmlFootprint( FOOTPRINT* aFootprint, std::ostream
compose_quat( q1, q2, q1 );
from_quat( q1, rot );
double offsetFactor = 1000.0f * IU_PER_MILS / 25.4f;
double offsetFactor = 1000.0f * pcbIUScale.IU_PER_MILS / 25.4f;
// adjust 3D shape local offset position
// they are given in mm, so they are converted in board IU.

View File

@ -44,7 +44,7 @@
/* Conversion utilities - these will be used often in there... */
inline double diameter_in_inches( double ius )
{
return ius * 0.001 / IU_PER_MILS;
return ius * 0.001 / pcbIUScale.IU_PER_MILS;
}
@ -98,7 +98,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
{
case PLOT_FORMAT::GERBER:
plotter = new GERBER_PLOTTER();
plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false );
plotter->SetViewport( offset, pcbIUScale.IU_PER_MILS / 10, scale, false );
plotter->SetGerberCoordinatesFormat( 5 ); // format x.5 unit = mm
break;
@ -111,7 +111,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
case PLOT_FORMAT::SVG:
{
PAGE_INFO pageA4( wxT( "A4" ) );
wxSize pageSizeIU = pageA4.GetSizeIU( IU_PER_MILS );
wxSize pageSizeIU = pageA4.GetSizeIU( pcbIUScale.IU_PER_MILS );
// Reserve a 10 mm margin around the page.
int margin = pcbIUScale.mmToIU( 10 );
@ -147,7 +147,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
plotter = new PS_PLOTTER;
plotter->SetPageSettings( pageA4 );
plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false );
plotter->SetViewport( offset, pcbIUScale.IU_PER_MILS / 10, scale, false );
break;
}
@ -162,7 +162,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
plotter = dxf_plotter;
plotter->SetPageSettings( page_info );
plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false );
plotter->SetViewport( offset, pcbIUScale.IU_PER_MILS / 10, scale, false );
break;
}
}

View File

@ -361,7 +361,7 @@ void EXCELLON_WRITER::SetFormat( bool aMetric, ZEROS_FMT aZerosFmt, int aLeftDig
if( m_unitsMetric )
m_conversionUnits = 1.0 / IU_PER_MM; // EXCELLON units = mm
else
m_conversionUnits = 0.001 / IU_PER_MILS; // EXCELLON units = INCHES
m_conversionUnits = 0.001 / pcbIUScale.IU_PER_MILS; // EXCELLON units = INCHES
// Set the zero counts. if aZerosFmt == DECIMAL_FORMAT, these values
// will be set, but not used.

View File

@ -147,7 +147,7 @@ int GERBER_WRITER::createDrillFile( wxString& aFullFilename, bool aIsNpth,
// Add the standard X2 header, without FileFunction
AddGerberX2Header( &plotter, m_pcb );
plotter.SetViewport( m_offset, IU_PER_MILS/10, /* scale */ 1.0, /* mirror */false );
plotter.SetViewport( m_offset, pcbIUScale.IU_PER_MILS/10, /* scale */ 1.0, /* mirror */false );
// has meaning only for gerber plotter. Must be called only after SetViewport
plotter.SetGerberCoordinatesFormat( 6 );

View File

@ -85,7 +85,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
// Add the standard X2 header, without FileFunction
AddGerberX2Header( &plotter, m_pcb );
plotter.SetViewport( m_offset, IU_PER_MILS/10, /* scale */ 1.0, /* mirror */false );
plotter.SetViewport( m_offset, pcbIUScale.IU_PER_MILS/10, /* scale */ 1.0, /* mirror */false );
// has meaning only for gerber plotter. Must be called only after SetViewport
plotter.SetGerberCoordinatesFormat( 6 );

View File

@ -160,7 +160,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// In Footprint Editor, set the default paper size to A4 for plot/print
SetPageSettings( PAGE_INFO( PAGE_INFO::A4 ) );
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU( IU_PER_MILS ) ) );
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU( pcbIUScale.IU_PER_MILS ) ) );
// Create the manager and dispatcher & route draw panel events to the dispatcher
setupTools();

View File

@ -242,7 +242,7 @@ void MWAVE_POLYGONAL_SHAPE_DLG::ReadDataShapeDescr( wxCommandEvent& event )
if( strncasecmp( param1, "Unit", 4 ) == 0 )
{
if( strncasecmp( param2, "inch", 4 ) == 0 )
unitconv = IU_PER_MILS*1000;
unitconv = pcbIUScale.IU_PER_MILS*1000;
if( strncasecmp( param2, "mm", 2 ) == 0 )
unitconv = IU_PER_MM;

View File

@ -120,7 +120,7 @@ VECTOR2I BOARD_NETLIST_UPDATER::estimateFootprintInsertionPosition()
else
{
// Position new components in the center of the page when the board is empty.
wxSize pageSize = m_board->GetPageSettings().GetSizeIU( IU_PER_MILS );
wxSize pageSize = m_board->GetPageSettings().GetSizeIU( pcbIUScale.IU_PER_MILS );
bestPosition.x = pageSize.GetWidth() / 2;
bestPosition.y = pageSize.GetHeight() / 2;

View File

@ -528,7 +528,7 @@ void PCB_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
m_pcb->SetPageSettings( aPageSettings );
if( GetScreen() )
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU( IU_PER_MILS ) );
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU( pcbIUScale.IU_PER_MILS ) );
}
@ -543,7 +543,7 @@ const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
// this function is only needed because EDA_DRAW_FRAME is not compiled
// with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
// into an application specific source file.
return m_pcb->GetPageSettings().GetSizeIU( IU_PER_MILS );
return m_pcb->GetPageSettings().GetSizeIU( pcbIUScale.IU_PER_MILS );
}

View File

@ -233,7 +233,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// initialize parameters in m_LayersManager
LoadSettings( config() );
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU( IU_PER_MILS ) ) );
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU( pcbIUScale.IU_PER_MILS ) ) );
// PCB drawings start in the upper left corner.
GetScreen()->m_Center = false;
@ -529,7 +529,7 @@ void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
PCB_BASE_FRAME::SetPageSettings( aPageSettings );
// Prepare drawing-sheet template
DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( IU_PER_MILS,
DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( pcbIUScale.IU_PER_MILS,
&m_pcb->GetPageSettings(),
m_pcb->GetProject(),
&m_pcb->GetTitleBlock() );

View File

@ -126,7 +126,7 @@ bool PCBNEW_PRINTOUT::OnPrintPage( int aPage )
int PCBNEW_PRINTOUT::milsToIU( double aMils ) const
{
return KiROUND( IU_PER_MILS * aMils );
return KiROUND( pcbIUScale.IU_PER_MILS * aMils );
}

View File

@ -1007,7 +1007,7 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
const PAGE_INFO* sheet_info;
double paperscale; // Page-to-paper ratio
wxSize paperSizeIU;
wxSize pageSizeIU( pageInfo.GetSizeIU( IU_PER_MILS ) );
wxSize pageSizeIU( pageInfo.GetSizeIU( pcbIUScale.IU_PER_MILS ) );
bool autocenter = false;
// Special options: to fit the sheet to an A4 sheet replace the paper size. However there
@ -1018,7 +1018,7 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
if( aPlotOpts->GetA4Output() )
{
sheet_info = &pageA4;
paperSizeIU = pageA4.GetSizeIU( IU_PER_MILS );
paperSizeIU = pageA4.GetSizeIU( pcbIUScale.IU_PER_MILS );
paperscale = (double) paperSizeIU.x / pageSizeIU.x;
autocenter = true;
}
@ -1069,7 +1069,7 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
aPlotter->SetPageSettings( *sheet_info );
aPlotter->SetViewport( offset, IU_PER_MILS/10, compound_scale, aPlotOpts->GetMirror() );
aPlotter->SetViewport( offset, pcbIUScale.IU_PER_MILS/10, compound_scale, aPlotOpts->GetMirror() );
// Has meaning only for gerber plotter. Must be called only after SetViewport
aPlotter->SetGerberCoordinatesFormat( aPlotOpts->GetGerberPrecision() );
@ -1106,7 +1106,7 @@ static void ConfigureHPGLPenSizes( HPGL_PLOTTER *aPlotter, const PCB_PLOT_PARAMS
{
// Compute penDiam (the value is given in mils) in pcb units, with plot scale (if Scale is 2,
// penDiam value is always m_HPGLPenDiam so apparent penDiam is actually penDiam / Scale
int penDiam = KiROUND( aPlotOpts->GetHPGLPenDiameter() * IU_PER_MILS / aPlotOpts->GetScale() );
int penDiam = KiROUND( aPlotOpts->GetHPGLPenDiameter() * pcbIUScale.IU_PER_MILS / aPlotOpts->GetScale() );
// Set HPGL-specific options and start
aPlotter->SetPenSpeed( aPlotOpts->GetHPGLPenSpeed() );

View File

@ -638,8 +638,8 @@ void ALTIUM_PCB::Parse( const ALTIUM_COMPOUND_FILE& altiumPcbFi
// center board
BOX2I bbbox = m_board->GetBoardEdgesBoundingBox();
int w = m_board->GetPageSettings().GetWidthIU( IU_PER_MILS );
int h = m_board->GetPageSettings().GetHeightIU( IU_PER_MILS );
int w = m_board->GetPageSettings().GetWidthIU( pcbIUScale.IU_PER_MILS );
int h = m_board->GetPageSettings().GetHeightIU( pcbIUScale.IU_PER_MILS );
int desired_x = ( w - bbbox.GetWidth() ) / 2;
int desired_y = ( h - bbbox.GetHeight() ) / 2;

View File

@ -1593,7 +1593,7 @@ ZONE* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode )
}
else if( p.pour == EPOLYGON::HATCH )
{
int spacing = p.spacing ? p.spacing->ToPcbUnits() : 50 * IU_PER_MILS;
int spacing = p.spacing ? p.spacing->ToPcbUnits() : 50 * pcbIUScale.IU_PER_MILS;
zone->SetFillMode( ZONE_FILL_MODE::HATCH_PATTERN );
zone->SetHatchThickness( p.width.ToPcbUnits() );
@ -1603,7 +1603,7 @@ ZONE* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode )
// We divide the thickness by half because we are tracing _inside_ the zone outline
// This means the radius of curvature will be twice the size for an equivalent EAGLE zone
zone->SetMinThickness( std::max<int>( ZONE_THICKNESS_MIN_VALUE_MIL * IU_PER_MILS,
zone->SetMinThickness( std::max<int>( ZONE_THICKNESS_MIN_VALUE_MIL * pcbIUScale.IU_PER_MILS,
p.width.ToPcbUnits() / 2 ) );
if( p.isolate )

View File

@ -277,19 +277,19 @@ double FABMASTER::processScaleFactor( size_t aRow )
std::transform(units.begin(), units.end(),units.begin(), ::toupper);
if( units == "MILS" )
retval = IU_PER_MILS;
retval = pcbIUScale.IU_PER_MILS;
else if( units == "MILLIMETERS" )
retval = IU_PER_MM;
else if( units == "MICRONS" )
retval = IU_PER_MM * 10.0;
else if( units == "INCHES" )
retval = IU_PER_MILS * 1000.0;
retval = pcbIUScale.IU_PER_MILS * 1000.0;
}
if( retval < 1.0 )
{
wxLogError( _( "Could not find units value, defaulting to mils." ) );
retval = IU_PER_MILS;
retval = pcbIUScale.IU_PER_MILS;
}
return retval;

View File

@ -309,11 +309,11 @@ long long GPCB_FPL_CACHE::GetTimestamp( const wxString& aLibPath )
FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
{
#define TEXT_DEFAULT_SIZE ( 40*IU_PER_MILS )
#define OLD_GPCB_UNIT_CONV IU_PER_MILS
#define TEXT_DEFAULT_SIZE ( 40*pcbIUScale.IU_PER_MILS )
#define OLD_GPCB_UNIT_CONV pcbIUScale.IU_PER_MILS
// Old version unit = 1 mil, so conv_unit is 10 or 0.1
#define NEW_GPCB_UNIT_CONV ( 0.01*IU_PER_MILS )
#define NEW_GPCB_UNIT_CONV ( 0.01*pcbIUScale.IU_PER_MILS )
int paramCnt;
@ -398,7 +398,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
// Calculate size: default height is 40 mils, width 30 mil.
// real size is: default * ibuf[idx+3] / 100 (size in gpcb is given in percent of default size
int thsize = parseInt( parameters[paramCnt-3], TEXT_DEFAULT_SIZE ) / 100;
thsize = std::max( (int)( 5 * IU_PER_MILS ), thsize ); // Ensure a minimal size = 5 mils
thsize = std::max( (int)( 5 * pcbIUScale.IU_PER_MILS ), thsize ); // Ensure a minimal size = 5 mils
int twsize = thsize * 30 / 40;
int thickness = thsize / 8;

View File

@ -2885,7 +2885,7 @@ void LEGACY_PLUGIN::init( const PROPERTIES* aProperties )
// mm to nanometers. The deci-mil legacy files have no such "Units" marker
// so we must assume the file is in deci-mils until told otherwise.
diskToBiu = IU_PER_MILS / 10; // BIUs are nanometers
diskToBiu = pcbIUScale.IU_PER_MILS / 10; // BIUs are nanometers
}

View File

@ -161,7 +161,7 @@ double StrToDoublePrecisionUnits( const wxString& aStr, char aAxe,
else
{
ls.ToCDouble( &i );
i *= IU_PER_MILS;
i *= pcbIUScale.IU_PER_MILS;
}
}
else

View File

@ -49,7 +49,7 @@
def ToMils(iu):
if type(iu) in [int,float]:
return float(iu) / float(IU_PER_MILS)
return float(iu) / float(pcbIUScale.IU_PER_MILS)
elif type(iu) in [wxPoint,wxSize,VECTOR2I]:
return tuple(map(ToMils,iu))
else:
@ -57,7 +57,7 @@
def FromMils(mils):
if type(mils) in [int,float]:
return int(float(mils)*float(IU_PER_MILS))
return int(float(mils)*float(pcbIUScale.IU_PER_MILS))
elif type(mils) in [wxPoint,wxSize,VECTOR2I]:
return tuple(map(FromMils,mils))
else:

View File

@ -294,7 +294,7 @@ int BOARD_EDITOR_CONTROL::PageSettings( const TOOL_EVENT& aEvent )
undoCmd.PushItem( wrapper );
m_frame->SaveCopyInUndoList( undoCmd, UNDO_REDO::PAGESETTINGS );
DIALOG_PAGES_SETTINGS dlg( m_frame, IU_PER_MILS, wxSize( MAX_PAGE_SIZE_PCBNEW_MILS,
DIALOG_PAGES_SETTINGS dlg( m_frame, pcbIUScale.IU_PER_MILS, wxSize( MAX_PAGE_SIZE_PCBNEW_MILS,
MAX_PAGE_SIZE_PCBNEW_MILS ) );
dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName );