Browse Source

Fix a collision with a Windows define and our use of the same var name.

We use IN for INCH as units, but IN is defined in a Windows header
revert-0c36e162
jean-pierre charras 7 months ago
parent
commit
eaa1e6d594
  1. 6
      3d-viewer/dialogs/panel_preview_3d_model.cpp
  2. 8
      bitmap2component/bitmap2cmp_frame.cpp
  3. 4
      bitmap2component/bitmap2cmp_panel.cpp
  4. 6
      common/eda_draw_frame.cpp
  5. 18
      common/eda_units.cpp
  6. 2
      common/jobs/job_export_pcb_3d.cpp
  7. 2
      common/jobs/job_export_pcb_3d.h
  8. 4
      common/jobs/job_export_pcb_drill.cpp
  9. 2
      common/jobs/job_export_pcb_drill.h
  10. 4
      common/jobs/job_export_pcb_dxf.cpp
  11. 2
      common/jobs/job_export_pcb_dxf.h
  12. 2
      common/jobs/job_export_pcb_odb.cpp
  13. 2
      common/jobs/job_export_pcb_odb.h
  14. 2
      common/jobs/job_export_pcb_pos.cpp
  15. 2
      common/jobs/job_export_pcb_pos.h
  16. 2
      common/jobs/job_rc.cpp
  17. 2
      common/jobs/job_rc.h
  18. 2
      common/libeval/numeric_evaluator.cpp
  19. 2
      common/plotters/DXF_plotter.cpp
  20. 2
      common/preview_items/preview_utils.cpp
  21. 2
      common/tool/actions.cpp
  22. 2
      common/tool/common_tools.cpp
  23. 2
      cvpcb/display_footprints_frame.cpp
  24. 2
      eeschema/eeschema_jobs_handler.cpp
  25. 2
      eeschema/sch_edit_frame.cpp
  26. 2
      eeschema/symbol_editor/symbol_edit_frame.cpp
  27. 2
      gerbview/gerbview_frame.cpp
  28. 2
      gerbview/toolbars_gerber.cpp
  29. 2
      gerbview/tools/gerbview_inspection_tool.cpp
  30. 2
      include/eda_units.h
  31. 2
      include/plotters/plotter.h
  32. 2
      include/plotters/plotter_dxf.h
  33. 2
      kicad/cli/command_pcb_drc.cpp
  34. 2
      kicad/cli/command_pcb_export_3d.cpp
  35. 2
      kicad/cli/command_pcb_export_drill.cpp
  36. 2
      kicad/cli/command_pcb_export_dxf.cpp
  37. 2
      kicad/cli/command_pcb_export_odb.cpp
  38. 2
      kicad/cli/command_pcb_export_pos.cpp
  39. 2
      kicad/cli/command_sch_erc.cpp
  40. 10
      pagelayout_editor/pl_editor_frame.cpp
  41. 4
      pcbnew/api/api_pcb_enums.cpp
  42. 2
      pcbnew/board_design_settings.cpp
  43. 4
      pcbnew/dialogs/dialog_dimension_properties.cpp
  44. 10
      pcbnew/dialogs/dialog_gen_footprint_position.cpp
  45. 4
      pcbnew/dialogs/dialog_gendrill.cpp
  46. 8
      pcbnew/dialogs/dialog_plot.cpp
  47. 18
      pcbnew/dialogs/panel_setup_constraints.cpp
  48. 2
      pcbnew/exporters/gen_drill_report_files.cpp
  49. 2
      pcbnew/files.cpp
  50. 2
      pcbnew/footprint_chooser_frame.cpp
  51. 2
      pcbnew/footprint_edit_frame.cpp
  52. 4
      pcbnew/footprint_editor_settings.cpp
  53. 2
      pcbnew/footprint_viewer_frame.cpp
  54. 12
      pcbnew/pcb_dimension.cpp
  55. 2
      pcbnew/pcb_dimension.h
  56. 2
      pcbnew/pcb_edit_frame.cpp
  57. 4
      pcbnew/pcb_io/altium/altium_pcb.cpp
  58. 2
      pcbnew/pcb_io/cadstar/cadstar_pcb_archive_loader.cpp
  59. 6
      pcbnew/pcb_plot_params.cpp
  60. 4
      pcbnew/pcb_plotter.cpp
  61. 2
      pcbnew/pcbexpr_evaluator.cpp
  62. 6
      pcbnew/pcbnew_jobs_handler.cpp
  63. 2
      pcbnew/pcbnew_settings.cpp
  64. 2
      pcbnew/toolbars_pcb_editor.cpp
  65. 2
      pcbnew/tools/drawing_stackup_table_tool.cpp

6
3d-viewer/dialogs/panel_preview_3d_model.cpp

@ -286,7 +286,7 @@ wxString PANEL_PREVIEW_3D_MODEL::formatRotationValue( double aValue )
wxString PANEL_PREVIEW_3D_MODEL::formatOffsetValue( double aValue )
{
// Convert from internal units (mm) to user units
if( m_userUnits == EDA_UNITS::IN )
if( m_userUnits == EDA_UNITS::INCH )
aValue /= 25.4;
else if( m_userUnits == EDA_UNITS::MILS )
aValue /= 25.4 / 1e3;
@ -511,7 +511,7 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign
if( wxGetMouseState().ShiftDown( ) )
step_mm = OFFSET_INCREMENT_MM_FINE;
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::IN )
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCH )
{
step_mm = 25.4*OFFSET_INCREMENT_MIL/1000;
@ -586,7 +586,7 @@ void PANEL_PREVIEW_3D_MODEL::onMouseWheelOffset( wxMouseEvent& event )
if( event.ShiftDown( ) )
step_mm = OFFSET_INCREMENT_MM_FINE;
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::IN )
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCH )
{
step_mm = 25.4*OFFSET_INCREMENT_MIL/1000.0;

8
bitmap2component/bitmap2cmp_frame.cpp

@ -63,7 +63,7 @@ void IMAGE_SIZE::SetOutputSizeFromInitialImageSize()
// Set the m_outputSize value from the m_originalSizePixels and the selected unit
if( m_unit == EDA_UNITS::MM )
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI * 25.4;
else if( m_unit == EDA_UNITS::IN )
else if( m_unit == EDA_UNITS::INCH )
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI;
else
m_outputSize = m_originalDPI;
@ -76,7 +76,7 @@ int IMAGE_SIZE::GetOutputDPI()
if( m_unit == EDA_UNITS::MM )
outputDPI = GetOriginalSizePixels() / ( m_outputSize / 25.4 );
else if( m_unit == EDA_UNITS::IN )
else if( m_unit == EDA_UNITS::INCH )
outputDPI = GetOriginalSizePixels() / m_outputSize;
else
outputDPI = KiROUND( m_outputSize );
@ -102,7 +102,7 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
{
size_mm = m_outputSize;
}
else if( m_unit == EDA_UNITS::IN )
else if( m_unit == EDA_UNITS::INCH )
{
size_mm = m_outputSize * 25.4;
}
@ -121,7 +121,7 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
{
m_outputSize = size_mm;
}
else if( aUnit == EDA_UNITS::IN )
else if( aUnit == EDA_UNITS::INCH )
{
m_outputSize = size_mm / 25.4;
}

4
bitmap2component/bitmap2cmp_panel.cpp

@ -268,7 +268,7 @@ wxString BITMAP2CMP_PANEL::formatOutputSize( double aSize )
if( getUnitFromSelection() == EDA_UNITS::MM )
text.Printf( wxS( "%.1f" ), aSize );
else if( getUnitFromSelection() == EDA_UNITS::IN )
else if( getUnitFromSelection() == EDA_UNITS::INCH )
text.Printf( wxS( "%.2f" ), aSize );
else
text.Printf( wxT( "%d" ), KiROUND( aSize ) );
@ -295,7 +295,7 @@ EDA_UNITS BITMAP2CMP_PANEL::getUnitFromSelection()
// return the EDA_UNITS from the m_PixelUnit choice
switch( m_PixelUnit->GetSelection() )
{
case 1: return EDA_UNITS::IN;
case 1: return EDA_UNITS::INCH;
case 2: return EDA_UNITS::UNSCALED;
case 0:
default: return EDA_UNITS::MM;

6
common/eda_draw_frame.cpp

@ -320,7 +320,7 @@ void EDA_DRAW_FRAME::ToggleUserUnits()
}
else
{
SetUserUnits( GetUserUnits() == EDA_UNITS::IN ? EDA_UNITS::MM : EDA_UNITS::IN );
SetUserUnits( GetUserUnits() == EDA_UNITS::INCH ? EDA_UNITS::MM : EDA_UNITS::INCH );
unitsChangeRefresh();
wxCommandEvent e( EDA_EVT_UNITS_CHANGED );
@ -678,7 +678,7 @@ void EDA_DRAW_FRAME::DisplayUnitsMsg()
switch( GetUserUnits() )
{
case EDA_UNITS::IN: msg = _( "inches" ); break;
case EDA_UNITS::INCH: msg = _( "inches" ); break;
case EDA_UNITS::MILS: msg = _( "mils" ); break;
case EDA_UNITS::MM: msg = _( "mm" ); break;
default: msg = _( "Units" ); break;
@ -1270,7 +1270,7 @@ void EDA_DRAW_FRAME::setupUnits( APP_SETTINGS_BASE* aCfg )
{
default:
case EDA_UNITS::MM: m_toolManager->RunAction( ACTIONS::millimetersUnits ); break;
case EDA_UNITS::IN: m_toolManager->RunAction( ACTIONS::inchesUnits ); break;
case EDA_UNITS::INCH: m_toolManager->RunAction( ACTIONS::inchesUnits ); break;
case EDA_UNITS::MILS: m_toolManager->RunAction( ACTIONS::milsUnits ); break;
}
}

18
common/eda_units.cpp

@ -48,7 +48,7 @@ bool EDA_UNIT_UTILS::IsImperialUnit( EDA_UNITS aUnit )
{
switch( aUnit )
{
case EDA_UNITS::IN:
case EDA_UNITS::INCH:
case EDA_UNITS::MILS:
return true;
@ -114,7 +114,7 @@ bool EDA_UNIT_UTILS::FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // "mils" or "thou"
aUnits = EDA_UNITS::MILS;
else if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
aUnits = EDA_UNITS::IN;
aUnits = EDA_UNITS::INCH;
else if( unit == wxT( "de" ) || unit == wxT( "ra" ) ) // "deg" or "rad"
aUnits = EDA_UNITS::DEGREES;
else
@ -135,7 +135,7 @@ wxString EDA_UNIT_UTILS::GetText( EDA_UNITS aUnits, EDA_DATA_TYPE aType )
case EDA_UNITS::CM: label = wxT( " cm" ); break;
case EDA_UNITS::DEGREES: label = wxT( "°" ); break;
case EDA_UNITS::MILS: label = wxT( " mils" ); break;
case EDA_UNITS::IN: label = wxT( " in" ); break;
case EDA_UNITS::INCH: label = wxT( " in" ); break;
case EDA_UNITS::PERCENT: label = wxT( "%" ); break;
case EDA_UNITS::UNSCALED: break;
default: UNIMPLEMENTED_FOR( wxS( "Unknown units" ) ); break;
@ -267,7 +267,7 @@ double EDA_UNIT_UTILS::UI::ToUserUnit( const EDA_IU_SCALE& aIuScale, EDA_UNITS a
case EDA_UNITS::MM: return IU_TO_MM( aValue, aIuScale );
case EDA_UNITS::CM: return IU_TO_MM( aValue, aIuScale ) / 10;
case EDA_UNITS::MILS: return IU_TO_MILS( aValue, aIuScale );
case EDA_UNITS::IN: return IU_TO_IN( aValue, aIuScale );
case EDA_UNITS::INCH: return IU_TO_IN( aValue, aIuScale );
case EDA_UNITS::DEGREES: return aValue;
default: return aValue;
}
@ -305,7 +305,7 @@ wxString EDA_UNIT_UTILS::UI::StringFromValue( const EDA_IU_SCALE& aIuScale, EDA_
{
case EDA_UNITS::MILS: format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.5f" ); break;
case EDA_UNITS::IN: format = is_eeschema ? wxT( "%.6f" ) : wxT( "%.8f" ); break;
case EDA_UNITS::INCH: format = is_eeschema ? wxT( "%.6f" ) : wxT( "%.8f" ); break;
case EDA_UNITS::DEGREES: format = wxT( "%.4f" ); break;
default: format = wxT( "%.10f" ); break;
}
@ -394,7 +394,7 @@ wxString EDA_UNIT_UTILS::UI::MessageTextFromValue( const EDA_IU_SCALE& aIuScale,
case EDA_UNITS::MM: format = is_eeschema ? wxT( "%.2f" ) : wxT( "%.4f" ); break;
case EDA_UNITS::CM: format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.5f" ); break;
case EDA_UNITS::MILS: format = is_eeschema ? wxT( "%.0f" ) : wxT( "%.2f" ); break;
case EDA_UNITS::IN: format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.4f" ); break;
case EDA_UNITS::INCH: format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.4f" ); break;
case EDA_UNITS::DEGREES: format = wxT( "%.3f" ); break;
case EDA_UNITS::UNSCALED: format = wxT( "%.0f" ); break;
}
@ -448,7 +448,7 @@ double EDA_UNIT_UTILS::UI::FromUserUnit( const EDA_IU_SCALE& aIuScale, EDA_UNITS
case EDA_UNITS::MM: return MM_TO_IU( aValue, aIuScale );
case EDA_UNITS::CM: return MM_TO_IU( aValue * 10, aIuScale );
case EDA_UNITS::MILS: return MILS_TO_IU( aValue, aIuScale );
case EDA_UNITS::IN: return IN_TO_IU( aValue, aIuScale );
case EDA_UNITS::INCH: return IN_TO_IU( aValue, aIuScale );
default:
case EDA_UNITS::DEGREES:
case EDA_UNITS::UNSCALED:
@ -532,7 +532,7 @@ double EDA_UNIT_UTILS::UI::DoubleValueFromString( const EDA_IU_SCALE& aIuScale,
|| aUnits == EDA_UNITS::MM
|| aUnits == EDA_UNITS::CM
|| aUnits == EDA_UNITS::MILS
|| aUnits == EDA_UNITS::IN )
|| aUnits == EDA_UNITS::INCH )
{
//check for um, μm (µ is MICRO SIGN) and µm (µ is GREEK SMALL LETTER MU) for micrometre
if( unit == wxT( "um" ) || unit == wxT( "\u00B5m" ) || unit == wxT( "\u03BCm" ) )
@ -553,7 +553,7 @@ double EDA_UNIT_UTILS::UI::DoubleValueFromString( const EDA_IU_SCALE& aIuScale,
}
else if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
{
aUnits = EDA_UNITS::IN;
aUnits = EDA_UNITS::INCH;
}
else if( unit == wxT( "oz" ) ) // 1 oz = 1.37 mils
{

2
common/jobs/job_export_pcb_3d.cpp

@ -36,7 +36,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_3D::FORMAT,
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_3D::VRML_UNITS,
{
{ JOB_EXPORT_PCB_3D::VRML_UNITS::IN, "in" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::INCH, "in" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::METERS, "m" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::MM, "mm" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::TENTHS, "tenths" },

2
common/jobs/job_export_pcb_3d.h

@ -125,7 +125,7 @@ public:
enum class VRML_UNITS
{
IN,
INCH, // Do not use IN: it conflicts with a Windows header
MM,
METERS,
TENTHS // inches

4
common/jobs/job_export_pcb_drill.cpp

@ -36,7 +36,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_DRILL::DRILL_ORIGIN,
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_DRILL::DRILL_UNITS,
{
{ JOB_EXPORT_PCB_DRILL::DRILL_UNITS::IN, "in" },
{ JOB_EXPORT_PCB_DRILL::DRILL_UNITS::INCH, "in" },
{ JOB_EXPORT_PCB_DRILL::DRILL_UNITS::MM, "mm" },
} )
@ -66,7 +66,7 @@ JOB_EXPORT_PCB_DRILL::JOB_EXPORT_PCB_DRILL() :
m_excellonOvalDrillRoute( false ),
m_format( DRILL_FORMAT::EXCELLON ),
m_drillOrigin( DRILL_ORIGIN::ABS ),
m_drillUnits( DRILL_UNITS::IN ),
m_drillUnits( DRILL_UNITS::INCH ),
m_zeroFormat( ZEROS_FORMAT::DECIMAL ),
m_mapFormat( MAP_FORMAT::PDF ),
m_gerberPrecision( 5 ),

2
common/jobs/job_export_pcb_drill.h

@ -48,7 +48,7 @@ public:
enum class DRILL_UNITS
{
IN,
INCH, // Do not use IN: it conflicts with a Windows header
MM
};

4
common/jobs/job_export_pcb_dxf.cpp

@ -30,7 +30,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_DXF::GEN_MODE,
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_DXF::DXF_UNITS,
{
{ JOB_EXPORT_PCB_DXF::DXF_UNITS::IN, "in" },
{ JOB_EXPORT_PCB_DXF::DXF_UNITS::INCH, "in" },
{ JOB_EXPORT_PCB_DXF::DXF_UNITS::MM, "mm" },
} )
@ -38,7 +38,7 @@ JOB_EXPORT_PCB_DXF::JOB_EXPORT_PCB_DXF() :
JOB_EXPORT_PCB_PLOT( JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::DXF, "dxf", false ),
m_plotGraphicItemsUsingContours( true ),
m_polygonMode( true ),
m_dxfUnits( DXF_UNITS::IN ),
m_dxfUnits( DXF_UNITS::INCH ),
m_genMode( GEN_MODE::MULTI )
{
m_plotDrawingSheet = false;

2
common/jobs/job_export_pcb_dxf.h

@ -37,7 +37,7 @@ public:
enum class DXF_UNITS
{
IN,
INCH, // Do not use IN: it conflicts with a Windows header
MM
};

2
common/jobs/job_export_pcb_odb.cpp

@ -24,7 +24,7 @@
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_ODB::ODB_UNITS,
{
{ JOB_EXPORT_PCB_ODB::ODB_UNITS::IN, "in" },
{ JOB_EXPORT_PCB_ODB::ODB_UNITS::INCH, "in" },
{ JOB_EXPORT_PCB_ODB::ODB_UNITS::MM, "mm" },
} )

2
common/jobs/job_export_pcb_odb.h

@ -36,7 +36,7 @@ public:
enum class ODB_UNITS
{
MM,
IN,
INCH, // Do not use IN: it conflicts with a Windows header
};
enum class ODB_COMPRESSION

2
common/jobs/job_export_pcb_pos.cpp

@ -39,7 +39,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_POS::SIDE,
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_POS::UNITS,
{
{ JOB_EXPORT_PCB_POS::UNITS::IN, "in" },
{ JOB_EXPORT_PCB_POS::UNITS::INCH, "in" },
{ JOB_EXPORT_PCB_POS::UNITS::MM, "mm" },
} )

2
common/jobs/job_export_pcb_pos.h

@ -44,7 +44,7 @@ public:
enum class UNITS
{
IN,
INCH, // Do not use IN: it conflicts with a Windows header
MM
};

2
common/jobs/job_rc.cpp

@ -22,7 +22,7 @@
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_RC::UNITS, {
{ JOB_RC::UNITS::IN, "in" },
{ JOB_RC::UNITS::INCH, "in" },
{ JOB_RC::UNITS::MM, "mm" },
{ JOB_RC::UNITS::MILS, "mils" },
} )

2
common/jobs/job_rc.h

@ -32,7 +32,7 @@ public:
enum class UNITS
{
IN,
INCH, // Do not use IN: it conflicts with a Windows header
MM,
MILS
};

2
common/libeval/numeric_evaluator.cpp

@ -84,7 +84,7 @@ void NUMERIC_EVALUATOR::SetDefaultUnits( EDA_UNITS aUnits )
{
case EDA_UNITS::MM: m_defaultUnits = Unit::MM; break;
case EDA_UNITS::MILS: m_defaultUnits = Unit::Mil; break;
case EDA_UNITS::IN: m_defaultUnits = Unit::Inch; break;
case EDA_UNITS::INCH: m_defaultUnits = Unit::Inch; break;
case EDA_UNITS::DEGREES: m_defaultUnits = Unit::Degrees; break;
case EDA_UNITS::UNSCALED: m_defaultUnits = Unit::SI; break;
default: m_defaultUnits = Unit::MM; break;

2
common/plotters/DXF_plotter.cpp

@ -141,7 +141,7 @@ void DXF_PLOTTER::SetUnits( DXF_UNITS aUnit )
m_measurementDirective = 1;
break;
case DXF_UNITS::IN:
case DXF_UNITS::INCH:
default:
m_unitScalingFactor = 0.0001;
m_measurementDirective = 0;

2
common/preview_items/preview_utils.cpp

@ -49,7 +49,7 @@ wxString KIGFX::PREVIEW::DimensionLabel( const wxString& prefix, double aVal,
case EDA_UNITS::MM: fmtStr = wxT( "%.3f" ); break; // 1um
case EDA_UNITS::CM: fmtStr = wxT( "%.4f" ); break; // 1um
case EDA_UNITS::MILS: fmtStr = wxT( "%.1f" ); break; // 0.1mil
case EDA_UNITS::IN: fmtStr = wxT( "%.4f" ); break; // 0.1mil
case EDA_UNITS::INCH: fmtStr = wxT( "%.4f" ); break; // 0.1mil
case EDA_UNITS::DEGREES: fmtStr = wxT( "%.1f" ); break; // 0.1deg
case EDA_UNITS::PERCENT: fmtStr = wxT( "%.1f" ); break; // 0.1%
case EDA_UNITS::UNSCALED: fmtStr = wxT( "%f" ); break;

2
common/tool/actions.cpp

@ -973,7 +973,7 @@ TOOL_ACTION ACTIONS::inchesUnits( TOOL_ACTION_ARGS()
.Icon( BITMAPS::unit_inch )
.ToolbarState( TOOLBAR_STATE::TOGGLE )
.Flags( AF_NONE )
.Parameter( EDA_UNITS::IN ) );
.Parameter( EDA_UNITS::INCH ) );
TOOL_ACTION ACTIONS::milsUnits( TOOL_ACTION_ARGS()
.Name( "common.Control.mils" )

2
common/tool/common_tools.cpp

@ -50,7 +50,7 @@
COMMON_TOOLS::COMMON_TOOLS() :
TOOL_INTERACTIVE( "common.Control" ),
m_frame( nullptr ),
m_imperialUnit( EDA_UNITS::IN ),
m_imperialUnit( EDA_UNITS::INCH ),
m_metricUnit( EDA_UNITS::MM )
{
}

2
cvpcb/display_footprints_frame.cpp

@ -204,7 +204,7 @@ void DISPLAY_FOOTPRINTS_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( PCB_ACTIONS::showPadNumbers, CHECK( cond.PadNumbersDisplay() ) );

2
eeschema/eeschema_jobs_handler.cpp

@ -1146,7 +1146,7 @@ int EESCHEMA_JOBS_HANDLER::JobSchErc( JOB* aJob )
switch( ercJob->m_units )
{
case JOB_SCH_ERC::UNITS::IN: units = EDA_UNITS::IN; break;
case JOB_SCH_ERC::UNITS::INCH: units = EDA_UNITS::INCH; break;
case JOB_SCH_ERC::UNITS::MILS: units = EDA_UNITS::MILS; break;
case JOB_SCH_ERC::UNITS::MM: units = EDA_UNITS::MM; break;
default: units = EDA_UNITS::MM; break;

2
eeschema/sch_edit_frame.cpp

@ -631,7 +631,7 @@ void SCH_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::toggleGridOverrides, CHECK( cond.GridOverrides() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( EE_ACTIONS::lineModeFree,

2
eeschema/symbol_editor/symbol_edit_frame.cpp

@ -488,7 +488,7 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::toggleGridOverrides, CHECK( cond.GridOverrides() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( ACTIONS::cut, ENABLE( isEditableCond ) );

2
gerbview/gerbview_frame.cpp

@ -1136,7 +1136,7 @@ void GERBVIEW_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
auto flashedDisplayOutlinesCond =

2
gerbview/toolbars_gerber.cpp

@ -313,7 +313,7 @@ void GERBVIEW_FRAME::updateDCodeSelectBox()
units = wxT( "mm" );
break;
case EDA_UNITS::IN:
case EDA_UNITS::INCH:
scale = gerbIUScale.IU_PER_MILS * 1000;
units = wxT( "in" );
break;

2
gerbview/tools/gerbview_inspection_tool.cpp

@ -83,7 +83,7 @@ int GERBVIEW_INSPECTION_TOOL::ShowDCodes( const TOOL_EVENT& aEvent )
units = wxT( "mm" );
break;
case EDA_UNITS::IN:
case EDA_UNITS::INCH:
scale = gerbIUScale.IU_PER_MILS * 1000;
units = wxT( "in" );
break;

2
include/eda_units.h

@ -44,7 +44,7 @@ enum class EDA_DATA_TYPE
enum class EDA_UNITS
{
IN = 0,
INCH = 0, // Do not use IN: it conflicts with a Windows header
MM = 1,
UNSCALED = 2,
DEGREES = 3,

2
include/plotters/plotter.h

@ -51,7 +51,7 @@ using KIGFX::RENDER_SETTINGS;
// Units (inch/mm for DXF plotter
enum class DXF_UNITS
{
IN = 0,
INCH = 0, // Do not use MM: it conficts with a Windows header
MM = 1
};

2
include/plotters/plotter_dxf.h

@ -31,7 +31,7 @@ public:
m_textAsLines = true;
m_currentColor = COLOR4D::BLACK;
m_currentLineType = LINE_STYLE::SOLID;
SetUnits( DXF_UNITS::IN );
SetUnits( DXF_UNITS::INCH );
}
virtual PLOT_FORMAT GetPlotterType() const override

2
kicad/cli/command_pcb_drc.cpp

@ -135,7 +135,7 @@ int CLI::PCB_DRC_COMMAND::doPerform( KIWAY& aKiway )
}
else if( units == wxS( "in" ) )
{
drcJob->m_units = JOB_PCB_DRC::UNITS::IN;
drcJob->m_units = JOB_PCB_DRC::UNITS::INCH;
}
else if( units == wxS( "mils" ) )
{

2
kicad/cli/command_pcb_export_3d.cpp

@ -281,7 +281,7 @@ int CLI::PCB_EXPORT_3D_COMMAND::doPerform( KIWAY& aKiway )
wxString units = From_UTF8( m_argParser.get<std::string>( ARG_VRML_UNITS ).c_str() );
if( units == wxS( "in" ) )
step->m_vrmlUnits = JOB_EXPORT_PCB_3D::VRML_UNITS::IN;
step->m_vrmlUnits = JOB_EXPORT_PCB_3D::VRML_UNITS::INCH;
else if( units == wxS( "mm" ) )
step->m_vrmlUnits = JOB_EXPORT_PCB_3D::VRML_UNITS::MM;
else if( units == wxS( "m" ) )

2
kicad/cli/command_pcb_export_drill.cpp

@ -148,7 +148,7 @@ int CLI::PCB_EXPORT_DRILL_COMMAND::doPerform( KIWAY& aKiway )
}
else if( units == wxS( "in" ) )
{
drillJob->m_drillUnits = JOB_EXPORT_PCB_DRILL::DRILL_UNITS::IN;
drillJob->m_drillUnits = JOB_EXPORT_PCB_DRILL::DRILL_UNITS::INCH;
}
else
{

2
kicad/cli/command_pcb_export_dxf.cpp

@ -147,7 +147,7 @@ int CLI::PCB_EXPORT_DXF_COMMAND::doPerform( KIWAY& aKiway )
}
else if( units == wxS( "in" ) )
{
dxfJob->m_dxfUnits = JOB_EXPORT_PCB_DXF::DXF_UNITS::IN;
dxfJob->m_dxfUnits = JOB_EXPORT_PCB_DXF::DXF_UNITS::INCH;
}
else
{

2
kicad/cli/command_pcb_export_odb.cpp

@ -85,7 +85,7 @@ int CLI::PCB_EXPORT_ODB_COMMAND::doPerform( KIWAY& aKiway )
if( units == "mm" )
job->m_units = JOB_EXPORT_PCB_ODB::ODB_UNITS::MM;
else if( units == "in" )
job->m_units = JOB_EXPORT_PCB_ODB::ODB_UNITS::IN;
job->m_units = JOB_EXPORT_PCB_ODB::ODB_UNITS::INCH;
wxString compression = From_UTF8( m_argParser.get<std::string>( ARG_COMPRESS ).c_str() ).Lower();

2
kicad/cli/command_pcb_export_pos.cpp

@ -144,7 +144,7 @@ int CLI::PCB_EXPORT_POS_COMMAND::doPerform( KIWAY& aKiway )
}
else if( units == wxS( "in" ) )
{
aPosJob->m_units = JOB_EXPORT_PCB_POS::UNITS::IN;
aPosJob->m_units = JOB_EXPORT_PCB_POS::UNITS::INCH;
}
else
{

2
kicad/cli/command_sch_erc.cpp

@ -122,7 +122,7 @@ int CLI::SCH_ERC_COMMAND::doPerform( KIWAY& aKiway )
}
else if( units == wxS( "in" ) )
{
ercJob->m_units = JOB_SCH_ERC::UNITS::IN;
ercJob->m_units = JOB_SCH_ERC::UNITS::INCH;
}
else if( units == wxS( "mils" ) )
{

10
pagelayout_editor/pl_editor_frame.cpp

@ -304,7 +304,7 @@ void PL_EDITOR_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( ACTIONS::cut, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
@ -705,9 +705,9 @@ void PL_EDITOR_FRAME::DisplayGridMsg()
switch( GetUserUnits() )
{
case EDA_UNITS::IN: gridformatter = wxS( "grid %.3f" ); break;
case EDA_UNITS::MM: gridformatter = wxS( "grid %.4f" ); break;
default: gridformatter = wxS( "grid %f" ); break;
case EDA_UNITS::INCH: gridformatter = wxS( "grid %.3f" ); break;
case EDA_UNITS::MM: gridformatter = wxS( "grid %.4f" ); break;
default: gridformatter = wxS( "grid %f" ); break;
}
double grid = EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, GetUserUnits(),
@ -767,7 +767,7 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
switch( GetUserUnits() )
{
case EDA_UNITS::IN: SetStatusText( _( "inches" ), 6 ); break;
case EDA_UNITS::INCH: SetStatusText( _( "inches" ), 6 ); break;
case EDA_UNITS::MILS: SetStatusText( _( "mils" ), 6 ); break;
case EDA_UNITS::MM: SetStatusText( _( "mm" ), 6 ); break;
case EDA_UNITS::UNSCALED: SetStatusText( wxEmptyString, 6 ); break;

4
pcbnew/api/api_pcb_enums.cpp

@ -641,7 +641,7 @@ types::DimensionUnit ToProtoEnum( DIM_UNITS_MODE aValue )
{
switch( aValue )
{
case DIM_UNITS_MODE::IN: return types::DimensionUnit::DU_INCHES;
case DIM_UNITS_MODE::INCH: return types::DimensionUnit::DU_INCHES;
case DIM_UNITS_MODE::MILS: return types::DimensionUnit::DU_MILS;
case DIM_UNITS_MODE::MM: return types::DimensionUnit::DU_MILLIMETERS;
case DIM_UNITS_MODE::AUTOMATIC: return types::DimensionUnit::DU_AUTOMATIC;
@ -658,7 +658,7 @@ DIM_UNITS_MODE FromProtoEnum( types::DimensionUnit aValue )
{
switch( aValue )
{
case types::DimensionUnit::DU_INCHES: return DIM_UNITS_MODE::IN;
case types::DimensionUnit::DU_INCHES: return DIM_UNITS_MODE::INCH;
case types::DimensionUnit::DU_MILS: return DIM_UNITS_MODE::MILS;
case types::DimensionUnit::DU_MILLIMETERS: return DIM_UNITS_MODE::MM;
case types::DimensionUnit::DU_UNKNOWN:

2
pcbnew/board_design_settings.cpp

@ -813,7 +813,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
&m_TextUpright[LAYER_CLASS_OTHERS], true ) );
m_params.emplace_back( new PARAM_ENUM<DIM_UNITS_MODE>( "defaults.dimension_units",
&m_DimensionUnitsMode, DIM_UNITS_MODE::AUTOMATIC, DIM_UNITS_MODE::IN,
&m_DimensionUnitsMode, DIM_UNITS_MODE::AUTOMATIC, DIM_UNITS_MODE::INCH,
DIM_UNITS_MODE::AUTOMATIC ) );
m_params.emplace_back( new PARAM_ENUM<DIM_PRECISION>( "defaults.dimension_precision",

4
pcbnew/dialogs/dialog_dimension_properties.cpp

@ -205,7 +205,7 @@ bool DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow()
switch( m_dimension->GetUnitsMode() )
{
case DIM_UNITS_MODE::IN: m_cbUnits->SetSelection( 0 ); break;
case DIM_UNITS_MODE::INCH: m_cbUnits->SetSelection( 0 ); break;
case DIM_UNITS_MODE::MILS: m_cbUnits->SetSelection( 1 ); break;
case DIM_UNITS_MODE::MM: m_cbUnits->SetSelection( 2 ); break;
case DIM_UNITS_MODE::AUTOMATIC: m_cbUnits->SetSelection( 3 ); break;
@ -396,7 +396,7 @@ void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( PCB_DIMENSION_BASE*
switch( m_cbUnits->GetSelection() )
{
case 0: aTarget->SetUnitsMode( DIM_UNITS_MODE::IN ); break;
case 0: aTarget->SetUnitsMode( DIM_UNITS_MODE::INCH ); break;
case 1: aTarget->SetUnitsMode( DIM_UNITS_MODE::MILS ); break;
case 2: aTarget->SetUnitsMode( DIM_UNITS_MODE::MM ); break;
case 3: aTarget->SetUnitsMode( DIM_UNITS_MODE::AUTOMATIC ); break;

10
pcbnew/dialogs/dialog_gen_footprint_position.cpp

@ -90,7 +90,7 @@ void DIALOG_GEN_FOOTPRINT_POSITION::initDialog()
PROJECT_FILE& projectFile = m_editFrame->Prj().GetProjectFile();
PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings();
m_units = cfg->m_PlaceFile.units == 0 ? EDA_UNITS::IN : EDA_UNITS::MM;
m_units = cfg->m_PlaceFile.units == 0 ? EDA_UNITS::INCH : EDA_UNITS::MM;
// Output directory
m_outputDirectoryName->SetValue( projectFile.m_PcbLastPath[LAST_PATH_POS_FILES] );
@ -113,7 +113,7 @@ void DIALOG_GEN_FOOTPRINT_POSITION::initDialog()
SetTitle( m_job->GetSettingsDialogTitle() );
m_browseButton->Hide();
m_units = m_job->m_units == JOB_EXPORT_PCB_POS::UNITS::IN ? EDA_UNITS::IN : EDA_UNITS::MM;
m_units = m_job->m_units == JOB_EXPORT_PCB_POS::UNITS::INCH ? EDA_UNITS::INCH : EDA_UNITS::MM;
m_staticTextDir->SetLabel( _( "Output file:" ) );
m_outputDirectoryName->SetValue( m_job->GetConfiguredOutputPath() );
@ -264,7 +264,7 @@ void DIALOG_GEN_FOOTPRINT_POSITION::onGenerate( wxCommandEvent& event )
{
if( !m_job )
{
m_units = m_unitsCtrl->GetSelection() == 0 ? EDA_UNITS::IN : EDA_UNITS::MM;
m_units = m_unitsCtrl->GetSelection() == 0 ? EDA_UNITS::INCH : EDA_UNITS::MM;
PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings();
@ -274,7 +274,7 @@ void DIALOG_GEN_FOOTPRINT_POSITION::onGenerate( wxCommandEvent& event )
m_editFrame->Prj().GetProjectFile().m_PcbLastPath[LAST_PATH_POS_FILES] = dirStr;
cfg->m_PlaceFile.output_directory = dirStr;
cfg->m_PlaceFile.units = m_units == EDA_UNITS::IN ? 0 : 1;
cfg->m_PlaceFile.units = m_units == EDA_UNITS::INCH ? 0 : 1;
cfg->m_PlaceFile.file_options = m_singleFile->GetValue() ? 1 : 0;
cfg->m_PlaceFile.file_format = m_formatCtrl->GetSelection();
cfg->m_PlaceFile.include_board_edge = m_cbIncludeBoardEdge->GetValue();
@ -291,7 +291,7 @@ void DIALOG_GEN_FOOTPRINT_POSITION::onGenerate( wxCommandEvent& event )
else
{
m_job->SetConfiguredOutputPath( m_outputDirectoryName->GetValue() );
m_job->m_units = m_unitsCtrl->GetSelection() == 0 ? JOB_EXPORT_PCB_POS::UNITS::IN
m_job->m_units = m_unitsCtrl->GetSelection() == 0 ? JOB_EXPORT_PCB_POS::UNITS::INCH
: JOB_EXPORT_PCB_POS::UNITS::MM;
m_job->m_format = static_cast<JOB_EXPORT_PCB_POS::FORMAT>( m_formatCtrl->GetSelection() );
m_job->m_side = JOB_EXPORT_PCB_POS::SIDE::BOTH;

4
pcbnew/dialogs/dialog_gendrill.cpp

@ -139,7 +139,7 @@ bool DIALOG_GENDRILL::TransferDataFromWindow()
m_job->m_format = m_rbExcellon->GetValue() ? JOB_EXPORT_PCB_DRILL::DRILL_FORMAT::EXCELLON
: JOB_EXPORT_PCB_DRILL::DRILL_FORMAT::GERBER;
m_job->m_drillUnits = m_units->GetSelection() == 0 ? JOB_EXPORT_PCB_DRILL::DRILL_UNITS::MM
: JOB_EXPORT_PCB_DRILL::DRILL_UNITS::IN;
: JOB_EXPORT_PCB_DRILL::DRILL_UNITS::INCH;
m_job->m_drillOrigin = static_cast<JOB_EXPORT_PCB_DRILL::DRILL_ORIGIN>( m_origin->GetSelection() );
m_job->m_excellonCombinePTHNPTH = m_Check_Merge_PTH_NPTH->IsChecked();
m_job->m_excellonMinimalHeader = m_Check_Minimal->IsChecked();
@ -185,7 +185,7 @@ bool DIALOG_GENDRILL::TransferDataToWindow()
m_rbExcellon->SetValue( m_job->m_format == JOB_EXPORT_PCB_DRILL::DRILL_FORMAT::EXCELLON );
m_rbGerberX2->SetValue( m_job->m_format == JOB_EXPORT_PCB_DRILL::DRILL_FORMAT::GERBER );
m_units->SetSelection( m_job->m_drillUnits == JOB_EXPORT_PCB_DRILL::DRILL_UNITS::IN );
m_units->SetSelection( m_job->m_drillUnits == JOB_EXPORT_PCB_DRILL::DRILL_UNITS::INCH );
m_zeros->SetSelection( static_cast<int>( m_job->m_zeroFormat ) );
updatePrecisionOptions();
m_Check_Minimal->SetValue( m_job->m_excellonMinimalHeader );

8
pcbnew/dialogs/dialog_plot.cpp

@ -403,7 +403,7 @@ void DIALOG_PLOT::init_Dialog()
== PLOT_TEXT_MODE::DEFAULT );
// DXF units selection
m_DXF_plotUnits->SetSelection( m_plotOpts.GetDXFPlotUnits() == DXF_UNITS::IN ? 0 : 1 );
m_DXF_plotUnits->SetSelection( m_plotOpts.GetDXFPlotUnits() == DXF_UNITS::INCH ? 0 : 1 );
// Plot mirror option
m_plotMirrorOpt->SetValue( m_plotOpts.GetMirror() );
@ -451,8 +451,8 @@ void DIALOG_PLOT::transferPlotParamsToJob()
if( m_job->m_plotFormat == JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::DXF )
{
JOB_EXPORT_PCB_DXF* dxfJob = static_cast<JOB_EXPORT_PCB_DXF*>( m_job );
dxfJob->m_dxfUnits = m_plotOpts.GetDXFPlotUnits() == DXF_UNITS::IN
? JOB_EXPORT_PCB_DXF::DXF_UNITS::IN
dxfJob->m_dxfUnits = m_plotOpts.GetDXFPlotUnits() == DXF_UNITS::INCH
? JOB_EXPORT_PCB_DXF::DXF_UNITS::INCH
: JOB_EXPORT_PCB_DXF::DXF_UNITS::MM;
dxfJob->m_plotGraphicItemsUsingContours = m_plotOpts.GetPlotMode() == OUTLINE_MODE::SKETCH;
dxfJob->m_polygonMode = m_plotOpts.GetDXFPlotPolygonMode();
@ -1053,7 +1053,7 @@ void DIALOG_PLOT::applyPlotSettings()
tempOptions.SetDXFPlotPolygonMode( m_DXF_plotModeOpt->GetValue() );
sel = m_DXF_plotUnits->GetSelection();
tempOptions.SetDXFPlotUnits( sel == 0 ? DXF_UNITS::IN : DXF_UNITS::MM );
tempOptions.SetDXFPlotUnits( sel == 0 ? DXF_UNITS::INCH : DXF_UNITS::MM );
if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() ) // Currently, only DXF supports this option
tempOptions.SetTextMode( PLOT_TEXT_MODE::DEFAULT );

18
pcbnew/dialogs/panel_setup_constraints.cpp

@ -124,34 +124,34 @@ bool PANEL_SETUP_CONSTRAINTS::TransferDataToWindow()
bool PANEL_SETUP_CONSTRAINTS::TransferDataFromWindow()
{
if( !m_minClearance.Validate( 0, 10, EDA_UNITS::IN ) )
if( !m_minClearance.Validate( 0, 10, EDA_UNITS::INCH ) )
return false;
if( !m_minConn.Validate( 0, 10, EDA_UNITS::IN ) )
if( !m_minConn.Validate( 0, 10, EDA_UNITS::INCH ) )
return false;
if( !m_trackMinWidth.Validate( 0, 10, EDA_UNITS::IN ) )
if( !m_trackMinWidth.Validate( 0, 10, EDA_UNITS::INCH ) )
return false;
if( !m_viaMinAnnulus.Validate( 0, 10, EDA_UNITS::IN ) )
if( !m_viaMinAnnulus.Validate( 0, 10, EDA_UNITS::INCH ) )
return false;
if( !m_viaMinSize.Validate( 0, 10, EDA_UNITS::IN ) )
if( !m_viaMinSize.Validate( 0, 10, EDA_UNITS::INCH ) )
return false;
if( !m_holeClearance.Validate( 0, 10, EDA_UNITS::IN ) )
if( !m_holeClearance.Validate( 0, 10, EDA_UNITS::INCH ) )
return false;
if( !m_edgeClearance.Validate( 0, 10, EDA_UNITS::IN ) )
if( !m_edgeClearance.Validate( 0, 10, EDA_UNITS::INCH ) )
return false;
if( !m_minGrooveWidth.Validate( 0, 10, EDA_UNITS::IN ) )
if( !m_minGrooveWidth.Validate( 0, 10, EDA_UNITS::INCH ) )
return false;
if( !m_throughHoleMin.Validate( 2, 1000, EDA_UNITS::MILS ) ) // #107 to 1 inch
return false;
if( !m_holeToHoleMin.Validate( 0, 10, EDA_UNITS::IN ) )
if( !m_holeToHoleMin.Validate( 0, 10, EDA_UNITS::INCH ) )
return false;
// These are all stored in project file, not board, so no need for OnModify()

2
pcbnew/exporters/gen_drill_report_files.cpp

@ -179,7 +179,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
{
DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER;
dxf_plotter->SetUnits( m_unitsMetric ? DXF_UNITS::MM : DXF_UNITS::IN );
dxf_plotter->SetUnits( m_unitsMetric ? DXF_UNITS::MM : DXF_UNITS::INCH );
plotter = dxf_plotter;
plotter->SetPageSettings( page_info );

2
pcbnew/files.cpp

@ -1443,7 +1443,7 @@ void PCB_EDIT_FRAME::GenODBPPFiles( wxCommandEvent& event )
job.m_precision = dlg.GetPrecision();
job.m_units = dlg.GetUnitsString() == "mm" ? JOB_EXPORT_PCB_ODB::ODB_UNITS::MM
: JOB_EXPORT_PCB_ODB::ODB_UNITS::IN;
: JOB_EXPORT_PCB_ODB::ODB_UNITS::INCH;
WX_PROGRESS_REPORTER progressReporter( this, _( "Generating ODB++ output files" ), 3, false );
WX_STRING_REPORTER reporter;

2
pcbnew/footprint_chooser_frame.cpp

@ -772,7 +772,7 @@ void FOOTPRINT_CHOOSER_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( PCB_ACTIONS::showPadNumbers, CHECK( cond.PadNumbersDisplay() ) );

2
pcbnew/footprint_edit_frame.cpp

@ -1255,7 +1255,7 @@ void FOOTPRINT_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::toggleGridOverrides, CHECK( cond.GridOverrides() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );

4
pcbnew/footprint_editor_settings.cpp

@ -289,7 +289,7 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
// Dimension settings
m_params.emplace_back( new PARAM_ENUM<DIM_UNITS_MODE>( "design_settings.dimensions.units",
&m_DesignSettings.m_DimensionUnitsMode, DIM_UNITS_MODE::AUTOMATIC, DIM_UNITS_MODE::IN,
&m_DesignSettings.m_DimensionUnitsMode, DIM_UNITS_MODE::AUTOMATIC, DIM_UNITS_MODE::INCH,
DIM_UNITS_MODE::AUTOMATIC ) );
m_params.emplace_back( new PARAM_ENUM<DIM_PRECISION>( "design_settings.dimensions.precision",
@ -484,7 +484,7 @@ bool FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
if( aCfg->Read( f + "PcbUserGrid_X", &x ) && aCfg->Read( f + "PcbUserGrid_Y", &y ) )
{
EDA_UNITS u = static_cast<EDA_UNITS>( aCfg->ReadLong( f + "PcbUserGrid_Unit",
static_cast<long>( EDA_UNITS::IN ) ) );
static_cast<long>( EDA_UNITS::INCH ) ) );
// Convert to internal units
x = EDA_UNIT_UTILS::UI::FromUserUnit( pcbIUScale, u, x );

2
pcbnew/footprint_viewer_frame.cpp

@ -350,7 +350,7 @@ void FOOTPRINT_VIEWER_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( PCB_ACTIONS::saveFpToBoard, ENABLE( addToBoardCond ) );

12
pcbnew/pcb_dimension.cpp

@ -147,7 +147,7 @@ static void CollectKnockedOutSegments( const SHAPE_POLY_SET& aPoly, const SEG& a
PCB_DIMENSION_BASE::PCB_DIMENSION_BASE( BOARD_ITEM* aParent, KICAD_T aType ) :
PCB_TEXT( aParent, aType ),
m_overrideTextEnabled( false ),
m_units( EDA_UNITS::IN ),
m_units( EDA_UNITS::INCH ),
m_autoUnits( false ),
m_unitsFormat( DIM_UNITS_FORMAT::BARE_SUFFIX ),
m_arrowDirection( DIM_ARROW_DIRECTION::OUTWARD ),
@ -429,7 +429,7 @@ wxString PCB_DIMENSION_BASE::GetValueText() const
{
switch( m_units )
{
case EDA_UNITS::IN: precision = precision - 4; break;
case EDA_UNITS::INCH: precision = precision - 4; break;
case EDA_UNITS::MILS: precision = std::max( 0, precision - 7 ); break;
case EDA_UNITS::MM: precision = precision - 5; break;
default: precision = precision - 4; break;
@ -487,7 +487,7 @@ DIM_UNITS_MODE PCB_DIMENSION_BASE::GetUnitsMode() const
switch( m_units )
{
default:
case EDA_UNITS::IN: return DIM_UNITS_MODE::IN;
case EDA_UNITS::INCH: return DIM_UNITS_MODE::INCH;
case EDA_UNITS::MM: return DIM_UNITS_MODE::MM;
case EDA_UNITS::MILS: return DIM_UNITS_MODE::MILS;
}
@ -499,9 +499,9 @@ void PCB_DIMENSION_BASE::SetUnitsMode( DIM_UNITS_MODE aMode )
{
switch( aMode )
{
case DIM_UNITS_MODE::IN:
case DIM_UNITS_MODE::INCH:
m_autoUnits = false;
m_units = EDA_UNITS::IN;
m_units = EDA_UNITS::INCH;
break;
case DIM_UNITS_MODE::MILS:
@ -1783,7 +1783,7 @@ static struct DIMENSION_DESC
.Map( DIM_UNITS_FORMAT::PAREN_SUFFIX, _HKI( "1234.0 (mm)" ) );
ENUM_MAP<DIM_UNITS_MODE>::Instance()
.Map( DIM_UNITS_MODE::IN, _HKI( "Inches" ) )
.Map( DIM_UNITS_MODE::INCH, _HKI( "Inches" ) )
.Map( DIM_UNITS_MODE::MILS, _HKI( "Mils" ) )
.Map( DIM_UNITS_MODE::MM, _HKI( "Millimeters" ) )
.Map( DIM_UNITS_MODE::AUTOMATIC, _HKI( "Automatic" ) );

2
pcbnew/pcb_dimension.h

@ -70,7 +70,7 @@ enum class DIM_TEXT_POSITION
*/
enum class DIM_UNITS_MODE
{
IN,
INCH, // Do not use IN: it conflicts with a Windows header
MILS,
MM,
AUTOMATIC

2
pcbnew/pcb_edit_frame.cpp

@ -805,7 +805,7 @@ void PCB_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::togglePolarCoords, CHECK( cond.PolarCoordinates() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );

4
pcbnew/pcb_io/altium/altium_pcb.cpp

@ -1646,7 +1646,7 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem )
switch( aElem.textunit )
{
case ALTIUM_UNIT::IN: dimension->SetUnits( EDA_UNITS::IN ); break;
case ALTIUM_UNIT::IN: dimension->SetUnits( EDA_UNITS::INCH ); break;
case ALTIUM_UNIT::MILS: dimension->SetUnits( EDA_UNITS::MILS ); break;
case ALTIUM_UNIT::MM: dimension->SetUnits( EDA_UNITS::MM ); break;
case ALTIUM_UNIT::CM: dimension->SetUnits( EDA_UNITS::MM ); break;
@ -1697,7 +1697,7 @@ void ALTIUM_PCB::HelperParseDimensions6Radial(const ADIMENSION6 &aElem)
switch( aElem.textunit )
{
case ALTIUM_UNIT::IN: dimension->SetUnits( EDA_UNITS::IN ); break;
case ALTIUM_UNIT::IN: dimension->SetUnits( EDA_UNITS::INCH ); break;
case ALTIUM_UNIT::MILS: dimension->SetUnits( EDA_UNITS::MILS ); break;
case ALTIUM_UNIT::MM: dimension->SetUnits( EDA_UNITS::MM ); break;
case ALTIUM_UNIT::CM: dimension->SetUnits( EDA_UNITS::MM ); break;

2
pcbnew/pcb_io/cadstar/cadstar_pcb_archive_loader.cpp

@ -3725,7 +3725,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::applyDimensionSettings( const DIMENSION& aCads
break;
case UNITS::INCH:
aKiCadDim->SetUnitsMode( DIM_UNITS_MODE::IN );
aKiCadDim->SetUnitsMode( DIM_UNITS_MODE::INCH );
break;
case UNITS::THOU:

6
pcbnew/pcb_plot_params.cpp

@ -105,7 +105,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
m_plotDrawingSheet = false;
m_plotMode = FILLED;
m_DXFPolygonMode = true;
m_DXFUnits = DXF_UNITS::IN;
m_DXFUnits = DXF_UNITS::INCH;
m_useAuxOrigin = false;
m_HPGLPenNum = 1;
m_HPGLPenSpeed = 20; // this param is always in cm/s
@ -219,7 +219,7 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter ) const
// DXF options
KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_dxfpolygonmode ), m_DXFPolygonMode );
KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_dxfimperialunits ),
m_DXFUnits == DXF_UNITS::IN );
m_DXFUnits == DXF_UNITS::INCH );
KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_dxfusepcbnewfont ),
m_textMode != PLOT_TEXT_MODE::NATIVE );
@ -776,7 +776,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams )
break;
case T_dxfimperialunits:
aPcbPlotParams->m_DXFUnits = parseBool() ? DXF_UNITS::IN : DXF_UNITS::MM;
aPcbPlotParams->m_DXFUnits = parseBool() ? DXF_UNITS::INCH : DXF_UNITS::MM;
break;
case T_dxfusepcbnewfont:

4
pcbnew/pcb_plotter.cpp

@ -348,8 +348,8 @@ void PCB_PLOTTER::PlotJobToPlotOpts( PCB_PLOT_PARAMS& aOpts, JOB_EXPORT_PCB_PLOT
if( aJob->m_plotFormat == JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::DXF )
{
JOB_EXPORT_PCB_DXF* dxfJob = static_cast<JOB_EXPORT_PCB_DXF*>( aJob );
aOpts.SetDXFPlotUnits( dxfJob->m_dxfUnits == JOB_EXPORT_PCB_DXF::DXF_UNITS::IN
? DXF_UNITS::IN
aOpts.SetDXFPlotUnits( dxfJob->m_dxfUnits == JOB_EXPORT_PCB_DXF::DXF_UNITS::INCH
? DXF_UNITS::INCH
: DXF_UNITS::MM );
aOpts.SetPlotMode( dxfJob->m_plotGraphicItemsUsingContours ? OUTLINE_MODE::SKETCH

2
pcbnew/pcbexpr_evaluator.cpp

@ -571,7 +571,7 @@ double PCBEXPR_UNIT_RESOLVER::Convert( const wxString& aString, int unitId ) con
{
case 0: return EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::MILS, aString );
case 1: return EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::MM, aString );
case 2: return EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::IN, aString );
case 2: return EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::INCH, aString );
default: return v;
}
};

6
pcbnew/pcbnew_jobs_handler.cpp

@ -393,7 +393,7 @@ int PCBNEW_JOBS_HANDLER::JobExportStep( JOB* aJob )
case JOB_EXPORT_PCB_3D::VRML_UNITS::MM: scale = 1.0; break;
case JOB_EXPORT_PCB_3D::VRML_UNITS::METERS: scale = 0.001; break;
case JOB_EXPORT_PCB_3D::VRML_UNITS::TENTHS: scale = 10.0 / 25.4; break;
case JOB_EXPORT_PCB_3D::VRML_UNITS::IN: scale = 1.0 / 25.4; break;
case JOB_EXPORT_PCB_3D::VRML_UNITS::INCH: scale = 1.0 / 25.4; break;
}
EXPORTER_VRML vrmlExporter( brd );
@ -1324,7 +1324,7 @@ int PCBNEW_JOBS_HANDLER::JobExportDrill( JOB* aJob )
DRILL_PRECISION precision;
if( aDrillJob->m_drillUnits == JOB_EXPORT_PCB_DRILL::DRILL_UNITS::IN )
if( aDrillJob->m_drillUnits == JOB_EXPORT_PCB_DRILL::DRILL_UNITS::INCH )
precision = precisionListForInches;
else
precision = precisionListForMetric;
@ -1813,7 +1813,7 @@ int PCBNEW_JOBS_HANDLER::JobExportDrc( JOB* aJob )
switch( drcJob->m_units )
{
case JOB_PCB_DRC::UNITS::IN: units = EDA_UNITS::IN; break;
case JOB_PCB_DRC::UNITS::INCH: units = EDA_UNITS::INCH; break;
case JOB_PCB_DRC::UNITS::MILS: units = EDA_UNITS::MILS; break;
case JOB_PCB_DRC::UNITS::MM: units = EDA_UNITS::MM; break;
default: units = EDA_UNITS::MM; break;

2
pcbnew/pcbnew_settings.cpp

@ -991,7 +991,7 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
if( aCfg->Read( f + "PcbUserGrid_X", &x ) && aCfg->Read( f + "PcbUserGrid_Y", &y ) )
{
EDA_UNITS u = static_cast<EDA_UNITS>( aCfg->ReadLong( f + "PcbUserGrid_Unit",
static_cast<long>( EDA_UNITS::IN ) ) );
static_cast<long>( EDA_UNITS::INCH ) ) );
// Convert to internal units
x = EDA_UNIT_UTILS::UI::FromUserUnit( pcbIUScale, u, x );

2
pcbnew/toolbars_pcb_editor.cpp

@ -448,7 +448,7 @@ static wxString ComboBoxUnits( EDA_UNITS aUnits, double aValue, bool aIncludeLab
case EDA_UNITS::UNSCALED: format = wxT( "%.0f" ); break;
case EDA_UNITS::MM: format = wxT( "%.3f" ); break;
case EDA_UNITS::MILS: format = wxT( "%.2f" ); break;
case EDA_UNITS::IN: format = wxT( "%.5f" ); break;
case EDA_UNITS::INCH: format = wxT( "%.5f" ); break;
}
text.Printf( format, EDA_UNIT_UTILS::UI::ToUserUnit( pcbIUScale, aUnits, aValue ) );

2
pcbnew/tools/drawing_stackup_table_tool.cpp

@ -260,7 +260,7 @@ std::vector<BOARD_ITEM*> DRAWING_TOOL::DrawSpecificationStackup( const VECTOR2I&
switch( m_frame->GetUserUnits() )
{
case EDA_UNITS::MM: t->SetText( _( "Thickness (mm)" ) ); break;
case EDA_UNITS::IN: t->SetText( _( "Thickness (inches)" ) ); break;
case EDA_UNITS::INCH: t->SetText( _( "Thickness (inches)" ) ); break;
case EDA_UNITS::MILS: t->SetText( _( "Thickness (mils)" ) ); break;
default: wxFAIL_MSG( wxT( "Unhandled unit type" ) );
}

Loading…
Cancel
Save