From 7a5829f8d6e0637112265873c0f8bb6f2f171bd0 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Fri, 16 Sep 2022 19:53:06 -0400 Subject: [PATCH] Move IU2Mils --- common/pg_properties.cpp | 4 +- .../panel_eeschema_editing_options.cpp | 4 +- .../dialogs/panel_sym_editing_options.cpp | 10 +-- .../cadstar/cadstar_sch_archive_loader.cpp | 4 +- .../sch_plugins/eagle/sch_eagle_plugin.cpp | 4 +- .../legacy/sch_legacy_lib_plugin_cache.cpp | 66 ++++++++--------- .../sch_plugins/legacy/sch_legacy_plugin.cpp | 74 +++++++++---------- gerbview/gerber_file_image.cpp | 8 +- include/convert_to_biu.h | 16 ---- pcbnew/dialogs/dialog_copper_zones.cpp | 8 +- pcbnew/python/plugins/sdip_wizard.py | 2 +- 11 files changed, 92 insertions(+), 108 deletions(-) diff --git a/common/pg_properties.cpp b/common/pg_properties.cpp index ccd4909487..b1845b5bb4 100644 --- a/common/pg_properties.cpp +++ b/common/pg_properties.cpp @@ -214,10 +214,10 @@ wxString PGPROPERTY_DISTANCE::DistanceToString( wxVariant& aVariant, int aArgFla switch( PROPERTY_MANAGER::Instance().GetUnits() ) { case EDA_UNITS::INCHES: - return wxString::Format( wxT( "%g in" ), Iu2Mils( aVariant.GetLong() ) / 1000.0 ); + return wxString::Format( wxT( "%g in" ), pcbIUScale.IUToMils( aVariant.GetLong() ) / 1000.0 ); case EDA_UNITS::MILS: - return wxString::Format( wxT( "%g mils" ), Iu2Mils( aVariant.GetLong() ) ); + return wxString::Format( wxT( "%g mils" ), pcbIUScale.IUToMils( aVariant.GetLong() ) ); case EDA_UNITS::MILLIMETRES: return wxString::Format( wxT( "%g mm" ), pcbIUScale.IUTomm( aVariant.GetLong() ) ); diff --git a/eeschema/dialogs/panel_eeschema_editing_options.cpp b/eeschema/dialogs/panel_eeschema_editing_options.cpp index c577394975..20b7a18315 100644 --- a/eeschema/dialogs/panel_eeschema_editing_options.cpp +++ b/eeschema/dialogs/panel_eeschema_editing_options.cpp @@ -102,8 +102,8 @@ bool PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataFromWindow() cfg->m_Drawing.default_sheet_border_color = m_borderColorSwatch->GetSwatchColor(); cfg->m_Drawing.default_sheet_background_color = m_backgroundColorSwatch->GetSwatchColor(); - cfg->m_Drawing.default_repeat_offset_x = Iu2Mils( (int) m_hPitch.GetValue() ); - cfg->m_Drawing.default_repeat_offset_y = Iu2Mils( (int) m_vPitch.GetValue() ); + cfg->m_Drawing.default_repeat_offset_x = schIUScale.IUToMils( (int) m_hPitch.GetValue() ); + cfg->m_Drawing.default_repeat_offset_y = schIUScale.IUToMils( (int) m_vPitch.GetValue() ); cfg->m_Drawing.repeat_label_increment = m_spinLabelRepeatStep->GetValue(); cfg->m_Drawing.line_mode = m_choiceLineMode->GetSelection(); diff --git a/eeschema/dialogs/panel_sym_editing_options.cpp b/eeschema/dialogs/panel_sym_editing_options.cpp index dcdd96596f..5dc281b9c5 100644 --- a/eeschema/dialogs/panel_sym_editing_options.cpp +++ b/eeschema/dialogs/panel_sym_editing_options.cpp @@ -71,11 +71,11 @@ bool PANEL_SYM_EDITING_OPTIONS::TransferDataFromWindow() SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); SYMBOL_EDITOR_SETTINGS* settings = mgr.GetAppSettings(); - settings->m_Defaults.line_width = Iu2Mils( (int) m_lineWidth.GetValue() ); - settings->m_Defaults.text_size = Iu2Mils( (int) m_textSize.GetValue() ); - settings->m_Defaults.pin_length = Iu2Mils( (int) m_pinLength.GetValue() ); - settings->m_Defaults.pin_num_size = Iu2Mils( (int) m_pinNumberSize.GetValue() ); - settings->m_Defaults.pin_name_size = Iu2Mils( (int) m_pinNameSize.GetValue() ); + settings->m_Defaults.line_width = schIUScale.IUToMils( (int) m_lineWidth.GetValue() ); + settings->m_Defaults.text_size = schIUScale.IUToMils( (int) m_textSize.GetValue() ); + settings->m_Defaults.pin_length = schIUScale.IUToMils( (int) m_pinLength.GetValue() ); + settings->m_Defaults.pin_num_size = schIUScale.IUToMils( (int) m_pinNumberSize.GetValue() ); + settings->m_Defaults.pin_name_size = schIUScale.IUToMils( (int) m_pinNameSize.GetValue() ); settings->m_Repeat.label_delta = m_spinRepeatLabel->GetValue(); settings->m_Repeat.pin_step = m_choicePinDisplacement->GetSelection() == 1 ? 50 : 100; settings->m_ShowPinElectricalType = m_cbShowPinElectricalType->GetValue(); diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp index ce1903ae13..7950ec1e2c 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp @@ -226,8 +226,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh // Update page size always PAGE_INFO pageInfo = sheet->GetScreen()->GetPageSettings(); - pageInfo.SetWidthMils( Iu2Mils( targetSheetSize.x ) ); - pageInfo.SetHeightMils( Iu2Mils( targetSheetSize.y ) ); + pageInfo.SetWidthMils( schIUScale.IUToMils( targetSheetSize.x ) ); + pageInfo.SetHeightMils( schIUScale.IUToMils( targetSheetSize.y ) ); // Set the new sheet size. sheet->GetScreen()->SetPageSettings( pageInfo ); diff --git a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp index 29c7f09585..21da6a1490 100644 --- a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp +++ b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp @@ -945,10 +945,10 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex ) // Increase if necessary if( pageSizeIU.x < targetSheetSize.x ) - pageInfo.SetWidthMils( Iu2Mils( targetSheetSize.x ) ); + pageInfo.SetWidthMils( schIUScale.IUToMils( targetSheetSize.x ) ); if( pageSizeIU.y < targetSheetSize.y ) - pageInfo.SetHeightMils( Iu2Mils( targetSheetSize.y ) ); + pageInfo.SetHeightMils( schIUScale.IUToMils( targetSheetSize.y ) ); // Set the new sheet size. m_currentSheet->GetScreen()->SetPageSettings( pageInfo ); diff --git a/eeschema/sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp b/eeschema/sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp index c5bd5940df..f8eb73f84b 100644 --- a/eeschema/sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp +++ b/eeschema/sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp @@ -1403,7 +1403,7 @@ void SCH_LEGACY_PLUGIN_CACHE::SaveSymbol( LIB_SYMBOL* aSymbol, OUTPUTFORMATTER& aFormatter.Print( 0, " ~" ); aFormatter.Print( 0, " %d %d %c %c %d %c %c\n", - 0, Iu2Mils( aSymbol->GetPinNameOffset() ), + 0, schIUScale.IUToMils( aSymbol->GetPinNameOffset() ), aSymbol->ShowPinNumbers() ? 'Y' : 'N', aSymbol->ShowPinNames() ? 'Y' : 'N', aSymbol->GetUnitCount(), aSymbol->UnitsLocked() ? 'L' : 'F', @@ -1524,19 +1524,19 @@ void SCH_LEGACY_PLUGIN_CACHE::saveArc( LIB_SHAPE* aArc, OUTPUTFORMATTER& aFormat endAngle.Normalize180(); aFormatter.Print( 0, "A %d %d %d %d %d %d %d %d %c %d %d %d %d\n", - Iu2Mils( aArc->GetPosition().x ), - Iu2Mils( aArc->GetPosition().y ), - Iu2Mils( aArc->GetRadius() ), + schIUScale.IUToMils( aArc->GetPosition().x ), + schIUScale.IUToMils( aArc->GetPosition().y ), + schIUScale.IUToMils( aArc->GetRadius() ), startAngle.AsTenthsOfADegree(), endAngle.AsTenthsOfADegree(), aArc->GetUnit(), aArc->GetConvert(), - Iu2Mils( aArc->GetWidth() ), + schIUScale.IUToMils( aArc->GetWidth() ), fill_tab[ static_cast( aArc->GetFillMode() ) - 1 ], - Iu2Mils( aArc->GetStart().x ), - Iu2Mils( aArc->GetStart().y ), - Iu2Mils( aArc->GetEnd().x ), - Iu2Mils( aArc->GetEnd().y ) ); + schIUScale.IUToMils( aArc->GetStart().x ), + schIUScale.IUToMils( aArc->GetStart().y ), + schIUScale.IUToMils( aArc->GetEnd().x ), + schIUScale.IUToMils( aArc->GetEnd().y ) ); } @@ -1548,10 +1548,10 @@ void SCH_LEGACY_PLUGIN_CACHE::saveBezier( LIB_SHAPE* aBezier, OUTPUTFORMATTER& a (unsigned)aBezier->GetBezierPoints().size(), aBezier->GetUnit(), aBezier->GetConvert(), - Iu2Mils( aBezier->GetWidth() ) ); + schIUScale.IUToMils( aBezier->GetWidth() ) ); for( const VECTOR2I& pt : aBezier->GetBezierPoints() ) - aFormatter.Print( 0, " %d %d", Iu2Mils( pt.x ), Iu2Mils( pt.y ) ); + aFormatter.Print( 0, " %d %d", schIUScale.IUToMils( pt.x ), schIUScale.IUToMils( pt.y ) ); aFormatter.Print( 0, " %c\n", fill_tab[ static_cast( aBezier->GetFillMode() ) - 1 ] ); } @@ -1562,12 +1562,12 @@ void SCH_LEGACY_PLUGIN_CACHE::saveCircle( LIB_SHAPE* aCircle, OUTPUTFORMATTER& a wxCHECK_RET( aCircle && aCircle->GetShape() == SHAPE_T::CIRCLE, "Invalid CIRCLE object." ); aFormatter.Print( 0, "C %d %d %d %d %d %d %c\n", - Iu2Mils( aCircle->GetPosition().x ), - Iu2Mils( aCircle->GetPosition().y ), - Iu2Mils( aCircle->GetRadius() ), + schIUScale.IUToMils( aCircle->GetPosition().x ), + schIUScale.IUToMils( aCircle->GetPosition().y ), + schIUScale.IUToMils( aCircle->GetRadius() ), aCircle->GetUnit(), aCircle->GetConvert(), - Iu2Mils( aCircle->GetWidth() ), + schIUScale.IUToMils( aCircle->GetWidth() ), fill_tab[ static_cast( aCircle->GetFillMode() ) - 1 ] ); } @@ -1597,9 +1597,9 @@ void SCH_LEGACY_PLUGIN_CACHE::saveField( const LIB_FIELD* aField, OUTPUTFORMATTE aFormatter.Print( 0, "F%d %s %d %d %d %c %c %c %c%c%c", id, EscapedUTF8( text ).c_str(), // wraps in quotes - Iu2Mils( aField->GetTextPos().x ), - Iu2Mils( aField->GetTextPos().y ), - Iu2Mils( aField->GetTextWidth() ), + schIUScale.IUToMils( aField->GetTextPos().x ), + schIUScale.IUToMils( aField->GetTextPos().y ), + schIUScale.IUToMils( aField->GetTextWidth() ), aField->GetTextAngle().IsHorizontal() ? 'H' : 'V', aField->IsVisible() ? 'V' : 'I', hjustify, vjustify, @@ -1649,12 +1649,12 @@ void SCH_LEGACY_PLUGIN_CACHE::savePin( const LIB_PIN* aPin, OUTPUTFORMATTER& aFo aFormatter.Print( 0, " %s %d %d %d %c %d %d %d %d %c", aPin->GetNumber().IsEmpty() ? "~" : TO_UTF8( aPin->GetNumber() ), - Iu2Mils( aPin->GetPosition().x ), - Iu2Mils( aPin->GetPosition().y ), - Iu2Mils( (int) aPin->GetLength() ), + schIUScale.IUToMils( aPin->GetPosition().x ), + schIUScale.IUToMils( aPin->GetPosition().y ), + schIUScale.IUToMils( (int) aPin->GetLength() ), (int) aPin->GetOrientation(), - Iu2Mils( aPin->GetNumberTextSize() ), - Iu2Mils( aPin->GetNameTextSize() ), + schIUScale.IUToMils( aPin->GetNumberTextSize() ), + schIUScale.IUToMils( aPin->GetNameTextSize() ), aPin->GetUnit(), aPin->GetConvert(), Etype ); @@ -1693,10 +1693,10 @@ void SCH_LEGACY_PLUGIN_CACHE::savePolyLine( LIB_SHAPE* aPolyLine, OUTPUTFORMATTE (int) aPolyLine->GetPolyShape().Outline( 0 ).GetPointCount(), aPolyLine->GetUnit(), aPolyLine->GetConvert(), - Iu2Mils( aPolyLine->GetWidth() ) ); + schIUScale.IUToMils( aPolyLine->GetWidth() ) ); for( const VECTOR2I& pt : aPolyLine->GetPolyShape().Outline( 0 ).CPoints() ) - aFormatter.Print( 0, " %d %d", Iu2Mils( pt.x ), Iu2Mils( pt.y ) ); + aFormatter.Print( 0, " %d %d", schIUScale.IUToMils( pt.x ), schIUScale.IUToMils( pt.y ) ); aFormatter.Print( 0, " %c\n", fill_tab[ static_cast( aPolyLine->GetFillMode() ) - 1 ] ); } @@ -1707,13 +1707,13 @@ void SCH_LEGACY_PLUGIN_CACHE::saveRectangle( LIB_SHAPE* aRectangle, OUTPUTFORMAT wxCHECK_RET( aRectangle && aRectangle->GetShape() == SHAPE_T::RECT, "Invalid RECT object." ); aFormatter.Print( 0, "S %d %d %d %d %d %d %d %c\n", - Iu2Mils( aRectangle->GetPosition().x ), - Iu2Mils( aRectangle->GetPosition().y ), - Iu2Mils( aRectangle->GetEnd().x ), - Iu2Mils( aRectangle->GetEnd().y ), + schIUScale.IUToMils( aRectangle->GetPosition().x ), + schIUScale.IUToMils( aRectangle->GetPosition().y ), + schIUScale.IUToMils( aRectangle->GetEnd().x ), + schIUScale.IUToMils( aRectangle->GetEnd().y ), aRectangle->GetUnit(), aRectangle->GetConvert(), - Iu2Mils( aRectangle->GetWidth() ), + schIUScale.IUToMils( aRectangle->GetWidth() ), fill_tab[ static_cast( aRectangle->GetFillMode() ) - 1 ] ); } @@ -1733,9 +1733,9 @@ void SCH_LEGACY_PLUGIN_CACHE::saveText( const LIB_TEXT* aText, OUTPUTFORMATTER& aFormatter.Print( 0, "T %g %d %d %d %d %d %d %s", (double) aText->GetTextAngle().AsTenthsOfADegree(), - Iu2Mils( aText->GetTextPos().x ), - Iu2Mils( aText->GetTextPos().y ), - Iu2Mils( aText->GetTextWidth() ), + schIUScale.IUToMils( aText->GetTextPos().x ), + schIUScale.IUToMils( aText->GetTextPos().y ), + schIUScale.IUToMils( aText->GetTextWidth() ), !aText->IsVisible(), aText->GetUnit(), aText->GetConvert(), diff --git a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp index 06a05d88e5..c56cf01e97 100644 --- a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp +++ b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp @@ -1594,8 +1594,8 @@ void SCH_LEGACY_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol ) // Save the position m_out->Print( 0, "P %d %d\n", - Iu2Mils( aSymbol->GetPosition().x ), - Iu2Mils( aSymbol->GetPosition().y ) ); + schIUScale.IUToMils( aSymbol->GetPosition().x ), + schIUScale.IUToMils( aSymbol->GetPosition().y ) ); /* If this is a complex hierarchy; save hierarchical references. * but for simple hierarchies it is not necessary. @@ -1646,8 +1646,8 @@ void SCH_LEGACY_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol ) // Unit number, position, box ( old standard ) m_out->Print( 0, "\t%-4d %-4d %-4d\n", aSymbol->GetUnit(), - Iu2Mils( aSymbol->GetPosition().x ), - Iu2Mils( aSymbol->GetPosition().y ) ); + schIUScale.IUToMils( aSymbol->GetPosition().x ), + schIUScale.IUToMils( aSymbol->GetPosition().y ) ); TRANSFORM transform = aSymbol->GetTransform(); @@ -1677,9 +1677,9 @@ void SCH_LEGACY_PLUGIN::saveField( SCH_FIELD* aField ) aField->GetId(), EscapedUTF8( aField->GetText() ).c_str(), // wraps in quotes too aField->GetTextAngle().IsHorizontal() ? 'H' : 'V', - Iu2Mils( aField->GetLibPosition().x ), - Iu2Mils( aField->GetLibPosition().y ), - Iu2Mils( aField->GetTextWidth() ), + schIUScale.IUToMils( aField->GetLibPosition().x ), + schIUScale.IUToMils( aField->GetLibPosition().y ), + schIUScale.IUToMils( aField->GetTextWidth() ), !aField->IsVisible(), hjustify, vjustify, aField->IsItalic() ? 'I' : 'N', @@ -1703,8 +1703,8 @@ void SCH_LEGACY_PLUGIN::saveBitmap( SCH_BITMAP* aBitmap ) m_out->Print( 0, "$Bitmap\n" ); m_out->Print( 0, "Pos %-4d %-4d\n", - Iu2Mils( aBitmap->GetPosition().x ), - Iu2Mils( aBitmap->GetPosition().y ) ); + schIUScale.IUToMils( aBitmap->GetPosition().x ), + schIUScale.IUToMils( aBitmap->GetPosition().y ) ); m_out->Print( 0, "Scale %f\n", aBitmap->GetImage()->GetScale() ); m_out->Print( 0, "Data\n" ); @@ -1739,10 +1739,10 @@ void SCH_LEGACY_PLUGIN::saveSheet( SCH_SHEET* aSheet ) m_out->Print( 0, "$Sheet\n" ); m_out->Print( 0, "S %-4d %-4d %-4d %-4d\n", - Iu2Mils( aSheet->GetPosition().x ), - Iu2Mils( aSheet->GetPosition().y ), - Iu2Mils( aSheet->GetSize().x ), - Iu2Mils( aSheet->GetSize().y ) ); + schIUScale.IUToMils( aSheet->GetPosition().x ), + schIUScale.IUToMils( aSheet->GetPosition().y ), + schIUScale.IUToMils( aSheet->GetSize().x ), + schIUScale.IUToMils( aSheet->GetSize().y ) ); m_out->Print( 0, "U %8.8X\n", aSheet->m_Uuid.AsLegacyTimestamp() ); @@ -1752,12 +1752,12 @@ void SCH_LEGACY_PLUGIN::saveSheet( SCH_SHEET* aSheet ) if( !sheetName.GetText().IsEmpty() ) m_out->Print( 0, "F0 %s %d\n", EscapedUTF8( sheetName.GetText() ).c_str(), - Iu2Mils( sheetName.GetTextSize().x ) ); + schIUScale.IUToMils( sheetName.GetTextSize().x ) ); if( !fileName.GetText().IsEmpty() ) m_out->Print( 0, "F1 %s %d\n", EscapedUTF8( fileName.GetText() ).c_str(), - Iu2Mils( fileName.GetTextSize().x ) ); + schIUScale.IUToMils( fileName.GetTextSize().x ) ); for( const SCH_SHEET_PIN* pin : aSheet->GetPins() ) { @@ -1788,9 +1788,9 @@ void SCH_LEGACY_PLUGIN::saveSheet( SCH_SHEET* aSheet ) m_out->Print( 0, "F%d %s %c %c %-3d %-3d %-3d\n", pin->GetNumber(), EscapedUTF8( pin->GetText() ).c_str(), // supplies wrapping quotes - type, side, Iu2Mils( pin->GetPosition().x ), - Iu2Mils( pin->GetPosition().y ), - Iu2Mils( pin->GetTextWidth() ) ); + type, side, schIUScale.IUToMils( pin->GetPosition().x ), + schIUScale.IUToMils( pin->GetPosition().y ), + schIUScale.IUToMils( pin->GetTextWidth() ) ); } m_out->Print( 0, "$EndSheet\n" ); @@ -1802,8 +1802,8 @@ void SCH_LEGACY_PLUGIN::saveJunction( SCH_JUNCTION* aJunction ) wxCHECK_RET( aJunction != nullptr, "SCH_JUNCTION* is NULL" ); m_out->Print( 0, "Connection ~ %-4d %-4d\n", - Iu2Mils( aJunction->GetPosition().x ), - Iu2Mils( aJunction->GetPosition().y ) ); + schIUScale.IUToMils( aJunction->GetPosition().x ), + schIUScale.IUToMils( aJunction->GetPosition().y ) ); } @@ -1812,8 +1812,8 @@ void SCH_LEGACY_PLUGIN::saveNoConnect( SCH_NO_CONNECT* aNoConnect ) wxCHECK_RET( aNoConnect != nullptr, "SCH_NOCONNECT* is NULL" ); m_out->Print( 0, "NoConn ~ %-4d %-4d\n", - Iu2Mils( aNoConnect->GetPosition().x ), - Iu2Mils( aNoConnect->GetPosition().y ) ); + schIUScale.IUToMils( aNoConnect->GetPosition().x ), + schIUScale.IUToMils( aNoConnect->GetPosition().y ) ); } @@ -1823,14 +1823,14 @@ void SCH_LEGACY_PLUGIN::saveBusEntry( SCH_BUS_ENTRY_BASE* aBusEntry ) if( aBusEntry->GetLayer() == LAYER_WIRE ) m_out->Print( 0, "Entry Wire Line\n\t%-4d %-4d %-4d %-4d\n", - Iu2Mils( aBusEntry->GetPosition().x ), - Iu2Mils( aBusEntry->GetPosition().y ), - Iu2Mils( aBusEntry->GetEnd().x ), Iu2Mils( aBusEntry->GetEnd().y ) ); + schIUScale.IUToMils( aBusEntry->GetPosition().x ), + schIUScale.IUToMils( aBusEntry->GetPosition().y ), + schIUScale.IUToMils( aBusEntry->GetEnd().x ), schIUScale.IUToMils( aBusEntry->GetEnd().y ) ); else m_out->Print( 0, "Entry Bus Bus\n\t%-4d %-4d %-4d %-4d\n", - Iu2Mils( aBusEntry->GetPosition().x ), - Iu2Mils( aBusEntry->GetPosition().y ), - Iu2Mils( aBusEntry->GetEnd().x ), Iu2Mils( aBusEntry->GetEnd().y ) ); + schIUScale.IUToMils( aBusEntry->GetPosition().x ), + schIUScale.IUToMils( aBusEntry->GetPosition().y ), + schIUScale.IUToMils( aBusEntry->GetEnd().x ), schIUScale.IUToMils( aBusEntry->GetEnd().y ) ); } @@ -1852,7 +1852,7 @@ void SCH_LEGACY_PLUGIN::saveLine( SCH_LINE* aLine ) if( aLine->IsGraphicLine() ) { if( aLine->GetLineSize() != 0 ) - m_out->Print( 0, " %s %d", T_WIDTH, Iu2Mils( aLine->GetLineSize() ) ); + m_out->Print( 0, " %s %d", T_WIDTH, schIUScale.IUToMils( aLine->GetLineSize() ) ); m_out->Print( 0, " %s %s", T_STYLE, TO_UTF8( STROKE_PARAMS::GetLineStyleToken( aLine->GetLineStyle() ) ) ); @@ -1867,8 +1867,8 @@ void SCH_LEGACY_PLUGIN::saveLine( SCH_LINE* aLine ) m_out->Print( 0, "\n" ); m_out->Print( 0, "\t%-4d %-4d %-4d %-4d", - Iu2Mils( aLine->GetStartPoint().x ), Iu2Mils( aLine->GetStartPoint().y ), - Iu2Mils( aLine->GetEndPoint().x ), Iu2Mils( aLine->GetEndPoint().y ) ); + schIUScale.IUToMils( aLine->GetStartPoint().x ), schIUScale.IUToMils( aLine->GetStartPoint().y ), + schIUScale.IUToMils( aLine->GetEndPoint().x ), schIUScale.IUToMils( aLine->GetEndPoint().y ) ); m_out->Print( 0, "\n"); } @@ -1924,10 +1924,10 @@ void SCH_LEGACY_PLUGIN::saveText( SCH_TEXT* aText ) spinStyle = 0; m_out->Print( 0, "Text %s %-4d %-4d %-4d %-4d %s %d\n%s\n", textType, - Iu2Mils( aText->GetPosition().x ), Iu2Mils( aText->GetPosition().y ), + schIUScale.IUToMils( aText->GetPosition().x ), schIUScale.IUToMils( aText->GetPosition().y ), spinStyle, - Iu2Mils( aText->GetTextWidth() ), - italics, Iu2Mils( aText->GetTextThickness() ), TO_UTF8( text ) ); + schIUScale.IUToMils( aText->GetTextWidth() ), + italics, schIUScale.IUToMils( aText->GetTextThickness() ), TO_UTF8( text ) ); } else if( layer == LAYER_GLOBLABEL || layer == LAYER_HIERLABEL ) { @@ -1937,12 +1937,12 @@ void SCH_LEGACY_PLUGIN::saveText( SCH_TEXT* aText ) wxCHECK_RET( shapeLabelIt != sheetLabelNames.end(), "Shape not found in names list" ); m_out->Print( 0, "Text %s %-4d %-4d %-4d %-4d %s %s %d\n%s\n", textType, - Iu2Mils( aText->GetPosition().x ), Iu2Mils( aText->GetPosition().y ), + schIUScale.IUToMils( aText->GetPosition().x ), schIUScale.IUToMils( aText->GetPosition().y ), static_cast( aText->GetTextSpinStyle() ), - Iu2Mils( aText->GetTextWidth() ), + schIUScale.IUToMils( aText->GetTextWidth() ), shapeLabelIt->second, italics, - Iu2Mils( aText->GetTextThickness() ), TO_UTF8( text ) ); + schIUScale.IUToMils( aText->GetTextThickness() ), TO_UTF8( text ) ); } } diff --git a/gerbview/gerber_file_image.cpp b/gerbview/gerber_file_image.cpp index 1b2ecddfcf..202bb5a90f 100644 --- a/gerbview/gerber_file_image.cpp +++ b/gerbview/gerber_file_image.cpp @@ -349,13 +349,13 @@ void GERBER_FILE_IMAGE::DisplayImageInfo( GERBVIEW_FRAME* aMainFrame ) switch( aMainFrame->GetUserUnits() ) { case EDA_UNITS::MILS: - msg.Printf( wxT( "X=%f Y=%f" ), Iu2Mils( m_ImageJustifyOffset.x ), - Iu2Mils( m_ImageJustifyOffset.y ) ); + msg.Printf( wxT( "X=%f Y=%f" ), gerbIUScale.IUToMils( m_ImageJustifyOffset.x ), + gerbIUScale.IUToMils( m_ImageJustifyOffset.y ) ); break; case EDA_UNITS::INCHES: - msg.Printf( wxT( "X=%f Y=%f" ), Iu2Mils( m_ImageJustifyOffset.x ) / 1000.0, - Iu2Mils( m_ImageJustifyOffset.y ) / 1000.0 ); + msg.Printf( wxT( "X=%f Y=%f" ), gerbIUScale.IUToMils( m_ImageJustifyOffset.x ) / 1000.0, + gerbIUScale.IUToMils( m_ImageJustifyOffset.y ) / 1000.0 ); break; case EDA_UNITS::MILLIMETRES: diff --git a/include/convert_to_biu.h b/include/convert_to_biu.h index c4b71b26a6..4195f8a3c0 100644 --- a/include/convert_to_biu.h +++ b/include/convert_to_biu.h @@ -129,22 +129,6 @@ constexpr double IU_PER_MM = SCH_IU_PER_MM; constexpr double IU_PER_MILS = (IU_PER_MM * 0.0254); -#if defined(EESCHEMA) -constexpr inline int Iu2Mils( int iu ) -{ - double mils = iu / IU_PER_MILS; - - return static_cast< int >( mils < 0 ? mils - 0.5 : mils + 0.5 ); -} -#else -constexpr inline double Iu2Mils( int iu ) -{ - double mils = iu / IU_PER_MILS; - - return static_cast< int >( mils < 0 ? mils - 0.5 : mils + 0.5 ); -} -#endif - /// Convert mm to internal units (iu). constexpr inline int Millimeter2iu( double mm ) { diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index ed8debf3a8..1531a4fd9b 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -576,10 +576,10 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly ) } storePersistentNetSortConfigurations(); - cfg->m_Zones.clearance = Iu2Mils( m_settings.m_ZoneClearance ); - cfg->m_Zones.min_thickness = Iu2Mils( m_settings.m_ZoneMinThickness ); - cfg->m_Zones.thermal_relief_gap = Iu2Mils( m_settings.m_ThermalReliefGap ); - cfg->m_Zones.thermal_relief_copper_width = Iu2Mils( m_settings.m_ThermalReliefSpokeWidth ); + cfg->m_Zones.clearance = pcbIUScale.IUToMils( m_settings.m_ZoneClearance ); + cfg->m_Zones.min_thickness = pcbIUScale.IUToMils( m_settings.m_ZoneMinThickness ); + cfg->m_Zones.thermal_relief_gap = pcbIUScale.IUToMils( m_settings.m_ThermalReliefGap ); + cfg->m_Zones.thermal_relief_copper_width = pcbIUScale.IUToMils( m_settings.m_ThermalReliefSpokeWidth ); m_settings.SetIslandRemovalMode( (ISLAND_REMOVAL_MODE) m_cbRemoveIslands->GetSelection() ); m_settings.SetMinIslandArea( m_islandThreshold.GetValue() ); diff --git a/pcbnew/python/plugins/sdip_wizard.py b/pcbnew/python/plugins/sdip_wizard.py index 9d00435d1e..b1a6af9c89 100644 --- a/pcbnew/python/plugins/sdip_wizard.py +++ b/pcbnew/python/plugins/sdip_wizard.py @@ -157,7 +157,7 @@ class SDIPWizard(RowedFootprint): pads = self.parameters["Pads"] rows = pads[self.row_count_key] pad_count = pads[self.pad_count_key] - row_dist_mil = pcbnew.Iu2Mils(int(self.parameters["Pads"][self.row_spacing_key])) #int(self.parameters["Pads"][self.row_spacing_key] / 2.54 * 100) + row_dist_mil = pcbnew.pcbIUScale.IUToMils(int(self.parameters["Pads"][self.row_spacing_key])) #int(self.parameters["Pads"][self.row_spacing_key] / 2.54 * 100) pad_shape = "" if pads[self.pad_width_key] != pads[self.pad_length_key]: