From d14761bee68b98f1e229b0bcf7fafc7c56897c01 Mon Sep 17 00:00:00 2001 From: Mikolaj Wielgus Date: Sat, 3 Oct 2020 00:04:16 +0200 Subject: [PATCH] Fix inches being sometimes used instead of mils --- common/base_units.cpp | 2 -- eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp | 2 +- eeschema/dialogs/panel_setup_formatting.cpp | 8 ++++---- pcbnew/class_dimension.cpp | 2 +- pcbnew/dialogs/dialog_board_reannotate.cpp | 6 +++--- pcbnew/dialogs/panel_setup_feature_constraints.cpp | 2 +- pcbnew/footprint_preview_panel.cpp | 2 +- pcbnew/pcb_expr_evaluator.cpp | 2 +- pcbnew/plugins/altium/altium_pcb.cpp | 2 +- pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp | 2 +- 10 files changed, 14 insertions(+), 16 deletions(-) diff --git a/common/base_units.cpp b/common/base_units.cpp index 8ac2c44427..0d31be3a5a 100644 --- a/common/base_units.cpp +++ b/common/base_units.cpp @@ -40,8 +40,6 @@ #include #include -// We need this function even in routines that do not define internal units - #if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA ) || defined( GERBVIEW ) || defined( PL_EDITOR ) #define IU_TO_MM( x ) ( x / IU_PER_MM ) #define IU_TO_IN( x ) ( x / IU_PER_MILS / 1000 ) diff --git a/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp b/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp index d3ced22d70..d9aebcd308 100644 --- a/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp +++ b/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp @@ -435,7 +435,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow() { - if( !m_textSize.Validate( 1.0, 10000.0, EDA_UNITS::INCHES ) ) // 1 mil .. 10 inches + if( !m_textSize.Validate( 1.0, 10000.0, EDA_UNITS::MILS ) ) // 1 mil .. 10 inches return false; SCH_SHEET_PATH currentSheet = m_parent->GetCurrentSheet(); diff --git a/eeschema/dialogs/panel_setup_formatting.cpp b/eeschema/dialogs/panel_setup_formatting.cpp index 8ef397118f..fc0fa37b16 100644 --- a/eeschema/dialogs/panel_setup_formatting.cpp +++ b/eeschema/dialogs/panel_setup_formatting.cpp @@ -59,10 +59,10 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow() m_choiceSeparatorRefId->SetSelection( refStyleSelection ); - m_textSize.SetUnits( EDA_UNITS::INCHES ); - m_lineWidth.SetUnits( EDA_UNITS::INCHES ); - m_pinSymbolSize.SetUnits( EDA_UNITS::INCHES ); - m_junctionSize.SetUnits( EDA_UNITS::INCHES ); + m_textSize.SetUnits( EDA_UNITS::MILS ); + m_lineWidth.SetUnits( EDA_UNITS::MILS ); + m_pinSymbolSize.SetUnits( EDA_UNITS::MILS ); + m_junctionSize.SetUnits( EDA_UNITS::MILS ); m_textSize.SetValue( settings.m_DefaultTextSize ); m_lineWidth.SetValue( settings.m_DefaultLineWidth ); diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index 5e86fafc2c..1185815ad2 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -193,7 +193,7 @@ void DIMENSION::SetUnitsMode( DIM_UNITS_MODE aMode ) break; case DIM_UNITS_MODE::MILS: - m_units = EDA_UNITS::INCHES; + m_units = EDA_UNITS::MILS; break; case DIM_UNITS_MODE::MILLIMETRES: diff --git a/pcbnew/dialogs/dialog_board_reannotate.cpp b/pcbnew/dialogs/dialog_board_reannotate.cpp index 69d1089861..3e1040ef3c 100644 --- a/pcbnew/dialogs/dialog_board_reannotate.cpp +++ b/pcbnew/dialogs/dialog_board_reannotate.cpp @@ -398,14 +398,14 @@ void DIALOG_BOARD_REANNOTATE::GetParameters() if( m_GridIndex >= ( int ) m_Settings->m_Window.grid.sizes.size() ) { - m_SortGridx = DoubleValueFromString( EDA_UNITS::INCHES, + m_SortGridx = DoubleValueFromString( EDA_UNITS::MILS, m_Settings->m_Window.grid.user_grid_x ); - m_SortGridy = DoubleValueFromString( EDA_UNITS::INCHES, + m_SortGridy = DoubleValueFromString( EDA_UNITS::MILS, m_Settings->m_Window.grid.user_grid_y ); } else { - m_SortGridx = DoubleValueFromString( EDA_UNITS::INCHES, + m_SortGridx = DoubleValueFromString( EDA_UNITS::MILS, m_Settings->m_Window.grid.sizes[ m_GridIndex ] ); m_SortGridy = m_SortGridx; } diff --git a/pcbnew/dialogs/panel_setup_feature_constraints.cpp b/pcbnew/dialogs/panel_setup_feature_constraints.cpp index dee7c7221b..c497d72fa4 100644 --- a/pcbnew/dialogs/panel_setup_feature_constraints.cpp +++ b/pcbnew/dialogs/panel_setup_feature_constraints.cpp @@ -101,7 +101,7 @@ bool PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataFromWindow() if( !m_edgeClearance.Validate( 0, 10, EDA_UNITS::INCHES ) ) return false; - if( !m_throughHoleMin.Validate( 2, 1000, EDA_UNITS::INCHES ) ) // #107 to 1 inch + if( !m_throughHoleMin.Validate( 2, 1000, EDA_UNITS::MILS ) ) // #107 to 1 inch return false; if( !m_holeToHoleMin.Validate( 0, 10, EDA_UNITS::INCHES ) ) diff --git a/pcbnew/footprint_preview_panel.cpp b/pcbnew/footprint_preview_panel.cpp index 0be16a9f5e..54f16c3ed0 100644 --- a/pcbnew/footprint_preview_panel.cpp +++ b/pcbnew/footprint_preview_panel.cpp @@ -483,7 +483,7 @@ FOOTPRINT_PREVIEW_PANEL* FOOTPRINT_PREVIEW_PANEL::New( KIWAY* aKiway, wxWindow* //Bounds checking cannot include number of elements as an index! int gridIdx = std::max( 0, std::min( gridCfg.last_size_idx, (int) gridCfg.sizes.size() - 1 ) ); - int gridSize = (int) ValueFromString( EDA_UNITS::INCHES, gridCfg.sizes[ gridIdx ] ); + int gridSize = (int) ValueFromString( EDA_UNITS::MILS, gridCfg.sizes[ gridIdx ] ); panel->GetGAL()->SetGridSize( VECTOR2D( gridSize, gridSize ) ); return panel; diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index 3863b89493..5ade2a29b6 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -533,7 +533,7 @@ public: switch( unitId ) { - case 0: return DoubleValueFromString( EDA_UNITS::INCHES, aString ); + case 0: return DoubleValueFromString( EDA_UNITS::MILS, aString ); case 1: return DoubleValueFromString( EDA_UNITS::MILLIMETRES, aString ); case 2: return DoubleValueFromString( EDA_UNITS::INCHES, aString ); default: return v; diff --git a/pcbnew/plugins/altium/altium_pcb.cpp b/pcbnew/plugins/altium/altium_pcb.cpp index c92e9cb0aa..e9f603ceba 100644 --- a/pcbnew/plugins/altium/altium_pcb.cpp +++ b/pcbnew/plugins/altium/altium_pcb.cpp @@ -965,7 +965,7 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem ) dimension->SetUnits( EDA_UNITS::INCHES ); break; case ALTIUM_UNIT::MILS: - dimension->SetUnits( EDA_UNITS::INCHES ); + dimension->SetUnits( EDA_UNITS::MILS ); break; case ALTIUM_UNIT::MILLIMETERS: case ALTIUM_UNIT::CENTIMETER: diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp index 5596fdae9f..c8f4bf0129 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp @@ -946,7 +946,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions() break; case UNITS::THOU: - dimension->SetUnits( EDA_UNITS::INCHES ); + dimension->SetUnits( EDA_UNITS::MILS ); break; } }