Browse Source

Code brevity.

revert-0c36e162
Jeff Young 9 months ago
parent
commit
f951497a4f
  1. 6
      3d-viewer/dialogs/panel_preview_3d_model.cpp
  2. 18
      bitmap2component/bitmap2cmp_frame.cpp
  3. 8
      bitmap2component/bitmap2cmp_panel.cpp
  4. 22
      common/dialog_shim.cpp
  5. 12
      common/dialogs/dialog_grid_settings.cpp
  6. 2
      common/eda_base_frame.cpp
  7. 28
      common/eda_draw_frame.cpp
  8. 154
      common/eda_units.cpp
  9. 12
      common/import_gfx/dxf_import_plugin.cpp
  10. 6
      common/import_gfx/dxf_import_plugin.h
  11. 41
      common/jobs/job_export_pcb_3d.cpp
  12. 13
      common/jobs/job_export_pcb_3d.h
  13. 32
      common/jobs/job_export_pcb_drill.cpp
  14. 38
      common/jobs/job_export_pcb_drill.h
  15. 14
      common/jobs/job_export_pcb_dxf.cpp
  16. 7
      common/jobs/job_export_pcb_dxf.h
  17. 28
      common/jobs/job_export_pcb_ipc2581.cpp
  18. 25
      common/jobs/job_export_pcb_ipc2581.h
  19. 16
      common/jobs/job_export_pcb_odb.cpp
  20. 13
      common/jobs/job_export_pcb_odb.h
  21. 30
      common/jobs/job_export_pcb_pos.cpp
  22. 34
      common/jobs/job_export_pcb_pos.h
  23. 12
      common/jobs/job_rc.cpp
  24. 15
      common/jobs/job_rc.h
  25. 12
      common/libeval/numeric_evaluator.cpp
  26. 4
      common/plotters/DXF_plotter.cpp
  27. 50
      common/plotters/GERBER_plotter.cpp
  28. 16
      common/preview_items/preview_utils.cpp
  29. 4
      common/settings/app_settings.cpp
  30. 18
      common/settings/grid_settings.cpp
  31. 4
      common/tool/actions.cpp
  32. 8
      common/tool/common_tools.cpp
  33. 2
      common/widgets/wx_html_report_box.cpp
  34. 10
      cvpcb/display_footprints_frame.cpp
  35. 4
      eeschema/connection_graph.cpp
  36. 2
      eeschema/dialogs/dialog_label_properties.cpp
  37. 2
      eeschema/dialogs/dialog_text_properties.cpp
  38. 2
      eeschema/eeschema.cpp
  39. 9
      eeschema/eeschema_jobs_handler.cpp
  40. 10
      eeschema/import_gfx/dialog_import_gfx_sch.cpp
  41. 2
      eeschema/lib_symbol.cpp
  42. 2
      eeschema/sch_connection.cpp
  43. 5
      eeschema/sch_edit_frame.cpp
  44. 4
      eeschema/symbol_editor/symbol_edit_frame.cpp
  45. 2
      gerbview/gerbview.cpp
  46. 4
      gerbview/gerbview_frame.cpp
  47. 4
      gerbview/toolbars_gerber.cpp
  48. 4
      gerbview/tools/gerbview_inspection_tool.cpp
  49. 18
      include/eda_units.h
  50. 4
      include/plotters/plotter.h
  51. 5
      include/plotters/plotter_dxf.h
  52. 2
      include/reporter.h
  53. 8
      include/units_provider.h
  54. 4
      kicad/cli/command_pcb_drc.cpp
  55. 4
      kicad/cli/command_pcb_export_3d.cpp
  56. 4
      kicad/cli/command_pcb_export_drill.cpp
  57. 4
      kicad/cli/command_pcb_export_dxf.cpp
  58. 4
      kicad/cli/command_pcb_export_ipc2581.cpp
  59. 4
      kicad/cli/command_pcb_export_odb.cpp
  60. 4
      kicad/cli/command_pcb_export_pos.cpp
  61. 4
      kicad/cli/command_sch_erc.cpp
  62. 6
      pagelayout_editor/dialogs/properties_frame.cpp
  63. 2
      pagelayout_editor/pl_editor.cpp
  64. 22
      pagelayout_editor/pl_editor_frame.cpp
  65. 12
      pcbnew/api/api_pcb_enums.cpp
  66. 2
      pcbnew/board.cpp
  67. 2
      pcbnew/board_design_settings.cpp
  68. 24
      pcbnew/dialogs/dialog_dimension_properties.cpp
  69. 6
      pcbnew/dialogs/dialog_export_2581.cpp
  70. 2
      pcbnew/dialogs/dialog_export_odbpp.cpp
  71. 17
      pcbnew/dialogs/dialog_gen_footprint_position.cpp
  72. 7
      pcbnew/dialogs/dialog_gendrill.cpp
  73. 10
      pcbnew/dialogs/dialog_plot.cpp
  74. 2
      pcbnew/dialogs/panel_pcbnew_color_settings.cpp
  75. 18
      pcbnew/dialogs/panel_setup_constraints.cpp
  76. 20
      pcbnew/drc/drc_engine.cpp
  77. 3
      pcbnew/drc/drc_test_provider.cpp
  78. 4
      pcbnew/drc/drc_test_provider_library_parity.cpp
  79. 5
      pcbnew/exporters/gen_drill_report_files.cpp
  80. 4
      pcbnew/exporters/gendrill_Excellon_writer.cpp
  81. 4
      pcbnew/exporters/place_file_exporter.cpp
  82. 10
      pcbnew/exporters/step/step_pcb_model.cpp
  83. 4
      pcbnew/files.cpp
  84. 4
      pcbnew/footprint_chooser_frame.cpp
  85. 4
      pcbnew/footprint_edit_frame.cpp
  86. 4
      pcbnew/footprint_editor_settings.cpp
  87. 4
      pcbnew/footprint_viewer_frame.cpp
  88. 2
      pcbnew/generators/pcb_tuning_pattern.cpp
  89. 10
      pcbnew/import_gfx/dialog_import_graphics.cpp
  90. 42
      pcbnew/pcb_dimension.cpp
  91. 4
      pcbnew/pcb_dimension.h
  92. 4
      pcbnew/pcb_edit_frame.cpp
  93. 6
      pcbnew/pcb_io/altium/altium_parser_pcb.cpp
  94. 8
      pcbnew/pcb_io/altium/altium_parser_pcb.h
  95. 34
      pcbnew/pcb_io/altium/altium_pcb.cpp
  96. 4
      pcbnew/pcb_io/cadstar/cadstar_pcb_archive_loader.cpp
  97. 6
      pcbnew/pcb_io/eagle/pcb_io_eagle.cpp
  98. 2
      pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp
  99. 13
      pcbnew/pcb_painter.cpp
  100. 9
      pcbnew/pcb_plot_params.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::INCHES )
if( m_userUnits == EDA_UNITS::IN )
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::INCHES )
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::IN )
{
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::INCHES )
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::IN )
{
step_mm = 25.4*OFFSET_INCREMENT_MIL/1000.0;

18
bitmap2component/bitmap2cmp_frame.cpp

@ -51,7 +51,7 @@ IMAGE_SIZE::IMAGE_SIZE()
m_outputSize = 0.0;
m_originalDPI = DEFAULT_DPI;
m_originalSizePixels = 0;
m_unit = EDA_UNITS::MILLIMETRES;
m_unit = EDA_UNITS::MM;
}
@ -61,9 +61,9 @@ void IMAGE_SIZE::SetOutputSizeFromInitialImageSize()
m_originalDPI = std::max( 1, m_originalDPI );
// Set the m_outputSize value from the m_originalSizePixels and the selected unit
if( m_unit == EDA_UNITS::MILLIMETRES )
if( m_unit == EDA_UNITS::MM )
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI * 25.4;
else if( m_unit == EDA_UNITS::INCHES )
else if( m_unit == EDA_UNITS::IN )
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI;
else
m_outputSize = m_originalDPI;
@ -74,9 +74,9 @@ int IMAGE_SIZE::GetOutputDPI()
{
int outputDPI;
if( m_unit == EDA_UNITS::MILLIMETRES )
if( m_unit == EDA_UNITS::MM )
outputDPI = GetOriginalSizePixels() / ( m_outputSize / 25.4 );
else if( m_unit == EDA_UNITS::INCHES )
else if( m_unit == EDA_UNITS::IN )
outputDPI = GetOriginalSizePixels() / m_outputSize;
else
outputDPI = KiROUND( m_outputSize );
@ -98,11 +98,11 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
// Convert m_outputSize to mm:
double size_mm;
if( m_unit == EDA_UNITS::MILLIMETRES )
if( m_unit == EDA_UNITS::MM )
{
size_mm = m_outputSize;
}
else if( m_unit == EDA_UNITS::INCHES )
else if( m_unit == EDA_UNITS::IN )
{
size_mm = m_outputSize * 25.4;
}
@ -117,11 +117,11 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
}
// Convert m_outputSize to new value:
if( aUnit == EDA_UNITS::MILLIMETRES )
if( aUnit == EDA_UNITS::MM )
{
m_outputSize = size_mm;
}
else if( aUnit == EDA_UNITS::INCHES )
else if( aUnit == EDA_UNITS::IN )
{
m_outputSize = size_mm / 25.4;
}

8
bitmap2component/bitmap2cmp_panel.cpp

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

22
common/dialog_shim.cpp

@ -50,17 +50,17 @@ END_EVENT_TABLE()
DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, long style,
const wxString& name ) :
wxDialog( aParent, id, title, pos, size, style, name ),
KIWAY_HOLDER( nullptr, KIWAY_HOLDER::DIALOG ),
m_units( EDA_UNITS::MILLIMETRES ),
m_useCalculatedSize( false ),
m_firstPaintEvent( true ),
m_initialFocusTarget( nullptr ),
m_isClosing( false ),
m_qmodal_loop( nullptr ),
m_qmodal_showing( false ),
m_qmodal_parent_disabler( nullptr ),
m_parentFrame( nullptr )
wxDialog( aParent, id, title, pos, size, style, name ),
KIWAY_HOLDER( nullptr, KIWAY_HOLDER::DIALOG ),
m_units( EDA_UNITS::MM ),
m_useCalculatedSize( false ),
m_firstPaintEvent( true ),
m_initialFocusTarget( nullptr ),
m_isClosing( false ),
m_qmodal_loop( nullptr ),
m_qmodal_showing( false ),
m_qmodal_parent_disabler( nullptr ),
m_parentFrame( nullptr )
{
KIWAY_HOLDER* kiwayHolder = nullptr;
m_initialSize = size;

12
common/dialogs/dialog_grid_settings.cpp

@ -77,14 +77,14 @@ bool DIALOG_GRID_SETTINGS::TransferDataFromWindow()
{
double gridX = m_gridSizeX.GetDoubleValue();
if( !m_gridSizeX.Validate( 0.001, 1000.0, EDA_UNITS::MILLIMETRES ) )
if( !m_gridSizeX.Validate( 0.001, 1000.0, EDA_UNITS::MM ) )
{
wxMessageBox( _( "Grid size X out of range." ), _( "Error" ), wxOK | wxICON_ERROR );
return false;
}
if( !m_checkLinked->IsChecked()
&& !m_gridSizeY.Validate( 0.001, 1000.0, EDA_UNITS::MILLIMETRES ) )
&& !m_gridSizeY.Validate( 0.001, 1000.0, EDA_UNITS::MM ) )
{
wxMessageBox( _( "Grid size Y out of range." ), _( "Error" ), wxOK | wxICON_ERROR );
return false;
@ -94,10 +94,10 @@ bool DIALOG_GRID_SETTINGS::TransferDataFromWindow()
m_grid.name = m_textName->GetValue();
// Grid X/Y are always stored in millimeters so we can compare them easily
m_grid.x = EDA_UNIT_UTILS::UI::StringFromValue( m_unitsProvider->GetIuScale(),
EDA_UNITS::MILLIMETRES, gridX );
m_grid.y = EDA_UNIT_UTILS::UI::StringFromValue( m_unitsProvider->GetIuScale(),
EDA_UNITS::MILLIMETRES, gridY );
m_grid.x = EDA_UNIT_UTILS::UI::StringFromValue( m_unitsProvider->GetIuScale(), EDA_UNITS::MM,
gridX );
m_grid.y = EDA_UNIT_UTILS::UI::StringFromValue( m_unitsProvider->GetIuScale(), EDA_UNITS::MM,
gridY );
return true;
}

2
common/eda_base_frame.cpp

@ -176,7 +176,7 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, const wxS
wxFrame( aParent, wxID_ANY, aTitle, aPos, aSize, aStyle, aFrameName ),
TOOLS_HOLDER(),
KIWAY_HOLDER( aKiway, KIWAY_HOLDER::FRAME ),
UNITS_PROVIDER( aIuScale, EDA_UNITS::MILLIMETRES )
UNITS_PROVIDER( aIuScale, EDA_UNITS::MM )
{
m_tbTopMain = nullptr;
m_tbTopAux = nullptr;

28
common/eda_draw_frame.cpp

@ -96,9 +96,10 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
long aStyle, const wxString& aFrameName,
const EDA_IU_SCALE& aIuScale ) :
KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName, aIuScale ),
m_socketServer( nullptr ),
m_lastToolbarIconSize( 0 )
KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName,
aIuScale ),
m_socketServer( nullptr ),
m_lastToolbarIconSize( 0 )
{
m_gridSelectBox = nullptr;
m_zoomSelectBox = nullptr;
@ -121,7 +122,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
m_propertiesPanel = nullptr;
m_netInspectorPanel = nullptr;
SetUserUnits( EDA_UNITS::MILLIMETRES );
SetUserUnits( EDA_UNITS::MM );
m_auimgr.SetFlags( wxAUI_MGR_DEFAULT );
@ -319,8 +320,7 @@ void EDA_DRAW_FRAME::ToggleUserUnits()
}
else
{
SetUserUnits( GetUserUnits() == EDA_UNITS::INCHES ? EDA_UNITS::MILLIMETRES
: EDA_UNITS::INCHES );
SetUserUnits( GetUserUnits() == EDA_UNITS::IN ? EDA_UNITS::MM : EDA_UNITS::IN );
unitsChangeRefresh();
wxCommandEvent e( EDA_EVT_UNITS_CHANGED );
@ -678,10 +678,10 @@ void EDA_DRAW_FRAME::DisplayUnitsMsg()
switch( GetUserUnits() )
{
case EDA_UNITS::INCHES: msg = _( "inches" ); break;
case EDA_UNITS::MILS: msg = _( "mils" ); break;
case EDA_UNITS::MILLIMETRES: msg = _( "mm" ); break;
default: msg = _( "Units" ); break;
case EDA_UNITS::IN: msg = _( "inches" ); break;
case EDA_UNITS::MILS: msg = _( "mils" ); break;
case EDA_UNITS::MM: msg = _( "mm" ); break;
default: msg = _( "Units" ); break;
}
SetStatusText( msg, 5 );
@ -1269,9 +1269,9 @@ void EDA_DRAW_FRAME::setupUnits( APP_SETTINGS_BASE* aCfg )
switch( static_cast<EDA_UNITS>( aCfg->m_System.units ) )
{
default:
case EDA_UNITS::MILLIMETRES: m_toolManager->RunAction( ACTIONS::millimetersUnits ); break;
case EDA_UNITS::INCHES: m_toolManager->RunAction( ACTIONS::inchesUnits ); break;
case EDA_UNITS::MILS: m_toolManager->RunAction( ACTIONS::milsUnits ); break;
case EDA_UNITS::MM: m_toolManager->RunAction( ACTIONS::millimetersUnits ); break;
case EDA_UNITS::IN: m_toolManager->RunAction( ACTIONS::inchesUnits ); break;
case EDA_UNITS::MILS: m_toolManager->RunAction( ACTIONS::milsUnits ); break;
}
}
@ -1288,7 +1288,7 @@ void EDA_DRAW_FRAME::GetUnitPair( EDA_UNITS& aPrimaryUnit, EDA_UNITS& aSecondary
if( cmnTool )
aSecondaryUnits = cmnTool->GetLastMetricUnits();
else
aSecondaryUnits = EDA_UNITS::MILLIMETRES;
aSecondaryUnits = EDA_UNITS::MM;
}
else
{

154
common/eda_units.cpp

@ -48,7 +48,7 @@ bool EDA_UNIT_UTILS::IsImperialUnit( EDA_UNITS aUnit )
{
switch( aUnit )
{
case EDA_UNITS::INCHES:
case EDA_UNITS::IN:
case EDA_UNITS::MILS:
return true;
@ -62,9 +62,9 @@ bool EDA_UNIT_UTILS::IsMetricUnit( EDA_UNITS aUnit )
{
switch( aUnit )
{
case EDA_UNITS::MICROMETRES:
case EDA_UNITS::MILLIMETRES:
case EDA_UNITS::CENTIMETRES:
case EDA_UNITS::UM:
case EDA_UNITS::MM:
case EDA_UNITS::CM:
return true;
default:
@ -106,15 +106,15 @@ bool EDA_UNIT_UTILS::FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS
//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" ) )
aUnits = EDA_UNITS::MICROMETRES;
aUnits = EDA_UNITS::UM;
else if( unit == wxT( "mm" ) )
aUnits = EDA_UNITS::MILLIMETRES;
aUnits = EDA_UNITS::MM;
if( unit == wxT( "cm" ) )
aUnits = EDA_UNITS::CENTIMETRES;
aUnits = EDA_UNITS::CM;
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::INCHES;
aUnits = EDA_UNITS::IN;
else if( unit == wxT( "de" ) || unit == wxT( "ra" ) ) // "deg" or "rad"
aUnits = EDA_UNITS::DEGREES;
else
@ -130,15 +130,15 @@ wxString EDA_UNIT_UTILS::GetText( EDA_UNITS aUnits, EDA_DATA_TYPE aType )
switch( aUnits )
{
case EDA_UNITS::MICROMETRES: label = wxT( " \u00B5m" ); break; //00B5 for µ
case EDA_UNITS::MILLIMETRES: label = wxT( " mm" ); break;
case EDA_UNITS::CENTIMETRES: label = wxT( " cm" ); break;
case EDA_UNITS::DEGREES: label = wxT( "°" ); break;
case EDA_UNITS::MILS: label = wxT( " mils" ); break;
case EDA_UNITS::INCHES: label = wxT( " in" ); break;
case EDA_UNITS::PERCENT: label = wxT( "%" ); break;
case EDA_UNITS::UNSCALED: break;
default: UNIMPLEMENTED_FOR( wxS( "Unknown units" ) ); break;
case EDA_UNITS::UM: label = wxT( " \u00B5m" ); break; //00B5 for µ
case EDA_UNITS::MM: label = wxT( " mm" ); break;
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::PERCENT: label = wxT( "%" ); break;
case EDA_UNITS::UNSCALED: break;
default: UNIMPLEMENTED_FOR( wxS( "Unknown units" ) ); break;
}
switch( aType )
@ -263,26 +263,13 @@ double EDA_UNIT_UTILS::UI::ToUserUnit( const EDA_IU_SCALE& aIuScale, EDA_UNITS a
{
switch( aUnit )
{
case EDA_UNITS::MICROMETRES:
return IU_TO_MM( aValue, aIuScale ) * 1000;
case EDA_UNITS::MILLIMETRES:
return IU_TO_MM( aValue, aIuScale );
case EDA_UNITS::CENTIMETRES:
return IU_TO_MM( aValue, aIuScale ) / 10;
case EDA_UNITS::MILS:
return IU_TO_MILS( aValue, aIuScale );
case EDA_UNITS::INCHES:
return IU_TO_IN( aValue, aIuScale );
case EDA_UNITS::DEGREES:
return aValue;
default:
return aValue;
case EDA_UNITS::UM: return IU_TO_MM( aValue, aIuScale ) * 1000;
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::DEGREES: return aValue;
default: return aValue;
}
}
@ -317,21 +304,10 @@ wxString EDA_UNIT_UTILS::UI::StringFromValue( const EDA_IU_SCALE& aIuScale, EDA_
switch( aUnits )
{
case EDA_UNITS::MILS:
format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.5f" );
break;
case EDA_UNITS::INCHES:
format = is_eeschema ? wxT( "%.6f" ) : wxT( "%.8f" );
break;
case EDA_UNITS::DEGREES:
format = wxT( "%.4f" );
break;
default:
format = wxT( "%.10f" );
break;
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::DEGREES: format = wxT( "%.4f" ); break;
default: format = wxT( "%.10f" ); break;
}
wxString text;
@ -414,34 +390,13 @@ wxString EDA_UNIT_UTILS::UI::MessageTextFromValue( const EDA_IU_SCALE& aIuScale,
switch( aUnits )
{
default:
case EDA_UNITS::MICROMETRES:
format = is_eeschema ? wxT( "%.0f" ) : wxT( "%.1f" );
break;
case EDA_UNITS::MILLIMETRES:
format = is_eeschema ? wxT( "%.2f" ) : wxT( "%.4f" );
break;
case EDA_UNITS::CENTIMETRES:
format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.5f" );
break;
case EDA_UNITS::MILS:
format = is_eeschema ? wxT( "%.0f" ) : wxT( "%.2f" );
break;
case EDA_UNITS::INCHES:
format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.4f" );
break;
case EDA_UNITS::DEGREES:
// 3 digits in mantissa should be good for rotation in degree
format = wxT( "%.3f" );
break;
case EDA_UNITS::UNSCALED:
format = wxT( "%.0f" );
break;
case EDA_UNITS::UM: format = is_eeschema ? wxT( "%.0f" ) : wxT( "%.1f" ); break;
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::DEGREES: format = wxT( "%.3f" ); break;
case EDA_UNITS::UNSCALED: format = wxT( "%.0f" ); break;
}
text.Printf( format, value );
@ -489,26 +444,15 @@ double EDA_UNIT_UTILS::UI::FromUserUnit( const EDA_IU_SCALE& aIuScale, EDA_UNITS
{
switch( aUnits )
{
case EDA_UNITS::MICROMETRES:
return MM_TO_IU( aValue / 1000.0, aIuScale );
case EDA_UNITS::MILLIMETRES:
return MM_TO_IU( aValue, aIuScale );
case EDA_UNITS::CENTIMETRES:
return MM_TO_IU( aValue * 10, aIuScale );
case EDA_UNITS::MILS:
return MILS_TO_IU( aValue, aIuScale );
case EDA_UNITS::INCHES:
return IN_TO_IU( aValue, aIuScale );
case EDA_UNITS::UM: return MM_TO_IU( aValue / 1000.0, aIuScale );
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 );
default:
case EDA_UNITS::DEGREES:
case EDA_UNITS::UNSCALED:
case EDA_UNITS::PERCENT:
return aValue;
case EDA_UNITS::PERCENT: return aValue;
}
}
@ -584,24 +528,24 @@ double EDA_UNIT_UTILS::UI::DoubleValueFromString( const EDA_IU_SCALE& aIuScale,
// Check the optional unit designator (2 ch significant)
wxString unit( buf.Mid( brk_point ).Strip( wxString::leading ).Left( 2 ).Lower() );
if( aUnits == EDA_UNITS::MICROMETRES
|| aUnits == EDA_UNITS::MILLIMETRES
|| aUnits == EDA_UNITS::CENTIMETRES
if( aUnits == EDA_UNITS::UM
|| aUnits == EDA_UNITS::MM
|| aUnits == EDA_UNITS::CM
|| aUnits == EDA_UNITS::MILS
|| aUnits == EDA_UNITS::INCHES )
|| aUnits == EDA_UNITS::IN )
{
//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" ) )
{
aUnits = EDA_UNITS::MICROMETRES;
aUnits = EDA_UNITS::UM;
}
else if( unit == wxT( "mm" ) )
{
aUnits = EDA_UNITS::MILLIMETRES;
aUnits = EDA_UNITS::MM;
}
else if( unit == wxT( "cm" ) )
{
aUnits = EDA_UNITS::CENTIMETRES;
aUnits = EDA_UNITS::CM;
}
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) )
{
@ -609,7 +553,7 @@ double EDA_UNIT_UTILS::UI::DoubleValueFromString( const EDA_IU_SCALE& aIuScale,
}
else if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
{
aUnits = EDA_UNITS::INCHES;
aUnits = EDA_UNITS::IN;
}
else if( unit == wxT( "oz" ) ) // 1 oz = 1.37 mils
{

12
common/import_gfx/dxf_import_plugin.cpp

@ -1006,10 +1006,10 @@ double DXF_IMPORT_PLUGIN::getCurrentUnitScale()
switch( m_currentUnit )
{
case DXF_IMPORT_UNITS::INCHES: scale = 25.4; break;
case DXF_IMPORT_UNITS::IN: scale = 25.4; break;
case DXF_IMPORT_UNITS::FEET: scale = 304.8; break;
case DXF_IMPORT_UNITS::MILLIMETERS: scale = 1.0; break;
case DXF_IMPORT_UNITS::CENTIMETERS: scale = 10.0; break;
case DXF_IMPORT_UNITS::MM: scale = 1.0; break;
case DXF_IMPORT_UNITS::CM: scale = 10.0; break;
case DXF_IMPORT_UNITS::METERS: scale = 1000.0; break;
case DXF_IMPORT_UNITS::MICROINCHES: scale = 2.54e-5; break;
case DXF_IMPORT_UNITS::MILS: scale = 0.0254; break;
@ -1065,10 +1065,10 @@ void DXF_IMPORT_PLUGIN::setVariableInt( const std::string& key, int value, int c
switch( value )
{
case 1: m_currentUnit = DXF_IMPORT_UNITS::INCHES; break;
case 1: m_currentUnit = DXF_IMPORT_UNITS::IN; break;
case 2: m_currentUnit = DXF_IMPORT_UNITS::FEET; break;
case 4: m_currentUnit = DXF_IMPORT_UNITS::MILLIMETERS; break;
case 5: m_currentUnit = DXF_IMPORT_UNITS::CENTIMETERS; break;
case 4: m_currentUnit = DXF_IMPORT_UNITS::MM; break;
case 5: m_currentUnit = DXF_IMPORT_UNITS::CM; break;
case 6: m_currentUnit = DXF_IMPORT_UNITS::METERS; break;
case 8: m_currentUnit = DXF_IMPORT_UNITS::MICROINCHES; break;
case 9: m_currentUnit = DXF_IMPORT_UNITS::MILS; break;

6
common/import_gfx/dxf_import_plugin.h

@ -182,10 +182,10 @@ public:
enum class DXF_IMPORT_UNITS
{
DEFAULT = 0,
INCHES = 1,
IN = 1,
FEET = 2,
MILLIMETERS = 4,
CENTIMETERS = 5,
MM = 4,
CM = 5,
METERS = 6,
MICROINCHES = 8,
MILS = 9,

41
common/jobs/job_export_pcb_3d.cpp

@ -25,20 +25,20 @@
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_3D::FORMAT,
{
{ JOB_EXPORT_PCB_3D::FORMAT::UNKNOWN, nullptr },
{ JOB_EXPORT_PCB_3D::FORMAT::STEP, "step" },
{ JOB_EXPORT_PCB_3D::FORMAT::BREP, "brep" },
{ JOB_EXPORT_PCB_3D::FORMAT::GLB, "step" },
{ JOB_EXPORT_PCB_3D::FORMAT::VRML, "vrml" },
{ JOB_EXPORT_PCB_3D::FORMAT::XAO, "xao" },
{ JOB_EXPORT_PCB_3D::FORMAT::PLY, "ply" },
{ JOB_EXPORT_PCB_3D::FORMAT::STL, "stl" },
{ JOB_EXPORT_PCB_3D::FORMAT::STEP, "step" },
{ JOB_EXPORT_PCB_3D::FORMAT::BREP, "brep" },
{ JOB_EXPORT_PCB_3D::FORMAT::GLB, "step" },
{ JOB_EXPORT_PCB_3D::FORMAT::VRML, "vrml" },
{ JOB_EXPORT_PCB_3D::FORMAT::XAO, "xao" },
{ JOB_EXPORT_PCB_3D::FORMAT::PLY, "ply" },
{ JOB_EXPORT_PCB_3D::FORMAT::STL, "stl" },
} )
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_3D::VRML_UNITS,
{
{ JOB_EXPORT_PCB_3D::VRML_UNITS::INCHES, "in" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::IN, "in" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::METERS, "m" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::MILLIMETERS, "mm" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::MM, "mm" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::TENTHS, "tenths" },
} )
@ -74,13 +74,13 @@ wxString EXPORTER_STEP_PARAMS::GetFormatName() const
JOB_EXPORT_PCB_3D::JOB_EXPORT_PCB_3D() :
JOB( "3d", false ),
m_hasUserOrigin( false ),
m_filename(),
m_format( JOB_EXPORT_PCB_3D::FORMAT::UNKNOWN ),
m_vrmlUnits( JOB_EXPORT_PCB_3D::VRML_UNITS::METERS ),
m_vrmlModelDir( wxEmptyString ),
m_vrmlRelativePaths( false )
JOB( "3d", false ),
m_hasUserOrigin( false ),
m_filename(),
m_format( JOB_EXPORT_PCB_3D::FORMAT::UNKNOWN ),
m_vrmlUnits( JOB_EXPORT_PCB_3D::VRML_UNITS::METERS ),
m_vrmlModelDir( wxEmptyString ),
m_vrmlRelativePaths( false )
{
m_params.emplace_back(
new JOB_PARAM<bool>( "overwrite", &m_3dparams.m_Overwrite, m_3dparams.m_Overwrite ) );
@ -154,14 +154,15 @@ wxString JOB_EXPORT_PCB_3D::GetSettingsDialogTitle() const
void JOB_EXPORT_PCB_3D::SetStepFormat( EXPORTER_STEP_PARAMS::FORMAT aFormat )
{
m_3dparams.m_Format = aFormat;
switch( m_3dparams.m_Format )
{
case EXPORTER_STEP_PARAMS::FORMAT::STEP: m_format = JOB_EXPORT_PCB_3D::FORMAT::STEP; break;
case EXPORTER_STEP_PARAMS::FORMAT::GLB: m_format = JOB_EXPORT_PCB_3D::FORMAT::GLB; break;
case EXPORTER_STEP_PARAMS::FORMAT::XAO: m_format = JOB_EXPORT_PCB_3D::FORMAT::XAO; break;
case EXPORTER_STEP_PARAMS::FORMAT::GLB: m_format = JOB_EXPORT_PCB_3D::FORMAT::GLB; break;
case EXPORTER_STEP_PARAMS::FORMAT::XAO: m_format = JOB_EXPORT_PCB_3D::FORMAT::XAO; break;
case EXPORTER_STEP_PARAMS::FORMAT::BREP: m_format = JOB_EXPORT_PCB_3D::FORMAT::BREP; break;
case EXPORTER_STEP_PARAMS::FORMAT::PLY: m_format = JOB_EXPORT_PCB_3D::FORMAT::PLY; break;
case EXPORTER_STEP_PARAMS::FORMAT::STL: m_format = JOB_EXPORT_PCB_3D::FORMAT::STL; break;
case EXPORTER_STEP_PARAMS::FORMAT::PLY: m_format = JOB_EXPORT_PCB_3D::FORMAT::PLY; break;
case EXPORTER_STEP_PARAMS::FORMAT::STL: m_format = JOB_EXPORT_PCB_3D::FORMAT::STL; break;
}
}

13
common/jobs/job_export_pcb_3d.h

@ -125,23 +125,24 @@ public:
enum class VRML_UNITS
{
INCHES,
MILLIMETERS,
IN,
MM,
METERS,
TENTHS // inches
};
public:
bool m_hasUserOrigin;
wxString m_filename;
JOB_EXPORT_PCB_3D::FORMAT m_format;
/// Despite the name; also used for other formats
EXPORTER_STEP_PARAMS m_3dparams;
EXPORTER_STEP_PARAMS m_3dparams;
VRML_UNITS m_vrmlUnits;
wxString m_vrmlModelDir;
bool m_vrmlRelativePaths;
VRML_UNITS m_vrmlUnits;
wxString m_vrmlModelDir;
bool m_vrmlRelativePaths;
};
#endif

32
common/jobs/job_export_pcb_drill.cpp

@ -36,8 +36,8 @@ 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::INCHES, "in" },
{ JOB_EXPORT_PCB_DRILL::DRILL_UNITS::MILLIMETERS, "mm" },
{ JOB_EXPORT_PCB_DRILL::DRILL_UNITS::IN, "in" },
{ JOB_EXPORT_PCB_DRILL::DRILL_UNITS::MM, "mm" },
} )
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_DRILL::ZEROS_FORMAT,
@ -58,20 +58,20 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_DRILL::MAP_FORMAT,
} )
JOB_EXPORT_PCB_DRILL::JOB_EXPORT_PCB_DRILL() :
JOB( "drill", true ),
m_filename(),
m_excellonMirrorY( false ),
m_excellonMinimalHeader( false ),
m_excellonCombinePTHNPTH( true ),
m_excellonOvalDrillRoute( false ),
m_format( DRILL_FORMAT::EXCELLON ),
m_drillOrigin( DRILL_ORIGIN::ABS ),
m_drillUnits( DRILL_UNITS::INCHES ),
m_zeroFormat( ZEROS_FORMAT::DECIMAL ),
m_mapFormat( MAP_FORMAT::PDF ),
m_gerberPrecision( 5 ),
m_generateMap( false ),
m_generateTenting( false )
JOB( "drill", true ),
m_filename(),
m_excellonMirrorY( false ),
m_excellonMinimalHeader( false ),
m_excellonCombinePTHNPTH( true ),
m_excellonOvalDrillRoute( false ),
m_format( DRILL_FORMAT::EXCELLON ),
m_drillOrigin( DRILL_ORIGIN::ABS ),
m_drillUnits( DRILL_UNITS::IN ),
m_zeroFormat( ZEROS_FORMAT::DECIMAL ),
m_mapFormat( MAP_FORMAT::PDF ),
m_gerberPrecision( 5 ),
m_generateMap( false ),
m_generateTenting( false )
{
m_params.emplace_back( new JOB_PARAM<bool>( "excellon.mirror_y",
&m_excellonMirrorY,

38
common/jobs/job_export_pcb_drill.h

@ -34,37 +34,24 @@ public:
wxString GetDefaultDescription() const override;
wxString GetSettingsDialogTitle() const override;
wxString m_filename;
bool m_excellonMirrorY;
bool m_excellonMinimalHeader;
bool m_excellonCombinePTHNPTH;
bool m_excellonOvalDrillRoute;
enum class DRILL_FORMAT
{
EXCELLON,
GERBER
};
DRILL_FORMAT m_format;
enum class DRILL_ORIGIN
{
ABS,
PLOT
};
DRILL_ORIGIN m_drillOrigin;
enum class DRILL_UNITS
{
INCHES,
MILLIMETERS
IN,
MM
};
DRILL_UNITS m_drillUnits;
enum class ZEROS_FORMAT
{
DECIMAL,
@ -73,8 +60,6 @@ public:
KEEP_ZEROS
};
ZEROS_FORMAT m_zeroFormat;
enum class MAP_FORMAT
{
POSTSCRIPT,
@ -84,13 +69,24 @@ public:
PDF
};
MAP_FORMAT m_mapFormat;
public:
wxString m_filename;
bool m_excellonMirrorY;
bool m_excellonMinimalHeader;
bool m_excellonCombinePTHNPTH;
bool m_excellonOvalDrillRoute;
int m_gerberPrecision;
DRILL_FORMAT m_format;
DRILL_ORIGIN m_drillOrigin;
DRILL_UNITS m_drillUnits;
ZEROS_FORMAT m_zeroFormat;
bool m_generateMap;
MAP_FORMAT m_mapFormat;
int m_gerberPrecision;
bool m_generateMap;
bool m_generateTenting;
bool m_generateTenting;
};
#endif

14
common/jobs/job_export_pcb_dxf.cpp

@ -30,16 +30,16 @@ 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::INCHES, "in" },
{ JOB_EXPORT_PCB_DXF::DXF_UNITS::MILLIMETERS, "mm" },
{ JOB_EXPORT_PCB_DXF::DXF_UNITS::IN, "in" },
{ JOB_EXPORT_PCB_DXF::DXF_UNITS::MM, "mm" },
} )
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::INCHES ),
m_genMode( GEN_MODE::MULTI )
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_genMode( GEN_MODE::MULTI )
{
m_plotDrawingSheet = false;

7
common/jobs/job_export_pcb_dxf.h

@ -37,8 +37,8 @@ public:
enum class DXF_UNITS
{
INCHES,
MILLIMETERS
IN,
MM
};
enum class GEN_MODE
@ -47,11 +47,12 @@ public:
MULTI
};
public:
bool m_plotGraphicItemsUsingContours;
bool m_polygonMode;
DXF_UNITS m_dxfUnits;
GEN_MODE m_genMode;
GEN_MODE m_genMode;
};
#endif

28
common/jobs/job_export_pcb_ipc2581.cpp

@ -25,8 +25,8 @@
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS,
{
{ JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::INCHES, "in" },
{ JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::MILLIMETERS, "mm" },
{ JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::IN, "in" },
{ JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::MM, "mm" },
} )
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_IPC2581::IPC2581_VERSION,
@ -36,18 +36,18 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_IPC2581::IPC2581_VERSION,
} )
JOB_EXPORT_PCB_IPC2581::JOB_EXPORT_PCB_IPC2581() :
JOB( "ipc2581", false ),
m_filename(),
m_drawingSheet(),
m_units( IPC2581_UNITS::MILLIMETERS ),
m_version( IPC2581_VERSION::C ),
m_precision( 6 ),
m_compress( false ),
m_colInternalId(),
m_colMfgPn(),
m_colMfg(),
m_colDistPn(),
m_colDist()
JOB( "ipc2581", false ),
m_filename(),
m_drawingSheet(),
m_units( IPC2581_UNITS::MM ),
m_version( IPC2581_VERSION::C ),
m_precision( 6 ),
m_compress( false ),
m_colInternalId(),
m_colMfgPn(),
m_colMfg(),
m_colDistPn(),
m_colDist()
{
m_params.emplace_back( new JOB_PARAM<wxString>( "drawing_sheet", &m_drawingSheet, m_drawingSheet ) );
m_params.emplace_back( new JOB_PARAM<IPC2581_UNITS>( "units", &m_units, m_units ) );

25
common/jobs/job_export_pcb_ipc2581.h

@ -36,8 +36,8 @@ public:
enum class IPC2581_UNITS
{
INCHES,
MILLIMETERS
IN,
MM
};
enum class IPC2581_VERSION
@ -46,20 +46,21 @@ public:
C
};
wxString m_filename;
wxString m_drawingSheet;
public:
wxString m_filename;
wxString m_drawingSheet;
IPC2581_UNITS m_units;
IPC2581_UNITS m_units;
IPC2581_VERSION m_version;
int m_precision;
int m_precision;
bool m_compress;
bool m_compress;
wxString m_colInternalId;
wxString m_colMfgPn;
wxString m_colMfg;
wxString m_colDistPn;
wxString m_colDist;
wxString m_colInternalId;
wxString m_colMfgPn;
wxString m_colMfg;
wxString m_colDistPn;
wxString m_colDist;
};
#endif

16
common/jobs/job_export_pcb_odb.cpp

@ -24,8 +24,8 @@
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_ODB::ODB_UNITS,
{
{ JOB_EXPORT_PCB_ODB::ODB_UNITS::INCHES, "in" },
{ JOB_EXPORT_PCB_ODB::ODB_UNITS::MILLIMETERS, "mm" },
{ JOB_EXPORT_PCB_ODB::ODB_UNITS::IN, "in" },
{ JOB_EXPORT_PCB_ODB::ODB_UNITS::MM, "mm" },
} )
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_ODB::ODB_COMPRESSION,
@ -37,12 +37,12 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_ODB::ODB_COMPRESSION,
JOB_EXPORT_PCB_ODB::JOB_EXPORT_PCB_ODB() :
JOB( "odb", false ),
m_filename(),
m_drawingSheet(),
m_units( ODB_UNITS::MILLIMETERS ),
m_precision( 2 ),
m_compressionMode( ODB_COMPRESSION::ZIP )
JOB( "odb", false ),
m_filename(),
m_drawingSheet(),
m_units( ODB_UNITS::MM ),
m_precision( 2 ),
m_compressionMode( ODB_COMPRESSION::ZIP )
{
m_params.emplace_back( new JOB_PARAM<wxString>( "drawing_sheet", &m_drawingSheet, m_drawingSheet ) );
m_params.emplace_back( new JOB_PARAM<ODB_UNITS>( "units", &m_units, m_units ) );

13
common/jobs/job_export_pcb_odb.h

@ -35,8 +35,8 @@ public:
enum class ODB_UNITS
{
MILLIMETERS,
INCHES,
MM,
IN,
};
enum class ODB_COMPRESSION
@ -46,11 +46,12 @@ public:
TGZ,
};
wxString m_filename;
wxString m_drawingSheet;
public:
wxString m_filename;
wxString m_drawingSheet;
ODB_UNITS m_units;
int m_precision;
ODB_UNITS m_units;
int m_precision;
ODB_COMPRESSION m_compressionMode;
};

30
common/jobs/job_export_pcb_pos.cpp

@ -39,24 +39,24 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_POS::SIDE,
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_POS::UNITS,
{
{ JOB_EXPORT_PCB_POS::UNITS::INCHES, "in" },
{ JOB_EXPORT_PCB_POS::UNITS::MILLIMETERS, "mm" },
{ JOB_EXPORT_PCB_POS::UNITS::IN, "in" },
{ JOB_EXPORT_PCB_POS::UNITS::MM, "mm" },
} )
JOB_EXPORT_PCB_POS::JOB_EXPORT_PCB_POS() :
JOB( "pos", false ),
m_filename(),
m_useDrillPlaceFileOrigin( true ),
m_smdOnly( false ),
m_excludeFootprintsWithTh( false ),
m_excludeDNP( false ),
m_negateBottomX( false ),
m_singleFile( false ),
m_nakedFilename( false ),
m_side( SIDE::BOTH ),
m_units( UNITS::MILLIMETERS ),
m_format( FORMAT::ASCII ),
m_gerberBoardEdge( true )
JOB( "pos", false ),
m_filename(),
m_useDrillPlaceFileOrigin( true ),
m_smdOnly( false ),
m_excludeFootprintsWithTh( false ),
m_excludeDNP( false ),
m_negateBottomX( false ),
m_singleFile( false ),
m_nakedFilename( false ),
m_side( SIDE::BOTH ),
m_units( UNITS::MM ),
m_format( FORMAT::ASCII ),
m_gerberBoardEdge( true )
{
m_params.emplace_back( new JOB_PARAM<bool>( "use_drill_place_file_origin",
&m_useDrillPlaceFileOrigin,

34
common/jobs/job_export_pcb_pos.h

@ -35,16 +35,6 @@ public:
void SetDefaultOutputPath( const wxString& aReferenceName );
wxString m_filename;
bool m_useDrillPlaceFileOrigin;
bool m_smdOnly;
bool m_excludeFootprintsWithTh;
bool m_excludeDNP;
bool m_negateBottomX;
bool m_singleFile;
bool m_nakedFilename;
enum class SIDE
{
FRONT,
@ -52,17 +42,12 @@ public:
BOTH
};
SIDE m_side;
enum class UNITS
{
INCHES,
MILLIMETERS
IN,
MM
};
UNITS m_units;
enum class FORMAT
{
ASCII,
@ -70,9 +55,20 @@ public:
GERBER
};
FORMAT m_format;
public:
wxString m_filename;
bool m_gerberBoardEdge;
bool m_useDrillPlaceFileOrigin;
bool m_smdOnly;
bool m_excludeFootprintsWithTh;
bool m_excludeDNP;
bool m_negateBottomX;
bool m_singleFile;
bool m_nakedFilename;
SIDE m_side;
UNITS m_units;
FORMAT m_format;
bool m_gerberBoardEdge;
};
#endif

12
common/jobs/job_rc.cpp

@ -22,21 +22,21 @@
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_RC::UNITS, {
{ JOB_RC::UNITS::INCHES, "in" },
{ JOB_RC::UNITS::MILLIMETERS, "mm" },
{ JOB_RC::UNITS::IN, "in" },
{ JOB_RC::UNITS::MM, "mm" },
{ JOB_RC::UNITS::MILS, "mils" },
} )
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_RC::OUTPUT_FORMAT,
{
{ JOB_RC::OUTPUT_FORMAT::REPORT, "report" },
{ JOB_RC::OUTPUT_FORMAT::JSON, "json" },
{ JOB_RC::OUTPUT_FORMAT::JSON, "json" },
} )
JOB_RC::JOB_RC( const std::string& aType )
: JOB( aType, false ),
JOB_RC::JOB_RC( const std::string& aType ) :
JOB( aType, false ),
m_filename(),
m_units( JOB_RC::UNITS::MILLIMETERS ),
m_units( JOB_RC::UNITS::MM ),
m_severity( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ),
m_format( OUTPUT_FORMAT::REPORT ),
m_exitCodeViolations( false )

15
common/jobs/job_rc.h

@ -30,18 +30,13 @@ class KICOMMON_API JOB_RC : public JOB
public:
JOB_RC( const std::string& aType );
wxString m_filename;
enum class UNITS
{
INCHES,
MILLIMETERS,
IN,
MM,
MILS
};
UNITS m_units;
int m_severity;
enum class OUTPUT_FORMAT
{
@ -49,7 +44,11 @@ public:
JSON
};
public:
wxString m_filename;
UNITS m_units;
int m_severity;
OUTPUT_FORMAT m_format;
bool m_exitCodeViolations;
bool m_exitCodeViolations;
};

12
common/libeval/numeric_evaluator.cpp

@ -82,12 +82,12 @@ void NUMERIC_EVALUATOR::SetDefaultUnits( EDA_UNITS aUnits )
{
switch( aUnits )
{
case EDA_UNITS::MILLIMETRES: m_defaultUnits = Unit::MM; break;
case EDA_UNITS::MILS: m_defaultUnits = Unit::Mil; break;
case EDA_UNITS::INCHES: 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;
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::DEGREES: m_defaultUnits = Unit::Degrees; break;
case EDA_UNITS::UNSCALED: m_defaultUnits = Unit::SI; break;
default: m_defaultUnits = Unit::MM; break;
}
}

4
common/plotters/DXF_plotter.cpp

@ -136,12 +136,12 @@ void DXF_PLOTTER::SetUnits( DXF_UNITS aUnit )
switch( aUnit )
{
case DXF_UNITS::MILLIMETERS:
case DXF_UNITS::MM:
m_unitScalingFactor = 0.00254;
m_measurementDirective = 1;
break;
case DXF_UNITS::INCHES:
case DXF_UNITS::IN:
default:
m_unitScalingFactor = 0.0001;
m_measurementDirective = 0;

50
common/plotters/GERBER_plotter.cpp

@ -288,7 +288,7 @@ bool GERBER_PLOTTER::StartPlot( const wxString& aPageNumber )
fprintf( m_outputFile, "G04 Created by KiCad (%s) date %s*\n",
TO_UTF8( Title ), TO_UTF8( date.FormatISOCombined( ' ') ) );
/* Mass parameter: unit = INCHES/MM */
/* Mass parameter: unit = IN/MM */
if( m_gerberUnitInch )
fputs( "%MOIN*%\n", m_outputFile );
else
@ -647,7 +647,8 @@ void GERBER_PLOTTER::writeApertureList()
break;
case APERTURE::AT_RECT:
fprintf( m_outputFile, "R,%#fX%#f*%%\n", tool.m_Size.x * fscale,
fprintf( m_outputFile, "R,%#fX%#f*%%\n",
tool.m_Size.x * fscale,
tool.m_Size.y * fscale );
break;
@ -656,7 +657,8 @@ void GERBER_PLOTTER::writeApertureList()
break;
case APERTURE::AT_OVAL:
fprintf( m_outputFile, "O,%#fX%#f*%%\n", tool.m_Size.x * fscale,
fprintf( m_outputFile, "O,%#fX%#f*%%\n",
tool.m_Size.x * fscale,
tool.m_Size.y * fscale );
break;
@ -671,8 +673,10 @@ void GERBER_PLOTTER::writeApertureList()
case APERTURE::AT_REGULAR_POLY10:
case APERTURE::AT_REGULAR_POLY11:
case APERTURE::AT_REGULAR_POLY12:
fprintf( m_outputFile, "P,%#fX%dX%#f*%%\n", tool.GetDiameter() * fscale,
tool.GetRegPolyVerticeCount(), tool.GetRotation().AsDegrees() );
fprintf( m_outputFile, "P,%#fX%dX%#f*%%\n",
tool.GetDiameter() * fscale,
tool.GetRegPolyVerticeCount(),
tool.GetRotation().AsDegrees() );
break;
case APERTURE::AM_ROUND_RECT: // Aperture macro for round rect pads
@ -700,12 +704,16 @@ void GERBER_PLOTTER::writeApertureList()
for( int ii = 0; ii < 4; ii++ )
RotatePoint( corners[ii], -tool.m_Rotation );
fprintf( m_outputFile, "%s,%#fX", APER_MACRO_ROUNDRECT_NAME, tool.m_Radius * fscale );
fprintf( m_outputFile, "%s,%#fX",
APER_MACRO_ROUNDRECT_NAME,
tool.m_Radius * fscale );
// Add each corner
for( int ii = 0; ii < 4; ii++ )
{
fprintf( m_outputFile, "%#fX%#fX", corners[ii].x * fscale, corners[ii].y * fscale );
fprintf( m_outputFile, "%#fX%#fX",
corners[ii].x * fscale,
corners[ii].y * fscale );
}
fprintf( m_outputFile, "0*%%\n" );
@ -714,7 +722,9 @@ void GERBER_PLOTTER::writeApertureList()
case APERTURE::AM_ROT_RECT: // Aperture macro for rotated rect pads
fprintf( m_outputFile, "%s,%#fX%#fX%#f*%%\n", APER_MACRO_ROT_RECT_NAME,
tool.m_Size.x * fscale, tool.m_Size.y * fscale, tool.m_Rotation.AsDegrees() );
tool.m_Size.x * fscale,
tool.m_Size.y * fscale,
tool.m_Rotation.AsDegrees() );
break;
case APERTURE::APER_MACRO_OUTLINE4P: // Aperture macro for trapezoid pads
@ -746,11 +756,8 @@ void GERBER_PLOTTER::writeApertureList()
// Output all corners (should be 4 to 8 corners)
// Remember: the Y coordinate must be negated, due to the fact in Pcbnew
// the Y axis is from top to bottom
for( size_t ii = 0; ii < tool.m_Corners.size(); ii++ )
{
fprintf( m_outputFile, "%#fX%#fX", tool.m_Corners[ii].x * fscale,
-tool.m_Corners[ii].y * fscale );
}
for( const VECTOR2I& corner : tool.m_Corners)
fprintf( m_outputFile, "%#fX%#fX", corner.x * fscale, -corner.y * fscale );
// close outline and output rotation
fprintf( m_outputFile, "%#f*%%\n", tool.m_Rotation.AsDegrees() );
@ -773,10 +780,11 @@ void GERBER_PLOTTER::writeApertureList()
RotatePoint( start, tool.m_Rotation );
RotatePoint( end, tool.m_Rotation );
fprintf( m_outputFile, "%s,%#fX%#fX%#fX%#fX%#fX0*%%\n", APER_MACRO_SHAPE_OVAL_NAME,
fprintf( m_outputFile, "%s,%#fX%#fX%#fX%#fX%#fX0*%%\n",
APER_MACRO_SHAPE_OVAL_NAME,
tool.m_Size.y * fscale, // width
start.x * fscale, -start.y * fscale, // X,Y corner start pos
end.x * fscale, -end.y * fscale ); // X,Y cornerend pos
end.x * fscale, -end.y * fscale ); // X,Y corner end pos
}
break;
@ -788,7 +796,9 @@ void GERBER_PLOTTER::writeApertureList()
// Write DCODE id ( "%ADDxx" is already in buffer) and rotation
// the full line is something like :%ADD12FreePoly1,45.000000*%
fprintf( m_outputFile, "%s%d,%#f*%%\n", AM_FREEPOLY_BASENAME, idx,
fprintf( m_outputFile, "%s%d,%#f*%%\n",
AM_FREEPOLY_BASENAME,
idx,
tool.m_Rotation.AsDegrees() );
break;
}
@ -982,13 +992,9 @@ void GERBER_PLOTTER::PlotGerberRegion( const SHAPE_LINE_CHAIN& aPoly, GBR_METADA
if( clearTA_AperFunction )
{
if( m_useX2format )
{
fputs( "%TD.AperFunction*%\n", m_outputFile );
}
else
{
fputs( "G04 #@! TD.AperFunction*\n", m_outputFile );
}
}
}
@ -1018,13 +1024,9 @@ void GERBER_PLOTTER::PlotGerberRegion( const std::vector<VECTOR2I>& aCornerList,
if( clearTA_AperFunction )
{
if( m_useX2format )
{
fputs( "%TD.AperFunction*%\n", m_outputFile );
}
else
{
fputs( "G04 #@! TD.AperFunction*\n", m_outputFile );
}
}
}

16
common/preview_items/preview_utils.cpp

@ -45,14 +45,14 @@ wxString KIGFX::PREVIEW::DimensionLabel( const wxString& prefix, double aVal,
// nanometre
switch( aUnits )
{
case EDA_UNITS::MICROMETRES: fmtStr = wxT( "%.0f" ); break; // 1um
case EDA_UNITS::MILLIMETRES: fmtStr = wxT( "%.3f" ); break; // 1um
case EDA_UNITS::CENTIMETRES: fmtStr = wxT( "%.4f" ); break; // 1um
case EDA_UNITS::MILS: fmtStr = wxT( "%.1f" ); break; // 0.1mil
case EDA_UNITS::INCHES: 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;
case EDA_UNITS::UM: fmtStr = wxT( "%.0f" ); break; // 1um
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::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;
}
str << wxString::Format( fmtStr, EDA_UNIT_UTILS::UI::ToUserUnit( aIuScale, aUnits, aVal ) );

4
common/settings/app_settings.cpp

@ -158,11 +158,11 @@ APP_SETTINGS_BASE::APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaV
else
{
m_params.emplace_back( new PARAM<int>( "system.units",
&m_System.units, static_cast<int>( EDA_UNITS::MILLIMETRES ) ) );
&m_System.units, static_cast<int>( EDA_UNITS::MM ) ) );
}
m_params.emplace_back( new PARAM<int>( "system.last_metric_units",
&m_System.last_metric_units, static_cast<int>( EDA_UNITS::MILLIMETRES ) ) );
&m_System.last_metric_units, static_cast<int>( EDA_UNITS::MM ) ) );
m_params.emplace_back( new PARAM<int>( "system.last_imperial_units",
&m_System.last_imperial_units, static_cast<int>( EDA_UNITS::MILS ) ) );

18
common/settings/grid_settings.cpp

@ -30,13 +30,13 @@ wxString GRID::MessageText( EDA_IU_SCALE aScale, EDA_UNITS aUnits, bool aDisplay
EDA_DATA_TYPE type = EDA_DATA_TYPE::DISTANCE;
wxString xStr = EDA_UNIT_UTILS::UI::MessageTextFromValue(
aScale, aUnits,
EDA_UNIT_UTILS::UI::DoubleValueFromString( aScale, EDA_UNITS::MILLIMETRES, x, type ),
aDisplayUnits );
aScale, aUnits,
EDA_UNIT_UTILS::UI::DoubleValueFromString( aScale, EDA_UNITS::MM, x, type ),
aDisplayUnits );
wxString yStr = EDA_UNIT_UTILS::UI::MessageTextFromValue(
aScale, aUnits,
EDA_UNIT_UTILS::UI::DoubleValueFromString( aScale, EDA_UNITS::MILLIMETRES, y, type ),
aDisplayUnits );
aScale, aUnits,
EDA_UNIT_UTILS::UI::DoubleValueFromString( aScale, EDA_UNITS::MM, y, type ),
aDisplayUnits );
if( xStr == yStr )
return xStr;
@ -52,10 +52,8 @@ wxString GRID::UserUnitsMessageText( UNITS_PROVIDER* aProvider, bool aDisplayUni
VECTOR2D GRID::ToDouble( EDA_IU_SCALE aScale ) const
{
return VECTOR2D{
EDA_UNIT_UTILS::UI::DoubleValueFromString( aScale, EDA_UNITS::MILLIMETRES, x ),
EDA_UNIT_UTILS::UI::DoubleValueFromString( aScale, EDA_UNITS::MILLIMETRES, y ),
};
return VECTOR2D( EDA_UNIT_UTILS::UI::DoubleValueFromString( aScale, EDA_UNITS::MM, x ),
EDA_UNIT_UTILS::UI::DoubleValueFromString( aScale, EDA_UNITS::MM, y ) );
}

4
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::INCHES ) );
.Parameter( EDA_UNITS::IN ) );
TOOL_ACTION ACTIONS::milsUnits( TOOL_ACTION_ARGS()
.Name( "common.Control.mils" )
@ -991,7 +991,7 @@ TOOL_ACTION ACTIONS::millimetersUnits( TOOL_ACTION_ARGS()
.ToolbarState( TOOLBAR_STATE::TOGGLE )
.Icon( BITMAPS::unit_mm )
.Flags( AF_NONE )
.Parameter( EDA_UNITS::MILLIMETRES ) );
.Parameter( EDA_UNITS::MM ) );
TOOL_ACTION ACTIONS::updateUnits( TOOL_ACTION_ARGS()
.Name( "common.Control.updateUnits" )

8
common/tool/common_tools.cpp

@ -50,8 +50,8 @@
COMMON_TOOLS::COMMON_TOOLS() :
TOOL_INTERACTIVE( "common.Control" ),
m_frame( nullptr ),
m_imperialUnit( EDA_UNITS::INCHES ),
m_metricUnit( EDA_UNITS::MILLIMETRES )
m_imperialUnit( EDA_UNITS::IN ),
m_metricUnit( EDA_UNITS::MM )
{
}
@ -69,9 +69,9 @@ void COMMON_TOOLS::Reset( RESET_REASON aReason )
for( GRID& gridDef : settings.grids )
{
double gridSizeX = EDA_UNIT_UTILS::UI::DoubleValueFromString( scale, EDA_UNITS::MILLIMETRES,
double gridSizeX = EDA_UNIT_UTILS::UI::DoubleValueFromString( scale, EDA_UNITS::MM,
gridDef.x );
double gridSizeY = EDA_UNIT_UTILS::UI::DoubleValueFromString( scale, EDA_UNITS::MILLIMETRES,
double gridSizeY = EDA_UNIT_UTILS::UI::DoubleValueFromString( scale, EDA_UNITS::MM,
gridDef.y );
m_grids.emplace_back( KiROUND<double, int>( gridSizeX ),

2
common/widgets/wx_html_report_box.cpp

@ -31,7 +31,7 @@
WX_HTML_REPORT_BOX::WX_HTML_REPORT_BOX( wxWindow* parent, wxWindowID id, const wxPoint& pos,
const wxSize& size, long style ) :
HTML_WINDOW( parent, id, pos, size, style ),
m_units( EDA_UNITS::MILLIMETRES ),
m_units( EDA_UNITS::MM ),
m_immediateMode( false )
{
Flush();

10
cvpcb/display_footprints_frame.cpp

@ -200,12 +200,12 @@ void DISPLAY_FOOTPRINTS_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::measureTool,
CHECK( cond.CurrentTool( ACTIONS::measureTool ) ) );
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( PCB_ACTIONS::showPadNumbers, CHECK( cond.PadNumbersDisplay() ) );
mgr->SetConditions( PCB_ACTIONS::padDisplayMode, CHECK( !cond.PadFillDisplay() ) );

4
eeschema/connection_graph.cpp

@ -1575,7 +1575,7 @@ void CONNECTION_GRAPH::collectAllDriverValues()
}
default:
{
UNITS_PROVIDER unitsProvider( schIUScale, EDA_UNITS::MILLIMETRES );
UNITS_PROVIDER unitsProvider( schIUScale, EDA_UNITS::MM );
wxLogTrace( ConnTrace, wxS( "Unexpected strong driver %s" ),
driver->GetItemDescription( &unitsProvider, true ) );
@ -1845,7 +1845,7 @@ void CONNECTION_GRAPH::processSubGraphs()
}
else
{
UNITS_PROVIDER unitsProvider( schIUScale, EDA_UNITS::MILLIMETRES );
UNITS_PROVIDER unitsProvider( schIUScale, EDA_UNITS::MM );
wxLogTrace( ConnTrace,
wxS( "%ld (%s) weakly driven by unique sheet pin %s, "

2
eeschema/dialogs/dialog_label_properties.cpp

@ -435,7 +435,7 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataFromWindow()
return false;
// Don't allow text to disappear; it can be difficult to correct if you can't select it
if( !m_textSize.Validate( 0.01, 1000.0, EDA_UNITS::MILLIMETRES ) )
if( !m_textSize.Validate( 0.01, 1000.0, EDA_UNITS::MM ) )
return false;
SCH_COMMIT commit( m_Parent );

2
eeschema/dialogs/dialog_text_properties.cpp

@ -448,7 +448,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
return false;
// Don't allow text to disappear; it can be difficult to correct if you can't select it
if( !m_textSize.Validate( 0.01, 1000.0, EDA_UNITS::MILLIMETRES ) )
if( !m_textSize.Validate( 0.01, 1000.0, EDA_UNITS::MM ) )
return false;
SCH_COMMIT commit( m_frame );

2
eeschema/eeschema.cpp

@ -154,7 +154,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
IFACE( const char* aName, KIWAY::FACE_T aType ) :
KIFACE_BASE( aName, aType ),
UNITS_PROVIDER( schIUScale, EDA_UNITS::MILLIMETRES )
UNITS_PROVIDER( schIUScale, EDA_UNITS::MM )
{}
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits, KIWAY* aKiway ) override;

9
eeschema/eeschema_jobs_handler.cpp

@ -865,7 +865,6 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
{
wxString filename;
wxFileName fn;
size_t forbidden_char;
fn.SetPath( aSvgJob->m_outputDirectory );
fn.SetExt( FILEEXT::SVGFileExtension );
@ -1147,10 +1146,10 @@ int EESCHEMA_JOBS_HANDLER::JobSchErc( JOB* aJob )
switch( ercJob->m_units )
{
case JOB_SCH_ERC::UNITS::INCHES: units = EDA_UNITS::INCHES; break;
case JOB_SCH_ERC::UNITS::MILS: units = EDA_UNITS::MILS; break;
case JOB_SCH_ERC::UNITS::MILLIMETERS: units = EDA_UNITS::MILLIMETRES; break;
default: units = EDA_UNITS::MILLIMETRES; break;
case JOB_SCH_ERC::UNITS::IN: units = EDA_UNITS::IN; 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;
}
std::shared_ptr<SHEETLIST_ERC_ITEMS_PROVIDER> markersProvider =

10
eeschema/import_gfx/dialog_import_gfx_sch.cpp

@ -55,11 +55,11 @@ double DIALOG_IMPORT_GFX_SCH::m_importScale = 1.0; // Do not change t
const std::map<DXF_IMPORT_UNITS, wxString> dxfUnitsMap = {
{ DXF_IMPORT_UNITS::INCHES, _( "Inches" ) },
{ DXF_IMPORT_UNITS::MILLIMETERS, _( "Millimeters" ) },
{ DXF_IMPORT_UNITS::MILS, _( "Mils" ) },
{ DXF_IMPORT_UNITS::CENTIMETERS, _( "Centimeter" ) },
{ DXF_IMPORT_UNITS::FEET, _( "Feet" ) },
{ DXF_IMPORT_UNITS::IN, _( "Inches" ) },
{ DXF_IMPORT_UNITS::MM, _( "Millimeters" ) },
{ DXF_IMPORT_UNITS::MILS, _( "Mils" ) },
{ DXF_IMPORT_UNITS::CM, _( "Centimeter" ) },
{ DXF_IMPORT_UNITS::FEET, _( "Feet" ) },
};

2
eeschema/lib_symbol.cpp

@ -1433,7 +1433,7 @@ std::vector<LIB_SYMBOL_UNIT> LIB_SYMBOL::GetUnitDrawItems()
int LIB_SYMBOL::Compare( const LIB_SYMBOL& aRhs, int aCompareFlags, REPORTER* aReporter ) const
{
UNITS_PROVIDER unitsProvider( schIUScale, EDA_UNITS::MILLIMETRES );
UNITS_PROVIDER unitsProvider( schIUScale, EDA_UNITS::MM );
if( m_me == aRhs.m_me )
return 0;

2
eeschema/sch_connection.cpp

@ -471,7 +471,7 @@ void SCH_CONNECTION::AppendInfoToMsgPanel( std::vector<MSG_PANEL_ITEM>& aList )
if( SCH_ITEM* driver = Driver() )
{
UNITS_PROVIDER unitsProvider( schIUScale, EDA_UNITS::MILLIMETRES );
UNITS_PROVIDER unitsProvider( schIUScale, EDA_UNITS::MM );
msg.Printf( wxS( "%s at %p" ),
driver->GetItemDescription( &unitsProvider, false ),

5
eeschema/sch_edit_frame.cpp

@ -630,9 +630,8 @@ void SCH_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
mgr->SetConditions( ACTIONS::toggleGridOverrides, CHECK( cond.GridOverrides() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits,
CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( EE_ACTIONS::lineModeFree,

4
eeschema/symbol_editor/symbol_edit_frame.cpp

@ -487,8 +487,8 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
mgr->SetConditions( ACTIONS::toggleGridOverrides, CHECK( cond.GridOverrides() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( ACTIONS::cut, ENABLE( isEditableCond ) );

2
gerbview/gerbview.cpp

@ -58,7 +58,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
IFACE( const char* aName, KIWAY::FACE_T aType ) :
KIFACE_BASE( aName, aType ),
UNITS_PROVIDER( gerbIUScale, EDA_UNITS::MILLIMETRES )
UNITS_PROVIDER( gerbIUScale, EDA_UNITS::MM )
{}
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits, KIWAY* aKiway ) override;

4
gerbview/gerbview_frame.cpp

@ -1135,8 +1135,8 @@ void GERBVIEW_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::togglePolarCoords, CHECK( cond.PolarCoordinates() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
auto flashedDisplayOutlinesCond =

4
gerbview/toolbars_gerber.cpp

@ -308,12 +308,12 @@ void GERBVIEW_FRAME::updateDCodeSelectBox()
switch( GetUserUnits() )
{
case EDA_UNITS::MILLIMETRES:
case EDA_UNITS::MM:
scale = gerbIUScale.IU_PER_MM;
units = wxT( "mm" );
break;
case EDA_UNITS::INCHES:
case EDA_UNITS::IN:
scale = gerbIUScale.IU_PER_MILS * 1000;
units = wxT( "in" );
break;

4
gerbview/tools/gerbview_inspection_tool.cpp

@ -78,12 +78,12 @@ int GERBVIEW_INSPECTION_TOOL::ShowDCodes( const TOOL_EVENT& aEvent )
switch( m_frame->GetUserUnits() )
{
case EDA_UNITS::MILLIMETRES:
case EDA_UNITS::MM:
scale = gerbIUScale.IU_PER_MM;
units = wxT( "mm" );
break;
case EDA_UNITS::INCHES:
case EDA_UNITS::IN:
scale = gerbIUScale.IU_PER_MILS * 1000;
units = wxT( "in" );
break;

18
include/eda_units.h

@ -44,14 +44,14 @@ enum class EDA_DATA_TYPE
enum class EDA_UNITS
{
INCHES = 0,
MILLIMETRES = 1,
UNSCALED = 2,
DEGREES = 3,
PERCENT = 4,
MILS = 5,
MICROMETRES = 6, //The S is because MILLIMETRES already has an S at the end. But it is
CENTIMETRES = 7, //micrometre and centimetre and not micrometre (or cm) times second.
IN = 0,
MM = 1,
UNSCALED = 2,
DEGREES = 3,
PERCENT = 4,
MILS = 5,
UM = 6,
CM = 7,
};
namespace EDA_UNIT_UTILS
@ -201,7 +201,7 @@ namespace EDA_UNIT_UTILS
* because the mantissa of the number displayed has 4 digits max for readability. The
* actual internal value could need up to 8 digits to preserve precision.
*
* @param aUnits Units (INCHES, MILLIMETRE ..).
* @param aUnits Units (IN, MM, ...)
* @param aValue The double value to convert.
* @param aAddUnitsText If true, adds the unit label to the end of the string.
* @param aType DISTANCE, AREA, or VOLUME.

4
include/plotters/plotter.h

@ -51,8 +51,8 @@ using KIGFX::RENDER_SETTINGS;
// Units (inch/mm for DXF plotter
enum class DXF_UNITS
{
INCHES = 0,
MILLIMETERS = 1
IN = 0,
MM = 1
};

5
include/plotters/plotter_dxf.h

@ -25,12 +25,13 @@
class DXF_PLOTTER : public PLOTTER
{
public:
DXF_PLOTTER() : m_textAsLines( false )
DXF_PLOTTER() :
m_textAsLines( false )
{
m_textAsLines = true;
m_currentColor = COLOR4D::BLACK;
m_currentLineType = LINE_STYLE::SOLID;
SetUnits( DXF_UNITS::INCHES );
SetUnits( DXF_UNITS::IN );
}
virtual PLOT_FORMAT GetPlotterType() const override

2
include/reporter.h

@ -129,7 +129,7 @@ public:
virtual EDA_UNITS GetUnits() const
{
return EDA_UNITS::MILLIMETRES;
return EDA_UNITS::MM;
}
virtual ~REPORTER()

8
include/units_provider.h

@ -48,12 +48,8 @@ public:
virtual void GetUnitPair( EDA_UNITS& aPrimaryUnit, EDA_UNITS& aSecondaryUnits )
{
aPrimaryUnit = GetUserUnits();
aSecondaryUnits = EDA_UNITS::MILS;
if( EDA_UNIT_UTILS::IsImperialUnit( aPrimaryUnit ) )
aSecondaryUnits = EDA_UNITS::MILLIMETRES;
else
aSecondaryUnits = EDA_UNITS::MILS;
aSecondaryUnits = EDA_UNIT_UTILS::IsImperialUnit( aPrimaryUnit ) ? EDA_UNITS::MM
: EDA_UNITS::MILS;
}
const EDA_IU_SCALE& GetIuScale() const { return m_iuScale; }

4
kicad/cli/command_pcb_drc.cpp

@ -131,11 +131,11 @@ int CLI::PCB_DRC_COMMAND::doPerform( KIWAY& aKiway )
if( units == wxS( "mm" ) )
{
drcJob->m_units = JOB_PCB_DRC::UNITS::MILLIMETERS;
drcJob->m_units = JOB_PCB_DRC::UNITS::MM;
}
else if( units == wxS( "in" ) )
{
drcJob->m_units = JOB_PCB_DRC::UNITS::INCHES;
drcJob->m_units = JOB_PCB_DRC::UNITS::IN;
}
else if( units == wxS( "mils" ) )
{

4
kicad/cli/command_pcb_export_3d.cpp

@ -281,9 +281,9 @@ 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::INCHES;
step->m_vrmlUnits = JOB_EXPORT_PCB_3D::VRML_UNITS::IN;
else if( units == wxS( "mm" ) )
step->m_vrmlUnits = JOB_EXPORT_PCB_3D::VRML_UNITS::MILLIMETERS;
step->m_vrmlUnits = JOB_EXPORT_PCB_3D::VRML_UNITS::MM;
else if( units == wxS( "m" ) )
step->m_vrmlUnits = JOB_EXPORT_PCB_3D::VRML_UNITS::METERS;
else if( units == wxS( "tenths" ) )

4
kicad/cli/command_pcb_export_drill.cpp

@ -144,11 +144,11 @@ int CLI::PCB_EXPORT_DRILL_COMMAND::doPerform( KIWAY& aKiway )
if( units == wxS( "mm" ) )
{
drillJob->m_drillUnits = JOB_EXPORT_PCB_DRILL::DRILL_UNITS::MILLIMETERS;
drillJob->m_drillUnits = JOB_EXPORT_PCB_DRILL::DRILL_UNITS::MM;
}
else if( units == wxS( "in" ) )
{
drillJob->m_drillUnits = JOB_EXPORT_PCB_DRILL::DRILL_UNITS::INCHES;
drillJob->m_drillUnits = JOB_EXPORT_PCB_DRILL::DRILL_UNITS::IN;
}
else
{

4
kicad/cli/command_pcb_export_dxf.cpp

@ -136,11 +136,11 @@ int CLI::PCB_EXPORT_DXF_COMMAND::doPerform( KIWAY& aKiway )
if( units == wxS( "mm" ) )
{
dxfJob->m_dxfUnits = JOB_EXPORT_PCB_DXF::DXF_UNITS::MILLIMETERS;
dxfJob->m_dxfUnits = JOB_EXPORT_PCB_DXF::DXF_UNITS::MM;
}
else if( units == wxS( "in" ) )
{
dxfJob->m_dxfUnits = JOB_EXPORT_PCB_DXF::DXF_UNITS::INCHES;
dxfJob->m_dxfUnits = JOB_EXPORT_PCB_DXF::DXF_UNITS::IN;
}
else
{

4
kicad/cli/command_pcb_export_ipc2581.cpp

@ -131,9 +131,9 @@ int CLI::PCB_EXPORT_IPC2581_COMMAND::doPerform( KIWAY& aKiway )
wxString units = From_UTF8( m_argParser.get<std::string>( ARG_UNITS ).c_str() );
if( units == "mm" )
ipc2581Job->m_units = JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::MILLIMETERS;
ipc2581Job->m_units = JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::MM;
else if( units == "in" )
ipc2581Job->m_units = JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::INCHES;
ipc2581Job->m_units = JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::IN;
ipc2581Job->m_colInternalId =
From_UTF8( m_argParser.get<std::string>( ARG_BOM_COL_INT_ID ).c_str() );

4
kicad/cli/command_pcb_export_odb.cpp

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

4
kicad/cli/command_pcb_export_pos.cpp

@ -140,11 +140,11 @@ int CLI::PCB_EXPORT_POS_COMMAND::doPerform( KIWAY& aKiway )
if( units == wxS( "mm" ) )
{
aPosJob->m_units = JOB_EXPORT_PCB_POS::UNITS::MILLIMETERS;
aPosJob->m_units = JOB_EXPORT_PCB_POS::UNITS::MM;
}
else if( units == wxS( "in" ) )
{
aPosJob->m_units = JOB_EXPORT_PCB_POS::UNITS::INCHES;
aPosJob->m_units = JOB_EXPORT_PCB_POS::UNITS::IN;
}
else
{

4
kicad/cli/command_sch_erc.cpp

@ -118,11 +118,11 @@ int CLI::SCH_ERC_COMMAND::doPerform( KIWAY& aKiway )
if( units == wxS( "mm" ) )
{
ercJob->m_units = JOB_SCH_ERC::UNITS::MILLIMETERS;
ercJob->m_units = JOB_SCH_ERC::UNITS::MM;
}
else if( units == wxS( "in" ) )
{
ercJob->m_units = JOB_SCH_ERC::UNITS::INCHES;
ercJob->m_units = JOB_SCH_ERC::UNITS::IN;
}
else if( units == wxS( "mils" ) )
{

6
pagelayout_editor/dialogs/properties_frame.cpp

@ -161,19 +161,19 @@ wxSize PROPERTIES_FRAME::GetMinSize() const
double fromMM( double aMMValue )
{
return EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale, EDA_UNITS::MILLIMETRES, aMMValue );
return EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale, EDA_UNITS::MM, aMMValue );
}
double toMM( double aIUValue )
{
return EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, EDA_UNITS::MILLIMETRES, aIUValue );
return EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, EDA_UNITS::MM, aIUValue );
}
bool validateMM( UNIT_BINDER& aUnitBinder, double aMin, double aMax )
{
return aUnitBinder.Validate( aMin, aMax, EDA_UNITS::MILLIMETRES );
return aUnitBinder.Validate( aMin, aMax, EDA_UNITS::MM );
}

2
pagelayout_editor/pl_editor.cpp

@ -50,7 +50,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
IFACE( const char* aName, KIWAY::FACE_T aType ) :
KIFACE_BASE( aName, aType ),
UNITS_PROVIDER( drawSheetIUScale, EDA_UNITS::MILLIMETRES )
UNITS_PROVIDER( drawSheetIUScale, EDA_UNITS::MM )
{}
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits, KIWAY* aKiway ) override;

22
pagelayout_editor/pl_editor_frame.cpp

@ -95,7 +95,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_mruImagePath( wxEmptyString )
{
m_maximizeByDefault = true;
SetUserUnits( EDA_UNITS::MILLIMETRES );
SetUserUnits( EDA_UNITS::MM );
m_showBorderAndTitleBlock = true; // true for reference drawings.
DS_DATA_MODEL::GetTheInstance().m_EditMode = true;
@ -303,8 +303,8 @@ 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::MILLIMETRES ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
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::INCHES: gridformatter = wxS( "grid %.3f" ); break;
case EDA_UNITS::MILLIMETRES: gridformatter = wxS( "grid %.4f" ); break;
default: gridformatter = wxS( "grid %f" ); break;
case EDA_UNITS::IN: 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,11 +767,11 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
switch( GetUserUnits() )
{
case EDA_UNITS::INCHES: SetStatusText( _( "inches" ), 6 ); break;
case EDA_UNITS::MILS: SetStatusText( _( "mils" ), 6 ); break;
case EDA_UNITS::MILLIMETRES: SetStatusText( _( "mm" ), 6 ); break;
case EDA_UNITS::UNSCALED: SetStatusText( wxEmptyString, 6 ); break;
default: wxASSERT( false ); break;
case EDA_UNITS::IN: 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;
default: wxASSERT( false ); break;
}
wxString line;

12
pcbnew/api/api_pcb_enums.cpp

@ -641,10 +641,10 @@ types::DimensionUnit ToProtoEnum( DIM_UNITS_MODE aValue )
{
switch( aValue )
{
case DIM_UNITS_MODE::INCHES: return types::DimensionUnit::DU_INCHES;
case DIM_UNITS_MODE::MILS: return types::DimensionUnit::DU_MILS;
case DIM_UNITS_MODE::MILLIMETRES: return types::DimensionUnit::DU_MILLIMETERS;
case DIM_UNITS_MODE::AUTOMATIC: return types::DimensionUnit::DU_AUTOMATIC;
case DIM_UNITS_MODE::IN: 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;
default:
wxCHECK_MSG( false, types::DimensionUnit::DU_UNKNOWN,
@ -658,9 +658,9 @@ DIM_UNITS_MODE FromProtoEnum( types::DimensionUnit aValue )
{
switch( aValue )
{
case types::DimensionUnit::DU_INCHES: return DIM_UNITS_MODE::INCHES;
case types::DimensionUnit::DU_INCHES: return DIM_UNITS_MODE::IN;
case types::DimensionUnit::DU_MILS: return DIM_UNITS_MODE::MILS;
case types::DimensionUnit::DU_MILLIMETERS: return DIM_UNITS_MODE::MILLIMETRES;
case types::DimensionUnit::DU_MILLIMETERS: return DIM_UNITS_MODE::MM;
case types::DimensionUnit::DU_UNKNOWN:
case types::DimensionUnit::DU_AUTOMATIC: return DIM_UNITS_MODE::AUTOMATIC;

2
pcbnew/board.cpp

@ -81,7 +81,7 @@ BOARD::BOARD() :
m_timeStamp( 1 ),
m_paper( PAGE_INFO::A4 ),
m_project( nullptr ),
m_userUnits( EDA_UNITS::MILLIMETRES ),
m_userUnits( EDA_UNITS::MM ),
m_designSettings( new BOARD_DESIGN_SETTINGS( nullptr, "board.design_settings" ) ),
m_NetInfo( this ),
m_embedFonts( false )

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::INCHES,
&m_DimensionUnitsMode, DIM_UNITS_MODE::AUTOMATIC, DIM_UNITS_MODE::IN,
DIM_UNITS_MODE::AUTOMATIC ) );
m_params.emplace_back( new PARAM_ENUM<DIM_PRECISION>( "defaults.dimension_precision",

24
pcbnew/dialogs/dialog_dimension_properties.cpp

@ -205,16 +205,16 @@ bool DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow()
switch( m_dimension->GetUnitsMode() )
{
case DIM_UNITS_MODE::INCHES: m_cbUnits->SetSelection( 0 ); break;
case DIM_UNITS_MODE::MILS: m_cbUnits->SetSelection( 1 ); break;
case DIM_UNITS_MODE::MILLIMETRES: m_cbUnits->SetSelection( 2 ); break;
case DIM_UNITS_MODE::AUTOMATIC: m_cbUnits->SetSelection( 3 ); break;
case DIM_UNITS_MODE::IN: 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;
}
switch ( m_dimension->GetArrowDirection() )
{
case DIM_ARROW_DIRECTION::INWARD: m_cbArrowDirection->SetSelection( 0 ); break;
case DIM_ARROW_DIRECTION::OUTWARD: m_cbArrowDirection->SetSelection( 1 ); break;
case DIM_ARROW_DIRECTION::INWARD: m_cbArrowDirection->SetSelection( 0 ); break;
case DIM_ARROW_DIRECTION::OUTWARD: m_cbArrowDirection->SetSelection( 1 ); break;
}
m_cbUnitsFormat->SetSelection( static_cast<int>( m_dimension->GetUnitsFormat() ) );
@ -390,16 +390,16 @@ void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( PCB_DIMENSION_BASE*
aTarget->SetLayer( static_cast<PCB_LAYER_ID>( m_cbLayerActual->GetLayerSelection() ) );
switch ( m_cbArrowDirection->GetSelection() ) {
case 0: aTarget->SetArrowDirection( DIM_ARROW_DIRECTION::INWARD ); break;
case 1: aTarget->SetArrowDirection( DIM_ARROW_DIRECTION::OUTWARD ); break;
case 0: aTarget->SetArrowDirection( DIM_ARROW_DIRECTION::INWARD ); break;
case 1: aTarget->SetArrowDirection( DIM_ARROW_DIRECTION::OUTWARD ); break;
}
switch( m_cbUnits->GetSelection() )
{
case 0: aTarget->SetUnitsMode( DIM_UNITS_MODE::INCHES ); break;
case 1: aTarget->SetUnitsMode( DIM_UNITS_MODE::MILS ); break;
case 2: aTarget->SetUnitsMode( DIM_UNITS_MODE::MILLIMETRES ); break;
case 3: aTarget->SetUnitsMode( DIM_UNITS_MODE::AUTOMATIC ); break;
case 0: aTarget->SetUnitsMode( DIM_UNITS_MODE::IN ); 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;
}
aTarget->SetUnitsFormat( static_cast<DIM_UNITS_FORMAT>( m_cbUnitsFormat->GetSelection() ) );

6
pcbnew/dialogs/dialog_export_2581.cpp

@ -267,7 +267,7 @@ bool DIALOG_EXPORT_2581::Init()
{
SetTitle( m_job->GetSettingsDialogTitle() );
m_choiceUnits->SetSelection( m_job->m_units == JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::MILLIMETERS ? 0 : 1 );
m_choiceUnits->SetSelection( m_job->m_units == JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::MM ? 0 : 1 );
m_precision->SetValue( static_cast<int>( m_job->m_precision ) );
m_versionChoice->SetSelection( m_job->m_version == JOB_EXPORT_PCB_IPC2581::IPC2581_VERSION::B ? 0 : 1 );
m_cbCompress->SetValue( m_job->m_compress );
@ -390,8 +390,8 @@ bool DIALOG_EXPORT_2581::TransferDataFromWindow()
m_job->m_version = GetVersion() == 'B' ? JOB_EXPORT_PCB_IPC2581::IPC2581_VERSION::B
: JOB_EXPORT_PCB_IPC2581::IPC2581_VERSION::C;
m_job->m_units = GetUnitsString() == wxT( "mm" ) ? JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::MILLIMETERS
: JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::INCHES;
m_job->m_units = GetUnitsString() == wxT( "mm" ) ? JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::MM
: JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::IN;
m_job->m_precision = m_precision->GetValue();
m_job->m_compress = GetCompress();
}

2
pcbnew/dialogs/dialog_export_odbpp.cpp

@ -438,7 +438,7 @@ void DIALOG_EXPORT_ODBPP::GenerateODBPPFiles( const JOB_EXPORT_PCB_ODB& aJob, BO
wxString lowerTxt;
std::map<std::string, UTF8> props;
props["units"] = aJob.m_units == JOB_EXPORT_PCB_ODB::ODB_UNITS::MILLIMETERS ? "mm" : "inch";
props["units"] = aJob.m_units == JOB_EXPORT_PCB_ODB::ODB_UNITS::MM ? "mm" : "inch";
props["sigfig"] = wxString::Format( "%d", aJob.m_precision );
auto saveFile = [&]() -> bool

17
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::INCHES : EDA_UNITS::MILLIMETRES;
m_units = cfg->m_PlaceFile.units == 0 ? EDA_UNITS::IN : EDA_UNITS::MM;
// Output directory
m_outputDirectoryName->SetValue( projectFile.m_PcbLastPath[LAST_PATH_POS_FILES] );
@ -113,10 +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::INCHES ? EDA_UNITS::INCHES
: EDA_UNITS::MILLIMETRES;
m_units = m_job->m_units == JOB_EXPORT_PCB_POS::UNITS::IN ? EDA_UNITS::IN : EDA_UNITS::MM;
m_staticTextDir->SetLabel( _( "Output file:" ) );
m_outputDirectoryName->SetValue( m_job->GetConfiguredOutputPath() );
@ -267,7 +264,7 @@ void DIALOG_GEN_FOOTPRINT_POSITION::onGenerate( wxCommandEvent& event )
{
if( !m_job )
{
m_units = m_unitsCtrl->GetSelection() == 0 ? EDA_UNITS::INCHES : EDA_UNITS::MILLIMETRES;
m_units = m_unitsCtrl->GetSelection() == 0 ? EDA_UNITS::IN : EDA_UNITS::MM;
PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings();
@ -277,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::INCHES ? 0 : 1;
cfg->m_PlaceFile.units = m_units == EDA_UNITS::IN ? 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();
@ -294,8 +291,8 @@ 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::INCHES
: JOB_EXPORT_PCB_POS::UNITS::MILLIMETERS;
m_job->m_units = m_unitsCtrl->GetSelection() == 0 ? JOB_EXPORT_PCB_POS::UNITS::IN
: 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;
m_job->m_singleFile = m_singleFile->GetValue();
@ -602,7 +599,7 @@ void PCB_EDIT_FRAME::GenFootprintsReport( wxCommandEvent& event )
fn.SetPath( dirDialog.GetPath() );
fn.SetExt( wxT( "rpt" ) );
bool unitMM = GetUserUnits() == EDA_UNITS::MILLIMETRES;
bool unitMM = GetUserUnits() == EDA_UNITS::MM;
bool success = DoGenFootprintsReport( fn.GetFullPath(), unitMM );
wxString msg;

7
pcbnew/dialogs/dialog_gendrill.cpp

@ -138,9 +138,8 @@ bool DIALOG_GENDRILL::TransferDataFromWindow()
m_job->SetConfiguredOutputPath( m_outputDirectoryName->GetValue() );
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::MILLIMETERS
: JOB_EXPORT_PCB_DRILL::DRILL_UNITS::INCHES;
m_job->m_drillUnits = m_units->GetSelection() == 0 ? JOB_EXPORT_PCB_DRILL::DRILL_UNITS::MM
: JOB_EXPORT_PCB_DRILL::DRILL_UNITS::IN;
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();
@ -186,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::INCHES );
m_units->SetSelection( m_job->m_drillUnits == JOB_EXPORT_PCB_DRILL::DRILL_UNITS::IN );
m_zeros->SetSelection( static_cast<int>( m_job->m_zeroFormat ) );
updatePrecisionOptions();
m_Check_Minimal->SetValue( m_job->m_excellonMinimalHeader );

10
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::INCHES ? 0 : 1 );
m_DXF_plotUnits->SetSelection( m_plotOpts.GetDXFPlotUnits() == DXF_UNITS::IN ? 0 : 1 );
// Plot mirror option
m_plotMirrorOpt->SetValue( m_plotOpts.GetMirror() );
@ -451,9 +451,9 @@ 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::INCHES
? JOB_EXPORT_PCB_DXF::DXF_UNITS::INCHES
: JOB_EXPORT_PCB_DXF::DXF_UNITS::MILLIMETERS;
dxfJob->m_dxfUnits = m_plotOpts.GetDXFPlotUnits() == DXF_UNITS::IN
? JOB_EXPORT_PCB_DXF::DXF_UNITS::IN
: JOB_EXPORT_PCB_DXF::DXF_UNITS::MM;
dxfJob->m_plotGraphicItemsUsingContours = m_plotOpts.GetPlotMode() == OUTLINE_MODE::SKETCH;
dxfJob->m_polygonMode = m_plotOpts.GetDXFPlotPolygonMode();
dxfJob->m_genMode = JOB_EXPORT_PCB_DXF::GEN_MODE::MULTI;
@ -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::INCHES : DXF_UNITS::MILLIMETERS );
tempOptions.SetDXFPlotUnits( sel == 0 ? DXF_UNITS::IN : DXF_UNITS::MM );
if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() ) // Currently, only DXF supports this option
tempOptions.SetTextMode( PLOT_TEXT_MODE::DEFAULT );

2
pcbnew/dialogs/panel_pcbnew_color_settings.cpp

@ -682,7 +682,7 @@ std::set<int> g_excludedLayers =
PANEL_PCBNEW_COLOR_SETTINGS::PANEL_PCBNEW_COLOR_SETTINGS( wxWindow* aParent, BOARD* aBoard ) :
PANEL_COLOR_SETTINGS( aParent ),
UNITS_PROVIDER( pcbIUScale, EDA_UNITS::MILLIMETRES ),
UNITS_PROVIDER( pcbIUScale, EDA_UNITS::MM ),
m_preview( nullptr ),
m_page( nullptr ),
m_titleBlock( nullptr ),

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::INCHES ) )
if( !m_minClearance.Validate( 0, 10, EDA_UNITS::IN ) )
return false;
if( !m_minConn.Validate( 0, 10, EDA_UNITS::INCHES ) )
if( !m_minConn.Validate( 0, 10, EDA_UNITS::IN ) )
return false;
if( !m_trackMinWidth.Validate( 0, 10, EDA_UNITS::INCHES ) )
if( !m_trackMinWidth.Validate( 0, 10, EDA_UNITS::IN ) )
return false;
if( !m_viaMinAnnulus.Validate( 0, 10, EDA_UNITS::INCHES ) )
if( !m_viaMinAnnulus.Validate( 0, 10, EDA_UNITS::IN ) )
return false;
if( !m_viaMinSize.Validate( 0, 10, EDA_UNITS::INCHES ) )
if( !m_viaMinSize.Validate( 0, 10, EDA_UNITS::IN ) )
return false;
if( !m_holeClearance.Validate( 0, 10, EDA_UNITS::INCHES ) )
if( !m_holeClearance.Validate( 0, 10, EDA_UNITS::IN ) )
return false;
if( !m_edgeClearance.Validate( 0, 10, EDA_UNITS::INCHES ) )
if( !m_edgeClearance.Validate( 0, 10, EDA_UNITS::IN ) )
return false;
if( !m_minGrooveWidth.Validate( 0, 10, EDA_UNITS::INCHES ) )
if( !m_minGrooveWidth.Validate( 0, 10, EDA_UNITS::IN ) )
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::INCHES ) )
if( !m_holeToHoleMin.Validate( 0, 10, EDA_UNITS::IN ) )
return false;
// These are all stored in project file, not board, so no need for OnModify()

20
pcbnew/drc/drc_engine.cpp

@ -76,16 +76,16 @@ void drcPrintDebugMessage( int level, const wxString& msg, const char *function,
DRC_ENGINE::DRC_ENGINE( BOARD* aBoard, BOARD_DESIGN_SETTINGS *aSettings ) :
UNITS_PROVIDER( pcbIUScale, EDA_UNITS::MILLIMETRES ),
m_designSettings ( aSettings ),
m_board( aBoard ),
m_drawingSheet( nullptr ),
m_schematicNetlist( nullptr ),
m_rulesValid( false ),
m_reportAllTrackErrors( false ),
m_testFootprints( false ),
m_reporter( nullptr ),
m_progressReporter( nullptr )
UNITS_PROVIDER( pcbIUScale, EDA_UNITS::MM ),
m_designSettings ( aSettings ),
m_board( aBoard ),
m_drawingSheet( nullptr ),
m_schematicNetlist( nullptr ),
m_rulesValid( false ),
m_reportAllTrackErrors( false ),
m_testFootprints( false ),
m_reporter( nullptr ),
m_progressReporter( nullptr )
{
m_errorLimits.resize( DRCE_LAST + 1 );

3
pcbnew/drc/drc_test_provider.cpp

@ -43,7 +43,8 @@ DRC_TEST_PROVIDER_REGISTRY::~DRC_TEST_PROVIDER_REGISTRY()
DRC_TEST_PROVIDER::DRC_TEST_PROVIDER() :
UNITS_PROVIDER( pcbIUScale, EDA_UNITS::MILLIMETRES ), m_drcEngine( nullptr )
UNITS_PROVIDER( pcbIUScale, EDA_UNITS::MM ),
m_drcEngine( nullptr )
{
}

4
pcbnew/drc/drc_test_provider_library_parity.cpp

@ -123,7 +123,7 @@ public:
#define PAD_DESC( pad ) wxString::Format( _( "Pad %s" ), ( pad )->GetNumber() )
UNITS_PROVIDER g_unitsProvider( pcbIUScale, EDA_UNITS::MILLIMETRES );
UNITS_PROVIDER g_unitsProvider( pcbIUScale, EDA_UNITS::MM );
bool primitiveNeedsUpdate( const std::shared_ptr<PCB_SHAPE>& a,
@ -572,8 +572,6 @@ bool zoneNeedsUpdate( const ZONE* a, const ZONE* b, REPORTER* aReporter )
bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFP, int aCompareFlags,
REPORTER* aReporter )
{
UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::MILLIMETRES );
wxASSERT( aLibFP );
bool diff = false;

5
pcbnew/exporters/gen_drill_report_files.cpp

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

4
pcbnew/exporters/gendrill_Excellon_writer.cpp

@ -363,9 +363,9 @@ void EXCELLON_WRITER::SetFormat( bool aMetric, ZEROS_FMT aZerosFmt, int aLeftDig
/* Set conversion scale depending on drill file units */
if( m_unitsMetric )
m_conversionUnits = 1.0 / pcbIUScale.IU_PER_MM; // EXCELLON units = mm
m_conversionUnits = 1.0 / pcbIUScale.IU_PER_MM; // EXCELLON units = mm
else
m_conversionUnits = 0.001 / pcbIUScale.IU_PER_MILS; // EXCELLON units = INCHES
m_conversionUnits = 0.001 / pcbIUScale.IU_PER_MILS; // EXCELLON units = in
// Set the zero counts. if aZerosFmt == DECIMAL_FORMAT, these values
// will be set, but not used.

4
pcbnew/exporters/place_file_exporter.cpp

@ -47,10 +47,10 @@ public:
// Defined values to write coordinates using inches or mm:
static const double conv_unit_inch = 0.001 / pcbIUScale.IU_PER_MILS ; // units = INCHES
static const double conv_unit_inch = 0.001 / pcbIUScale.IU_PER_MILS ; // units = in
static const char unit_text_inch[] = "## Unit = inches, Angle = deg.\n";
static const double conv_unit_mm = 1.0 / pcbIUScale.IU_PER_MM; // units = mm
static const double conv_unit_mm = 1.0 / pcbIUScale.IU_PER_MM; // units = mm
static const char unit_text_mm[] = "## Unit = mm, Angle = deg.\n";
// Sort function use by GenerefootprintsPosition()

10
pcbnew/exporters/step/step_pcb_model.cpp

@ -1385,12 +1385,12 @@ bool STEP_PCB_MODEL::MakeShapeAsThickSegment( TopoDS_Shape& aShape,
static wxString formatBBox( const BOX2I& aBBox )
{
wxString str;
UNITS_PROVIDER up( pcbIUScale, EDA_UNITS::MILLIMETRES );
UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::MM );
str << "x0: " << up.StringFromValue( aBBox.GetLeft(), false ) << "; ";
str << "y0: " << up.StringFromValue( aBBox.GetTop(), false ) << "; ";
str << "x1: " << up.StringFromValue( aBBox.GetRight(), false ) << "; ";
str << "y1: " << up.StringFromValue( aBBox.GetBottom(), false );
str << "x0: " << unitsProvider.StringFromValue( aBBox.GetLeft(), false ) << "; ";
str << "y0: " << unitsProvider.StringFromValue( aBBox.GetTop(), false ) << "; ";
str << "x1: " << unitsProvider.StringFromValue( aBBox.GetRight(), false ) << "; ";
str << "y1: " << unitsProvider.StringFromValue( aBBox.GetBottom(), false );
return str;
}

4
pcbnew/files.cpp

@ -1442,8 +1442,8 @@ void PCB_EDIT_FRAME::GenODBPPFiles( wxCommandEvent& event )
job.m_compressionMode = static_cast<JOB_EXPORT_PCB_ODB::ODB_COMPRESSION>( dlg.GetCompressFormat() );
job.m_precision = dlg.GetPrecision();
job.m_units = dlg.GetUnitsString() == "mm" ? JOB_EXPORT_PCB_ODB::ODB_UNITS::MILLIMETERS
: JOB_EXPORT_PCB_ODB::ODB_UNITS::INCHES;
job.m_units = dlg.GetUnitsString() == "mm" ? JOB_EXPORT_PCB_ODB::ODB_UNITS::MM
: JOB_EXPORT_PCB_ODB::ODB_UNITS::IN;
WX_PROGRESS_REPORTER progressReporter( this, _( "Generating ODB++ output files" ), 3, false );
WX_STRING_REPORTER reporter;

4
pcbnew/footprint_chooser_frame.cpp

@ -771,8 +771,8 @@ void FOOTPRINT_CHOOSER_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::MILLIMETRES ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( PCB_ACTIONS::showPadNumbers, CHECK( cond.PadNumbersDisplay() ) );

4
pcbnew/footprint_edit_frame.cpp

@ -1254,8 +1254,8 @@ void FOOTPRINT_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
mgr->SetConditions( ACTIONS::toggleGridOverrides, CHECK( cond.GridOverrides() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
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::INCHES,
&m_DesignSettings.m_DimensionUnitsMode, DIM_UNITS_MODE::AUTOMATIC, DIM_UNITS_MODE::IN,
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::INCHES ) ) );
static_cast<long>( EDA_UNITS::IN ) ) );
// Convert to internal units
x = EDA_UNIT_UTILS::UI::FromUserUnit( pcbIUScale, u, x );

4
pcbnew/footprint_viewer_frame.cpp

@ -349,8 +349,8 @@ 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::MILLIMETRES ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( PCB_ACTIONS::saveFpToBoard, ENABLE( addToBoardCond ) );

2
pcbnew/generators/pcb_tuning_pattern.cpp

@ -1468,7 +1468,7 @@ bool PCB_TUNING_PATTERN::Update( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COM
}
wxString result;
EDA_UNITS userUnits = EDA_UNITS::MILLIMETRES;
EDA_UNITS userUnits = EDA_UNITS::MM;
if( aTool->GetManager()->GetSettings() )
userUnits = static_cast<EDA_UNITS>( aTool->GetManager()->GetSettings()->m_System.units );

10
pcbnew/import_gfx/dialog_import_graphics.cpp

@ -50,11 +50,11 @@ double DIALOG_IMPORT_GRAPHICS::s_importScale = 1.0; // Do not change the importe
const std::map<DXF_IMPORT_UNITS, wxString> dxfUnitsMap = {
{ DXF_IMPORT_UNITS::INCHES, _( "Inches" ) },
{ DXF_IMPORT_UNITS::MILLIMETERS, _( "Millimeters" ) },
{ DXF_IMPORT_UNITS::MILS, _( "Mils" ) },
{ DXF_IMPORT_UNITS::CENTIMETERS, _( "Centimeter" ) },
{ DXF_IMPORT_UNITS::FEET, _( "Feet" ) },
{ DXF_IMPORT_UNITS::IN, _( "Inches" ) },
{ DXF_IMPORT_UNITS::MM, _( "Millimeters" ) },
{ DXF_IMPORT_UNITS::MILS, _( "Mils" ) },
{ DXF_IMPORT_UNITS::CM, _( "Centimeter" ) },
{ DXF_IMPORT_UNITS::FEET, _( "Feet" ) },
};

42
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::INCHES ),
m_units( EDA_UNITS::IN ),
m_autoUnits( false ),
m_unitsFormat( DIM_UNITS_FORMAT::BARE_SUFFIX ),
m_arrowDirection( DIM_ARROW_DIRECTION::OUTWARD ),
@ -429,10 +429,10 @@ wxString PCB_DIMENSION_BASE::GetValueText() const
{
switch( m_units )
{
case EDA_UNITS::INCHES: precision = precision - 4; break;
case EDA_UNITS::MILS: precision = std::max( 0, precision - 7 ); break;
case EDA_UNITS::MILLIMETRES: precision = precision - 5; break;
default: precision = precision - 4; break;
case EDA_UNITS::IN: 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,9 +487,9 @@ DIM_UNITS_MODE PCB_DIMENSION_BASE::GetUnitsMode() const
switch( m_units )
{
default:
case EDA_UNITS::INCHES: return DIM_UNITS_MODE::INCHES;
case EDA_UNITS::MILLIMETRES: return DIM_UNITS_MODE::MILLIMETRES;
case EDA_UNITS::MILS: return DIM_UNITS_MODE::MILS;
case EDA_UNITS::IN: return DIM_UNITS_MODE::IN;
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::INCHES:
case DIM_UNITS_MODE::IN:
m_autoUnits = false;
m_units = EDA_UNITS::INCHES;
m_units = EDA_UNITS::IN;
break;
case DIM_UNITS_MODE::MILS:
@ -509,14 +509,14 @@ void PCB_DIMENSION_BASE::SetUnitsMode( DIM_UNITS_MODE aMode )
m_units = EDA_UNITS::MILS;
break;
case DIM_UNITS_MODE::MILLIMETRES:
case DIM_UNITS_MODE::MM:
m_autoUnits = false;
m_units = EDA_UNITS::MILLIMETRES;
m_units = EDA_UNITS::MM;
break;
case DIM_UNITS_MODE::AUTOMATIC:
m_autoUnits = true;
m_units = GetBoard() ? GetBoard()->GetUserUnits() : EDA_UNITS::MILLIMETRES;
m_units = GetBoard() ? GetBoard()->GetUserUnits() : EDA_UNITS::MM;
break;
}
}
@ -634,7 +634,7 @@ void PCB_DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
// Use our own UNITS_PROVIDER to report dimension info in dimension's units rather than
// in frame's units.
UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::MILLIMETRES );
UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::MM );
unitsProvider.SetUserUnits( GetUnits() );
aList.emplace_back( _( "Units" ), EDA_UNIT_UTILS::GetLabel( GetUnits() ) );
@ -1027,7 +1027,7 @@ void PCB_DIM_ALIGNED::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_P
// Use our own UNITS_PROVIDER to report dimension info in dimension's units rather than
// in frame's units.
UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::MILLIMETRES );
UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::MM );
unitsProvider.SetUserUnits( GetUnits() );
aList.emplace_back( _( "Height" ), unitsProvider.MessageTextFromValue( m_height ) );
@ -1783,14 +1783,14 @@ static struct DIMENSION_DESC
.Map( DIM_UNITS_FORMAT::PAREN_SUFFIX, _HKI( "1234.0 (mm)" ) );
ENUM_MAP<DIM_UNITS_MODE>::Instance()
.Map( DIM_UNITS_MODE::INCHES, _HKI( "Inches" ) )
.Map( DIM_UNITS_MODE::MILS, _HKI( "Mils" ) )
.Map( DIM_UNITS_MODE::MILLIMETRES, _HKI( "Millimeters" ) )
.Map( DIM_UNITS_MODE::AUTOMATIC, _HKI( "Automatic" ) );
.Map( DIM_UNITS_MODE::IN, _HKI( "Inches" ) )
.Map( DIM_UNITS_MODE::MILS, _HKI( "Mils" ) )
.Map( DIM_UNITS_MODE::MM, _HKI( "Millimeters" ) )
.Map( DIM_UNITS_MODE::AUTOMATIC, _HKI( "Automatic" ) );
ENUM_MAP<DIM_ARROW_DIRECTION>::Instance()
.Map( DIM_ARROW_DIRECTION::INWARD, _HKI( "Inward" ) )
.Map( DIM_ARROW_DIRECTION::OUTWARD, _HKI( "Outward" ) );
.Map( DIM_ARROW_DIRECTION::INWARD, _HKI( "Inward" ) )
.Map( DIM_ARROW_DIRECTION::OUTWARD, _HKI( "Outward" ) );
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( PCB_DIMENSION_BASE );

4
pcbnew/pcb_dimension.h

@ -70,9 +70,9 @@ enum class DIM_TEXT_POSITION
*/
enum class DIM_UNITS_MODE
{
INCHES,
IN,
MILS,
MILLIMETRES,
MM,
AUTOMATIC
};

4
pcbnew/pcb_edit_frame.cpp

@ -804,8 +804,8 @@ void PCB_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::toggleGridOverrides, CHECK( cond.GridOverrides() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::togglePolarCoords, CHECK( cond.PolarCoordinates() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::IN ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );

6
pcbnew/pcb_io/altium/altium_parser_pcb.cpp

@ -444,10 +444,10 @@ ADIMENSION6::ADIMENSION6( ALTIUM_BINARY_PARSER& aReader )
wxString dimensionunit = ALTIUM_PROPS_UTILS::ReadString( props, wxT( "TEXTDIMENSIONUNIT" ), wxT( "Millimeters" ) );
if( dimensionunit == wxT( "Inches" ) ) textunit = ALTIUM_UNIT::INCHES;
if( dimensionunit == wxT( "Inches" ) ) textunit = ALTIUM_UNIT::IN;
else if( dimensionunit == wxT( "Mils" ) ) textunit = ALTIUM_UNIT::MILS;
else if( dimensionunit == wxT( "Millimeters" ) ) textunit = ALTIUM_UNIT::MILLIMETERS;
else if( dimensionunit == wxT( "Centimeters" ) ) textunit = ALTIUM_UNIT::CENTIMETER;
else if( dimensionunit == wxT( "Millimeters" ) ) textunit = ALTIUM_UNIT::MM;
else if( dimensionunit == wxT( "Centimeters" ) ) textunit = ALTIUM_UNIT::CM;
else textunit = ALTIUM_UNIT::UNKNOWN;
if( aReader.HasParsingError() )

8
pcbnew/pcb_io/altium/altium_parser_pcb.h

@ -50,10 +50,10 @@ enum class ALTIUM_UNIT
{
UNKNOWN = 0,
INCHES = 1,
MILS = 2,
MILLIMETERS = 3,
CENTIMETER = 4
IN = 1,
MILS = 2,
MM = 3,
CM = 4
};
enum class ALTIUM_CLASS_KIND

34
pcbnew/pcb_io/altium/altium_pcb.cpp

@ -1646,18 +1646,11 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem )
switch( aElem.textunit )
{
case ALTIUM_UNIT::INCHES:
dimension->SetUnits( EDA_UNITS::INCHES );
break;
case ALTIUM_UNIT::MILS:
dimension->SetUnits( EDA_UNITS::MILS );
break;
case ALTIUM_UNIT::MILLIMETERS:
case ALTIUM_UNIT::CENTIMETER:
dimension->SetUnits( EDA_UNITS::MILLIMETRES );
break;
default:
break;
case ALTIUM_UNIT::IN: dimension->SetUnits( EDA_UNITS::IN ); 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;
default: break;
}
m_board->Add( dimension.release(), ADD_MODE::APPEND );
@ -1704,18 +1697,11 @@ void ALTIUM_PCB::HelperParseDimensions6Radial(const ADIMENSION6 &aElem)
switch( aElem.textunit )
{
case ALTIUM_UNIT::INCHES:
dimension->SetUnits( EDA_UNITS::INCHES );
break;
case ALTIUM_UNIT::MILS:
dimension->SetUnits( EDA_UNITS::MILS );
break;
case ALTIUM_UNIT::MILLIMETERS:
case ALTIUM_UNIT::CENTIMETER:
dimension->SetUnits( EDA_UNITS::MILLIMETRES );
break;
default:
break;
case ALTIUM_UNIT::IN: dimension->SetUnits( EDA_UNITS::IN ); 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;
default: break;
}
if( aElem.textPoint.empty() )

4
pcbnew/pcb_io/cadstar/cadstar_pcb_archive_loader.cpp

@ -3721,11 +3721,11 @@ void CADSTAR_PCB_ARCHIVE_LOADER::applyDimensionSettings( const DIMENSION& aCads
aCadstarDim.ID ) );
KI_FALLTHROUGH;
case UNITS::MM:
aKiCadDim->SetUnitsMode( DIM_UNITS_MODE::MILLIMETRES );
aKiCadDim->SetUnitsMode( DIM_UNITS_MODE::MM );
break;
case UNITS::INCH:
aKiCadDim->SetUnitsMode( DIM_UNITS_MODE::INCHES );
aKiCadDim->SetUnitsMode( DIM_UNITS_MODE::IN );
break;
case UNITS::THOU:

6
pcbnew/pcb_io/eagle/pcb_io_eagle.cpp

@ -1045,7 +1045,7 @@ void PCB_IO_EAGLE::loadPlain( wxXmlNode* aGraphics )
dimension->SetTextSize( textSize );
dimension->SetTextThickness( textThickness );
dimension->SetLineThickness( designSettings.GetLineThickness( layer ) );
dimension->SetUnits( EDA_UNITS::MILLIMETRES );
dimension->SetUnits( EDA_UNITS::MM );
}
else if( d.dimensionType == wxT( "leader" ) )
{
@ -1096,7 +1096,7 @@ void PCB_IO_EAGLE::loadPlain( wxXmlNode* aGraphics )
dimension->SetTextSize( textSize );
dimension->SetTextThickness( textThickness );
dimension->SetLineThickness( designSettings.GetLineThickness( layer ) );
dimension->SetUnits( EDA_UNITS::MILLIMETRES );
dimension->SetUnits( EDA_UNITS::MM );
// check which axis the dimension runs in
// because the "height" of the dimension is perpendicular to that axis
@ -2667,7 +2667,7 @@ void PCB_IO_EAGLE::loadClasses( wxXmlNode* aClasses )
entry.first,
eClass.name,
m_classMap[ entry.first ]->GetName(),
EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, EDA_UNITS::MILLIMETRES, entry.second.ToPcbUnits() ) );
EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, EDA_UNITS::MM, entry.second.ToPcbUnits() ) );
m_customRules += wxT( "\n" ) + rule;
}

2
pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp

@ -4032,7 +4032,7 @@ PCB_DIMENSION_BASE* PCB_IO_KICAD_SEXPR_PARSER::parseDIMENSION( BOARD_ITEM* aPare
if( isLegacyDimension )
{
EDA_UNITS units = EDA_UNITS::MILLIMETRES;
EDA_UNITS units = EDA_UNITS::MM;
if( !EDA_UNIT_UTILS::FetchUnitsFromString( dim->GetText(), units ) )
dim->SetAutoUnits( true ); //Not determined => use automatic units

13
pcbnew/pcb_painter.cpp

@ -2576,14 +2576,11 @@ void PCB_PAINTER::draw( const PCB_TABLE* aTable, int aLayer )
{
setupStroke( aTable->GetBorderStroke() );
std::vector<VECTOR2I> topLeft = aTable->GetCell( 0, 0 )->GetCornersInSequence();
std::vector<VECTOR2I> bottomLeft =
aTable->GetCell( aTable->GetRowCount() - 1, 0 )->GetCornersInSequence();
std::vector<VECTOR2I> topRight =
aTable->GetCell( 0, aTable->GetColCount() - 1 )->GetCornersInSequence();
std::vector<VECTOR2I> bottomRight =
aTable->GetCell( aTable->GetRowCount() - 1, aTable->GetColCount() - 1 )
->GetCornersInSequence();
std::vector<VECTOR2I> topLeft = aTable->GetCell( 0, 0 )->GetCornersInSequence();
std::vector<VECTOR2I> bottomLeft = aTable->GetCell( aTable->GetRowCount() - 1, 0 )->GetCornersInSequence();
std::vector<VECTOR2I> topRight = aTable->GetCell( 0, aTable->GetColCount() - 1 )->GetCornersInSequence();
std::vector<VECTOR2I> bottomRight = aTable->GetCell( aTable->GetRowCount() - 1, aTable->GetColCount() - 1 )->GetCornersInSequence();
strokeLine( topLeft[0], topRight[1] );
strokeLine( topRight[1], bottomRight[2] );
strokeLine( bottomRight[2], bottomLeft[3] );

9
pcbnew/pcb_plot_params.cpp

@ -104,8 +104,8 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
m_svgPrecision = SVG_PRECISION_DEFAULT;
m_plotDrawingSheet = false;
m_plotMode = FILLED;
m_DXFPolygonMode = true;
m_DXFUnits = DXF_UNITS::INCHES;
m_DXFPolygonMode = true;
m_DXFUnits = DXF_UNITS::IN;
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::INCHES );
m_DXFUnits == DXF_UNITS::IN );
KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_dxfusepcbnewfont ),
m_textMode != PLOT_TEXT_MODE::NATIVE );
@ -776,8 +776,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams )
break;
case T_dxfimperialunits:
aPcbPlotParams->m_DXFUnits = parseBool() ? DXF_UNITS::INCHES
: DXF_UNITS::MILLIMETERS;
aPcbPlotParams->m_DXFUnits = parseBool() ? DXF_UNITS::IN : DXF_UNITS::MM;
break;
case T_dxfusepcbnewfont:

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save