Strip out Mils2Iu

This commit is contained in:
Marek Roszko 2022-09-16 19:42:20 -04:00
parent e6ed275c25
commit 61e11d6896
61 changed files with 383 additions and 392 deletions

View File

@ -176,11 +176,11 @@ bool PGPROPERTY_DISTANCE::StringToDistance( wxVariant& aVariant, const wxString&
switch( unit )
{
case EDA_UNITS::INCHES:
newValueIU = Mils2iu( value * 1000.0 );
newValueIU = pcbIUScale.MilsToIU( value * 1000.0 );
break;
case EDA_UNITS::MILS:
newValueIU = Mils2iu( value );
newValueIU = pcbIUScale.MilsToIU( value );
break;
case EDA_UNITS::MILLIMETRES:

View File

@ -65,10 +65,10 @@
#include <eeschema_settings.h>
#include <core/arraydim.h>
#define FIELD_PADDING Mils2iu( 10 ) // arbitrarily chosen for aesthetics
#define WIRE_V_SPACING Mils2iu( 100 )
#define HPADDING Mils2iu( 25 )
#define VPADDING Mils2iu( 25 )
#define FIELD_PADDING schIUScale.MilsToIU( 10 ) // arbitrarily chosen for aesthetics
#define WIRE_V_SPACING schIUScale.MilsToIU( 100 )
#define HPADDING schIUScale.MilsToIU( 25 )
#define VPADDING schIUScale.MilsToIU( 25 )
/**
* Round up/down to the nearest multiple of n
@ -175,10 +175,10 @@ public:
if( m_align_to_grid )
{
if( abs( field_side.x ) > 0 )
pos.x = round_n( pos.x, Mils2iu( 50 ), field_side.x >= 0 );
pos.x = round_n( pos.x, schIUScale.MilsToIU( 50 ), field_side.x >= 0 );
if( abs( field_side.y ) > 0 )
pos.y = round_n( pos.y, Mils2iu( 50 ), field_side.y >= 0 );
pos.y = round_n( pos.y, schIUScale.MilsToIU( 50 ), field_side.y >= 0 );
}
field->SetPosition( pos );
@ -226,7 +226,7 @@ protected:
if( !aDynamic )
total_height += WIRE_V_SPACING;
else if( m_align_to_grid )
total_height += round_n( field_height, Mils2iu( 50 ), true );
total_height += round_n( field_height, schIUScale.MilsToIU( 50 ), true );
else
total_height += field_height + FIELD_PADDING;
}
@ -702,7 +702,7 @@ protected:
else if( m_align_to_grid )
{
field_height = aField->GetBoundingBox().GetHeight();
padding = round_n( field_height, Mils2iu( 50 ), true ) - field_height;
padding = round_n( field_height, schIUScale.MilsToIU( 50 ), true ) - field_height;
}
else
{

View File

@ -295,9 +295,9 @@ public:
auto* cfg = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
if( last->GetOrientation() == PIN_LEFT || last->GetOrientation() == PIN_RIGHT )
pos.y -= Mils2iu( cfg->m_Repeat.pin_step );
pos.y -= schIUScale.MilsToIU( cfg->m_Repeat.pin_step );
else
pos.x += Mils2iu( cfg->m_Repeat.pin_step );
pos.x += schIUScale.MilsToIU( cfg->m_Repeat.pin_step );
newPin->SetPosition( pos );
@ -911,9 +911,9 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow( wxCommandEvent& event )
SYMBOL_EDITOR_SETTINGS* cfg = m_editFrame->GetSettings();
if( last->GetOrientation() == PIN_LEFT || last->GetOrientation() == PIN_RIGHT )
pos.y -= Mils2iu(cfg->m_Repeat.pin_step);
pos.y -= schIUScale.MilsToIU(cfg->m_Repeat.pin_step);
else
pos.x += Mils2iu(cfg->m_Repeat.pin_step);
pos.x += schIUScale.MilsToIU(cfg->m_Repeat.pin_step);
newPin->SetPosition( pos );
}

View File

@ -47,7 +47,7 @@ DIALOG_LIB_NEW_SYMBOL::DIALOG_LIB_NEW_SYMBOL( EDA_DRAW_FRAME* aParent,
m_textName->SetValidator( SCH_FIELD_VALIDATOR( true, VALUE_FIELD ) );
m_textReference->SetValidator( SCH_FIELD_VALIDATOR( true, REFERENCE_FIELD ) );
m_pinTextPosition.SetValue( Mils2iu( DEFAULT_PIN_NAME_OFFSET ) );
m_pinTextPosition.SetValue( schIUScale.MilsToIU( DEFAULT_PIN_NAME_OFFSET ) );
// initial focus should be on first editable field.
m_textName->SetFocus();

View File

@ -209,7 +209,7 @@ void DIALOG_LIB_SHAPE_PROPERTIES::onBorderChecked( wxCommandEvent& event )
bool border = m_checkBorder->GetValue();
if( border && m_borderWidth.GetValue() < 0 )
m_borderWidth.SetValue( Mils2iu( m_frame->libeditconfig()->m_Defaults.line_width ) );
m_borderWidth.SetValue( schIUScale.MilsToIU( m_frame->libeditconfig()->m_Defaults.line_width ) );
m_borderWidth.Enable( border );
m_borderColorLabel->Enable( border );

View File

@ -488,8 +488,8 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnAddField( wxCommandEvent& event )
int fieldID = m_fields->size();
LIB_FIELD newField( m_libEntry, fieldID );
newField.SetTextSize( wxSize( Mils2iu( settings->m_Defaults.text_size ),
Mils2iu( settings->m_Defaults.text_size ) ) );
newField.SetTextSize( wxSize( schIUScale.MilsToIU( settings->m_Defaults.text_size ),
schIUScale.MilsToIU( settings->m_Defaults.text_size ) ) );
m_fields->push_back( newField );

View File

@ -161,7 +161,7 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow()
SYMBOL_EDITOR_SETTINGS* cfg = m_parent->GetSettings();
auto* tools = m_parent->GetToolManager()->GetTool<SYMBOL_EDITOR_DRAWING_TOOLS>();
m_textSize.SetValue( Mils2iu( cfg->m_Defaults.text_size ) );
m_textSize.SetValue( schIUScale.MilsToIU( cfg->m_Defaults.text_size ) );
m_CommonUnit->SetValue( !tools->GetDrawSpecificUnit() );
m_CommonConvert->SetValue( !tools->GetDrawSpecificConvert() );

View File

@ -369,7 +369,7 @@ void DIALOG_LIB_TEXTBOX_PROPERTIES::onBorderChecked( wxCommandEvent& event )
bool border = m_borderCheckbox->GetValue();
if( border && m_borderWidth.GetValue() < 0 )
m_borderWidth.SetValue( Mils2iu( m_frame->libeditconfig()->m_Defaults.line_width ) );
m_borderWidth.SetValue( schIUScale.MilsToIU( m_frame->libeditconfig()->m_Defaults.line_width ) );
m_borderWidth.Enable( border );
m_borderColorLabel->Enable( border );

View File

@ -173,7 +173,7 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
// Set the default line width (pen width which should be used for
// items that do not have a pen size defined (like frame ref)
// the default line width is stored in mils in config
m_defaultLineWidth.SetValue( Mils2iu( cfg->m_Drawing.default_line_thickness ) );
m_defaultLineWidth.SetValue( schIUScale.MilsToIU( cfg->m_Drawing.default_line_thickness ) );
}
// Initialize HPGL specific widgets

View File

@ -111,7 +111,7 @@ void DIALOG_SHAPE_PROPERTIES::onBorderChecked( wxCommandEvent& event )
bool border = m_borderCheckbox->GetValue();
if( border && m_borderWidth.GetValue() < 0 )
m_borderWidth.SetValue( Mils2iu( m_frame->eeconfig()->m_Drawing.default_line_thickness ) );
m_borderWidth.SetValue( schIUScale.MilsToIU( m_frame->eeconfig()->m_Drawing.default_line_thickness ) );
m_borderWidth.Enable( border );
m_borderColorLabel->Enable( border );

View File

@ -286,27 +286,27 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
SCH_LINE* wire = new SCH_LINE;
wire->SetLayer( line.first );
STROKE_PARAMS stroke = wire->GetStroke();
stroke.SetWidth( Mils2iu( 6 ) );
stroke.SetWidth( schIUScale.MilsToIU( 6 ) );
if( line.first != LAYER_NOTES )
{
stroke.SetPlotStyle( PLOT_DASH_TYPE::SOLID );
if( line.first == LAYER_BUS )
stroke.SetWidth( Mils2iu( 12 ) );
stroke.SetWidth( schIUScale.MilsToIU( 12 ) );
}
wire->SetStroke( stroke );
wire->SetStartPoint( VECTOR2I( Mils2iu( line.second.first.x ),
Mils2iu( line.second.first.y ) ) );
wire->SetEndPoint( VECTOR2I( Mils2iu( line.second.second.x ),
Mils2iu( line.second.second.y ) ) );
wire->SetStartPoint( VECTOR2I( schIUScale.MilsToIU( line.second.first.x ),
schIUScale.MilsToIU( line.second.first.y ) ) );
wire->SetEndPoint( VECTOR2I( schIUScale.MilsToIU( line.second.second.x ),
schIUScale.MilsToIU( line.second.second.y ) ) );
addItem( wire );
}
#define MILS_POINT( x, y ) VECTOR2I( Mils2iu( x ), Mils2iu( y ) )
#define MILS_POINT( x, y ) VECTOR2I( schIUScale.MilsToIU( x ), schIUScale.MilsToIU( y ) )
SCH_NO_CONNECT* nc = new SCH_NO_CONNECT;
nc->SetPosition( MILS_POINT( 2525, 1300 ) );
@ -379,7 +379,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
comp_body->SetUnit( 0 );
comp_body->SetConvert( 0 );
comp_body->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
comp_body->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
comp_body->SetFillMode( FILL_T::FILLED_WITH_BG_BODYCOLOR );
comp_body->AddPoint( MILS_POINT( p.x - 200, p.y + 200 ) );
comp_body->AddPoint( MILS_POINT( p.x + 200, p.y ) );
@ -391,7 +391,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
LIB_PIN* pin = new LIB_PIN( symbol );
pin->SetPosition( MILS_POINT( p.x - 300, p.y + 100 ) );
pin->SetLength( Mils2iu( 100 ) );
pin->SetLength( schIUScale.MilsToIU( 100 ) );
pin->SetOrientation( PIN_RIGHT );
pin->SetType( ELECTRICAL_PINTYPE::PT_INPUT );
pin->SetNumber( wxT( "1" ) );
@ -403,7 +403,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
pin = new LIB_PIN( symbol );
pin->SetPosition( MILS_POINT( p.x - 300, p.y - 100 ) );
pin->SetLength( Mils2iu( 100 ) );
pin->SetLength( schIUScale.MilsToIU( 100 ) );
pin->SetOrientation( PIN_RIGHT );
pin->SetType( ELECTRICAL_PINTYPE::PT_INPUT );
pin->SetNumber( wxT( "2" ) );
@ -415,7 +415,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
pin = new LIB_PIN( symbol );
pin->SetPosition( MILS_POINT( p.x + 300, p.y ) );
pin->SetLength( Mils2iu( 100 ) );
pin->SetLength( schIUScale.MilsToIU( 100 ) );
pin->SetOrientation( PIN_LEFT );
pin->SetType( ELECTRICAL_PINTYPE::PT_OUTPUT );
pin->SetNumber( wxT( "3" ) );
@ -430,7 +430,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
SCH_SHEET* s = new SCH_SHEET(
/* aParent */ nullptr,
/* aPosition */ MILS_POINT( 4000, 1300 ),
/* aSize */ wxSize( Mils2iu( 800 ), Mils2iu( 1300 ) ) );
/* aSize */ wxSize( schIUScale.MilsToIU( 800 ), schIUScale.MilsToIU( 1300 ) ) );
s->GetFields().at( SHEETNAME ).SetText( wxT( "SHEET" ) );
s->GetFields().at( SHEETFILENAME ).SetText( _( "/path/to/sheet" ) );
s->AutoplaceFields( nullptr, false );

View File

@ -54,8 +54,8 @@ PANEL_EESCHEMA_EDITING_OPTIONS::PANEL_EESCHEMA_EDITING_OPTIONS( wxWindow* aWindo
void PANEL_EESCHEMA_EDITING_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* aCfg )
{
m_hPitch.SetValue( Mils2iu( aCfg->m_Drawing.default_repeat_offset_x ) );
m_vPitch.SetValue( Mils2iu( aCfg->m_Drawing.default_repeat_offset_y ) );
m_hPitch.SetValue( schIUScale.MilsToIU( aCfg->m_Drawing.default_repeat_offset_x ) );
m_vPitch.SetValue( schIUScale.MilsToIU( aCfg->m_Drawing.default_repeat_offset_y ) );
m_spinLabelRepeatStep->SetValue( aCfg->m_Drawing.repeat_label_increment );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();

View File

@ -44,11 +44,11 @@ PANEL_SYM_EDITING_OPTIONS::PANEL_SYM_EDITING_OPTIONS( wxWindow* aWindow,
void PANEL_SYM_EDITING_OPTIONS::loadSymEditorSettings( SYMBOL_EDITOR_SETTINGS* aCfg )
{
m_lineWidth.SetValue( Mils2iu( aCfg->m_Defaults.line_width ) );
m_textSize.SetValue( Mils2iu( aCfg->m_Defaults.text_size ) );
m_pinLength.SetValue( Mils2iu( aCfg->m_Defaults.pin_length ) );
m_pinNumberSize.SetValue( Mils2iu( aCfg->m_Defaults.pin_num_size ) );
m_pinNameSize.SetValue( Mils2iu( aCfg->m_Defaults.pin_name_size ) );
m_lineWidth.SetValue( schIUScale.MilsToIU( aCfg->m_Defaults.line_width ) );
m_textSize.SetValue( schIUScale.MilsToIU( aCfg->m_Defaults.text_size ) );
m_pinLength.SetValue( schIUScale.MilsToIU( aCfg->m_Defaults.pin_length ) );
m_pinNumberSize.SetValue( schIUScale.MilsToIU( aCfg->m_Defaults.pin_num_size ) );
m_pinNameSize.SetValue( schIUScale.MilsToIU( aCfg->m_Defaults.pin_name_size ) );
m_choicePinDisplacement->SetSelection( aCfg->m_Repeat.pin_step == 50 ? 1 : 0 );
m_spinRepeatLabel->SetValue( aCfg->m_Repeat.label_delta );
m_cbShowPinElectricalType->SetValue( aCfg->m_ShowPinElectricalType );

View File

@ -801,7 +801,7 @@ int ERC_TESTER::TestOffGridEndpoints( int aGridSize )
// this is because all symbols are using a 50 mils grid to place pins, and therefore
// the wires must be on the 50 mils grid
// So raise an error if a pin is not on a 25 mil (or bigger: 50 mil or 100 mil) grid
const int min_grid_size = Mils2iu( 25 );
const int min_grid_size = schIUScale.MilsToIU( 25 );
const int clamped_grid_size = ( aGridSize < min_grid_size ) ? min_grid_size : aGridSize;
SCH_SCREENS screens( m_schematic->Root() );

View File

@ -106,15 +106,15 @@ LIB_PIN::LIB_PIN( LIB_SYMBOL* aParent ) :
if( pgm )
{
auto* settings = pgm->GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
m_length = Mils2iu( settings->m_Defaults.pin_length );
m_numTextSize = Mils2iu( settings->m_Defaults.pin_num_size );
m_nameTextSize = Mils2iu( settings->m_Defaults.pin_name_size );
m_length = schIUScale.MilsToIU( settings->m_Defaults.pin_length );
m_numTextSize = schIUScale.MilsToIU( settings->m_Defaults.pin_num_size );
m_nameTextSize = schIUScale.MilsToIU( settings->m_Defaults.pin_name_size );
}
else // Use hardcoded eeschema defaults: symbol_editor settings are not existing.
{
m_length = Mils2iu( DEFAULT_PIN_LENGTH );
m_numTextSize = Mils2iu( DEFAULT_PINNUM_SIZE );
m_nameTextSize = Mils2iu( DEFAULT_PINNAME_SIZE );
m_length = schIUScale.MilsToIU( DEFAULT_PIN_LENGTH );
m_numTextSize = schIUScale.MilsToIU( DEFAULT_PINNUM_SIZE );
m_nameTextSize = schIUScale.MilsToIU( DEFAULT_PINNAME_SIZE );
}
}
@ -388,8 +388,8 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos
int numPenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, true ),
aSettings->GetDefaultPenWidth() );
int name_offset = Mils2iu( PIN_TEXT_MARGIN ) + namePenWidth;
int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numPenWidth;
int name_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + namePenWidth;
int num_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + numPenWidth;
/* Get the num and name colors */
COLOR4D nameColor = aSettings->GetLayerColor( IsVisible() ? LAYER_PINNAM : LAYER_HIDDEN );
@ -764,8 +764,8 @@ void LIB_PIN::PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, int aPin
aPlotter->RenderSettings()->GetDefaultPenWidth() );
int numPenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, true ),
aPlotter->RenderSettings()->GetDefaultPenWidth() );
int name_offset = Mils2iu( PIN_TEXT_MARGIN ) + namePenWidth;
int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numPenWidth;
int name_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + namePenWidth;
int num_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + numPenWidth;
/* Get the num and name colors */
COLOR4D nameColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_PINNAM );
@ -1237,7 +1237,7 @@ const BOX2I LIB_PIN::GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNa
VECTOR2I nameSize = font->StringBoundaryLimits( name, fontSize, penWidth, false, false );
nameTextLength = nameSize.x + nameTextOffset;
nameTextHeight = nameSize.y + Mils2iu( PIN_TEXT_MARGIN );
nameTextHeight = nameSize.y + schIUScale.MilsToIU( PIN_TEXT_MARGIN );
}
if( includeType )
@ -1247,7 +1247,7 @@ const BOX2I LIB_PIN::GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNa
VECTOR2D( fontSize, fontSize ),
fontSize / 8.0, false, false );
typeTextLength = typeTextSize.x + Mils2iu( PIN_TEXT_MARGIN ) + TARGET_PIN_RADIUS;
typeTextLength = typeTextSize.x + schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + TARGET_PIN_RADIUS;
minsizeV = std::max( minsizeV, typeTextSize.y / 2 );
}
@ -1257,7 +1257,7 @@ const BOX2I LIB_PIN::GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNa
// calculate top left corner position
// for the default pin orientation (PIN_RIGHT)
begin.y = std::max( minsizeV, numberTextHeight + Mils2iu( PIN_TEXT_MARGIN ) );
begin.y = std::max( minsizeV, numberTextHeight + schIUScale.MilsToIU( PIN_TEXT_MARGIN ) );
begin.x = std::min( -typeTextLength, m_length - ( numberTextLength / 2) );
// calculate bottom right corner position and adjust top left corner position

View File

@ -32,7 +32,7 @@
#include <lib_symbol.h>
// Circle diameter drawn at the active end of pins:
#define TARGET_PIN_RADIUS Mils2iu( 15 )
#define TARGET_PIN_RADIUS schIUScale.MilsToIU( 15 )
// Pin visibility flag bit:
#define PIN_INVISIBLE 1 // Set makes pin invisible

View File

@ -44,8 +44,8 @@ LIB_SHAPE::LIB_SHAPE( LIB_SYMBOL* aParent, SHAPE_T aShape, int aLineWidth, FILL_
bool LIB_SHAPE::HitTest( const VECTOR2I& aPosRef, int aAccuracy ) const
{
if( aAccuracy < Mils2iu( MINIMUM_SELECTION_DISTANCE ) )
aAccuracy = Mils2iu( MINIMUM_SELECTION_DISTANCE );
if( aAccuracy < schIUScale.MilsToIU( MINIMUM_SELECTION_DISTANCE ) )
aAccuracy = schIUScale.MilsToIU( MINIMUM_SELECTION_DISTANCE );
return hitTest( DefaultTransform.TransformCoordinate( aPosRef ), aAccuracy );
}

View File

@ -105,7 +105,7 @@ LIB_SYMBOL::LIB_SYMBOL( const wxString& aName, LIB_SYMBOL* aParent, SYMBOL_LIB*
{
m_lastModDate = 0;
m_unitCount = 1;
m_pinNameOffset = Mils2iu( DEFAULT_PIN_NAME_OFFSET );
m_pinNameOffset = schIUScale.MilsToIU( DEFAULT_PIN_NAME_OFFSET );
m_options = ENTRY_NORMAL;
m_unitsLocked = false;
m_showPinNumbers = true;

View File

@ -41,7 +41,7 @@ LIB_TEXT::LIB_TEXT( LIB_SYMBOL* aParent ) :
LIB_ITEM( LIB_TEXT_T, aParent ),
EDA_TEXT( schIUScale, wxEmptyString )
{
SetTextSize( wxSize( Mils2iu( DEFAULT_TEXT_SIZE ), Mils2iu( DEFAULT_TEXT_SIZE ) ) );
SetTextSize( wxSize( schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ), schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ) ) );
}

View File

@ -47,7 +47,7 @@ LIB_TEXTBOX::LIB_TEXTBOX( LIB_SYMBOL* aParent, int aLineWidth, FILL_T aFillType,
LIB_SHAPE( aParent, SHAPE_T::RECT, aLineWidth, aFillType, LIB_TEXTBOX_T ),
EDA_TEXT( schIUScale, text )
{
SetTextSize( wxSize( Mils2iu( DEFAULT_TEXT_SIZE ), Mils2iu( DEFAULT_TEXT_SIZE ) ) );
SetTextSize( wxSize( schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ), schIUScale.MilsToIU( DEFAULT_TEXT_SIZE ) ) );
SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
SetVertJustify( GR_TEXT_V_ALIGN_TOP );
SetMultilineAllowed( true );
@ -332,8 +332,8 @@ wxString LIB_TEXTBOX::GetShownText( int aDepth ) const
bool LIB_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{
if( aAccuracy < Mils2iu( MINIMUM_SELECTION_DISTANCE ) )
aAccuracy = Mils2iu( MINIMUM_SELECTION_DISTANCE );
if( aAccuracy < schIUScale.MilsToIU( MINIMUM_SELECTION_DISTANCE ) )
aAccuracy = schIUScale.MilsToIU( MINIMUM_SELECTION_DISTANCE );
BOX2I rect = GetBoundingBox();

View File

@ -47,8 +47,8 @@ SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const VECTOR2I& pos, bool
SCH_ITEM( nullptr, aType )
{
m_pos = pos;
m_size.x = Mils2iu( DEFAULT_SCH_ENTRY_SIZE );
m_size.y = Mils2iu( DEFAULT_SCH_ENTRY_SIZE );
m_size.x = schIUScale.MilsToIU( DEFAULT_SCH_ENTRY_SIZE );
m_size.y = schIUScale.MilsToIU( DEFAULT_SCH_ENTRY_SIZE );
m_stroke.SetWidth( 0 );
m_stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
@ -59,7 +59,7 @@ SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const VECTOR2I& pos, bool
m_isDanglingStart = m_isDanglingEnd = true;
m_lastResolvedWidth = Mils2iu( DEFAULT_WIRE_WIDTH_MILS );
m_lastResolvedWidth = schIUScale.MilsToIU( DEFAULT_WIRE_WIDTH_MILS );
m_lastResolvedLineStyle = PLOT_DASH_TYPE::SOLID;
m_lastResolvedColor = COLOR4D::UNSPECIFIED;
}
@ -71,7 +71,7 @@ SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const VECTOR2I& pos, bool aFlipY ) :
m_layer = LAYER_WIRE;
m_connected_bus_item = nullptr;
m_lastResolvedWidth = Mils2iu( DEFAULT_WIRE_WIDTH_MILS );
m_lastResolvedWidth = schIUScale.MilsToIU( DEFAULT_WIRE_WIDTH_MILS );
m_lastResolvedLineStyle = PLOT_DASH_TYPE::SOLID;
m_lastResolvedColor = COLOR4D::UNSPECIFIED;
}
@ -92,7 +92,7 @@ SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const VECTOR2I& pos, int aQuadrant ) :
m_layer = LAYER_WIRE;
m_connected_bus_item = nullptr;
m_lastResolvedWidth = Mils2iu( DEFAULT_WIRE_WIDTH_MILS );
m_lastResolvedWidth = schIUScale.MilsToIU( DEFAULT_WIRE_WIDTH_MILS );
m_lastResolvedLineStyle = PLOT_DASH_TYPE::SOLID;
m_lastResolvedColor = COLOR4D::UNSPECIFIED;
}
@ -105,7 +105,7 @@ SCH_BUS_BUS_ENTRY::SCH_BUS_BUS_ENTRY( const VECTOR2I& pos, bool aFlipY ) :
m_connected_bus_items[0] = nullptr;
m_connected_bus_items[1] = nullptr;
m_lastResolvedWidth = Mils2iu( DEFAULT_WIRE_WIDTH_MILS );
m_lastResolvedWidth = schIUScale.MilsToIU( DEFAULT_WIRE_WIDTH_MILS );
m_lastResolvedLineStyle = PLOT_DASH_TYPE::SOLID;
m_lastResolvedColor = COLOR4D::UNSPECIFIED;
}

View File

@ -28,7 +28,7 @@
#include <gal/color4d.h>
#include <sch_item.h>
#define TARGET_BUSENTRY_RADIUS Mils2iu( 12 ) // Circle diameter drawn at the ends
#define TARGET_BUSENTRY_RADIUS schIUScale.MilsToIU( 12 ) // Circle diameter drawn at the ends
/**

View File

@ -45,7 +45,7 @@ SCH_JUNCTION::SCH_JUNCTION( const VECTOR2I& aPosition, int aDiameter, SCH_LAYER_
m_diameter = aDiameter;
m_layer = aLayer;
m_lastResolvedDiameter = KiROUND( Mils2iu( DEFAULT_WIRE_WIDTH_MILS ) * 1.7 );
m_lastResolvedDiameter = KiROUND( schIUScale.MilsToIU( DEFAULT_WIRE_WIDTH_MILS ) * 1.7 );
m_lastResolvedColor = COLOR4D::UNSPECIFIED;
}
@ -83,7 +83,7 @@ SHAPE_CIRCLE SCH_JUNCTION::getEffectiveShape() const
else if( Schematic() )
m_lastResolvedDiameter = Schematic()->Settings().m_JunctionSize;
else
m_lastResolvedDiameter = Mils2iu( DEFAULT_JUNCTION_DIAM );
m_lastResolvedDiameter = schIUScale.MilsToIU( DEFAULT_JUNCTION_DIAM );
if( m_lastResolvedDiameter != 1 ) // Diameter 1 means user doesn't want to draw junctions
{

View File

@ -1038,8 +1038,8 @@ SCH_DIRECTIVE_LABEL::SCH_DIRECTIVE_LABEL( const VECTOR2I& pos ) :
{
m_layer = LAYER_NETCLASS_REFS;
m_shape = LABEL_FLAG_SHAPE::F_ROUND;
m_pinLength = Mils2iu( 100 );
m_symbolSize = Mils2iu( 20 );
m_pinLength = schIUScale.MilsToIU( 100 );
m_symbolSize = schIUScale.MilsToIU( 20 );
m_isDangling = true;
}
@ -1555,7 +1555,7 @@ const BOX2I SCH_HIERLABEL::GetBodyBoundingBox() const
case TEXT_SPIN_STYLE::LEFT:
dx = -length;
dy = height;
x += Mils2iu( DANGLING_SYMBOL_SIZE );
x += schIUScale.MilsToIU( DANGLING_SYMBOL_SIZE );
y -= height / 2;
break;
@ -1563,13 +1563,13 @@ const BOX2I SCH_HIERLABEL::GetBodyBoundingBox() const
dx = height;
dy = -length;
x -= height / 2;
y += Mils2iu( DANGLING_SYMBOL_SIZE );
y += schIUScale.MilsToIU( DANGLING_SYMBOL_SIZE );
break;
case TEXT_SPIN_STYLE::RIGHT:
dx = length;
dy = height;
x -= Mils2iu( DANGLING_SYMBOL_SIZE );
x -= schIUScale.MilsToIU( DANGLING_SYMBOL_SIZE );
y -= height / 2;
break;
@ -1577,7 +1577,7 @@ const BOX2I SCH_HIERLABEL::GetBodyBoundingBox() const
dx = height;
dy = length;
x -= height / 2;
y -= Mils2iu( DANGLING_SYMBOL_SIZE );
y -= schIUScale.MilsToIU( DANGLING_SYMBOL_SIZE );
break;
}

View File

@ -62,11 +62,11 @@ SCH_LINE::SCH_LINE( const VECTOR2I& pos, int layer ) :
m_startIsDangling = m_endIsDangling = false;
if( layer == LAYER_WIRE )
m_lastResolvedWidth = Mils2iu( DEFAULT_WIRE_WIDTH_MILS );
m_lastResolvedWidth = schIUScale.MilsToIU( DEFAULT_WIRE_WIDTH_MILS );
else if( layer == LAYER_BUS )
m_lastResolvedWidth = Mils2iu( DEFAULT_BUS_WIDTH_MILS );
m_lastResolvedWidth = schIUScale.MilsToIU( DEFAULT_BUS_WIDTH_MILS );
else
m_lastResolvedWidth = Mils2iu( DEFAULT_LINE_WIDTH_MILS );
m_lastResolvedWidth = schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS );
m_lastResolvedLineStyle = PLOT_DASH_TYPE::SOLID;
m_lastResolvedColor = COLOR4D::UNSPECIFIED;
@ -303,7 +303,7 @@ int SCH_LINE::GetPenWidth() const
if( schematic )
return schematic->Settings().m_DefaultLineWidth;
return Mils2iu( DEFAULT_LINE_WIDTH_MILS );
return schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS );
case LAYER_WIRE:
if( m_stroke.GetWidth() > 0 )

View File

@ -42,7 +42,7 @@ SCH_NO_CONNECT::SCH_NO_CONNECT( const VECTOR2I& pos ) :
SCH_ITEM( nullptr, SCH_NO_CONNECT_T )
{
m_pos = pos;
m_size = Mils2iu( DEFAULT_NOCONNECT_SIZE ); ///< No-connect symbol size.
m_size = schIUScale.MilsToIU( DEFAULT_NOCONNECT_SIZE ); ///< No-connect symbol size.
SetLayer( LAYER_NOCONNECT );
}

View File

@ -162,12 +162,12 @@ static LIB_SYMBOL* dummy()
LIB_SHAPE* square = new LIB_SHAPE( symbol, SHAPE_T::RECT );
square->MoveTo( VECTOR2I( Mils2iu( -200 ), Mils2iu( 200 ) ) );
square->SetEnd( VECTOR2I( Mils2iu( 200 ), Mils2iu( -200 ) ) );
square->MoveTo( VECTOR2I( schIUScale.MilsToIU( -200 ), schIUScale.MilsToIU( 200 ) ) );
square->SetEnd( VECTOR2I( schIUScale.MilsToIU( 200 ), schIUScale.MilsToIU( -200 ) ) );
LIB_TEXT* text = new LIB_TEXT( symbol );
text->SetTextSize( wxSize( Mils2iu( 150 ), Mils2iu( 150 ) ) );
text->SetTextSize( wxSize( schIUScale.MilsToIU( 150 ), schIUScale.MilsToIU( 150 ) ) );
text->SetText( wxString( wxT( "??" ) ) );
symbol->AddDrawItem( square );
@ -229,7 +229,7 @@ void SCH_PAINTER::draw( const EDA_ITEM *aItem, int aLayer, bool aDimmed )
m_gal->SetIsStroke( true );
m_gal->SetStrokeColor( aItem->IsSelected() ? COLOR4D( 1.0, 0.2, 0.2, 1 )
: COLOR4D( 0.2, 0.2, 0.2, 1 ) );
m_gal->SetLineWidth( Mils2iu( 3 ) );
m_gal->SetLineWidth( schIUScale.MilsToIU( 3 ) );
m_gal->DrawRectangle( box.GetOrigin(), box.GetEnd() );
}
@ -350,7 +350,7 @@ float SCH_PAINTER::getShadowWidth( bool aForHighlight ) const
// For best visuals the selection width must be a cross between the zoom level and the
// default line width.
return (float) std::fabs( matrix.GetScale().x * milsWidth ) + Mils2iu( milsWidth );
return (float) std::fabs( matrix.GetScale().x * milsWidth ) + schIUScale.MilsToIU( milsWidth );
}
@ -472,7 +472,7 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM *aItem, int aLayer, bool aDr
float SCH_PAINTER::getLineWidth( const EDA_ITEM* aItem, bool aDrawingShadows ) const
{
wxCHECK( aItem, static_cast<float>( Mils2iu( DEFAULT_LINE_WIDTH_MILS ) ) );
wxCHECK( aItem, static_cast<float>( schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ) ) );
int pen = 0;
@ -1461,9 +1461,9 @@ void SCH_PAINTER::draw( const LIB_PIN *aPin, int aLayer, bool aDimmed )
}
float insideOffset = textOffset - thickness[INSIDE] / 2.0;
float outsideOffset = Mils2iu( PIN_TEXT_MARGIN ) + TARGET_PIN_RADIUS - thickness[OUTSIDE] / 2.0;
float aboveOffset = Mils2iu( PIN_TEXT_MARGIN ) + penWidth / 2.0 + thickness[ABOVE] / 2.0;
float belowOffset = Mils2iu( PIN_TEXT_MARGIN ) + penWidth / 2.0 + thickness[BELOW] / 2.0;
float outsideOffset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + TARGET_PIN_RADIUS - thickness[OUTSIDE] / 2.0;
float aboveOffset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + penWidth / 2.0 + thickness[ABOVE] / 2.0;
float belowOffset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + penWidth / 2.0 + thickness[BELOW] / 2.0;
if( isDangling )
outsideOffset += TARGET_PIN_RADIUS / 2.0;
@ -1615,8 +1615,8 @@ void SCH_PAINTER::draw( const LIB_PIN *aPin, int aLayer, bool aDimmed )
void SCH_PAINTER::drawDanglingSymbol( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth,
bool aDrawingShadows, bool aBrightened )
{
VECTOR2I radius( aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ),
aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ) );
VECTOR2I radius( aWidth + schIUScale.MilsToIU( DANGLING_SYMBOL_SIZE / 2 ),
aWidth + schIUScale.MilsToIU( DANGLING_SYMBOL_SIZE / 2 ) );
// Dangling symbols must be drawn in a slightly different colour so they can be seen when
// they overlap with a junction dot.
@ -1898,7 +1898,7 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
{
if( aText->IsDangling() )
{
drawDanglingSymbol( aText->GetTextPos(), color, Mils2iu( DANGLING_SYMBOL_SIZE / 2 ),
drawDanglingSymbol( aText->GetTextPos(), color, schIUScale.MilsToIU( DANGLING_SYMBOL_SIZE / 2 ),
drawingShadows, aText->IsBrightened() );
}
@ -2481,7 +2481,7 @@ void SCH_PAINTER::draw( const SCH_DIRECTIVE_LABEL *aLabel, int aLayer )
{
if( aLabel->IsDangling() )
{
drawDanglingSymbol( aLabel->GetTextPos(), color, Mils2iu( DANGLING_SYMBOL_SIZE / 2 ),
drawDanglingSymbol( aLabel->GetTextPos(), color, schIUScale.MilsToIU( DANGLING_SYMBOL_SIZE / 2 ),
drawingShadows, aLabel->IsBrightened() );
}

View File

@ -45,8 +45,8 @@ constexpr int Altium2KiCadUnit( const int val, const int frac )
{
constexpr double int_limit = ( std::numeric_limits<int>::max() - 10 ) / 2.54;
double dbase = 10 * Mils2iu( val );
double dfrac = Mils2iu( frac ) / 10000.0;
double dbase = 10 * schIUScale.MilsToIU( val );
double dfrac = schIUScale.MilsToIU( frac ) / 10000.0;
return KiROUND( Clamp<double>( -int_limit, ( dbase + dfrac ) / 10.0, int_limit ) ) * 10;
}

View File

@ -1830,48 +1830,48 @@ VECTOR2I HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_
{
LIB_SHAPE* line1 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line1 );
line1->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line1->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line1->AddPoint( { 0, 0 } );
line1->AddPoint( { 0, Mils2iu( -50 ) } );
line1->AddPoint( { 0, schIUScale.MilsToIU( -50 ) } );
if( aStyle == ASCH_POWER_PORT_STYLE::CIRCLE )
{
LIB_SHAPE* circle = new LIB_SHAPE( aKsymbol, SHAPE_T::CIRCLE );
aKsymbol->AddDrawItem( circle );
circle->SetStroke( STROKE_PARAMS( Mils2iu( 5 ), PLOT_DASH_TYPE::SOLID ) );
circle->SetPosition( { Mils2iu( 0 ), Mils2iu( -75 ) } );
circle->SetEnd( circle->GetPosition() + VECTOR2I( Mils2iu( 25 ), 0 ) );
circle->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 5 ), PLOT_DASH_TYPE::SOLID ) );
circle->SetPosition( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -75 ) } );
circle->SetEnd( circle->GetPosition() + VECTOR2I( schIUScale.MilsToIU( 25 ), 0 ) );
}
else
{
LIB_SHAPE* line2 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line2 );
line2->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line2->AddPoint( { Mils2iu( -25 ), Mils2iu( -50 ) } );
line2->AddPoint( { Mils2iu( 25 ), Mils2iu( -50 ) } );
line2->AddPoint( { Mils2iu( 0 ), Mils2iu( -100 ) } );
line2->AddPoint( { Mils2iu( -25 ), Mils2iu( -50 ) } );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -25 ), schIUScale.MilsToIU( -50 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 25 ), schIUScale.MilsToIU( -50 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( -25 ), schIUScale.MilsToIU( -50 ) } );
}
return { 0, Mils2iu( 150 ) };
return { 0, schIUScale.MilsToIU( 150 ) };
}
else if( aStyle == ASCH_POWER_PORT_STYLE::WAVE )
{
LIB_SHAPE* line = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line );
line->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line->AddPoint( { 0, 0 } );
line->AddPoint( { 0, Mils2iu( -72 ) } );
line->AddPoint( { 0, schIUScale.MilsToIU( -72 ) } );
LIB_SHAPE* bezier = new LIB_SHAPE( aKsymbol, SHAPE_T::BEZIER );
aKsymbol->AddDrawItem( bezier );
bezier->SetStroke( STROKE_PARAMS( Mils2iu( 5 ), PLOT_DASH_TYPE::SOLID ) );
bezier->AddPoint( { Mils2iu( 30 ), Mils2iu( -50 ) } );
bezier->AddPoint( { Mils2iu( 30 ), Mils2iu( -87 ) } );
bezier->AddPoint( { Mils2iu( -30 ), Mils2iu( -63 ) } );
bezier->AddPoint( { Mils2iu( -30 ), Mils2iu( -100 ) } );
bezier->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 5 ), PLOT_DASH_TYPE::SOLID ) );
bezier->AddPoint( { schIUScale.MilsToIU( 30 ), schIUScale.MilsToIU( -50 ) } );
bezier->AddPoint( { schIUScale.MilsToIU( 30 ), schIUScale.MilsToIU( -87 ) } );
bezier->AddPoint( { schIUScale.MilsToIU( -30 ), schIUScale.MilsToIU( -63 ) } );
bezier->AddPoint( { schIUScale.MilsToIU( -30 ), schIUScale.MilsToIU( -100 ) } );
return { 0, Mils2iu( 150 ) };
return { 0, schIUScale.MilsToIU( 150 ) };
}
else if( aStyle == ASCH_POWER_PORT_STYLE::POWER_GROUND
|| aStyle == ASCH_POWER_PORT_STYLE::SIGNAL_GROUND
@ -1880,129 +1880,129 @@ VECTOR2I HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_
{
LIB_SHAPE* line1 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line1 );
line1->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line1->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line1->AddPoint( { 0, 0 } );
line1->AddPoint( { 0, Mils2iu( -100 ) } );
line1->AddPoint( { 0, schIUScale.MilsToIU( -100 ) } );
if( aStyle == ASCH_POWER_PORT_STYLE::POWER_GROUND )
{
LIB_SHAPE* line2 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line2 );
line2->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line2->AddPoint( { Mils2iu( -100 ), Mils2iu( -100 ) } );
line2->AddPoint( { Mils2iu( 100 ), Mils2iu( -100 ) } );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 100 ), schIUScale.MilsToIU( -100 ) } );
LIB_SHAPE* line3 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line3 );
line3->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line3->AddPoint( { Mils2iu( -70 ), Mils2iu( -130 ) } );
line3->AddPoint( { Mils2iu( 70 ), Mils2iu( -130 ) } );
line3->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line3->AddPoint( { schIUScale.MilsToIU( -70 ), schIUScale.MilsToIU( -130 ) } );
line3->AddPoint( { schIUScale.MilsToIU( 70 ), schIUScale.MilsToIU( -130 ) } );
LIB_SHAPE* line4 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line4 );
line4->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line4->AddPoint( { Mils2iu( -40 ), Mils2iu( -160 ) } );
line4->AddPoint( { Mils2iu( 40 ), Mils2iu( -160 ) } );
line4->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line4->AddPoint( { schIUScale.MilsToIU( -40 ), schIUScale.MilsToIU( -160 ) } );
line4->AddPoint( { schIUScale.MilsToIU( 40 ), schIUScale.MilsToIU( -160 ) } );
LIB_SHAPE* line5 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line5 );
line5->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line5->AddPoint( { Mils2iu( -10 ), Mils2iu( -190 ) } );
line5->AddPoint( { Mils2iu( 10 ), Mils2iu( -190 ) } );
line5->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line5->AddPoint( { schIUScale.MilsToIU( -10 ), schIUScale.MilsToIU( -190 ) } );
line5->AddPoint( { schIUScale.MilsToIU( 10 ), schIUScale.MilsToIU( -190 ) } );
}
else if( aStyle == ASCH_POWER_PORT_STYLE::SIGNAL_GROUND )
{
LIB_SHAPE* line2 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line2 );
line2->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line2->AddPoint( { Mils2iu( -100 ), Mils2iu( -100 ) } );
line2->AddPoint( { Mils2iu( 100 ), Mils2iu( -100 ) } );
line2->AddPoint( { Mils2iu( 0 ), Mils2iu( -200 ) } );
line2->AddPoint( { Mils2iu( -100 ), Mils2iu( -100 ) } );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 100 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -200 ) } );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -100 ) } );
}
else if( aStyle == ASCH_POWER_PORT_STYLE::EARTH )
{
LIB_SHAPE* line2 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line2 );
line2->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line2->AddPoint( { Mils2iu( -150 ), Mils2iu( -200 ) } );
line2->AddPoint( { Mils2iu( -100 ), Mils2iu( -100 ) } );
line2->AddPoint( { Mils2iu( 100 ), Mils2iu( -100 ) } );
line2->AddPoint( { Mils2iu( 50 ), Mils2iu( -200 ) } );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -150 ), schIUScale.MilsToIU( -200 ) } );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 100 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 50 ), schIUScale.MilsToIU( -200 ) } );
LIB_SHAPE* line3 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line3 );
line3->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line3->AddPoint( { Mils2iu( 0 ), Mils2iu( -100 ) } );
line3->AddPoint( { Mils2iu( -50 ), Mils2iu( -200 ) } );
line3->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line3->AddPoint( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -100 ) } );
line3->AddPoint( { schIUScale.MilsToIU( -50 ), schIUScale.MilsToIU( -200 ) } );
}
else // ASCH_POWER_PORT_STYLE::GOST_ARROW
{
LIB_SHAPE* line2 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line2 );
line2->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line2->AddPoint( { Mils2iu( -25 ), Mils2iu( -50 ) } );
line2->AddPoint( { Mils2iu( 0 ), Mils2iu( -100 ) } );
line2->AddPoint( { Mils2iu( 25 ), Mils2iu( -50 ) } );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -25 ), schIUScale.MilsToIU( -50 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 25 ), schIUScale.MilsToIU( -50 ) } );
return { 0, Mils2iu( 150 ) }; // special case
return { 0, schIUScale.MilsToIU( 150 ) }; // special case
}
return { 0, Mils2iu( 250 ) };
return { 0, schIUScale.MilsToIU( 250 ) };
}
else if( aStyle == ASCH_POWER_PORT_STYLE::GOST_POWER_GROUND
|| aStyle == ASCH_POWER_PORT_STYLE::GOST_EARTH )
{
LIB_SHAPE* line1 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line1 );
line1->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line1->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line1->AddPoint( { 0, 0 } );
line1->AddPoint( { 0, Mils2iu( -160 ) } );
line1->AddPoint( { 0, schIUScale.MilsToIU( -160 ) } );
LIB_SHAPE* line2 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line2 );
line2->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line2->AddPoint( { Mils2iu( -100 ), Mils2iu( -160 ) } );
line2->AddPoint( { Mils2iu( 100 ), Mils2iu( -160 ) } );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -160 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 100 ), schIUScale.MilsToIU( -160 ) } );
LIB_SHAPE* line3 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line3 );
line3->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line3->AddPoint( { Mils2iu( -60 ), Mils2iu( -200 ) } );
line3->AddPoint( { Mils2iu( 60 ), Mils2iu( -200 ) } );
line3->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line3->AddPoint( { schIUScale.MilsToIU( -60 ), schIUScale.MilsToIU( -200 ) } );
line3->AddPoint( { schIUScale.MilsToIU( 60 ), schIUScale.MilsToIU( -200 ) } );
LIB_SHAPE* line4 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line4 );
line4->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line4->AddPoint( { Mils2iu( -20 ), Mils2iu( -240 ) } );
line4->AddPoint( { Mils2iu( 20 ), Mils2iu( -240 ) } );
line4->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line4->AddPoint( { schIUScale.MilsToIU( -20 ), schIUScale.MilsToIU( -240 ) } );
line4->AddPoint( { schIUScale.MilsToIU( 20 ), schIUScale.MilsToIU( -240 ) } );
if( aStyle == ASCH_POWER_PORT_STYLE::GOST_POWER_GROUND )
return { 0, Mils2iu( 300 ) };
return { 0, schIUScale.MilsToIU( 300 ) };
LIB_SHAPE* circle = new LIB_SHAPE( aKsymbol, SHAPE_T::CIRCLE );
aKsymbol->AddDrawItem( circle );
circle->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
circle->SetPosition( { Mils2iu( 0 ), Mils2iu( -160 ) } );
circle->SetEnd( circle->GetPosition() + VECTOR2I( Mils2iu( 120 ), 0 ) );
circle->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
circle->SetPosition( { schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( -160 ) } );
circle->SetEnd( circle->GetPosition() + VECTOR2I( schIUScale.MilsToIU( 120 ), 0 ) );
return { 0, Mils2iu( 350 ) };
return { 0, schIUScale.MilsToIU( 350 ) };
}
else if( aStyle == ASCH_POWER_PORT_STYLE::GOST_BAR )
{
LIB_SHAPE* line1 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line1 );
line1->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line1->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line1->AddPoint( { 0, 0 } );
line1->AddPoint( { 0, Mils2iu( -200 ) } );
line1->AddPoint( { 0, schIUScale.MilsToIU( -200 ) } );
LIB_SHAPE* line2 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line2 );
line2->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line2->AddPoint( { Mils2iu( -100 ), Mils2iu( -200 ) } );
line2->AddPoint( { Mils2iu( 100 ), Mils2iu( -200 ) } );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -100 ), schIUScale.MilsToIU( -200 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 100 ), schIUScale.MilsToIU( -200 ) } );
return { 0, Mils2iu( 250 ) };
return { 0, schIUScale.MilsToIU( 250 ) };
}
else
{
@ -2014,17 +2014,17 @@ VECTOR2I HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_
LIB_SHAPE* line1 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line1 );
line1->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line1->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line1->AddPoint( { 0, 0 } );
line1->AddPoint( { 0, Mils2iu( -100 ) } );
line1->AddPoint( { 0, schIUScale.MilsToIU( -100 ) } );
LIB_SHAPE* line2 = new LIB_SHAPE( aKsymbol, SHAPE_T::POLY );
aKsymbol->AddDrawItem( line2 );
line2->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
line2->AddPoint( { Mils2iu( -50 ), Mils2iu( -100 ) } );
line2->AddPoint( { Mils2iu( 50 ), Mils2iu( -100 ) } );
line2->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
line2->AddPoint( { schIUScale.MilsToIU( -50 ), schIUScale.MilsToIU( -100 ) } );
line2->AddPoint( { schIUScale.MilsToIU( 50 ), schIUScale.MilsToIU( -100 ) } );
return { 0, Mils2iu( 150 ) };
return { 0, schIUScale.MilsToIU( 150 ) };
}
}
@ -2134,7 +2134,7 @@ void SCH_ALTIUM_PLUGIN::ParseHarnessPort( const ASCH_PORT& aElem )
int height = aElem.Height;
if( height <= 0 )
height = Mils2iu( 100 ); // chose default 50 grid
height = schIUScale.MilsToIU( 100 ); // chose default 50 grid
textBox->SetStartX( ( aElem.Location + m_sheetOffset ).x );
textBox->SetStartY( ( aElem.Location + m_sheetOffset ).y - ( height / 2 ) );
@ -2296,7 +2296,7 @@ void SCH_ALTIUM_PLUGIN::ParsePort( const ASCH_PORT& aElem )
{
SCH_LINE* wire = new SCH_LINE( start, SCH_LAYER_ID::LAYER_WIRE );
wire->SetEndPoint( end );
wire->SetLineWidth( Mils2iu( 2 ) );
wire->SetLineWidth( schIUScale.MilsToIU( 2 ) );
wire->SetFlags( IS_NEW );
m_currentSheet->GetScreen()->Append( wire );
}
@ -2304,7 +2304,7 @@ void SCH_ALTIUM_PLUGIN::ParsePort( const ASCH_PORT& aElem )
{
SCH_LINE* wire = new SCH_LINE( start, SCH_LAYER_ID::LAYER_BUS );
wire->SetEndPoint( end );
wire->SetLineWidth( Mils2iu( 2 ) );
wire->SetLineWidth( schIUScale.MilsToIU( 2 ) );
wire->SetFlags( IS_NEW );
m_currentSheet->GetScreen()->Append( wire );
}

View File

@ -282,8 +282,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSheets()
for( LAYER_ID sheetID : orphanSheets )
{
VECTOR2I pos( x * Mils2iu( 1000 ), y * Mils2iu( 1000 ) );
wxSize siz( Mils2iu( 1000 ), Mils2iu( 1000 ) );
VECTOR2I pos( x * schIUScale.MilsToIU( 1000 ), y * schIUScale.MilsToIU( 1000 ) );
wxSize siz( schIUScale.MilsToIU( 1000 ), schIUScale.MilsToIU( 1000 ) );
loadSheetAndChildSheets( sheetID, pos, siz, rootPath );
@ -664,7 +664,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
SCH_GLOBALLABEL* netLabel = new SCH_GLOBALLABEL;
netLabel->SetPosition( getKiCadPoint( (VECTOR2I)sym.Origin + terminalPosOffset ) );
netLabel->SetText( "***UNKNOWN NET****" ); // This should be later updated when we load the netlist
netLabel->SetTextSize( wxSize( Mils2iu( 50 ), Mils2iu( 50 ) ) );
netLabel->SetTextSize( wxSize( schIUScale.MilsToIU( 50 ), schIUScale.MilsToIU( 50 ) ) );
SYMDEF_SCM symbolDef = Library.SymbolDefinitions.at( sym.SymdefID );
@ -2417,7 +2417,7 @@ int CADSTAR_SCH_ARCHIVE_LOADER::getLineThickness( const LINECODE_ID& aCadstarLin
{
wxCHECK( Assignments.Codedefs.LineCodes.find( aCadstarLineCodeID )
!= Assignments.Codedefs.LineCodes.end(),
Mils2iu( DEFAULT_WIRE_WIDTH_MILS ) );
schIUScale.MilsToIU( DEFAULT_WIRE_WIDTH_MILS ) );
return getKiCadLength( Assignments.Codedefs.LineCodes.at( aCadstarLineCodeID ).Width );
}

View File

@ -704,7 +704,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
while( sheetNode )
{
VECTOR2I pos = VECTOR2I( x * Mils2iu( 1000 ), y * Mils2iu( 1000 ) );
VECTOR2I pos = VECTOR2I( x * schIUScale.MilsToIU( 1000 ), y * schIUScale.MilsToIU( 1000 ) );
std::unique_ptr<SCH_SHEET> sheet = std::make_unique<SCH_SHEET>( m_rootSheet, pos );
SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
wxString pageNo = wxString::Format( wxT( "%d" ), i );
@ -937,7 +937,7 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
// Calculate the new sheet size.
BOX2I sheetBoundingBox = getSheetBbox( m_currentSheet );
VECTOR2I targetSheetSize = sheetBoundingBox.GetSize();
targetSheetSize += VECTOR2I( Mils2iu( 1500 ), Mils2iu( 1500 ) );
targetSheetSize += VECTOR2I( schIUScale.MilsToIU( 1500 ), schIUScale.MilsToIU( 1500 ) );
// Get current Eeschema sheet size.
wxSize pageSizeIU = m_currentSheet->GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS );
@ -959,8 +959,8 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
// round the translation to nearest 100mil to place it on the grid.
VECTOR2I translation = sheetcentre - itemsCentre;
translation.x = translation.x - translation.x % Mils2iu( 100 );
translation.y = translation.y - translation.y % Mils2iu( 100 );
translation.x = translation.x - translation.x % schIUScale.MilsToIU( 100 );
translation.y = translation.y - translation.y % schIUScale.MilsToIU( 100 );
// Add global net labels for the named power input pins in this sheet
for( SCH_ITEM* item : m_currentSheet->GetScreen()->Items().OfType( SCH_SYMBOL_T ) )
@ -1139,7 +1139,7 @@ void SCH_EAGLE_PLUGIN::loadSegments( wxXmlNode* aSegmentsNode, const wxString& n
{
label->SetPosition( firstWire->GetStartPoint() );
label->SetText( escapeName( netName ) );
label->SetTextSize( wxSize( Mils2iu( 40 ), Mils2iu( 40 ) ) );
label->SetTextSize( wxSize( schIUScale.MilsToIU( 40 ), schIUScale.MilsToIU( 40 ) ) );
if( firstWire->GetEndPoint().x > firstWire->GetStartPoint().x )
label->SetTextSpinStyle( TEXT_SPIN_STYLE::LEFT );
@ -1932,20 +1932,20 @@ LIB_PIN* SCH_EAGLE_PLUGIN::loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol, wxXmlN
default: wxFAIL_MSG( wxString::Format( wxT( "Unhandled orientation (%d degrees)." ), roti ) );
}
pin->SetLength( Mils2iu( 300 ) ); // Default pin length when not defined.
pin->SetLength( schIUScale.MilsToIU( 300 ) ); // Default pin length when not defined.
if( aEPin->length )
{
wxString length = aEPin->length.Get();
if( length == wxT( "short" ) )
pin->SetLength( Mils2iu( 100 ) );
pin->SetLength( schIUScale.MilsToIU( 100 ) );
else if( length == wxT( "middle" ) )
pin->SetLength( Mils2iu( 200 ) );
pin->SetLength( schIUScale.MilsToIU( 200 ) );
else if( length == wxT( "long" ) )
pin->SetLength( Mils2iu( 300 ) );
pin->SetLength( schIUScale.MilsToIU( 300 ) );
else if( length == wxT( "point" ) )
pin->SetLength( Mils2iu( 0 ) );
pin->SetLength( schIUScale.MilsToIU( 0 ) );
}
// emulate the visibility of pin elements
@ -2041,15 +2041,15 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
if( !eframe.border_left )
{
lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY );
lines->AddPoint( VECTOR2I( xMin + Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) );
lines->AddPoint( VECTOR2I( xMin + Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) );
lines->AddPoint( VECTOR2I( xMin + schIUScale.MilsToIU( 150 ), yMin + schIUScale.MilsToIU( 150 ) ) );
lines->AddPoint( VECTOR2I( xMin + schIUScale.MilsToIU( 150 ), yMax - schIUScale.MilsToIU( 150 ) ) );
aItems.push_back( lines );
int i;
int height = yMax - yMin;
int x1 = xMin;
int x2 = x1 + Mils2iu( 150 );
int legendPosX = xMin + Mils2iu( 75 );
int x2 = x1 + schIUScale.MilsToIU( 150 );
int legendPosX = xMin + schIUScale.MilsToIU( 75 );
double rowSpacing = height / double( eframe.rows );
double legendPosY = yMax - ( rowSpacing / 2 );
@ -2069,7 +2069,7 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
LIB_TEXT* legendText = new LIB_TEXT( nullptr );
legendText->SetPosition( VECTOR2I( legendPosX, KiROUND( legendPosY ) ) );
legendText->SetText( wxString( legendChar ) );
legendText->SetTextSize( wxSize( Mils2iu( 90 ), Mils2iu( 100 ) ) );
legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), schIUScale.MilsToIU( 100 ) ) );
aItems.push_back( legendText );
legendChar++;
legendPosY -= rowSpacing;
@ -2079,15 +2079,15 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
if( !eframe.border_right )
{
lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY );
lines->AddPoint( VECTOR2I( xMax - Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) );
lines->AddPoint( VECTOR2I( xMax - Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) );
lines->AddPoint( VECTOR2I( xMax - schIUScale.MilsToIU( 150 ), yMin + schIUScale.MilsToIU( 150 ) ) );
lines->AddPoint( VECTOR2I( xMax - schIUScale.MilsToIU( 150 ), yMax - schIUScale.MilsToIU( 150 ) ) );
aItems.push_back( lines );
int i;
int height = yMax - yMin;
int x1 = xMax - Mils2iu( 150 );
int x1 = xMax - schIUScale.MilsToIU( 150 );
int x2 = xMax;
int legendPosX = xMax - Mils2iu( 75 );
int legendPosX = xMax - schIUScale.MilsToIU( 75 );
double rowSpacing = height / double( eframe.rows );
double legendPosY = yMax - ( rowSpacing / 2 );
@ -2107,7 +2107,7 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
LIB_TEXT* legendText = new LIB_TEXT( nullptr );
legendText->SetPosition( VECTOR2I( legendPosX, KiROUND( legendPosY ) ) );
legendText->SetText( wxString( legendChar ) );
legendText->SetTextSize( wxSize( Mils2iu( 90 ), Mils2iu( 100 ) ) );
legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), schIUScale.MilsToIU( 100 ) ) );
aItems.push_back( legendText );
legendChar++;
legendPosY -= rowSpacing;
@ -2117,15 +2117,15 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
if( !eframe.border_top )
{
lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY );
lines->AddPoint( VECTOR2I( xMax - Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) );
lines->AddPoint( VECTOR2I( xMin + Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) );
lines->AddPoint( VECTOR2I( xMax - schIUScale.MilsToIU( 150 ), yMax - schIUScale.MilsToIU( 150 ) ) );
lines->AddPoint( VECTOR2I( xMin + schIUScale.MilsToIU( 150 ), yMax - schIUScale.MilsToIU( 150 ) ) );
aItems.push_back( lines );
int i;
int width = xMax - xMin;
int y1 = yMin;
int y2 = yMin + Mils2iu( 150 );
int legendPosY = yMax - Mils2iu( 75 );
int y2 = yMin + schIUScale.MilsToIU( 150 );
int legendPosY = yMax - schIUScale.MilsToIU( 75 );
double columnSpacing = width / double( eframe.columns );
double legendPosX = xMin + ( columnSpacing / 2 );
@ -2145,7 +2145,7 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
LIB_TEXT* legendText = new LIB_TEXT( nullptr );
legendText->SetPosition( VECTOR2I( KiROUND( legendPosX ), legendPosY ) );
legendText->SetText( wxString( legendChar ) );
legendText->SetTextSize( wxSize( Mils2iu( 90 ), Mils2iu( 100 ) ) );
legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), schIUScale.MilsToIU( 100 ) ) );
aItems.push_back( legendText );
legendChar++;
legendPosX += columnSpacing;
@ -2155,15 +2155,15 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
if( !eframe.border_bottom )
{
lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY );
lines->AddPoint( VECTOR2I( xMax - Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) );
lines->AddPoint( VECTOR2I( xMin + Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) );
lines->AddPoint( VECTOR2I( xMax - schIUScale.MilsToIU( 150 ), yMin + schIUScale.MilsToIU( 150 ) ) );
lines->AddPoint( VECTOR2I( xMin + schIUScale.MilsToIU( 150 ), yMin + schIUScale.MilsToIU( 150 ) ) );
aItems.push_back( lines );
int i;
int width = xMax - xMin;
int y1 = yMax - Mils2iu( 150 );
int y1 = yMax - schIUScale.MilsToIU( 150 );
int y2 = yMax;
int legendPosY = yMin + Mils2iu( 75 );
int legendPosY = yMin + schIUScale.MilsToIU( 75 );
double columnSpacing = width / double( eframe.columns );
double legendPosX = xMin + ( columnSpacing / 2 );
@ -2183,7 +2183,7 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
LIB_TEXT* legendText = new LIB_TEXT( nullptr );
legendText->SetPosition( VECTOR2I( KiROUND( legendPosX ), legendPosY ) );
legendText->SetText( wxString( legendChar ) );
legendText->SetTextSize( wxSize( Mils2iu( 90 ), Mils2iu( 100 ) ) );
legendText->SetTextSize( wxSize( schIUScale.MilsToIU( 90 ), schIUScale.MilsToIU( 100 ) ) );
aItems.push_back( legendText );
legendChar++;
legendPosX += columnSpacing;
@ -2296,7 +2296,7 @@ void SCH_EAGLE_PLUGIN::adjustNetLabels()
// Create a vector pointing in the direction of the wire, 50 mils long
VECTOR2I wireDirection( segAttached->B - segAttached->A );
wireDirection = wireDirection.Resize( Mils2iu( 50 ) );
wireDirection = wireDirection.Resize( schIUScale.MilsToIU( 50 ) );
const VECTOR2I origPos( labelPos );
// Flags determining the search direction
@ -2402,8 +2402,8 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
auto entrySize =
[]( int signX, int signY ) -> VECTOR2I
{
return VECTOR2I( Mils2iu( DEFAULT_SCH_ENTRY_SIZE ) * signX,
Mils2iu( DEFAULT_SCH_ENTRY_SIZE ) * signY );
return VECTOR2I( schIUScale.MilsToIU( DEFAULT_SCH_ENTRY_SIZE ) * signX,
schIUScale.MilsToIU( DEFAULT_SCH_ENTRY_SIZE ) * signY );
};
auto testBusHit =
@ -2976,7 +2976,7 @@ void SCH_EAGLE_PLUGIN::addImplicitConnections( SCH_SYMBOL* aSymbol, SCH_SCREEN*
SCH_GLOBALLABEL* netLabel = new SCH_GLOBALLABEL;
netLabel->SetPosition( aSymbol->GetPinPhysicalPosition( pin ) );
netLabel->SetText( extractNetName( pin->GetName() ) );
netLabel->SetTextSize( wxSize( Mils2iu( 40 ), Mils2iu( 40 ) ) );
netLabel->SetTextSize( wxSize( schIUScale.MilsToIU( 40 ), schIUScale.MilsToIU( 40 ) ) );
switch( pin->GetOrientation() )
{

View File

@ -165,12 +165,12 @@ void SCH_SEXPR_PLUGIN_CACHE::SaveSymbol( LIB_SYMBOL* aSymbol, OUTPUTFORMATTER& a
if( !aSymbol->ShowPinNumbers() )
aFormatter.Print( 0, " (pin_numbers hide)" );
if( aSymbol->GetPinNameOffset() != Mils2iu( DEFAULT_PIN_NAME_OFFSET )
if( aSymbol->GetPinNameOffset() != schIUScale.MilsToIU( DEFAULT_PIN_NAME_OFFSET )
|| !aSymbol->ShowPinNames() )
{
aFormatter.Print( 0, " (pin_names" );
if( aSymbol->GetPinNameOffset() != Mils2iu( DEFAULT_PIN_NAME_OFFSET ) )
if( aSymbol->GetPinNameOffset() != schIUScale.MilsToIU( DEFAULT_PIN_NAME_OFFSET ) )
aFormatter.Print( 0, " (offset %s)",
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aSymbol->GetPinNameOffset() ).c_str() );

View File

@ -930,7 +930,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseArc()
VECTOR2I midPoint( 1, 1 );
VECTOR2I endPoint( 0, 1 );
bool hasMidPoint = false;
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
STROKE_PARAMS stroke( schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
FILL_PARAMS fill;
// Parameters for legacy format
@ -1076,7 +1076,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseBezier()
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a bezier." ) );
T token;
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
STROKE_PARAMS stroke( schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
FILL_PARAMS fill;
std::unique_ptr<LIB_SHAPE> bezier = std::make_unique<LIB_SHAPE>( nullptr, SHAPE_T::BEZIER );
@ -1159,7 +1159,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseCircle()
T token;
VECTOR2I center( 0, 0 );
int radius = 1; // defaulting to 0 could result in troublesome math....
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
STROKE_PARAMS stroke( schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
FILL_PARAMS fill;
std::unique_ptr<LIB_SHAPE> circle = std::make_unique<LIB_SHAPE>( nullptr, SHAPE_T::CIRCLE );
@ -1344,7 +1344,7 @@ LIB_PIN* SCH_SEXPR_PARSER::parsePin()
{
// The EDA_TEXT font effects formatting is used so use and EDA_TEXT object
// so duplicate parsing is not required.
EDA_TEXT text( Mils2iu( DEFAULT_SIZE_TEXT ) );
EDA_TEXT text( schIUScale.MilsToIU( DEFAULT_SIZE_TEXT ) );
parseEDA_TEXT( &text, true );
pin->SetNameTextSize( text.GetTextHeight() );
@ -1378,7 +1378,7 @@ LIB_PIN* SCH_SEXPR_PARSER::parsePin()
{
// The EDA_TEXT font effects formatting is used so use and EDA_TEXT object
// so duplicate parsing is not required.
EDA_TEXT text( Mils2iu( DEFAULT_SIZE_TEXT ) );
EDA_TEXT text( schIUScale.MilsToIU( DEFAULT_SIZE_TEXT ) );
parseEDA_TEXT( &text, false );
pin->SetNumberTextSize( text.GetTextHeight() );
@ -1433,7 +1433,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parsePolyLine()
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a poly." ) );
T token;
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
STROKE_PARAMS stroke( schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
FILL_PARAMS fill;
std::unique_ptr<LIB_SHAPE> poly = std::make_unique<LIB_SHAPE>( nullptr, SHAPE_T::POLY );
@ -1501,7 +1501,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseRectangle()
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a rectangle." ) );
T token;
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
STROKE_PARAMS stroke( schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
FILL_PARAMS fill;
std::unique_ptr<LIB_SHAPE> rectangle = std::make_unique<LIB_SHAPE>( nullptr, SHAPE_T::RECT );
@ -1621,7 +1621,7 @@ LIB_TEXTBOX* SCH_SEXPR_PARSER::parseTextBox()
VECTOR2I size;
bool foundEnd = false;
bool foundSize = false;
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
STROKE_PARAMS stroke( schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
FILL_PARAMS fill;
std::unique_ptr<LIB_TEXTBOX> textBox = std::make_unique<LIB_TEXTBOX>( nullptr );
@ -2803,7 +2803,7 @@ SCH_SHEET* SCH_SEXPR_PARSER::parseSheet()
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a sheet." ) );
T token;
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
STROKE_PARAMS stroke( schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
FILL_PARAMS fill;
SCH_FIELD* field;
std::vector<SCH_FIELD> fields;
@ -3003,7 +3003,7 @@ SCH_BUS_WIRE_ENTRY* SCH_SEXPR_PARSER::parseBusEntry()
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a bus entry." ) );
T token;
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
STROKE_PARAMS stroke( schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
std::unique_ptr<SCH_BUS_WIRE_ENTRY> busEntry = std::make_unique<SCH_BUS_WIRE_ENTRY>();
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
@ -3054,7 +3054,7 @@ SCH_BUS_WIRE_ENTRY* SCH_SEXPR_PARSER::parseBusEntry()
SCH_SHAPE* SCH_SEXPR_PARSER::parseSchPolyLine()
{
T token;
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
STROKE_PARAMS stroke( schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
FILL_PARAMS fill;
int layer = LAYER_NOTES;
@ -3118,7 +3118,7 @@ SCH_LINE* SCH_SEXPR_PARSER::parseLine()
// parseSchPolyLine() that can handle true polygons, and not only one segment.
T token;
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
STROKE_PARAMS stroke( schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
int layer;
switch( CurTok() )
@ -3190,7 +3190,7 @@ SCH_SHAPE* SCH_SEXPR_PARSER::parseSchArc()
VECTOR2I startPoint;
VECTOR2I midPoint;
VECTOR2I endPoint;
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
STROKE_PARAMS stroke( schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
FILL_PARAMS fill;
std::unique_ptr<SCH_SHAPE> arc = std::make_unique<SCH_SHAPE>( SHAPE_T::ARC );
@ -3254,7 +3254,7 @@ SCH_SHAPE* SCH_SEXPR_PARSER::parseSchCircle()
T token;
VECTOR2I center;
int radius = 0;
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
STROKE_PARAMS stroke( schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
FILL_PARAMS fill;
std::unique_ptr<SCH_SHAPE> circle = std::make_unique<SCH_SHAPE>( SHAPE_T::CIRCLE );
@ -3312,7 +3312,7 @@ SCH_SHAPE* SCH_SEXPR_PARSER::parseSchRectangle()
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a rectangle." ) );
T token;
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
STROKE_PARAMS stroke( schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
FILL_PARAMS fill;
std::unique_ptr<SCH_SHAPE> rectangle = std::make_unique<SCH_SHAPE>( SHAPE_T::RECT );
@ -3367,7 +3367,7 @@ SCH_SHAPE* SCH_SEXPR_PARSER::parseSchBezier()
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a bezier." ) );
T token;
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
STROKE_PARAMS stroke( schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
FILL_PARAMS fill;
std::unique_ptr<SCH_SHAPE> bezier = std::make_unique<SCH_SHAPE>( SHAPE_T::BEZIER );
@ -3606,7 +3606,7 @@ SCH_TEXTBOX* SCH_SEXPR_PARSER::parseSchTextBox()
VECTOR2I size;
bool foundEnd = false;
bool foundSize = false;
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
STROKE_PARAMS stroke( schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
FILL_PARAMS fill;
std::unique_ptr<SCH_TEXTBOX> textBox = std::make_unique<SCH_TEXTBOX>();

View File

@ -842,7 +842,7 @@ void SCH_SEXPR_PLUGIN::saveField( SCH_FIELD* aField, int aNestLevel )
m_out->Print( aNestLevel, " (show_name)" );
if( !aField->IsDefaultFormatting()
|| ( aField->GetTextHeight() != Mils2iu( DEFAULT_SIZE_TEXT ) ) )
|| ( aField->GetTextHeight() != schIUScale.MilsToIU( DEFAULT_SIZE_TEXT ) ) )
{
m_out->Print( 0, "\n" );
aField->Format( m_out, aNestLevel, 0 );

View File

@ -326,7 +326,7 @@ LIB_SYMBOL* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorV
}
pos += tmp.size() + 1;
symbol->SetPinNameOffset( Mils2Iu( (int)num ) );
symbol->SetPinNameOffset( schIUScale.MilsToIU( (int)num ) );
tmp = tokens.GetNextToken(); // Show pin numbers.
@ -566,13 +566,13 @@ void SCH_LEGACY_PLUGIN_CACHE::loadField( std::unique_ptr<LIB_SYMBOL>& aSymbol,
VECTOR2I pos;
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
pos.y = Mils2Iu( parseInt( aReader, line, &line ) );
pos.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
pos.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
field->SetPosition( pos );
wxSize textSize;
textSize.x = textSize.y = Mils2Iu( parseInt( aReader, line, &line ) );
textSize.x = textSize.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
field->SetTextSize( textSize );
char textOrient = parseChar( aReader, line, &line );
@ -758,12 +758,12 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadArc( std::unique_ptr<LIB_SYMBOL>& aSymbo
VECTOR2I center;
center.x = Mils2Iu( parseInt( aReader, line, &line ) );
center.y = Mils2Iu( parseInt( aReader, line, &line ) );
center.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
center.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
arc->SetPosition( center );
(void) Mils2Iu( parseInt( aReader, line, &line ) );
(void) schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
EDA_ANGLE angle1( parseInt( aReader, line, &line ), TENTHS_OF_A_DEGREE_T );
EDA_ANGLE angle2( parseInt( aReader, line, &line ), TENTHS_OF_A_DEGREE_T );
@ -771,7 +771,7 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadArc( std::unique_ptr<LIB_SYMBOL>& aSymbo
arc->SetUnit( parseInt( aReader, line, &line ) );
arc->SetConvert( parseInt( aReader, line, &line ) );
STROKE_PARAMS stroke( Mils2Iu( parseInt( aReader, line, &line ) ), PLOT_DASH_TYPE::SOLID );
STROKE_PARAMS stroke( schIUScale.MilsToIU( parseInt( aReader, line, &line ) ), PLOT_DASH_TYPE::SOLID );
arc->SetStroke( stroke );
@ -785,10 +785,10 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadArc( std::unique_ptr<LIB_SYMBOL>& aSymbo
{
VECTOR2I arcStart, arcEnd;
arcStart.x = Mils2Iu( parseInt( aReader, line, &line ) );
arcStart.y = Mils2Iu( parseInt( aReader, line, &line ) );
arcEnd.x = Mils2Iu( parseInt( aReader, line, &line ) );
arcEnd.y = Mils2Iu( parseInt( aReader, line, &line ) );
arcStart.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
arcStart.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
arcEnd.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
arcEnd.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
arc->SetStart( arcStart );
arc->SetEnd( arcEnd );
@ -842,17 +842,17 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadCircle( std::unique_ptr<LIB_SYMBOL>& aSy
VECTOR2I center;
center.x = Mils2Iu( parseInt( aReader, line, &line ) );
center.y = Mils2Iu( parseInt( aReader, line, &line ) );
center.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
center.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
int radius = Mils2Iu( parseInt( aReader, line, &line ) );
int radius = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
circle->SetStart( center );
circle->SetEnd( VECTOR2I( center.x + radius, center.y ) );
circle->SetUnit( parseInt( aReader, line, &line ) );
circle->SetConvert( parseInt( aReader, line, &line ) );
STROKE_PARAMS stroke( Mils2Iu( parseInt( aReader, line, &line ) ), PLOT_DASH_TYPE::SOLID );
STROKE_PARAMS stroke( schIUScale.MilsToIU( parseInt( aReader, line, &line ) ), PLOT_DASH_TYPE::SOLID );
circle->SetStroke( stroke );
@ -879,13 +879,13 @@ LIB_TEXT* SCH_LEGACY_PLUGIN_CACHE::loadText( std::unique_ptr<LIB_SYMBOL>& aSymbo
VECTOR2I center;
center.x = Mils2Iu( parseInt( aReader, line, &line ) );
center.y = Mils2Iu( parseInt( aReader, line, &line ) );
center.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
center.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
text->SetPosition( center );
wxSize size;
size.x = size.y = Mils2Iu( parseInt( aReader, line, &line ) );
size.x = size.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
text->SetTextSize( size );
text->SetVisible( !parseInt( aReader, line, &line ) );
text->SetUnit( parseInt( aReader, line, &line ) );
@ -973,20 +973,20 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadRect( std::unique_ptr<LIB_SYMBOL>& aSymb
VECTOR2I pos;
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
pos.y = Mils2Iu( parseInt( aReader, line, &line ) );
pos.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
pos.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
rectangle->SetPosition( pos );
VECTOR2I end;
end.x = Mils2Iu( parseInt( aReader, line, &line ) );
end.y = Mils2Iu( parseInt( aReader, line, &line ) );
end.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
end.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
rectangle->SetEnd( end );
rectangle->SetUnit( parseInt( aReader, line, &line ) );
rectangle->SetConvert( parseInt( aReader, line, &line ) );
STROKE_PARAMS stroke( Mils2Iu( parseInt( aReader, line, &line ) ), PLOT_DASH_TYPE::SOLID );
STROKE_PARAMS stroke( schIUScale.MilsToIU( parseInt( aReader, line, &line ) ), PLOT_DASH_TYPE::SOLID );
rectangle->SetStroke( stroke );
@ -1036,7 +1036,7 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol,
}
pos += tmp.size() + 1;
position.x = Mils2Iu( (int) num );
position.x = schIUScale.MilsToIU( (int) num );
tmp = tokens.GetNextToken();
@ -1047,7 +1047,7 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol,
}
pos += tmp.size() + 1;
position.y = Mils2Iu( (int) num );
position.y = schIUScale.MilsToIU( (int) num );
tmp = tokens.GetNextToken();
@ -1058,7 +1058,7 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol,
}
pos += tmp.size() + 1;
int length = Mils2Iu( (int) num );
int length = schIUScale.MilsToIU( (int) num );
tmp = tokens.GetNextToken();
@ -1081,7 +1081,7 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol,
}
pos += tmp.size() + 1;
int numberTextSize = Mils2Iu( (int) num );
int numberTextSize = schIUScale.MilsToIU( (int) num );
tmp = tokens.GetNextToken();
@ -1092,7 +1092,7 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol,
}
pos += tmp.size() + 1;
int nameTextSize = Mils2Iu( (int) num );
int nameTextSize = schIUScale.MilsToIU( (int) num );
tmp = tokens.GetNextToken();
@ -1228,7 +1228,7 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadPolyLine( std::unique_ptr<LIB_SYMBOL>& a
polyLine->SetUnit( parseInt( aReader, line, &line ) );
polyLine->SetConvert( parseInt( aReader, line, &line ) );
STROKE_PARAMS stroke( Mils2Iu( parseInt( aReader, line, &line ) ), PLOT_DASH_TYPE::SOLID );
STROKE_PARAMS stroke( schIUScale.MilsToIU( parseInt( aReader, line, &line ) ), PLOT_DASH_TYPE::SOLID );
polyLine->SetStroke( stroke );
@ -1236,8 +1236,8 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadPolyLine( std::unique_ptr<LIB_SYMBOL>& a
for( int i = 0; i < points; i++ )
{
pt.x = Mils2Iu( parseInt( aReader, line, &line ) );
pt.y = Mils2Iu( parseInt( aReader, line, &line ) );
pt.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
pt.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
polyLine->AddPoint( pt );
}
@ -1264,26 +1264,26 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadBezier( std::unique_ptr<LIB_SYMBOL>& aSy
bezier->SetUnit( parseInt( aReader, line, &line ) );
bezier->SetConvert( parseInt( aReader, line, &line ) );
STROKE_PARAMS stroke ( Mils2Iu( parseInt( aReader, line, &line ) ), PLOT_DASH_TYPE::SOLID );
STROKE_PARAMS stroke ( schIUScale.MilsToIU( parseInt( aReader, line, &line ) ), PLOT_DASH_TYPE::SOLID );
bezier->SetStroke( stroke );
VECTOR2I pt;
pt.x = Mils2Iu( parseInt( aReader, line, &line ) );
pt.y = Mils2Iu( parseInt( aReader, line, &line ) );
pt.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
pt.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
bezier->SetStart( pt );
pt.x = Mils2Iu( parseInt( aReader, line, &line ) );
pt.y = Mils2Iu( parseInt( aReader, line, &line ) );
pt.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
pt.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
bezier->SetBezierC1( pt );
pt.x = Mils2Iu( parseInt( aReader, line, &line ) );
pt.y = Mils2Iu( parseInt( aReader, line, &line ) );
pt.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
pt.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
bezier->SetBezierC2( pt );
pt.x = Mils2Iu( parseInt( aReader, line, &line ) );
pt.y = Mils2Iu( parseInt( aReader, line, &line ) );
pt.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
pt.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
bezier->SetEnd( pt );
bezier->RebuildBezierToSegmentsPointsList( bezier->GetWidth() );

View File

@ -534,14 +534,14 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
{
VECTOR2I position;
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
position.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
position.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
sheet->SetPosition( position );
wxSize size;
size.SetWidth( Mils2Iu( parseInt( aReader, line, &line ) ) );
size.SetHeight( Mils2Iu( parseInt( aReader, line, &line ) ) );
size.SetWidth( schIUScale.MilsToIU( parseInt( aReader, line, &line ) ) );
size.SetHeight( schIUScale.MilsToIU( parseInt( aReader, line, &line ) ) );
sheet->SetSize( size );
}
else if( strCompare( "U", line, &line ) ) // Sheet UUID.
@ -563,7 +563,7 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
if( fieldId == 0 || fieldId == 1 ) // Sheet name and file name.
{
parseQuotedString( text, aReader, line, &line );
size = Mils2Iu( parseInt( aReader, line, &line ) );
size = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
SCH_FIELD& field = sheet->GetFields()[ fieldId ];
field.SetText( text );
@ -606,11 +606,11 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
VECTOR2I position;
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
position.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
position.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
sheetPin->SetPosition( position );
size = Mils2Iu( parseInt( aReader, line, &line ) );
size = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
sheetPin->SetTextSize( wxSize( size, size ) );
@ -648,8 +648,8 @@ SCH_BITMAP* SCH_LEGACY_PLUGIN::loadBitmap( LINE_READER& aReader )
{
VECTOR2I position;
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
position.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
position.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
bitmap->SetPosition( position );
}
else if( strCompare( "Scale", line, &line ) )
@ -735,8 +735,8 @@ SCH_JUNCTION* SCH_LEGACY_PLUGIN::loadJunction( LINE_READER& aReader )
VECTOR2I position;
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
position.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
position.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
junction->SetPosition( position );
return junction.release();
@ -757,8 +757,8 @@ SCH_NO_CONNECT* SCH_LEGACY_PLUGIN::loadNoConnect( LINE_READER& aReader )
VECTOR2I position;
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
position.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
position.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
no_connect->SetPosition( position );
return no_connect.release();
@ -798,7 +798,7 @@ SCH_LINE* SCH_LEGACY_PLUGIN::loadWire( LINE_READER& aReader )
else if( buf == T_WIDTH )
{
int size = Mils2Iu( parseInt( aReader, line, &line ) );
int size = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
wire->SetLineWidth( size );
}
else if( buf == T_STYLE )
@ -858,10 +858,10 @@ SCH_LINE* SCH_LEGACY_PLUGIN::loadWire( LINE_READER& aReader )
VECTOR2I begin, end;
begin.x = Mils2Iu( parseInt( aReader, line, &line ) );
begin.y = Mils2Iu( parseInt( aReader, line, &line ) );
end.x = Mils2Iu( parseInt( aReader, line, &line ) );
end.y = Mils2Iu( parseInt( aReader, line, &line ) );
begin.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
begin.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
end.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
end.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
wire->SetStartPoint( begin );
wire->SetEndPoint( end );
@ -900,10 +900,10 @@ SCH_BUS_ENTRY_BASE* SCH_LEGACY_PLUGIN::loadBusEntry( LINE_READER& aReader )
VECTOR2I pos;
wxSize size;
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
pos.y = Mils2Iu( parseInt( aReader, line, &line ) );
size.x = Mils2Iu( parseInt( aReader, line, &line ) );
size.y = Mils2Iu( parseInt( aReader, line, &line ) );
pos.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
pos.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
size.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
size.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
size.x -= pos.x;
size.y -= pos.y;
@ -954,8 +954,8 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( LINE_READER& aReader )
// Parse the parameters common to all text objects.
VECTOR2I position;
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
position.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
position.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
text->SetPosition( position );
int spinStyle = parseInt( aReader, line, &line );
@ -978,7 +978,7 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( LINE_READER& aReader )
text->SetTextSpinStyle( static_cast<TEXT_SPIN_STYLE::SPIN>( spinStyle ) );
int size = Mils2Iu( parseInt( aReader, line, &line ) );
int size = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
text->SetTextSize( wxSize( size, size ) );
@ -1145,8 +1145,8 @@ SCH_SYMBOL* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader )
{
VECTOR2I pos;
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
pos.y = Mils2Iu( parseInt( aReader, line, &line ) );
pos.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
pos.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
symbol->SetPosition( pos );
}
else if( strCompare( "AR", line, &line ) )
@ -1215,9 +1215,9 @@ SCH_SYMBOL* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader )
char orientation = parseChar( aReader, line, &line );
VECTOR2I pos;
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
pos.y = Mils2Iu( parseInt( aReader, line, &line ) );
int size = Mils2Iu( parseInt( aReader, line, &line ) );
pos.x = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
pos.y = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
int size = schIUScale.MilsToIU( parseInt( aReader, line, &line ) );
int attributes = parseHex( aReader, line, &line );
if( index >= symbol->GetFieldCount() )

View File

@ -27,8 +27,6 @@
THROW_PARSE_ERROR( text, reader.GetSource(), reader.Line(), \
reader.LineNumber(), pos - reader.Line() )
#define Mils2Iu( x ) Mils2iu( x )
class LINE_READER;
class wxString;

View File

@ -75,7 +75,7 @@ SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL( wxWindow* aParentWindow, wxWindowID aWindo
m_gal->SetGridColor( m_painter->GetSettings()->GetLayerColor( LAYER_SCHEMATIC_GRID ) );
m_gal->SetCursorEnabled( false );
m_gal->SetGridSize( VECTOR2D( Mils2iu( 100.0 ), Mils2iu( 100.0 ) ) );
m_gal->SetGridSize( VECTOR2D( schIUScale.MilsToIU( 100.0 ), schIUScale.MilsToIU( 100.0 ) ) );
SetEvtHandlerEnabled( true );
SetFocus();

View File

@ -238,7 +238,7 @@ int SCH_SHAPE::GetPenWidth() const
if( schematic )
return schematic->Settings().m_DefaultLineWidth;
return Mils2iu( DEFAULT_LINE_WIDTH_MILS );
return schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS );
}

View File

@ -448,7 +448,7 @@ bool SCH_SHEET::HasUndefinedPins() const
int bumpToNextGrid( const int aVal, const int aDirection )
{
constexpr int gridSize = Mils2iu( 50 );
constexpr int gridSize = schIUScale.MilsToIU( 50 );
int base = aVal / gridSize;
int excess = abs( aVal % gridSize );
@ -498,7 +498,7 @@ int SCH_SHEET::GetMinWidth( bool aFromLeft ) const
else
pinMinWidth = m_pos.x + m_size.x - pinsLeft;
return std::max( pinMinWidth, Mils2iu( MIN_SHEET_WIDTH ) );
return std::max( pinMinWidth, schIUScale.MilsToIU( MIN_SHEET_WIDTH ) );
}
@ -532,7 +532,7 @@ int SCH_SHEET::GetMinHeight( bool aFromTop ) const
else
pinMinHeight = m_pos.y + m_size.y - pinsTop;
return std::max( pinMinHeight, Mils2iu( MIN_SHEET_HEIGHT ) );
return std::max( pinMinHeight, schIUScale.MilsToIU( MIN_SHEET_HEIGHT ) );
}
@ -582,7 +582,7 @@ int SCH_SHEET::GetPenWidth() const
if( Schematic() )
return Schematic()->Settings().m_DefaultLineWidth;
return Mils2iu( DEFAULT_LINE_WIDTH_MILS );
return schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS );
}

View File

@ -55,7 +55,7 @@ class SCH_SHEET : public SCH_ITEM
{
public:
SCH_SHEET( EDA_ITEM* aParent = nullptr, const VECTOR2I& aPos = VECTOR2I( 0, 0 ),
wxSize aSize = wxSize( Mils2iu( MIN_SHEET_WIDTH ), Mils2iu( MIN_SHEET_HEIGHT ) ),
wxSize aSize = wxSize( schIUScale.MilsToIU( MIN_SHEET_WIDTH ), schIUScale.MilsToIU( MIN_SHEET_HEIGHT ) ),
FIELDS_AUTOPLACED aAutoplaceFields = FIELDS_AUTOPLACED_AUTO );
/**

View File

@ -97,7 +97,7 @@ int SCH_SHEET_PIN::GetPenWidth() const
if( Schematic() )
return Schematic()->Settings().m_DefaultLineWidth;
return Mils2iu( DEFAULT_LINE_WIDTH_MILS );
return schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS );
}

View File

@ -80,12 +80,12 @@ static LIB_SYMBOL* dummy()
LIB_SHAPE* square = new LIB_SHAPE( symbol, SHAPE_T::RECT );
square->MoveTo( VECTOR2I( Mils2iu( -200 ), Mils2iu( 200 ) ) );
square->SetEnd( VECTOR2I( Mils2iu( 200 ), Mils2iu( -200 ) ) );
square->MoveTo( VECTOR2I( schIUScale.MilsToIU( -200 ), schIUScale.MilsToIU( 200 ) ) );
square->SetEnd( VECTOR2I( schIUScale.MilsToIU( 200 ), schIUScale.MilsToIU( -200 ) ) );
LIB_TEXT* text = new LIB_TEXT( symbol );
text->SetTextSize( wxSize( Mils2iu( 150 ), Mils2iu( 150 ) ) );
text->SetTextSize( wxSize( schIUScale.MilsToIU( 150 ), schIUScale.MilsToIU( 150 ) ) );
text->SetText( wxString( wxT( "??" ) ) );
symbol->AddDrawItem( square );
@ -266,7 +266,7 @@ bool SCH_SYMBOL::IsMovableFromAnchorPoint() const
// going to end up moving the symbol's pins off-grid.
// The minimal grid size allowed to place a pin is 25 mils
const int min_grid_size = Mils2iu( 25 );
const int min_grid_size = schIUScale.MilsToIU( 25 );
for( const std::unique_ptr<SCH_PIN>& pin : m_pins )
{

View File

@ -50,7 +50,7 @@ SCH_VIEW::SCH_VIEW( bool aIsDynamic, SCH_BASE_FRAME* aFrame ) :
// Set m_boundary to define the max working area size. The default value is acceptable for
// Pcbnew and Gerbview, but too large for Eeschema due to very different internal units.
// A full size = 3 * MAX_PAGE_SIZE_MILS size allows a wide margin around the drawing-sheet.
double max_size = Mils2iu( MAX_PAGE_SIZE_EESCHEMA_MILS ) * 3.0;
double max_size = schIUScale.MilsToIU( MAX_PAGE_SIZE_EESCHEMA_MILS ) * 3.0;
m_boundary.SetOrigin( -max_size/4, -max_size/4 );
m_boundary.SetSize( max_size, max_size );
}

View File

@ -102,11 +102,11 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
&m_DashedLineGapRatio, 3.0 ) ); // Default from ISO 128-2
m_params.emplace_back( new PARAM_SCALED<int>( "drawing.default_line_thickness",
&m_DefaultLineWidth, Mils2iu( defaultLineThickness ), Mils2iu( 5 ), Mils2iu( 1000 ),
&m_DefaultLineWidth, schIUScale.MilsToIU( defaultLineThickness ), schIUScale.MilsToIU( 5 ), schIUScale.MilsToIU( 1000 ),
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 ),
&m_DefaultTextSize, schIUScale.MilsToIU( defaultTextSize ), schIUScale.MilsToIU( 5 ), schIUScale.MilsToIU( 1000 ),
1 / schIUScale.IU_PER_MILS ) );
m_params.emplace_back( new PARAM<double>( "drawing.text_offset_ratio",
@ -116,7 +116,7 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
&m_LabelSizeRatio, DEFAULT_LABEL_SIZE_RATIO, 0.0, 2.0 ) );
m_params.emplace_back( new PARAM_SCALED<int>( "drawing.pin_symbol_size",
&m_PinSymbolSize, Mils2iu( defaultPinSymbolSize ), Mils2iu( 0 ), Mils2iu( 1000 ),
&m_PinSymbolSize, schIUScale.MilsToIU( defaultPinSymbolSize ), schIUScale.MilsToIU( 0 ), schIUScale.MilsToIU( 1000 ),
1 / schIUScale.IU_PER_MILS ) );
// m_JunctionSize is only a run-time cache of the calculated size. Do not save it.

View File

@ -79,7 +79,7 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
// this is because all aSymbols are using a 50 mils grid to place pins, and therefore
// the wires must be on the 50 mils grid
// So raise an error if a pin is not on a 25 (or bigger :50 or 100) mils grid
const int min_grid_size = Mils2iu( 25 );
const int min_grid_size = schIUScale.MilsToIU( 25 );
const int clamped_grid_size = ( aGridForPins < min_grid_size ) ? min_grid_size : aGridForPins;
for( unsigned ii = 1; ii < pinList.size(); ii++ )

View File

@ -675,7 +675,7 @@ void EE_POINT_EDITOR::updateParentItem() const
VECTOR2I botLeft = m_editPoints->Point( RECT_BOTLEFT ).GetPosition();
VECTOR2I botRight = m_editPoints->Point( RECT_BOTRIGHT ).GetPosition();
pinEditedCorner( Mils2iu( 1 ), Mils2iu( 1 ), topLeft, topRight, botLeft, botRight,
pinEditedCorner( schIUScale.MilsToIU( 1 ), schIUScale.MilsToIU( 1 ), topLeft, topRight, botLeft, botRight,
&gridHelper );
if( isModified( m_editPoints->Point( RECT_TOPLEFT ) )
@ -735,7 +735,7 @@ void EE_POINT_EDITOR::updateParentItem() const
VECTOR2I botLeft = m_editPoints->Point( RECT_BOTLEFT ).GetPosition();
VECTOR2I botRight = m_editPoints->Point( RECT_BOTRIGHT ).GetPosition();
pinEditedCorner( Mils2iu( 1 ), Mils2iu( 1 ), topLeft, topRight, botLeft, botRight,
pinEditedCorner( schIUScale.MilsToIU( 1 ), schIUScale.MilsToIU( 1 ), topLeft, topRight, botLeft, botRight,
&gridHelper );
if( isModified( m_editPoints->Point( RECT_TOPLEFT ) )
@ -825,7 +825,7 @@ void EE_POINT_EDITOR::updateParentItem() const
VECTOR2I botLeft = m_editPoints->Point( RECT_BOTLEFT ).GetPosition();
VECTOR2I botRight = m_editPoints->Point( RECT_BOTRIGHT ).GetPosition();
pinEditedCorner( Mils2iu( 1 ), Mils2iu( 1 ), topLeft, topRight, botLeft, botRight,
pinEditedCorner( schIUScale.MilsToIU( 1 ), schIUScale.MilsToIU( 1 ), topLeft, topRight, botLeft, botRight,
&gridHelper );
if( isModified( m_editPoints->Point( RECT_TOPLEFT ) )
@ -885,7 +885,7 @@ void EE_POINT_EDITOR::updateParentItem() const
VECTOR2I botLeft = m_editPoints->Point( RECT_BOTLEFT ).GetPosition();
VECTOR2I botRight = m_editPoints->Point( RECT_BOTRIGHT ).GetPosition();
pinEditedCorner( Mils2iu( 1 ), Mils2iu( 1 ), topLeft, topRight, botLeft, botRight,
pinEditedCorner( schIUScale.MilsToIU( 1 ), schIUScale.MilsToIU( 1 ), topLeft, topRight, botLeft, botRight,
&gridHelper );
if( isModified( m_editPoints->Point( RECT_TOPLEFT ) )
@ -935,7 +935,7 @@ void EE_POINT_EDITOR::updateParentItem() const
VECTOR2I botLeft = m_editPoints->Point( RECT_BOTLEFT ).GetPosition();
VECTOR2I botRight = m_editPoints->Point( RECT_BOTRIGHT ).GetPosition();
pinEditedCorner( Mils2iu( 50 ), Mils2iu( 50 ), topLeft, topRight, botLeft, botRight,
pinEditedCorner( schIUScale.MilsToIU( 50 ), schIUScale.MilsToIU( 50 ), topLeft, topRight, botLeft, botRight,
&gridHelper );
double oldWidth = bitmap->GetSize().x;

View File

@ -1546,7 +1546,7 @@ void EE_SELECTION_TOOL::ZoomFitCrossProbeBBox( const BOX2I& aBBox )
// This ratio is not useful by itself as a scaling factor. It must be "bent" to
// provide good scaling at varying symbol sizes. Bigger symbols need less
// scaling than small ones.
double currTextHeight = Mils2iu( DEFAULT_TEXT_SIZE );
double currTextHeight = schIUScale.MilsToIU( DEFAULT_TEXT_SIZE );
double compRatio = bbSize.y / currTextHeight; // Ratio of symbol to text height
double compRatioBent = 1.0;

View File

@ -1810,7 +1810,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
sheet = new SCH_SHEET( m_frame->GetCurrentSheet().Last(), cursorPos );
sheet->SetFlags( IS_NEW | IS_RESIZING );
sheet->SetScreen( nullptr );
sheet->SetBorderWidth( Mils2iu( cfg->m_Drawing.default_line_thickness ) );
sheet->SetBorderWidth( schIUScale.MilsToIU( cfg->m_Drawing.default_line_thickness ) );
sheet->SetBorderColor( cfg->m_Drawing.default_sheet_border_color );
sheet->SetBackgroundColor( cfg->m_Drawing.default_sheet_background_color );
sheet->GetFields()[ SHEETNAME ].SetText( "Untitled Sheet" );
@ -1901,8 +1901,8 @@ void SCH_DRAWING_TOOLS::sizeSheet( SCH_SHEET* aSheet, const VECTOR2I& aPos )
VECTOR2I pos = aSheet->GetPosition();
VECTOR2I size = aPos - pos;
size.x = std::max( size.x, Mils2iu( MIN_SHEET_WIDTH ) );
size.y = std::max( size.y, Mils2iu( MIN_SHEET_HEIGHT ) );
size.x = std::max( size.x, schIUScale.MilsToIU( MIN_SHEET_WIDTH ) );
size.y = std::max( size.y, schIUScale.MilsToIU( MIN_SHEET_HEIGHT ) );
VECTOR2I grid = m_frame->GetNearestGridPosition( pos + size );
aSheet->Resize( wxSize( grid.x - pos.x, grid.y - pos.y ) );

View File

@ -1117,8 +1117,8 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
}
else
{
newItem->Move( VECTOR2I( Mils2iu( cfg->m_Drawing.default_repeat_offset_x ),
Mils2iu( cfg->m_Drawing.default_repeat_offset_y ) ) );
newItem->Move( VECTOR2I( schIUScale.MilsToIU( cfg->m_Drawing.default_repeat_offset_x ),
schIUScale.MilsToIU( cfg->m_Drawing.default_repeat_offset_y ) ) );
}
m_toolMgr->RunAction( EE_ACTIONS::addItemToSel, true, newItem );

View File

@ -218,8 +218,8 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
LIB_TEXT* text = new LIB_TEXT( symbol );
text->SetPosition( VECTOR2I( cursorPos.x, -cursorPos.y ) );
text->SetTextSize( wxSize( Mils2iu( settings->m_Defaults.text_size ),
Mils2iu( settings->m_Defaults.text_size ) ) );
text->SetTextSize( wxSize( schIUScale.MilsToIU( settings->m_Defaults.text_size ),
schIUScale.MilsToIU( settings->m_Defaults.text_size ) ) );
text->SetTextAngle( m_lastTextAngle );
DIALOG_LIB_TEXT_PROPERTIES dlg( m_frame, text );
@ -422,7 +422,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
int lineWidth = Mils2iu( settings->m_Defaults.line_width );
int lineWidth = schIUScale.MilsToIU( settings->m_Defaults.line_width );
if( isTextBox )
{
@ -430,8 +430,8 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
textbox->SetBold( m_lastTextBold );
textbox->SetItalic( m_lastTextItalic );
textbox->SetTextSize( wxSize( Mils2iu( settings->m_Defaults.text_size ),
Mils2iu( settings->m_Defaults.text_size ) ) );
textbox->SetTextSize( wxSize( schIUScale.MilsToIU( settings->m_Defaults.text_size ),
schIUScale.MilsToIU( settings->m_Defaults.text_size ) ) );
textbox->SetTextAngle( m_lastTextAngle );
textbox->SetHorizJustify( m_lastTextJust );

View File

@ -52,7 +52,7 @@ static int GetLastPinLength()
if( g_LastPinLength == -1 )
{
auto* settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
g_LastPinLength = Mils2iu( settings->m_Defaults.pin_length );
g_LastPinLength = schIUScale.MilsToIU( settings->m_Defaults.pin_length );
}
return g_LastPinLength;
@ -63,7 +63,7 @@ static int GetLastPinNameSize()
if( g_LastPinNameSize == -1 )
{
auto* settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
g_LastPinNameSize = Mils2iu( settings->m_Defaults.pin_name_size );
g_LastPinNameSize = schIUScale.MilsToIU( settings->m_Defaults.pin_name_size );
}
return g_LastPinNameSize;
@ -74,7 +74,7 @@ static int GetLastPinNumSize()
if( g_LastPinNumSize == -1 )
{
auto* settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
g_LastPinNumSize = Mils2iu( settings->m_Defaults.pin_num_size );
g_LastPinNumSize = schIUScale.MilsToIU( settings->m_Defaults.pin_num_size );
}
return g_LastPinNumSize;
@ -424,10 +424,10 @@ LIB_PIN* SYMBOL_EDITOR_PIN_TOOL::RepeatPin( const LIB_PIN* aSourcePin )
switch( pin->GetOrientation() )
{
case PIN_UP: step.x = Mils2iu(settings->m_Repeat.pin_step); break;
case PIN_DOWN: step.x = Mils2iu(settings->m_Repeat.pin_step); break;
case PIN_LEFT: step.y = Mils2iu(-settings->m_Repeat.pin_step); break;
case PIN_RIGHT: step.y = Mils2iu(-settings->m_Repeat.pin_step); break;
case PIN_UP: step.x = schIUScale.MilsToIU(settings->m_Repeat.pin_step); break;
case PIN_DOWN: step.x = schIUScale.MilsToIU(settings->m_Repeat.pin_step); break;
case PIN_LEFT: step.y = schIUScale.MilsToIU(-settings->m_Repeat.pin_step); break;
case PIN_RIGHT: step.y = schIUScale.MilsToIU(-settings->m_Repeat.pin_step); break;
}
pin->Offset( step );

View File

@ -128,11 +128,6 @@ constexpr double IU_PER_MM = SCH_IU_PER_MM;
#ifndef UNKNOWN_IU
constexpr double IU_PER_MILS = (IU_PER_MM * 0.0254);
constexpr inline int Mils2iu( int mils )
{
double x = mils * IU_PER_MILS;
return int( x < 0 ? x - 0.5 : x + 0.5 );
}
#if defined(EESCHEMA)
constexpr inline int Iu2Mils( int iu )
@ -156,12 +151,6 @@ constexpr inline int Millimeter2iu( double mm )
return (int) ( mm < 0 ? mm * IU_PER_MM - 0.5 : mm * IU_PER_MM + 0.5 );
}
/// Convert mm to internal units (iu).
// constexpr inline double Iu2Mils( int iu )
// {
// return iu / IU_PER_MILS;
// }
// The max error is the distance between the middle of a segment, and the circle
// for circle/arc to segment approximation.
// Warning: too small values can create very long calculation time in zone filling

View File

@ -343,7 +343,8 @@ void PL_POINT_EDITOR::updateItem() const
VECTOR2I botLeft = m_editPoints->Point( RECT_BOTLEFT ).GetPosition();
VECTOR2I botRight = m_editPoints->Point( RECT_BOTRIGHT ).GetPosition();
pinEditedCorner( getEditedPointIndex(), Mils2iu( 1 ), Mils2iu( 1 ),
pinEditedCorner( getEditedPointIndex(), drawSheetIUScale.MilsToIU( 1 ),
drawSheetIUScale.MilsToIU( 1 ),
topLeft, topRight, botLeft, botRight );
VECTOR2I start_delta, end_delta;

View File

@ -123,7 +123,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
m_DimensionSuppressZeroes = false;
m_DimensionTextPosition = DIM_TEXT_POSITION::OUTSIDE;
m_DimensionKeepTextAligned = true;
m_DimensionArrowLength = Mils2iu( DEFAULT_DIMENSION_ARROW_LENGTH );
m_DimensionArrowLength = pcbIUScale.MilsToIU( DEFAULT_DIMENSION_ARROW_LENGTH );
m_DimensionExtensionOffset = pcbIUScale.mmToIU( DEFAULT_DIMENSION_EXTENSION_OFFSET );
m_useCustomTrackVia = false;
@ -699,14 +699,14 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
m_params.emplace_back( new PARAM<int>( "defaults.dimensions.arrow_length",
&m_DimensionArrowLength,
Mils2iu( DEFAULT_DIMENSION_ARROW_LENGTH ) ) );
pcbIUScale.MilsToIU( DEFAULT_DIMENSION_ARROW_LENGTH ) ) );
m_params.emplace_back( new PARAM<int>( "defaults.dimensions.extension_offset",
&m_DimensionExtensionOffset,
pcbIUScale.mmToIU( DEFAULT_DIMENSION_EXTENSION_OFFSET ) ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.zones.min_clearance",
&m_defaultZoneSettings.m_ZoneClearance, Mils2iu( ZONE_CLEARANCE_MIL ),
&m_defaultZoneSettings.m_ZoneClearance, pcbIUScale.MilsToIU( ZONE_CLEARANCE_MIL ),
pcbIUScale.mmToIU( 0.0 ), pcbIUScale.mmToIU( 25.0 ), pcbIUScale.MM_PER_IU ) );
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "defaults.pads",

View File

@ -49,7 +49,7 @@ PCB_BITMAP::PCB_BITMAP( BOARD_ITEM* aParent, const VECTOR2I& pos, PCB_LAYER_ID a
{
m_pos = pos;
m_image = new BITMAP_BASE();
m_image->SetPixelSizeIu( (float) Mils2iu( 1000 ) / m_image->GetPPI() );
m_image->SetPixelSizeIu( (float) pcbIUScale.MilsToIU( 1000 ) / m_image->GetPPI() );
}
@ -57,7 +57,7 @@ PCB_BITMAP::PCB_BITMAP( const PCB_BITMAP& aPCBBitmap ) : BOARD_ITEM( aPCBBitmap
{
m_pos = aPCBBitmap.m_pos;
m_image = new BITMAP_BASE( *aPCBBitmap.m_image );
m_image->SetPixelSizeIu( (float) Mils2iu( 1000 ) / m_image->GetPPI() );
m_image->SetPixelSizeIu( (float) pcbIUScale.MilsToIU( 1000 ) / m_image->GetPPI() );
}
@ -76,7 +76,7 @@ PCB_BITMAP& PCB_BITMAP::operator=( const BOARD_ITEM& aItem )
delete m_image;
m_image = new BITMAP_BASE( *bitmap->m_image );
m_pos = bitmap->m_pos;
m_image->SetPixelSizeIu( (float) Mils2iu( 1000 ) / m_image->GetPPI() );
m_image->SetPixelSizeIu( (float) pcbIUScale.MilsToIU( 1000 ) / m_image->GetPPI() );
}
return *this;

View File

@ -50,7 +50,7 @@ PCB_DIMENSION_BASE::PCB_DIMENSION_BASE( BOARD_ITEM* aParent, KICAD_T aType ) :
m_precision( 4 ),
m_suppressZeroes( false ),
m_lineThickness( pcbIUScale.mmToIU( 0.2 ) ),
m_arrowLength( Mils2iu( 50 ) ),
m_arrowLength( pcbIUScale.MilsToIU( 50 ) ),
m_extensionOffset( 0 ),
m_textPosition( DIM_TEXT_POSITION::OUTSIDE ),
m_keepTextAligned( true ),

View File

@ -2222,7 +2222,7 @@ void PCB_PAINTER::draw( const PCB_GROUP* aGroup, int aLayer )
int ptSize = 12;
int scaledSize = abs( KiROUND( m_gal->GetScreenWorldMatrix().GetScale().x * ptSize ) );
int unscaledSize = Mils2iu( ptSize );
int unscaledSize = pcbIUScale.MilsToIU( ptSize );
// Scale by zoom a bit, but not too much
int textSize = ( scaledSize + ( unscaledSize * 2 ) ) / 3;

View File

@ -25,12 +25,12 @@
#ifndef PCBNEW_H
#define PCBNEW_H
#include <convert_to_biu.h> // to define Mils2iu() conversion function
#include <convert_to_biu.h> // to define pcbIUScale.MilsToIU() conversion function
// These are only here for algorithmic safety, not to tell the user what to do
#define TEXTS_MIN_SIZE Mils2iu( 1 ) ///< Minimum text size in internal units (1 mil)
#define TEXTS_MAX_SIZE Mils2iu( 10000 ) ///< Maximum text size in internal units (10 inches)
#define TEXTS_MAX_WIDTH Mils2iu( 10000 ) ///< Maximum text width in internal units (10 inches)
#define TEXTS_MIN_SIZE pcbIUScale.MilsToIU( 1 ) ///< Minimum text size in internal units (1 mil)
#define TEXTS_MAX_SIZE pcbIUScale.MilsToIU( 10000 ) ///< Maximum text size in internal units (10 inches)
#define TEXTS_MAX_WIDTH pcbIUScale.MilsToIU( 10000 ) ///< Maximum text width in internal units (10 inches)
#endif // PCBNEW_H

View File

@ -104,8 +104,8 @@ BOOST_AUTO_TEST_CASE( Junctions )
{
for( int i = 0; i < 100; i++ )
{
SCH_JUNCTION* junction =
new SCH_JUNCTION( VECTOR2I( Mils2iu( 100 ) * i, Mils2iu( 100 ) * i ) );
SCH_JUNCTION* junction = new SCH_JUNCTION(
VECTOR2I( schIUScale.MilsToIU( 100 ) * i, schIUScale.MilsToIU( 100 ) * i ) );
m_tree.insert( junction );
}
@ -128,9 +128,12 @@ BOOST_AUTO_TEST_CASE( Junctions )
BOOST_CHECK_EQUAL( count, 0 );
BOX2I small_bbox( VECTOR2I( -1, -1 ), VECTOR2I( Mils2iu( 2 ), Mils2iu( 2 ) ) );
BOX2I med_bbox( VECTOR2I( 0, 0 ), VECTOR2I( Mils2iu( 100 ), Mils2iu( 100 ) ) );
BOX2I big_bbox( VECTOR2I( 0, 0 ), VECTOR2I( Mils2iu( 5000 ), Mils2iu( 5000 ) ) );
BOX2I small_bbox( VECTOR2I( -1, -1 ),
VECTOR2I( schIUScale.MilsToIU( 2 ), schIUScale.MilsToIU( 2 ) ) );
BOX2I med_bbox( VECTOR2I( 0, 0 ),
VECTOR2I( schIUScale.MilsToIU( 100 ), schIUScale.MilsToIU( 100 ) ) );
BOX2I big_bbox( VECTOR2I( 0, 0 ),
VECTOR2I( schIUScale.MilsToIU( 5000 ), schIUScale.MilsToIU( 5000 ) ) );
count = 0;
@ -193,12 +196,12 @@ BOOST_AUTO_TEST_CASE( MixedElements )
int x_sign = ( i % 2 == 0 ) ? -1 : 1;
int y_sign = ( i % 3 == 0 ) ? -1 : 1;
SCH_JUNCTION* junction = new SCH_JUNCTION( VECTOR2I( Mils2iu( 100 ) * i * x_sign,
Mils2iu( 100 ) * i * y_sign ) );
SCH_JUNCTION* junction = new SCH_JUNCTION( VECTOR2I( schIUScale.MilsToIU( 100 ) * i * x_sign,
schIUScale.MilsToIU( 100 ) * i * y_sign ) );
m_tree.insert( junction );
SCH_NO_CONNECT* nc = new SCH_NO_CONNECT( VECTOR2I( Mils2iu( 150 ) * i * y_sign,
Mils2iu( 150 ) * i * x_sign ) );
SCH_NO_CONNECT* nc = new SCH_NO_CONNECT( VECTOR2I( schIUScale.MilsToIU( 150 ) * i * y_sign,
schIUScale.MilsToIU( 150 ) * i * x_sign ) );
m_tree.insert( nc );
}
@ -222,7 +225,7 @@ BOOST_AUTO_TEST_CASE( MixedElements )
BOOST_CHECK_EQUAL( count, 100 );
BOX2I small_bbox( VECTOR2I( -1, -1 ), VECTOR2I( Mils2iu( 2 ), Mils2iu( 2 ) ) );
BOX2I small_bbox( VECTOR2I( -1, -1 ), VECTOR2I( schIUScale.MilsToIU( 2 ), schIUScale.MilsToIU( 2 ) ) );
count = 0;
@ -262,10 +265,10 @@ BOOST_AUTO_TEST_CASE( MixedElements )
// where the first case may or may not match
BOOST_AUTO_TEST_CASE( SingleElementTree )
{
SCH_JUNCTION* junction = new SCH_JUNCTION( VECTOR2I( Mils2iu( 100 ), Mils2iu( 100 ) ) );
SCH_JUNCTION* junction = new SCH_JUNCTION( VECTOR2I( schIUScale.MilsToIU( 100 ), schIUScale.MilsToIU( 100 ) ) );
m_tree.insert( junction );
SCH_NO_CONNECT* nc = new SCH_NO_CONNECT( VECTOR2I( Mils2iu( 150 ), Mils2iu( 150 ) ) );
SCH_NO_CONNECT* nc = new SCH_NO_CONNECT( VECTOR2I( schIUScale.MilsToIU( 150 ), schIUScale.MilsToIU( 150 ) ) );
m_tree.insert( nc );
int count = 0;

View File

@ -75,7 +75,7 @@ const static std::vector<EXPR_TO_TEST> simpleExpressions = {
const static std::vector<EXPR_TO_TEST> introspectionExpressions = {
{ "A.type == 'Pad' && B.type == 'Pad' && (A.existsOnLayer('F.Cu'))", false, VAL( 0.0 ) },
{ "A.Width > B.Width", false, VAL( 0.0 ) },
{ "A.Width + B.Width", false, VAL( Mils2iu(10) + Mils2iu(20) ) },
{ "A.Width + B.Width", false, VAL( pcbIUScale.MilsToIU(10) + pcbIUScale.MilsToIU(20) ) },
{ "A.Netclass", false, VAL( "HV" ) },
{ "(A.Netclass == 'HV') && (B.netclass == 'otherClass') && (B.netclass != 'F.Cu')", false, VAL( 1.0 ) },
{ "A.Netclass + 1.0", false, VAL( 1.0 ) },
@ -171,8 +171,8 @@ BOOST_AUTO_TEST_CASE( IntrospectedProperties )
trackB.SetLayer( F_Cu );
trackA.SetWidth( Mils2iu( 10 ) );
trackB.SetWidth( Mils2iu( 20 ) );
trackA.SetWidth( pcbIUScale.MilsToIU( 10 ) );
trackB.SetWidth( pcbIUScale.MilsToIU( 20 ) );
for( const auto& expr : introspectionExpressions )
{