Fix inches being sometimes used instead of mils

This commit is contained in:
Mikolaj Wielgus 2020-10-03 00:04:16 +02:00 committed by Ian McInerney
parent 400c15b8eb
commit d14761bee6
10 changed files with 14 additions and 16 deletions

View File

@ -40,8 +40,6 @@
#include <macros.h> #include <macros.h>
#include <title_block.h> #include <title_block.h>
// 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 ) #if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA ) || defined( GERBVIEW ) || defined( PL_EDITOR )
#define IU_TO_MM( x ) ( x / IU_PER_MM ) #define IU_TO_MM( x ) ( x / IU_PER_MM )
#define IU_TO_IN( x ) ( x / IU_PER_MILS / 1000 ) #define IU_TO_IN( x ) ( x / IU_PER_MILS / 1000 )

View File

@ -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() 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; return false;
SCH_SHEET_PATH currentSheet = m_parent->GetCurrentSheet(); SCH_SHEET_PATH currentSheet = m_parent->GetCurrentSheet();

View File

@ -59,10 +59,10 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
m_choiceSeparatorRefId->SetSelection( refStyleSelection ); m_choiceSeparatorRefId->SetSelection( refStyleSelection );
m_textSize.SetUnits( EDA_UNITS::INCHES ); m_textSize.SetUnits( EDA_UNITS::MILS );
m_lineWidth.SetUnits( EDA_UNITS::INCHES ); m_lineWidth.SetUnits( EDA_UNITS::MILS );
m_pinSymbolSize.SetUnits( EDA_UNITS::INCHES ); m_pinSymbolSize.SetUnits( EDA_UNITS::MILS );
m_junctionSize.SetUnits( EDA_UNITS::INCHES ); m_junctionSize.SetUnits( EDA_UNITS::MILS );
m_textSize.SetValue( settings.m_DefaultTextSize ); m_textSize.SetValue( settings.m_DefaultTextSize );
m_lineWidth.SetValue( settings.m_DefaultLineWidth ); m_lineWidth.SetValue( settings.m_DefaultLineWidth );

View File

@ -193,7 +193,7 @@ void DIMENSION::SetUnitsMode( DIM_UNITS_MODE aMode )
break; break;
case DIM_UNITS_MODE::MILS: case DIM_UNITS_MODE::MILS:
m_units = EDA_UNITS::INCHES; m_units = EDA_UNITS::MILS;
break; break;
case DIM_UNITS_MODE::MILLIMETRES: case DIM_UNITS_MODE::MILLIMETRES:

View File

@ -398,14 +398,14 @@ void DIALOG_BOARD_REANNOTATE::GetParameters()
if( m_GridIndex >= ( int ) m_Settings->m_Window.grid.sizes.size() ) 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_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 ); m_Settings->m_Window.grid.user_grid_y );
} }
else else
{ {
m_SortGridx = DoubleValueFromString( EDA_UNITS::INCHES, m_SortGridx = DoubleValueFromString( EDA_UNITS::MILS,
m_Settings->m_Window.grid.sizes[ m_GridIndex ] ); m_Settings->m_Window.grid.sizes[ m_GridIndex ] );
m_SortGridy = m_SortGridx; m_SortGridy = m_SortGridx;
} }

View File

@ -101,7 +101,7 @@ bool PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataFromWindow()
if( !m_edgeClearance.Validate( 0, 10, EDA_UNITS::INCHES ) ) if( !m_edgeClearance.Validate( 0, 10, EDA_UNITS::INCHES ) )
return false; 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; return false;
if( !m_holeToHoleMin.Validate( 0, 10, EDA_UNITS::INCHES ) ) if( !m_holeToHoleMin.Validate( 0, 10, EDA_UNITS::INCHES ) )

View File

@ -483,7 +483,7 @@ FOOTPRINT_PREVIEW_PANEL* FOOTPRINT_PREVIEW_PANEL::New( KIWAY* aKiway, wxWindow*
//Bounds checking cannot include number of elements as an index! //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 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 ) ); panel->GetGAL()->SetGridSize( VECTOR2D( gridSize, gridSize ) );
return panel; return panel;

View File

@ -533,7 +533,7 @@ public:
switch( unitId ) 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 1: return DoubleValueFromString( EDA_UNITS::MILLIMETRES, aString );
case 2: return DoubleValueFromString( EDA_UNITS::INCHES, aString ); case 2: return DoubleValueFromString( EDA_UNITS::INCHES, aString );
default: return v; default: return v;

View File

@ -965,7 +965,7 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem )
dimension->SetUnits( EDA_UNITS::INCHES ); dimension->SetUnits( EDA_UNITS::INCHES );
break; break;
case ALTIUM_UNIT::MILS: case ALTIUM_UNIT::MILS:
dimension->SetUnits( EDA_UNITS::INCHES ); dimension->SetUnits( EDA_UNITS::MILS );
break; break;
case ALTIUM_UNIT::MILLIMETERS: case ALTIUM_UNIT::MILLIMETERS:
case ALTIUM_UNIT::CENTIMETER: case ALTIUM_UNIT::CENTIMETER:

View File

@ -946,7 +946,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions()
break; break;
case UNITS::THOU: case UNITS::THOU:
dimension->SetUnits( EDA_UNITS::INCHES ); dimension->SetUnits( EDA_UNITS::MILS );
break; break;
} }
} }